openpond 0.2.64 → 0.2.66
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/dist/app-server.js +1 -1
- package/dist/chunks/{acp-G5GCLP44.js → acp-YYZ3ZO3Q.js} +1 -1
- package/dist/chunks/{acp-agent-JM5THNMF.js → acp-agent-T26S7TU2.js} +1 -1
- package/dist/chunks/{app-layer-DZHMJUBC.js → app-layer-5XUMNHDO.js} +1 -1
- package/dist/chunks/{app-server-runtime-6LCX46RF.js → app-server-runtime-TH56EG2Z.js} +1 -1
- package/dist/chunks/{apps-7LPKIYRY.js → apps-MNT3KXIY.js} +1 -1
- package/dist/chunks/chunk-2ZNW6GUU.js +2 -0
- package/dist/chunks/{chunk-SQX22LQT.js → chunk-BQVB2SPF.js} +5 -5
- package/dist/chunks/{chunk-GKLZQN6P.js → chunk-JKI53ED7.js} +2 -2
- package/dist/chunks/{chunk-EW7CD7OA.js → chunk-NABPZ7AK.js} +1 -1
- package/dist/chunks/{chunk-KGUPAPGR.js → chunk-PLVWARB7.js} +1 -1
- package/dist/chunks/chunk-SBQ6KLXB.js +33 -0
- package/dist/chunks/{chunk-HQQJKWZY.js → chunk-UXPO3ZV7.js} +2 -2
- package/dist/chunks/{command-NDHFZAKA.js → command-NW6BGKOM.js} +3 -3
- package/dist/chunks/{configuration-command-HPMGH7WR.js → configuration-command-4WTS2MZS.js} +1 -1
- package/dist/chunks/{connected-evidence-FNHTBUDG.js → connected-evidence-D7C45HYD.js} +1 -1
- package/dist/chunks/{connected-starting-assets-O4X6D6BG.js → connected-starting-assets-4LDXQVLN.js} +1 -1
- package/dist/chunks/{core-commands-LEFFBKR7.js → core-commands-RXPXOYOP.js} +1 -1
- package/dist/chunks/{datasets-BWHI23IB.js → datasets-LBLEKLCS.js} +1 -1
- package/dist/chunks/{desktop-test-XROQ7K5H.js → desktop-test-INJPZ5VP.js} +1 -1
- package/dist/chunks/{evaluation-coordination-JTQIKHW6.js → evaluation-coordination-3ARLJAFH.js} +1 -1
- package/dist/chunks/{experiment-improvements-2TV2DA3K.js → experiment-improvements-UB4C5CSP.js} +1 -1
- package/dist/chunks/{experiments-VUJ4SEMG.js → experiments-AHHKFJD6.js} +1 -1
- package/dist/chunks/{experiments-signal-TSTEBORD.js → experiments-signal-MTR475QV.js} +1 -1
- package/dist/chunks/{help-OPN36XRA.js → help-JQA3YMCX.js} +1 -1
- package/dist/chunks/{hosted-app-server-composition-7WZ4RIX2.js → hosted-app-server-composition-GPXH3BOG.js} +1 -1
- package/dist/chunks/{human-review-NVKBEYG5.js → human-review-DVHVJXBA.js} +1 -1
- package/dist/chunks/{import-P5DCYMQ6.js → import-CLWTKDG6.js} +1 -1
- package/dist/chunks/{opchat-ZJ5DO4RT.js → opchat-LMKH3OWR.js} +1 -1
- package/dist/chunks/{opchat-bounded-chat-JVZ5LRH2.js → opchat-bounded-chat-PPOWO7H4.js} +1 -1
- package/dist/chunks/{organizations-UKXORVYS.js → organizations-T6ZUSHNJ.js} +1 -1
- package/dist/chunks/{profile-XL5LABHR.js → profile-RIDNU2I5.js} +1 -1
- package/dist/chunks/{project-agent-CCGEMNR7.js → project-agent-GBMVDJY3.js} +1 -1
- package/dist/chunks/{sandbox-command-L6BMKDGY.js → sandbox-command-L5VQ2T6C.js} +1 -1
- package/dist/chunks/{sandbox-template-QL5ID5GJ.js → sandbox-template-NN3XQI7M.js} +1 -1
- package/dist/chunks/{setup-HSRCZ3WR.js → setup-TXEM2QSG.js} +1 -1
- package/dist/chunks/{src-KWOSLOBH.js → src-HJHIBDFX.js} +1 -1
- package/dist/chunks/{teams-bot-LGV7UKX2.js → teams-bot-FXMCOCPP.js} +1 -1
- package/dist/chunks/{tool-learning-NGO7QHYK.js → tool-learning-O7QTTEDB.js} +1 -1
- package/dist/cli.js +1 -1
- package/dist/skills/manifest.json +1 -1
- package/dist/web/assets/{App-BZuSv1XM.js → App-CNQi3RlI.js} +4 -4
- package/dist/web/assets/{AppDialog-BILEK4np.js → AppDialog-DuSd0wk6.js} +1 -1
- package/dist/web/assets/{AppTerminalPanel-BvxZ8bwD.js → AppTerminalPanel-DLz34eSs.js} +2 -2
- package/dist/web/assets/{AppToastContext-C-FsCKXW.js → AppToastContext-Dklk6CaG.js} +1 -1
- package/dist/web/assets/{AppsView-BMaq5oxx.js → AppsView-DkCMr67-.js} +1 -1
- package/dist/web/assets/{AttachmentTypeIcon-Bh7Ft_UL.js → AttachmentTypeIcon-DipNT6Tj.js} +1 -1
- package/dist/web/assets/{BrowserSidebar-BG2MLJ9I.js → BrowserSidebar-BBaaanMS.js} +1 -1
- package/dist/web/assets/{CartesianChart-CS6ES_XT.js → CartesianChart-UU1sdoUO.js} +1 -1
- package/dist/web/assets/{ChatTimelineEntry-Dr5X_XyN.js → ChatTimelineEntry-Ct59FKw1.js} +1 -1
- package/dist/web/assets/{CollaborationTabs-CPJ2w67F.js → CollaborationTabs-BWYRQ1PE.js} +1 -1
- package/dist/web/assets/{CommandMenu-Fe1V7NJd.js → CommandMenu-B08F9x5g.js} +1 -1
- package/dist/web/assets/{CommunityView-DHTcmOnI.js → CommunityView-BLTlSxyb.js} +1 -1
- package/dist/web/assets/{ComposerAttachments-Ck9VWD6o.js → ComposerAttachments-srWBKvCv.js} +1 -1
- package/dist/web/assets/{ComposerCreateImproveStrip-yiXO7cf8.js → ComposerCreateImproveStrip-DqTpU5cO.js} +1 -1
- package/dist/web/assets/{ConversationImportsSettings-_VLzUnHQ.js → ConversationImportsSettings-2KC-KQvu.js} +1 -1
- package/dist/web/assets/{FilePagePreview-BpcM1DfE.js → FilePagePreview-B-iUVPhh.js} +2 -2
- package/dist/web/assets/{GetStartedView-BH-WJ-rW.js → GetStartedView-5v0vBWXy.js} +1 -1
- package/dist/web/assets/{GettingStartedDialog-CdQfj7RA.js → GettingStartedDialog-Bn4072K-.js} +1 -1
- package/dist/web/assets/{HostedModelLearningReview-C3GsOlu9.js → HostedModelLearningReview-DWF6WPao.js} +1 -1
- package/dist/web/assets/{HostedModelLearningSettings-SSMst6dl.js → HostedModelLearningSettings-BYl-2j7B.js} +1 -1
- package/dist/web/assets/{HtmlVisual-CH0tb3fv.js → HtmlVisual-C2WsMj90.js} +1 -1
- package/dist/web/assets/{LabModelVersionDetailPage-J2t9yILv.js → LabModelVersionDetailPage-CQz29DwD.js} +1 -1
- package/dist/web/assets/{LabSkillSidebar-DdDYvfj2.js → LabSkillSidebar-C50P74LI.js} +1 -1
- package/dist/web/assets/{LabsRoute-MJwIjSKg.js → LabsRoute-DJRgF1kQ.js} +6 -6
- package/dist/web/assets/{MainChatThread-BcwtaTDZ.js → MainChatThread-gwmhe1Nw.js} +2 -2
- package/dist/web/assets/{MainPane-DDO6diPt.js → MainPane-CqtgV9rU.js} +5 -5
- package/dist/web/assets/{NativeSetupTerminal-BPSUFpRm.js → NativeSetupTerminal-DrQldDsG.js} +2 -2
- package/dist/web/assets/{NativeSkillSidebar-DPYavzau.js → NativeSkillSidebar-Clv0IWyn.js} +1 -1
- package/dist/web/assets/{NewProjectDialog-BtmvE9Sp.js → NewProjectDialog-Cw_F5Eaa.js} +1 -1
- package/dist/web/assets/{OutputsPage-BMRY7RK2.js → OutputsPage-Btyiie4B.js} +1 -1
- package/dist/web/assets/{PageChrome-5VRxH6Rp.js → PageChrome-BLLw_cEA.js} +1 -1
- package/dist/web/assets/{ProjectsPage-1LHqxOMo.js → ProjectsPage-BpSHWQgj.js} +1 -1
- package/dist/web/assets/{RightChatPanelStack-D_7KgExz.js → RightChatPanelStack-xW5rKbp0.js} +1 -1
- package/dist/web/assets/RightSidebarHomePanel-BDmIxvIm.js +1 -0
- package/dist/web/assets/{ScheduledWorkPage-Dtz4zJ0T.js → ScheduledWorkPage-WytWGQgw.js} +1 -1
- package/dist/web/assets/{SettingsView-BeDYNPcD.js → SettingsView-BJq5zNkv.js} +3 -3
- package/dist/web/assets/{TasksetDraftEditorPrimitives-CcvKO3YA.js → TasksetDraftEditorPrimitives-BxFEWI9W.js} +1 -1
- package/dist/web/assets/{TeamChatView-DaXxOkTe.js → TeamChatView-BisSMAXy.js} +1 -1
- package/dist/web/assets/{TerminalOverlay-CF8uB4qA.js → TerminalOverlay-C7OM2F0-.js} +1 -1
- package/dist/web/assets/{TrainingCreationPanel-DmMO7x5T.js → TrainingCreationPanel-KH5GFacT.js} +1 -1
- package/dist/web/assets/{TrainingDraftPanel-DCHbXjSx.js → TrainingDraftPanel-DzOw13Md.js} +1 -1
- package/dist/web/assets/{TrainingRunLineage-CwisTWs_.js → TrainingRunLineage-B2WBOchk.js} +1 -1
- package/dist/web/assets/{UsageSettingsSection-Drt7gwRb.js → UsageSettingsSection-nZHno_4P.js} +1 -1
- package/dist/web/assets/WorkSidebarPanel-D3Ub_jVj.js +1 -0
- package/dist/web/assets/{WorkspaceDiffPanel-Dmbrg0-y.js → WorkspaceDiffPanel-CyTa8Cjs.js} +3 -3
- package/dist/web/assets/{WorkspaceEnvironmentMenu-KEZm1gdb.js → WorkspaceEnvironmentMenu-CtZzxQ1e.js} +1 -1
- package/dist/web/assets/{WorkspaceFileLocation-ChbOKrPO.js → WorkspaceFileLocation-1U8DDj1J.js} +1 -1
- package/dist/web/assets/{WorkspaceGitDialogs-BS2JQKNQ.js → WorkspaceGitDialogs-BO1EUA3G.js} +1 -1
- package/dist/web/assets/{WorkspaceMonacoEditor-CN1hE_C4.js → WorkspaceMonacoEditor-Rqq_sKW_.js} +3 -3
- package/dist/web/assets/{WorkspacePdfPreview-Clb4m0le.js → WorkspacePdfPreview-zmmMp09R.js} +2 -2
- package/dist/web/assets/{WorkspacePresentationPreview-CwQsdvAR.js → WorkspacePresentationPreview-DNbhGjkE.js} +1 -1
- package/dist/web/assets/{bot-BNFltD5O.js → bot-D-eTQib6.js} +1 -1
- package/dist/web/assets/{chevron-down-BnnT0tnM.js → chevron-down-75im8nFF.js} +1 -1
- package/dist/web/assets/chevron-right-CpbCIUFo.js +1 -0
- package/dist/web/assets/{chevron-up-BAnwJJN3.js → chevron-up-BD8jg0bQ.js} +1 -1
- package/dist/web/assets/{client-choice-storage-Iuzoszas.js → client-choice-storage-CXlWJW5g.js} +1 -1
- package/dist/web/assets/{cloud-upload-CdSXJ7ms.js → cloud-upload-4lP-5zmp.js} +1 -1
- package/dist/web/assets/{copy-CBFg6m0d.js → copy-DRnATDDY.js} +1 -1
- package/dist/web/assets/{createLucideIcon-DF2VR6WA.js → createLucideIcon-CmkSm39S.js} +1 -1
- package/dist/web/assets/{cssMode-BSQUZhUO.js → cssMode-Cps-05f3.js} +1 -1
- package/dist/web/assets/{external-link-Cql9bKdv.js → external-link-D_nBEDFO.js} +1 -1
- package/dist/web/assets/{folder-open-BXdVB5J1.js → folder-open-tD5Lle1M.js} +1 -1
- package/dist/web/assets/{folder-plus-Cma2HulC.js → folder-plus-DlZ4hM48.js} +1 -1
- package/dist/web/assets/{git-commit-horizontal-eF--16ps.js → git-commit-horizontal-g8KBhvfr.js} +1 -1
- package/dist/web/assets/{htmlMode-aLPlQtyU.js → htmlMode-Do72TyNy.js} +1 -1
- package/dist/web/assets/icons-B8_Rkg-l.js +1 -0
- package/dist/web/assets/{image-CqKPwnBn.js → image-CUZMnZYi.js} +1 -1
- package/dist/web/assets/{index-CM0IRu1U.js → index-D7igQSAg.js} +2 -2
- package/dist/web/assets/{info-CqeYEqG0.js → info-SmuBZiE5.js} +1 -1
- package/dist/web/assets/{jsonMode-fu7bEcHB.js → jsonMode-B2N7W15Y.js} +1 -1
- package/dist/web/assets/loader-circle-D_KVxLLz.js +1 -0
- package/dist/web/assets/{lspLanguageFeatures-DraXQA4w.js → lspLanguageFeatures-DPmyOFVA.js} +1 -1
- package/dist/web/assets/{maximize-2-yMp8X9ts.js → maximize-2-B8HN3jsA.js} +1 -1
- package/dist/web/assets/{message-square-DbIMQqfj.js → message-square-CrDvzn66.js} +1 -1
- package/dist/web/assets/{monaco.contribution-Bd8EqYGR.js → monaco.contribution-BfOxF9PJ.js} +2 -2
- package/dist/web/assets/{monaco.contribution-BQhp1CJs.js → monaco.contribution-CRdTg0FH.js} +2 -2
- package/dist/web/assets/{monaco.contribution-CYWKnVxQ.js → monaco.contribution-DNONXznc.js} +2 -2
- package/dist/web/assets/{monaco.contribution-CmbWO0tB.js → monaco.contribution-DqqJBDzF.js} +2 -2
- package/dist/web/assets/{monitor-DFE2fTkT.js → monitor-CW-M_aaj.js} +1 -1
- package/dist/web/assets/{paperclip-D_qsKbVs.js → paperclip-DL449Io5.js} +1 -1
- package/dist/web/assets/{pdf-DkQRsi4n.js → pdf-BCq2Oosd.js} +1 -1
- package/dist/web/assets/play-DYLqBrwg.js +1 -0
- package/dist/web/assets/plus-DXZIpQuY.js +1 -0
- package/dist/web/assets/{presentation-BN_kIBPL.js → presentation-CupIXaYv.js} +1 -1
- package/dist/web/assets/{python-DB9pj5Hr.js → python-DuGMr666.js} +1 -1
- package/dist/web/assets/{refresh-cw-B27ohHfn.js → refresh-cw-CzVf5_oo.js} +1 -1
- package/dist/web/assets/{save-D-rwjKop.js → save-DatjrYPV.js} +1 -1
- package/dist/web/assets/{settings-lists-DgSaJQA4.js → settings-lists-D2ol3uNK.js} +1 -1
- package/dist/web/assets/square-BWB1nbZF.js +1 -0
- package/dist/web/assets/{square-terminal-CeoK51wH.js → square-terminal-Buj-s-fz.js} +1 -1
- package/dist/web/assets/{submit-issue-command-DZNW7Evj.js → submit-issue-command-wfngGS6Y.js} +1 -1
- package/dist/web/assets/{toggleHighContrast-Bs8L1gx0.js → toggleHighContrast-cl0cw2QK.js} +1 -1
- package/dist/web/assets/{training-model-data-wHvE7xL1.js → training-model-data-CWnu1bz9.js} +1 -1
- package/dist/web/assets/{tsMode-C7EqshxC.js → tsMode-DLEc0PYL.js} +1 -1
- package/dist/web/assets/{upload-BWgjC2Jf.js → upload-DaFVH6R1.js} +1 -1
- package/dist/web/assets/{useAccountSettings-Dva1MpsJ.js → useAccountSettings-ByxjI9BG.js} +1 -1
- package/dist/web/assets/{useAgentInventory-CrjIOmvb.js → useAgentInventory-Df64T07n.js} +1 -1
- package/dist/web/assets/{useLocalAgentSchedules-P-UaUKMb.js → useLocalAgentSchedules-DNh_x9gQ.js} +1 -1
- package/dist/web/assets/{useQuery-Bn3KqR4r.js → useQuery-yUz7Ui8g.js} +1 -1
- package/dist/web/assets/{wifi-off--mKrSPFc.js → wifi-off-CtNwnIJc.js} +1 -1
- package/dist/web/assets/{workers-p0Kn2KMK.js → workers-CnqrOtic.js} +1 -1
- package/dist/web/assets/x-Bhl-4Zlt.js +1 -0
- package/dist/web/assets/{yaml-BeIdC4tu.js → yaml-C9vtYV4w.js} +1 -1
- package/dist/web/index.html +1 -1
- package/package.json +1 -1
- package/dist/chunks/chunk-LOIYNRBC.js +0 -33
- package/dist/chunks/chunk-MMJU6PZV.js +0 -2
- package/dist/web/assets/RightSidebarHomePanel-iznJwDMf.js +0 -1
- package/dist/web/assets/WorkSidebarPanel-BrIIRtGW.js +0 -1
- package/dist/web/assets/chevron-right-C8K5PZj7.js +0 -1
- package/dist/web/assets/icons-c3vt7y6n.js +0 -1
- package/dist/web/assets/loader-circle-pxp89T5x.js +0 -1
- package/dist/web/assets/play-BtlX2stU.js +0 -1
- package/dist/web/assets/plus-DbASL_gy.js +0 -1
- package/dist/web/assets/square-C2caJ3NG.js +0 -1
- package/dist/web/assets/x-D9GTV9ke.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TerminalOverlay-
|
|
2
|
-
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{g as t,h as n,m as r,t as i}from"./index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TerminalOverlay-C7OM2F0-.js","assets/rolldown-runtime-Dd_uD5pT.js","assets/index-D7igQSAg.js","assets/index-g7UqJhnX.css","assets/api-client-Dgz-fOMl.js","assets/icons-B8_Rkg-l.js","assets/chevron-down-75im8nFF.js","assets/createLucideIcon-CmkSm39S.js","assets/plus-DXZIpQuY.js","assets/x-Bhl-4Zlt.js","assets/AppToastContext-Dklk6CaG.js","assets/ui-theme.generated-D-mc26qt.js","assets/App-CNQi3RlI.js","assets/useQuery-yUz7Ui8g.js","assets/schemas-lO3MoWQr.js","assets/common-BMjyKlX-.js","assets/settings-D7C-Auyi.js","assets/client-choice-storage-CXlWJW5g.js","assets/requests-BCbaFiqV.js","assets/create-pipeline-CyUZrbbO.js","assets/profile-ref-DSNkG6Ol.js","assets/chunk-H3JZ3P5T-B0SCoPw4.js","assets/work-outputs-CK0nHe4g.js","assets/contracts-BLiqJxBv.js","assets/training-DCdoHJ0Y.js","assets/chunk-GJRXJL6G-pJp1DyJd.js","assets/reward-checks-Bcq9ETCA.js","assets/intake-contracts-BW0Y0C2R.js","assets/chat-resources-CTN4f6KC.js","assets/ponder-desktop-Dm7tOkKo.js","assets/app-models-Cz3yxq4x.js","assets/model-display-zPvC4L2B.js","assets/submit-issue-command-wfngGS6Y.js","assets/connected-app-mentions-D3wRZLwI.js","assets/profile-agent-labels-Duh96b8x.js","assets/browser-sidebar-links-ZyYiYBBd.js","assets/browser-url-LACq2Ngu.js","assets/query-scope-BRpcgljO.js","assets/bot-D-eTQib6.js","assets/chevron-right-CpbCIUFo.js","assets/copy-DRnATDDY.js","assets/external-link-D_nBEDFO.js","assets/loader-circle-D_KVxLLz.js","assets/maximize-2-B8HN3jsA.js","assets/message-square-CrDvzn66.js","assets/refresh-cw-CzVf5_oo.js","assets/square-terminal-Buj-s-fz.js","assets/models-route-CWcJuOd0.js","assets/PageChrome-BLLw_cEA.js","assets/AppDialog-DuSd0wk6.js","assets/organization-types-PP-yuR2J.js","assets/App-DpFKLxuA.css","assets/TerminalOverlay-DoUFGstN.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{g as t,h as n,m as r,t as i}from"./index-D7igQSAg.js";import{t as a}from"./AppDialog-DuSd0wk6.js";var o=e(t(),1),s=n(),c=r(),l=(0,o.lazy)(()=>i(()=>import(`./TerminalOverlay-C7OM2F0-.js`).then(e=>({default:e.TerminalOverlay})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52])));function u({connection:e,command:t,displayCommand:n=`OpenPond setup`,onClose:r,onComplete:i,modal:u=!1}){let[d,f]=(0,o.useState)([]),[p]=(0,o.useState)(()=>({kind:`draft`,id:`native-setup-${crypto.randomUUID()}`})),m=(0,o.useRef)(!1),[h]=(0,o.useState)(()=>({command:t,displayCommand:n}));(0,o.useEffect)(()=>{!m.current&&d.some(e=>e.lastCommand!==null&&e.lastExitCode===0&&e.commandStatus===`success`)&&(m.current=!0,i?.())},[d,i]);let g=(0,c.jsx)(o.Suspense,{fallback:(0,c.jsx)(`p`,{role:`status`,children:`Opening setup terminal…`}),children:(0,c.jsx)(l,{open:!0,disposeOnUnmount:!0,connection:e,scope:p,tabs:d,onTabsChange:f,cwd:null,appId:null,workspaceName:`Agent setup`,queuedCommand:null,setupCommand:h,onClose:r})});return(0,s.createPortal)(u?(0,c.jsx)(a,{ariaLabel:`Agent setup terminal`,backdropClassName:`native-setup-modal-backdrop`,className:`native-setup-terminal`,onClose:r,children:g}):(0,c.jsx)(`div`,{className:`native-setup-terminal`,children:g}),document.body)}export{u as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{g as t,m as n}from"./index-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{g as t,m as n}from"./index-D7igQSAg.js";import"./icons-B8_Rkg-l.js";import{L as r}from"./training-model-data-CWnu1bz9.js";import{t as i}from"./maximize-2-B8HN3jsA.js";import{t as a}from"./x-Bhl-4Zlt.js";import{Rt as o,an as s}from"./App-CNQi3RlI.js";var c=e(t(),1),l=n();function u({expanded:e,skill:t,onClose:n,onResizeStart:u,onToggleExpanded:d}){let[f,p]=(0,c.useState)({skill:t,path:`SKILL.md`}),m=t.files?.find(e=>f.skill===t&&e.path===f.path)??t.files?.[0],h=m?.path??t.path,g=m?.body??t.body,_=h.split(`/`).at(-1)??h;return(0,l.jsxs)(`aside`,{className:`workspace-diff-panel native-skill-sidebar ${e?`expanded`:``}`,"aria-label":`Skill source: ${t.name}`,children:[e?null:(0,l.jsx)(`div`,{className:`workspace-diff-resize-handle`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize native skill source`,onPointerDown:u}),(0,l.jsxs)(`div`,{className:`workspace-diff-topbar native-skill-sidebar-topbar`,children:[t.files?.length?(0,l.jsx)(o,{compact:!0,floating:!0,label:`Skill file`,value:h,options:t.files.map(e=>({value:e.path,label:e.path})),onChange:e=>p({skill:t,path:e})}):(0,l.jsx)(`div`,{className:`workspace-diff-tabs`,role:`tablist`,"aria-label":`Native skill files`,children:(0,l.jsxs)(`button`,{className:`workspace-diff-tab active`,type:`button`,role:`tab`,"aria-selected":!0,children:[(0,l.jsx)(s,{size:14}),(0,l.jsx)(`span`,{children:_})]})}),(0,l.jsxs)(`div`,{className:`workspace-diff-toolbar-actions`,children:[(0,l.jsx)(`button`,{className:`diff-icon-button`,type:`button`,title:e?`Dock sidebar`:`Expand sidebar`,"aria-label":e?`Dock sidebar`:`Expand sidebar`,onClick:d,children:e?(0,l.jsx)(r,{size:14}):(0,l.jsx)(i,{size:14})}),(0,l.jsx)(`button`,{className:`diff-icon-button`,type:`button`,title:`Close skill source`,"aria-label":`Close skill source`,onClick:n,children:(0,l.jsx)(a,{size:14})})]})]}),(0,l.jsxs)(`div`,{className:`native-skill-sidebar-body`,children:[(0,l.jsxs)(`header`,{className:`native-skill-source-header`,children:[(0,l.jsx)(`h2`,{children:t.name}),(0,l.jsx)(`p`,{children:t.description}),(0,l.jsx)(`code`,{children:h})]}),(0,l.jsx)(`pre`,{className:`native-skill-markdown-source`,"aria-label":`${t.name} Markdown source`,children:(0,l.jsx)(`code`,{children:g})})]})]})}export{u as NativeSkillSidebar};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{g as t,m as n}from"./index-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{g as t,m as n}from"./index-D7igQSAg.js";import"./icons-B8_Rkg-l.js";import{t as r}from"./folder-open-tD5Lle1M.js";import{t as i}from"./folder-plus-DlZ4hM48.js";import{t as a}from"./monitor-CW-M_aaj.js";import{t as o}from"./x-Bhl-4Zlt.js";import{Bt as s,cn as c,in as l}from"./App-CNQi3RlI.js";var u=e(t(),1),d=n();function f({open:e,mode:t=`local`,name:n,path:f,directory:p,busy:m,onNameChange:h,onPathChange:g,onClose:_,onSubmit:v}){let[y,b]=(0,u.useState)([]),[x,S]=(0,u.useState)(``),[C,w]=(0,u.useState)(``),[T,E]=(0,u.useState)(!1),D=(0,u.useRef)(null),O=(0,u.useRef)(null);if((0,u.useEffect)(()=>{if(e)return D.current=document.activeElement instanceof HTMLElement?document.activeElement:null,()=>D.current?.focus()},[e]),!e)return null;let k=t===`cloud`,A=t===`existing-local`,j=k?c:A?r:i,M=k?`New Cloud Project`:A?`Create project`:`New Local Project`,N=k?`Create a hosted project in OpenPond Cloud.`:`Create a new local Git project and add it to Projects.`,P=!!window.openpond?.selectFolder,F=P?`This computer`:`Connected computer`,I=async()=>{if(!P&&!T){E(!0);return}let e=P?await window.openpond.selectFolder():{path:f.trim(),canceled:!1},t=e.path?.trim();t&&!e.canceled&&(y.includes(t)?w(`This folder is already selected.`):(b(e=>[...e,t]),x||S(t),n.trim()||h(t.split(/[\\/]/).filter(Boolean).at(-1)??t),P||(g(``),E(!1)),w(``)))},L=m||(A?!n.trim()||y.length===0:!n.trim()),R=m?`Creating`:k?`Create Cloud Project`:`Create project`;return(0,d.jsx)(`div`,{className:`git-dialog-backdrop`,role:`presentation`,onKeyDown:e=>{e.key===`Escape`&&!m&&(e.stopPropagation(),_())},children:(0,d.jsxs)(`form`,{ref:O,className:`git-dialog new-project-dialog${A?` new-project-collection`:``}`,role:`dialog`,"aria-modal":`true`,"aria-label":`Create project`,onKeyDown:e=>{if(e.key!==`Tab`)return;let t=Array.from(O.current?.querySelectorAll(`button:not(:disabled), input:not(:disabled)`)??[]);if(!t.length)return;let n=t[0],r=t.at(-1);e.shiftKey&&document.activeElement===n?(e.preventDefault(),r?.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n?.focus())},onSubmit:async e=>{e.preventDefault(),w(``),await v(A?{name:n.trim(),sourceFolders:y,primaryFolder:x}:void 0)||w(`Project could not be created. Check the selected folders and try again.`)},children:[(0,d.jsx)(`button`,{className:`git-dialog-close`,disabled:m,type:`button`,onClick:_,children:(0,d.jsx)(o,{size:14})}),A?null:(0,d.jsx)(`div`,{className:`git-dialog-icon`,children:(0,d.jsx)(j,{size:18})}),(0,d.jsx)(`h2`,{children:M}),A?null:(0,d.jsx)(`p`,{children:N}),A?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(`label`,{className:`new-project-name-field`,children:[(0,d.jsx)(l,{size:16,"aria-hidden":`true`}),(0,d.jsx)(`input`,{autoFocus:!0,"aria-label":`Project name`,disabled:m,value:n,onChange:e=>h(e.target.value),placeholder:`Project name`})]}),(0,d.jsxs)(`div`,{className:`new-project-source-heading`,children:[(0,d.jsx)(`span`,{children:`Source folders`}),y.length?(0,d.jsxs)(`span`,{children:[(0,d.jsx)(a,{size:15,"aria-hidden":`true`}),F]}):null]}),(0,d.jsxs)(`div`,{className:`new-project-source-box${y.length?` populated`:` empty`}`,children:[y.length===0?(0,d.jsxs)(`div`,{className:`new-project-empty-source`,children:[(0,d.jsxs)(`span`,{children:[`Add a folder on `,P?`this`:`the connected`,` computer`]}),(0,d.jsxs)(`button`,{type:`button`,disabled:m,onClick:()=>void I(),children:[(0,d.jsx)(i,{size:14,"aria-hidden":`true`}),`Add`]})]}):(0,d.jsx)(`ul`,{className:`new-project-folder-list`,children:y.map(e=>(0,d.jsxs)(`li`,{className:`new-project-folder-row`,children:[(0,d.jsx)(l,{size:15,"aria-hidden":`true`}),(0,d.jsx)(`span`,{title:e,"aria-label":e,children:e.split(/[\\/]/).filter(Boolean).at(-1)??e}),x===e?(0,d.jsx)(`span`,{className:`new-project-primary-pill`,children:`Primary`}):(0,d.jsx)(`button`,{className:`new-project-make-primary`,type:`button`,disabled:m,onClick:()=>S(e),children:`Make primary`}),(0,d.jsx)(`button`,{className:`new-project-remove`,type:`button`,disabled:m,"aria-label":`Remove ${e}`,onClick:()=>{b(t=>{let n=t.filter(t=>t!==e);return x===e&&S(n[0]??``),n})},children:(0,d.jsx)(o,{size:14,"aria-hidden":`true`})})]},e))}),y.length?(0,d.jsxs)(`button`,{className:`new-project-add-row`,type:`button`,disabled:m,onClick:()=>void I(),children:[(0,d.jsx)(i,{size:15,"aria-hidden":`true`}),`Add folder`]}):null,T?(0,d.jsxs)(`label`,{className:`new-project-manual-path`,children:[(0,d.jsx)(`span`,{children:`Folder path on connected computer`}),(0,d.jsx)(`input`,{value:f,onChange:e=>g(e.target.value),placeholder:`/path/to/folder`,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),I())}}),(0,d.jsx)(`button`,{type:`button`,disabled:!f.trim(),onClick:()=>void I(),children:`Add folder`})]}):null]})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(`label`,{className:`git-dialog-field`,children:[(0,d.jsx)(`span`,{children:`Project name`}),(0,d.jsx)(`input`,{autoFocus:!0,disabled:m,placeholder:`New project`,value:n,onChange:e=>h(e.target.value)})]}),(0,d.jsxs)(`div`,{className:`git-dialog-row`,children:[(0,d.jsx)(`span`,{children:`Location`}),(0,d.jsx)(`strong`,{className:`git-dialog-path`,children:k?`OpenPond Cloud`:p})]})]}),C?(0,d.jsx)(s,{error:C}):null,(0,d.jsxs)(`div`,{className:`new-project-footer`,children:[(0,d.jsx)(`button`,{className:`new-project-cancel`,type:`button`,disabled:m,onClick:_,children:`Cancel`}),(0,d.jsx)(`button`,{className:`git-dialog-primary`,disabled:L,type:`submit`,children:R})]})]})})}export{f as NewProjectDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{g as t,m as n}from"./index-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{g as t,m as n}from"./index-D7igQSAg.js";import"./icons-B8_Rkg-l.js";import{C as r,R as i,S as a,z as o}from"./training-model-data-CWnu1bz9.js";import{i as s,n as c,r as l,t as u}from"./presentation-CupIXaYv.js";import{t as d}from"./folder-open-tD5Lle1M.js";import{t as f}from"./image-CUZMnZYi.js";import{t as p}from"./loader-circle-D_KVxLLz.js";import{t as m}from"./x-Bhl-4Zlt.js";import{Bt as h,an as g,bn as _,on as v}from"./App-CNQi3RlI.js";var y=e(t(),1),b=`application/vnd.openxmlformats-officedocument.wordprocessingml.document`,x=`application/vnd.openxmlformats-officedocument.presentationml.presentation`,S=`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`;function C(e){let t=e.contentType.toLowerCase(),n=e.title.toLowerCase();return t===b||n.endsWith(`.docx`)?{label:`Document`,type:`document`}:t===`application/pdf`||n.endsWith(`.pdf`)?{label:`PDF`,type:`pdf`}:t===x||n.endsWith(`.pptx`)?{label:`Presentation`,type:`presentation`}:t===S||t===`text/csv`||t===`text/tab-separated-values`||n.endsWith(`.xlsx`)||n.endsWith(`.csv`)||n.endsWith(`.tsv`)?{label:`Table`,type:`table`}:t===`text/html`||n.endsWith(`.html`)?{label:`HTML`,type:`html`}:t===`application/json`||t===`text/markdown`||t===`text/plain`?{label:`Text`,type:`text`}:t.startsWith(`image/`)?{label:`Image`,type:`image`}:t.startsWith(`audio/`)?{label:`Audio`,type:`audio`}:t.startsWith(`video/`)?{label:`Video`,type:`video`}:{label:`File`,type:`file`}}function w(e){return[...e].sort((e,t)=>T(t.createdAt)-T(e.createdAt)||t.revision-e.revision)}function T(e){let t=new Date(e).getTime();return Number.isNaN(t)?0:t}var E=15e3,D=new Map;function O(e){let t=(0,y.useMemo)(()=>e?j(e):null,[e]),n=t?k(t):null,[r,i]=(0,y.useState)(n??[]),[a,o]=(0,y.useState)(!!e&&!n),[s,c]=(0,y.useState)(null);return(0,y.useEffect)(()=>{let n=!1;if(!e||!t){i([]),o(!1),c(null);return}let r=k(t);return i(r??[]),o(!r),c(null),A(e).then(e=>{n||i(e)}).catch(e=>{n||c(M(e))}).finally(()=>{n||o(!1)}),()=>{n=!0}},[t,e]),{error:s,loading:a,outputs:r}}function k(e){let t=D.get(e);return t&&t.refreshedAt>0?t.outputs:null}function A(e){let t=j(e),n=D.get(t);if(n?.request)return n.request;if(n&&n.refreshedAt>0&&Date.now()-n.refreshedAt<E)return Promise.resolve(n.outputs);let r=_.workOutputs(e).then(e=>w(e.outputs)).then(e=>(D.set(t,{outputs:e,refreshedAt:Date.now(),request:null}),e)).catch(e=>{throw n?D.set(t,{...n,request:null}):D.delete(t),e});return D.set(t,{outputs:n?.outputs??[],refreshedAt:n?.refreshedAt??0,request:r}),r}function j(e){return`${e.serverUrl}\0${e.token}`}function M(e){return e instanceof Error?e.message:`Could not load Work outputs.`}var N=n(),P=`all`,F=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`});function I({connection:e,onViewChat:t}){let{error:n,loading:i,outputs:a}=O(e),[o,s]=(0,y.useState)(P),[c,l]=(0,y.useState)(null),[u,d]=(0,y.useState)(null),[f,m]=(0,y.useState)(null);(0,y.useEffect)(()=>()=>{f?.objectUrl&&URL.revokeObjectURL(f.objectUrl)},[f?.objectUrl]);let g=(0,y.useMemo)(()=>Array.from(new Set(a.map(e=>C(e).label))).sort((e,t)=>e.localeCompare(t)),[a]),b=g.includes(o)?o:P,x=(0,y.useMemo)(()=>b===P?a:a.filter(e=>C(e).label===b),[b,a]);async function S(t){if(!e)return;let n=V(t);d(n),l(null);try{let n=await _.workspaceTool(e,t.sourceTaskId,{action:`work_output_read`,source:`ui_button`,args:{outputId:t.id,revision:t.revision}});if(!n.ok)throw Error(n.output);let r=G(n.data),i=typeof r.contentsBase64==`string`?r.contentsBase64:``;if(!i)throw Error(`The output did not include file data.`);let a=new File([W(i)],t.title,{type:t.contentType}),o=C(t),s=o.type===`text`||o.type===`html`;f?.objectUrl&&URL.revokeObjectURL(f.objectUrl),m({file:a,objectUrl:s?null:URL.createObjectURL(a),output:t,text:s?await a.text():null})}catch(e){l(K(e))}finally{d(null)}}async function w(e){if(e.location.kind!==`local`)return;let t=await r(e.location.path,e.title);!t.ok&&!t.canceled&&l(`Could not save a copy of the Work output.`)}return(0,N.jsxs)(`section`,{"aria-label":`Outputs`,className:`outputs-view${f?` detail-open`:``}`,children:[(0,N.jsx)(`div`,{className:`outputs-scroll`,children:(0,N.jsxs)(`div`,{className:`outputs-content`,children:[a.length>0?(0,N.jsx)(`header`,{className:`outputs-header`,children:(0,N.jsx)(`label`,{className:`outputs-filter`,children:(0,N.jsxs)(`select`,{"aria-label":`Filter files by file type`,onChange:e=>s(e.target.value),value:b,children:[(0,N.jsx)(`option`,{value:P,children:`All file types`}),g.map(e=>(0,N.jsx)(`option`,{value:e,children:e},e))]})})}):null,n||c?(0,N.jsx)(h,{error:c??n}):null,e?i&&a.length===0?(0,N.jsxs)(`div`,{className:`outputs-loading`,role:`status`,children:[(0,N.jsx)(p,{className:`outputs-spin`,size:16}),(0,N.jsx)(`span`,{children:`Loading files`})]}):a.length===0?(0,N.jsx)(B,{children:`Files created in Work will appear here.`}):x.length===0?(0,N.jsx)(B,{children:`No files match this file type.`}):(0,N.jsx)(`div`,{className:`outputs-grid`,"data-testid":`desktop-output-cards`,children:x.map(e=>{let n=C(e),r=V(e);return(0,N.jsxs)(`article`,{className:`output-card`,children:[(0,N.jsxs)(`button`,{"aria-label":`Preview ${e.title}`,className:`output-card-main`,disabled:u===r,onClick:()=>void S(e),type:`button`,children:[(0,N.jsx)(`span`,{className:`output-card-icon`,children:(0,N.jsx)(R,{type:n.type})}),(0,N.jsxs)(`span`,{className:`output-card-copy`,children:[(0,N.jsx)(`strong`,{children:e.title}),(0,N.jsxs)(`small`,{children:[n.label,` · `,H(e.sizeBytes)]}),(0,N.jsxs)(`small`,{children:[`Revision `,e.revision,` ·`,` `,(0,N.jsx)(`time`,{dateTime:e.createdAt,children:U(e.createdAt)})]})]}),u===r?(0,N.jsx)(p,{className:`outputs-spin`,size:15}):null]}),(0,N.jsxs)(`div`,{className:`output-card-actions`,children:[e.location.kind===`local`?(0,N.jsx)(`button`,{"aria-label":`Download ${e.title}`,className:`output-download-button`,onClick:()=>void w(e),title:`Download`,type:`button`,children:(0,N.jsx)(v,{"aria-hidden":`true`,size:14})}):null,(0,N.jsx)(`button`,{onClick:()=>t(e.sourceTaskId),type:`button`,children:`View chat`})]})]},r)})}):(0,N.jsx)(B,{children:`Connect to the local OpenPond server to view outputs.`})]})}),f?(0,N.jsx)(L,{onClose:()=>m(null),onSave:()=>void w(f.output),onViewChat:()=>t(f.output.sourceTaskId),preview:f}):null]})}function L({onClose:e,onSave:t,onViewChat:n,preview:r}){let i=C(r.output);return(0,N.jsxs)(`aside`,{"aria-label":`${r.output.title} preview`,className:`output-detail`,children:[(0,N.jsxs)(`header`,{className:`output-detail-header`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`h2`,{children:r.output.title}),(0,N.jsxs)(`p`,{children:[i.label,` · Revision `,r.output.revision]})]}),(0,N.jsx)(`button`,{"aria-label":`Close output preview`,onClick:e,type:`button`,children:(0,N.jsx)(m,{size:16})})]}),(0,N.jsx)(`div`,{className:`output-preview-surface`,children:r.text===null?i.type===`image`&&r.objectUrl?(0,N.jsx)(`img`,{alt:r.output.title,src:r.objectUrl}):i.type===`pdf`&&r.objectUrl?(0,N.jsx)(`iframe`,{src:r.objectUrl,title:r.output.title}):i.type===`audio`&&r.objectUrl?(0,N.jsx)(`audio`,{controls:!0,src:r.objectUrl}):i.type===`video`&&r.objectUrl?(0,N.jsx)(`video`,{controls:!0,src:r.objectUrl}):(0,N.jsxs)(`div`,{className:`output-native-preview`,children:[(0,N.jsx)(R,{type:i.type}),(0,N.jsx)(`p`,{children:`This file type uses its native application for detailed review.`})]}):i.type===`html`?(0,N.jsx)(`iframe`,{sandbox:``,srcDoc:r.text,title:r.output.title}):(0,N.jsx)(`pre`,{children:r.text})}),(0,N.jsxs)(`div`,{className:`output-detail-actions`,children:[r.output.location.kind===`local`?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(`button`,{onClick:()=>void a(r.output.location.kind===`local`?r.output.location.path:``),type:`button`,children:[(0,N.jsx)(d,{size:14}),`Reveal`]}),(0,N.jsx)(`button`,{"aria-label":`Download ${r.output.title}`,className:`output-download-button`,onClick:t,title:`Download`,type:`button`,children:(0,N.jsx)(v,{"aria-hidden":`true`,size:14})})]}):null,(0,N.jsx)(`button`,{onClick:n,type:`button`,children:`View chat`})]})]})}function R({type:e}){let t=z(e);return(0,N.jsx)(t,{"aria-hidden":`true`,size:18})}function z(e){return e===`audio`?s:e===`html`||e===`text`?o:e===`image`?f:e===`presentation`?u:e===`table`?l:e===`video`?c:e===`file`?i:g}function B({children:e}){return(0,N.jsx)(`p`,{className:`outputs-empty`,children:e})}function V(e){return`${e.sourceTaskId}:${e.id}:${e.revision}`}function H(e){return e<1e3?`${e} B`:e<1e6?`${(e/1e3).toFixed(1)} KB`:`${(e/1e6).toFixed(1)} MB`}function U(e){let t=new Date(e);return Number.isNaN(t.getTime())?`Unknown date`:F.format(t)}function W(e){let t=window.atob(e),n=new ArrayBuffer(t.length),r=new Uint8Array(n);for(let e=0;e<t.length;e+=1)r[e]=t.charCodeAt(e);return n}function G(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function K(e){return e instanceof Error?e.message:`Could not load Work outputs.`}export{I as OutputsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{g as t,h as n,m as r}from"./index-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{g as t,h as n,m as r}from"./index-D7igQSAg.js";var i=e(t(),1),a=n(),o=r(),s=(0,i.createContext)(null);function c({children:e}){let[t,n]=(0,i.useState)(null),[r,a]=(0,i.useState)(null),[c,l]=(0,i.useState)(null),u=(0,i.useMemo)(()=>({title:t,actions:r,activity:c,setTitle:n,setActions:a,setActivity:l}),[t,r,c]);return(0,o.jsx)(s.Provider,{value:u,children:e})}function l({children:e}){return(0,o.jsx)(s.Provider,{value:null,children:e})}function u({children:e,className:t=``}){let n=(0,i.useContext)(s);return(0,o.jsx)(`div`,{ref:n?.setTitle,className:`page-chrome-title-target ${t}`,children:e?(0,o.jsx)(`div`,{className:`page-chrome-fallback`,children:e}):null})}function d({className:e=``}){let t=(0,i.useContext)(s);return(0,o.jsx)(`div`,{ref:t?.setActions,className:e})}function f({title:e,actions:t,fallback:n,children:r}){let c=(0,i.useContext)(s);return c?(0,o.jsxs)(o.Fragment,{children:[c.title?(0,a.createPortal)((0,o.jsx)(`div`,{className:`page-chrome-title`,children:e}),c.title):null,c.actions&&t?(0,a.createPortal)(t,c.actions):null,r]}):n??(0,o.jsxs)(`header`,{children:[e,t]})}export{u as a,c as i,l as n,f as r,d as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{g as t,m as n}from"./index-CM0IRu1U.js";import{h as r}from"./app-models-Cz3yxq4x.js";import"./icons-c3vt7y6n.js";import{t as i}from"./cloud-upload-CdSXJ7ms.js";import{t as a}from"./external-link-Cql9bKdv.js";import{Bt as o,Ht as s,Jt as c,Yt as l,bn as u,cn as d,rn as f,s as p,vn as m}from"./App-BZuSv1XM.js";var h=e(t(),1);function g(e,t){let n=e.project.sourceLabel?.trim()??``;if(e.project.sourceType===`github_repo`&&n){if(/^https?:\/\//i.test(n))return n;if(/^[^/\s]+\/[^/\s]+$/.test(n))return`https://github.com/${n}`}return p({accountBaseUrl:t,organizationSlug:e.project.organizationSlug,projectSlug:e.project.slug})}function _(e,t){return e.kind===`cloud`?g(e,t):e.project.linkedSandboxProject?.sourceRepoUrl??null}function v(e){return e.replace(/^https?:\/\//i,``).replace(/\/$/,``)}async function y(e){let t=window.openpond?.browser;if(t){let n=await t.openExternal({conversationId:`projects`,url:e});if(!n.ok)throw Error(n.error??`Unable to open project URL.`)}else window.open(e,`_blank`,`noopener,noreferrer`)}var b=n();function x({loading:e,workspace:t,linked:n,unavailable:r}){if(e)return(0,b.jsx)(E,{children:`Loading environments…`});if(!n)return(0,b.jsx)(E,{children:`Upload this local project to create cloud development environments.`});if(r)return(0,b.jsx)(E,{error:!0,children:`Unable to load environments.`});if(!t?.environments.length)return(0,b.jsx)(E,{children:`No development environment has been created for this project yet.`});let i=A(t);return(0,b.jsx)(T,{headings:[`Environment`,`Status`,`Branch`,`Default`,`Updated`],children:t.environments.map(({sandbox:e,runtime:t})=>(0,b.jsxs)(`tr`,{children:[(0,b.jsx)(`td`,{children:(0,b.jsx)(`strong`,{children:j(e.metadata,e.id)})}),(0,b.jsx)(`td`,{children:(0,b.jsx)(D,{status:e.state})}),(0,b.jsx)(`td`,{children:(0,b.jsx)(`code`,{children:t?.baseBranch??e.repoRef??`Not available`})}),(0,b.jsx)(`td`,{children:e.id===i?`Preferred`:`—`}),(0,b.jsx)(`td`,{children:I(e.updatedAt)})]},e.id))})}function S({loading:e,workspace:t,linked:n,unavailable:r}){return e?(0,b.jsx)(E,{children:`Loading deployments…`}):n?r||t?.errors.deployments?(0,b.jsx)(E,{error:!0,children:`Unable to load deployments.`}):t?.website?t.deployments.length?(0,b.jsx)(T,{headings:[`Deployment`,`Status`,`Commit`,`Build`,`Created by`,`Created`],children:t.deployments.map(e=>(0,b.jsx)(O,{deployment:e},e.release.id))}):(0,b.jsx)(E,{children:`No deployments yet.`}):(0,b.jsx)(E,{children:`Set up Website before creating a deployment.`}):(0,b.jsx)(E,{children:`Upload this local project before creating deployments.`})}function C({loading:e,workspace:t,linked:n,unavailable:r}){let[i,a]=(0,h.useState)(null);return e?(0,b.jsx)(E,{children:`Loading requests…`}):n?r||t?.errors.requests?(0,b.jsx)(E,{error:!0,children:`Unable to load requests.`}):t?.website?t.requests.length?(0,b.jsx)(`div`,{className:`project-detail-table-frame`,children:(0,b.jsxs)(`table`,{className:`project-detail-table project-request-table`,children:[(0,b.jsx)(`thead`,{children:(0,b.jsxs)(`tr`,{children:[(0,b.jsx)(`th`,{children:`Request`}),(0,b.jsx)(`th`,{children:`Status`}),(0,b.jsx)(`th`,{children:`Runtime`}),(0,b.jsx)(`th`,{children:`Started`}),(0,b.jsx)(`th`,{children:`Duration`})]})}),t.requests.map(e=>{let t=i===e.id;return(0,b.jsxs)(`tbody`,{children:[(0,b.jsxs)(`tr`,{"aria-expanded":t,className:`project-request-row`,onClick:()=>a(t=>t===e.id?null:e.id),children:[(0,b.jsxs)(`td`,{children:[(0,b.jsx)(`code`,{children:e.method}),` `,N(e.path)]}),(0,b.jsx)(`td`,{children:(0,b.jsx)(D,{status:String(e.responseStatus),tone:e.outcome===`failure`?`error`:`success`})}),(0,b.jsx)(`td`,{children:e.coldStart===null?`Unknown`:e.coldStart?`Cold`:`Warm`}),(0,b.jsx)(`td`,{children:I(e.startedAt)}),(0,b.jsx)(`td`,{children:F(e.totalDurationMs)})]}),t?(0,b.jsx)(k,{trace:e}):null]},e.id)})]})}):(0,b.jsx)(E,{children:`No requests yet.`}):(0,b.jsx)(E,{children:`Set up Website to receive requests.`}):(0,b.jsx)(E,{children:`Upload this local project and set up Website to receive requests.`})}function w({loading:e,workspace:t,linked:n,unavailable:r}){if(e)return(0,b.jsx)(E,{children:`Loading website…`});if(!n)return(0,b.jsx)(E,{children:`Upload this local project before setting up Website.`});if(r||t?.errors.website)return(0,b.jsx)(E,{error:!0,children:`Unable to load the website.`});let i=t?.website??null,a=i?.settings.platformDomain?`https://${i.settings.platformDomain}`:null,o=i?.releases.find(e=>e.id===i.settings.activeReleaseId)?.sourceCommitSha??null,s=[[`Public URL`,a?(0,b.jsx)(`a`,{href:a,onClick:e=>{e.preventDefault(),y(a)},children:v(a)}):`Not assigned`],[`Live release`,i?.settings.activeReleaseId?`Active`:`Not published`],[`Source`,o?P(o):`Not available`],[`Account database`,M(t)],[`Availability`,i?.settings.runtimePolicy?.availabilityMode===`always_on`?`Always on`:`On demand`]];return(0,b.jsxs)(`div`,{className:`project-detail-table-frame`,children:[(0,b.jsxs)(`table`,{className:`project-detail-table`,children:[(0,b.jsx)(`thead`,{children:(0,b.jsxs)(`tr`,{children:[(0,b.jsx)(`th`,{children:`Setting`}),(0,b.jsx)(`th`,{children:`Value`})]})}),(0,b.jsx)(`tbody`,{children:s.map(([e,t])=>(0,b.jsxs)(`tr`,{children:[(0,b.jsx)(`td`,{children:e}),(0,b.jsx)(`td`,{children:t})]},e))})]}),i?null:(0,b.jsx)(`div`,{className:`project-detail-table-note`,children:`Website has not been set up for this project.`})]})}function T({headings:e,children:t}){return(0,b.jsx)(`div`,{className:`project-detail-table-frame`,children:(0,b.jsxs)(`table`,{className:`project-detail-table`,children:[(0,b.jsx)(`thead`,{children:(0,b.jsx)(`tr`,{children:e.map(e=>(0,b.jsx)(`th`,{children:e},e))})}),(0,b.jsx)(`tbody`,{children:t})]})})}function E({children:e,error:t=!1}){return(0,b.jsx)(`div`,{className:`project-detail-empty${t?` error`:``}`,children:e})}function D({status:e,tone:t}){return(0,b.jsx)(`span`,{className:`project-detail-status${t?` ${t}`:``}`,children:e.replaceAll(`_`,` `)})}function O({deployment:e}){let{build:t,release:n}=e;return(0,b.jsxs)(`tr`,{children:[(0,b.jsx)(`td`,{children:(0,b.jsxs)(`strong`,{children:[`v`,n.version]})}),(0,b.jsx)(`td`,{children:(0,b.jsx)(D,{status:n.status,tone:n.status===`failed`?`error`:n.status===`active`||n.status===`ready`?`success`:void 0})}),(0,b.jsx)(`td`,{children:(0,b.jsx)(`code`,{children:n.sourceCommitSha?P(n.sourceCommitSha):`Not available`})}),(0,b.jsx)(`td`,{children:t?`${t.status.replaceAll(`_`,` `)} · ${t.currentStage.replaceAll(`_`,` `)}`:`Not started`}),(0,b.jsx)(`td`,{children:e.creatorName??`Unknown`}),(0,b.jsx)(`td`,{children:I(n.createdAt)})]})}function k({trace:e}){return(0,b.jsx)(`tr`,{className:`project-request-detail`,children:(0,b.jsxs)(`td`,{colSpan:5,children:[(0,b.jsx)(`dl`,{children:e.stages.map((e,t)=>(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`dt`,{children:[e.name.replaceAll(`_`,` `),e.errorCode?` · ${e.errorCode}`:``]}),(0,b.jsx)(`dd`,{children:F(e.durationMs)})]},`${e.name}:${t}`))}),e.errorCode?(0,b.jsx)(`p`,{children:e.errorCode}):null]})})}function A(e){let t=e.project.metadata.preferredDevelopmentSandboxId;return typeof t==`string`&&t.trim()?t:null}function j(e,t){for(let t of[`name`,`label`,`environmentName`]){let n=e[t];if(typeof n==`string`&&n.trim())return n}return t.length>18?t.slice(0,18):t}function M(e){return e?.website?e.errors.database?`Unavailable`:e.database?.status===`ready`?`Connected · ${e.database.provider}`:e.database?.status===`provisioning`?`Connecting…`:`Not connected`:`Set up the website first`}function N(e){let t=e.indexOf(`/ingress`);return t===-1?e:`/api${e.slice(t+8)||`/`}`}function P(e){return e.length>12?e.slice(0,12):e}function F(e){return e<1e3?`${Math.round(e)} ms`:`${(e/1e3).toFixed(e<1e4?2:1)} s`}function I(e){let t=Date.parse(e);return Number.isFinite(t)?new Date(t).toLocaleString():e}function L({accountBaseUrl:e,connection:t,project:n,taskCount:r,teamName:d,onBack:f,onNewTask:p,onTogglePinned:g,onUploadLocalProject:v}){let[T,E]=(0,h.useState)(`source`),[D,O]=(0,h.useState)(null),[k,A]=(0,h.useState)(null),[j,M]=(0,h.useState)(!1),[N,P]=(0,h.useState)([]),[F,I]=(0,h.useState)(!1),[L,K]=(0,h.useState)(null),q=H(n);(0,h.useEffect)(()=>{E(`source`)},[n.id]),(0,h.useEffect)(()=>{let e=!0;if(A(null),O(null),M(!1),P([]),K(null),!t)return I(!1),()=>{e=!1};I(!0);let r=q?R(t,q):Promise.resolve(null),i=n.kind===`local`?u.localProjectActions(t,n.project.id):Promise.resolve(null);return Promise.allSettled([r,i]).then(([t,r])=>{if(!e)return;t.status===`fulfilled`&&t.value&&(O(t.value.project),A(t.value.workspace),M(t.value.workspaceUnavailable)),r.status===`fulfilled`&&r.value&&P(r.value.actions.map(W));let i=[t,r].filter(e=>e.status===`rejected`);i.length>0&&i.length===Number(!!q)+Number(n.kind===`local`)&&K(i[0]?.reason instanceof Error?i[0].reason.message:`Project details could not be loaded.`),I(!1)}),()=>{e=!1}},[t,q?.projectId,q?.teamId,n]);let J=(0,h.useMemo)(()=>G(U(D),N),[D,N]),Y=_(n,e),X=V({hostedProject:D,project:n,repositoryUrl:Y,taskCount:r,teamName:d});return(0,b.jsxs)(`section`,{"aria-label":`${n.project.name} project`,className:`project-detail-view`,children:[(0,b.jsxs)(`header`,{className:`project-detail-header`,children:[(0,b.jsxs)(`div`,{className:`project-detail-heading`,children:[(0,b.jsxs)(`button`,{className:`project-detail-back`,onClick:f,type:`button`,children:[(0,b.jsx)(m,{"aria-hidden":`true`,size:15}),(0,b.jsx)(`span`,{children:`Projects`})]}),(0,b.jsx)(`h1`,{children:n.project.name})]}),(0,b.jsxs)(`div`,{className:`project-detail-actions`,children:[n.kind===`local`?(0,b.jsxs)(`button`,{onClick:()=>v(n),type:`button`,children:[(0,b.jsx)(i,{"aria-hidden":`true`,size:14}),(0,b.jsx)(`span`,{children:`Upload`})]}):null,Y?(0,b.jsxs)(`button`,{onClick:()=>void y(Y),type:`button`,children:[(0,b.jsx)(a,{"aria-hidden":`true`,size:14}),(0,b.jsx)(`span`,{children:`Open repository`})]}):null,(0,b.jsxs)(`button`,{onClick:()=>p(n),type:`button`,children:[(0,b.jsx)(s,{"aria-hidden":`true`,size:14}),(0,b.jsx)(`span`,{children:`New task`})]}),(0,b.jsx)(`button`,{"aria-label":`${n.pinned?`Unpin`:`Pin`} ${n.project.name}`,onClick:()=>g(n),title:n.pinned?`Unpin project`:`Pin project`,type:`button`,children:n.pinned?(0,b.jsx)(c,{"aria-hidden":`true`,size:14}):(0,b.jsx)(l,{"aria-hidden":`true`,size:14})})]})]}),(0,b.jsxs)(`div`,{"aria-label":`Project detail`,className:`project-detail-tabs`,role:`tablist`,children:[(0,b.jsx)(`button`,{"aria-selected":T===`source`,onClick:()=>E(`source`),role:`tab`,type:`button`,children:`Source`}),(0,b.jsxs)(`button`,{"aria-selected":T===`actions`,onClick:()=>E(`actions`),role:`tab`,type:`button`,children:[`Project Actions`,J.length>0?(0,b.jsx)(`span`,{children:J.length}):null]}),(0,b.jsx)(`button`,{"aria-selected":T===`environments`,onClick:()=>E(`environments`),role:`tab`,type:`button`,children:`Environments`}),(0,b.jsx)(`button`,{"aria-selected":T===`deployments`,onClick:()=>E(`deployments`),role:`tab`,type:`button`,children:`Deployments`}),(0,b.jsx)(`button`,{"aria-selected":T===`requests`,onClick:()=>E(`requests`),role:`tab`,type:`button`,children:`Requests`}),(0,b.jsx)(`button`,{"aria-selected":T===`website`,onClick:()=>E(`website`),role:`tab`,type:`button`,children:`Website`})]}),L?(0,b.jsx)(o,{error:L}):null,T===`source`?(0,b.jsx)(z,{loading:F,rows:X}):T===`actions`?(0,b.jsx)(B,{actions:J,loading:F}):T===`environments`?(0,b.jsx)(x,{linked:!!q,loading:F,unavailable:j,workspace:k}):T===`deployments`?(0,b.jsx)(S,{linked:!!q,loading:F,unavailable:j,workspace:k}):T===`requests`?(0,b.jsx)(C,{linked:!!q,loading:F,unavailable:j,workspace:k}):(0,b.jsx)(w,{linked:!!q,loading:F,unavailable:j,workspace:k})]})}async function R(e,t){try{let n=await u.getSandboxProjectWorkspace(e,t.projectId,{teamId:t.teamId});return{project:n.project,workspace:n,workspaceUnavailable:!1}}catch{return{project:(await u.getSandboxProject(e,t.projectId,{teamId:t.teamId})).project,workspace:null,workspaceUnavailable:!0}}}function z({loading:e,rows:t}){return(0,b.jsx)(`div`,{className:`project-detail-table-frame`,children:(0,b.jsxs)(`table`,{className:`project-detail-table`,children:[(0,b.jsx)(`thead`,{children:(0,b.jsxs)(`tr`,{children:[(0,b.jsx)(`th`,{children:`Setting`}),(0,b.jsx)(`th`,{children:`Value`})]})}),(0,b.jsx)(`tbody`,{children:t.map(([t,n])=>(0,b.jsxs)(`tr`,{children:[(0,b.jsx)(`td`,{children:t}),(0,b.jsx)(`td`,{children:e&&t===`Latest commit`?`Loading…`:n})]},t))})]})})}function B({actions:e,loading:t}){return t?(0,b.jsx)(`div`,{className:`project-detail-empty`,children:`Loading Project Actions…`}):e.length===0?(0,b.jsx)(`div`,{className:`project-detail-empty`,children:`No Project Actions are registered from this source.`}):(0,b.jsx)(`div`,{className:`project-detail-table-frame`,children:(0,b.jsxs)(`table`,{className:`project-detail-table actions`,children:[(0,b.jsx)(`thead`,{children:(0,b.jsxs)(`tr`,{children:[(0,b.jsx)(`th`,{children:`Action`}),(0,b.jsx)(`th`,{children:`Description`}),(0,b.jsx)(`th`,{children:`Source`})]})}),(0,b.jsx)(`tbody`,{children:e.map(e=>(0,b.jsxs)(`tr`,{children:[(0,b.jsx)(`td`,{children:(0,b.jsx)(`code`,{children:e.id})}),(0,b.jsx)(`td`,{children:e.description??`No description`}),(0,b.jsx)(`td`,{children:e.source===`hosted`?`Hosted project`:`Local source`})]},`${e.source}:${e.id}`))})]})})}function V(e){let{hostedProject:t,project:n,repositoryUrl:r,taskCount:i,teamName:a}=e,o=n.kind===`local`?n.project.linkedSandboxProject:null,s=t?.gitBranch??t?.defaultBranch??(n.kind===`cloud`?n.project.defaultBranch:o?.defaultBranch)??`Not set`,c=t?K(t):o?.lastUploadedCommit??null,l=t?.sandboxManifestSyncedAt??(n.kind===`cloud`?n.project.syncedAt:o?.syncedAt)??null;return[[`Repository`,r?(0,b.jsx)(`a`,{href:r,onClick:e=>{e.preventDefault(),y(r)},children:v(r)}):n.kind===`local`?n.project.path:`Not available`],...n.kind===`local`?[[`Primary folder`,n.project.workspacePath],[`Source folders`,(0,b.jsx)(`ul`,{className:`project-source-folder-list`,children:(n.project.sourceFolders??[n.project.workspacePath]).map(e=>(0,b.jsx)(`li`,{children:e},e))},`source-folders`)]]:[],[`Branch`,s],[`Latest commit`,c?q(c):`Not available`],[`Last synced`,l?J(l):`Not available`],[`Team`,a??(n.kind===`cloud`?n.project.organizationName:null)??`Local only`],[`Tasks`,String(i)]]}function H(e){if(e.kind===`cloud`)return{projectId:e.project.id,teamId:e.project.teamId};let t=e.project.linkedSandboxProject;return t?{projectId:t.projectId,teamId:t.teamId}:null}function U(e){let t=e?.sandboxActionRegistry?.actions;return Array.isArray(t)?t.flatMap(e=>{if(!e||typeof e!=`object`||Array.isArray(e))return[];let t=e,n=typeof(t.id??t.name)==`string`?String(t.id??t.name).trim():``;return n?[{id:n,description:typeof t.description==`string`?t.description:null,source:`hosted`}]:[]}):[]}function W(e){return{id:e.id,description:e.description??e.label??e.name??null,source:`local`}}function G(e,t){let n=new Map;for(let r of[...e,...t])n.has(r.id)||n.set(r.id,r);return Array.from(n.values()).sort((e,t)=>e.id.localeCompare(t.id))}function K(e){return[e.sourceConfig.commitSha,e.sourceConfig.sourceCommitSha,e.metadata.commitSha,e.metadata.sourceCommitSha,e.templateRemoteSha].find(e=>typeof e==`string`&&!!e.trim())??null}function q(e){return e.length>12?e.slice(0,12):e}function J(e){let t=Date.parse(e);return Number.isFinite(t)?new Date(t).toLocaleString():e}var Y=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`});function X({accountBaseUrl:e,connection:t,projects:n,taskCountByProjectId:a,teamName:o,onNewCloudProject:u,onNewLocalProject:p,onNewTask:m,onTogglePinned:g,onUploadLocalProject:_}){let[v,y]=(0,h.useState)(null),x=(0,h.useMemo)(()=>n.find(e=>e.id===v)??null,[n,v]);return(0,h.useEffect)(()=>{v&&!x&&y(null)},[x,v]),x?(0,b.jsx)(L,{accountBaseUrl:e,connection:t,onBack:()=>y(null),onNewTask:m,onTogglePinned:g,onUploadLocalProject:_,project:x,taskCount:a[x.id]??0,teamName:o}):(0,b.jsxs)(`section`,{"aria-label":`Projects`,className:`projects-page`,children:[(0,b.jsxs)(`header`,{className:`projects-page-header`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`h1`,{children:`Projects`}),(0,b.jsxs)(`p`,{children:[`Local projects on this device and hosted projects for `,o??`your active team`,`.`]})]}),(0,b.jsxs)(`div`,{className:`projects-cloud-actions`,children:[(0,b.jsxs)(`button`,{className:`projects-cloud-button`,onClick:p,type:`button`,children:[(0,b.jsx)(f,{"aria-hidden":`true`,size:15}),(0,b.jsx)(`span`,{children:`Add project`})]}),(0,b.jsxs)(`button`,{className:`projects-cloud-button`,onClick:u,type:`button`,children:[(0,b.jsx)(d,{"aria-hidden":`true`,size:15}),(0,b.jsx)(`span`,{children:`New cloud project`})]})]})]}),n.length===0?(0,b.jsxs)(`div`,{className:`projects-empty`,children:[(0,b.jsx)(f,{"aria-hidden":`true`,size:24}),(0,b.jsx)(`h2`,{children:`No projects yet`}),(0,b.jsx)(`p`,{children:`Add folders from this computer or create a hosted project.`})]}):(0,b.jsx)(`div`,{className:`projects-table-frame`,children:(0,b.jsxs)(`table`,{className:`projects-table`,children:[(0,b.jsx)(`thead`,{children:(0,b.jsxs)(`tr`,{children:[(0,b.jsx)(`th`,{scope:`col`,children:`Project`}),(0,b.jsx)(`th`,{scope:`col`,children:`Location`}),(0,b.jsx)(`th`,{scope:`col`,children:`Tasks`}),(0,b.jsx)(`th`,{scope:`col`,children:`Updated`}),(0,b.jsx)(`th`,{"aria-label":`Project actions`,scope:`col`})]})}),(0,b.jsx)(`tbody`,{children:n.map(t=>{let n=t.project.updatedAt;return(0,b.jsxs)(`tr`,{children:[(0,b.jsx)(`td`,{children:(0,b.jsxs)(`button`,{className:`projects-name-button`,onClick:()=>y(t.id),type:`button`,children:[(0,b.jsx)(`span`,{className:`projects-kind-icon ${Z(t)}`,children:r(t)?(0,b.jsx)(f,{"aria-hidden":`true`,size:16}):(0,b.jsx)(d,{"aria-hidden":`true`,size:16})}),(0,b.jsx)(`span`,{className:`projects-name-copy`,children:(0,b.jsx)(`strong`,{children:t.project.name})})]})}),(0,b.jsx)(`td`,{children:r(t)?(0,b.jsxs)(`div`,{className:`projects-location-cell`,children:[(0,b.jsx)(`span`,{className:`projects-location`,title:t.project.path,children:t.project.path}),(0,b.jsxs)(`button`,{className:`projects-upload-button`,onClick:()=>_(t),title:`Upload ${t.project.name} to the active team`,type:`button`,children:[(0,b.jsx)(i,{"aria-hidden":`true`,size:13}),(0,b.jsx)(`span`,{children:`Upload`})]})]}):(0,b.jsx)(Q,{accountBaseUrl:e,project:t})}),(0,b.jsx)(`td`,{children:a[t.id]??0}),(0,b.jsx)(`td`,{children:n?(0,b.jsx)(`time`,{dateTime:n,children:$(n)}):(0,b.jsx)(`span`,{className:`projects-table-muted`,children:`—`})}),(0,b.jsx)(`td`,{children:(0,b.jsxs)(`div`,{className:`projects-row-actions`,children:[(0,b.jsx)(`button`,{"aria-label":`Start a new task in ${t.project.name}`,onClick:()=>m(t),title:`New task`,type:`button`,children:(0,b.jsx)(s,{"aria-hidden":`true`,size:15})}),(0,b.jsx)(`button`,{"aria-label":`${t.pinned?`Unpin`:`Pin`} ${t.project.name}`,onClick:()=>g(t),title:t.pinned?`Unpin project`:`Pin project`,type:`button`,children:t.pinned?(0,b.jsx)(c,{"aria-hidden":`true`,size:15}):(0,b.jsx)(l,{"aria-hidden":`true`,size:15})})]})})]},t.id)})})]})})]})}function Z(e){return r(e)?e.project.linkedSandboxProject&&e.cloudLinkTrusted?`linked`:`desktop`:`cloud`}function Q({accountBaseUrl:e,project:t}){let n=g(t,e);return n?(0,b.jsxs)(`a`,{className:`projects-location-link`,href:n,onClick:e=>{e.preventDefault(),y(n)},title:n,children:[(0,b.jsx)(`span`,{children:v(n)}),(0,b.jsx)(a,{"aria-hidden":`true`,size:12})]}):(0,b.jsx)(`span`,{className:`projects-table-muted`,children:`Repository unavailable`})}function $(e){let t=Date.parse(e);return Number.isFinite(t)?Y.format(t):e}export{X as ProjectsPage};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{g as t,m as n}from"./index-D7igQSAg.js";import{h as r}from"./app-models-Cz3yxq4x.js";import"./icons-B8_Rkg-l.js";import{t as i}from"./cloud-upload-4lP-5zmp.js";import{t as a}from"./external-link-D_nBEDFO.js";import{Bt as o,Ht as s,Jt as c,Yt as l,bn as u,cn as d,rn as f,s as p,vn as m}from"./App-CNQi3RlI.js";var h=e(t(),1);function g(e,t){let n=e.project.sourceLabel?.trim()??``;if(e.project.sourceType===`github_repo`&&n){if(/^https?:\/\//i.test(n))return n;if(/^[^/\s]+\/[^/\s]+$/.test(n))return`https://github.com/${n}`}return p({accountBaseUrl:t,organizationSlug:e.project.organizationSlug,projectSlug:e.project.slug})}function _(e,t){return e.kind===`cloud`?g(e,t):e.project.linkedSandboxProject?.sourceRepoUrl??null}function v(e){return e.replace(/^https?:\/\//i,``).replace(/\/$/,``)}async function y(e){let t=window.openpond?.browser;if(t){let n=await t.openExternal({conversationId:`projects`,url:e});if(!n.ok)throw Error(n.error??`Unable to open project URL.`)}else window.open(e,`_blank`,`noopener,noreferrer`)}var b=n();function x({loading:e,workspace:t,linked:n,unavailable:r}){if(e)return(0,b.jsx)(E,{children:`Loading environments…`});if(!n)return(0,b.jsx)(E,{children:`Upload this local project to create cloud development environments.`});if(r)return(0,b.jsx)(E,{error:!0,children:`Unable to load environments.`});if(!t?.environments.length)return(0,b.jsx)(E,{children:`No development environment has been created for this project yet.`});let i=A(t);return(0,b.jsx)(T,{headings:[`Environment`,`Status`,`Branch`,`Default`,`Updated`],children:t.environments.map(({sandbox:e,runtime:t})=>(0,b.jsxs)(`tr`,{children:[(0,b.jsx)(`td`,{children:(0,b.jsx)(`strong`,{children:j(e.metadata,e.id)})}),(0,b.jsx)(`td`,{children:(0,b.jsx)(D,{status:e.state})}),(0,b.jsx)(`td`,{children:(0,b.jsx)(`code`,{children:t?.baseBranch??e.repoRef??`Not available`})}),(0,b.jsx)(`td`,{children:e.id===i?`Preferred`:`—`}),(0,b.jsx)(`td`,{children:I(e.updatedAt)})]},e.id))})}function S({loading:e,workspace:t,linked:n,unavailable:r}){return e?(0,b.jsx)(E,{children:`Loading deployments…`}):n?r||t?.errors.deployments?(0,b.jsx)(E,{error:!0,children:`Unable to load deployments.`}):t?.website?t.deployments.length?(0,b.jsx)(T,{headings:[`Deployment`,`Status`,`Commit`,`Build`,`Created by`,`Created`],children:t.deployments.map(e=>(0,b.jsx)(O,{deployment:e},e.release.id))}):(0,b.jsx)(E,{children:`No deployments yet.`}):(0,b.jsx)(E,{children:`Set up Website before creating a deployment.`}):(0,b.jsx)(E,{children:`Upload this local project before creating deployments.`})}function C({loading:e,workspace:t,linked:n,unavailable:r}){let[i,a]=(0,h.useState)(null);return e?(0,b.jsx)(E,{children:`Loading requests…`}):n?r||t?.errors.requests?(0,b.jsx)(E,{error:!0,children:`Unable to load requests.`}):t?.website?t.requests.length?(0,b.jsx)(`div`,{className:`project-detail-table-frame`,children:(0,b.jsxs)(`table`,{className:`project-detail-table project-request-table`,children:[(0,b.jsx)(`thead`,{children:(0,b.jsxs)(`tr`,{children:[(0,b.jsx)(`th`,{children:`Request`}),(0,b.jsx)(`th`,{children:`Status`}),(0,b.jsx)(`th`,{children:`Runtime`}),(0,b.jsx)(`th`,{children:`Started`}),(0,b.jsx)(`th`,{children:`Duration`})]})}),t.requests.map(e=>{let t=i===e.id;return(0,b.jsxs)(`tbody`,{children:[(0,b.jsxs)(`tr`,{"aria-expanded":t,className:`project-request-row`,onClick:()=>a(t=>t===e.id?null:e.id),children:[(0,b.jsxs)(`td`,{children:[(0,b.jsx)(`code`,{children:e.method}),` `,N(e.path)]}),(0,b.jsx)(`td`,{children:(0,b.jsx)(D,{status:String(e.responseStatus),tone:e.outcome===`failure`?`error`:`success`})}),(0,b.jsx)(`td`,{children:e.coldStart===null?`Unknown`:e.coldStart?`Cold`:`Warm`}),(0,b.jsx)(`td`,{children:I(e.startedAt)}),(0,b.jsx)(`td`,{children:F(e.totalDurationMs)})]}),t?(0,b.jsx)(k,{trace:e}):null]},e.id)})]})}):(0,b.jsx)(E,{children:`No requests yet.`}):(0,b.jsx)(E,{children:`Set up Website to receive requests.`}):(0,b.jsx)(E,{children:`Upload this local project and set up Website to receive requests.`})}function w({loading:e,workspace:t,linked:n,unavailable:r}){if(e)return(0,b.jsx)(E,{children:`Loading website…`});if(!n)return(0,b.jsx)(E,{children:`Upload this local project before setting up Website.`});if(r||t?.errors.website)return(0,b.jsx)(E,{error:!0,children:`Unable to load the website.`});let i=t?.website??null,a=i?.settings.platformDomain?`https://${i.settings.platformDomain}`:null,o=i?.releases.find(e=>e.id===i.settings.activeReleaseId)?.sourceCommitSha??null,s=[[`Public URL`,a?(0,b.jsx)(`a`,{href:a,onClick:e=>{e.preventDefault(),y(a)},children:v(a)}):`Not assigned`],[`Live release`,i?.settings.activeReleaseId?`Active`:`Not published`],[`Source`,o?P(o):`Not available`],[`Account database`,M(t)],[`Availability`,i?.settings.runtimePolicy?.availabilityMode===`always_on`?`Always on`:`On demand`]];return(0,b.jsxs)(`div`,{className:`project-detail-table-frame`,children:[(0,b.jsxs)(`table`,{className:`project-detail-table`,children:[(0,b.jsx)(`thead`,{children:(0,b.jsxs)(`tr`,{children:[(0,b.jsx)(`th`,{children:`Setting`}),(0,b.jsx)(`th`,{children:`Value`})]})}),(0,b.jsx)(`tbody`,{children:s.map(([e,t])=>(0,b.jsxs)(`tr`,{children:[(0,b.jsx)(`td`,{children:e}),(0,b.jsx)(`td`,{children:t})]},e))})]}),i?null:(0,b.jsx)(`div`,{className:`project-detail-table-note`,children:`Website has not been set up for this project.`})]})}function T({headings:e,children:t}){return(0,b.jsx)(`div`,{className:`project-detail-table-frame`,children:(0,b.jsxs)(`table`,{className:`project-detail-table`,children:[(0,b.jsx)(`thead`,{children:(0,b.jsx)(`tr`,{children:e.map(e=>(0,b.jsx)(`th`,{children:e},e))})}),(0,b.jsx)(`tbody`,{children:t})]})})}function E({children:e,error:t=!1}){return(0,b.jsx)(`div`,{className:`project-detail-empty${t?` error`:``}`,children:e})}function D({status:e,tone:t}){return(0,b.jsx)(`span`,{className:`project-detail-status${t?` ${t}`:``}`,children:e.replaceAll(`_`,` `)})}function O({deployment:e}){let{build:t,release:n}=e;return(0,b.jsxs)(`tr`,{children:[(0,b.jsx)(`td`,{children:(0,b.jsxs)(`strong`,{children:[`v`,n.version]})}),(0,b.jsx)(`td`,{children:(0,b.jsx)(D,{status:n.status,tone:n.status===`failed`?`error`:n.status===`active`||n.status===`ready`?`success`:void 0})}),(0,b.jsx)(`td`,{children:(0,b.jsx)(`code`,{children:n.sourceCommitSha?P(n.sourceCommitSha):`Not available`})}),(0,b.jsx)(`td`,{children:t?`${t.status.replaceAll(`_`,` `)} · ${t.currentStage.replaceAll(`_`,` `)}`:`Not started`}),(0,b.jsx)(`td`,{children:e.creatorName??`Unknown`}),(0,b.jsx)(`td`,{children:I(n.createdAt)})]})}function k({trace:e}){return(0,b.jsx)(`tr`,{className:`project-request-detail`,children:(0,b.jsxs)(`td`,{colSpan:5,children:[(0,b.jsx)(`dl`,{children:e.stages.map((e,t)=>(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`dt`,{children:[e.name.replaceAll(`_`,` `),e.errorCode?` · ${e.errorCode}`:``]}),(0,b.jsx)(`dd`,{children:F(e.durationMs)})]},`${e.name}:${t}`))}),e.errorCode?(0,b.jsx)(`p`,{children:e.errorCode}):null]})})}function A(e){let t=e.project.metadata.preferredDevelopmentSandboxId;return typeof t==`string`&&t.trim()?t:null}function j(e,t){for(let t of[`name`,`label`,`environmentName`]){let n=e[t];if(typeof n==`string`&&n.trim())return n}return t.length>18?t.slice(0,18):t}function M(e){return e?.website?e.errors.database?`Unavailable`:e.database?.status===`ready`?`Connected · ${e.database.provider}`:e.database?.status===`provisioning`?`Connecting…`:`Not connected`:`Set up the website first`}function N(e){let t=e.indexOf(`/ingress`);return t===-1?e:`/api${e.slice(t+8)||`/`}`}function P(e){return e.length>12?e.slice(0,12):e}function F(e){return e<1e3?`${Math.round(e)} ms`:`${(e/1e3).toFixed(e<1e4?2:1)} s`}function I(e){let t=Date.parse(e);return Number.isFinite(t)?new Date(t).toLocaleString():e}function L({accountBaseUrl:e,connection:t,project:n,taskCount:r,teamName:d,onBack:f,onNewTask:p,onTogglePinned:g,onUploadLocalProject:v}){let[T,E]=(0,h.useState)(`source`),[D,O]=(0,h.useState)(null),[k,A]=(0,h.useState)(null),[j,M]=(0,h.useState)(!1),[N,P]=(0,h.useState)([]),[F,I]=(0,h.useState)(!1),[L,K]=(0,h.useState)(null),q=H(n);(0,h.useEffect)(()=>{E(`source`)},[n.id]),(0,h.useEffect)(()=>{let e=!0;if(A(null),O(null),M(!1),P([]),K(null),!t)return I(!1),()=>{e=!1};I(!0);let r=q?R(t,q):Promise.resolve(null),i=n.kind===`local`?u.localProjectActions(t,n.project.id):Promise.resolve(null);return Promise.allSettled([r,i]).then(([t,r])=>{if(!e)return;t.status===`fulfilled`&&t.value&&(O(t.value.project),A(t.value.workspace),M(t.value.workspaceUnavailable)),r.status===`fulfilled`&&r.value&&P(r.value.actions.map(W));let i=[t,r].filter(e=>e.status===`rejected`);i.length>0&&i.length===Number(!!q)+Number(n.kind===`local`)&&K(i[0]?.reason instanceof Error?i[0].reason.message:`Project details could not be loaded.`),I(!1)}),()=>{e=!1}},[t,q?.projectId,q?.teamId,n]);let J=(0,h.useMemo)(()=>G(U(D),N),[D,N]),Y=_(n,e),X=V({hostedProject:D,project:n,repositoryUrl:Y,taskCount:r,teamName:d});return(0,b.jsxs)(`section`,{"aria-label":`${n.project.name} project`,className:`project-detail-view`,children:[(0,b.jsxs)(`header`,{className:`project-detail-header`,children:[(0,b.jsxs)(`div`,{className:`project-detail-heading`,children:[(0,b.jsxs)(`button`,{className:`project-detail-back`,onClick:f,type:`button`,children:[(0,b.jsx)(m,{"aria-hidden":`true`,size:15}),(0,b.jsx)(`span`,{children:`Projects`})]}),(0,b.jsx)(`h1`,{children:n.project.name})]}),(0,b.jsxs)(`div`,{className:`project-detail-actions`,children:[n.kind===`local`?(0,b.jsxs)(`button`,{onClick:()=>v(n),type:`button`,children:[(0,b.jsx)(i,{"aria-hidden":`true`,size:14}),(0,b.jsx)(`span`,{children:`Upload`})]}):null,Y?(0,b.jsxs)(`button`,{onClick:()=>void y(Y),type:`button`,children:[(0,b.jsx)(a,{"aria-hidden":`true`,size:14}),(0,b.jsx)(`span`,{children:`Open repository`})]}):null,(0,b.jsxs)(`button`,{onClick:()=>p(n),type:`button`,children:[(0,b.jsx)(s,{"aria-hidden":`true`,size:14}),(0,b.jsx)(`span`,{children:`New task`})]}),(0,b.jsx)(`button`,{"aria-label":`${n.pinned?`Unpin`:`Pin`} ${n.project.name}`,onClick:()=>g(n),title:n.pinned?`Unpin project`:`Pin project`,type:`button`,children:n.pinned?(0,b.jsx)(c,{"aria-hidden":`true`,size:14}):(0,b.jsx)(l,{"aria-hidden":`true`,size:14})})]})]}),(0,b.jsxs)(`div`,{"aria-label":`Project detail`,className:`project-detail-tabs`,role:`tablist`,children:[(0,b.jsx)(`button`,{"aria-selected":T===`source`,onClick:()=>E(`source`),role:`tab`,type:`button`,children:`Source`}),(0,b.jsxs)(`button`,{"aria-selected":T===`actions`,onClick:()=>E(`actions`),role:`tab`,type:`button`,children:[`Project Actions`,J.length>0?(0,b.jsx)(`span`,{children:J.length}):null]}),(0,b.jsx)(`button`,{"aria-selected":T===`environments`,onClick:()=>E(`environments`),role:`tab`,type:`button`,children:`Environments`}),(0,b.jsx)(`button`,{"aria-selected":T===`deployments`,onClick:()=>E(`deployments`),role:`tab`,type:`button`,children:`Deployments`}),(0,b.jsx)(`button`,{"aria-selected":T===`requests`,onClick:()=>E(`requests`),role:`tab`,type:`button`,children:`Requests`}),(0,b.jsx)(`button`,{"aria-selected":T===`website`,onClick:()=>E(`website`),role:`tab`,type:`button`,children:`Website`})]}),L?(0,b.jsx)(o,{error:L}):null,T===`source`?(0,b.jsx)(z,{loading:F,rows:X}):T===`actions`?(0,b.jsx)(B,{actions:J,loading:F}):T===`environments`?(0,b.jsx)(x,{linked:!!q,loading:F,unavailable:j,workspace:k}):T===`deployments`?(0,b.jsx)(S,{linked:!!q,loading:F,unavailable:j,workspace:k}):T===`requests`?(0,b.jsx)(C,{linked:!!q,loading:F,unavailable:j,workspace:k}):(0,b.jsx)(w,{linked:!!q,loading:F,unavailable:j,workspace:k})]})}async function R(e,t){try{let n=await u.getSandboxProjectWorkspace(e,t.projectId,{teamId:t.teamId});return{project:n.project,workspace:n,workspaceUnavailable:!1}}catch{return{project:(await u.getSandboxProject(e,t.projectId,{teamId:t.teamId})).project,workspace:null,workspaceUnavailable:!0}}}function z({loading:e,rows:t}){return(0,b.jsx)(`div`,{className:`project-detail-table-frame`,children:(0,b.jsxs)(`table`,{className:`project-detail-table`,children:[(0,b.jsx)(`thead`,{children:(0,b.jsxs)(`tr`,{children:[(0,b.jsx)(`th`,{children:`Setting`}),(0,b.jsx)(`th`,{children:`Value`})]})}),(0,b.jsx)(`tbody`,{children:t.map(([t,n])=>(0,b.jsxs)(`tr`,{children:[(0,b.jsx)(`td`,{children:t}),(0,b.jsx)(`td`,{children:e&&t===`Latest commit`?`Loading…`:n})]},t))})]})})}function B({actions:e,loading:t}){return t?(0,b.jsx)(`div`,{className:`project-detail-empty`,children:`Loading Project Actions…`}):e.length===0?(0,b.jsx)(`div`,{className:`project-detail-empty`,children:`No Project Actions are registered from this source.`}):(0,b.jsx)(`div`,{className:`project-detail-table-frame`,children:(0,b.jsxs)(`table`,{className:`project-detail-table actions`,children:[(0,b.jsx)(`thead`,{children:(0,b.jsxs)(`tr`,{children:[(0,b.jsx)(`th`,{children:`Action`}),(0,b.jsx)(`th`,{children:`Description`}),(0,b.jsx)(`th`,{children:`Source`})]})}),(0,b.jsx)(`tbody`,{children:e.map(e=>(0,b.jsxs)(`tr`,{children:[(0,b.jsx)(`td`,{children:(0,b.jsx)(`code`,{children:e.id})}),(0,b.jsx)(`td`,{children:e.description??`No description`}),(0,b.jsx)(`td`,{children:e.source===`hosted`?`Hosted project`:`Local source`})]},`${e.source}:${e.id}`))})]})})}function V(e){let{hostedProject:t,project:n,repositoryUrl:r,taskCount:i,teamName:a}=e,o=n.kind===`local`?n.project.linkedSandboxProject:null,s=t?.gitBranch??t?.defaultBranch??(n.kind===`cloud`?n.project.defaultBranch:o?.defaultBranch)??`Not set`,c=t?K(t):o?.lastUploadedCommit??null,l=t?.sandboxManifestSyncedAt??(n.kind===`cloud`?n.project.syncedAt:o?.syncedAt)??null;return[[`Repository`,r?(0,b.jsx)(`a`,{href:r,onClick:e=>{e.preventDefault(),y(r)},children:v(r)}):n.kind===`local`?n.project.path:`Not available`],...n.kind===`local`?[[`Primary folder`,n.project.workspacePath],[`Source folders`,(0,b.jsx)(`ul`,{className:`project-source-folder-list`,children:(n.project.sourceFolders??[n.project.workspacePath]).map(e=>(0,b.jsx)(`li`,{children:e},e))},`source-folders`)]]:[],[`Branch`,s],[`Latest commit`,c?q(c):`Not available`],[`Last synced`,l?J(l):`Not available`],[`Team`,a??(n.kind===`cloud`?n.project.organizationName:null)??`Local only`],[`Tasks`,String(i)]]}function H(e){if(e.kind===`cloud`)return{projectId:e.project.id,teamId:e.project.teamId};let t=e.project.linkedSandboxProject;return t?{projectId:t.projectId,teamId:t.teamId}:null}function U(e){let t=e?.sandboxActionRegistry?.actions;return Array.isArray(t)?t.flatMap(e=>{if(!e||typeof e!=`object`||Array.isArray(e))return[];let t=e,n=typeof(t.id??t.name)==`string`?String(t.id??t.name).trim():``;return n?[{id:n,description:typeof t.description==`string`?t.description:null,source:`hosted`}]:[]}):[]}function W(e){return{id:e.id,description:e.description??e.label??e.name??null,source:`local`}}function G(e,t){let n=new Map;for(let r of[...e,...t])n.has(r.id)||n.set(r.id,r);return Array.from(n.values()).sort((e,t)=>e.id.localeCompare(t.id))}function K(e){return[e.sourceConfig.commitSha,e.sourceConfig.sourceCommitSha,e.metadata.commitSha,e.metadata.sourceCommitSha,e.templateRemoteSha].find(e=>typeof e==`string`&&!!e.trim())??null}function q(e){return e.length>12?e.slice(0,12):e}function J(e){let t=Date.parse(e);return Number.isFinite(t)?new Date(t).toLocaleString():e}var Y=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`});function X({accountBaseUrl:e,connection:t,projects:n,taskCountByProjectId:a,teamName:o,onNewCloudProject:u,onNewLocalProject:p,onNewTask:m,onTogglePinned:g,onUploadLocalProject:_}){let[v,y]=(0,h.useState)(null),x=(0,h.useMemo)(()=>n.find(e=>e.id===v)??null,[n,v]);return(0,h.useEffect)(()=>{v&&!x&&y(null)},[x,v]),x?(0,b.jsx)(L,{accountBaseUrl:e,connection:t,onBack:()=>y(null),onNewTask:m,onTogglePinned:g,onUploadLocalProject:_,project:x,taskCount:a[x.id]??0,teamName:o}):(0,b.jsxs)(`section`,{"aria-label":`Projects`,className:`projects-page`,children:[(0,b.jsxs)(`header`,{className:`projects-page-header`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`h1`,{children:`Projects`}),(0,b.jsxs)(`p`,{children:[`Local projects on this device and hosted projects for `,o??`your active team`,`.`]})]}),(0,b.jsxs)(`div`,{className:`projects-cloud-actions`,children:[(0,b.jsxs)(`button`,{className:`projects-cloud-button`,onClick:p,type:`button`,children:[(0,b.jsx)(f,{"aria-hidden":`true`,size:15}),(0,b.jsx)(`span`,{children:`Add project`})]}),(0,b.jsxs)(`button`,{className:`projects-cloud-button`,onClick:u,type:`button`,children:[(0,b.jsx)(d,{"aria-hidden":`true`,size:15}),(0,b.jsx)(`span`,{children:`New cloud project`})]})]})]}),n.length===0?(0,b.jsxs)(`div`,{className:`projects-empty`,children:[(0,b.jsx)(f,{"aria-hidden":`true`,size:24}),(0,b.jsx)(`h2`,{children:`No projects yet`}),(0,b.jsx)(`p`,{children:`Add folders from this computer or create a hosted project.`})]}):(0,b.jsx)(`div`,{className:`projects-table-frame`,children:(0,b.jsxs)(`table`,{className:`projects-table`,children:[(0,b.jsx)(`thead`,{children:(0,b.jsxs)(`tr`,{children:[(0,b.jsx)(`th`,{scope:`col`,children:`Project`}),(0,b.jsx)(`th`,{scope:`col`,children:`Location`}),(0,b.jsx)(`th`,{scope:`col`,children:`Tasks`}),(0,b.jsx)(`th`,{scope:`col`,children:`Updated`}),(0,b.jsx)(`th`,{"aria-label":`Project actions`,scope:`col`})]})}),(0,b.jsx)(`tbody`,{children:n.map(t=>{let n=t.project.updatedAt;return(0,b.jsxs)(`tr`,{children:[(0,b.jsx)(`td`,{children:(0,b.jsxs)(`button`,{className:`projects-name-button`,onClick:()=>y(t.id),type:`button`,children:[(0,b.jsx)(`span`,{className:`projects-kind-icon ${Z(t)}`,children:r(t)?(0,b.jsx)(f,{"aria-hidden":`true`,size:16}):(0,b.jsx)(d,{"aria-hidden":`true`,size:16})}),(0,b.jsx)(`span`,{className:`projects-name-copy`,children:(0,b.jsx)(`strong`,{children:t.project.name})})]})}),(0,b.jsx)(`td`,{children:r(t)?(0,b.jsxs)(`div`,{className:`projects-location-cell`,children:[(0,b.jsx)(`span`,{className:`projects-location`,title:t.project.path,children:t.project.path}),(0,b.jsxs)(`button`,{className:`projects-upload-button`,onClick:()=>_(t),title:`Upload ${t.project.name} to the active team`,type:`button`,children:[(0,b.jsx)(i,{"aria-hidden":`true`,size:13}),(0,b.jsx)(`span`,{children:`Upload`})]})]}):(0,b.jsx)(Q,{accountBaseUrl:e,project:t})}),(0,b.jsx)(`td`,{children:a[t.id]??0}),(0,b.jsx)(`td`,{children:n?(0,b.jsx)(`time`,{dateTime:n,children:$(n)}):(0,b.jsx)(`span`,{className:`projects-table-muted`,children:`—`})}),(0,b.jsx)(`td`,{children:(0,b.jsxs)(`div`,{className:`projects-row-actions`,children:[(0,b.jsx)(`button`,{"aria-label":`Start a new task in ${t.project.name}`,onClick:()=>m(t),title:`New task`,type:`button`,children:(0,b.jsx)(s,{"aria-hidden":`true`,size:15})}),(0,b.jsx)(`button`,{"aria-label":`${t.pinned?`Unpin`:`Pin`} ${t.project.name}`,onClick:()=>g(t),title:t.pinned?`Unpin project`:`Pin project`,type:`button`,children:t.pinned?(0,b.jsx)(c,{"aria-hidden":`true`,size:15}):(0,b.jsx)(l,{"aria-hidden":`true`,size:15})})]})})]},t.id)})})]})})]})}function Z(e){return r(e)?e.project.linkedSandboxProject&&e.cloudLinkTrusted?`linked`:`desktop`:`cloud`}function Q({accountBaseUrl:e,project:t}){let n=g(t,e);return n?(0,b.jsxs)(`a`,{className:`projects-location-link`,href:n,onClick:e=>{e.preventDefault(),y(n)},title:n,children:[(0,b.jsx)(`span`,{children:v(n)}),(0,b.jsx)(a,{"aria-hidden":`true`,size:12})]}):(0,b.jsx)(`span`,{className:`projects-table-muted`,children:`Repository unavailable`})}function $(e){let t=Date.parse(e);return Number.isFinite(t)?Y.format(t):e}export{X as ProjectsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{g as t,m as n}from"./index-CM0IRu1U.js";import{w as r,x as i}from"./submit-issue-command-DZNW7Evj.js";import{a,l as o,n as s,t as ee}from"./browser-sidebar-links-ZyYiYBBd.js";import"./icons-c3vt7y6n.js";import{t as c}from"./folder-open-BXdVB5J1.js";import{i as te,n as ne,r as re,t as ie}from"./ChatTimelineEntry-Dr5X_XyN.js";import{t as l}from"./message-square-DbIMQqfj.js";import{t as ae}from"./plus-DbASL_gy.js";import{t as oe}from"./x-D9GTV9ke.js";import{$ as u,at as se,i as d,ot as f,rt as p,st as ce}from"./App-BZuSv1XM.js";import{A as le,E as m,H as h,M as g,N as ue,T as de,W as fe,j as pe}from"./MainPane-DDO6diPt.js";var _=e(t(),1),v=n();function me({panel:e,runtimeEventStore:t,actionCatalog:n,createImproveActions:r,contextCompaction:i,steerActiveResponses:c,initialScrollState:l,codexPermissionMode:ae,codexReasoningEffort:oe,openPondCommandAccessMode:u,connection:d,connectedAppMentions:p,mentionApps:me,codexPersonalSkills:y,profileSkills:b,profileTarget:x,projectTarget:S,providerSettings:C,accountBaseUrl:w,billingOrganizationSlug:T,billingTeamId:E,showToast:D,workspaceTarget:O,onCodexPermissionModeChange:k,onCodexReasoningEffortChange:A,onOpenPondCommandAccessModeChange:j,onModelChange:M,onOpenAttachmentInSidebar:N,onOpenFileInSidebar:P,onOpenProfileSettings:F,onOpenSession:I,onOpenPonder:L,onProviderChange:R,onProviderSetupOpen:he,onPromptChange:ge,onProfileTargetChange:z,onScrollStateChange:_e,onProjectTargetChange:ve,onResolveApproval:ye,onShowBrowserPanel:B,onStop:V,onSubmit:H,onWorkspaceTargetChange:be}){let U=(0,_.useRef)(null),[W]=(0,_.useState)(()=>new pe),G=(0,_.useRef)(l?.stickyToBottom??!0),K=(0,_.useRef)(!1);ue(t,e.runtimeSource===`live`?e.sessionId:null,P);let q=le(t,e.runtimeSource===`live`?e.sessionId:null),J=(0,_.useMemo)(()=>{if(e.runtimeSource===`history`||!e.sessionId)return e;let t=q.events,n=se(t,[]);return{...e,messages:s(W.project(t),e.pendingUserMessage),createImproveRun:o({events:t}),contextWindowStatus:a({provider:e.provider,snapshot:f(n,e.sessionId),preferences:i}),goalRuntime:ce(n,e.sessionId)}},[W,i,q,e]),Y=J.running&&!J.pendingApproval&&fe(J.messages),X=(0,_.useMemo)(()=>J.createImproveRun?{...r,run:J.createImproveRun}:null,[J.createImproveRun,r]),Z=(0,_.useMemo)(()=>h(J.messages,{showThinkingIndicator:Y}),[J.messages,Y]),xe=te(J.messages,J.sessionId??`draft:${J.id}`),Q=J.messages.at(-1),$=re({connection:d,latestTurnId:Q?.turnId??null,sessionId:J.sessionId,turnRunning:J.running}),Se=[J.id,J.sessionId??`draft`,Z.length,Q?.id??``,Q?.content?.length??0,Q?.timestamp??``,Y?`thinking`:``].join(`:`);(0,_.useLayoutEffect)(()=>{let e=U.current;e&&!K.current&&(K.current=!0,e.scrollTop=l?.stickyToBottom?e.scrollHeight:l?.scrollTop??0)},[l]),g({contentKey:Se,onContentChange:e=>{G.current&&(e.scrollTop=e.scrollHeight)},threadRef:U});let Ce=(0,_.useCallback)((e,t)=>{let n=J.sessionId??`side-chat:${J.id}`;ee({conversationId:n,href:e,explicitFile:t?.explicitFile,newTab:t?.newTab}).then(e=>{e&&B()})},[J.id,J.sessionId,B]),we=(0,_.useCallback)(async(e,t)=>{let n=t.action===`answer`?t.text:`Dismiss this question`;if(!await H([],null,null,{displayPrompt:n,promptOverride:n,turnMetadata:{userQuestionResolution:t}}))throw Error(`The question response could not be sent.`)},[H]);return(0,v.jsxs)(`section`,{"data-thread-session":J.sessionId??void 0,className:`right-chat-pane ${J.pendingApproval?`has-approval`:``}`,id:`right-chat-panel-${J.id}`,role:`tabpanel`,"aria-labelledby":`right-chat-tab-${J.id}`,children:[(0,v.jsx)(`div`,{className:`chat-thread right-chat-thread`,ref:U,onScroll:e=>{let t=e.currentTarget;G.current=t.scrollHeight-t.scrollTop-t.clientHeight<=72,_e({scrollTop:t.scrollTop,stickyToBottom:G.current})},children:Z.map(t=>(0,v.jsx)(ie,{row:t,renderMessage:t=>(0,v.jsx)(ne,{activeWorkspaceAppId:J.activeWorkspaceAppId,accountBaseUrl:w,billingOrganizationSlug:T,billingTeamId:E,connection:d,animateInitialContent:t.message.role===`assistant`&&xe.has(t.message.id),kvCacheSummary:t.showFooter&&t.message.turnId?$.get(t.message.turnId)??null:null,message:t.message,codexRecoveryEnabled:t.message.turnId===Q?.turnId,onOpenBrowserLink:Ce,onOpenAttachmentInSidebar:N,onOpenFileInSidebar:P,onOpenProfileSettings:F,onResolveUserQuestion:we,onOpenSession:I,onOpenPonder:L,userAttachmentDisplay:e.provider===`codex`?`compact`:`full`,workspaceRootPath:J.workspaceRootPath,showFooter:t.showFooter},t.id)},t.id))}),(0,v.jsxs)(`div`,{className:`composer-stack dock right-chat-composer ${J.pendingApproval?`has-approval`:``}`,children:[(0,v.jsx)(de,{connection:d,showToast:D,approval:J.pendingApproval,onResolve:ye}),(0,v.jsx)(m,{mode:`dock`,prompt:e.prompt,mentionApps:me,connectedAppMentions:p,profileSkills:e.provider===`codex`?y:b,profileTarget:e.provider===`codex`?null:x,selectedMentionAppId:null,contextWindowStatus:J.contextWindowStatus,goalRuntime:J.goalRuntime,createImproveRuntime:X,busy:J.running,running:J.running,steerActiveResponses:c,taskSessionId:e.runtimeSource===`live`?e.sessionId:null,goalSessionId:e.sessionId,taskEvents:q.events,submissionScopeKey:J.sessionId??J.id,showProjectFooter:!1,connection:d,providerSettings:C,provider:e.provider,model:e.model,projectTarget:S,actionCatalog:n,workspaceTarget:O,codexPermissionMode:ae,codexReasoningEffort:oe,openPondCommandAccessMode:e.provider===`codex`?u:J.session?.openPondCommandAccessMode??u,onProviderChange:R,onProviderSetupOpen:he,onProjectTargetChange:ve,onWorkspaceTargetChange:be,onModelChange:M,onCodexPermissionModeChange:k,onCodexReasoningEffortChange:A,onOpenPondCommandAccessModeChange:j,onPromptChange:ge,onProfileTargetChange:z,onMentionAppSelect:void 0,showToast:D,onSubmit:H,onStop:V})]})]})}function y({panels:e,runtimeEventStore:t,actionCatalog:n=[],createImproveActions:a,contextCompaction:o,steerActiveResponses:s,busy:ee,codexPermissionMode:te,codexReasoningEffort:ne,openPondCommandAccessMode:re,connection:ie,connectedAppMentions:se,mentionApps:f,codexPersonalSkills:ce,profileSkills:le=[],profileLibrary:m={lastUsed:null,profiles:[]},extensionCatalog:h,projectTarget:g,providerSettings:ue,accountBaseUrl:de,billingOrganizationSlug:fe,billingTeamId:pe,showToast:y,workspaceTarget:b,onAddChat:x,onActivatePanel:S,onClosePanel:C,onCodexPermissionModeChange:w,onCodexReasoningEffortChange:T,onOpenPondCommandAccessModeChange:E,onModelChange:D,onOpenAttachmentInSidebar:O,onOpenFileInSidebar:k,onOpenProfileSettings:A,onOpenSession:j,onOpenPonder:M,onProviderChange:N,onProviderSetupOpen:P,onPromptChange:F,onProfileTargetChange:I,onScrollStateChange:L,onProjectTargetChange:R,onResolveApproval:he,onResizeStart:ge,onSelectFiles:z,onShowBrowserPanel:_e,onStop:ve,onSubmit:ye,onWorkspaceTargetChange:B}){let[V,H]=(0,_.useState)(!1),[be,U]=(0,_.useState)(()=>d(e)?.id??null),W=(0,_.useRef)(null),G=(0,_.useRef)(new Map),K=(0,_.useRef)(new Set(e.map(e=>e.id))),q=(0,_.useRef)(new Map(e.map(e=>[e.id,e.activationVersion]))),J=e.find(e=>e.id===be)??e.at(-1)??null,Y=J?.session?.currentProfile??m.lastUsed,X=p(m,Y),Z=X?u(X,h):le,xe=X?[...n.filter(e=>!r(e)),...i(X)]:n;(0,_.useEffect)(()=>{let t=K.current,n=q.current,r=null,i=null;for(let a of e)t.has(a.id)||(r=a),t.has(a.id)&&a.activationVersion>(n.get(a.id)??0)&&(i=a);K.current=new Set(e.map(e=>e.id)),q.current=new Map(e.map(e=>[e.id,e.activationVersion])),U(t=>i?i.id:r?r.id:t&&e.some(e=>e.id===t)?t:e.at(-1)?.id??null)},[e]),(0,_.useEffect)(()=>{if(!V)return;function e(e){W.current?.contains(e.target)||H(!1)}function t(e){e.key===`Escape`&&H(!1)}return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}},[V]);let Q=(0,_.useCallback)((e,t=!1)=>{U(e),S(e),t&&window.requestAnimationFrame(()=>G.current.get(e)?.focus())},[S]),$=(0,_.useCallback)((e=!1)=>{z(),e&&window.requestAnimationFrame(()=>{document.getElementById(`right-sidebar-files-tab`)?.focus()})},[z]),Se=(0,_.useCallback)((t,n)=>{let r=e.findIndex(e=>e.id===n);if(r<0)return;let i=r+1,a=null;if(t.key===`ArrowRight`&&(a=(i+1)%(e.length+1)),t.key===`ArrowLeft`&&(a=(i-1+e.length+1)%(e.length+1)),t.key===`Home`&&(a=0),t.key===`End`&&(a=e.length),a===null)return;if(t.preventDefault(),a===0){$(!0);return}let o=e[a-1];o&&Q(o.id,!0)},[e,$,Q]),Ce=(0,_.useCallback)(t=>{if(![`ArrowRight`,`ArrowLeft`,`Home`,`End`].includes(t.key)||(t.preventDefault(),t.key===`Home`))return;let n=t.key===`ArrowLeft`||t.key===`End`?e.at(-1):e[0];n&&Q(n.id,!0)},[e,Q]);return(0,v.jsxs)(`aside`,{className:`workspace-diff-panel right-chat-panel-stack`,"aria-label":`Side chats`,children:[(0,v.jsx)(`div`,{className:`workspace-diff-resize-handle`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize side chat panel`,onPointerDown:ge}),(0,v.jsx)(`div`,{className:`workspace-diff-topbar right-chat-topbar`,children:(0,v.jsxs)(`div`,{className:`workspace-diff-tabs`,role:`tablist`,"aria-label":`Right sidebar views`,children:[(0,v.jsxs)(`button`,{type:`button`,className:`workspace-diff-tab`,role:`tab`,id:`right-sidebar-files-tab`,"aria-controls":`right-sidebar-files-panel`,"aria-selected":!1,tabIndex:-1,onClick:()=>$(!1),onKeyDown:Ce,children:[(0,v.jsx)(c,{size:14}),(0,v.jsx)(`span`,{children:`Files`})]}),e.map(e=>{let t=e.id===J?.id;return(0,v.jsxs)(`div`,{className:`workspace-diff-tab right-chat-tab ${t?`active`:``}`,children:[(0,v.jsxs)(`button`,{type:`button`,className:`workspace-diff-tab-main`,role:`tab`,id:`right-chat-tab-${e.id}`,"aria-controls":`right-chat-panel-${e.id}`,"aria-selected":t,tabIndex:t?0:-1,title:e.title,ref:t=>{t?G.current.set(e.id,t):G.current.delete(e.id)},onClick:()=>Q(e.id),onKeyDown:t=>Se(t,e.id),children:[e.running?(0,v.jsx)(`span`,{className:`right-chat-status-dot`,"aria-label":`Running`}):null,(0,v.jsx)(`span`,{children:e.title})]}),(0,v.jsx)(`button`,{type:`button`,className:`workspace-diff-tab-close`,title:`Close ${e.title}`,"aria-label":`Close ${e.title}`,onClick:t=>{t.stopPropagation(),C(e.id)},children:(0,v.jsx)(oe,{size:12})})]},e.id)}),(0,v.jsxs)(`div`,{className:`workspace-diff-add-anchor`,ref:W,children:[(0,v.jsx)(`button`,{type:`button`,className:`workspace-diff-add-tab ${V?`active`:``}`,title:`Add to right sidebar`,"aria-label":`Add to right sidebar`,"aria-haspopup":`menu`,"aria-expanded":V,onClick:()=>H(e=>!e),children:(0,v.jsx)(ae,{size:15})}),V?(0,v.jsxs)(`div`,{className:`workspace-diff-add-menu right-chat-add-popover`,role:`menu`,children:[(0,v.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{H(!1),x()},children:[(0,v.jsx)(l,{size:13}),(0,v.jsx)(`span`,{children:`New task`})]}),(0,v.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{H(!1),z()},children:[(0,v.jsx)(c,{size:13}),(0,v.jsx)(`span`,{children:`Files`})]})]}):null]})]})}),(0,v.jsx)(`div`,{className:`right-chat-stack-body panes-1`,children:J?(0,v.jsx)(me,{busy:ee,createImproveActions:a,contextCompaction:o,steerActiveResponses:s,codexPermissionMode:te,codexReasoningEffort:ne,openPondCommandAccessMode:re,connection:ie,connectedAppMentions:se,actionCatalog:xe,mentionApps:f,codexPersonalSkills:ce,profileSkills:Z,profileTarget:null,panel:J,runtimeEventStore:t,initialScrollState:{scrollTop:J.scrollTop,stickyToBottom:J.stickyToBottom},projectTarget:g,providerSettings:ue,accountBaseUrl:de,billingOrganizationSlug:fe,billingTeamId:pe,showToast:y,workspaceTarget:b,onCodexPermissionModeChange:w,onCodexReasoningEffortChange:T,onOpenPondCommandAccessModeChange:e=>E(e,J.session),onModelChange:e=>D(J.id,e),onOpenAttachmentInSidebar:O,onOpenFileInSidebar:k,onOpenProfileSettings:A,onOpenSession:j,onOpenPonder:M,onProviderChange:(e,t)=>N(J.id,e,t),onProviderSetupOpen:P,onPromptChange:e=>F(J.id,e),onProfileTargetChange:e=>I(J.sessionId,e),onScrollStateChange:e=>L(J.id,e),onProjectTargetChange:R,onResolveApproval:he,onShowBrowserPanel:_e,onStop:()=>ve(J.sessionId),onSubmit:(e,t,n,r)=>ye(J.id,e,t,n,r),onWorkspaceTargetChange:B},J.id):null})]})}export{y as RightChatPanelStack};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{g as t,m as n}from"./index-D7igQSAg.js";import{w as r,x as i}from"./submit-issue-command-wfngGS6Y.js";import{a,l as o,n as s,t as ee}from"./browser-sidebar-links-ZyYiYBBd.js";import"./icons-B8_Rkg-l.js";import{t as c}from"./folder-open-tD5Lle1M.js";import{i as te,n as ne,r as re,t as ie}from"./ChatTimelineEntry-Ct59FKw1.js";import{t as l}from"./message-square-CrDvzn66.js";import{t as ae}from"./plus-DXZIpQuY.js";import{t as oe}from"./x-Bhl-4Zlt.js";import{$ as u,at as se,i as d,ot as f,rt as p,st as ce}from"./App-CNQi3RlI.js";import{A as le,E as m,H as h,M as g,N as ue,T as de,W as fe,j as pe}from"./MainPane-CqtgV9rU.js";var _=e(t(),1),v=n();function me({panel:e,runtimeEventStore:t,actionCatalog:n,createImproveActions:r,contextCompaction:i,steerActiveResponses:c,initialScrollState:l,codexPermissionMode:ae,codexReasoningEffort:oe,openPondCommandAccessMode:u,connection:d,connectedAppMentions:p,mentionApps:me,codexPersonalSkills:y,profileSkills:b,profileTarget:x,projectTarget:S,providerSettings:C,accountBaseUrl:w,billingOrganizationSlug:T,billingTeamId:E,showToast:D,workspaceTarget:O,onCodexPermissionModeChange:k,onCodexReasoningEffortChange:A,onOpenPondCommandAccessModeChange:j,onModelChange:M,onOpenAttachmentInSidebar:N,onOpenFileInSidebar:P,onOpenProfileSettings:F,onOpenSession:I,onOpenPonder:L,onProviderChange:R,onProviderSetupOpen:he,onPromptChange:ge,onProfileTargetChange:z,onScrollStateChange:_e,onProjectTargetChange:ve,onResolveApproval:ye,onShowBrowserPanel:B,onStop:V,onSubmit:H,onWorkspaceTargetChange:be}){let U=(0,_.useRef)(null),[W]=(0,_.useState)(()=>new pe),G=(0,_.useRef)(l?.stickyToBottom??!0),K=(0,_.useRef)(!1);ue(t,e.runtimeSource===`live`?e.sessionId:null,P);let q=le(t,e.runtimeSource===`live`?e.sessionId:null),J=(0,_.useMemo)(()=>{if(e.runtimeSource===`history`||!e.sessionId)return e;let t=q.events,n=se(t,[]);return{...e,messages:s(W.project(t),e.pendingUserMessage),createImproveRun:o({events:t}),contextWindowStatus:a({provider:e.provider,snapshot:f(n,e.sessionId),preferences:i}),goalRuntime:ce(n,e.sessionId)}},[W,i,q,e]),Y=J.running&&!J.pendingApproval&&fe(J.messages),X=(0,_.useMemo)(()=>J.createImproveRun?{...r,run:J.createImproveRun}:null,[J.createImproveRun,r]),Z=(0,_.useMemo)(()=>h(J.messages,{showThinkingIndicator:Y}),[J.messages,Y]),xe=te(J.messages,J.sessionId??`draft:${J.id}`),Q=J.messages.at(-1),$=re({connection:d,latestTurnId:Q?.turnId??null,sessionId:J.sessionId,turnRunning:J.running}),Se=[J.id,J.sessionId??`draft`,Z.length,Q?.id??``,Q?.content?.length??0,Q?.timestamp??``,Y?`thinking`:``].join(`:`);(0,_.useLayoutEffect)(()=>{let e=U.current;e&&!K.current&&(K.current=!0,e.scrollTop=l?.stickyToBottom?e.scrollHeight:l?.scrollTop??0)},[l]),g({contentKey:Se,onContentChange:e=>{G.current&&(e.scrollTop=e.scrollHeight)},threadRef:U});let Ce=(0,_.useCallback)((e,t)=>{let n=J.sessionId??`side-chat:${J.id}`;ee({conversationId:n,href:e,explicitFile:t?.explicitFile,newTab:t?.newTab}).then(e=>{e&&B()})},[J.id,J.sessionId,B]),we=(0,_.useCallback)(async(e,t)=>{let n=t.action===`answer`?t.text:`Dismiss this question`;if(!await H([],null,null,{displayPrompt:n,promptOverride:n,turnMetadata:{userQuestionResolution:t}}))throw Error(`The question response could not be sent.`)},[H]);return(0,v.jsxs)(`section`,{"data-thread-session":J.sessionId??void 0,className:`right-chat-pane ${J.pendingApproval?`has-approval`:``}`,id:`right-chat-panel-${J.id}`,role:`tabpanel`,"aria-labelledby":`right-chat-tab-${J.id}`,children:[(0,v.jsx)(`div`,{className:`chat-thread right-chat-thread`,ref:U,onScroll:e=>{let t=e.currentTarget;G.current=t.scrollHeight-t.scrollTop-t.clientHeight<=72,_e({scrollTop:t.scrollTop,stickyToBottom:G.current})},children:Z.map(t=>(0,v.jsx)(ie,{row:t,renderMessage:t=>(0,v.jsx)(ne,{activeWorkspaceAppId:J.activeWorkspaceAppId,accountBaseUrl:w,billingOrganizationSlug:T,billingTeamId:E,connection:d,animateInitialContent:t.message.role===`assistant`&&xe.has(t.message.id),kvCacheSummary:t.showFooter&&t.message.turnId?$.get(t.message.turnId)??null:null,message:t.message,codexRecoveryEnabled:t.message.turnId===Q?.turnId,onOpenBrowserLink:Ce,onOpenAttachmentInSidebar:N,onOpenFileInSidebar:P,onOpenProfileSettings:F,onResolveUserQuestion:we,onOpenSession:I,onOpenPonder:L,userAttachmentDisplay:e.provider===`codex`?`compact`:`full`,workspaceRootPath:J.workspaceRootPath,showFooter:t.showFooter},t.id)},t.id))}),(0,v.jsxs)(`div`,{className:`composer-stack dock right-chat-composer ${J.pendingApproval?`has-approval`:``}`,children:[(0,v.jsx)(de,{connection:d,showToast:D,approval:J.pendingApproval,onResolve:ye}),(0,v.jsx)(m,{mode:`dock`,prompt:e.prompt,mentionApps:me,connectedAppMentions:p,profileSkills:e.provider===`codex`?y:b,profileTarget:e.provider===`codex`?null:x,selectedMentionAppId:null,contextWindowStatus:J.contextWindowStatus,goalRuntime:J.goalRuntime,createImproveRuntime:X,busy:J.running,running:J.running,steerActiveResponses:c,taskSessionId:e.runtimeSource===`live`?e.sessionId:null,goalSessionId:e.sessionId,taskEvents:q.events,submissionScopeKey:J.sessionId??J.id,showProjectFooter:!1,connection:d,providerSettings:C,provider:e.provider,model:e.model,projectTarget:S,actionCatalog:n,workspaceTarget:O,codexPermissionMode:ae,codexReasoningEffort:oe,openPondCommandAccessMode:e.provider===`codex`?u:J.session?.openPondCommandAccessMode??u,onProviderChange:R,onProviderSetupOpen:he,onProjectTargetChange:ve,onWorkspaceTargetChange:be,onModelChange:M,onCodexPermissionModeChange:k,onCodexReasoningEffortChange:A,onOpenPondCommandAccessModeChange:j,onPromptChange:ge,onProfileTargetChange:z,onMentionAppSelect:void 0,showToast:D,onSubmit:H,onStop:V})]})]})}function y({panels:e,runtimeEventStore:t,actionCatalog:n=[],createImproveActions:a,contextCompaction:o,steerActiveResponses:s,busy:ee,codexPermissionMode:te,codexReasoningEffort:ne,openPondCommandAccessMode:re,connection:ie,connectedAppMentions:se,mentionApps:f,codexPersonalSkills:ce,profileSkills:le=[],profileLibrary:m={lastUsed:null,profiles:[]},extensionCatalog:h,projectTarget:g,providerSettings:ue,accountBaseUrl:de,billingOrganizationSlug:fe,billingTeamId:pe,showToast:y,workspaceTarget:b,onAddChat:x,onActivatePanel:S,onClosePanel:C,onCodexPermissionModeChange:w,onCodexReasoningEffortChange:T,onOpenPondCommandAccessModeChange:E,onModelChange:D,onOpenAttachmentInSidebar:O,onOpenFileInSidebar:k,onOpenProfileSettings:A,onOpenSession:j,onOpenPonder:M,onProviderChange:N,onProviderSetupOpen:P,onPromptChange:F,onProfileTargetChange:I,onScrollStateChange:L,onProjectTargetChange:R,onResolveApproval:he,onResizeStart:ge,onSelectFiles:z,onShowBrowserPanel:_e,onStop:ve,onSubmit:ye,onWorkspaceTargetChange:B}){let[V,H]=(0,_.useState)(!1),[be,U]=(0,_.useState)(()=>d(e)?.id??null),W=(0,_.useRef)(null),G=(0,_.useRef)(new Map),K=(0,_.useRef)(new Set(e.map(e=>e.id))),q=(0,_.useRef)(new Map(e.map(e=>[e.id,e.activationVersion]))),J=e.find(e=>e.id===be)??e.at(-1)??null,Y=J?.session?.currentProfile??m.lastUsed,X=p(m,Y),Z=X?u(X,h):le,xe=X?[...n.filter(e=>!r(e)),...i(X)]:n;(0,_.useEffect)(()=>{let t=K.current,n=q.current,r=null,i=null;for(let a of e)t.has(a.id)||(r=a),t.has(a.id)&&a.activationVersion>(n.get(a.id)??0)&&(i=a);K.current=new Set(e.map(e=>e.id)),q.current=new Map(e.map(e=>[e.id,e.activationVersion])),U(t=>i?i.id:r?r.id:t&&e.some(e=>e.id===t)?t:e.at(-1)?.id??null)},[e]),(0,_.useEffect)(()=>{if(!V)return;function e(e){W.current?.contains(e.target)||H(!1)}function t(e){e.key===`Escape`&&H(!1)}return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}},[V]);let Q=(0,_.useCallback)((e,t=!1)=>{U(e),S(e),t&&window.requestAnimationFrame(()=>G.current.get(e)?.focus())},[S]),$=(0,_.useCallback)((e=!1)=>{z(),e&&window.requestAnimationFrame(()=>{document.getElementById(`right-sidebar-files-tab`)?.focus()})},[z]),Se=(0,_.useCallback)((t,n)=>{let r=e.findIndex(e=>e.id===n);if(r<0)return;let i=r+1,a=null;if(t.key===`ArrowRight`&&(a=(i+1)%(e.length+1)),t.key===`ArrowLeft`&&(a=(i-1+e.length+1)%(e.length+1)),t.key===`Home`&&(a=0),t.key===`End`&&(a=e.length),a===null)return;if(t.preventDefault(),a===0){$(!0);return}let o=e[a-1];o&&Q(o.id,!0)},[e,$,Q]),Ce=(0,_.useCallback)(t=>{if(![`ArrowRight`,`ArrowLeft`,`Home`,`End`].includes(t.key)||(t.preventDefault(),t.key===`Home`))return;let n=t.key===`ArrowLeft`||t.key===`End`?e.at(-1):e[0];n&&Q(n.id,!0)},[e,Q]);return(0,v.jsxs)(`aside`,{className:`workspace-diff-panel right-chat-panel-stack`,"aria-label":`Side chats`,children:[(0,v.jsx)(`div`,{className:`workspace-diff-resize-handle`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize side chat panel`,onPointerDown:ge}),(0,v.jsx)(`div`,{className:`workspace-diff-topbar right-chat-topbar`,children:(0,v.jsxs)(`div`,{className:`workspace-diff-tabs`,role:`tablist`,"aria-label":`Right sidebar views`,children:[(0,v.jsxs)(`button`,{type:`button`,className:`workspace-diff-tab`,role:`tab`,id:`right-sidebar-files-tab`,"aria-controls":`right-sidebar-files-panel`,"aria-selected":!1,tabIndex:-1,onClick:()=>$(!1),onKeyDown:Ce,children:[(0,v.jsx)(c,{size:14}),(0,v.jsx)(`span`,{children:`Files`})]}),e.map(e=>{let t=e.id===J?.id;return(0,v.jsxs)(`div`,{className:`workspace-diff-tab right-chat-tab ${t?`active`:``}`,children:[(0,v.jsxs)(`button`,{type:`button`,className:`workspace-diff-tab-main`,role:`tab`,id:`right-chat-tab-${e.id}`,"aria-controls":`right-chat-panel-${e.id}`,"aria-selected":t,tabIndex:t?0:-1,title:e.title,ref:t=>{t?G.current.set(e.id,t):G.current.delete(e.id)},onClick:()=>Q(e.id),onKeyDown:t=>Se(t,e.id),children:[e.running?(0,v.jsx)(`span`,{className:`right-chat-status-dot`,"aria-label":`Running`}):null,(0,v.jsx)(`span`,{children:e.title})]}),(0,v.jsx)(`button`,{type:`button`,className:`workspace-diff-tab-close`,title:`Close ${e.title}`,"aria-label":`Close ${e.title}`,onClick:t=>{t.stopPropagation(),C(e.id)},children:(0,v.jsx)(oe,{size:12})})]},e.id)}),(0,v.jsxs)(`div`,{className:`workspace-diff-add-anchor`,ref:W,children:[(0,v.jsx)(`button`,{type:`button`,className:`workspace-diff-add-tab ${V?`active`:``}`,title:`Add to right sidebar`,"aria-label":`Add to right sidebar`,"aria-haspopup":`menu`,"aria-expanded":V,onClick:()=>H(e=>!e),children:(0,v.jsx)(ae,{size:15})}),V?(0,v.jsxs)(`div`,{className:`workspace-diff-add-menu right-chat-add-popover`,role:`menu`,children:[(0,v.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{H(!1),x()},children:[(0,v.jsx)(l,{size:13}),(0,v.jsx)(`span`,{children:`New task`})]}),(0,v.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{H(!1),z()},children:[(0,v.jsx)(c,{size:13}),(0,v.jsx)(`span`,{children:`Files`})]})]}):null]})]})}),(0,v.jsx)(`div`,{className:`right-chat-stack-body panes-1`,children:J?(0,v.jsx)(me,{busy:ee,createImproveActions:a,contextCompaction:o,steerActiveResponses:s,codexPermissionMode:te,codexReasoningEffort:ne,openPondCommandAccessMode:re,connection:ie,connectedAppMentions:se,actionCatalog:xe,mentionApps:f,codexPersonalSkills:ce,profileSkills:Z,profileTarget:null,panel:J,runtimeEventStore:t,initialScrollState:{scrollTop:J.scrollTop,stickyToBottom:J.stickyToBottom},projectTarget:g,providerSettings:ue,accountBaseUrl:de,billingOrganizationSlug:fe,billingTeamId:pe,showToast:y,workspaceTarget:b,onCodexPermissionModeChange:w,onCodexReasoningEffortChange:T,onOpenPondCommandAccessModeChange:e=>E(e,J.session),onModelChange:e=>D(J.id,e),onOpenAttachmentInSidebar:O,onOpenFileInSidebar:k,onOpenProfileSettings:A,onOpenSession:j,onOpenPonder:M,onProviderChange:(e,t)=>N(J.id,e,t),onProviderSetupOpen:P,onPromptChange:e=>F(J.id,e),onProfileTargetChange:e=>I(J.sessionId,e),onScrollStateChange:e=>L(J.id,e),onProjectTargetChange:R,onResolveApproval:he,onShowBrowserPanel:_e,onStop:()=>ve(J.sessionId),onSubmit:(e,t,n,r)=>ye(J.id,e,t,n,r),onWorkspaceTargetChange:B},J.id):null})]})}export{y as RightChatPanelStack};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{w as RightSidebarHomePanel}from"./MainPane-CqtgV9rU.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{g as t,m as n}from"./index-CM0IRu1U.js";import{n as r,o as i}from"./client-choice-storage-Iuzoszas.js";import{t as a}from"./requests-BCbaFiqV.js";import{n as o,o as s,r as c}from"./ComposerAttachments-Ck9VWD6o.js";import"./icons-c3vt7y6n.js";import{F as l,I as u,L as d,V as f}from"./training-model-data-wHvE7xL1.js";import{t as p}from"./external-link-Cql9bKdv.js";import{t as m}from"./loader-circle-pxp89T5x.js";import{t as h}from"./maximize-2-yMp8X9ts.js";import{t as g}from"./play-BtlX2stU.js";import{t as _}from"./refresh-cw-B27ohHfn.js";import{t as v}from"./save-D-rwjKop.js";import{t as y}from"./x-D9GTV9ke.js";import{r as b}from"./AppToastContext-C-FsCKXW.js";import{Bt as x,Kt as S,Qt as C,bn as w,pn as T,vn as E}from"./App-BZuSv1XM.js";import{t as D}from"./useLocalAgentSchedules-P-UaUKMb.js";var O=e(t(),1),k=3e4;function A(e){let[t,n]=(0,O.useState)([]),[r,i]=(0,O.useState)([]),[a,o]=(0,O.useState)(null),[s,c]=(0,O.useState)(!1),[l,u]=(0,O.useState)(null),[d,f]=(0,O.useState)(()=>new Set);async function p(e,t){t&&c(!0);try{let t=await w.hostedSavedWork(e);n(t.definitions),i(t.runs),o(t.webBaseUrl??null),u(null)}catch(e){u(j(e))}finally{t&&c(!1)}}(0,O.useEffect)(()=>{if(!e){n([]),i([]),o(null),u(null),c(!1);return}let t=!1,r=async r=>{if(!t){r&&c(!0);try{let r=await w.hostedSavedWork(e);if(t)return;n(r.definitions),i(r.runs),o(r.webBaseUrl??null),u(null)}catch(e){t||u(j(e))}finally{!t&&r&&c(!1)}}};r(!0);let a=window.setInterval(()=>void r(!1),k);return()=>{t=!0,window.clearInterval(a)}},[e]);async function m(){e&&await p(e,!0)}async function h(t){e&&(await w.createHostedSavedWork(e,t),await p(e,!1))}async function g(e,t){await y(e,async n=>{await w.updateHostedSavedWork(n,e,t)})}async function _(e){await y(e,async t=>{await w.deleteHostedSavedWork(t,e)})}async function v(e){await y(e,async t=>{await w.runHostedSavedWork(t,e,crypto.randomUUID())})}async function y(t,n){if(e&&!d.has(t)){b(t,!0);try{await n(e),await p(e,!1)}catch(e){throw u(j(e)),e}finally{b(t,!1)}}}function b(e,t){f(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})}return{create:h,definitions:t,error:l,loading:s,pendingScheduleIds:d,refresh:m,remove:_,run:v,runs:r,update:g,webBaseUrl:a}}function j(e){return e instanceof Error?e.message:String(e)}var M=3e4;function ee(e){let[t,n]=(0,O.useState)([]),[r,i]=(0,O.useState)([]),[a,o]=(0,O.useState)(!1),[s,c]=(0,O.useState)(null),[l,u]=(0,O.useState)(()=>new Set),d=(0,O.useCallback)(async t=>{if(e){t&&o(!0);try{let t=await w.chatWorkflows(e);n(t.workflows),i(t.runs),c(null)}catch(e){c(e instanceof Error?e.message:String(e))}finally{t&&o(!1)}}},[e]);(0,O.useEffect)(()=>{if(!e){n([]),i([]),c(null),o(!1);return}d(!0);let t=window.setInterval(()=>void d(!1),M);return()=>window.clearInterval(t)},[e,d]);async function f(e,t){if(!l.has(e)){u(t=>new Set(t).add(e));try{await t(),await d(!1)}catch(e){throw c(e instanceof Error?e.message:String(e)),e}finally{u(t=>{let n=new Set(t);return n.delete(e),n})}}}return{workflows:t,runs:r,loading:a,error:s,pendingIds:l,refresh:()=>d(!0),update:(t,n)=>f(t,()=>w.updateChatWorkflow(e,t,n)),remove:t=>f(t,()=>w.deleteChatWorkflow(e,t)),run:t=>f(t,()=>w.runChatWorkflow(e,t))}}var N=`openpond.scheduled-work.view.v1`;function te(e=F()){try{return e?.getItem(N)===`list`?`list`:`calendar`}catch{return`calendar`}}function P(e,t=F()){try{t?.setItem(N,e)}catch{}}function F(){if(typeof window>`u`)return null;try{return r}catch{return null}}function I(e,t){if(!e)return`None`;let n=new Date(e);if(!Number.isFinite(n.getTime()))return`None`;try{return n.toLocaleString(void 0,{month:`short`,day:`numeric`,year:`numeric`,hour:`numeric`,minute:`2-digit`,...t?{timeZone:t,timeZoneName:`short`}:{}})}catch{return n.toLocaleString()}}function L(e){return R(e.replaceAll(`_`,` `))}function R(e){return e.replace(/^./,e=>e.toUpperCase())}function z(e){let[t=`0`,n=`00`]=e.split(`:`);return new Date(2020,0,1,Number(t),Number(n)).toLocaleTimeString(void 0,{hour:`numeric`,minute:`2-digit`})}var B=n();function V({run:e}){let t=e.error||e.stderr||e.stdout;return(0,B.jsxs)(`details`,{className:`scheduled-run-row`,children:[(0,B.jsxs)(`summary`,{children:[(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{children:L(e.status)}),(0,B.jsx)(`small`,{children:I(e.createdAt,null)})]}),(0,B.jsx)(`span`,{className:`scheduled-run-trigger`,children:e.trigger===`manual`?`Manual`:`Scheduled`})]}),t?(0,B.jsx)(`pre`,{children:t}):null]})}function H({onOpen:e,run:t}){return(0,B.jsxs)(`button`,{className:`scheduled-run-row hosted`,onClick:e,type:`button`,children:[(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{children:L(t.status)}),(0,B.jsx)(`small`,{children:I(t.createdAt,null)})]}),(0,B.jsxs)(`span`,{className:`scheduled-run-trigger`,children:[R(t.triggerKind),` `,(0,B.jsx)(p,{size:11})]}),t.deliveryError?(0,B.jsx)(`p`,{children:t.deliveryError}):null]})}function U({children:e,detailExpanded:t,kind:n=`schedule`,label:r,onClose:i,onDetailResizeStart:a,onToggleDetailExpanded:o}){return(0,B.jsxs)(`aside`,{"aria-label":r,className:`workspace-diff-panel scheduled-detail${t?` expanded`:``}`,children:[t?null:(0,B.jsx)(`div`,{"aria-label":`Resize schedule details`,"aria-orientation":`vertical`,className:`workspace-diff-resize-handle`,onPointerDown:a,role:`separator`}),(0,B.jsxs)(`div`,{className:`workspace-diff-topbar`,children:[(0,B.jsx)(`div`,{className:`workspace-diff-tabs`,role:`tablist`,"aria-label":`${n===`workflow`?`Workflow`:`Schedule`} details`,children:(0,B.jsxs)(`button`,{"aria-selected":`true`,className:`workspace-diff-tab active`,role:`tab`,type:`button`,children:[(0,B.jsx)(T,{size:14}),(0,B.jsx)(`span`,{children:n===`workflow`?`Workflow`:`Schedule`})]})}),(0,B.jsxs)(`div`,{className:`workspace-diff-toolbar-actions`,children:[(0,B.jsx)(`button`,{"aria-label":t?`Dock ${n} details`:`Expand ${n} details`,className:`diff-icon-button`,onClick:o,title:t?`Dock ${n} details`:`Expand ${n} details`,type:`button`,children:t?(0,B.jsx)(d,{size:14}):(0,B.jsx)(h,{size:14})}),(0,B.jsx)(`button`,{"aria-label":`Close ${n} details`,className:`diff-icon-button`,onClick:i,title:`Close ${n} details`,type:`button`,children:(0,B.jsx)(y,{size:14})})]})]}),(0,B.jsx)(`div`,{className:`scheduled-detail-body`,children:e})]})}function W({children:e,title:t}){return(0,B.jsxs)(`section`,{className:`scheduled-detail-section`,children:[(0,B.jsx)(`div`,{className:`scheduled-detail-section-heading`,children:(0,B.jsx)(`h3`,{children:t})}),e]})}function G({label:e,value:t}){return(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:e}),(0,B.jsx)(`dd`,{children:t})]})}function K({children:e}){return(0,B.jsx)(`p`,{className:`scheduled-empty`,children:e})}function ne({label:e}){return(0,B.jsxs)(`div`,{className:`scheduled-loading`,role:`status`,children:[(0,B.jsx)(m,{className:`scheduled-spin`,size:16}),(0,B.jsx)(`span`,{children:e})]})}var q=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`];function re({items:e,onSelect:t,selectedKey:n}){let[r,i]=(0,O.useState)(()=>se(new Date)),a=(0,O.useMemo)(()=>J(r),[r]),o=(0,O.useMemo)(()=>ie(e),[e]),s=new Intl.DateTimeFormat(void 0,{month:`long`,year:`numeric`}).format(r),c=e.filter(e=>!ae(e.nextRunAt));return(0,B.jsxs)(`div`,{className:`scheduled-calendar`,children:[(0,B.jsxs)(`div`,{className:`scheduled-calendar-toolbar`,children:[(0,B.jsx)(`strong`,{children:s}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`button`,{"aria-label":`Previous month`,className:`scheduled-icon-button`,onClick:()=>i(ce(r,-1)),type:`button`,children:(0,B.jsx)(E,{size:15})}),(0,B.jsx)(`button`,{className:`scheduled-calendar-today`,onClick:()=>i(se(new Date)),type:`button`,children:`Today`}),(0,B.jsx)(`button`,{"aria-label":`Next month`,className:`scheduled-icon-button`,onClick:()=>i(ce(r,1)),type:`button`,children:(0,B.jsx)(f,{size:15})})]})]}),(0,B.jsxs)(`div`,{className:`scheduled-calendar-grid`,role:`grid`,"aria-label":s,children:[q.map(e=>(0,B.jsx)(`div`,{className:`scheduled-calendar-weekday`,role:`columnheader`,children:e},e)),a.map(e=>{let i=oe(e),a=o.get(i)??[],s=e.getMonth()!==r.getMonth(),c=i===oe(new Date);return(0,B.jsxs)(`div`,{className:`scheduled-calendar-day${s?` outside`:``}${c?` today`:``}`,role:`gridcell`,children:[(0,B.jsx)(`span`,{className:`scheduled-calendar-day-number`,children:e.getDate()}),(0,B.jsx)(`div`,{className:`scheduled-calendar-events`,children:a.map(e=>(0,B.jsxs)(`button`,{"aria-current":n===e.key?`true`:void 0,className:`scheduled-calendar-event${e.enabled?``:` paused`}`,onClick:()=>t(e.key),title:e.title,type:`button`,children:[(0,B.jsx)(`span`,{children:le(e.nextRunAt)}),(0,B.jsx)(`strong`,{children:e.title})]},e.key))})]},i)})]}),c.length?(0,B.jsxs)(`div`,{className:`scheduled-calendar-unscheduled`,children:[(0,B.jsx)(`span`,{children:`No upcoming run`}),(0,B.jsx)(`div`,{children:c.map(e=>(0,B.jsx)(`button`,{onClick:()=>t(e.key),type:`button`,children:e.title},e.key))})]}):null]})}function J(e){let t=new Date(e.getFullYear(),e.getMonth(),1),n=new Date(t);return n.setDate(t.getDate()-t.getDay()),Array.from({length:42},(e,t)=>{let r=new Date(n);return r.setDate(n.getDate()+t),r})}function ie(e){let t=new Map;for(let n of e){let e=ae(n.nextRunAt);if(!e)continue;let r=oe(e);t.set(r,[...t.get(r)??[],n])}for(let e of t.values())e.sort((e,t)=>e.nextRunAt.localeCompare(t.nextRunAt));return t}function ae(e){if(!e)return null;let t=new Date(e);return Number.isNaN(t.getTime())?null:t}function oe(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`}function se(e){return new Date(e.getFullYear(),e.getMonth(),1)}function ce(e,t){return new Date(e.getFullYear(),e.getMonth()+t,1)}function le(e){return new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}).format(new Date(e))}function ue({entry:e,onSelect:t,selected:n}){return(0,B.jsxs)(`button`,{"aria-current":n?`true`:void 0,className:`scheduled-list-row`,onClick:t,type:`button`,children:[(0,B.jsx)(`span`,{className:`scheduled-status-dot`}),(0,B.jsxs)(`span`,{className:`scheduled-list-copy`,children:[(0,B.jsx)(`span`,{className:`scheduled-list-title`,children:(0,B.jsx)(`strong`,{children:e.workflow.label})}),(0,B.jsx)(`span`,{children:e.workflow.description}),(0,B.jsxs)(`small`,{children:[`On demand · Source `,e.binding.sourceRevision.slice(0,10)]})]})]})}function de({cadence:e,onSelect:t,schedule:n,selected:r}){return(0,B.jsxs)(`button`,{"aria-current":r?`true`:void 0,className:`scheduled-list-row`,onClick:t,type:`button`,children:[(0,B.jsx)(`span`,{className:`scheduled-status-dot ${n.enabled?`active`:`paused`}`}),(0,B.jsxs)(`span`,{className:`scheduled-list-copy`,children:[(0,B.jsx)(`span`,{className:`scheduled-list-title`,children:(0,B.jsx)(`strong`,{children:n.scheduleName})}),(0,B.jsx)(`span`,{children:n.localProjectName}),(0,B.jsxs)(`small`,{children:[e,n.nextRunAt?` · Next ${I(n.nextRunAt,n.timezone)}`:` · No next run`]})]})]})}function fe({cadence:e,definition:t,onSelect:n,schedule:r,selected:i}){return(0,B.jsxs)(`button`,{"aria-current":i?`true`:void 0,className:`scheduled-list-row`,onClick:n,type:`button`,children:[(0,B.jsx)(`span`,{className:`scheduled-status-dot ${r.enabled?`active`:`paused`}`}),(0,B.jsxs)(`span`,{className:`scheduled-list-copy`,children:[(0,B.jsxs)(`span`,{className:`scheduled-list-title`,children:[(0,B.jsx)(`strong`,{children:t.name}),(0,B.jsx)(`small`,{className:`scheduled-environment-badge hosted`,children:`Hosted`})]}),(0,B.jsx)(`span`,{children:t.prompt}),(0,B.jsxs)(`small`,{children:[e,r.nextRunAt?` · Next ${I(r.nextRunAt,r.timeZone)}`:` · No next run`]})]})]})}function pe({cadence:e,onSelect:t,selected:n,workflow:r}){return(0,B.jsxs)(`button`,{"aria-current":n?`true`:void 0,className:`scheduled-list-row`,onClick:t,type:`button`,children:[(0,B.jsx)(`span`,{className:`scheduled-status-dot ${r.enabled?`active`:`paused`}`}),(0,B.jsxs)(`span`,{className:`scheduled-list-copy`,children:[(0,B.jsxs)(`span`,{className:`scheduled-list-title`,children:[(0,B.jsx)(`strong`,{children:r.name}),(0,B.jsx)(`small`,{className:`scheduled-environment-badge`,children:`Chat`})]}),(0,B.jsx)(`span`,{children:r.prompt}),(0,B.jsxs)(`small`,{children:[`Runs in `,r.sessionTitle,` · `,e,r.nextRunAt?` · Next ${I(r.nextRunAt,r.recurrence.timeZone)}`:` · No next run`]})]})]})}function me(e,t){return e.filter(e=>t===`active`?e.enabled:t!==`paused`||!e.enabled).sort((e,t)=>(e.nextRunAt?new Date(e.nextRunAt).getTime():1/0)-(t.nextRunAt?new Date(t.nextRunAt).getTime():1/0)||e.name.localeCompare(t.name))}function he(e){let t=z(e.localTime);return e.kind===`once`?`Once on ${e.startDate} at ${t} · ${e.timeZone}`:e.kind===`weekdays`?`Weekdays at ${t} · ${e.timeZone}`:e.kind===`weekly`?`${e.weekdays?.map(R).join(`, `)??`Weekly`} at ${t} · ${e.timeZone}`:e.kind===`monthly`?`Monthly on day ${e.dayOfMonth??1} at ${t} · ${e.timeZone}`:`Daily at ${t} · ${e.timeZone}`}function ge({detailExpanded:e,onClose:t,onDelete:n,onDetailResizeStart:r,onRun:i,onToggle:a,onToggleDetailExpanded:o,pending:s,runs:c,workflow:d}){return(0,B.jsxs)(U,{detailExpanded:e,label:`${d.name} details`,onClose:t,onDetailResizeStart:r,onToggleDetailExpanded:o,children:[(0,B.jsx)(`div`,{className:`scheduled-detail-header`,children:(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`scheduled-detail-title-row`,children:[(0,B.jsx)(`h2`,{children:`Workflow details`}),(0,B.jsx)(`span`,{children:d.enabled?`Active`:`Paused`})]}),(0,B.jsx)(`p`,{children:d.name})]})}),(0,B.jsx)(W,{title:`Prompt`,children:(0,B.jsx)(`pre`,{className:`scheduled-prompt`,children:d.prompt})}),(0,B.jsx)(W,{title:`Profile source`,children:d.profileRef&&d.profileWorkflowId?(0,B.jsxs)(`p`,{children:[d.profileRef.profileId,` · workflows/`,d.profileWorkflowId,`/PROMPT.md`]}):(0,B.jsx)(`p`,{className:`scheduled-detail-error`,children:d.profileMigrationError??`Profile package is unresolved.`})}),(0,B.jsxs)(W,{title:`Delivery`,children:[(0,B.jsxs)(`dl`,{className:`scheduled-detail-fields`,children:[(0,B.jsx)(G,{label:`Runs in`,value:d.sessionTitle}),(0,B.jsx)(G,{label:`Cadence`,value:he(d.recurrence)}),(0,B.jsx)(G,{label:`Next run`,value:I(d.nextRunAt,d.recurrence.timeZone)}),(0,B.jsx)(G,{label:`Last run`,value:I(d.lastRunAt,d.recurrence.timeZone)})]}),d.lastError?(0,B.jsx)(`p`,{className:`scheduled-detail-error`,children:d.lastError}):null]}),(0,B.jsxs)(`div`,{className:`scheduled-detail-actions`,children:[(0,B.jsxs)(`button`,{disabled:s,onClick:()=>void i(),type:`button`,children:[(0,B.jsx)(S,{size:15}),(0,B.jsx)(`span`,{children:`Run now`})]}),(0,B.jsxs)(`button`,{disabled:s,onClick:()=>void a(),type:`button`,children:[d.enabled?(0,B.jsx)(u,{size:15}):(0,B.jsx)(g,{size:15}),(0,B.jsx)(`span`,{children:d.enabled?`Pause`:`Resume`})]}),(0,B.jsxs)(`button`,{disabled:s,onClick:()=>void n(),type:`button`,children:[(0,B.jsx)(l,{size:15}),(0,B.jsx)(`span`,{children:`Delete`})]})]}),(0,B.jsx)(W,{title:`Runs`,children:c.length===0?(0,B.jsx)(`p`,{className:`scheduled-no-runs`,children:`No runs yet.`}):(0,B.jsx)(`div`,{className:`scheduled-run-list`,children:c.map(e=>(0,B.jsxs)(`div`,{className:`scheduled-run-row`,children:[(0,B.jsx)(`span`,{children:R(e.status)}),(0,B.jsx)(`small`,{children:I(e.createdAt,d.recurrence.timeZone)}),e.error?(0,B.jsx)(`p`,{children:e.error}):null]},e.id))})})]})}async function _e(e){let t=e.catalog.workflows.find(t=>t.workflow.id===e.workflowId);if(!t)throw Error(`Selected Profile workflow is unavailable.`);let n=e.client??w,r=await n.createSession(e.connection,{experience:`work`,provider:`openpond`,...e.workspaceTarget===`local`?{metadata:{workspaceTarget:`local`}}:{},currentProfile:e.catalog.profileRef,profileWorkflowBinding:t.binding,title:t.workflow.label});return e.onSessionCreated?.(r.id),await n.sendTurn(e.connection,r.id,{prompt:e.prompt?.trim()||t.workflow.label,workflowInput:e.value,...e.attachments?.length?{attachments:e.attachments}:{},approvalPolicy:`on-request`,sandbox:`workspace-write`,codexPermissionMode:`default`}),r.id}function ve({catalog:e,connection:t,detailExpanded:n,entry:r,onClose:i,onDetailResizeStart:l,onOpenSession:u,onToggleDetailExpanded:d}){let[f,p]=(0,O.useState)(``),[m,h]=(0,O.useState)([]),[g,_]=(0,O.useState)(`{}`),[v,y]=(0,O.useState)(e.profileRef.source===`local`?`local`:`hosted`),[b,C]=(0,O.useState)(!1),[w,T]=(0,O.useState)(null),E=r.workflow;async function D(n){if(n.preventDefault(),!b){C(!0),T(null);try{let n=JSON.parse(g);if(m.length>a.maxAttachments)throw Error(`Choose at most ${a.maxAttachments} files.`);let r=await Promise.all(m.map(async e=>{if(e.size>a.maxAttachmentBytes)throw Error(`${e.name} exceeds the attachment size limit.`);return s({id:c(),file:e,name:e.name,mediaType:e.type||`application/octet-stream`,sizeBytes:e.size,kind:o(e)})}));await _e({connection:t,catalog:e,workflowId:E.id,value:n,prompt:f,attachments:r,workspaceTarget:v,onSessionCreated:u})}catch(e){T(e instanceof Error?e.message:String(e))}finally{C(!1)}}}return(0,B.jsxs)(U,{detailExpanded:n,kind:`workflow`,label:`${E.label} details`,onClose:i,onDetailResizeStart:l,onToggleDetailExpanded:d,children:[(0,B.jsx)(`div`,{className:`scheduled-detail-header`,children:(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`scheduled-detail-title-row`,children:(0,B.jsx)(`h2`,{children:`Workflow details`})}),(0,B.jsx)(`p`,{children:E.label})]})}),(0,B.jsx)(W,{title:`Description`,children:(0,B.jsx)(`p`,{children:E.description})}),(0,B.jsxs)(W,{title:`Source`,children:[(0,B.jsxs)(`p`,{children:[`workflows/`,E.id,`/`,E.invocation.kind===`instructions`?`PROMPT.md`:`ACTION.json`]}),(0,B.jsxs)(`p`,{children:[`Revision `,r.binding.sourceRevision.slice(0,12),` · Release `,r.binding.harnessRelease.contentHash.slice(0,12)]})]}),E.skillPaths.length>0?(0,B.jsx)(W,{title:`Skills`,children:(0,B.jsx)(`p`,{children:E.skillPaths.join(`, `)})}):null,E.invocation.kind===`instructions`?(0,B.jsx)(W,{title:`Instructions`,children:(0,B.jsx)(`pre`,{className:`scheduled-prompt`,children:E.invocation.instructions})}):null,(0,B.jsx)(W,{title:`Start a run`,children:(0,B.jsxs)(`form`,{className:`scheduled-profile-workflow-form`,onSubmit:e=>void D(e),children:[(0,B.jsx)(`label`,{htmlFor:`scheduled-profile-workflow-prompt`,children:`Instructions for this run`}),(0,B.jsx)(`textarea`,{id:`scheduled-profile-workflow-prompt`,onChange:e=>p(e.target.value),value:f}),(0,B.jsx)(`label`,{htmlFor:`scheduled-profile-workflow-files`,children:`Files for this run`}),(0,B.jsx)(`input`,{id:`scheduled-profile-workflow-files`,type:`file`,multiple:!0,onChange:e=>h(Array.from(e.target.files??[]))}),m.length>0?(0,B.jsx)(`small`,{children:m.map(e=>e.name).join(`, `)}):null,(0,B.jsx)(`label`,{htmlFor:`scheduled-profile-workflow-target`,children:`Run in`}),(0,B.jsxs)(`select`,{id:`scheduled-profile-workflow-target`,value:v,onChange:e=>y(e.target.value),children:[(0,B.jsx)(`option`,{value:`local`,children:`Desktop local workspace`}),(0,B.jsx)(`option`,{value:`hosted`,children:`Hosted Work`})]}),E.invocation.kind===`agent_action`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`label`,{htmlFor:`scheduled-profile-workflow-input`,children:`Input JSON`}),(0,B.jsx)(`textarea`,{id:`scheduled-profile-workflow-input`,onChange:e=>_(e.target.value),value:g})]}):null,w?(0,B.jsx)(x,{error:w}):null,(0,B.jsx)(`div`,{className:`scheduled-detail-actions`,children:(0,B.jsxs)(`button`,{disabled:b,type:`submit`,children:[(0,B.jsx)(S,{size:15}),(0,B.jsx)(`span`,{children:b?`Starting…`:`Run now`})]})})]})})]})}function ye(e){return e.flatMap(e=>e.schedules.map(t=>({definition:e,schedule:t})))}function be(e,t){return e.filter(e=>t===`active`?e.schedule.enabled:t!==`paused`||!e.schedule.enabled).sort((e,t)=>$(e.schedule.nextRunAt)-$(t.schedule.nextRunAt)||e.definition.name.localeCompare(t.definition.name))}function xe(e,t){return e.filter(e=>t===`active`?e.enabled:t!==`paused`||!e.enabled).sort((e,t)=>$(e.nextRunAt)-$(t.nextRunAt)||e.scheduleName.localeCompare(t.scheduleName))}function Se(e,t,n){return[...e.map(e=>({kind:`chat`,workflow:e})),...t.map(e=>({kind:`local`,schedule:e})),...n.map(e=>({kind:`hosted`,row:e}))].sort((e,t)=>{let n=$(Te(e)),r=$(Te(t));if(n!==r)return n-r;let i=Ee(e),a=Ee(t);return i.localeCompare(a)})}function Ce(e){return e.kind===`chat`?{enabled:e.workflow.enabled,key:X(e.workflow.id),nextRunAt:e.workflow.nextRunAt,title:e.workflow.name}:e.kind===`local`?{enabled:e.schedule.enabled,key:Y(e.schedule.id),nextRunAt:e.schedule.nextRunAt,title:e.schedule.scheduleName}:{enabled:e.row.schedule.enabled,key:Q(e.row.schedule.id),nextRunAt:e.row.schedule.nextRunAt,title:e.row.definition.name}}function we(e){let t=e.recurrence;return t?he(t):e.expression??`Manual`}function Te(e){return e.kind===`chat`?e.workflow.nextRunAt:e.kind===`local`?e.schedule.nextRunAt:e.row.schedule.nextRunAt}function Ee(e){return e.kind===`chat`?e.workflow.name:e.kind===`local`?e.schedule.scheduleName:e.row.definition.name}function De(e){let t=e.timezone?` · ${e.timezone}`:``;if(e.scheduleType===`rate`)return`Every ${e.scheduleExpression}${t}`;let n=e.scheduleExpression.trim().split(/\s+/);if(n.length===5&&/^\d+$/.test(n[0])&&/^\d+$/.test(n[1])){let e=z(`${n[1].padStart(2,`0`)}:${n[0].padStart(2,`0`)}`);if(n[2]===`*`&&n[3]===`*`&&n[4]===`*`)return`Daily at ${e}${t}`;if(n[2]===`*`&&n[3]===`*`&&n[4]===`MON-FRI`)return`Weekdays at ${e}${t}`}return`Cron ${e.scheduleExpression}${t}`}function Y(e){return`local:${e}`}function X(e){return`chat:${e}`}function Z(e){return`profile:${e}`}function Q(e){return`hosted:${e}`}function $(e){if(!e)return 2**53-1;let t=new Date(e).getTime();return Number.isFinite(t)?t:2**53-1}var Oe=[`sunday`,`monday`,`tuesday`,`wednesday`,`thursday`,`friday`,`saturday`];function ke({connection:e,selectedProfileKey:t,onOpenSession:n,detailOpen:r,detailExpanded:a,onDetailOpenChange:o,onDetailResizeStart:s,onToggleDetailExpanded:c}){let l=A(e),u=ee(e),d=D(e),[f,p]=(0,O.useState)(null),[m,h]=(0,O.useState)(!1),[g,v]=(0,O.useState)(null),[y,x]=(0,O.useState)(`all`),[S,T]=(0,O.useState)(te);i(()=>T(te()));let[E,k]=(0,O.useState)(!1),[j,M]=(0,O.useState)(null),N=(0,O.useMemo)(()=>ye(l.definitions),[l.definitions]),F=(0,O.useMemo)(()=>be(N,y),[y,N]),I=(0,O.useMemo)(()=>xe(d.schedules,y),[y,d.schedules]),L=(0,O.useMemo)(()=>me(u.workflows,y),[u.workflows,y]),R=N.find(e=>Q(e.schedule.id)===j)??null,z=d.schedules.find(e=>Y(e.id)===j)??null,V=u.workflows.find(e=>X(e.id)===j)??null,H=f?.workflows.find(e=>Z(e.workflow.id)===j)??null,U=R?l.runs.filter(e=>e.scheduleId===R.schedule.id):[],W=(0,O.useMemo)(()=>Se(L,I,F),[L,I,F]),G=(0,O.useMemo)(()=>[...W.map(Ce),...f?.workflows.map(e=>({enabled:!0,key:Z(e.workflow.id),nextRunAt:null,title:e.workflow.label}))??[]],[W,f]);b(l.error,{prefix:`Workflows`}),b(d.error,{prefix:`Local schedules`}),b(u.error,{prefix:`Chat workflows`}),b(g,{prefix:`Profile workflows`}),(0,O.useEffect)(()=>{if(!e||!t){p(null),v(null);return}let n=!0;return h(!0),w.profileWorkflows(e).then(e=>{n&&(p(e),v(null))}).catch(e=>{n&&v(e instanceof Error?e.message:String(e))}).finally(()=>{n&&h(!1)}),()=>{n=!1}},[e,t]),(0,O.useEffect)(()=>{j&&!R&&!z&&!V&&!H&&!m&&M(null)},[m,V,R,z,H,j]),(0,O.useEffect)(()=>{!r&&j&&M(null)},[r,j]),(0,O.useEffect)(()=>()=>o(!1),[o]);function q(e){M(e),o(!0)}function J(){M(null),o(!1)}function ie(e){T(e),P(e)}async function ae(){k(!0);try{await Promise.all([l.refresh(),d.refresh(),u.refresh(),e&&t?w.profileWorkflows(e).then(p):Promise.resolve()])}finally{k(!1)}}return(0,B.jsxs)(`section`,{"aria-label":`Workflows`,className:`scheduled-work-view${R||z||V||H?` detail-open`:``}${a?` detail-expanded`:``}`,children:[(0,B.jsx)(`div`,{className:`scheduled-work-scroll`,children:(0,B.jsxs)(`div`,{className:`scheduled-work-content`,children:[(0,B.jsxs)(`header`,{className:`scheduled-work-header`,children:[(0,B.jsxs)(`div`,{"aria-label":`Workflow view`,className:`scheduled-view-tabs`,role:`tablist`,children:[(0,B.jsx)(`button`,{"aria-selected":S===`calendar`,className:S===`calendar`?`active`:void 0,onClick:()=>ie(`calendar`),role:`tab`,type:`button`,children:`Calendar`}),(0,B.jsx)(`button`,{"aria-selected":S===`list`,className:S===`list`?`active`:void 0,onClick:()=>ie(`list`),role:`tab`,type:`button`,children:`List`})]}),(0,B.jsxs)(`div`,{className:`scheduled-work-header-actions`,children:[(0,B.jsx)(`button`,{"aria-label":`Refresh schedules`,className:`scheduled-icon-button`,disabled:!e||l.loading||d.loading||u.loading||m,onClick:()=>void ae(),title:`Refresh schedules`,type:`button`,children:(0,B.jsx)(_,{className:E?`scheduled-spin`:void 0,size:16})}),(0,B.jsxs)(`label`,{className:`scheduled-filter`,children:[(0,B.jsx)(C,{"aria-hidden":`true`,size:16}),(0,B.jsxs)(`select`,{"aria-label":`Schedule filter`,onChange:e=>x(e.target.value),value:y,children:[(0,B.jsx)(`option`,{value:`active`,children:`Active`}),(0,B.jsx)(`option`,{value:`paused`,children:`Paused`}),(0,B.jsx)(`option`,{value:`all`,children:`All`})]})]})]})]}),(0,B.jsx)(`section`,{"aria-busy":l.loading||d.loading||u.loading||m,className:`scheduled-list`,children:e?(l.loading||d.loading||u.loading||m)&&N.length===0&&d.schedules.length===0&&u.workflows.length===0&&!f?.workflows.length?(0,B.jsx)(ne,{label:`Loading schedules`}):l.error&&d.error&&N.length===0&&d.schedules.length===0?(0,B.jsx)(K,{children:`Schedules are unavailable. Refresh to try again.`}):W.length===0&&!f?.workflows.length?(0,B.jsx)(K,{children:`Create a scheduled task here or ask for one in Work.`}):S===`calendar`?(0,B.jsx)(re,{items:G,onSelect:q,selectedKey:j}):(0,B.jsxs)(`div`,{className:`scheduled-list-rows`,children:[f?.workflows.map(e=>(0,B.jsx)(ue,{entry:e,onSelect:()=>q(Z(e.workflow.id)),selected:j===Z(e.workflow.id)},Z(e.workflow.id))),W.map(e=>e.kind===`chat`?(0,B.jsx)(pe,{cadence:he(e.workflow.recurrence),onSelect:()=>q(X(e.workflow.id)),selected:j===X(e.workflow.id),workflow:e.workflow},X(e.workflow.id)):e.kind===`local`?(0,B.jsx)(de,{cadence:De(e.schedule),onSelect:()=>q(Y(e.schedule.id)),schedule:e.schedule,selected:j===Y(e.schedule.id)},Y(e.schedule.id)):(0,B.jsx)(fe,{cadence:we(e.row.schedule),definition:e.row.definition,onSelect:()=>q(Q(e.row.schedule.id)),schedule:e.row.schedule,selected:j===Q(e.row.schedule.id)},Q(e.row.schedule.id)))]}):(0,B.jsx)(K,{children:`Connect to OpenPond to view scheduled Work.`})})]})}),H&&f&&e?(0,B.jsx)(ve,{catalog:f,connection:e,detailExpanded:a,entry:H,onClose:J,onDetailResizeStart:s,onOpenSession:n,onToggleDetailExpanded:c},H.workflow.id):R?(0,B.jsx)(je,{onClose:J,onDelete:async()=>{await l.remove(R.schedule.id),J()},onRun:()=>l.run(R.schedule.id),onSave:e=>l.update(R.schedule.id,e),onToggle:()=>l.update(R.schedule.id,{enabled:!R.schedule.enabled}),pending:l.pendingScheduleIds.has(R.schedule.id),row:R,runs:U,detailExpanded:a,onDetailResizeStart:s,onToggleDetailExpanded:c,webBaseUrl:l.webBaseUrl},`${R.schedule.id}:${R.definition.version}:${R.schedule.configurationVersion}`):V?(0,B.jsx)(ge,{detailExpanded:a,onClose:J,onDelete:async()=>{await u.remove(V.id),J()},onDetailResizeStart:s,onRun:()=>u.run(V.id),onToggle:()=>u.update(V.id,{enabled:!V.enabled}),onToggleDetailExpanded:c,pending:u.pendingIds.has(V.id),runs:u.runs.filter(e=>e.workflowId===V.id),workflow:V},V.id):z?(0,B.jsx)(Ae,{connection:e,onClose:J,onRun:()=>d.run(z),onToggle:()=>d.toggle(z),pending:d.pendingScheduleIds.has(z.id),schedule:z,detailExpanded:a,onDetailResizeStart:s,onToggleDetailExpanded:c},z.id):null]})}function Ae({connection:e,detailExpanded:t,onClose:n,onDetailResizeStart:r,onRun:i,onToggleDetailExpanded:a,onToggle:o,pending:s,schedule:c}){let l=Pe(e,c.id);return b(l.error,{prefix:`Local schedule runs`}),(0,B.jsxs)(U,{detailExpanded:t,label:`${c.scheduleName} details`,onClose:n,onDetailResizeStart:r,onToggleDetailExpanded:a,children:[(0,B.jsx)(`div`,{className:`scheduled-detail-header`,children:(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`scheduled-detail-title-row`,children:[(0,B.jsx)(`h2`,{children:`Schedule details`}),(0,B.jsx)(`span`,{children:c.enabled?`Active`:`Paused`})]}),(0,B.jsx)(`p`,{children:c.scheduleName})]})}),(0,B.jsxs)(W,{title:`Task`,children:[(0,B.jsxs)(`dl`,{className:`scheduled-detail-fields`,children:[(0,B.jsx)(G,{label:`Environment`,value:`Local`}),(0,B.jsx)(G,{label:`Project`,value:c.localProjectName}),(0,B.jsx)(G,{label:`Agent`,value:c.agentName}),(0,B.jsx)(G,{label:`Action`,value:c.targetAction})]}),(0,B.jsx)(`pre`,{className:`scheduled-prompt`,children:Ne(c)})]}),(0,B.jsxs)(W,{title:`Schedule`,children:[(0,B.jsxs)(`dl`,{className:`scheduled-detail-fields`,children:[(0,B.jsx)(G,{label:`Cadence`,value:De(c)}),(0,B.jsx)(G,{label:`Expression`,value:c.scheduleExpression}),(0,B.jsx)(G,{label:`Timezone`,value:c.timezone??`Local time`}),(0,B.jsx)(G,{label:`Next run`,value:I(c.nextRunAt,c.timezone)}),(0,B.jsx)(G,{label:`Last run`,value:I(c.lastRunAt,c.timezone)})]}),c.lastError?(0,B.jsx)(`p`,{className:`scheduled-detail-error`,children:c.lastError}):null]}),(0,B.jsxs)(`div`,{className:`scheduled-detail-actions`,children:[(0,B.jsxs)(`button`,{disabled:s,onClick:()=>void i(),type:`button`,children:[(0,B.jsx)(S,{size:15}),(0,B.jsx)(`span`,{children:`Run now`})]}),(0,B.jsxs)(`button`,{disabled:s,onClick:()=>void o(),type:`button`,children:[c.enabled?(0,B.jsx)(u,{size:15}):(0,B.jsx)(g,{size:15}),(0,B.jsx)(`span`,{children:c.enabled?`Pause`:`Resume`})]})]}),(0,B.jsx)(W,{title:`Runs`,children:l.loading&&l.runs.length===0?(0,B.jsx)(ne,{label:`Loading runs`}):l.runs.length===0?(0,B.jsx)(`p`,{className:`scheduled-no-runs`,children:`No runs yet.`}):(0,B.jsx)(`div`,{className:`scheduled-run-list`,children:l.runs.map(e=>(0,B.jsx)(V,{run:e},e.id))})})]})}function je({detailExpanded:e,onClose:t,onDelete:n,onDetailResizeStart:r,onRun:i,onSave:a,onToggleDetailExpanded:o,onToggle:s,pending:c,row:d,runs:f,webBaseUrl:m}){let h=Me(d.schedule),[_,y]=(0,O.useState)(d.definition.name),[b,x]=(0,O.useState)(d.definition.prompt),[C,w]=(0,O.useState)(h.kind),[T,E]=(0,O.useState)(h.timeZone),[D,k]=(0,O.useState)(h.startDate),[A,j]=(0,O.useState)(h.localTime),[M,ee]=(0,O.useState)(h.weekdays?.[0]??`monday`),[N,te]=(0,O.useState)(h.dayOfMonth??1),P=f[0]?.conversationId??null,F=m?Fe(m,P):null,L=_!==d.definition.name||b!==d.definition.prompt||C!==h.kind||T!==h.timeZone||D!==h.startDate||A!==h.localTime||M!==(h.weekdays?.[0]??`monday`)||N!==(h.dayOfMonth??1);async function z(e){e.preventDefault(),await a({name:_,prompt:b,recurrence:{version:1,kind:C,timeZone:T,startDate:D,localTime:A,end:{kind:`never`},...C===`weekly`?{weekdays:[M]}:{},...C===`monthly`?{dayOfMonth:N}:{}}})}return(0,B.jsx)(U,{detailExpanded:e,label:`${d.definition.name} details`,onClose:t,onDetailResizeStart:r,onToggleDetailExpanded:o,children:(0,B.jsxs)(`form`,{onSubmit:z,children:[(0,B.jsxs)(`div`,{className:`scheduled-detail-header`,children:[(0,B.jsx)(`div`,{children:(0,B.jsxs)(`div`,{className:`scheduled-detail-title-row`,children:[(0,B.jsx)(`h2`,{children:`Schedule details`}),(0,B.jsx)(`span`,{children:d.schedule.enabled?`Active`:`Paused`})]})}),(0,B.jsx)(`div`,{className:`scheduled-detail-header-controls`,children:(0,B.jsx)(`button`,{"aria-label":`Delete schedule`,className:`scheduled-icon-button`,disabled:c,onClick:()=>void n(),title:`Delete schedule`,type:`button`,children:(0,B.jsx)(l,{size:16})})})]}),(0,B.jsxs)(W,{title:`Task`,children:[(0,B.jsxs)(`label`,{className:`scheduled-field`,children:[(0,B.jsx)(`span`,{children:`Name`}),(0,B.jsx)(`input`,{maxLength:180,onChange:e=>y(e.target.value),required:!0,value:_})]}),(0,B.jsxs)(`label`,{className:`scheduled-field`,children:[(0,B.jsx)(`span`,{children:`Prompt`}),(0,B.jsx)(`textarea`,{onChange:e=>x(e.target.value),required:!0,value:b})]})]}),(0,B.jsxs)(W,{title:`Schedule`,children:[(0,B.jsxs)(`div`,{className:`scheduled-field-grid`,children:[(0,B.jsxs)(`label`,{className:`scheduled-field`,children:[(0,B.jsx)(`span`,{children:`Repeat`}),(0,B.jsxs)(`select`,{onChange:e=>w(e.target.value),value:C,children:[(0,B.jsx)(`option`,{value:`once`,children:`Once`}),(0,B.jsx)(`option`,{value:`daily`,children:`Daily`}),(0,B.jsx)(`option`,{value:`weekdays`,children:`Weekdays`}),(0,B.jsx)(`option`,{value:`weekly`,children:`Weekly`}),(0,B.jsx)(`option`,{value:`monthly`,children:`Monthly`})]})]}),C===`weekly`?(0,B.jsxs)(`label`,{className:`scheduled-field`,children:[(0,B.jsx)(`span`,{children:`Day`}),(0,B.jsx)(`select`,{onChange:e=>ee(e.target.value),value:M,children:Oe.map(e=>(0,B.jsx)(`option`,{value:e,children:R(e)},e))})]}):C===`monthly`?(0,B.jsxs)(`label`,{className:`scheduled-field`,children:[(0,B.jsx)(`span`,{children:`Day of month`}),(0,B.jsx)(`input`,{max:31,min:1,onChange:e=>te(Number(e.target.value)),type:`number`,value:N})]}):null,(0,B.jsxs)(`label`,{className:`scheduled-field`,children:[(0,B.jsx)(`span`,{children:`Start date`}),(0,B.jsx)(`input`,{onChange:e=>k(e.target.value),required:!0,type:`date`,value:D})]}),(0,B.jsxs)(`label`,{className:`scheduled-field`,children:[(0,B.jsx)(`span`,{children:`Time`}),(0,B.jsx)(`input`,{onChange:e=>j(e.target.value),required:!0,type:`time`,value:A})]}),(0,B.jsxs)(`label`,{className:`scheduled-field scheduled-field-wide`,children:[(0,B.jsx)(`span`,{children:`Timezone`}),(0,B.jsx)(`input`,{onChange:e=>E(e.target.value),required:!0,value:T})]})]}),(0,B.jsxs)(`p`,{className:`scheduled-next-run`,children:[`Next run: `,I(d.schedule.nextRunAt,h.timeZone)]})]}),(0,B.jsxs)(`div`,{className:`scheduled-detail-actions`,children:[L?(0,B.jsxs)(`button`,{disabled:c,type:`submit`,children:[(0,B.jsx)(v,{size:15}),(0,B.jsx)(`span`,{children:`Save`})]}):null,(0,B.jsxs)(`button`,{disabled:c,onClick:()=>void i(),type:`button`,children:[(0,B.jsx)(S,{size:15}),(0,B.jsx)(`span`,{children:`Run now`})]}),(0,B.jsxs)(`button`,{disabled:c,onClick:()=>void s(),type:`button`,children:[d.schedule.enabled?(0,B.jsx)(u,{size:15}):(0,B.jsx)(g,{size:15}),(0,B.jsx)(`span`,{children:d.schedule.enabled?`Pause`:`Resume`})]})]}),(0,B.jsxs)(`button`,{className:`scheduled-open-chat`,disabled:c||!F,onClick:()=>{F&&Ie(F,P)},type:`button`,children:[(0,B.jsx)(`span`,{children:`Open hosted chat`}),(0,B.jsx)(p,{size:14})]}),(0,B.jsx)(W,{title:`Runs`,children:f.length===0?(0,B.jsx)(`p`,{className:`scheduled-no-runs`,children:`No runs yet.`}):(0,B.jsx)(`div`,{className:`scheduled-run-list`,children:f.map(e=>(0,B.jsx)(H,{onOpen:()=>{m&&Ie(Fe(m,e.conversationId),e.conversationId)},run:e},e.id))})})]})})}function Me(e){return e.recurrence??{version:1,kind:`daily`,timeZone:e.timeZone||Re(),startDate:Le(),localTime:`08:00`,end:{kind:`never`}}}function Ne(e){let t=e.input.prompt;return typeof t==`string`&&t.trim()?t.trim():Object.keys(e.input).length>0?JSON.stringify(e.input,null,2):`No task input configured.`}function Pe(e,t){let[n,r]=(0,O.useState)([]),[i,a]=(0,O.useState)(!1),[o,s]=(0,O.useState)(null);return(0,O.useEffect)(()=>{if(!e){r([]),a(!1),s(null);return}let n=!1;return a(!0),w.localAgentScheduleRuns(e,t,{limit:20}).then(e=>{n||(r(e.runs),s(null))}).catch(e=>{n||s(ze(e))}).finally(()=>{n||a(!1)}),()=>{n=!0}},[e,t]),{error:o,loading:i,runs:n}}function Fe(e,t){let n=new URL(e);return n.pathname=t?`/sandboxes/work/${encodeURIComponent(t)}`:`/sandboxes/work`,n.search=``,n.hash=``,n.toString()}async function Ie(e,t){let n=window.openpond?.browser;n?.openExternal&&(await n.openExternal({conversationId:t??`hosted-scheduled-work`,url:e})).ok||window.open(e,`_blank`,`noopener,noreferrer`)}function Le(){return new Date().toISOString().slice(0,10)}function Re(){return Intl.DateTimeFormat().resolvedOptions().timeZone||`UTC`}function ze(e){return e instanceof Error?e.message:String(e)}export{ke as ScheduledWorkPage};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{g as t,m as n}from"./index-D7igQSAg.js";import{n as r,o as i}from"./client-choice-storage-CXlWJW5g.js";import{t as a}from"./requests-BCbaFiqV.js";import{n as o,o as s,r as c}from"./ComposerAttachments-srWBKvCv.js";import"./icons-B8_Rkg-l.js";import{F as l,I as u,L as d,V as f}from"./training-model-data-CWnu1bz9.js";import{t as p}from"./external-link-D_nBEDFO.js";import{t as m}from"./loader-circle-D_KVxLLz.js";import{t as h}from"./maximize-2-B8HN3jsA.js";import{t as g}from"./play-DYLqBrwg.js";import{t as _}from"./refresh-cw-CzVf5_oo.js";import{t as v}from"./save-DatjrYPV.js";import{t as y}from"./x-Bhl-4Zlt.js";import{r as b}from"./AppToastContext-Dklk6CaG.js";import{Bt as x,Kt as S,Qt as C,bn as w,pn as T,vn as E}from"./App-CNQi3RlI.js";import{t as D}from"./useLocalAgentSchedules-DNh_x9gQ.js";var O=e(t(),1),k=3e4;function A(e){let[t,n]=(0,O.useState)([]),[r,i]=(0,O.useState)([]),[a,o]=(0,O.useState)(null),[s,c]=(0,O.useState)(!1),[l,u]=(0,O.useState)(null),[d,f]=(0,O.useState)(()=>new Set);async function p(e,t){t&&c(!0);try{let t=await w.hostedSavedWork(e);n(t.definitions),i(t.runs),o(t.webBaseUrl??null),u(null)}catch(e){u(j(e))}finally{t&&c(!1)}}(0,O.useEffect)(()=>{if(!e){n([]),i([]),o(null),u(null),c(!1);return}let t=!1,r=async r=>{if(!t){r&&c(!0);try{let r=await w.hostedSavedWork(e);if(t)return;n(r.definitions),i(r.runs),o(r.webBaseUrl??null),u(null)}catch(e){t||u(j(e))}finally{!t&&r&&c(!1)}}};r(!0);let a=window.setInterval(()=>void r(!1),k);return()=>{t=!0,window.clearInterval(a)}},[e]);async function m(){e&&await p(e,!0)}async function h(t){e&&(await w.createHostedSavedWork(e,t),await p(e,!1))}async function g(e,t){await y(e,async n=>{await w.updateHostedSavedWork(n,e,t)})}async function _(e){await y(e,async t=>{await w.deleteHostedSavedWork(t,e)})}async function v(e){await y(e,async t=>{await w.runHostedSavedWork(t,e,crypto.randomUUID())})}async function y(t,n){if(e&&!d.has(t)){b(t,!0);try{await n(e),await p(e,!1)}catch(e){throw u(j(e)),e}finally{b(t,!1)}}}function b(e,t){f(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})}return{create:h,definitions:t,error:l,loading:s,pendingScheduleIds:d,refresh:m,remove:_,run:v,runs:r,update:g,webBaseUrl:a}}function j(e){return e instanceof Error?e.message:String(e)}var M=3e4;function ee(e){let[t,n]=(0,O.useState)([]),[r,i]=(0,O.useState)([]),[a,o]=(0,O.useState)(!1),[s,c]=(0,O.useState)(null),[l,u]=(0,O.useState)(()=>new Set),d=(0,O.useCallback)(async t=>{if(e){t&&o(!0);try{let t=await w.chatWorkflows(e);n(t.workflows),i(t.runs),c(null)}catch(e){c(e instanceof Error?e.message:String(e))}finally{t&&o(!1)}}},[e]);(0,O.useEffect)(()=>{if(!e){n([]),i([]),c(null),o(!1);return}d(!0);let t=window.setInterval(()=>void d(!1),M);return()=>window.clearInterval(t)},[e,d]);async function f(e,t){if(!l.has(e)){u(t=>new Set(t).add(e));try{await t(),await d(!1)}catch(e){throw c(e instanceof Error?e.message:String(e)),e}finally{u(t=>{let n=new Set(t);return n.delete(e),n})}}}return{workflows:t,runs:r,loading:a,error:s,pendingIds:l,refresh:()=>d(!0),update:(t,n)=>f(t,()=>w.updateChatWorkflow(e,t,n)),remove:t=>f(t,()=>w.deleteChatWorkflow(e,t)),run:t=>f(t,()=>w.runChatWorkflow(e,t))}}var N=`openpond.scheduled-work.view.v1`;function te(e=F()){try{return e?.getItem(N)===`list`?`list`:`calendar`}catch{return`calendar`}}function P(e,t=F()){try{t?.setItem(N,e)}catch{}}function F(){if(typeof window>`u`)return null;try{return r}catch{return null}}function I(e,t){if(!e)return`None`;let n=new Date(e);if(!Number.isFinite(n.getTime()))return`None`;try{return n.toLocaleString(void 0,{month:`short`,day:`numeric`,year:`numeric`,hour:`numeric`,minute:`2-digit`,...t?{timeZone:t,timeZoneName:`short`}:{}})}catch{return n.toLocaleString()}}function L(e){return R(e.replaceAll(`_`,` `))}function R(e){return e.replace(/^./,e=>e.toUpperCase())}function z(e){let[t=`0`,n=`00`]=e.split(`:`);return new Date(2020,0,1,Number(t),Number(n)).toLocaleTimeString(void 0,{hour:`numeric`,minute:`2-digit`})}var B=n();function V({run:e}){let t=e.error||e.stderr||e.stdout;return(0,B.jsxs)(`details`,{className:`scheduled-run-row`,children:[(0,B.jsxs)(`summary`,{children:[(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{children:L(e.status)}),(0,B.jsx)(`small`,{children:I(e.createdAt,null)})]}),(0,B.jsx)(`span`,{className:`scheduled-run-trigger`,children:e.trigger===`manual`?`Manual`:`Scheduled`})]}),t?(0,B.jsx)(`pre`,{children:t}):null]})}function H({onOpen:e,run:t}){return(0,B.jsxs)(`button`,{className:`scheduled-run-row hosted`,onClick:e,type:`button`,children:[(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{children:L(t.status)}),(0,B.jsx)(`small`,{children:I(t.createdAt,null)})]}),(0,B.jsxs)(`span`,{className:`scheduled-run-trigger`,children:[R(t.triggerKind),` `,(0,B.jsx)(p,{size:11})]}),t.deliveryError?(0,B.jsx)(`p`,{children:t.deliveryError}):null]})}function U({children:e,detailExpanded:t,kind:n=`schedule`,label:r,onClose:i,onDetailResizeStart:a,onToggleDetailExpanded:o}){return(0,B.jsxs)(`aside`,{"aria-label":r,className:`workspace-diff-panel scheduled-detail${t?` expanded`:``}`,children:[t?null:(0,B.jsx)(`div`,{"aria-label":`Resize schedule details`,"aria-orientation":`vertical`,className:`workspace-diff-resize-handle`,onPointerDown:a,role:`separator`}),(0,B.jsxs)(`div`,{className:`workspace-diff-topbar`,children:[(0,B.jsx)(`div`,{className:`workspace-diff-tabs`,role:`tablist`,"aria-label":`${n===`workflow`?`Workflow`:`Schedule`} details`,children:(0,B.jsxs)(`button`,{"aria-selected":`true`,className:`workspace-diff-tab active`,role:`tab`,type:`button`,children:[(0,B.jsx)(T,{size:14}),(0,B.jsx)(`span`,{children:n===`workflow`?`Workflow`:`Schedule`})]})}),(0,B.jsxs)(`div`,{className:`workspace-diff-toolbar-actions`,children:[(0,B.jsx)(`button`,{"aria-label":t?`Dock ${n} details`:`Expand ${n} details`,className:`diff-icon-button`,onClick:o,title:t?`Dock ${n} details`:`Expand ${n} details`,type:`button`,children:t?(0,B.jsx)(d,{size:14}):(0,B.jsx)(h,{size:14})}),(0,B.jsx)(`button`,{"aria-label":`Close ${n} details`,className:`diff-icon-button`,onClick:i,title:`Close ${n} details`,type:`button`,children:(0,B.jsx)(y,{size:14})})]})]}),(0,B.jsx)(`div`,{className:`scheduled-detail-body`,children:e})]})}function W({children:e,title:t}){return(0,B.jsxs)(`section`,{className:`scheduled-detail-section`,children:[(0,B.jsx)(`div`,{className:`scheduled-detail-section-heading`,children:(0,B.jsx)(`h3`,{children:t})}),e]})}function G({label:e,value:t}){return(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:e}),(0,B.jsx)(`dd`,{children:t})]})}function K({children:e}){return(0,B.jsx)(`p`,{className:`scheduled-empty`,children:e})}function ne({label:e}){return(0,B.jsxs)(`div`,{className:`scheduled-loading`,role:`status`,children:[(0,B.jsx)(m,{className:`scheduled-spin`,size:16}),(0,B.jsx)(`span`,{children:e})]})}var q=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`];function re({items:e,onSelect:t,selectedKey:n}){let[r,i]=(0,O.useState)(()=>se(new Date)),a=(0,O.useMemo)(()=>J(r),[r]),o=(0,O.useMemo)(()=>ie(e),[e]),s=new Intl.DateTimeFormat(void 0,{month:`long`,year:`numeric`}).format(r),c=e.filter(e=>!ae(e.nextRunAt));return(0,B.jsxs)(`div`,{className:`scheduled-calendar`,children:[(0,B.jsxs)(`div`,{className:`scheduled-calendar-toolbar`,children:[(0,B.jsx)(`strong`,{children:s}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`button`,{"aria-label":`Previous month`,className:`scheduled-icon-button`,onClick:()=>i(ce(r,-1)),type:`button`,children:(0,B.jsx)(E,{size:15})}),(0,B.jsx)(`button`,{className:`scheduled-calendar-today`,onClick:()=>i(se(new Date)),type:`button`,children:`Today`}),(0,B.jsx)(`button`,{"aria-label":`Next month`,className:`scheduled-icon-button`,onClick:()=>i(ce(r,1)),type:`button`,children:(0,B.jsx)(f,{size:15})})]})]}),(0,B.jsxs)(`div`,{className:`scheduled-calendar-grid`,role:`grid`,"aria-label":s,children:[q.map(e=>(0,B.jsx)(`div`,{className:`scheduled-calendar-weekday`,role:`columnheader`,children:e},e)),a.map(e=>{let i=oe(e),a=o.get(i)??[],s=e.getMonth()!==r.getMonth(),c=i===oe(new Date);return(0,B.jsxs)(`div`,{className:`scheduled-calendar-day${s?` outside`:``}${c?` today`:``}`,role:`gridcell`,children:[(0,B.jsx)(`span`,{className:`scheduled-calendar-day-number`,children:e.getDate()}),(0,B.jsx)(`div`,{className:`scheduled-calendar-events`,children:a.map(e=>(0,B.jsxs)(`button`,{"aria-current":n===e.key?`true`:void 0,className:`scheduled-calendar-event${e.enabled?``:` paused`}`,onClick:()=>t(e.key),title:e.title,type:`button`,children:[(0,B.jsx)(`span`,{children:le(e.nextRunAt)}),(0,B.jsx)(`strong`,{children:e.title})]},e.key))})]},i)})]}),c.length?(0,B.jsxs)(`div`,{className:`scheduled-calendar-unscheduled`,children:[(0,B.jsx)(`span`,{children:`No upcoming run`}),(0,B.jsx)(`div`,{children:c.map(e=>(0,B.jsx)(`button`,{onClick:()=>t(e.key),type:`button`,children:e.title},e.key))})]}):null]})}function J(e){let t=new Date(e.getFullYear(),e.getMonth(),1),n=new Date(t);return n.setDate(t.getDate()-t.getDay()),Array.from({length:42},(e,t)=>{let r=new Date(n);return r.setDate(n.getDate()+t),r})}function ie(e){let t=new Map;for(let n of e){let e=ae(n.nextRunAt);if(!e)continue;let r=oe(e);t.set(r,[...t.get(r)??[],n])}for(let e of t.values())e.sort((e,t)=>e.nextRunAt.localeCompare(t.nextRunAt));return t}function ae(e){if(!e)return null;let t=new Date(e);return Number.isNaN(t.getTime())?null:t}function oe(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`}function se(e){return new Date(e.getFullYear(),e.getMonth(),1)}function ce(e,t){return new Date(e.getFullYear(),e.getMonth()+t,1)}function le(e){return new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}).format(new Date(e))}function ue({entry:e,onSelect:t,selected:n}){return(0,B.jsxs)(`button`,{"aria-current":n?`true`:void 0,className:`scheduled-list-row`,onClick:t,type:`button`,children:[(0,B.jsx)(`span`,{className:`scheduled-status-dot`}),(0,B.jsxs)(`span`,{className:`scheduled-list-copy`,children:[(0,B.jsx)(`span`,{className:`scheduled-list-title`,children:(0,B.jsx)(`strong`,{children:e.workflow.label})}),(0,B.jsx)(`span`,{children:e.workflow.description}),(0,B.jsxs)(`small`,{children:[`On demand · Source `,e.binding.sourceRevision.slice(0,10)]})]})]})}function de({cadence:e,onSelect:t,schedule:n,selected:r}){return(0,B.jsxs)(`button`,{"aria-current":r?`true`:void 0,className:`scheduled-list-row`,onClick:t,type:`button`,children:[(0,B.jsx)(`span`,{className:`scheduled-status-dot ${n.enabled?`active`:`paused`}`}),(0,B.jsxs)(`span`,{className:`scheduled-list-copy`,children:[(0,B.jsx)(`span`,{className:`scheduled-list-title`,children:(0,B.jsx)(`strong`,{children:n.scheduleName})}),(0,B.jsx)(`span`,{children:n.localProjectName}),(0,B.jsxs)(`small`,{children:[e,n.nextRunAt?` · Next ${I(n.nextRunAt,n.timezone)}`:` · No next run`]})]})]})}function fe({cadence:e,definition:t,onSelect:n,schedule:r,selected:i}){return(0,B.jsxs)(`button`,{"aria-current":i?`true`:void 0,className:`scheduled-list-row`,onClick:n,type:`button`,children:[(0,B.jsx)(`span`,{className:`scheduled-status-dot ${r.enabled?`active`:`paused`}`}),(0,B.jsxs)(`span`,{className:`scheduled-list-copy`,children:[(0,B.jsxs)(`span`,{className:`scheduled-list-title`,children:[(0,B.jsx)(`strong`,{children:t.name}),(0,B.jsx)(`small`,{className:`scheduled-environment-badge hosted`,children:`Hosted`})]}),(0,B.jsx)(`span`,{children:t.prompt}),(0,B.jsxs)(`small`,{children:[e,r.nextRunAt?` · Next ${I(r.nextRunAt,r.timeZone)}`:` · No next run`]})]})]})}function pe({cadence:e,onSelect:t,selected:n,workflow:r}){return(0,B.jsxs)(`button`,{"aria-current":n?`true`:void 0,className:`scheduled-list-row`,onClick:t,type:`button`,children:[(0,B.jsx)(`span`,{className:`scheduled-status-dot ${r.enabled?`active`:`paused`}`}),(0,B.jsxs)(`span`,{className:`scheduled-list-copy`,children:[(0,B.jsxs)(`span`,{className:`scheduled-list-title`,children:[(0,B.jsx)(`strong`,{children:r.name}),(0,B.jsx)(`small`,{className:`scheduled-environment-badge`,children:`Chat`})]}),(0,B.jsx)(`span`,{children:r.prompt}),(0,B.jsxs)(`small`,{children:[`Runs in `,r.sessionTitle,` · `,e,r.nextRunAt?` · Next ${I(r.nextRunAt,r.recurrence.timeZone)}`:` · No next run`]})]})]})}function me(e,t){return e.filter(e=>t===`active`?e.enabled:t!==`paused`||!e.enabled).sort((e,t)=>(e.nextRunAt?new Date(e.nextRunAt).getTime():1/0)-(t.nextRunAt?new Date(t.nextRunAt).getTime():1/0)||e.name.localeCompare(t.name))}function he(e){let t=z(e.localTime);return e.kind===`once`?`Once on ${e.startDate} at ${t} · ${e.timeZone}`:e.kind===`weekdays`?`Weekdays at ${t} · ${e.timeZone}`:e.kind===`weekly`?`${e.weekdays?.map(R).join(`, `)??`Weekly`} at ${t} · ${e.timeZone}`:e.kind===`monthly`?`Monthly on day ${e.dayOfMonth??1} at ${t} · ${e.timeZone}`:`Daily at ${t} · ${e.timeZone}`}function ge({detailExpanded:e,onClose:t,onDelete:n,onDetailResizeStart:r,onRun:i,onToggle:a,onToggleDetailExpanded:o,pending:s,runs:c,workflow:d}){return(0,B.jsxs)(U,{detailExpanded:e,label:`${d.name} details`,onClose:t,onDetailResizeStart:r,onToggleDetailExpanded:o,children:[(0,B.jsx)(`div`,{className:`scheduled-detail-header`,children:(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`scheduled-detail-title-row`,children:[(0,B.jsx)(`h2`,{children:`Workflow details`}),(0,B.jsx)(`span`,{children:d.enabled?`Active`:`Paused`})]}),(0,B.jsx)(`p`,{children:d.name})]})}),(0,B.jsx)(W,{title:`Prompt`,children:(0,B.jsx)(`pre`,{className:`scheduled-prompt`,children:d.prompt})}),(0,B.jsx)(W,{title:`Profile source`,children:d.profileRef&&d.profileWorkflowId?(0,B.jsxs)(`p`,{children:[d.profileRef.profileId,` · workflows/`,d.profileWorkflowId,`/PROMPT.md`]}):(0,B.jsx)(`p`,{className:`scheduled-detail-error`,children:d.profileMigrationError??`Profile package is unresolved.`})}),(0,B.jsxs)(W,{title:`Delivery`,children:[(0,B.jsxs)(`dl`,{className:`scheduled-detail-fields`,children:[(0,B.jsx)(G,{label:`Runs in`,value:d.sessionTitle}),(0,B.jsx)(G,{label:`Cadence`,value:he(d.recurrence)}),(0,B.jsx)(G,{label:`Next run`,value:I(d.nextRunAt,d.recurrence.timeZone)}),(0,B.jsx)(G,{label:`Last run`,value:I(d.lastRunAt,d.recurrence.timeZone)})]}),d.lastError?(0,B.jsx)(`p`,{className:`scheduled-detail-error`,children:d.lastError}):null]}),(0,B.jsxs)(`div`,{className:`scheduled-detail-actions`,children:[(0,B.jsxs)(`button`,{disabled:s,onClick:()=>void i(),type:`button`,children:[(0,B.jsx)(S,{size:15}),(0,B.jsx)(`span`,{children:`Run now`})]}),(0,B.jsxs)(`button`,{disabled:s,onClick:()=>void a(),type:`button`,children:[d.enabled?(0,B.jsx)(u,{size:15}):(0,B.jsx)(g,{size:15}),(0,B.jsx)(`span`,{children:d.enabled?`Pause`:`Resume`})]}),(0,B.jsxs)(`button`,{disabled:s,onClick:()=>void n(),type:`button`,children:[(0,B.jsx)(l,{size:15}),(0,B.jsx)(`span`,{children:`Delete`})]})]}),(0,B.jsx)(W,{title:`Runs`,children:c.length===0?(0,B.jsx)(`p`,{className:`scheduled-no-runs`,children:`No runs yet.`}):(0,B.jsx)(`div`,{className:`scheduled-run-list`,children:c.map(e=>(0,B.jsxs)(`div`,{className:`scheduled-run-row`,children:[(0,B.jsx)(`span`,{children:R(e.status)}),(0,B.jsx)(`small`,{children:I(e.createdAt,d.recurrence.timeZone)}),e.error?(0,B.jsx)(`p`,{children:e.error}):null]},e.id))})})]})}async function _e(e){let t=e.catalog.workflows.find(t=>t.workflow.id===e.workflowId);if(!t)throw Error(`Selected Profile workflow is unavailable.`);let n=e.client??w,r=await n.createSession(e.connection,{experience:`work`,provider:`openpond`,...e.workspaceTarget===`local`?{metadata:{workspaceTarget:`local`}}:{},currentProfile:e.catalog.profileRef,profileWorkflowBinding:t.binding,title:t.workflow.label});return e.onSessionCreated?.(r.id),await n.sendTurn(e.connection,r.id,{prompt:e.prompt?.trim()||t.workflow.label,workflowInput:e.value,...e.attachments?.length?{attachments:e.attachments}:{},approvalPolicy:`on-request`,sandbox:`workspace-write`,codexPermissionMode:`default`}),r.id}function ve({catalog:e,connection:t,detailExpanded:n,entry:r,onClose:i,onDetailResizeStart:l,onOpenSession:u,onToggleDetailExpanded:d}){let[f,p]=(0,O.useState)(``),[m,h]=(0,O.useState)([]),[g,_]=(0,O.useState)(`{}`),[v,y]=(0,O.useState)(e.profileRef.source===`local`?`local`:`hosted`),[b,C]=(0,O.useState)(!1),[w,T]=(0,O.useState)(null),E=r.workflow;async function D(n){if(n.preventDefault(),!b){C(!0),T(null);try{let n=JSON.parse(g);if(m.length>a.maxAttachments)throw Error(`Choose at most ${a.maxAttachments} files.`);let r=await Promise.all(m.map(async e=>{if(e.size>a.maxAttachmentBytes)throw Error(`${e.name} exceeds the attachment size limit.`);return s({id:c(),file:e,name:e.name,mediaType:e.type||`application/octet-stream`,sizeBytes:e.size,kind:o(e)})}));await _e({connection:t,catalog:e,workflowId:E.id,value:n,prompt:f,attachments:r,workspaceTarget:v,onSessionCreated:u})}catch(e){T(e instanceof Error?e.message:String(e))}finally{C(!1)}}}return(0,B.jsxs)(U,{detailExpanded:n,kind:`workflow`,label:`${E.label} details`,onClose:i,onDetailResizeStart:l,onToggleDetailExpanded:d,children:[(0,B.jsx)(`div`,{className:`scheduled-detail-header`,children:(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`scheduled-detail-title-row`,children:(0,B.jsx)(`h2`,{children:`Workflow details`})}),(0,B.jsx)(`p`,{children:E.label})]})}),(0,B.jsx)(W,{title:`Description`,children:(0,B.jsx)(`p`,{children:E.description})}),(0,B.jsxs)(W,{title:`Source`,children:[(0,B.jsxs)(`p`,{children:[`workflows/`,E.id,`/`,E.invocation.kind===`instructions`?`PROMPT.md`:`ACTION.json`]}),(0,B.jsxs)(`p`,{children:[`Revision `,r.binding.sourceRevision.slice(0,12),` · Release `,r.binding.harnessRelease.contentHash.slice(0,12)]})]}),E.skillPaths.length>0?(0,B.jsx)(W,{title:`Skills`,children:(0,B.jsx)(`p`,{children:E.skillPaths.join(`, `)})}):null,E.invocation.kind===`instructions`?(0,B.jsx)(W,{title:`Instructions`,children:(0,B.jsx)(`pre`,{className:`scheduled-prompt`,children:E.invocation.instructions})}):null,(0,B.jsx)(W,{title:`Start a run`,children:(0,B.jsxs)(`form`,{className:`scheduled-profile-workflow-form`,onSubmit:e=>void D(e),children:[(0,B.jsx)(`label`,{htmlFor:`scheduled-profile-workflow-prompt`,children:`Instructions for this run`}),(0,B.jsx)(`textarea`,{id:`scheduled-profile-workflow-prompt`,onChange:e=>p(e.target.value),value:f}),(0,B.jsx)(`label`,{htmlFor:`scheduled-profile-workflow-files`,children:`Files for this run`}),(0,B.jsx)(`input`,{id:`scheduled-profile-workflow-files`,type:`file`,multiple:!0,onChange:e=>h(Array.from(e.target.files??[]))}),m.length>0?(0,B.jsx)(`small`,{children:m.map(e=>e.name).join(`, `)}):null,(0,B.jsx)(`label`,{htmlFor:`scheduled-profile-workflow-target`,children:`Run in`}),(0,B.jsxs)(`select`,{id:`scheduled-profile-workflow-target`,value:v,onChange:e=>y(e.target.value),children:[(0,B.jsx)(`option`,{value:`local`,children:`Desktop local workspace`}),(0,B.jsx)(`option`,{value:`hosted`,children:`Hosted Work`})]}),E.invocation.kind===`agent_action`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`label`,{htmlFor:`scheduled-profile-workflow-input`,children:`Input JSON`}),(0,B.jsx)(`textarea`,{id:`scheduled-profile-workflow-input`,onChange:e=>_(e.target.value),value:g})]}):null,w?(0,B.jsx)(x,{error:w}):null,(0,B.jsx)(`div`,{className:`scheduled-detail-actions`,children:(0,B.jsxs)(`button`,{disabled:b,type:`submit`,children:[(0,B.jsx)(S,{size:15}),(0,B.jsx)(`span`,{children:b?`Starting…`:`Run now`})]})})]})})]})}function ye(e){return e.flatMap(e=>e.schedules.map(t=>({definition:e,schedule:t})))}function be(e,t){return e.filter(e=>t===`active`?e.schedule.enabled:t!==`paused`||!e.schedule.enabled).sort((e,t)=>$(e.schedule.nextRunAt)-$(t.schedule.nextRunAt)||e.definition.name.localeCompare(t.definition.name))}function xe(e,t){return e.filter(e=>t===`active`?e.enabled:t!==`paused`||!e.enabled).sort((e,t)=>$(e.nextRunAt)-$(t.nextRunAt)||e.scheduleName.localeCompare(t.scheduleName))}function Se(e,t,n){return[...e.map(e=>({kind:`chat`,workflow:e})),...t.map(e=>({kind:`local`,schedule:e})),...n.map(e=>({kind:`hosted`,row:e}))].sort((e,t)=>{let n=$(Te(e)),r=$(Te(t));if(n!==r)return n-r;let i=Ee(e),a=Ee(t);return i.localeCompare(a)})}function Ce(e){return e.kind===`chat`?{enabled:e.workflow.enabled,key:X(e.workflow.id),nextRunAt:e.workflow.nextRunAt,title:e.workflow.name}:e.kind===`local`?{enabled:e.schedule.enabled,key:Y(e.schedule.id),nextRunAt:e.schedule.nextRunAt,title:e.schedule.scheduleName}:{enabled:e.row.schedule.enabled,key:Q(e.row.schedule.id),nextRunAt:e.row.schedule.nextRunAt,title:e.row.definition.name}}function we(e){let t=e.recurrence;return t?he(t):e.expression??`Manual`}function Te(e){return e.kind===`chat`?e.workflow.nextRunAt:e.kind===`local`?e.schedule.nextRunAt:e.row.schedule.nextRunAt}function Ee(e){return e.kind===`chat`?e.workflow.name:e.kind===`local`?e.schedule.scheduleName:e.row.definition.name}function De(e){let t=e.timezone?` · ${e.timezone}`:``;if(e.scheduleType===`rate`)return`Every ${e.scheduleExpression}${t}`;let n=e.scheduleExpression.trim().split(/\s+/);if(n.length===5&&/^\d+$/.test(n[0])&&/^\d+$/.test(n[1])){let e=z(`${n[1].padStart(2,`0`)}:${n[0].padStart(2,`0`)}`);if(n[2]===`*`&&n[3]===`*`&&n[4]===`*`)return`Daily at ${e}${t}`;if(n[2]===`*`&&n[3]===`*`&&n[4]===`MON-FRI`)return`Weekdays at ${e}${t}`}return`Cron ${e.scheduleExpression}${t}`}function Y(e){return`local:${e}`}function X(e){return`chat:${e}`}function Z(e){return`profile:${e}`}function Q(e){return`hosted:${e}`}function $(e){if(!e)return 2**53-1;let t=new Date(e).getTime();return Number.isFinite(t)?t:2**53-1}var Oe=[`sunday`,`monday`,`tuesday`,`wednesday`,`thursday`,`friday`,`saturday`];function ke({connection:e,selectedProfileKey:t,onOpenSession:n,detailOpen:r,detailExpanded:a,onDetailOpenChange:o,onDetailResizeStart:s,onToggleDetailExpanded:c}){let l=A(e),u=ee(e),d=D(e),[f,p]=(0,O.useState)(null),[m,h]=(0,O.useState)(!1),[g,v]=(0,O.useState)(null),[y,x]=(0,O.useState)(`all`),[S,T]=(0,O.useState)(te);i(()=>T(te()));let[E,k]=(0,O.useState)(!1),[j,M]=(0,O.useState)(null),N=(0,O.useMemo)(()=>ye(l.definitions),[l.definitions]),F=(0,O.useMemo)(()=>be(N,y),[y,N]),I=(0,O.useMemo)(()=>xe(d.schedules,y),[y,d.schedules]),L=(0,O.useMemo)(()=>me(u.workflows,y),[u.workflows,y]),R=N.find(e=>Q(e.schedule.id)===j)??null,z=d.schedules.find(e=>Y(e.id)===j)??null,V=u.workflows.find(e=>X(e.id)===j)??null,H=f?.workflows.find(e=>Z(e.workflow.id)===j)??null,U=R?l.runs.filter(e=>e.scheduleId===R.schedule.id):[],W=(0,O.useMemo)(()=>Se(L,I,F),[L,I,F]),G=(0,O.useMemo)(()=>[...W.map(Ce),...f?.workflows.map(e=>({enabled:!0,key:Z(e.workflow.id),nextRunAt:null,title:e.workflow.label}))??[]],[W,f]);b(l.error,{prefix:`Workflows`}),b(d.error,{prefix:`Local schedules`}),b(u.error,{prefix:`Chat workflows`}),b(g,{prefix:`Profile workflows`}),(0,O.useEffect)(()=>{if(!e||!t){p(null),v(null);return}let n=!0;return h(!0),w.profileWorkflows(e).then(e=>{n&&(p(e),v(null))}).catch(e=>{n&&v(e instanceof Error?e.message:String(e))}).finally(()=>{n&&h(!1)}),()=>{n=!1}},[e,t]),(0,O.useEffect)(()=>{j&&!R&&!z&&!V&&!H&&!m&&M(null)},[m,V,R,z,H,j]),(0,O.useEffect)(()=>{!r&&j&&M(null)},[r,j]),(0,O.useEffect)(()=>()=>o(!1),[o]);function q(e){M(e),o(!0)}function J(){M(null),o(!1)}function ie(e){T(e),P(e)}async function ae(){k(!0);try{await Promise.all([l.refresh(),d.refresh(),u.refresh(),e&&t?w.profileWorkflows(e).then(p):Promise.resolve()])}finally{k(!1)}}return(0,B.jsxs)(`section`,{"aria-label":`Workflows`,className:`scheduled-work-view${R||z||V||H?` detail-open`:``}${a?` detail-expanded`:``}`,children:[(0,B.jsx)(`div`,{className:`scheduled-work-scroll`,children:(0,B.jsxs)(`div`,{className:`scheduled-work-content`,children:[(0,B.jsxs)(`header`,{className:`scheduled-work-header`,children:[(0,B.jsxs)(`div`,{"aria-label":`Workflow view`,className:`scheduled-view-tabs`,role:`tablist`,children:[(0,B.jsx)(`button`,{"aria-selected":S===`calendar`,className:S===`calendar`?`active`:void 0,onClick:()=>ie(`calendar`),role:`tab`,type:`button`,children:`Calendar`}),(0,B.jsx)(`button`,{"aria-selected":S===`list`,className:S===`list`?`active`:void 0,onClick:()=>ie(`list`),role:`tab`,type:`button`,children:`List`})]}),(0,B.jsxs)(`div`,{className:`scheduled-work-header-actions`,children:[(0,B.jsx)(`button`,{"aria-label":`Refresh schedules`,className:`scheduled-icon-button`,disabled:!e||l.loading||d.loading||u.loading||m,onClick:()=>void ae(),title:`Refresh schedules`,type:`button`,children:(0,B.jsx)(_,{className:E?`scheduled-spin`:void 0,size:16})}),(0,B.jsxs)(`label`,{className:`scheduled-filter`,children:[(0,B.jsx)(C,{"aria-hidden":`true`,size:16}),(0,B.jsxs)(`select`,{"aria-label":`Schedule filter`,onChange:e=>x(e.target.value),value:y,children:[(0,B.jsx)(`option`,{value:`active`,children:`Active`}),(0,B.jsx)(`option`,{value:`paused`,children:`Paused`}),(0,B.jsx)(`option`,{value:`all`,children:`All`})]})]})]})]}),(0,B.jsx)(`section`,{"aria-busy":l.loading||d.loading||u.loading||m,className:`scheduled-list`,children:e?(l.loading||d.loading||u.loading||m)&&N.length===0&&d.schedules.length===0&&u.workflows.length===0&&!f?.workflows.length?(0,B.jsx)(ne,{label:`Loading schedules`}):l.error&&d.error&&N.length===0&&d.schedules.length===0?(0,B.jsx)(K,{children:`Schedules are unavailable. Refresh to try again.`}):W.length===0&&!f?.workflows.length?(0,B.jsx)(K,{children:`Create a scheduled task here or ask for one in Work.`}):S===`calendar`?(0,B.jsx)(re,{items:G,onSelect:q,selectedKey:j}):(0,B.jsxs)(`div`,{className:`scheduled-list-rows`,children:[f?.workflows.map(e=>(0,B.jsx)(ue,{entry:e,onSelect:()=>q(Z(e.workflow.id)),selected:j===Z(e.workflow.id)},Z(e.workflow.id))),W.map(e=>e.kind===`chat`?(0,B.jsx)(pe,{cadence:he(e.workflow.recurrence),onSelect:()=>q(X(e.workflow.id)),selected:j===X(e.workflow.id),workflow:e.workflow},X(e.workflow.id)):e.kind===`local`?(0,B.jsx)(de,{cadence:De(e.schedule),onSelect:()=>q(Y(e.schedule.id)),schedule:e.schedule,selected:j===Y(e.schedule.id)},Y(e.schedule.id)):(0,B.jsx)(fe,{cadence:we(e.row.schedule),definition:e.row.definition,onSelect:()=>q(Q(e.row.schedule.id)),schedule:e.row.schedule,selected:j===Q(e.row.schedule.id)},Q(e.row.schedule.id)))]}):(0,B.jsx)(K,{children:`Connect to OpenPond to view scheduled Work.`})})]})}),H&&f&&e?(0,B.jsx)(ve,{catalog:f,connection:e,detailExpanded:a,entry:H,onClose:J,onDetailResizeStart:s,onOpenSession:n,onToggleDetailExpanded:c},H.workflow.id):R?(0,B.jsx)(je,{onClose:J,onDelete:async()=>{await l.remove(R.schedule.id),J()},onRun:()=>l.run(R.schedule.id),onSave:e=>l.update(R.schedule.id,e),onToggle:()=>l.update(R.schedule.id,{enabled:!R.schedule.enabled}),pending:l.pendingScheduleIds.has(R.schedule.id),row:R,runs:U,detailExpanded:a,onDetailResizeStart:s,onToggleDetailExpanded:c,webBaseUrl:l.webBaseUrl},`${R.schedule.id}:${R.definition.version}:${R.schedule.configurationVersion}`):V?(0,B.jsx)(ge,{detailExpanded:a,onClose:J,onDelete:async()=>{await u.remove(V.id),J()},onDetailResizeStart:s,onRun:()=>u.run(V.id),onToggle:()=>u.update(V.id,{enabled:!V.enabled}),onToggleDetailExpanded:c,pending:u.pendingIds.has(V.id),runs:u.runs.filter(e=>e.workflowId===V.id),workflow:V},V.id):z?(0,B.jsx)(Ae,{connection:e,onClose:J,onRun:()=>d.run(z),onToggle:()=>d.toggle(z),pending:d.pendingScheduleIds.has(z.id),schedule:z,detailExpanded:a,onDetailResizeStart:s,onToggleDetailExpanded:c},z.id):null]})}function Ae({connection:e,detailExpanded:t,onClose:n,onDetailResizeStart:r,onRun:i,onToggleDetailExpanded:a,onToggle:o,pending:s,schedule:c}){let l=Pe(e,c.id);return b(l.error,{prefix:`Local schedule runs`}),(0,B.jsxs)(U,{detailExpanded:t,label:`${c.scheduleName} details`,onClose:n,onDetailResizeStart:r,onToggleDetailExpanded:a,children:[(0,B.jsx)(`div`,{className:`scheduled-detail-header`,children:(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`scheduled-detail-title-row`,children:[(0,B.jsx)(`h2`,{children:`Schedule details`}),(0,B.jsx)(`span`,{children:c.enabled?`Active`:`Paused`})]}),(0,B.jsx)(`p`,{children:c.scheduleName})]})}),(0,B.jsxs)(W,{title:`Task`,children:[(0,B.jsxs)(`dl`,{className:`scheduled-detail-fields`,children:[(0,B.jsx)(G,{label:`Environment`,value:`Local`}),(0,B.jsx)(G,{label:`Project`,value:c.localProjectName}),(0,B.jsx)(G,{label:`Agent`,value:c.agentName}),(0,B.jsx)(G,{label:`Action`,value:c.targetAction})]}),(0,B.jsx)(`pre`,{className:`scheduled-prompt`,children:Ne(c)})]}),(0,B.jsxs)(W,{title:`Schedule`,children:[(0,B.jsxs)(`dl`,{className:`scheduled-detail-fields`,children:[(0,B.jsx)(G,{label:`Cadence`,value:De(c)}),(0,B.jsx)(G,{label:`Expression`,value:c.scheduleExpression}),(0,B.jsx)(G,{label:`Timezone`,value:c.timezone??`Local time`}),(0,B.jsx)(G,{label:`Next run`,value:I(c.nextRunAt,c.timezone)}),(0,B.jsx)(G,{label:`Last run`,value:I(c.lastRunAt,c.timezone)})]}),c.lastError?(0,B.jsx)(`p`,{className:`scheduled-detail-error`,children:c.lastError}):null]}),(0,B.jsxs)(`div`,{className:`scheduled-detail-actions`,children:[(0,B.jsxs)(`button`,{disabled:s,onClick:()=>void i(),type:`button`,children:[(0,B.jsx)(S,{size:15}),(0,B.jsx)(`span`,{children:`Run now`})]}),(0,B.jsxs)(`button`,{disabled:s,onClick:()=>void o(),type:`button`,children:[c.enabled?(0,B.jsx)(u,{size:15}):(0,B.jsx)(g,{size:15}),(0,B.jsx)(`span`,{children:c.enabled?`Pause`:`Resume`})]})]}),(0,B.jsx)(W,{title:`Runs`,children:l.loading&&l.runs.length===0?(0,B.jsx)(ne,{label:`Loading runs`}):l.runs.length===0?(0,B.jsx)(`p`,{className:`scheduled-no-runs`,children:`No runs yet.`}):(0,B.jsx)(`div`,{className:`scheduled-run-list`,children:l.runs.map(e=>(0,B.jsx)(V,{run:e},e.id))})})]})}function je({detailExpanded:e,onClose:t,onDelete:n,onDetailResizeStart:r,onRun:i,onSave:a,onToggleDetailExpanded:o,onToggle:s,pending:c,row:d,runs:f,webBaseUrl:m}){let h=Me(d.schedule),[_,y]=(0,O.useState)(d.definition.name),[b,x]=(0,O.useState)(d.definition.prompt),[C,w]=(0,O.useState)(h.kind),[T,E]=(0,O.useState)(h.timeZone),[D,k]=(0,O.useState)(h.startDate),[A,j]=(0,O.useState)(h.localTime),[M,ee]=(0,O.useState)(h.weekdays?.[0]??`monday`),[N,te]=(0,O.useState)(h.dayOfMonth??1),P=f[0]?.conversationId??null,F=m?Fe(m,P):null,L=_!==d.definition.name||b!==d.definition.prompt||C!==h.kind||T!==h.timeZone||D!==h.startDate||A!==h.localTime||M!==(h.weekdays?.[0]??`monday`)||N!==(h.dayOfMonth??1);async function z(e){e.preventDefault(),await a({name:_,prompt:b,recurrence:{version:1,kind:C,timeZone:T,startDate:D,localTime:A,end:{kind:`never`},...C===`weekly`?{weekdays:[M]}:{},...C===`monthly`?{dayOfMonth:N}:{}}})}return(0,B.jsx)(U,{detailExpanded:e,label:`${d.definition.name} details`,onClose:t,onDetailResizeStart:r,onToggleDetailExpanded:o,children:(0,B.jsxs)(`form`,{onSubmit:z,children:[(0,B.jsxs)(`div`,{className:`scheduled-detail-header`,children:[(0,B.jsx)(`div`,{children:(0,B.jsxs)(`div`,{className:`scheduled-detail-title-row`,children:[(0,B.jsx)(`h2`,{children:`Schedule details`}),(0,B.jsx)(`span`,{children:d.schedule.enabled?`Active`:`Paused`})]})}),(0,B.jsx)(`div`,{className:`scheduled-detail-header-controls`,children:(0,B.jsx)(`button`,{"aria-label":`Delete schedule`,className:`scheduled-icon-button`,disabled:c,onClick:()=>void n(),title:`Delete schedule`,type:`button`,children:(0,B.jsx)(l,{size:16})})})]}),(0,B.jsxs)(W,{title:`Task`,children:[(0,B.jsxs)(`label`,{className:`scheduled-field`,children:[(0,B.jsx)(`span`,{children:`Name`}),(0,B.jsx)(`input`,{maxLength:180,onChange:e=>y(e.target.value),required:!0,value:_})]}),(0,B.jsxs)(`label`,{className:`scheduled-field`,children:[(0,B.jsx)(`span`,{children:`Prompt`}),(0,B.jsx)(`textarea`,{onChange:e=>x(e.target.value),required:!0,value:b})]})]}),(0,B.jsxs)(W,{title:`Schedule`,children:[(0,B.jsxs)(`div`,{className:`scheduled-field-grid`,children:[(0,B.jsxs)(`label`,{className:`scheduled-field`,children:[(0,B.jsx)(`span`,{children:`Repeat`}),(0,B.jsxs)(`select`,{onChange:e=>w(e.target.value),value:C,children:[(0,B.jsx)(`option`,{value:`once`,children:`Once`}),(0,B.jsx)(`option`,{value:`daily`,children:`Daily`}),(0,B.jsx)(`option`,{value:`weekdays`,children:`Weekdays`}),(0,B.jsx)(`option`,{value:`weekly`,children:`Weekly`}),(0,B.jsx)(`option`,{value:`monthly`,children:`Monthly`})]})]}),C===`weekly`?(0,B.jsxs)(`label`,{className:`scheduled-field`,children:[(0,B.jsx)(`span`,{children:`Day`}),(0,B.jsx)(`select`,{onChange:e=>ee(e.target.value),value:M,children:Oe.map(e=>(0,B.jsx)(`option`,{value:e,children:R(e)},e))})]}):C===`monthly`?(0,B.jsxs)(`label`,{className:`scheduled-field`,children:[(0,B.jsx)(`span`,{children:`Day of month`}),(0,B.jsx)(`input`,{max:31,min:1,onChange:e=>te(Number(e.target.value)),type:`number`,value:N})]}):null,(0,B.jsxs)(`label`,{className:`scheduled-field`,children:[(0,B.jsx)(`span`,{children:`Start date`}),(0,B.jsx)(`input`,{onChange:e=>k(e.target.value),required:!0,type:`date`,value:D})]}),(0,B.jsxs)(`label`,{className:`scheduled-field`,children:[(0,B.jsx)(`span`,{children:`Time`}),(0,B.jsx)(`input`,{onChange:e=>j(e.target.value),required:!0,type:`time`,value:A})]}),(0,B.jsxs)(`label`,{className:`scheduled-field scheduled-field-wide`,children:[(0,B.jsx)(`span`,{children:`Timezone`}),(0,B.jsx)(`input`,{onChange:e=>E(e.target.value),required:!0,value:T})]})]}),(0,B.jsxs)(`p`,{className:`scheduled-next-run`,children:[`Next run: `,I(d.schedule.nextRunAt,h.timeZone)]})]}),(0,B.jsxs)(`div`,{className:`scheduled-detail-actions`,children:[L?(0,B.jsxs)(`button`,{disabled:c,type:`submit`,children:[(0,B.jsx)(v,{size:15}),(0,B.jsx)(`span`,{children:`Save`})]}):null,(0,B.jsxs)(`button`,{disabled:c,onClick:()=>void i(),type:`button`,children:[(0,B.jsx)(S,{size:15}),(0,B.jsx)(`span`,{children:`Run now`})]}),(0,B.jsxs)(`button`,{disabled:c,onClick:()=>void s(),type:`button`,children:[d.schedule.enabled?(0,B.jsx)(u,{size:15}):(0,B.jsx)(g,{size:15}),(0,B.jsx)(`span`,{children:d.schedule.enabled?`Pause`:`Resume`})]})]}),(0,B.jsxs)(`button`,{className:`scheduled-open-chat`,disabled:c||!F,onClick:()=>{F&&Ie(F,P)},type:`button`,children:[(0,B.jsx)(`span`,{children:`Open hosted chat`}),(0,B.jsx)(p,{size:14})]}),(0,B.jsx)(W,{title:`Runs`,children:f.length===0?(0,B.jsx)(`p`,{className:`scheduled-no-runs`,children:`No runs yet.`}):(0,B.jsx)(`div`,{className:`scheduled-run-list`,children:f.map(e=>(0,B.jsx)(H,{onOpen:()=>{m&&Ie(Fe(m,e.conversationId),e.conversationId)},run:e},e.id))})})]})})}function Me(e){return e.recurrence??{version:1,kind:`daily`,timeZone:e.timeZone||Re(),startDate:Le(),localTime:`08:00`,end:{kind:`never`}}}function Ne(e){let t=e.input.prompt;return typeof t==`string`&&t.trim()?t.trim():Object.keys(e.input).length>0?JSON.stringify(e.input,null,2):`No task input configured.`}function Pe(e,t){let[n,r]=(0,O.useState)([]),[i,a]=(0,O.useState)(!1),[o,s]=(0,O.useState)(null);return(0,O.useEffect)(()=>{if(!e){r([]),a(!1),s(null);return}let n=!1;return a(!0),w.localAgentScheduleRuns(e,t,{limit:20}).then(e=>{n||(r(e.runs),s(null))}).catch(e=>{n||s(ze(e))}).finally(()=>{n||a(!1)}),()=>{n=!0}},[e,t]),{error:o,loading:i,runs:n}}function Fe(e,t){let n=new URL(e);return n.pathname=t?`/sandboxes/work/${encodeURIComponent(t)}`:`/sandboxes/work`,n.search=``,n.hash=``,n.toString()}async function Ie(e,t){let n=window.openpond?.browser;n?.openExternal&&(await n.openExternal({conversationId:t??`hosted-scheduled-work`,url:e})).ok||window.open(e,`_blank`,`noopener,noreferrer`)}function Le(){return new Date().toISOString().slice(0,10)}function Re(){return Intl.DateTimeFormat().resolvedOptions().timeZone||`UTC`}function ze(e){return e instanceof Error?e.message:String(e)}export{ke as ScheduledWorkPage};
|