openpond 0.2.65 → 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-PHMBLRCV.js → acp-YYZ3ZO3Q.js} +1 -1
- package/dist/chunks/{acp-agent-A7GK2VSH.js → acp-agent-T26S7TU2.js} +1 -1
- package/dist/chunks/{app-layer-J66CQ2QN.js → app-layer-5XUMNHDO.js} +1 -1
- package/dist/chunks/{app-server-runtime-OMR2VE6L.js → app-server-runtime-TH56EG2Z.js} +1 -1
- package/dist/chunks/{apps-IHUFERZO.js → apps-MNT3KXIY.js} +1 -1
- package/dist/chunks/chunk-2ZNW6GUU.js +2 -0
- package/dist/chunks/{chunk-E2S2EMYQ.js → chunk-BQVB2SPF.js} +5 -5
- package/dist/chunks/{chunk-UM6EQOT2.js → chunk-JKI53ED7.js} +1 -1
- package/dist/chunks/{chunk-FGOTSCSE.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-N2AV7PHV.js → chunk-UXPO3ZV7.js} +2 -2
- package/dist/chunks/{command-NDHFZAKA.js → command-NW6BGKOM.js} +3 -3
- package/dist/chunks/{configuration-command-465ODYTC.js → configuration-command-4WTS2MZS.js} +1 -1
- package/dist/chunks/{connected-evidence-XPAZQRFQ.js → connected-evidence-D7C45HYD.js} +1 -1
- package/dist/chunks/{connected-starting-assets-2YX3QVDB.js → connected-starting-assets-4LDXQVLN.js} +1 -1
- package/dist/chunks/{core-commands-PJOGRBHJ.js → core-commands-RXPXOYOP.js} +1 -1
- package/dist/chunks/{datasets-OTE2I4VT.js → datasets-LBLEKLCS.js} +1 -1
- package/dist/chunks/{desktop-test-Q6REQJ7K.js → desktop-test-INJPZ5VP.js} +1 -1
- package/dist/chunks/{evaluation-coordination-KRCY2H4C.js → evaluation-coordination-3ARLJAFH.js} +1 -1
- package/dist/chunks/{experiment-improvements-7MI2VYBR.js → experiment-improvements-UB4C5CSP.js} +1 -1
- package/dist/chunks/{experiments-CNUQKJZE.js → experiments-AHHKFJD6.js} +1 -1
- package/dist/chunks/{experiments-signal-4N344D4Y.js → experiments-signal-MTR475QV.js} +1 -1
- package/dist/chunks/{help-ZUKVY6RO.js → help-JQA3YMCX.js} +1 -1
- package/dist/chunks/{hosted-app-server-composition-DWSU6ASL.js → hosted-app-server-composition-GPXH3BOG.js} +1 -1
- package/dist/chunks/{human-review-HOBGC6RC.js → human-review-DVHVJXBA.js} +1 -1
- package/dist/chunks/{import-Q3YRFVY7.js → import-CLWTKDG6.js} +1 -1
- package/dist/chunks/{opchat-2LLDIWEJ.js → opchat-LMKH3OWR.js} +1 -1
- package/dist/chunks/{opchat-bounded-chat-FLDS36LU.js → opchat-bounded-chat-PPOWO7H4.js} +1 -1
- package/dist/chunks/{organizations-VIFSOY6P.js → organizations-T6ZUSHNJ.js} +1 -1
- package/dist/chunks/{profile-KIHMW2WB.js → profile-RIDNU2I5.js} +1 -1
- package/dist/chunks/{project-agent-TJLQNMLA.js → project-agent-GBMVDJY3.js} +1 -1
- package/dist/chunks/{sandbox-command-CQO6BEMQ.js → sandbox-command-L5VQ2T6C.js} +1 -1
- package/dist/chunks/{sandbox-template-MU33IILL.js → sandbox-template-NN3XQI7M.js} +1 -1
- package/dist/chunks/{setup-HSRCZ3WR.js → setup-TXEM2QSG.js} +1 -1
- package/dist/chunks/{src-CHQVWHV7.js → src-HJHIBDFX.js} +1 -1
- package/dist/chunks/{teams-bot-D3LWA4S5.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,4 +1,4 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{f as t,g as n,h as r,m as i}from"./index-CM0IRu1U.js";import{n as a}from"./api-client-Dgz-fOMl.js";import"./icons-c3vt7y6n.js";import{t as o}from"./createLucideIcon-DF2VR6WA.js";import{t as s}from"./copy-CBFg6m0d.js";import{t as c}from"./x-D9GTV9ke.js";import{An as l,Bt as u,O as d,b as f,bn as p,dn as m,k as h,on as g,x as _}from"./App-BZuSv1XM.js";var v=o(`archive`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]),y=o(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),b=o(`clipboard`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}]]),x=o(`code-xml`,[[`path`,{d:`m18 16 4-4-4-4`,key:`1inbqp`}],[`path`,{d:`m6 8-4 4 4 4`,key:`15zrgr`}],[`path`,{d:`m14.5 4-5 16`,key:`e7oirm`}]]),S=o(`file`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}]]),C=o(`minimize-2`,[[`path`,{d:`m14 10 7-7`,key:`oa77jy`}],[`path`,{d:`M20 10h-6V4`,key:`mjg0md`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M4 14h6v6`,key:`rmj7iw`}]]),ee=o(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),te=o(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),ne=o(`workflow`,[[`rect`,{width:`8`,height:`8`,x:`3`,y:`3`,rx:`2`,key:`by2w9f`}],[`path`,{d:`M7 11v4a2 2 0 0 0 2 2h4`,key:`xkn7yn`}],[`rect`,{width:`8`,height:`8`,x:`13`,y:`13`,rx:`2`,key:`1cgmvn`}]]),re=o(`text-wrap`,[[`path`,{d:`m16 16-3 3 3 3`,key:`117b85`}],[`path`,{d:`M3 12h14.5a1 1 0 0 1 0 7H13`,key:`18xa6z`}],[`path`,{d:`M3 19h6`,key:`1ygdsz`}],[`path`,{d:`M3 5h18`,key:`1u36vt`}]]),w=e(n(),1);async function ie(e){if(!e)return!1;try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch(e){console.warn(`Clipboard write failed`,e)}try{let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.left=`-1000px`,t.style.top=`-1000px`,document.body.appendChild(t),t.select();let n=document.execCommand(`copy`);return t.remove(),n}catch(e){return console.warn(`Clipboard fallback failed`,e),!1}}var ae=e=>/\.html?(?:[?#].*)?$/i.test(e);async function oe(e,t,n,r=`local`){return(await a(e,`/v1/${r===`sandbox`?`sandboxes`:`workspaces`}/${encodeURIComponent(t)}/html-preview`,{method:`POST`,body:JSON.stringify({path:n})})).url}async function se(e,t,n){return(await a(e,`/v1/html-previews`,{method:`POST`,body:JSON.stringify({name:t,content:n})})).url}var ce=new Set(`bash.c.cc.cjs.cpp.css.csv.docx.env.gif.go.graphql.h.hpp.html.htm.ico.java.jpeg.jpg.js.json.jsx.lock.lockb.md.mdx.m4v.mjs.mov.mp4.pdf.pptx.png.py.rs.scss.sh.sql.svg.toml.ts.tsx.txt.xlsx.webp.webm.yaml.yml.zsh`.split(`.`)),le=new Set([`AGENTS.md`,`Dockerfile`,`LICENSE`,`Makefile`,`README`]),ue=String.raw`[A-Za-z0-9_.@+-]+`,de=new RegExp(String.raw`^(?:(?:\.{1,2}|~)?[\\/]|[A-Za-z]:[\\/])?(?:${ue}[\\/])+${ue}(?::\d+(?::\d+)?)?`),fe=new RegExp(String.raw`^${ue}(?::\d+(?::\d+)?)?`),pe=/^(?:workspace|sandbox):file:[^\s<>()]+/;function me({projectTargetDetail:e,projectTargetValue:t,workspaceRepoPath:n,workspaceTargetValue:r}){return n?.trim()||(r!==`local`||!t.startsWith(`local:`)?null:e.trim()||null)}function he(e,t,n={}){if(!xe(e[t-1]))return null;let r=e.slice(t),i=pe.exec(r),a=i?null:de.exec(r),o=i||a?null:fe.exec(r),s=Se((i??a??o)?.[0]??``);if(!s)return null;let c=ge(s,n);return c?{...c,end:t+s.length}:null}function ge(e,t={}){let n=Se(e.trim().replace(/^['"`]+|['"`]+$/g,``));if(!n||/^https?:\/\//i.test(n))return null;let r=ve(_e(n),t.href).replace(/:\d+(?::\d+)?$/,``);return be(r.replace(/(\.html?)[?#].*$/i,`$1`),t.href)?{displayPath:n,path:ye(t.fileBasePath&&!/^(?:workspace|sandbox):file:/i.test(n)&&!/^(?:[~/\\]|[A-Za-z]:|(?:workspace|sandbox):file:)/.test(r)?`${t.fileBasePath.replace(/[\\/]+$/,``)}/${r.replace(/^\.\//,``)}`:r)}:null}function _e(e){let t=/^(workspace|sandbox):file:(.*)$/i.exec(e);if(!t)return e;let n=t[1]?.toLowerCase(),r=t[2]??``;return n===`sandbox`&&(r=r.replace(/^\/workspace\/app\//,``).replace(/^\/workspace\//,``)),r}function ve(e,t=!1){if(!/^file:\/\//i.test(e)){if(t)try{return decodeURIComponent(e)}catch{}return e}try{let t=new URL(e);return decodeURIComponent(t.pathname)+(/\.html?$/i.test(t.pathname)?t.search+t.hash:``)}catch{return e.replace(/^file:\/\//i,``)}}function ye(e){return e.replace(/\\/g,`/`).replace(/^\.\/+/,``)}function be(e,t=!1){if(/[\n\r]/.test(e)||!t&&/^[^/\\]*\s/.test(e)||/[=;?<>|]/.test(e))return!1;if(/[\\/]$/.test(e)&&/[^.~/\\]/.test(e))return!0;let n=e.replace(/\\/g,`/`).split(`/`).filter(Boolean).at(-1)??e;if(le.has(n)||/^\.[A-Za-z_]/.test(n))return!0;let r=n.includes(`.`)?n.split(`.`).at(-1)?.toLowerCase():null;return!!(r&&ce.has(r))}function xe(e){return!e||/[\s([{<"'`]/.test(e)}function Se(e){return e.replace(/[.,;!?]+$/,``).replace(/[\])}]+$/,``)}function Ce(e){return/^(?:#{1,6}\s*)?(?:\*\*)?(?:(?:the|both|all)\s+)?(?:updated\s+)?(?:files|outputs|deliverables|everything|slide\s+and\s+deck)(?:\*\*)?\s*(?:(?:is|are)\s+)?(?:\(\s*)?(?:in|at|under|:)\s*`((?:~[\/]|[\/]|[A-Za-z]:[\/])[^`\n]+[\/])`/i.exec(e.trim())?.[1]??null}function we(e,t,n){let[r,i]=(0,w.useState)({key:t,url:null,status:`loading`}),a=(0,w.useRef)(null);(0,w.useEffect)(()=>{if(!e||!t)return;_.activateConnection(e);let r=_.watch(t,n,e=>i({...e,key:t}));a.current=r;let o=()=>{document.visibilityState!==`hidden`&&r.refresh()};return window.addEventListener(`focus`,o),window.addEventListener(`openpond-runtime-connected`,o),document.addEventListener(`visibilitychange`,o),()=>{r.close(),a.current=null,window.removeEventListener(`focus`,o),window.removeEventListener(`openpond-runtime-connected`,o),document.removeEventListener(`visibilitychange`,o)}},[e,t,n]);let o=(0,w.useCallback)(()=>a.current?.refresh(!0),[]);return{...r.key===t&&e&&t?r:{url:null,status:`loading`},retry:o}}function Te(e,t){return Ee(e,t).url}function Ee(e,t){let n=(0,w.useCallback)(()=>p.signLocalImageUrl(e,{path:t}),[e,t]);return we(e,e&&t?f(e,`local-image`,t):null,n)}function De(e){let[,t]=(0,w.useState)(0),n=(0,w.useCallback)(t=>!e||!t?null:(_.activateConnection(e),_.get(f(e,`local-image`,t))),[e]),r=(0,w.useCallback)(async n=>{if(!e||!n)return null;_.activateConnection(e);let r=f(e,`local-image`,n);return _.load(r,()=>p.signLocalImageUrl(e,{path:n})).finally(()=>t(e=>e+1))},[e]);return(0,w.useMemo)(()=>({getUrl:n,loadUrl:r}),[n,r])}function Oe(e,t,n){return/^(?:[~/\\]|[A-Za-z]:|file:\/\/)/.test(n)?p.signLocalImageUrl(e,{path:n}):p.signWorkspaceImageUrl(e,{appId:t,path:n})}function ke(e,t,n){return Ae(e,t,n).url}function Ae(e,t,n){let r=(0,w.useCallback)(()=>Oe(e,t,n),[e,t,n]);return we(e,e&&t&&n?f(e,`workspace-image`,t,n):null,r)}function je(e){let[,t]=(0,w.useState)(0),n=(0,w.useCallback)((t,n)=>!e||!t||!n?null:(_.activateConnection(e),_.get(f(e,`workspace-image`,t,n))),[e]),r=(0,w.useCallback)(async(n,r)=>{if(!e||!n||!r)return null;_.activateConnection(e);let i=f(e,`workspace-image`,n,r);return _.load(i,()=>Oe(e,n,r)).finally(()=>t(e=>e+1))},[e]),i=(0,w.useCallback)((e,t)=>{r(e,t)},[r]);return(0,w.useMemo)(()=>({ensureUrl:i,getUrl:n,loadUrl:r}),[i,n,r])}var Me=r();async function Ne(e,t){let n=window.openpond?.files?.saveImage;if(n){let r=await n({url:new URL(e,window.location.href).href,suggestedName:t});if(!r.ok&&!r.canceled)throw Error(r.error||`Could not save image.`);return}let r=window.showSaveFilePicker,i;try{i=r?await r.call(window,{suggestedName:t}):void 0}catch(e){if(e instanceof DOMException&&e.name===`AbortError`)return;throw e}let a=await fetch(e);if(!a.ok)throw Error(`Image download failed (${a.status}).`);let o=await a.blob();if(i){let e=await i.createWritable();try{await e.write(o),await e.close()}catch(t){throw await e.abort().catch(()=>void 0),t}return}let s=URL.createObjectURL(o),c=document.createElement(`a`);c.href=s,c.download=t,document.body.appendChild(c),c.click(),c.remove(),setTimeout(()=>URL.revokeObjectURL(s),6e4)}var T=i();function Pe({open:e,src:t,title:n,onClose:r}){let[i,a]=(0,w.useState)(!1),[o,s]=(0,w.useState)(!1),[l,d]=(0,w.useState)(null);if((0,w.useEffect)(()=>{if(!e)return;let t=e=>{e.key===`Escape`&&r()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[r,e]),(0,w.useEffect)(()=>{a(!1),d(null)},[t]),!e||!t)return null;let f=(()=>{let e=n.split(`/`).pop()?.trim();if(e&&/\.[A-Za-z0-9]+$/.test(e))return e;try{let e=new URL(t,window.location.href),n=(e.searchParams.get(`path`)??e.searchParams.get(`storageName`)??e.pathname).split(/[\\/]/).pop()?.trim();if(n&&/\.[A-Za-z0-9]+$/.test(n))return n}catch{}return`image.png`})();return(0,Me.createPortal)((0,T.jsx)(`div`,{className:`image-lightbox-backdrop`,role:`presentation`,onMouseDown:e=>{e.target===e.currentTarget&&r()},children:(0,T.jsxs)(`section`,{"aria-label":n?`Image preview: ${n}`:`Image preview`,"aria-modal":`true`,className:`image-lightbox-dialog`,role:`dialog`,children:[(0,T.jsxs)(`header`,{className:`image-lightbox-header`,children:[(0,T.jsx)(`span`,{title:n,children:n}),(0,T.jsxs)(`div`,{className:`image-lightbox-actions`,children:[(0,T.jsx)(`button`,{type:`button`,"aria-label":`Download image`,title:`Download`,disabled:o,"aria-busy":o,onClick:async()=>{if(!o){s(!0),d(null);try{await Ne(t,f)}catch(e){d(e instanceof Error?e.message:`Could not save image.`)}finally{s(!1)}}},children:(0,T.jsx)(g,{size:16})}),(0,T.jsx)(`button`,{type:`button`,"aria-label":`Close image preview`,title:`Close`,onClick:r,children:(0,T.jsx)(c,{size:16})})]})]}),l&&(0,T.jsx)(u,{error:l}),(0,T.jsx)(`div`,{className:`image-lightbox-frame`,children:i?(0,T.jsx)(u,{error:`Image preview unavailable`}):(0,T.jsx)(`img`,{alt:n||`Image preview`,decoding:`async`,draggable:!1,src:t,onError:()=>a(!0)})})]})}),document.body)}function Fe(e){let t=e.replace(/\r\n/g,`
|
|
1
|
+
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{f as t,g as n,h as r,m as i}from"./index-D7igQSAg.js";import{n as a}from"./api-client-Dgz-fOMl.js";import"./icons-B8_Rkg-l.js";import{t as o}from"./createLucideIcon-CmkSm39S.js";import{t as s}from"./copy-DRnATDDY.js";import{t as c}from"./x-Bhl-4Zlt.js";import{An as l,Bt as u,O as d,b as f,bn as p,dn as m,k as h,on as g,x as _}from"./App-CNQi3RlI.js";var v=o(`archive`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]),y=o(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),b=o(`clipboard`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}]]),x=o(`code-xml`,[[`path`,{d:`m18 16 4-4-4-4`,key:`1inbqp`}],[`path`,{d:`m6 8-4 4 4 4`,key:`15zrgr`}],[`path`,{d:`m14.5 4-5 16`,key:`e7oirm`}]]),S=o(`file`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}]]),C=o(`minimize-2`,[[`path`,{d:`m14 10 7-7`,key:`oa77jy`}],[`path`,{d:`M20 10h-6V4`,key:`mjg0md`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M4 14h6v6`,key:`rmj7iw`}]]),ee=o(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),te=o(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),ne=o(`workflow`,[[`rect`,{width:`8`,height:`8`,x:`3`,y:`3`,rx:`2`,key:`by2w9f`}],[`path`,{d:`M7 11v4a2 2 0 0 0 2 2h4`,key:`xkn7yn`}],[`rect`,{width:`8`,height:`8`,x:`13`,y:`13`,rx:`2`,key:`1cgmvn`}]]),re=o(`text-wrap`,[[`path`,{d:`m16 16-3 3 3 3`,key:`117b85`}],[`path`,{d:`M3 12h14.5a1 1 0 0 1 0 7H13`,key:`18xa6z`}],[`path`,{d:`M3 19h6`,key:`1ygdsz`}],[`path`,{d:`M3 5h18`,key:`1u36vt`}]]),w=e(n(),1);async function ie(e){if(!e)return!1;try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch(e){console.warn(`Clipboard write failed`,e)}try{let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.left=`-1000px`,t.style.top=`-1000px`,document.body.appendChild(t),t.select();let n=document.execCommand(`copy`);return t.remove(),n}catch(e){return console.warn(`Clipboard fallback failed`,e),!1}}var ae=e=>/\.html?(?:[?#].*)?$/i.test(e);async function oe(e,t,n,r=`local`){return(await a(e,`/v1/${r===`sandbox`?`sandboxes`:`workspaces`}/${encodeURIComponent(t)}/html-preview`,{method:`POST`,body:JSON.stringify({path:n})})).url}async function se(e,t,n){return(await a(e,`/v1/html-previews`,{method:`POST`,body:JSON.stringify({name:t,content:n})})).url}var ce=new Set(`bash.c.cc.cjs.cpp.css.csv.docx.env.gif.go.graphql.h.hpp.html.htm.ico.java.jpeg.jpg.js.json.jsx.lock.lockb.md.mdx.m4v.mjs.mov.mp4.pdf.pptx.png.py.rs.scss.sh.sql.svg.toml.ts.tsx.txt.xlsx.webp.webm.yaml.yml.zsh`.split(`.`)),le=new Set([`AGENTS.md`,`Dockerfile`,`LICENSE`,`Makefile`,`README`]),ue=String.raw`[A-Za-z0-9_.@+-]+`,de=new RegExp(String.raw`^(?:(?:\.{1,2}|~)?[\\/]|[A-Za-z]:[\\/])?(?:${ue}[\\/])+${ue}(?::\d+(?::\d+)?)?`),fe=new RegExp(String.raw`^${ue}(?::\d+(?::\d+)?)?`),pe=/^(?:workspace|sandbox):file:[^\s<>()]+/;function me({projectTargetDetail:e,projectTargetValue:t,workspaceRepoPath:n,workspaceTargetValue:r}){return n?.trim()||(r!==`local`||!t.startsWith(`local:`)?null:e.trim()||null)}function he(e,t,n={}){if(!xe(e[t-1]))return null;let r=e.slice(t),i=pe.exec(r),a=i?null:de.exec(r),o=i||a?null:fe.exec(r),s=Se((i??a??o)?.[0]??``);if(!s)return null;let c=ge(s,n);return c?{...c,end:t+s.length}:null}function ge(e,t={}){let n=Se(e.trim().replace(/^['"`]+|['"`]+$/g,``));if(!n||/^https?:\/\//i.test(n))return null;let r=ve(_e(n),t.href).replace(/:\d+(?::\d+)?$/,``);return be(r.replace(/(\.html?)[?#].*$/i,`$1`),t.href)?{displayPath:n,path:ye(t.fileBasePath&&!/^(?:workspace|sandbox):file:/i.test(n)&&!/^(?:[~/\\]|[A-Za-z]:|(?:workspace|sandbox):file:)/.test(r)?`${t.fileBasePath.replace(/[\\/]+$/,``)}/${r.replace(/^\.\//,``)}`:r)}:null}function _e(e){let t=/^(workspace|sandbox):file:(.*)$/i.exec(e);if(!t)return e;let n=t[1]?.toLowerCase(),r=t[2]??``;return n===`sandbox`&&(r=r.replace(/^\/workspace\/app\//,``).replace(/^\/workspace\//,``)),r}function ve(e,t=!1){if(!/^file:\/\//i.test(e)){if(t)try{return decodeURIComponent(e)}catch{}return e}try{let t=new URL(e);return decodeURIComponent(t.pathname)+(/\.html?$/i.test(t.pathname)?t.search+t.hash:``)}catch{return e.replace(/^file:\/\//i,``)}}function ye(e){return e.replace(/\\/g,`/`).replace(/^\.\/+/,``)}function be(e,t=!1){if(/[\n\r]/.test(e)||!t&&/^[^/\\]*\s/.test(e)||/[=;?<>|]/.test(e))return!1;if(/[\\/]$/.test(e)&&/[^.~/\\]/.test(e))return!0;let n=e.replace(/\\/g,`/`).split(`/`).filter(Boolean).at(-1)??e;if(le.has(n)||/^\.[A-Za-z_]/.test(n))return!0;let r=n.includes(`.`)?n.split(`.`).at(-1)?.toLowerCase():null;return!!(r&&ce.has(r))}function xe(e){return!e||/[\s([{<"'`]/.test(e)}function Se(e){return e.replace(/[.,;!?]+$/,``).replace(/[\])}]+$/,``)}function Ce(e){return/^(?:#{1,6}\s*)?(?:\*\*)?(?:(?:the|both|all)\s+)?(?:updated\s+)?(?:files|outputs|deliverables|everything|slide\s+and\s+deck)(?:\*\*)?\s*(?:(?:is|are)\s+)?(?:\(\s*)?(?:in|at|under|:)\s*`((?:~[\/]|[\/]|[A-Za-z]:[\/])[^`\n]+[\/])`/i.exec(e.trim())?.[1]??null}function we(e,t,n){let[r,i]=(0,w.useState)({key:t,url:null,status:`loading`}),a=(0,w.useRef)(null);(0,w.useEffect)(()=>{if(!e||!t)return;_.activateConnection(e);let r=_.watch(t,n,e=>i({...e,key:t}));a.current=r;let o=()=>{document.visibilityState!==`hidden`&&r.refresh()};return window.addEventListener(`focus`,o),window.addEventListener(`openpond-runtime-connected`,o),document.addEventListener(`visibilitychange`,o),()=>{r.close(),a.current=null,window.removeEventListener(`focus`,o),window.removeEventListener(`openpond-runtime-connected`,o),document.removeEventListener(`visibilitychange`,o)}},[e,t,n]);let o=(0,w.useCallback)(()=>a.current?.refresh(!0),[]);return{...r.key===t&&e&&t?r:{url:null,status:`loading`},retry:o}}function Te(e,t){return Ee(e,t).url}function Ee(e,t){let n=(0,w.useCallback)(()=>p.signLocalImageUrl(e,{path:t}),[e,t]);return we(e,e&&t?f(e,`local-image`,t):null,n)}function De(e){let[,t]=(0,w.useState)(0),n=(0,w.useCallback)(t=>!e||!t?null:(_.activateConnection(e),_.get(f(e,`local-image`,t))),[e]),r=(0,w.useCallback)(async n=>{if(!e||!n)return null;_.activateConnection(e);let r=f(e,`local-image`,n);return _.load(r,()=>p.signLocalImageUrl(e,{path:n})).finally(()=>t(e=>e+1))},[e]);return(0,w.useMemo)(()=>({getUrl:n,loadUrl:r}),[n,r])}function Oe(e,t,n){return/^(?:[~/\\]|[A-Za-z]:|file:\/\/)/.test(n)?p.signLocalImageUrl(e,{path:n}):p.signWorkspaceImageUrl(e,{appId:t,path:n})}function ke(e,t,n){return Ae(e,t,n).url}function Ae(e,t,n){let r=(0,w.useCallback)(()=>Oe(e,t,n),[e,t,n]);return we(e,e&&t&&n?f(e,`workspace-image`,t,n):null,r)}function je(e){let[,t]=(0,w.useState)(0),n=(0,w.useCallback)((t,n)=>!e||!t||!n?null:(_.activateConnection(e),_.get(f(e,`workspace-image`,t,n))),[e]),r=(0,w.useCallback)(async(n,r)=>{if(!e||!n||!r)return null;_.activateConnection(e);let i=f(e,`workspace-image`,n,r);return _.load(i,()=>Oe(e,n,r)).finally(()=>t(e=>e+1))},[e]),i=(0,w.useCallback)((e,t)=>{r(e,t)},[r]);return(0,w.useMemo)(()=>({ensureUrl:i,getUrl:n,loadUrl:r}),[i,n,r])}var Me=r();async function Ne(e,t){let n=window.openpond?.files?.saveImage;if(n){let r=await n({url:new URL(e,window.location.href).href,suggestedName:t});if(!r.ok&&!r.canceled)throw Error(r.error||`Could not save image.`);return}let r=window.showSaveFilePicker,i;try{i=r?await r.call(window,{suggestedName:t}):void 0}catch(e){if(e instanceof DOMException&&e.name===`AbortError`)return;throw e}let a=await fetch(e);if(!a.ok)throw Error(`Image download failed (${a.status}).`);let o=await a.blob();if(i){let e=await i.createWritable();try{await e.write(o),await e.close()}catch(t){throw await e.abort().catch(()=>void 0),t}return}let s=URL.createObjectURL(o),c=document.createElement(`a`);c.href=s,c.download=t,document.body.appendChild(c),c.click(),c.remove(),setTimeout(()=>URL.revokeObjectURL(s),6e4)}var T=i();function Pe({open:e,src:t,title:n,onClose:r}){let[i,a]=(0,w.useState)(!1),[o,s]=(0,w.useState)(!1),[l,d]=(0,w.useState)(null);if((0,w.useEffect)(()=>{if(!e)return;let t=e=>{e.key===`Escape`&&r()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[r,e]),(0,w.useEffect)(()=>{a(!1),d(null)},[t]),!e||!t)return null;let f=(()=>{let e=n.split(`/`).pop()?.trim();if(e&&/\.[A-Za-z0-9]+$/.test(e))return e;try{let e=new URL(t,window.location.href),n=(e.searchParams.get(`path`)??e.searchParams.get(`storageName`)??e.pathname).split(/[\\/]/).pop()?.trim();if(n&&/\.[A-Za-z0-9]+$/.test(n))return n}catch{}return`image.png`})();return(0,Me.createPortal)((0,T.jsx)(`div`,{className:`image-lightbox-backdrop`,role:`presentation`,onMouseDown:e=>{e.target===e.currentTarget&&r()},children:(0,T.jsxs)(`section`,{"aria-label":n?`Image preview: ${n}`:`Image preview`,"aria-modal":`true`,className:`image-lightbox-dialog`,role:`dialog`,children:[(0,T.jsxs)(`header`,{className:`image-lightbox-header`,children:[(0,T.jsx)(`span`,{title:n,children:n}),(0,T.jsxs)(`div`,{className:`image-lightbox-actions`,children:[(0,T.jsx)(`button`,{type:`button`,"aria-label":`Download image`,title:`Download`,disabled:o,"aria-busy":o,onClick:async()=>{if(!o){s(!0),d(null);try{await Ne(t,f)}catch(e){d(e instanceof Error?e.message:`Could not save image.`)}finally{s(!1)}}},children:(0,T.jsx)(g,{size:16})}),(0,T.jsx)(`button`,{type:`button`,"aria-label":`Close image preview`,title:`Close`,onClick:r,children:(0,T.jsx)(c,{size:16})})]})]}),l&&(0,T.jsx)(u,{error:l}),(0,T.jsx)(`div`,{className:`image-lightbox-frame`,children:i?(0,T.jsx)(u,{error:`Image preview unavailable`}):(0,T.jsx)(`img`,{alt:n||`Image preview`,decoding:`async`,draggable:!1,src:t,onError:()=>a(!0)})})]})}),document.body)}function Fe(e){let t=e.replace(/\r\n/g,`
|
|
2
2
|
`).split(`
|
|
3
3
|
`),n=[],r=[],i=[],a=[],o=!1,s,c=null,l,u=0,d=null;function f(){r.length!==0&&(n.push({type:`paragraph`,content:r.join(`
|
|
4
4
|
`).trim()}),r=[])}function p(){i.length!==0&&(n.push({type:`blockquote`,content:i.join(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as e,c as t,i as n,o as r,r as i,s as a}from"./WorkspaceMonacoEditor-
|
|
1
|
+
import{a as e,c as t,i as n,o as r,r as i,s as a}from"./WorkspaceMonacoEditor-Rqq_sKW_.js";import"./toggleHighContrast-cl0cw2QK.js";import{t as o}from"./workers-CnqrOtic.js";import{typescriptDefaults as s}from"./monaco.contribution-CRdTg0FH.js";var c=class{constructor(e,t){this._modeId=e,this._defaults=t,this._worker=null,this._client=null,this._configChangeListener=this._defaults.onDidChange(()=>this._stopWorker()),this._updateExtraLibsToken=0,this._extraLibsChangeListener=this._defaults.onDidExtraLibsChange(()=>this._updateExtraLibs())}dispose(){this._configChangeListener.dispose(),this._extraLibsChangeListener.dispose(),this._stopWorker()}_stopWorker(){this._worker&&=(this._worker.dispose(),null),this._client=null}async _updateExtraLibs(){if(!this._worker)return;let e=++this._updateExtraLibsToken,t=await this._worker.getProxy();this._updateExtraLibsToken===e&&t.updateExtraLibs(this._defaults.getExtraLibs())}_getClient(){return this._client||=(async()=>(this._worker=o({moduleId:`vs/language/typescript/tsWorker`,createWorker:()=>new Worker(new URL(`/assets/ts.worker-CwbYC1F9.js`,``+import.meta.url),{type:`module`}),label:this._modeId,keepIdleModels:!0,createData:{compilerOptions:this._defaults.getCompilerOptions(),extraLibs:this._defaults.getExtraLibs(),customWorkerPath:this._defaults.workerOptions.customWorkerPath,inlayHintsOptions:this._defaults.inlayHintsOptions}}),this._defaults.getEagerModelSync()?await this._worker.withSyncedResources(a.getModels().filter(e=>e.getLanguageId()===this._modeId).map(e=>e.uri)):await this._worker.getProxy()))(),this._client}async getLanguageServiceWorker(...e){let t=await this._getClient();return this._worker&&await this._worker.withSyncedResources(e),t}},l={};l[`lib.d.ts`]=!0,l[`lib.decorators.d.ts`]=!0,l[`lib.decorators.legacy.d.ts`]=!0,l[`lib.dom.asynciterable.d.ts`]=!0,l[`lib.dom.d.ts`]=!0,l[`lib.dom.iterable.d.ts`]=!0,l[`lib.es2015.collection.d.ts`]=!0,l[`lib.es2015.core.d.ts`]=!0,l[`lib.es2015.d.ts`]=!0,l[`lib.es2015.generator.d.ts`]=!0,l[`lib.es2015.iterable.d.ts`]=!0,l[`lib.es2015.promise.d.ts`]=!0,l[`lib.es2015.proxy.d.ts`]=!0,l[`lib.es2015.reflect.d.ts`]=!0,l[`lib.es2015.symbol.d.ts`]=!0,l[`lib.es2015.symbol.wellknown.d.ts`]=!0,l[`lib.es2016.array.include.d.ts`]=!0,l[`lib.es2016.d.ts`]=!0,l[`lib.es2016.full.d.ts`]=!0,l[`lib.es2016.intl.d.ts`]=!0,l[`lib.es2017.arraybuffer.d.ts`]=!0,l[`lib.es2017.d.ts`]=!0,l[`lib.es2017.date.d.ts`]=!0,l[`lib.es2017.full.d.ts`]=!0,l[`lib.es2017.intl.d.ts`]=!0,l[`lib.es2017.object.d.ts`]=!0,l[`lib.es2017.sharedmemory.d.ts`]=!0,l[`lib.es2017.string.d.ts`]=!0,l[`lib.es2017.typedarrays.d.ts`]=!0,l[`lib.es2018.asyncgenerator.d.ts`]=!0,l[`lib.es2018.asynciterable.d.ts`]=!0,l[`lib.es2018.d.ts`]=!0,l[`lib.es2018.full.d.ts`]=!0,l[`lib.es2018.intl.d.ts`]=!0,l[`lib.es2018.promise.d.ts`]=!0,l[`lib.es2018.regexp.d.ts`]=!0,l[`lib.es2019.array.d.ts`]=!0,l[`lib.es2019.d.ts`]=!0,l[`lib.es2019.full.d.ts`]=!0,l[`lib.es2019.intl.d.ts`]=!0,l[`lib.es2019.object.d.ts`]=!0,l[`lib.es2019.string.d.ts`]=!0,l[`lib.es2019.symbol.d.ts`]=!0,l[`lib.es2020.bigint.d.ts`]=!0,l[`lib.es2020.d.ts`]=!0,l[`lib.es2020.date.d.ts`]=!0,l[`lib.es2020.full.d.ts`]=!0,l[`lib.es2020.intl.d.ts`]=!0,l[`lib.es2020.number.d.ts`]=!0,l[`lib.es2020.promise.d.ts`]=!0,l[`lib.es2020.sharedmemory.d.ts`]=!0,l[`lib.es2020.string.d.ts`]=!0,l[`lib.es2020.symbol.wellknown.d.ts`]=!0,l[`lib.es2021.d.ts`]=!0,l[`lib.es2021.full.d.ts`]=!0,l[`lib.es2021.intl.d.ts`]=!0,l[`lib.es2021.promise.d.ts`]=!0,l[`lib.es2021.string.d.ts`]=!0,l[`lib.es2021.weakref.d.ts`]=!0,l[`lib.es2022.array.d.ts`]=!0,l[`lib.es2022.d.ts`]=!0,l[`lib.es2022.error.d.ts`]=!0,l[`lib.es2022.full.d.ts`]=!0,l[`lib.es2022.intl.d.ts`]=!0,l[`lib.es2022.object.d.ts`]=!0,l[`lib.es2022.regexp.d.ts`]=!0,l[`lib.es2022.string.d.ts`]=!0,l[`lib.es2023.array.d.ts`]=!0,l[`lib.es2023.collection.d.ts`]=!0,l[`lib.es2023.d.ts`]=!0,l[`lib.es2023.full.d.ts`]=!0,l[`lib.es2023.intl.d.ts`]=!0,l[`lib.es2024.arraybuffer.d.ts`]=!0,l[`lib.es2024.collection.d.ts`]=!0,l[`lib.es2024.d.ts`]=!0,l[`lib.es2024.full.d.ts`]=!0,l[`lib.es2024.object.d.ts`]=!0,l[`lib.es2024.promise.d.ts`]=!0,l[`lib.es2024.regexp.d.ts`]=!0,l[`lib.es2024.sharedmemory.d.ts`]=!0,l[`lib.es2024.string.d.ts`]=!0,l[`lib.es5.d.ts`]=!0,l[`lib.es6.d.ts`]=!0,l[`lib.esnext.array.d.ts`]=!0,l[`lib.esnext.collection.d.ts`]=!0,l[`lib.esnext.d.ts`]=!0,l[`lib.esnext.decorators.d.ts`]=!0,l[`lib.esnext.disposable.d.ts`]=!0,l[`lib.esnext.error.d.ts`]=!0,l[`lib.esnext.float16.d.ts`]=!0,l[`lib.esnext.full.d.ts`]=!0,l[`lib.esnext.intl.d.ts`]=!0,l[`lib.esnext.iterator.d.ts`]=!0,l[`lib.esnext.promise.d.ts`]=!0,l[`lib.esnext.sharedmemory.d.ts`]=!0,l[`lib.scripthost.d.ts`]=!0,l[`lib.webworker.asynciterable.d.ts`]=!0,l[`lib.webworker.d.ts`]=!0,l[`lib.webworker.importscripts.d.ts`]=!0,l[`lib.webworker.iterable.d.ts`]=!0;function u(e,t,n=0){if(typeof e==`string`)return e;if(e===void 0)return``;let r=``;if(n){r+=t;for(let e=0;e<n;e++)r+=` `}if(r+=e.messageText,n++,e.next)for(let i of e.next)r+=u(i,t,n);return r}function d(e){return e?e.map(e=>e.text).join(``):``}var f=class{constructor(e){this._worker=e}_textSpanToRange(e,t){let n=e.getPositionAt(t.start),r=e.getPositionAt(t.start+t.length),{lineNumber:i,column:a}=n,{lineNumber:o,column:s}=r;return{startLineNumber:i,startColumn:a,endLineNumber:o,endColumn:s}}},p=class{constructor(e){this._worker=e,this._libFiles={},this._hasFetchedLibFiles=!1,this._fetchLibFilesPromise=null}isLibFile(e){return e?e.path.indexOf(`/lib.`)===0&&!!l[e.path.slice(1)]:!1}getOrCreateModel(e){let t=r.parse(e),n=a.getModel(t);if(n)return n;if(this.isLibFile(t)&&this._hasFetchedLibFiles)return a.createModel(this._libFiles[t.path.slice(1)],`typescript`,t);let i=s.getExtraLibs()[e];return i?a.createModel(i.content,`typescript`,t):null}_containsLibFile(e){for(let t of e)if(this.isLibFile(t))return!0;return!1}async fetchLibFilesIfNecessary(e){this._containsLibFile(e)&&await this._fetchLibFiles()}_fetchLibFiles(){return this._fetchLibFilesPromise||=this._worker().then(e=>e.getLibFiles()).then(e=>{this._hasFetchedLibFiles=!0,this._libFiles=e}),this._fetchLibFilesPromise}},m=class extends f{constructor(e,t,n,r){super(r),this._libFiles=e,this._defaults=t,this._selector=n,this._disposables=[],this._listener=Object.create(null);let i=e=>{if(e.getLanguageId()!==n)return;let t=()=>{let{onlyVisible:t}=this._defaults.getDiagnosticsOptions();t?e.isAttachedToEditor()&&this._doValidate(e):this._doValidate(e)},r,i=e.onDidChangeContent(()=>{clearTimeout(r),r=window.setTimeout(t,500)}),o=e.onDidChangeAttached(()=>{let{onlyVisible:n}=this._defaults.getDiagnosticsOptions();n&&(e.isAttachedToEditor()?t():a.setModelMarkers(e,this._selector,[]))});this._listener[e.uri.toString()]={dispose(){i.dispose(),o.dispose(),clearTimeout(r)}},t()},o=e=>{a.setModelMarkers(e,this._selector,[]);let t=e.uri.toString();this._listener[t]&&(this._listener[t].dispose(),delete this._listener[t])};this._disposables.push(a.onDidCreateModel(e=>i(e))),this._disposables.push(a.onWillDisposeModel(o)),this._disposables.push(a.onDidChangeModelLanguage(e=>{o(e.model),i(e.model)})),this._disposables.push({dispose(){for(let e of a.getModels())o(e)}});let s=()=>{for(let e of a.getModels())o(e),i(e)};this._disposables.push(this._defaults.onDidChange(s)),this._disposables.push(this._defaults.onDidExtraLibsChange(s)),a.getModels().forEach(e=>i(e))}dispose(){this._disposables.forEach(e=>e&&e.dispose()),this._disposables=[]}async _doValidate(e){let t=await this._worker(e.uri);if(e.isDisposed())return;let n=[],{noSyntaxValidation:i,noSemanticValidation:o,noSuggestionDiagnostics:s}=this._defaults.getDiagnosticsOptions();i||n.push(t.getSyntacticDiagnostics(e.uri.toString())),o||n.push(t.getSemanticDiagnostics(e.uri.toString())),s||n.push(t.getSuggestionDiagnostics(e.uri.toString()));let c=await Promise.all(n);if(!c||e.isDisposed())return;let l=c.reduce((e,t)=>t.concat(e),[]).filter(e=>(this._defaults.getDiagnosticsOptions().diagnosticCodesToIgnore||[]).indexOf(e.code)===-1),u=l.map(e=>e.relatedInformation||[]).reduce((e,t)=>t.concat(e),[]).map(e=>e.file?r.parse(e.file.fileName):null);await this._libFiles.fetchLibFilesIfNecessary(u),!e.isDisposed()&&a.setModelMarkers(e,this._selector,l.map(t=>this._convertDiagnostics(e,t)))}_convertDiagnostics(e,t){let r=t.start||0,i=t.length||1,{lineNumber:a,column:o}=e.getPositionAt(r),{lineNumber:s,column:c}=e.getPositionAt(r+i),l=[];return t.reportsUnnecessary&&l.push(n.Unnecessary),t.reportsDeprecated&&l.push(n.Deprecated),{severity:this._tsDiagnosticCategoryToMarkerSeverity(t.category),startLineNumber:a,startColumn:o,endLineNumber:s,endColumn:c,message:u(t.messageText,`
|
|
2
2
|
`),code:t.code.toString(),tags:l,relatedInformation:this._convertRelatedInformation(e,t.relatedInformation)}}_convertRelatedInformation(e,t){if(!t)return[];let n=[];return t.forEach(t=>{let r=e;if(t.file&&(r=this._libFiles.getOrCreateModel(t.file.fileName)),!r)return;let i=t.start||0,a=t.length||1,{lineNumber:o,column:s}=r.getPositionAt(i),{lineNumber:c,column:l}=r.getPositionAt(i+a);n.push({resource:r.uri,startLineNumber:o,startColumn:s,endLineNumber:c,endColumn:l,message:u(t.messageText,`
|
|
3
3
|
`)})}),n}_tsDiagnosticCategoryToMarkerSeverity(e){switch(e){case 1:return i.Error;case 3:return i.Info;case 0:return i.Warning;case 2:return i.Hint}return i.Info}},h=class n extends f{get triggerCharacters(){return[`.`]}async provideCompletionItems(r,i,a,o){let s=r.getWordUntilPosition(i),c=new e(i.lineNumber,s.startColumn,i.lineNumber,s.endColumn),l=r.uri,u=r.getOffsetAt(i),d=await this._worker(l);if(r.isDisposed())return;let f=await d.getCompletionsAtPosition(l.toString(),u);if(f&&!r.isDisposed())return{suggestions:f.entries.map(a=>{let o=c;if(a.replacementSpan){let t=r.getPositionAt(a.replacementSpan.start),n=r.getPositionAt(a.replacementSpan.start+a.replacementSpan.length);o=new e(t.lineNumber,t.column,n.lineNumber,n.column)}let s=[];return a.kindModifiers!==void 0&&a.kindModifiers.indexOf(`deprecated`)!==-1&&s.push(t.CompletionItemTag.Deprecated),{uri:l,position:i,offset:u,range:o,label:a.name,insertText:a.name,sortText:a.sortText,kind:n.convertKind(a.kind),tags:s}})}}async resolveCompletionItem(e,t){let r=e,i=r.uri,a=r.position,o=r.offset,s=await(await this._worker(i)).getCompletionEntryDetails(i.toString(),o,r.label);return s?{uri:i,position:a,label:s.name,kind:n.convertKind(s.kind),detail:d(s.displayParts),documentation:{value:n.createDocumentationString(s)}}:r}static convertKind(e){switch(e){case C.primitiveType:case C.keyword:return t.CompletionItemKind.Keyword;case C.variable:case C.localVariable:return t.CompletionItemKind.Variable;case C.memberVariable:case C.memberGetAccessor:case C.memberSetAccessor:return t.CompletionItemKind.Field;case C.function:case C.memberFunction:case C.constructSignature:case C.callSignature:case C.indexSignature:return t.CompletionItemKind.Function;case C.enum:return t.CompletionItemKind.Enum;case C.module:return t.CompletionItemKind.Module;case C.class:return t.CompletionItemKind.Class;case C.interface:return t.CompletionItemKind.Interface;case C.warning:return t.CompletionItemKind.File}return t.CompletionItemKind.Property}static createDocumentationString(e){let t=d(e.documentation);if(e.tags)for(let n of e.tags)t+=`
|
|
4
4
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./createLucideIcon-
|
|
1
|
+
import{t as e}from"./createLucideIcon-CmkSm39S.js";var t=e(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]);export{t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{g as t}from"./index-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{g as t}from"./index-D7igQSAg.js";import{bn as n}from"./App-CNQi3RlI.js";var r=e(t(),1);function i({connection:e,onError:t,onPayload:i}){let[a,o]=(0,r.useState)(!1),[s,c]=(0,r.useState)(!1);async function l(r,a){if(e){o(!0),t(null);try{i(await n.switchOpenPondAccount(e,{handle:r,baseUrl:a??null}))}catch(e){t(e instanceof Error?e.message:String(e))}finally{o(!1)}}}async function u(r,a){if(!e)return!1;o(!0),t(null);try{return i(await n.removeOpenPondAccount(e,{handle:r,baseUrl:a??null})),!0}catch(e){return t(e instanceof Error?e.message:String(e)),!1}finally{o(!1)}}async function d(r){if(e&&r.apiKey.trim()){o(!0),t(null);try{let t=r.handle?.trim(),a=r.environment?.trim();i(await n.saveOpenPondAccount(e,{apiKey:r.apiKey.trim(),handle:t||void 0,baseUrl:r.baseUrl,apiBaseUrl:r.apiBaseUrl,environment:a||`custom`,setActive:!0}))}catch(e){throw t(e instanceof Error?e.message:String(e)),e}finally{o(!1)}}}async function f(){if(e){c(!0),t(null);try{i(await n.refreshOpenPondAccounts(e))}catch(e){t(e instanceof Error?e.message:String(e))}finally{c(!1)}}}return{refreshingAccounts:s,saving:a,refreshAccounts:f,removeAccount:u,saveAccount:d,switchAccount:l}}export{i as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{g as t,s as n}from"./index-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{g as t,s as n}from"./index-D7igQSAg.js";import{n as r}from"./api-client-Dgz-fOMl.js";var i=[{id:`openpond_chat`,name:`Pal`,icon:n},{id:`codex`,name:`Codex`,icon:`/agent-sources/codex.svg`,provider:`codex`},{id:`claude_code`,name:`Claude Code`,icon:`/agent-sources/claude-code.svg`,provider:`claude-code`},{id:`opencode`,name:`OpenCode`,icon:`/agent-sources/opencode.svg`,provider:`opencode`},{id:`grok_build`,name:`Grok Build`,icon:`/agent-sources/grok-build.svg`,provider:`grok-build`},{id:`hermes`,name:`Hermes`,icon:`/agent-sources/hermes.png`},{id:`pi`,name:`Pi`,icon:`/agent-sources/pi.svg`},{id:`openclaw`,name:`OpenClaw`,icon:`/agent-sources/openclaw.svg`},{id:`oh_my_pi`,name:`Oh My Pi`,icon:`/agent-sources/oh-my-pi.svg`}];function a(e,t){if(e.state===`disconnected`)return`Disconnected`;if(e.state===`paused`)return`Paused`;if(e.selectedConversations===0)return`Choose conversations to upload`;if(t.running&&e.run?.state===`running`)return`Importing conversations`;if(e.error||e.run?.state===`failed`)return`Needs attention`;let n=e.schedule;return n?.frequency===`hourly`?`Hourly`:n?.frequency===`cron`?`Cron: ${n.expression}`:n?.frequency===`daily`?`Daily at ${n.time}`:n?.frequency===`weekly`?`Weekly on ${[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`][n.day]} at ${n.time}`:`Manual imports`}var o=e(t(),1),s=new WeakMap;function c(e){let[t,n]=(0,o.useState)(null),[i,a]=(0,o.useState)(null),[c,l]=(0,o.useState)(!1),u=(0,o.useRef)(0),d=(0,o.useRef)(null),f=(0,o.useCallback)(async()=>{if(!e||d.current)return;let t=new AbortController;d.current=t;let i=u.current;l(!0);try{let o=await r(e,`/v1/native-history/collector`,{method:`POST`,body:JSON.stringify({command:`inventory`}),signal:t.signal});if(i!==u.current||t.signal.aborted)return;s.set(e,o),n({connection:e,value:o}),a(null)}catch(e){i===u.current&&!t.signal.aborted&&a(e instanceof Error?e.message:`Unable to read agent connections.`)}finally{d.current===t&&(d.current=null),i===u.current&&l(!1)}},[e]);return(0,o.useEffect)(()=>{u.current++,a(null),f();let e=window.setInterval(()=>{document.hidden||f()},1e4),t=()=>{f()};return window.addEventListener(`focus`,t),()=>{u.current++,d.current?.abort(),d.current=null,window.clearInterval(e),window.removeEventListener(`focus`,t)}},[f]),{inventory:t?.connection===e?t.value:e?s.get(e)??null:null,loading:c,error:i,refresh:f}}export{i as n,a as r,c as t};
|
package/dist/web/assets/{useLocalAgentSchedules-P-UaUKMb.js → useLocalAgentSchedules-DNh_x9gQ.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{g as t}from"./index-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{g as t}from"./index-D7igQSAg.js";import{bn as n}from"./App-CNQi3RlI.js";var r=e(t(),1),i=5e3;function a(e){let[t,a]=(0,r.useState)([]),[s,c]=(0,r.useState)(!1),[l,u]=(0,r.useState)(null),[d,f]=(0,r.useState)(()=>new Set);(0,r.useEffect)(()=>{if(!e){a([]),u(null),c(!1);return}let t=e,r=!1;async function s(e){if(!r){e&&c(!0);try{let e=await n.localAgentSchedules(t);if(r)return;a(e.schedules),u(null)}catch(e){r||u(o(e))}finally{!r&&e&&c(!1)}}}s(!0);let l=window.setInterval(()=>void s(!1),i);return()=>{r=!0,window.clearInterval(l)}},[e]);async function p(){if(e){c(!0);try{let t=await n.syncLocalAgentSchedules(e);a(t.schedules),u(null)}catch(e){u(o(e))}finally{c(!1)}}}async function m(t){if(e&&!d.has(t.id)){g(t.id,!0);try{await n.runLocalAgentSchedule(e,t.id);let r=await n.localAgentSchedules(e);a(r.schedules),u(null)}catch(e){u(o(e))}finally{g(t.id,!1)}}}async function h(t){if(e&&!d.has(t.id)){g(t.id,!0);try{await n.patchLocalAgentSchedule(e,t.id,{enabled:!t.enabled});let r=await n.localAgentSchedules(e);a(r.schedules),u(null)}catch(e){u(o(e))}finally{g(t.id,!1)}}}function g(e,t){f(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})}return{error:l,loading:s,pendingScheduleIds:d,refresh:p,run:m,schedules:t,toggle:h}}function o(e){return e instanceof Error?e.message:String(e)}export{a 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";var r=e(t(),1),i=n(),a=r.createContext(void 0),o=e=>{let t=r.useContext(a);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},s=({client:e,children:t})=>(r.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,i.jsx)(a.Provider,{value:e,children:t})),c={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},l=new class{#e=c;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function u(e){setTimeout(e,0)}var d=typeof window>`u`||`Deno`in globalThis;function f(){}function p(e,t){return typeof e==`function`?e(t):e}function m(e){return typeof e==`number`&&e>=0&&e!==1/0}function h(e,t){return Math.max(e+(t||0)-Date.now(),0)}function g(e,t){return typeof e==`function`?e(t):e}function _(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==y(o,t.options))return!1}else if(!x(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function v(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(b(t.options.mutationKey)!==b(a))return!1}else if(!x(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function y(e,t){return(t?.queryKeyHashFn||b)(e)}function b(e){return JSON.stringify(e,(e,t)=>T(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function x(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){for(let n=0;n<t.length;n++)if(!x(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!x(e[r],t[r]))return!1;return!0}return!1}var ee=Object.prototype.hasOwnProperty;function S(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=w(e)&&w(t);if(!r&&!(T(e)&&T(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:ee.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=S(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function C(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function w(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function T(e){if(!E(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!E(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function E(e){return Object.prototype.toString.call(e)===`[object Object]`}function te(e){return new Promise(t=>{l.setTimeout(t,e)})}function D(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:S(e,t)}function ne(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function re(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var O=Symbol();function k(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===O?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function A(e,t){return typeof e==`function`?e(...t):!!e}function ie(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r||(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0})),i)}),e}var ae=()=>d,j=()=>ae(),M=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},N=new class extends M{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},oe=u;function se(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=oe,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var P=se(),F=new class extends M{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function ce(e){return Math.min(1e3*2**e,3e4)}function I(e){return(e??`online`)!==`online`||F.isOnline()}var L=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function R(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(f);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new L(t);g(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},p=()=>N.isFocused()&&(e.networkMode===`always`||F.isOnline())&&e.canRun(),m=()=>I(e.networkMode)&&e.canRun(),h=e=>{c()||(r?.(),i=`resolved`,a(e))},g=e=>{c()||(r?.(),i=`rejected`,o(e))},_=()=>new Promise(t=>{r=e=>{(c()||p())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,c()||e.onContinue?.()}),v=()=>{if(c())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(h).catch(r=>{if(c())return;let i=e.retry??(j()?0:3),a=e.retryDelay??ce,o=typeof a==`function`?a(n,r):a,s=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);t||!s?g(r):(n++,e.onFail?.(n,r),te(o).then(()=>p()?void 0:_()).then(()=>{t?g(r):v()}))})};return{promise:s,status:()=>i,cancel:l,continue:()=>(r?.(),s),cancelRetry:u,continueRetry:d,canStart:m,start:()=>(m()?v():_().then(v),s)}}var z=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),m(this.gcTime)&&(this.#e=l.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(j()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(l.clearTimeout(this.#e),this.#e=void 0)}};function le(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{ie(e,()=>t.signal,()=>n=!0)},u=k(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?re:ne;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?V:B,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:B(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.fetchFn=t.options.persister?()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function B(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function V(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function ue(e,t){return t?B(e,t)!=null:!1}function H(e,t){return!t||!e.getPreviousPageParam?!1:V(e,t)!=null}var de=class extends z{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=G(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=G(this.options);e.data!==void 0&&(this.setState(W(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=D(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#c({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(f).catch(f):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>g(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===O||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>g(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!h(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){let t=this.observers.indexOf(e);t!==-1&&(this.observers.splice(t,1),this.observers.length||(this.#a&&(this.#s||this.state.fetchStatus===`paused`&&this.state.status===`pending`?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=k(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?le(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta});let o=this.#a=R({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof L&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await o.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof L){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.#a===o&&(this.#a=void 0),this.scheduleGc()}}#c(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...U(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...W(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),P.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function U(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:I(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function W(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function G(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var K=class extends M{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),q(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return J(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return J(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof g(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!C(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Y(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||g(this.options.enabled,this.#t)!==g(t.enabled,this.#t)||g(this.options.staleTime,this.#t)!==g(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||g(this.options.enabled,this.#t)!==g(t.enabled,this.#t)||i!==this.#f)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return C(this.getCurrentResult(),n)||(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),Reflect.get(e,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch().then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(f)),t}#h(e){return!j()&&g(this.options.enabled,this.#t)!==!1&&m(e)}#g(){this.#b();let e=g(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=h(this.#r.dataUpdatedAt,e)+1;this.#u=l.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#f=e,this.#f!==0&&this.#h(this.#f)&&(this.#d=l.setInterval(()=>{(this.options.refetchIntervalInBackground||N.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(l.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(l.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&q(e,t),o=i&&Y(e,n,t,r);(a||o)&&(l={...l,...U(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(m=`success`,d=D(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h){if(i&&d===a?.data&&t.select===this.#s)d=this.#c;else try{this.#s=t.select,d=t.select(d),d=D(i?.data,d,t),this.#c=d,this.#o=null}catch(e){this.#o=e}}else d===void 0&&(this.#o=null);this.#o&&(f=this.#o,d=this.#c,p=Date.now(),m=`error`,u=!1);let _=l.fetchStatus===`fetching`,v=m===`pending`,y=m===`error`,b=v&&_,x=d!==void 0;return{status:m,fetchStatus:l.fetchStatus,isPending:v,isSuccess:m===`success`,isError:y,isInitialLoading:b,isLoading:b,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:_,isRefetching:_&&!v,isLoadingError:y&&!x,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:y&&x,isStale:X(e,t),refetch:this.refetch,isEnabled:g(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),C(t,e))return;this.#r=t;let n=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size)return!0;let r=new Set(n??this.#p);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})();P.batch(()=>{n&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}};function fe(e,t){return g(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||g(t.retryOnMount,e)!==!1)}function q(e,t){return fe(e,t)||e.state.data!==void 0&&J(e,t,t.refetchOnMount)}function J(e,t,n){if(g(t.enabled,e)!==!1&&g(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&X(e,t)}return!1}function Y(e,t,n,r){return(e!==t||g(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&X(e,n)}function X(e,t){return g(t.enabled,e)!==!1&&e.isStaleByTime(g(t.staleTime,e))}var Z=r.createContext(!1),pe=()=>r.useContext(Z);Z.Provider;function me(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var he=r.createContext(me()),ge=()=>r.useContext(he),_e=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?A(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},Q=e=>{r.useEffect(()=>{e.clearReset()},[e])},ve=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||A(n,[e.error,r])),ye=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},be=(e,t)=>e?.suspense&&t.isPending,xe=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function $(e,t,n){let i=pe(),a=ge(),s=o(n),c=s.defaultQueryOptions(e),l=s.getQueryCache().get(c.queryHash),u=e.subscribed!==!1;c._optimisticResults=i?`isRestoring`:u?`optimistic`:void 0,ye(c),_e(c,a,l),Q(a);let[d]=r.useState(()=>new t(s,c)),p=d.getOptimisticResult(c),m=!i&&u;if(r.useSyncExternalStore(r.useCallback(e=>{let t=m?d.subscribe(P.batchCalls(e)):f;return d.updateResult(),t},[d,m]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),r.useEffect(()=>{d.setOptions(c)},[c,d]),be(c,p))throw xe(c,d,a);if(ve({result:p,errorResetBoundary:a,throwOnError:c.throwOnError,query:l,suspense:c.suspense}))throw p.error;return c.notifyOnChangeProps?p:d.trackResult(p)}function Se(e,t){return $(e,K,t)}export{O as C,A as S,o as T,_,ue as a,g as b,R as c,N as d,M as f,v as g,y as h,de as i,F as l,b as m,$ as n,H as o,p,K as r,z as s,Se as t,P as u,f as v,s as w,C as x,x as y};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{g as t,m as n}from"./index-D7igQSAg.js";var r=e(t(),1),i=n(),a=r.createContext(void 0),o=e=>{let t=r.useContext(a);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},s=({client:e,children:t})=>(r.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,i.jsx)(a.Provider,{value:e,children:t})),c={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},l=new class{#e=c;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function u(e){setTimeout(e,0)}var d=typeof window>`u`||`Deno`in globalThis;function f(){}function p(e,t){return typeof e==`function`?e(t):e}function m(e){return typeof e==`number`&&e>=0&&e!==1/0}function h(e,t){return Math.max(e+(t||0)-Date.now(),0)}function g(e,t){return typeof e==`function`?e(t):e}function _(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==y(o,t.options))return!1}else if(!x(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function v(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(b(t.options.mutationKey)!==b(a))return!1}else if(!x(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function y(e,t){return(t?.queryKeyHashFn||b)(e)}function b(e){return JSON.stringify(e,(e,t)=>T(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function x(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){for(let n=0;n<t.length;n++)if(!x(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!x(e[r],t[r]))return!1;return!0}return!1}var ee=Object.prototype.hasOwnProperty;function S(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=w(e)&&w(t);if(!r&&!(T(e)&&T(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:ee.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=S(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function C(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function w(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function T(e){if(!E(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!E(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function E(e){return Object.prototype.toString.call(e)===`[object Object]`}function te(e){return new Promise(t=>{l.setTimeout(t,e)})}function D(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:S(e,t)}function ne(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function re(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var O=Symbol();function k(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===O?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function A(e,t){return typeof e==`function`?e(...t):!!e}function ie(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r||(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0})),i)}),e}var ae=()=>d,j=()=>ae(),M=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},N=new class extends M{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},oe=u;function se(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=oe,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var P=se(),F=new class extends M{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function ce(e){return Math.min(1e3*2**e,3e4)}function I(e){return(e??`online`)!==`online`||F.isOnline()}var L=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function R(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(f);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new L(t);g(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},p=()=>N.isFocused()&&(e.networkMode===`always`||F.isOnline())&&e.canRun(),m=()=>I(e.networkMode)&&e.canRun(),h=e=>{c()||(r?.(),i=`resolved`,a(e))},g=e=>{c()||(r?.(),i=`rejected`,o(e))},_=()=>new Promise(t=>{r=e=>{(c()||p())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,c()||e.onContinue?.()}),v=()=>{if(c())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(h).catch(r=>{if(c())return;let i=e.retry??(j()?0:3),a=e.retryDelay??ce,o=typeof a==`function`?a(n,r):a,s=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);t||!s?g(r):(n++,e.onFail?.(n,r),te(o).then(()=>p()?void 0:_()).then(()=>{t?g(r):v()}))})};return{promise:s,status:()=>i,cancel:l,continue:()=>(r?.(),s),cancelRetry:u,continueRetry:d,canStart:m,start:()=>(m()?v():_().then(v),s)}}var z=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),m(this.gcTime)&&(this.#e=l.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(j()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(l.clearTimeout(this.#e),this.#e=void 0)}};function le(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{ie(e,()=>t.signal,()=>n=!0)},u=k(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?re:ne;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?V:B,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:B(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.fetchFn=t.options.persister?()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function B(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function V(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function ue(e,t){return t?B(e,t)!=null:!1}function H(e,t){return!t||!e.getPreviousPageParam?!1:V(e,t)!=null}var de=class extends z{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=G(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=G(this.options);e.data!==void 0&&(this.setState(W(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=D(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#c({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(f).catch(f):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>g(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===O||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>g(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!h(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){let t=this.observers.indexOf(e);t!==-1&&(this.observers.splice(t,1),this.observers.length||(this.#a&&(this.#s||this.state.fetchStatus===`paused`&&this.state.status===`pending`?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=k(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?le(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta});let o=this.#a=R({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof L&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await o.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof L){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.#a===o&&(this.#a=void 0),this.scheduleGc()}}#c(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...U(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...W(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),P.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function U(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:I(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function W(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function G(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var K=class extends M{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),q(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return J(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return J(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof g(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!C(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Y(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||g(this.options.enabled,this.#t)!==g(t.enabled,this.#t)||g(this.options.staleTime,this.#t)!==g(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||g(this.options.enabled,this.#t)!==g(t.enabled,this.#t)||i!==this.#f)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return C(this.getCurrentResult(),n)||(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),Reflect.get(e,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch().then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(f)),t}#h(e){return!j()&&g(this.options.enabled,this.#t)!==!1&&m(e)}#g(){this.#b();let e=g(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=h(this.#r.dataUpdatedAt,e)+1;this.#u=l.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#f=e,this.#f!==0&&this.#h(this.#f)&&(this.#d=l.setInterval(()=>{(this.options.refetchIntervalInBackground||N.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(l.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(l.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&q(e,t),o=i&&Y(e,n,t,r);(a||o)&&(l={...l,...U(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(m=`success`,d=D(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h){if(i&&d===a?.data&&t.select===this.#s)d=this.#c;else try{this.#s=t.select,d=t.select(d),d=D(i?.data,d,t),this.#c=d,this.#o=null}catch(e){this.#o=e}}else d===void 0&&(this.#o=null);this.#o&&(f=this.#o,d=this.#c,p=Date.now(),m=`error`,u=!1);let _=l.fetchStatus===`fetching`,v=m===`pending`,y=m===`error`,b=v&&_,x=d!==void 0;return{status:m,fetchStatus:l.fetchStatus,isPending:v,isSuccess:m===`success`,isError:y,isInitialLoading:b,isLoading:b,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:_,isRefetching:_&&!v,isLoadingError:y&&!x,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:y&&x,isStale:X(e,t),refetch:this.refetch,isEnabled:g(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),C(t,e))return;this.#r=t;let n=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size)return!0;let r=new Set(n??this.#p);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})();P.batch(()=>{n&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}};function fe(e,t){return g(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||g(t.retryOnMount,e)!==!1)}function q(e,t){return fe(e,t)||e.state.data!==void 0&&J(e,t,t.refetchOnMount)}function J(e,t,n){if(g(t.enabled,e)!==!1&&g(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&X(e,t)}return!1}function Y(e,t,n,r){return(e!==t||g(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&X(e,n)}function X(e,t){return g(t.enabled,e)!==!1&&e.isStaleByTime(g(t.staleTime,e))}var Z=r.createContext(!1),pe=()=>r.useContext(Z);Z.Provider;function me(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var he=r.createContext(me()),ge=()=>r.useContext(he),_e=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?A(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},Q=e=>{r.useEffect(()=>{e.clearReset()},[e])},ve=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||A(n,[e.error,r])),ye=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},be=(e,t)=>e?.suspense&&t.isPending,xe=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function $(e,t,n){let i=pe(),a=ge(),s=o(n),c=s.defaultQueryOptions(e),l=s.getQueryCache().get(c.queryHash),u=e.subscribed!==!1;c._optimisticResults=i?`isRestoring`:u?`optimistic`:void 0,ye(c),_e(c,a,l),Q(a);let[d]=r.useState(()=>new t(s,c)),p=d.getOptimisticResult(c),m=!i&&u;if(r.useSyncExternalStore(r.useCallback(e=>{let t=m?d.subscribe(P.batchCalls(e)):f;return d.updateResult(),t},[d,m]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),r.useEffect(()=>{d.setOptions(c)},[c,d]),be(c,p))throw xe(c,d,a);if(ve({result:p,errorResetBoundary:a,throwOnError:c.throwOnError,query:l,suspense:c.suspense}))throw p.error;return c.notifyOnChangeProps?p:d.trackResult(p)}function Se(e,t){return $(e,K,t)}export{O as C,A as S,o as T,_,ue as a,g as b,R as c,N as d,M as f,v as g,y as h,de as i,F as l,b as m,$ as n,H as o,p,K as r,z as s,Se as t,P as u,f as v,s as w,C as x,x as y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./createLucideIcon-
|
|
1
|
+
import{t as e}from"./createLucideIcon-CmkSm39S.js";var t=e(`bell`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]),n=e(`bell-off`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742`,key:`178tsu`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05`,key:`1hqiys`}]]),r=e(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),i=e(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]);export{t as i,r as n,n as r,i as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as e}from"./WorkspaceMonacoEditor-
|
|
1
|
+
import{s as e}from"./WorkspaceMonacoEditor-Rqq_sKW_.js";import"./toggleHighContrast-cl0cw2QK.js";function t(e,t){let n=globalThis.MonacoEnvironment;if(n?.createTrustedTypesPolicy)try{return n.createTrustedTypesPolicy(e,t)}catch(e){console.error(e);return}try{return globalThis.trustedTypes?.createPolicy(e,t)}catch(e){console.error(e);return}}var n=typeof self==`object`&&self.constructor&&self.constructor.name===`DedicatedWorkerGlobalScope`&&globalThis.workerttPolicy!==void 0?globalThis.workerttPolicy:t(`defaultWorkerFactory`,{createScriptURL:e=>e});function r(e){let t=e.label,r=globalThis.MonacoEnvironment;if(r){if(typeof r.getWorker==`function`)return r.getWorker(`workerMain.js`,t);if(typeof r.getWorkerUrl==`function`){let e=r.getWorkerUrl(`workerMain.js`,t);return new Worker(n?n.createScriptURL(e):e,{name:t,type:`module`})}}if(e.createWorker)return e.createWorker();throw Error(`You must define a function MonacoEnvironment.getWorkerUrl or MonacoEnvironment.getWorker`)}function i(t){let n=Promise.resolve(r({label:t.label??`monaco-editor-worker`,moduleId:t.moduleId,createWorker:t.createWorker})).then(e=>(e.postMessage(`ignore`),e.postMessage(t.createData),e));return e.createWebWorker({worker:n,host:t.host,keepIdleModels:t.keepIdleModels})}export{i as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./createLucideIcon-CmkSm39S.js";var t=e(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);export{t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e}from"./WorkspaceMonacoEditor-
|
|
1
|
+
import{c as e}from"./WorkspaceMonacoEditor-Rqq_sKW_.js";import"./toggleHighContrast-cl0cw2QK.js";var t={comments:{lineComment:`#`},brackets:[[`{`,`}`],[`[`,`]`],[`(`,`)`]],autoClosingPairs:[{open:`{`,close:`}`},{open:`[`,close:`]`},{open:`(`,close:`)`},{open:`"`,close:`"`},{open:`'`,close:`'`}],surroundingPairs:[{open:`{`,close:`}`},{open:`[`,close:`]`},{open:`(`,close:`)`},{open:`"`,close:`"`},{open:`'`,close:`'`}],folding:{offSide:!0},onEnterRules:[{beforeText:/:\s*$/,action:{indentAction:e.IndentAction.Indent}}]},n={tokenPostfix:`.yaml`,brackets:[{token:`delimiter.bracket`,open:`{`,close:`}`},{token:`delimiter.square`,open:`[`,close:`]`}],keywords:[`true`,`True`,`TRUE`,`false`,`False`,`FALSE`,`null`,`Null`,`Null`,`~`],numberInteger:/(?:0|[+-]?[0-9]+)/,numberFloat:/(?:0|[+-]?[0-9]+)(?:\.[0-9]+)?(?:e[-+][1-9][0-9]*)?/,numberOctal:/0o[0-7]+/,numberHex:/0x[0-9a-fA-F]+/,numberInfinity:/[+-]?\.(?:inf|Inf|INF)/,numberNaN:/\.(?:nan|Nan|NAN)/,numberDate:/\d{4}-\d\d-\d\d([Tt ]\d\d:\d\d:\d\d(\.\d+)?(( ?[+-]\d\d?(:\d\d)?)|Z)?)?/,escapes:/\\(?:[btnfr\\"']|[0-7][0-7]?|[0-3][0-7]{2})/,tokenizer:{root:[{include:`@whitespace`},{include:`@comment`},[/%[^ ]+.*$/,`meta.directive`],[/---/,`operators.directivesEnd`],[/\.{3}/,`operators.documentEnd`],[/[-?:](?= )/,`operators`],{include:`@anchor`},{include:`@tagHandle`},{include:`@flowCollections`},{include:`@blockStyle`},[/@numberInteger(?![ \t]*\S+)/,`number`],[/@numberFloat(?![ \t]*\S+)/,`number.float`],[/@numberOctal(?![ \t]*\S+)/,`number.octal`],[/@numberHex(?![ \t]*\S+)/,`number.hex`],[/@numberInfinity(?![ \t]*\S+)/,`number.infinity`],[/@numberNaN(?![ \t]*\S+)/,`number.nan`],[/@numberDate(?![ \t]*\S+)/,`number.date`],[/(".*?"|'.*?'|[^#'"]*?)([ \t]*)(:)( |$)/,[`type`,`white`,`operators`,`white`]],{include:`@flowScalars`},[/.+?(?=(\s+#|$))/,{cases:{"@keywords":`keyword`,"@default":`string`}}]],object:[{include:`@whitespace`},{include:`@comment`},[/\}/,`@brackets`,`@pop`],[/,/,`delimiter.comma`],[/:(?= )/,`operators`],[/(?:".*?"|'.*?'|[^,\{\[]+?)(?=: )/,`type`],{include:`@flowCollections`},{include:`@flowScalars`},{include:`@tagHandle`},{include:`@anchor`},{include:`@flowNumber`},[/[^\},]+/,{cases:{"@keywords":`keyword`,"@default":`string`}}]],array:[{include:`@whitespace`},{include:`@comment`},[/\]/,`@brackets`,`@pop`],[/,/,`delimiter.comma`],{include:`@flowCollections`},{include:`@flowScalars`},{include:`@tagHandle`},{include:`@anchor`},{include:`@flowNumber`},[/[^\],]+/,{cases:{"@keywords":`keyword`,"@default":`string`}}]],multiString:[[/^( +).+$/,`string`,`@multiStringContinued.$1`]],multiStringContinued:[[/^( *).+$/,{cases:{"$1==$S2":`string`,"@default":{token:`@rematch`,next:`@popall`}}}]],whitespace:[[/[ \t\r\n]+/,`white`]],comment:[[/#.*$/,`comment`]],flowCollections:[[/\[/,`@brackets`,`@array`],[/\{/,`@brackets`,`@object`]],flowScalars:[[/"([^"\\]|\\.)*$/,`string.invalid`],[/'([^'\\]|\\.)*$/,`string.invalid`],[/'[^']*'/,`string`],[/"/,`string`,`@doubleQuotedString`]],doubleQuotedString:[[/[^\\"]+/,`string`],[/@escapes/,`string.escape`],[/\\./,`string.escape.invalid`],[/"/,`string`,`@pop`]],blockStyle:[[/[>|][0-9]*[+-]?$/,`operators`,`@multiString`]],flowNumber:[[/@numberInteger(?=[ \t]*[,\]\}])/,`number`],[/@numberFloat(?=[ \t]*[,\]\}])/,`number.float`],[/@numberOctal(?=[ \t]*[,\]\}])/,`number.octal`],[/@numberHex(?=[ \t]*[,\]\}])/,`number.hex`],[/@numberInfinity(?=[ \t]*[,\]\}])/,`number.infinity`],[/@numberNaN(?=[ \t]*[,\]\}])/,`number.nan`],[/@numberDate(?=[ \t]*[,\]\}])/,`number.date`]],tagHandle:[[/\![^ ]*/,`tag`]],anchor:[[/[&*][^ ]+/,`namespace`]]}};export{t as conf,n as language};
|
package/dist/web/index.html
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />
|
|
10
10
|
<link rel="apple-touch-icon" href="/openpond-icon.png" />
|
|
11
11
|
<title>OpenPond App</title>
|
|
12
|
-
<script type="module" crossorigin src="/assets/index-
|
|
12
|
+
<script type="module" crossorigin src="/assets/index-D7igQSAg.js"></script>
|
|
13
13
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-Dd_uD5pT.js">
|
|
14
14
|
<link rel="stylesheet" crossorigin href="/assets/index-g7UqJhnX.css">
|
|
15
15
|
</head>
|
package/package.json
CHANGED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{b as ne}from"./chunk-CYQLXS2U.js";import{b as Te}from"./chunk-O6ZYDHEJ.js";import{f as G}from"./chunk-OKEC2EIE.js";import{m as R}from"./chunk-HIQPGYVH.js";import{l as be}from"./chunk-ZWW227M3.js";import{l as X}from"./chunk-G4E3WGLM.js";import{v as j}from"./chunk-ZY32SZ2P.js";import{I as ve,K as Ie}from"./chunk-SH7POUVX.js";import{c as P,d as k,e as _e,n as T}from"./chunk-RCT3O3HQ.js";import{A as e}from"./chunk-X2J2P5ZT.js";import{f as Ee}from"./chunk-UGOK7VTC.js";import{a as p}from"./chunk-FTQLQJQV.js";var c=Object.freeze({eventBytes:65536,actionBytes:16384,resultBytes:8192,stateBytes:8192,eventsPerAppend:32,eventsPerEpisode:256,episodeBytes:2097152,assetBytes:1048576,assetsPerEpisode:16,queueBytes:52428800,queueEvents:5e3,queueAgeSeconds:86400,capabilities:32,consultationRounds:3,consultationBytes:65536,manifestSeconds:300}),r=P,m=k,x=_e,oe=e.enum(["codex","claude_code","opencode","openpond"]),u=e.object({id:P,contentHash:k}).strict(),M=e.object({teamId:P,projectId:P}).strict();function E(n,t){return e.preprocess((o,i)=>{try{j(o,t)}catch{return i.addIssue({code:"custom",message:"Tool learning data exceeds its JSON boundary."}),e.NEVER}return o},n)}p(E,"boundedToolLearningSchema");function b(n){return e.string().max(n).refine(t=>new TextEncoder().encode(t).byteLength<=n,"Tool learning text exceeds its UTF-8 byte limit.")}p(b,"toolLearningText");var Me=E(e.record(e.string().min(1).max(120),e.union([b(2e3),e.number().finite(),e.boolean(),e.null()])).refine(n=>Object.keys(n).length<=32,"Use at most 32 explicit state fields."),c.stateBytes),C=e.object({application:e.string().trim().min(1).max(200),version:e.string().trim().min(1).max(200),state:Me,fingerprint:k}).strict(),W=e.object({id:P,contentHash:k,mediaType:e.enum(["text/plain","application/json","text/x-python","text/x-diff"]),sizeBytes:e.number().int().nonnegative().max(c.assetBytes),purpose:e.enum(["action","result","state","verification"])}).strict(),ye=e.object({policyRevision:e.number().int().positive(),policyHash:k,redactedFields:e.number().int().nonnegative().max(1e4),omittedFields:e.number().int().nonnegative().max(1e4),truncated:e.boolean()}).strict();function _(n,t=c.eventBytes){return j(n,t),T(n)}p(_,"toolLearningContentHash");var J=b(c.actionBytes),xe=e.string().min(1).max(1e3).refine(n=>!n.startsWith("/")&&!n.includes("\\")&&!/^[A-Za-z]:/u.test(n)&&n.split("/").every(t=>t!==""&&t!=="."&&t!==".."),"Use a workspace-relative artifact path."),H=E(e.discriminatedUnion("kind",[e.object({kind:e.literal("python"),code:J}).strict(),e.object({kind:e.literal("shell"),command:J,shell:e.string().min(1).max(120)}).strict(),e.object({kind:e.literal("tool_arguments"),arguments:e.record(e.string().min(1).max(200),e.json())}).strict(),e.object({kind:e.literal("edit"),patch:J,baseFiles:e.array(e.object({path:xe,contentHash:m.nullable()}).strict()).min(1).max(32)}).strict()]),c.actionBytes),gt=e.discriminatedUnion("kind",[e.object({kind:e.literal("replacement"),expectedActionHash:m,environmentFingerprint:m,action:H}).strict(),e.object({kind:e.literal("patch"),expectedActionHash:m,environmentFingerprint:m,files:e.array(e.object({path:xe,expectedContentHash:m,patch:J}).strict()).min(1).max(16)}).strict()]);var ze=e.object({intent:b(2e3),tool:e.object({name:e.string().min(1).max(200),version:e.string().max(200).nullable(),server:e.string().max(200).nullable()}).strict(),action:H,actionHash:m,environment:C,contextAssets:e.array(W).max(c.assetsPerEpisode),selection:e.discriminatedUnion("kind",[e.object({kind:e.literal("eligible_attempt")}).strict(),e.object({kind:e.literal("unchanged_control"),numerator:e.number().int().positive(),denominator:e.number().int().positive(),policyHash:m}).strict()])}).strict().superRefine((n,t)=>{_(n.action)!==n.actionHash&&t.addIssue({code:"custom",path:["actionHash"],message:"Action bytes differ from their hash."}),n.selection.kind==="unchanged_control"&&n.selection.numerator>n.selection.denominator&&t.addIssue({code:"custom",path:["selection"],message:"Sampling probability cannot exceed one."})}),Ve=e.enum(["validation_failure","execution_failure","process_failure","timeout","cancelled","infrastructure_failure","authorization_denied","outcome_failure","unknown_failure"]),ie={attempt:u,actionHash:m,execution:e.enum(["not_executed","executed","unknown"]),sideEffects:e.enum(["none","possible","observed","unknown"]),resultExcerpt:b(c.resultBytes),resultHash:m.nullable(),assets:e.array(W).max(c.assetsPerEpisode)},Ke=e.discriminatedUnion("outcome",[e.object({...ie,outcome:e.literal("succeeded"),exitCode:e.literal(0).nullable()}).strict(),e.object({...ie,outcome:e.literal("failed"),classification:Ve,errorCode:e.string().min(1).max(200),message:b(2e3),exitCode:e.number().int().min(-255).max(255).nullable()}).strict(),e.object({...ie,outcome:e.literal("incomplete"),reason:e.enum(["completion_not_observed","observer_restarted","transport_interrupted","coverage_gap"])}).strict()]).superRefine((n,t)=>{n.execution==="not_executed"&&n.sideEffects!=="none"&&t.addIssue({code:"custom",path:["sideEffects"],message:"An unexecuted action cannot claim tool effects."}),n.outcome==="succeeded"&&n.execution!=="executed"&&t.addIssue({code:"custom",path:["execution"],message:"Successful execution requires an observed execution."}),n.outcome==="failed"&&(n.classification==="validation_failure"&&n.execution!=="not_executed"&&t.addIssue({code:"custom",path:["execution"],message:"Pre-execution validation failure must be unexecuted."}),n.classification==="process_failure"&&(n.execution!=="executed"||n.exitCode===null||n.exitCode===0)&&t.addIssue({code:"custom",path:["exitCode"],message:"Process failure requires a nonzero observed exit."}))}),$e=e.object({failedAttempt:u,failedObservation:u,replacementAttempt:u,goalId:r,basis:e.enum(["explicit_relation","artifact_lineage","unverified"]),attributionEvidence:e.array(u).max(16)}).strict().superRefine((n,t)=>{n.failedAttempt.id===n.replacementAttempt.id&&t.addIssue({code:"custom",message:"A recovery must reference a different attempt."}),n.basis!=="unverified"&&n.attributionEvidence.length===0&&t.addIssue({code:"custom",path:["attributionEvidence"],message:"Recovery attribution needs retained evidence."})}),Xe=e.object({attempt:u,actionHash:m,outcome:e.enum(["passed","failed","unknown"]),verifierRelease:u.nullable(),verifierReceipt:u.nullable(),environmentFingerprint:m,resetStateHash:m.nullable(),outputArtifacts:e.array(W).max(c.assetsPerEpisode),reason:b(2e3)}).strict().superRefine((n,t)=>{n.outcome!=="unknown"&&(!n.verifierRelease||!n.verifierReceipt)&&t.addIssue({code:"custom",message:"A verification outcome requires an exact verifier and execution receipt."})}),z=e.object({schemaVersion:e.literal("openpond.toolEpisodeEvent.v1"),operationId:r,installationId:r,episodeId:r,eventId:r,sessionId:r,parentSessionId:r.nullable(),turnId:r.nullable(),callId:r,occurredAt:x,sequence:e.number().int().nonnegative(),adapterVersion:e.string().min(1).max(200),sanitization:ye,contentHash:m}).strict(),L=E(e.discriminatedUnion("eventKind",[z.extend({eventKind:e.literal("attempt"),payload:ze}).strict(),z.extend({eventKind:e.literal("observation"),payload:Ke}).strict(),z.extend({eventKind:e.literal("recovery_link"),payload:$e}).strict(),z.extend({eventKind:e.literal("verification"),payload:Xe}).strict(),z.extend({eventKind:e.literal("lineage"),payload:e.object({relation:e.enum(["fork","split","reopen"]),parentEpisode:u,parentSessionId:r,reason:b(1e3)}).strict()}).strict()]).superRefine((n,t)=>{let{contentHash:o,...i}=n;_(i)!==o&&t.addIssue({code:"custom",path:["contentHash"],message:"Episode event content hash mismatch."})}),c.eventBytes);function ae(n){let t=_(n);if(!n||typeof n!="object"||Array.isArray(n)||Object.hasOwn(n,"contentHash"))throw new Error("tool_episode_unsigned_envelope_required");return L.parse({...n,contentHash:t})}p(ae,"sealToolEpisodeEvent");var Le=E(e.object({schemaVersion:e.literal("openpond.toolEpisodeAppend.v1"),operationId:r,installationId:r,events:e.array(L).min(1).max(c.eventsPerAppend)}).strict().superRefine((n,t)=>{n.events.some(o=>o.installationId!==n.installationId)&&t.addIssue({code:"custom",path:["events"],message:"Append events must belong to the exact installation."}),new Set(n.events.map(o=>o.eventId)).size!==n.events.length&&t.addIssue({code:"custom",path:["events"],message:"Append event IDs must be unique."})}),c.eventBytes*c.eventsPerAppend),Se=e.object({schemaVersion:e.literal("openpond.toolEpisodeAppendReceipt.v1"),operationId:r,requestHash:m,installationId:r,teamId:r,projectId:r,receivedAt:x,events:e.array(e.object({eventId:r,contentHash:m,state:e.enum(["retained","already_retained","privacy_rejected"]),receiptId:r,reason:e.string().max(200).nullable()}).strict()).min(1).max(c.eventsPerAppend),learningEnrollment:e.literal(!1)}).strict();var F=e.object({revision:e.number().int().positive(),permittedTools:e.array(e.string().min(1).max(200)).min(1).max(100),workspaceRootHashes:e.array(m).min(1).max(32),permittedFields:e.array(e.enum(["action","intent","state","result_excerpt","artifact_reference"])).min(1).max(5),unchangedControls:e.object({numerator:e.number().int().nonnegative(),denominator:e.number().int().positive()}).strict(),maximumEventBytes:e.number().int().positive().max(c.eventBytes),maximumEpisodeBytes:e.number().int().positive().max(c.episodeBytes),maximumEpisodeEvents:e.number().int().positive().max(c.eventsPerEpisode),maximumQueueBytes:e.number().int().positive().max(c.queueBytes),maximumQueueEvents:e.number().int().positive().max(c.queueEvents),maximumQueueAgeSeconds:e.number().int().positive().max(c.queueAgeSeconds),rawRetentionDays:e.number().int().min(1).max(30),purposes:e.array(e.enum(["capture","consultation"])).min(1).max(2),modelUpdates:e.literal("requires_separate_review"),variantGeneration:e.literal("disabled")}).strict().superRefine((n,t)=>{n.unchangedControls.numerator>n.unchangedControls.denominator&&t.addIssue({code:"custom",path:["unchangedControls"],message:"Sampling probability cannot exceed one."});for(let o of["permittedTools","workspaceRootHashes","permittedFields","purposes"])new Set(n[o]).size!==n[o].length&&t.addIssue({code:"custom",path:[o],message:"Policy entries must be unique."});(n.maximumEpisodeBytes<n.maximumEventBytes||n.maximumQueueBytes<n.maximumEventBytes)&&t.addIssue({code:"custom",message:"Episode and queue capacities must fit one permitted event."})}),Ge=e.object({receipt:u.nullable(),start:e.enum(["observed","documented","unsupported","unqualified"]),resume:e.enum(["observed","documented","unsupported","unqualified"]),compaction:e.enum(["observed","documented","unsupported","unqualified"]),executionFailure:e.enum(["observed","documented","unsupported","unqualified"]),processFailure:e.enum(["observed","documented","unsupported","unqualified"]),validationFailure:e.enum(["observed","documented","unsupported","unqualified"]),nestedCalls:e.enum(["observed","documented","unsupported","unqualified"]),contextRefresh:e.enum(["session_start","start_resume","start_resume_compaction","revision_aware_turn","unqualified"]),gaps:e.array(e.string().min(1).max(500)).max(32)}).strict().superRefine((n,t)=>{Object.values(n).includes("observed")&&!n.receipt&&t.addIssue({code:"custom",path:["receipt"],message:"Observed coverage requires a qualification receipt."})}),Re=E(e.object({schemaVersion:e.literal("openpond.toolLearningRegistration.v1"),operationId:r,installationId:r,projectId:r,machineSourceId:r,client:oe,clientVersion:e.string().min(1).max(200),adapterRelease:u,collectionPolicy:F}).strict(),c.eventBytes),U=e.object({schemaVersion:e.literal("openpond.toolLearningInstallation.v1"),id:r,revision:e.number().int().positive(),scope:M,ownerUserId:r,machineSourceId:r,client:oe,clientVersion:e.string().min(1).max(200),adapterRelease:u,state:e.enum(["pending_client_trust","enabled","disabled","revoked"]),collectionPolicy:F,collectionPolicyHash:m,coverage:Ge,credential:e.object({id:r,expiresAt:x,revokedAt:x.nullable(),capabilities:e.array(e.enum(["episode_append","manifest_read","consultation_submit","consultation_read"])).min(1).max(4)}).strict().nullable(),createdAt:x,updatedAt:x}).strict(),we=e.object({operationId:r,expectedRevision:e.number().int().positive(),state:e.enum(["enabled","disabled","revoked"])}).strict(),xt=e.object({schemaVersion:e.literal("openpond.toolEpisodeOrigin.v1"),installationId:r,projectId:r,ownerUserId:r,episode:u,event:u,appendReceipt:u,purpose:e.literal("private_dataset_evidence"),trainingConsent:e.literal("not_granted")}).strict();import{DatabaseSync as Ye}from"node:sqlite";import{chmodSync as Ce,closeSync as Qe,existsSync as Oe,lstatSync as ce,mkdirSync as Ze,openSync as et}from"node:fs";import{join as je}from"node:path";var Y=e.object({id:r,application:e.string().min(1).max(200),versions:e.array(e.string().min(1).max(200)).min(1).max(32),tools:e.array(e.string().min(1).max(200)).min(1).max(32),mode:e.literal("recovery"),routingInstruction:b(2e3),qualification:e.discriminatedUnion("kind",[e.object({kind:e.literal("integration"),receipt:u}).strict(),e.object({kind:e.literal("learned"),receipt:u,trainingRun:u,adapter:u,evaluation:u,activation:u}).strict()])}).strict(),We=e.object({schemaVersion:e.literal("openpond.toolLearningManifest.v1"),installationId:r,scope:M,revision:e.number().int().positive(),contentHash:m,issuedAt:x,expiresAt:x,modelRelease:u,responseSchema:e.literal("openpond.toolLearningDecision.v1"),capabilities:e.array(Y).max(c.capabilities)}).strict().superRefine((n,t)=>{let{contentHash:o,...i}=n;_(i)!==o&&t.addIssue({code:"custom",path:["contentHash"],message:"Manifest content hash mismatch."});let a=Date.parse(n.expiresAt)-Date.parse(n.issuedAt);(a<=0||a>c.manifestSeconds*1e3)&&t.addIssue({code:"custom",path:["expiresAt"],message:"Manifest expiry exceeds the supported lifetime."}),new Set(n.capabilities.map(s=>s.id)).size!==n.capabilities.length&&t.addIssue({code:"custom",path:["capabilities"],message:"Capability IDs must be unique."})}),Ae=E(We,c.consultationBytes),w=E(e.object({schemaVersion:e.literal("openpond.toolLearningConsultation.v1"),operationId:r,installationId:r,scope:M,sessionId:r,callId:r,capabilityId:r,manifestHash:m,modelRelease:u,mode:e.literal("recovery"),intent:b(2e3),action:H,actionHash:m,environment:C,contextHash:m,failure:e.object({message:b(c.resultBytes),observation:u}).strict(),round:e.number().int().min(1).max(c.consultationRounds)}).strict().superRefine((n,t)=>{_(n.action)!==n.actionHash&&t.addIssue({code:"custom",path:["actionHash"],message:"Consultation action hash mismatch."}),_({intent:n.intent,environment:n.environment,failure:n.failure})!==n.contextHash&&t.addIssue({code:"custom",path:["contextHash"],message:"Consultation context hash mismatch."})}),c.consultationBytes),re=e.discriminatedUnion("decision",[e.object({decision:e.literal("proceed")}).strict(),e.object({decision:e.literal("revise"),issues:e.array(e.object({category:e.string().min(1).max(120),feedback:b(2e3)}).strict()).min(1).max(8)}).strict(),e.object({decision:e.literal("needs_context"),missing:e.array(e.object({field:e.string().min(1).max(120),reason:b(500)}).strict()).min(1).max(8)}).strict()]),Ne={operationId:r,installationId:r,capabilityId:r,manifestHash:m,modelRelease:u,actionHash:m,contextHash:m},Je=E(e.discriminatedUnion("state",[e.object({schemaVersion:e.literal("openpond.toolLearningDecision.v1"),...Ne,state:e.literal("completed"),decision:re,usageReceipt:u,completedAt:x}).strict(),e.object({schemaVersion:e.literal("openpond.toolLearningDecision.v1"),...Ne,state:e.literal("unavailable"),reason:e.enum(["disabled","revoked","expired_manifest","unsupported_scope","budget_exhausted","timeout","invalid_output","cancelled","dispatch_uncertain"]),usageReceipt:u.nullable()}).strict()]),c.consultationBytes);function se(n,t){let o=w.parse(n),i=Je.parse(t);for(let a of["operationId","installationId","capabilityId","manifestHash","actionHash","contextHash"])if(o[a]!==i[a])throw new Error(`tool_learning_consultation_${a}_mismatch`);if(o.modelRelease.id!==i.modelRelease.id||o.modelRelease.contentHash!==i.modelRelease.contentHash)throw new Error("tool_learning_consultation_model_mismatch");return i}p(se,"assertToolLearningConsultationResponse");function le(n,t){let o=L.parse(n),i=F.parse(t);if(!i.purposes.includes("capture"))throw new Error("tool_learning_capture_not_enabled");if(o.sanitization.policyRevision!==i.revision||o.sanitization.policyHash!==_(i))throw new Error("tool_learning_capture_policy_changed");if(new TextEncoder().encode(JSON.stringify(o)).byteLength>i.maximumEventBytes)throw new Error("tool_learning_event_policy_limit");let a=p(s=>i.permittedFields.includes(s),"permits");if(o.eventKind==="attempt"){if(!i.permittedTools.includes(o.payload.tool.name))throw new Error("tool_learning_tool_outside_collection_policy");if(!a("action")||!a("intent")&&o.payload.intent!==""||!a("state")&&Object.keys(o.payload.environment.state).length>0||!a("artifact_reference")&&o.payload.contextAssets.length>0)throw new Error("tool_learning_attempt_field_outside_collection_policy")}if(o.eventKind==="observation"&&(!a("result_excerpt")&&(o.payload.resultExcerpt!==""||o.payload.outcome==="failed"&&o.payload.message!=="")||!a("artifact_reference")&&o.payload.assets.length>0))throw new Error("tool_learning_result_field_outside_collection_policy");if(o.eventKind==="verification"&&(!a("result_excerpt")&&o.payload.reason!==""||!a("artifact_reference")&&o.payload.outputArtifacts.length>0))throw new Error("tool_learning_verification_field_outside_collection_policy");if(o.eventKind==="lineage"&&!a("intent")&&o.payload.reason!=="")throw new Error("tool_learning_lineage_field_outside_collection_policy")}p(le,"assertToolEpisodeCapturePolicy");var de=e.object({schemaVersion:e.literal("openpond.localToolLearningInstallation.v1"),id:r,teamId:r,projectId:r,client:e.enum(["claude_code","openpond"]),workspaceRoot:e.string().min(1).max(4e3),enabled:e.boolean(),policy:F,createdAt:e.iso.datetime({offset:!0})}).strict(),V=class{static{p(this,"ToolLearningLocalStore")}db;constructor(n){let t=je(n,"tool-learning");if(Oe(t)&&ce(t).isSymbolicLink())throw new Error("tool_learning_directory_symlink_forbidden");Ze(t,{recursive:!0,mode:448}),Ce(t,448);let o=je(t,"queue.sqlite");if(Oe(o)){if(!ce(o).isFile()||ce(o).isSymbolicLink())throw new Error("tool_learning_queue_file_invalid")}else Qe(et(o,"wx",384));Ce(o,384),this.db=new Ye(o),this.db.exec("PRAGMA busy_timeout = 3000; PRAGMA journal_mode = WAL; PRAGMA synchronous = FULL;"),this.db.exec(`
|
|
3
|
-
CREATE TABLE IF NOT EXISTS installations (id TEXT PRIMARY KEY, payload TEXT NOT NULL);
|
|
4
|
-
CREATE TABLE IF NOT EXISTS events (
|
|
5
|
-
id TEXT PRIMARY KEY, installation_id TEXT NOT NULL, episode_id TEXT NOT NULL,
|
|
6
|
-
policy_hash TEXT NOT NULL, content_hash TEXT NOT NULL,
|
|
7
|
-
payload TEXT NOT NULL, size_bytes INTEGER NOT NULL, received_at INTEGER NOT NULL
|
|
8
|
-
);
|
|
9
|
-
CREATE INDEX IF NOT EXISTS events_installation ON events(installation_id, received_at, id);
|
|
10
|
-
CREATE INDEX IF NOT EXISTS events_episode ON events(installation_id, episode_id);
|
|
11
|
-
CREATE INDEX IF NOT EXISTS events_policy ON events(installation_id, policy_hash, received_at, id);
|
|
12
|
-
CREATE TABLE IF NOT EXISTS counters (
|
|
13
|
-
installation_id TEXT PRIMARY KEY, dropped INTEGER NOT NULL DEFAULT 0, expired INTEGER NOT NULL DEFAULT 0
|
|
14
|
-
);
|
|
15
|
-
CREATE TABLE IF NOT EXISTS capture_boundaries (
|
|
16
|
-
installation_id TEXT NOT NULL, session_id TEXT NOT NULL, call_id TEXT NOT NULL,
|
|
17
|
-
phase TEXT NOT NULL, payload TEXT NOT NULL, size_bytes INTEGER NOT NULL,
|
|
18
|
-
expires_at INTEGER NOT NULL,
|
|
19
|
-
PRIMARY KEY(installation_id, session_id, call_id, phase)
|
|
20
|
-
);
|
|
21
|
-
CREATE INDEX IF NOT EXISTS capture_boundaries_expiry ON capture_boundaries(expires_at);
|
|
22
|
-
CREATE TABLE IF NOT EXISTS client_observations (
|
|
23
|
-
installation_id TEXT NOT NULL, event_name TEXT NOT NULL,
|
|
24
|
-
observed_at TEXT NOT NULL, count INTEGER NOT NULL,
|
|
25
|
-
PRIMARY KEY(installation_id, event_name)
|
|
26
|
-
);
|
|
27
|
-
CREATE TABLE IF NOT EXISTS consultation_requests (
|
|
28
|
-
installation_id TEXT NOT NULL, operation_id TEXT NOT NULL,
|
|
29
|
-
payload TEXT NOT NULL, size_bytes INTEGER NOT NULL, expires_at INTEGER NOT NULL,
|
|
30
|
-
PRIMARY KEY(installation_id, operation_id)
|
|
31
|
-
);
|
|
32
|
-
CREATE INDEX IF NOT EXISTS consultation_requests_expiry ON consultation_requests(expires_at);
|
|
33
|
-
`),this.expireCaptureBoundaries(),this.db.prepare("DELETE FROM consultation_requests WHERE expires_at <= ?").run(Date.now())}close(){this.db.close()}captureBoundary(n,t,o,i){this.expireCaptureBoundaries();let a=this.db.prepare("SELECT payload FROM capture_boundaries WHERE installation_id = ? AND session_id = ? AND call_id = ? AND phase = ?").get(n,t,o,i);if(!a)return null;let s=L.parse(JSON.parse(String(a.payload))),d=this.installation(n);return!d?.enabled||s.sanitization.policyHash!==_(d.policy)?null:s}retainCaptureBoundary(n,t=Date.now()){let o=L.parse(n);if(o.eventKind!=="attempt"&&o.eventKind!=="observation")throw new Error("tool_learning_capture_boundary_kind");return this.transaction(()=>{this.expireCaptureBoundaries(t);let i=this.installation(o.installationId);if(!i?.enabled)return null;le(o,i.policy);let a=this.captureBoundary(o.installationId,o.sessionId,o.callId,o.eventKind);if(a)return a;let s=JSON.stringify(o),d=Buffer.byteLength(s),l=this.retainedUsage(),v=this.retainedUsage(i.id);return Number(l.count)>=c.queueEvents||Number(v.count)>=i.policy.maximumQueueEvents||Number(v.bytes)+d>i.policy.maximumQueueBytes||Number(l.bytes)+d>c.queueBytes?(this.recordDropped(o.installationId),null):(this.db.prepare("INSERT INTO capture_boundaries VALUES (?, ?, ?, ?, ?, ?, ?)").run(o.installationId,o.sessionId,o.callId,o.eventKind,s,d,t+i.policy.maximumQueueAgeSeconds*1e3),o)})}recordDropped(n){this.db.prepare("INSERT INTO counters(installation_id, dropped) VALUES (?, 1) ON CONFLICT(installation_id) DO UPDATE SET dropped = dropped + 1").run(n)}recordClientObservation(n,t){if(!["start","resume","compact","turn_context","pre_tool","post_tool","failure"].includes(t))throw new Error("tool_learning_unknown_client_observation");this.installation(n)?.enabled&&this.db.prepare("INSERT INTO client_observations VALUES (?, ?, ?, 1) ON CONFLICT(installation_id, event_name) DO UPDATE SET observed_at = excluded.observed_at, count = count + 1").run(n,t,new Date().toISOString())}hasRecoveryCandidateContext(n,t,o=Date.now()){return this.db.prepare("SELECT payload FROM capture_boundaries WHERE installation_id = ? AND session_id = ? AND phase = 'observation' AND expires_at > ? ORDER BY json_extract(payload, '$.occurredAt') DESC LIMIT 33").all(n,t,o).slice(0,32).some(a=>{let s=L.parse(JSON.parse(a.payload));return s.eventKind==="observation"&&s.payload.outcome==="failed"&&Date.parse(s.occurredAt)>=o-6e5})}clientObservations(n){return this.db.prepare("SELECT event_name AS event, observed_at AS observedAt, count FROM client_observations WHERE installation_id = ? ORDER BY event_name").all(n)}consultationRequest(n,t){this.db.prepare("DELETE FROM consultation_requests WHERE expires_at <= ?").run(Date.now());let o=this.db.prepare("SELECT payload FROM consultation_requests WHERE installation_id = ? AND operation_id = ?").get(n,t);return o?w.parse(JSON.parse(String(o.payload))):null}consultationForCall(n,t,o){this.db.prepare("DELETE FROM consultation_requests WHERE expires_at <= ?").run(Date.now());let i=this.db.prepare("SELECT payload FROM consultation_requests WHERE installation_id = ? AND json_extract(payload, '$.sessionId') = ? AND json_extract(payload, '$.callId') = ? ORDER BY expires_at DESC LIMIT 1").get(n,t,o);return i?w.parse(JSON.parse(String(i.payload))):null}retainConsultationRequest(n){let t=w.parse(n);return this.transaction(()=>{let o=this.consultationRequest(t.installationId,t.operationId);if(o){if(_(o)!==_(t))throw new Error("tool_learning_consultation_identity_conflict");return o}let i=this.installation(t.installationId);if(!i?.enabled||i.teamId!==t.scope.teamId||i.projectId!==t.scope.projectId||!i.policy.purposes.includes("consultation"))throw new Error("tool_learning_consultation_disabled");let a=JSON.stringify(t),s=Buffer.byteLength(a),d=this.retainedUsage(),l=this.retainedUsage(i.id);if(Number(d.count)>=c.queueEvents||Number(l.count)>=i.policy.maximumQueueEvents||Number(l.bytes)+s>i.policy.maximumQueueBytes||Number(d.bytes)+s>c.queueBytes)throw new Error("tool_learning_consultation_capacity_reached");return this.db.prepare("INSERT INTO consultation_requests VALUES (?, ?, ?, ?, ?)").run(t.installationId,t.operationId,a,s,Date.now()+i.policy.maximumQueueAgeSeconds*1e3),t})}retainedUsage(n){let o=`SELECT COUNT(*) AS count, COALESCE(SUM(size_bytes), 0) AS bytes FROM (SELECT installation_id, size_bytes FROM events UNION ALL SELECT installation_id, size_bytes FROM capture_boundaries UNION ALL SELECT installation_id, size_bytes FROM consultation_requests)${n===void 0?"":" WHERE installation_id = ?"}`;return n===void 0?this.db.prepare(o).get():this.db.prepare(o).get(n)}expireCaptureBoundaries(n=Date.now()){this.db.prepare("DELETE FROM capture_boundaries WHERE expires_at <= ?").run(n)}installation(n){let t=this.db.prepare("SELECT payload FROM installations WHERE id = ?").get(n);return t?de.parse(JSON.parse(String(t.payload))):null}installations(){return this.db.prepare("SELECT payload FROM installations ORDER BY id").all().map(n=>de.parse(JSON.parse(String(n.payload))))}configure(n){let t=de.parse(n);return this.transaction(()=>{let o=this.installation(t.id);if(o&&["teamId","projectId","client","workspaceRoot"].some(i=>o[i]!==t[i]))throw new Error("tool_learning_installation_scope_immutable");if(o&&(t.policy.revision<o.policy.revision||t.policy.revision===o.policy.revision&&_(t.policy)!==_(o.policy)))throw new Error("tool_learning_capture_policy_revision_conflict");this.db.prepare("INSERT INTO installations VALUES (?, ?) ON CONFLICT(id) DO UPDATE SET payload = excluded.payload").run(t.id,JSON.stringify(t))}),t}append(n,t=Date.now()){let o=L.parse(n),i=JSON.stringify(o),a=Buffer.byteLength(i);return this.transaction(()=>{let s=this.installation(o.installationId);if(!s?.enabled)return"disabled";let d=s.policy;if(!d.purposes.includes("capture"))return"disabled";le(o,d);let l=this.db.prepare("SELECT content_hash, installation_id FROM events WHERE id = ?").get(o.eventId);if(l){if(l.content_hash!==o.contentHash||l.installation_id!==o.installationId)throw new Error("tool_learning_event_identity_conflict");return"already_retained"}this.db.prepare("INSERT INTO counters(installation_id) VALUES (?) ON CONFLICT DO NOTHING").run(s.id);let v=t-d.maximumQueueAgeSeconds*1e3,g=this.db.prepare("DELETE FROM events WHERE installation_id = ? AND received_at < ?").run(s.id,v).changes;if(this.db.prepare("UPDATE counters SET expired = expired + ? WHERE installation_id = ?").run(g,s.id),Date.parse(o.occurredAt)<v||Date.parse(o.occurredAt)>t+3e5)return this.db.prepare("UPDATE counters SET expired = expired + 1 WHERE installation_id = ?").run(s.id),"expired";let h=this.retainedUsage(),S=this.retainedUsage(s.id),I=this.db.prepare("SELECT COUNT(*) AS count, COALESCE(SUM(size_bytes), 0) AS bytes FROM events WHERE installation_id = ? AND episode_id = ?").get(s.id,o.episodeId);return Number(h.count)>=c.queueEvents||Number(h.bytes)+a>c.queueBytes||Number(S.count)>=d.maximumQueueEvents||Number(S.bytes)+a>d.maximumQueueBytes||Number(I.count)>=d.maximumEpisodeEvents||Number(I.bytes)+a>d.maximumEpisodeBytes?(this.db.prepare("UPDATE counters SET dropped = dropped + 1 WHERE installation_id = ?").run(s.id),"queue_full"):(this.db.prepare("INSERT INTO events VALUES (?, ?, ?, ?, ?, ?, ?, ?)").run(o.eventId,s.id,o.episodeId,o.sanitization.policyHash,o.contentHash,i,a,t),"retained")})}pending(n,t=c.eventsPerAppend){if(!Number.isInteger(t)||t<1||t>c.eventsPerAppend)throw new Error("tool_learning_queue_page_limit");this.expire(n);let o=this.installation(n);return!o?.enabled||!o.policy.purposes.includes("capture")?[]:this.db.prepare("SELECT payload FROM events WHERE installation_id = ? AND policy_hash = ? ORDER BY received_at, id LIMIT ?").all(n,_(o.policy),t).map(i=>L.parse(JSON.parse(String(i.payload))))}acknowledge(n,t){if(t.length>c.eventsPerAppend)throw new Error("tool_learning_ack_limit");this.transaction(()=>{for(let o of t){let i=this.db.prepare("DELETE FROM events WHERE installation_id = ? AND id = ? AND content_hash = ?").run(n,o.eventId,o.contentHash);o.state==="privacy_rejected"&&Number(i.changes)>0&&this.db.prepare("INSERT INTO counters(installation_id, dropped) VALUES (?, ?) ON CONFLICT(installation_id) DO UPDATE SET dropped = dropped + excluded.dropped").run(n,i.changes)}})}status(n){this.expire(n);let t=this.installation(n),o=this.db.prepare("SELECT COUNT(*) AS events, COALESCE(SUM(size_bytes), 0) AS bytes FROM events WHERE installation_id = ?").get(n),i=this.db.prepare("SELECT dropped, expired FROM counters WHERE installation_id = ?").get(n),a=t?.enabled&&t.policy.purposes.includes("capture")?Number(this.db.prepare("SELECT COUNT(*) AS count FROM events WHERE installation_id = ? AND policy_hash = ?").get(n,_(t.policy)).count):0;return{pendingEvents:Number(o.events),pendingBytes:Number(o.bytes),droppedEvents:Number(i?.dropped??0),expiredEvents:Number(i?.expired??0),blockedByPolicyEvents:Number(o.events)-a}}transaction(n){this.db.exec("BEGIN IMMEDIATE");try{let t=n();return this.db.exec("COMMIT"),t}catch(t){throw this.db.exec("ROLLBACK"),t}}expire(n){let t=this.installation(n);t&&this.transaction(()=>{let o=this.db.prepare("DELETE FROM events WHERE installation_id = ? AND received_at < ?").run(n,Date.now()-t.policy.maximumQueueAgeSeconds*1e3).changes;this.db.prepare("INSERT INTO counters(installation_id, expired) VALUES (?, ?) ON CONFLICT(installation_id) DO UPDATE SET expired = expired + excluded.expired").run(n,o)})}};var pe=E(e.object({registration:Re,credential:e.object({apiKey:ne,expiresAt:e.iso.datetime()}).strict()}).strict(),c.eventBytes),tt=E(e.object({operationId:r,expectedRevision:e.number().int().positive(),episodeId:r,failure:u,recovery:u,taskDefinition:X,familyKey:r,split:e.literal("train"),proposedTarget:re,saveToPrivateDataset:e.literal(!0),targetApproval:e.literal("pending_owner_review")}).strict(),c.eventBytes),nt=E(e.object({installationId:r,projectId:r,operationId:r,source:X,evidence:X,originHash:e.string().regex(/^[a-f0-9]{64}$/),requestHash:e.string().regex(/^[a-f0-9]{64}$/),projectedAt:e.iso.datetime(),targetApproval:e.literal("pending_owner_review"),learningEnrollment:e.literal(!1)}).strict(),c.eventBytes),He=E(e.object({operationId:r,expectedRevision:e.number().int().nonnegative(),state:e.enum(["enabled","disabled"]),modelId:r,qualification:e.discriminatedUnion("kind",[e.object({kind:e.literal("integration"),evaluationRunId:r}).strict(),e.object({kind:e.literal("learned"),evaluationRunId:r,baselineRunId:r,trainingRunId:r}).strict()]),capabilities:e.array(Y.omit({qualification:!0})).min(1).max(16),limits:e.object({maxOutputTokens:e.number().int().min(128).max(2048),maximumCallUsd:e.number().positive().max(1),maximumDayUsd:e.number().positive().max(10),maximumSessionCalls:e.number().int().min(1).max(20),maximumDayCalls:e.number().int().min(1).max(200)}).strict()}).strict(),c.eventBytes),ot=E(e.object({installationId:r,scope:e.object({teamId:r,projectId:r}).strict(),revision:e.number().int().positive(),operationId:r,requestHash:e.string().regex(/^[a-f0-9]{64}$/),configuration:He,modelRelease:u,policySystemPrompt:e.string().min(1).max(16384),capabilities:e.array(Y).max(16),updatedAt:e.iso.datetime()}).strict(),c.eventBytes);var D=class extends Error{static{p(this,"OpenPondToolLearningError")}constructor(n,t){super(`Tool learning request failed (${n}): ${t}`),this.status=n,this.code=t,this.name="OpenPondToolLearningError"}status;code},Ue=class{static{p(this,"OpenPondToolLearningClient")}#o;#e;constructor(n){this.#e={...n};let t=new URL(n.baseUrl);if(!["https:","http:"].includes(t.protocol)||t.username||t.password||t.search||t.hash||!n.apiKey.trim()||!n.teamId.trim()||!n.projectId.trim())throw new Error("tool_learning_client_scope_required");this.#o=t.toString().replace(/\/+$/,"")}async register(n,t){let o=pe.parse(n);if(o.registration.projectId!==this.#e.projectId)throw new Error("tool_learning_project_mismatch");let i=e.object({installation:U,apiKey:ne}).strict().parse(await this.#t("installations","POST",o,t));if(this.#n(i.installation,o.registration.installationId),i.apiKey!==o.credential.apiKey)throw new Error("tool_learning_credential_mismatch");let a=i.installation;if(a.client!==o.registration.client||a.clientVersion!==o.registration.clientVersion||a.machineSourceId!==o.registration.machineSourceId||R(a.adapterRelease)!==R(o.registration.adapterRelease)||R(a.collectionPolicy)!==R(o.registration.collectionPolicy)||a.collectionPolicyHash!==R(o.registration.collectionPolicy)||a.credential?.expiresAt!==o.credential.expiresAt)throw new Error("tool_learning_registration_receipt_mismatch");return i}async installation(n,t){let o=U.parse(await this.#t(`installations/${encodeURIComponent(n)}`,"GET",void 0,t));return this.#n(o,n),o}async installations(n,t){let o=e.object({items:e.array(U).max(30),nextCursor:r.nullable()}).strict().parse(await this.#t(`installations?projectId=${encodeURIComponent(this.#e.projectId)}${n?`&after=${encodeURIComponent(n)}`:""}`,"GET",void 0,t));for(let i of o.items)this.#n(i,i.id);if(o.nextCursor!==null&&o.nextCursor!==o.items.at(-1)?.id)throw new Error("tool_learning_installation_cursor_mismatch");return o}async episodes(n,t,o){let i=e.object({installationId:r,scope:e.object({teamId:r,projectId:r}).strict(),items:e.array(e.object({episodeId:r,eventCount:e.number().int().positive(),lastReceivedAt:e.iso.datetime()}).strict()).max(30),nextCursor:r.nullable(),learningEnrollment:e.literal(!1)}).strict().parse(await this.#t(`installations/${encodeURIComponent(n)}/episodes${t?`?after=${encodeURIComponent(t)}`:""}`,"GET",void 0,o));if(i.installationId!==n||i.scope.teamId!==this.#e.teamId||i.scope.projectId!==this.#e.projectId||i.nextCursor!==null&&i.nextCursor!==i.items.at(-1)?.episodeId)throw new Error("tool_learning_episode_page_mismatch");return i}async episode(n,t,o){let i=e.object({installationId:r,episodeId:r,scope:e.object({teamId:r,projectId:r}).strict(),events:e.array(L).max(c.eventsPerEpisode),state:e.enum(["incomplete","awaiting_owner_review"]),verificationAuthority:e.literal("not_granted"),learningEnrollment:e.literal(!1)}).strict().parse(await this.#t(`installations/${encodeURIComponent(n)}/episodes/${encodeURIComponent(t)}`,"GET",void 0,o));if(i.installationId!==n||i.episodeId!==t||i.scope.teamId!==this.#e.teamId||i.scope.projectId!==this.#e.projectId||i.events.some(a=>a.installationId!==n||a.episodeId!==t))throw new Error("tool_learning_episode_scope_mismatch");return i}async purge(n,t,o){let i=e.object({operationId:r,expectedRevision:e.number().int().positive()}).strict().parse(t),a=e.object({installationId:r,operationId:r,purgedEvents:e.number().int().nonnegative(),learningEnrollment:e.literal(!1)}).strict().parse(await this.#t(`installations/${encodeURIComponent(n)}/purge`,"POST",i,o));if(a.installationId!==n||a.operationId!==i.operationId)throw new Error("tool_learning_purge_scope_mismatch");return a}async project(n,t,o){let i=tt.parse(t),a=nt.parse(await this.#t(`installations/${encodeURIComponent(n)}/project`,"POST",i,o));if(a.installationId!==n||a.projectId!==this.#e.projectId||a.operationId!==i.operationId||a.requestHash!==R(i))throw new Error("tool_learning_projection_scope_mismatch");return a}async setState(n,t,o){let i=we.parse(t),a=U.parse(await this.#t(`installations/${encodeURIComponent(n)}`,"PATCH",i,o));if(this.#n(a,n),a.state!==i.state)throw new Error("tool_learning_state_mismatch");return a}async append(n,t){let o=Le.parse(n),i=Se.parse(await this.#t("episodes","POST",o,t));if(i.operationId!==o.operationId||i.installationId!==o.installationId||i.teamId!==this.#e.teamId||i.projectId!==this.#e.projectId||i.requestHash!==R(o)||i.events.length!==o.events.length||new Set(i.events.map(a=>a.eventId)).size!==i.events.length)throw new Error("tool_learning_append_receipt_mismatch");for(let a of i.events){let s=o.events.find(d=>d.eventId===a.eventId);if(!s||s.contentHash!==a.contentHash)throw new Error("tool_learning_append_event_mismatch")}return i}async routing(n,t){return this.#i(n,await this.#t(`installations/${encodeURIComponent(n)}/routing`,"GET",void 0,t))}async configureRouting(n,t,o){let i=He.parse(t),a=this.#i(n,await this.#t(`installations/${encodeURIComponent(n)}/routing`,"POST",i,o));if(a.operationId!==i.operationId||a.requestHash!==R(i)||R(a.configuration)!==R(i))throw new Error("tool_learning_routing_receipt_mismatch");return a}#i(n,t){let o=ot.parse(t);if(o.installationId!==n||o.scope.teamId!==this.#e.teamId||o.scope.projectId!==this.#e.projectId)throw new Error("tool_learning_routing_scope_mismatch");return o}async manifest(n,t){let o=Ae.parse(await this.#t(`installations/${encodeURIComponent(n)}/manifest`,"GET",void 0,t));if(o.installationId!==n||o.scope.teamId!==this.#e.teamId||o.scope.projectId!==this.#e.projectId)throw new Error("tool_learning_manifest_scope_mismatch");if(Date.parse(o.expiresAt)<=Date.now()||Date.parse(o.issuedAt)>Date.now()+3e4)throw new Error("tool_learning_manifest_expired");return o}async consult(n,t){let o=w.parse(n);if(o.scope.teamId!==this.#e.teamId||o.scope.projectId!==this.#e.projectId)throw new Error("tool_learning_consultation_scope_mismatch");return se(o,await this.#t("consultations","POST",o,t))}async consultation(n,t){let o=w.parse(n);if(o.scope.teamId!==this.#e.teamId||o.scope.projectId!==this.#e.projectId)throw new Error("tool_learning_consultation_scope_mismatch");return se(o,await this.#t(`installations/${encodeURIComponent(o.installationId)}/consultations/${encodeURIComponent(o.operationId)}`,"GET",void 0,t))}#n(n,t){if(n.id!==t||n.scope.teamId!==this.#e.teamId||n.scope.projectId!==this.#e.projectId)throw new Error("tool_learning_installation_scope_mismatch")}async#t(n,t,o,i){o!==void 0&&j(o,c.eventBytes*c.eventsPerAppend);let a=AbortSignal.timeout(3e4),s=await(this.#e.fetch??globalThis.fetch)(`${this.#o}/v1/tool-learning/${n}`,{method:t,redirect:"error",signal:i?AbortSignal.any([i,a]):a,headers:{Authorization:`Bearer ${this.#e.apiKey}`,"X-OpenPond-Team-Id":this.#e.teamId,Accept:"application/json",...o===void 0?{}:{"Content-Type":"application/json"}},...o===void 0?{}:{body:JSON.stringify(o)}}),d=await be(s,c.eventBytes*c.eventsPerAppend,"Tool learning response");if(!s.ok){let l=e.object({code:e.string().regex(/^[a-z0-9_]+$/).max(200)}).passthrough().safeParse(d);throw new D(s.status,l.success?l.data.code:"tool_learning_request_failed")}return d}};var rn=p(()=>Te,"nativeToolLearningClientVersion"),it=p((n,t)=>typeof n[t]=="string"?n[t].trim():"","optionString"),De=e.object({schemaVersion:e.literal("openpond.toolLearningLocalCredential.v1"),apiOrigin:e.string().url().refine(n=>new URL(n).origin===n),teamId:r,projectId:r,ownerAccount:e.string().nullable(),workspaceRoot:e.string().min(1),locallyEnabled:e.boolean(),environment:C.nullable().default(null),prepared:pe,installation:U.nullable()}).strict(),cn=p(n=>Ee({home:it(n,"home")||void 0}),"toolLearningHome"),Be=p(n=>`tool-learning:installation:${r.parse(n)}`,"toolLearningCredentialId");async function B(n,t){let o=await ve(n,Be(t));if(!o)throw new Error("Tool learning installation is not configured in this OpenPond home.");let i=De.parse(o.value);if(i.prepared.registration.installationId!==t||i.prepared.registration.projectId!==i.projectId)throw new Error("Tool learning credential scope does not match its installation.");return{...o,value:i}}p(B,"loadToolLearningCredential");async function qe(n,t,o){let i=De.parse(t);return Ie(n,Be(i.prepared.registration.installationId),i,o)}p(qe,"saveToolLearningCredential");function K(n){return new Ue({baseUrl:n.apiOrigin,apiKey:n.prepared.credential.apiKey,teamId:n.teamId,projectId:n.projectId})}p(K,"toolLearningProducer");function q(n,t,o){let i=t.prepared.registration;if(i.client!=="openpond"&&i.client!=="claude_code")throw new Error("This client has not been qualified for installation.");return n.configure({schemaVersion:"openpond.localToolLearningInstallation.v1",id:i.installationId,teamId:t.teamId,projectId:t.projectId,client:i.client,workspaceRoot:t.workspaceRoot,enabled:t.locallyEnabled&&o?.state==="enabled",policy:i.collectionPolicy,createdAt:o?.createdAt??new Date().toISOString()})}p(q,"configureLocalToolLearning");async function Q(n,t,o,i){let a=K(o),s=o.prepared.registration.installationId;if(!o.locallyEnabled)return q(t,o,null),{installationId:s,deliveredEvents:0,rejectedEvents:0,local:t.status(s),learningEnrollment:!1};let d=p(async()=>{q(t,o,null);let h=await B(n,s);h.value.locallyEnabled&&await qe(n,{...h.value,locallyEnabled:!1},h.revision)},"suspend"),l;try{l=await a.installation(s,i)}catch(h){throw h instanceof D&&[401,403].includes(h.status)&&await d(),h}if(l.state!=="enabled"&&await d(),l.collectionPolicyHash!==_(o.prepared.registration.collectionPolicy))throw await d(),new Error("Tool learning collection policy changed. Reconfigure this installation before uploading.");q(t,o,l);let v=0,g=0;for(let h=0;h<16;h++){let S=t.pending(s);if(!S.length)break;let I=await a.append({schemaVersion:"openpond.toolEpisodeAppend.v1",installationId:s,operationId:`tool-append-${T([s,S.map(f=>[f.eventId,f.contentHash])])}`,events:S},i).catch(async f=>{throw f instanceof D&&[401,403].includes(f.status)&&await d(),f});t.acknowledge(s,I.events),v+=I.events.filter(f=>f.state!=="privacy_rejected").length,g+=I.events.filter(f=>f.state==="privacy_rejected").length}return{installationId:s,deliveredEvents:v,rejectedEvents:g,local:t.status(s),learningEnrollment:!1}}p(Q,"flushToolLearning");import{realpath as at}from"node:fs/promises";function rt(n,t){let o=Buffer.from(n),i=Math.min(o.length,t);for(;i<o.length&&(o[i]&192)===128;)i--;return o.subarray(0,i).toString("utf8")}p(rt,"boundedExcerpt");function Pe(n){try{j(n,32768)}catch{return!0}let t=JSON.stringify(n);if(/(?:^|[\s/\\'"=])\.env(?:[.\s/\\'";]|$)/u.test(t))return!0;let o=G(t);return o.secretStatus!=="passed"||o.piiStatus!=="passed"}p(Pe,"privatePayload");async function Ln(n,t){let o=await at(t.workspaceRoot),i=new V(n),a=[],s=AbortSignal.timeout(2e3);try{let d=i.installations().filter(l=>l.enabled&&l.client===t.client&&l.workspaceRoot===o&&(!t.installationId||l.id===t.installationId)&&l.policy.permittedTools.includes(t.tool));for(let l of d){let v=await B(n,l.id),g=v.value;if(!g.locallyEnabled||g.prepared.registration.clientVersion!==t.clientVersion||g.workspaceRoot!==o||g.installation?.state!=="enabled"||t.accountScope&&(g.apiOrigin!==t.accountScope.apiOrigin||g.ownerAccount!==t.accountScope.accountHandle||g.installation.ownerUserId!==t.accountScope.ownerUserId||t.accountScope.teamId&&t.accountScope.teamId!==g.teamId))continue;q(i,g,g.installation);let h=l.policy,S=T(h);if(!h.purposes.includes("capture")||!h.workspaceRootHashes.includes(T(o)))continue;let I=p(te=>h.permittedFields.includes(te),"permits"),f=`tool-boundary-${T([l.id,t.sessionId,t.callId,t.phase])}`,N={schemaVersion:"openpond.toolEpisodeEvent.v1",operationId:f,installationId:l.id,episodeId:`tool-episode-${T([l.id,t.sessionId,t.callId])}`,eventId:f,sessionId:t.sessionId,parentSessionId:t.parentSessionId??null,turnId:t.turnId??null,callId:t.callId,occurredAt:new Date().toISOString(),sequence:t.phase==="attempt"?0:1,adapterVersion:g.prepared.registration.adapterRelease.id,sanitization:{policyRevision:h.revision,policyHash:S,redactedFields:0,omittedFields:0,truncated:!1}};if(t.phase==="attempt"){if(!I("action"))continue;let te=t.invalidArguments===void 0?{kind:"tool_arguments",arguments:t.arguments}:{kind:"tool_arguments",arguments:{invalidArguments:t.invalidArguments}},ue=H.safeParse(te);if(!ue.success){i.recordDropped(l.id);continue}let me=ue.data,he=t.environment??g.environment??{application:t.tool,version:t.clientVersion,state:{workspaceRootHash:T(o)},fingerprint:T([t.tool,t.clientVersion,o])},Fe=C.parse(I("state")?he:{...he,state:{}}),ge={intent:I("intent")?t.intent??"":"",tool:{name:t.tool,version:t.clientVersion,server:null},action:me,actionHash:T(me),environment:Fe,contextAssets:[],selection:{kind:"eligible_attempt"}};if(Pe(ge)){i.recordDropped(l.id);continue}let fe=i.retainCaptureBoundary(ae({...N,eventKind:"attempt",payload:ge}));fe&&a.push({installationId:l.id,event:fe});continue}let y=i.captureBoundary(l.id,t.sessionId,t.callId,"attempt");if(!y||y.eventKind!=="attempt"||!t.result)continue;let $=h.unchangedControls;if(!(t.result.outcome!=="succeeded"||i.hasRecoveryCandidateContext(l.id,t.sessionId)||parseInt(T([l.id,t.sessionId,t.callId]).slice(0,8),16)/4294967296<$.numerator/$.denominator))continue;if((!t.result.text||Buffer.byteLength(t.result.text)>8192)&&Buffer.byteLength(t.result.text)>8192){i.recordDropped(l.id);continue}let A={attempt:{id:y.eventId,contentHash:y.contentHash},actionHash:y.payload.actionHash,execution:t.result.execution,sideEffects:t.result.sideEffects,resultExcerpt:I("result_excerpt")?t.result.text:"",resultHash:I("result_excerpt")?T(t.result.text):null,assets:[]},O=t.result.outcome==="succeeded"?{...A,outcome:"succeeded",exitCode:t.result.exitCode??null}:t.result.outcome==="incomplete"?{...A,outcome:"incomplete",reason:"completion_not_observed"}:{...A,outcome:"failed",classification:t.result.classification??"unknown_failure",errorCode:t.result.classification??"unknown_failure",message:I("result_excerpt")?rt(t.result.text,2e3):"",exitCode:t.result.exitCode??null};if(Pe(O)){i.recordDropped(l.id);continue}let ee=i.retainCaptureBoundary(ae({...N,episodeId:y.episodeId,eventKind:"observation",payload:O}));if(ee){i.append(y),i.append(ee),a.push({installationId:l.id,event:ee});try{await Q(n,i,g,s)}catch{}}}return a.map(l=>({installationId:l.installationId,eventId:l.event.eventId,contentHash:l.event.contentHash}))}finally{i.close()}}p(Ln,"captureLocalToolBoundary");var st=e.object({sessionId:e.string().min(1).max(200),failedCallId:e.string().min(1).max(200),capabilityId:e.string().min(1).max(200),intent:e.string().max(2e3)}).strict();async function Un(n,t,o,i){let a=st.parse(o),{value:s}=await B(n,t);if(!s.locallyEnabled||s.installation?.state!=="enabled")throw new Error("tool_learning_consultation_disabled");let d=new V(n);try{q(d,s,s.installation);let l=d.captureBoundary(t,a.sessionId,a.failedCallId,"attempt"),v=d.captureBoundary(t,a.sessionId,a.failedCallId,"observation");if(!l||l.eventKind!=="attempt"||!v||v.eventKind!=="observation"||v.payload.outcome!=="failed")throw new Error("tool_learning_observed_failure_required");let g=G(a.intent);if(g.secretStatus!=="passed"||g.piiStatus!=="passed")throw new Error("tool_learning_consultation_privacy_blocked");let h=K(s),S={message:v.payload.message,observation:{id:v.eventId,contentHash:v.contentHash}},I=T({intent:a.intent,environment:l.payload.environment,failure:S}),f=d.consultationForCall(t,a.sessionId,a.failedCallId);if(f){let A=f.operationId;if(f.contextHash!==I||f.capabilityId!==a.capabilityId)return{operationId:A,response:{state:"unavailable",reason:"failure_already_submitted"},recovery:"Read the original consultation with openpond_consult_status. Changing context or capability does not authorize another paid call."};try{return{operationId:A,response:await h.consultation(f,i)}}catch(O){if(!(O instanceof D)||O.status!==404||O.code!=="tool_learning_consultation_not_found")throw O;return ke(h,f,i)}}let N=await h.manifest(t,i),y=N.capabilities.find(A=>A.id===a.capabilityId);if(!y||y.application!==l.payload.environment.application||!y.versions.includes(l.payload.environment.version)||!y.tools.includes(l.payload.tool.name))throw new Error("tool_learning_consultation_scope_unsupported");let $=`tool-consult-${T([t,a.sessionId,a.failedCallId,a.capabilityId,l.payload.actionHash,I,N.modelRelease])}`,Z=w.parse({schemaVersion:"openpond.toolLearningConsultation.v1",operationId:$,installationId:t,scope:N.scope,sessionId:a.sessionId,callId:a.failedCallId,capabilityId:a.capabilityId,manifestHash:N.contentHash,modelRelease:N.modelRelease,mode:"recovery",intent:a.intent,action:l.payload.action,actionHash:l.payload.actionHash,environment:l.payload.environment,contextHash:I,failure:S,round:1});return d.retainConsultationRequest(Z),await Q(n,d,s,i),ke(h,Z,i)}finally{d.close()}}p(Un,"consultLocalToolLearning");async function Dn(n,t,o,i){let{value:a}=await B(n,t);if(!a.locallyEnabled)throw new Error("tool_learning_consultation_disabled");let s=new V(n);try{let d=s.consultationRequest(t,o);if(!d)throw new Error("tool_learning_consultation_request_not_retained");return{operationId:o,response:await K(a).consultation(d,i)}}finally{s.close()}}p(Dn,"readLocalToolConsultation");async function ke(n,t,o){try{return{operationId:t.operationId,response:await n.consult(t,o)}}catch(i){let a=i instanceof D&&i.status>=400&&i.status<500&&i.status!==408;return{operationId:t.operationId,response:{state:"unavailable",reason:a?i.code:"dispatch_uncertain"},recovery:a?"Resolve the reported admission error. Keep this original operation ID; do not create a replacement paid request.":"Use openpond_consult_status with this operationId; do not create a replacement request."}}}p(ke,"submitLocalToolConsultation");export{c as a,r as b,u as c,E as d,C as e,L as f,Le as g,Se as h,Re as i,U as j,we as k,Y as l,Ae as m,w as n,re as o,se as p,V as q,rn as r,De as s,cn as t,Be as u,B as v,qe as w,K as x,q as y,Q as z,Ln as A,st as B,Un as C,Dn as D};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{a as x}from"./chunk-IOSBGCRT.js";import{c as m}from"./chunk-3M53YXEI.js";import{a as c,b as a,c as f,d as u,f as E,g as L,h as C,i as A,j as g,k as $,l as T,m as U,n as y,o as q,p as j}from"./chunk-LOIYNRBC.js";import{b as w,h as v}from"./chunk-W7NXFRHN.js";import{m as P}from"./chunk-5HPZGLOL.js";import{l as I}from"./chunk-G4E3WGLM.js";import{v as R}from"./chunk-ZY32SZ2P.js";import{n as l}from"./chunk-RCT3O3HQ.js";import{A as n}from"./chunk-X2J2P5ZT.js";import{a as d}from"./chunk-FTQLQJQV.js";var O=u(n.object({registration:A,credential:n.object({apiKey:w,expiresAt:n.iso.datetime()}).strict()}).strict(),c.eventBytes),B=u(n.object({operationId:a,expectedRevision:n.number().int().positive(),episodeId:a,failure:f,recovery:f,taskDefinition:I,familyKey:a,split:n.literal("train"),proposedTarget:q,saveToPrivateDataset:n.literal(!0),targetApproval:n.literal("pending_owner_review")}).strict(),c.eventBytes),H=u(n.object({installationId:a,projectId:a,operationId:a,source:I,evidence:I,originHash:n.string().regex(/^[a-f0-9]{64}$/),requestHash:n.string().regex(/^[a-f0-9]{64}$/),projectedAt:n.iso.datetime(),targetApproval:n.literal("pending_owner_review"),learningEnrollment:n.literal(!1)}).strict(),c.eventBytes),k=u(n.object({operationId:a,expectedRevision:n.number().int().nonnegative(),state:n.enum(["enabled","disabled"]),modelId:a,qualification:n.discriminatedUnion("kind",[n.object({kind:n.literal("integration"),evaluationRunId:a}).strict(),n.object({kind:n.literal("learned"),evaluationRunId:a,baselineRunId:a,trainingRunId:a}).strict()]),capabilities:n.array(T.omit({qualification:!0})).min(1).max(16),limits:n.object({maxOutputTokens:n.number().int().min(128).max(2048),maximumCallUsd:n.number().positive().max(1),maximumDayUsd:n.number().positive().max(10),maximumSessionCalls:n.number().int().min(1).max(20),maximumDayCalls:n.number().int().min(1).max(200)}).strict()}).strict(),c.eventBytes),K=u(n.object({installationId:a,scope:n.object({teamId:a,projectId:a}).strict(),revision:n.number().int().positive(),operationId:a,requestHash:n.string().regex(/^[a-f0-9]{64}$/),configuration:k,modelRelease:f,policySystemPrompt:n.string().min(1).max(16384),capabilities:n.array(T).max(16),updatedAt:n.iso.datetime()}).strict(),c.eventBytes);function X(s,t){let i=v({sourceId:s.installationId,name:"Tool learning installation",expiresAt:t});return O.parse({registration:s,credential:{apiKey:i.apiKey,expiresAt:t}})}d(X,"prepareToolLearningRegistration");var b=class extends Error{constructor(i,e){super(`Tool learning request failed (${i}): ${e}`);this.status=i;this.code=e;this.name="OpenPondToolLearningError"}status;code;static{d(this,"OpenPondToolLearningError")}},_=class{static{d(this,"OpenPondToolLearningClient")}#o;#e;constructor(t){this.#e={...t};let i=new URL(t.baseUrl);if(!["https:","http:"].includes(i.protocol)||i.username||i.password||i.search||i.hash||!t.apiKey.trim()||!t.teamId.trim()||!t.projectId.trim())throw new Error("tool_learning_client_scope_required");this.#o=i.toString().replace(/\/+$/,"")}async register(t,i){let e=O.parse(t);if(e.registration.projectId!==this.#e.projectId)throw new Error("tool_learning_project_mismatch");let o=n.object({installation:g,apiKey:w}).strict().parse(await this.#t("installations","POST",e,i));if(this.#n(o.installation,e.registration.installationId),o.apiKey!==e.credential.apiKey)throw new Error("tool_learning_credential_mismatch");let r=o.installation;if(r.client!==e.registration.client||r.clientVersion!==e.registration.clientVersion||r.machineSourceId!==e.registration.machineSourceId||l(r.adapterRelease)!==l(e.registration.adapterRelease)||l(r.collectionPolicy)!==l(e.registration.collectionPolicy)||r.collectionPolicyHash!==l(e.registration.collectionPolicy)||r.credential?.expiresAt!==e.credential.expiresAt)throw new Error("tool_learning_registration_receipt_mismatch");return o}async installation(t,i){let e=g.parse(await this.#t(`installations/${encodeURIComponent(t)}`,"GET",void 0,i));return this.#n(e,t),e}async installations(t,i){let e=n.object({items:n.array(g).max(30),nextCursor:a.nullable()}).strict().parse(await this.#t(`installations?projectId=${encodeURIComponent(this.#e.projectId)}${t?`&after=${encodeURIComponent(t)}`:""}`,"GET",void 0,i));for(let o of e.items)this.#n(o,o.id);if(e.nextCursor!==null&&e.nextCursor!==e.items.at(-1)?.id)throw new Error("tool_learning_installation_cursor_mismatch");return e}async episodes(t,i,e){let o=n.object({installationId:a,scope:n.object({teamId:a,projectId:a}).strict(),items:n.array(n.object({episodeId:a,eventCount:n.number().int().positive(),lastReceivedAt:n.iso.datetime()}).strict()).max(30),nextCursor:a.nullable(),learningEnrollment:n.literal(!1)}).strict().parse(await this.#t(`installations/${encodeURIComponent(t)}/episodes${i?`?after=${encodeURIComponent(i)}`:""}`,"GET",void 0,e));if(o.installationId!==t||o.scope.teamId!==this.#e.teamId||o.scope.projectId!==this.#e.projectId||o.nextCursor!==null&&o.nextCursor!==o.items.at(-1)?.episodeId)throw new Error("tool_learning_episode_page_mismatch");return o}async episode(t,i,e){let o=n.object({installationId:a,episodeId:a,scope:n.object({teamId:a,projectId:a}).strict(),events:n.array(E).max(c.eventsPerEpisode),state:n.enum(["incomplete","awaiting_owner_review"]),verificationAuthority:n.literal("not_granted"),learningEnrollment:n.literal(!1)}).strict().parse(await this.#t(`installations/${encodeURIComponent(t)}/episodes/${encodeURIComponent(i)}`,"GET",void 0,e));if(o.installationId!==t||o.episodeId!==i||o.scope.teamId!==this.#e.teamId||o.scope.projectId!==this.#e.projectId||o.events.some(r=>r.installationId!==t||r.episodeId!==i))throw new Error("tool_learning_episode_scope_mismatch");return o}async purge(t,i,e){let o=n.object({operationId:a,expectedRevision:n.number().int().positive()}).strict().parse(i),r=n.object({installationId:a,operationId:a,purgedEvents:n.number().int().nonnegative(),learningEnrollment:n.literal(!1)}).strict().parse(await this.#t(`installations/${encodeURIComponent(t)}/purge`,"POST",o,e));if(r.installationId!==t||r.operationId!==o.operationId)throw new Error("tool_learning_purge_scope_mismatch");return r}async project(t,i,e){let o=B.parse(i),r=H.parse(await this.#t(`installations/${encodeURIComponent(t)}/project`,"POST",o,e));if(r.installationId!==t||r.projectId!==this.#e.projectId||r.operationId!==o.operationId||r.requestHash!==l(o))throw new Error("tool_learning_projection_scope_mismatch");return r}async setState(t,i,e){let o=$.parse(i),r=g.parse(await this.#t(`installations/${encodeURIComponent(t)}`,"PATCH",o,e));if(this.#n(r,t),r.state!==o.state)throw new Error("tool_learning_state_mismatch");return r}async append(t,i){let e=L.parse(t),o=C.parse(await this.#t("episodes","POST",e,i));if(o.operationId!==e.operationId||o.installationId!==e.installationId||o.teamId!==this.#e.teamId||o.projectId!==this.#e.projectId||o.requestHash!==l(e)||o.events.length!==e.events.length||new Set(o.events.map(r=>r.eventId)).size!==o.events.length)throw new Error("tool_learning_append_receipt_mismatch");for(let r of o.events){let p=e.events.find(h=>h.eventId===r.eventId);if(!p||p.contentHash!==r.contentHash)throw new Error("tool_learning_append_event_mismatch")}return o}async routing(t,i){return this.#i(t,await this.#t(`installations/${encodeURIComponent(t)}/routing`,"GET",void 0,i))}async configureRouting(t,i,e){let o=k.parse(i),r=this.#i(t,await this.#t(`installations/${encodeURIComponent(t)}/routing`,"POST",o,e));if(r.operationId!==o.operationId||r.requestHash!==l(o)||l(r.configuration)!==l(o))throw new Error("tool_learning_routing_receipt_mismatch");return r}#i(t,i){let e=K.parse(i);if(e.installationId!==t||e.scope.teamId!==this.#e.teamId||e.scope.projectId!==this.#e.projectId)throw new Error("tool_learning_routing_scope_mismatch");return e}async manifest(t,i){let e=U.parse(await this.#t(`installations/${encodeURIComponent(t)}/manifest`,"GET",void 0,i));if(e.installationId!==t||e.scope.teamId!==this.#e.teamId||e.scope.projectId!==this.#e.projectId)throw new Error("tool_learning_manifest_scope_mismatch");if(Date.parse(e.expiresAt)<=Date.now()||Date.parse(e.issuedAt)>Date.now()+3e4)throw new Error("tool_learning_manifest_expired");return e}async consult(t,i){let e=y.parse(t);if(e.scope.teamId!==this.#e.teamId||e.scope.projectId!==this.#e.projectId)throw new Error("tool_learning_consultation_scope_mismatch");return j(e,await this.#t("consultations","POST",e,i))}async consultation(t,i){let e=y.parse(t);if(e.scope.teamId!==this.#e.teamId||e.scope.projectId!==this.#e.projectId)throw new Error("tool_learning_consultation_scope_mismatch");return j(e,await this.#t(`installations/${encodeURIComponent(e.installationId)}/consultations/${encodeURIComponent(e.operationId)}`,"GET",void 0,i))}#n(t,i){if(t.id!==i||t.scope.teamId!==this.#e.teamId||t.scope.projectId!==this.#e.projectId)throw new Error("tool_learning_installation_scope_mismatch")}async#t(t,i,e,o){e!==void 0&&R(e,c.eventBytes*c.eventsPerAppend);let r=AbortSignal.timeout(3e4),p=await(this.#e.fetch??globalThis.fetch)(`${this.#o}/v1/tool-learning/${t}`,{method:i,redirect:"error",signal:o?AbortSignal.any([o,r]):r,headers:{Authorization:`Bearer ${this.#e.apiKey}`,"X-OpenPond-Team-Id":this.#e.teamId,Accept:"application/json",...e===void 0?{}:{"Content-Type":"application/json"}},...e===void 0?{}:{body:JSON.stringify(e)}}),h=await P(p,c.eventBytes*c.eventsPerAppend,"Tool learning response");if(!p.ok){let S=n.object({code:n.string().regex(/^[a-z0-9_]+$/).max(200)}).passthrough().safeParse(h);throw new b(p.status,S.success?S.data.code:"tool_learning_request_failed")}return h}};async function ee(s,t){if(m(s,"teamId")&&m(s,"teamId")!==t.teamId)throw new Error("The selected workspace differs from this installation.");if(m(s,"projectId")&&m(s,"projectId")!==t.projectId)throw new Error("The selected Model Project differs from this installation.");let{context:i,baseUrl:e}=await x({...s,teamId:t.teamId,apiBaseUrl:t.apiOrigin,account:m(s,"account")||t.ownerAccount||""});return new _({baseUrl:e,apiKey:i.token,teamId:t.teamId,projectId:t.projectId})}d(ee,"toolLearningOwner");export{k as a,X as b,_ as c,ee as d};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{w as RightSidebarHomePanel}from"./MainPane-DDO6diPt.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{_ as WorkSidebarPanel}from"./MainPane-DDO6diPt.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./createLucideIcon-DF2VR6WA.js";var t=e(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]);export{t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{m as e}from"./index-CM0IRu1U.js";e();
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./createLucideIcon-DF2VR6WA.js";var t=e(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]);export{t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./createLucideIcon-DF2VR6WA.js";var t=e(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]);export{t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./createLucideIcon-DF2VR6WA.js";var t=e(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]);export{t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./createLucideIcon-DF2VR6WA.js";var t=e(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]);export{t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./createLucideIcon-DF2VR6WA.js";var t=e(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);export{t};
|