sliccy 6.164.1 → 6.166.0
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/node-server/_shared/agent-wire-types.d.ts +7 -1
- package/dist/node-server/_shared/agent-wire-types.d.ts.map +1 -1
- package/dist/node-server/_shared/computer-protocol.d.ts +108 -0
- package/dist/node-server/_shared/computer-protocol.d.ts.map +1 -0
- package/dist/node-server/_shared/computer-protocol.js +10 -0
- package/dist/node-server/_shared/computer-protocol.js.map +1 -0
- package/dist/node-server/_shared/index.d.ts +1 -0
- package/dist/node-server/_shared/index.d.ts.map +1 -1
- package/dist/node-server/_shared/index.js +1 -0
- package/dist/node-server/_shared/index.js.map +1 -1
- package/dist/ui/.vite/manifest.json +184 -174
- package/dist/ui/assets/{SKILL-C8DJkgFD.js → SKILL-BGEZa-y0.js} +1 -1
- package/dist/ui/assets/SKILL-DB5CVwyu.js +1 -0
- package/dist/ui/assets/SKILL-DEFDsScb.js +1 -0
- package/dist/ui/assets/SKILL-DZoCcID_.js +1 -0
- package/dist/ui/assets/{SKILL-BXSAhY0E.js → SKILL-cOU0zXaK.js} +3 -0
- package/dist/ui/assets/__vite-browser-external-C-cVeSv_.js +1 -0
- package/dist/ui/assets/{account-store-CScbFg3i.js → account-store-BEqmysw9.js} +1 -1
- package/dist/ui/assets/{account-store-DEob4Tob.js → account-store-C35GYvum.js} +1 -1
- package/dist/ui/assets/{adobe-CgamcTLU.js → adobe-BDH5oLAN.js} +1 -1
- package/dist/ui/assets/adobe-BcTGFCnQ.js +1 -0
- package/dist/ui/assets/{agent-panels-XcqgFmF4.js → agent-panels-DvqNnkLk.js} +1 -1
- package/dist/ui/assets/almost-bash-shell-headless-DqTtE9CM.js +3500 -0
- package/dist/ui/assets/{apply-layout-BDanZxtJ.js → apply-layout-CjYRGs37.js} +1 -1
- package/dist/ui/assets/{approver-agent-CCkU0PVa.js → approver-agent-CvnFt_s6.js} +1 -1
- package/dist/ui/assets/{apps-CU2dHbHf.js → apps-dzoLZ_5W.js} +1 -1
- package/dist/ui/assets/{azure-openai-kjz9Dci1.js → azure-openai-BffwoCtp.js} +1 -1
- package/dist/ui/assets/{azure-openai-Cl5VKD9d.js → azure-openai-DKGdcr4S.js} +1 -1
- package/dist/ui/assets/{backend-hostfs-DU0NS-tW.js → backend-hostfs-CWIlIhve.js} +1 -1
- package/dist/ui/assets/bridge-protocol-31SWTdS5.js +1 -0
- package/dist/ui/assets/{browser-fOe3v0iv.js → browser-eoO4vY7w.js} +1 -1
- package/dist/ui/assets/buffer-polyfill-BccMjOKj.js +1 -0
- package/dist/ui/assets/{cdp-Cry6h07Z.js → cdp-DXT6yEL1.js} +1 -1
- package/dist/ui/assets/{cerebras-DrMQuNWj.js → cerebras-BF5efkRL.js} +1 -1
- package/dist/ui/assets/{cerebras-CWXTOiZB.js → cerebras-By0l7t0i.js} +1 -1
- package/dist/ui/assets/{composer-speech-HE7hDylv.js → composer-speech-DIEePbQC.js} +1 -1
- package/dist/ui/assets/{connect-surface-DTj_-b2c.js → connect-surface-DBqs7oHf.js} +1 -1
- package/dist/ui/assets/{cost-command-DlIH8zCh.js → cost-command-BULzLcvz.js} +1 -1
- package/dist/ui/assets/descriptor-S4Jug1iP.js +1 -0
- package/dist/ui/assets/directed-approval-D1lGElvD.js +1 -0
- package/dist/ui/assets/engine-B-OPe78i.js +1 -0
- package/dist/ui/assets/{ensure-speech-assets-Bdq2ASEA.js → ensure-speech-assets-BJXemBO4.js} +1 -1
- package/dist/ui/assets/esp8266-l8ELjmQJ.js +1 -0
- package/dist/ui/assets/esptool-operations-h8-8jVn_.js +13 -0
- package/dist/ui/assets/fake-computer-1f2_4vxY.js +65 -0
- package/dist/ui/assets/{frozen-archive-writer-B1ANvJgT.js → frozen-archive-writer-DYPhPMg7.js} +2 -2
- package/dist/ui/assets/{fs-Dlit1SL1.js → fs-BapOupIM.js} +2 -2
- package/dist/ui/assets/{fs-DZGgOIET.js → fs-CBH-hQcI.js} +1 -1
- package/dist/ui/assets/gelatiere-store-C2u47uk0.js +1 -0
- package/dist/ui/assets/gelatiere-unit-wvDEO7gH.js +1 -0
- package/dist/ui/assets/{github-C5AdaH2F.js → github-Bx7_6LBm.js} +2 -2
- package/dist/ui/assets/{github-CGPZBKqk.js → github-Db015Tee.js} +1 -1
- package/dist/ui/assets/{github-auth-BEjdODKn.js → github-auth-DtKS6UIX.js} +1 -1
- package/dist/ui/assets/{github-copilot-D5K0xdpB.js → github-copilot-CtOjxhqK.js} +1 -1
- package/dist/ui/assets/{github-copilot-6b_0-c1B.js → github-copilot-eCfmryv6.js} +1 -1
- package/dist/ui/assets/{github-install-DLv9ZHaT.js → github-install-B6W4-xcc.js} +1 -1
- package/dist/ui/assets/{github-zip-pP3IhiBQ.js → github-zip-Bv1smNmy.js} +1 -1
- package/dist/ui/assets/handoff-link-B3It6xQY.js +1 -0
- package/dist/ui/assets/{hear-CybMJQVi.js → hear-BZHckZJM.js} +1 -1
- package/dist/ui/assets/{help-C1nN0w8V.js → help-BU2Hjl0P.js} +1 -1
- package/dist/ui/assets/host-BQ2qKD-D.js +1 -0
- package/dist/ui/assets/{installer-Chacgw8i.js → installer-BbtH3u7z.js} +1 -1
- package/dist/ui/assets/js-realm-worker-BT3mfq3w.js +50 -0
- package/dist/ui/assets/jsh-CrSWPG4t.js +1 -0
- package/dist/ui/assets/jsh-discovery-D3Gk1cKA.js +1 -0
- package/dist/ui/assets/jsh-executor-BWlgcE2N.js +18 -0
- package/dist/ui/assets/jsh-runtime-extensions-BnLXkzqP.js +1 -0
- package/dist/ui/assets/just-bash-compat-B-SPHuh_.js +1 -0
- package/dist/ui/assets/kernel-worker-Dseu067f.js +1185 -0
- package/dist/ui/assets/{key-GVxFyssW.js → key-6HWbWSGF.js} +1 -1
- package/dist/ui/assets/keys-n5_C9sHW.js +1 -0
- package/dist/ui/assets/lick-urls-DdKPDlgq.js +1 -0
- package/dist/ui/assets/{lick-ws-bridge-BMov8z0m.js → lick-ws-bridge-Cc9sToY7.js} +1 -1
- package/dist/ui/assets/lick-ws-bridge-ChigxI36.js +1 -0
- package/dist/ui/assets/live-session-snapshot-B70raB09.js +1 -0
- package/dist/ui/assets/{local-llm-B7zAVGSm.js → local-llm-Dcp5IIP-.js} +1 -1
- package/dist/ui/assets/{local-llm-ByCXv2P-.js → local-llm-DpSg-Oe3.js} +1 -1
- package/dist/ui/assets/{main-yKaIA_zV.js → main-CfF8CFBr.js} +3 -3
- package/dist/ui/assets/{main-cherry-BNWE5vJO.js → main-cherry-VckJPHm5.js} +1 -1
- package/dist/ui/assets/memory-curation-seam-DUaZFZG9.js +1 -0
- package/dist/ui/assets/memory-health-D7uEvfAx.js +1 -0
- package/dist/ui/assets/memory-v2-flag-BHVbti6Z.js +1 -0
- package/dist/ui/assets/memory-write-execute-rXtR1z76.js +1 -0
- package/dist/ui/assets/merge-file-core-VJlzucJY.js +11 -0
- package/dist/ui/assets/{mount-DvrzOwsL.js → mount-8lU2iH4k.js} +3 -3
- package/dist/ui/assets/mount-DoM0CLGG.js +1 -0
- package/dist/ui/assets/{new-session-C4AXW_7S.js → new-session-DEhAjxP1.js} +2 -2
- package/dist/ui/assets/{oauth-bootstrap-mNVnQZ_Q.js → oauth-bootstrap-DNTgbEZF.js} +2 -2
- package/dist/ui/assets/{onboarding-orchestrator-BwCfbdlW.js → onboarding-orchestrator-DzPQ0pVG.js} +1 -1
- package/dist/ui/assets/{openai-codex-DRyLvc3I.js → openai-codex-CsAhfz0D.js} +1 -1
- package/dist/ui/assets/{openai-codex-Subg_Vg8.js → openai-codex-DYRKYWTe.js} +1 -1
- package/dist/ui/assets/{openrouter-D5mJU1oF.js → openrouter-D9T6tXUF.js} +1 -1
- package/dist/ui/assets/{openrouter-B52vd-zH.js → openrouter-IyZlRHg4.js} +1 -1
- package/dist/ui/assets/{openrouter-free-CYBINFem.js → openrouter-free-CPshAgQD.js} +1 -1
- package/dist/ui/assets/{openrouter-free-CKmFPQ3y.js → openrouter-free-DfbYsnmf.js} +1 -1
- package/dist/ui/assets/{openrouter-oauth-BUFYoKT3.js → openrouter-oauth-hZg6oH0A.js} +1 -1
- package/dist/ui/assets/{openrouter-oauth-BML-cBKi.js → openrouter-oauth-xKlWi_wI.js} +1 -1
- package/dist/ui/assets/{opfs-mount-DmOQi3qJ.js → opfs-mount-C9Iamj6N.js} +1 -1
- package/dist/ui/assets/panel-rpc-handlers-Nu-wOrG9.js +2 -0
- package/dist/ui/assets/{panelize-shell-CJS6Q9hY.js → panelize-shell-tFElgHWF.js} +1 -1
- package/dist/ui/assets/pi-edit-execution-D6vx5LyF.js +2 -0
- package/dist/ui/assets/provider-3--cEcAF.js +1 -0
- package/dist/ui/assets/{provider-G-FXP5U3.js → provider-Z5aj7SzG.js} +2 -2
- package/dist/ui/assets/provider-settings-D9sjEfYE.js +1 -0
- package/dist/ui/assets/provider-store-access-M0PvJ08M.js +1 -0
- package/dist/ui/assets/provider-store-access-RxIHhH6d.js +1 -0
- package/dist/ui/assets/{providers-BT71Fchh.js → providers-CnoKdyLc.js} +2 -2
- package/dist/ui/assets/{providers-C1P4Z_in.js → providers-DVvrXbtx.js} +1 -1
- package/dist/ui/assets/{py-realm-worker-BRyQamcA.js → py-realm-worker-DXmzJqJi.js} +2 -2
- package/dist/ui/assets/{pyodide-DwR4k6wB.js → pyodide-b5uAaIjj.js} +2 -2
- package/dist/ui/assets/{quick-llm-BOu12xbc.js → quick-llm-DjWE-wQw.js} +1 -1
- package/dist/ui/assets/realm-inprocess-D0iWBQzz.js +30 -0
- package/dist/ui/assets/record-ChU1ND2B.js +1 -0
- package/dist/ui/assets/{recovery-screen-D_LwQpCA.js → recovery-screen-Y1CSyfR-.js} +1 -1
- package/dist/ui/assets/registry-Bq_j-EXx.js +1 -0
- package/dist/ui/assets/restore-DOkDX8BI.js +1 -0
- package/dist/ui/assets/{run-BFLhWKKw.js → run-B-fA26ea.js} +1 -1
- package/dist/ui/assets/run-BEt0RS3J.js +52 -0
- package/dist/ui/assets/{run-BGSKahNd.js → run-BOc9XLhg.js} +1 -1
- package/dist/ui/assets/run-BOkp5G58.js +91 -0
- package/dist/ui/assets/{run-CS-v8Znz.js → run-BWJSDhS7.js} +2 -2
- package/dist/ui/assets/{run-Dfw_vahy.js → run-Bld9B0W0.js} +1 -1
- package/dist/ui/assets/{run-CrPSdmNd.js → run-CISIYZMm.js} +1 -1
- package/dist/ui/assets/{run-MvSXwrUs.js → run-D0C4PgZM.js} +4 -4
- package/dist/ui/assets/{run-_2GCYBFU.js → run-DgNh1E56.js} +2 -2
- package/dist/ui/assets/{run-DWBPrvVI.js → run-DniTiLYn.js} +1 -1
- package/dist/ui/assets/run-a67LpkRp.js +42 -0
- package/dist/ui/assets/{run-BCXMG6On.js → run-vEDh-Me-.js} +6 -6
- package/dist/ui/assets/screencapture-media-B1iFS6Qy.js +1 -0
- package/dist/ui/assets/{screencapture-run-CfJW-gGP.js → screencapture-run-XrgS6hEd.js} +2 -2
- package/dist/ui/assets/script-catalog-CgT8L-OG.js +2 -0
- package/dist/ui/assets/{session-command-memory-0P878oz2.js → session-command-memory-DB2GmPSU.js} +2 -2
- package/dist/ui/assets/{session-jsonl-MJMdfn6X.js → session-jsonl-DFC-2T76.js} +1 -1
- package/dist/ui/assets/{session-jsonl-f7vG8uaN.js → session-jsonl-D_pTYppB.js} +1 -1
- package/dist/ui/assets/{session-search-index-BQmbRVuk.js → session-search-index-CN1zDLlx.js} +2 -2
- package/dist/ui/assets/{setup-feature-flags-remote-KCi8ndrR.js → setup-feature-flags-remote-BVd31Z12.js} +1 -1
- package/dist/ui/assets/signed-fetch-BY2Mdjqe.js +1 -0
- package/dist/ui/assets/{silent-renew-backoff-B06r5ZL-.js → silent-renew-backoff-CKAAh6GN.js} +1 -1
- package/dist/ui/assets/{silent-renew-backoff-DIMz5UqB.js → silent-renew-backoff-Dmz3DJHb.js} +1 -1
- package/dist/ui/assets/slicc-version-BZyTvfoc.js +1 -0
- package/dist/ui/assets/{snapshot-features-vq3FCiv5.js → snapshot-features-DjMJkCGq.js} +1 -1
- package/dist/ui/assets/{snapshot-BykuJ4wW.js → snapshot-gi8tDzvN.js} +1 -1
- package/dist/ui/assets/{soundscape-DQGEZGwB.js → soundscape-Bl3LhUk9.js} +1 -1
- package/dist/ui/assets/{speak-DivfwK0_.js → speak-BY_fDou2.js} +1 -1
- package/dist/ui/assets/{sprinkle-manager-rSxSSd0J.js → sprinkle-manager-C-NUJqPy.js} +1 -1
- package/dist/ui/assets/{sprinkle-renderer-Ul_GPDpn.js → sprinkle-renderer-CcA6ie5u.js} +1 -1
- package/dist/ui/assets/{state-CGafQVGp.js → state-z3wOHLww.js} +1 -1
- package/dist/ui/assets/{store-qzvn3yV9.js → store-ByUcAFUa.js} +1 -1
- package/dist/ui/assets/{store-BbZGuhdS.js → store-ChWzn_H8.js} +1 -1
- package/dist/ui/assets/{sudo-BLaOJiyv.js → sudo-DNZFIZ-H.js} +1 -1
- package/dist/ui/assets/sudo-fs-D620mZry.js +3 -0
- package/dist/ui/assets/supervisor-BtH2-9sE.js +1 -0
- package/dist/ui/assets/{sync-dialog-CfQLao_i.js → sync-dialog-Jqz74VkZ.js} +1 -1
- package/dist/ui/assets/sync-sab-wire-CC30v4TL.js +252 -0
- package/dist/ui/assets/tab-ToMhjbM4.js +1 -0
- package/dist/ui/assets/{transformers-env-7c5cDYNs.js → transformers-env-pq1E2H6B.js} +1 -1
- package/dist/ui/assets/{tray-leader-DqDL2jwl.js → tray-leader-Bas0lH9O.js} +1 -1
- package/dist/ui/assets/{tray-leave-runtime-Fs59e1NT.js → tray-leave-runtime-B9aV_guA.js} +1 -1
- package/dist/ui/assets/tray-runtime-config-BZoJXfW0.js +1 -0
- package/dist/ui/assets/{tray-sidecar-DuSizsy1.js → tray-sidecar-DA8NfCV6.js} +1 -1
- package/dist/ui/assets/upgrade-detection-B5ym__Gu.js +1 -0
- package/dist/ui/assets/{upskill-lick-skip-B0aTroa_.js → upskill-lick-skip-CZGM2OFA.js} +1 -1
- package/dist/ui/assets/v86-DseFx8Yp.js +1 -0
- package/dist/ui/assets/v86-vm-DCm7zA2r.js +2 -0
- package/dist/ui/assets/{voice-reply-BDW4paEk.js → voice-reply-CL5tDo0l.js} +1 -1
- package/dist/ui/assets/{wc-attach-C1JExhF6.js → wc-attach-C5yXIQNU.js} +2 -2
- package/dist/ui/assets/{wc-detached-YxBsBh4A.js → wc-detached-f_qit-5b.js} +1 -1
- package/dist/ui/assets/{wc-extension-CVnsFSuW.js → wc-extension-DRx21-cq.js} +2 -2
- package/dist/ui/assets/{wc-follower-CUovZlpa.js → wc-follower-DcKt92kM.js} +3 -3
- package/dist/ui/assets/{wc-follower-oauth-Bxhy8p-W.js → wc-follower-oauth-BF3qXDTt.js} +1 -1
- package/dist/ui/assets/{wc-gelatiere-CxkjwV-m.js → wc-gelatiere-qAW7lWGW.js} +1 -1
- package/dist/ui/assets/{wc-live-br4wUYv7.js → wc-live-DOMCfDT6.js} +6 -6
- package/dist/ui/assets/{wc-nav-ChrnrxPa.js → wc-nav-DzPuXq_n.js} +2 -2
- package/dist/ui/assets/{wc-onboarding-D2v396gn.js → wc-onboarding-CXM-z-7_.js} +2 -2
- package/dist/ui/assets/{wc-placeholder-Bw-g85Ke.js → wc-placeholder-BBqbsuml.js} +3 -3
- package/dist/ui/assets/{wc-secret-request-BK3k0VlW.js → wc-secret-request-BSUlxVVi.js} +1 -1
- package/dist/ui/assets/{wc-settings-D84UzOS6.js → wc-settings-55mC-jVS.js} +3 -3
- package/dist/ui/assets/{wc-shell-CKhQ3qyn.js → wc-shell-C71iKreG.js} +4 -4
- package/dist/ui/assets/{wc-shortcut-config-DFPLI7su.js → wc-shortcut-config-Crjq_rF1.js} +1 -1
- package/dist/ui/assets/{wc-sprinkles-Cf6JnkDK.js → wc-sprinkles-Caji5y7n.js} +2 -2
- package/dist/ui/assets/{wc-transcript-export-BbJ1QcHb.js → wc-transcript-export-Dqe3SH1t.js} +2 -2
- package/dist/ui/assets/{wc-tray-BEzyYj77.js → wc-tray-B7ayzT1W.js} +4 -4
- package/dist/ui/assets/welcome-detection-CEARSpAq.js +1 -0
- package/dist/ui/assets/{whisper-session-Ch3Rub5j.js → whisper-session-DfILe4Yb.js} +2 -2
- package/dist/ui/assets/workspace-mode-D0kUKBVS.js +1 -0
- package/dist/ui/assets/{xai-grok-D4lk5fCR.js → xai-grok-CVLBrxdD.js} +1 -1
- package/dist/ui/assets/{xai-grok-BT_WDAT_.js → xai-grok-Dp8n52fO.js} +1 -1
- package/dist/ui/index.html +3 -3
- package/dist/ui/packages/webapp/index.html +3 -3
- package/package.json +1 -1
- package/dist/ui/assets/SKILL-CtxHowg1.js +0 -96
- package/dist/ui/assets/__vite-browser-external-CCBdZzAl.js +0 -1
- package/dist/ui/assets/adobe-CjAD_QGX.js +0 -1
- package/dist/ui/assets/agent-bridge-D_5Sd3oe.js +0 -12
- package/dist/ui/assets/agent-message-to-chat-w7n13QEN.js +0 -7
- package/dist/ui/assets/attachments-u2K0aIPI.js +0 -6
- package/dist/ui/assets/bridge-protocol-DdqxTTSu.js +0 -1
- package/dist/ui/assets/budget-usage-source-BW8-RCSb.js +0 -1
- package/dist/ui/assets/clipboard-CknViQHB.js +0 -1
- package/dist/ui/assets/cone-memory-budget-Cmi9vXV5.js +0 -15
- package/dist/ui/assets/db-DSIYsBgP.js +0 -1
- package/dist/ui/assets/derive-CZLe75z_.js +0 -1
- package/dist/ui/assets/descriptor-D-6Koktu.js +0 -1
- package/dist/ui/assets/directed-approval-D9smLm9q.js +0 -1
- package/dist/ui/assets/engine-BnH9pfmR.js +0 -1
- package/dist/ui/assets/esp8266-BN3fFVWu.js +0 -1
- package/dist/ui/assets/esptool-operations-lUvXx3gs.js +0 -13
- package/dist/ui/assets/feature-flags-Dl-xb1DG.js +0 -1
- package/dist/ui/assets/frozen-archive-format-B4efpvB9.js +0 -1
- package/dist/ui/assets/gelatiere-constants-BYJlhm8R.js +0 -1
- package/dist/ui/assets/gelatiere-store-CE_Ssheh.js +0 -1
- package/dist/ui/assets/gelatiere-unit-BMHtZLOW.js +0 -1
- package/dist/ui/assets/js-realm-worker-AwpbqZPU.js +0 -50
- package/dist/ui/assets/jsh-runtime-extensions-Bcb8_nba.js +0 -1
- package/dist/ui/assets/just-bash-compat-BwD6SoTi.js +0 -1
- package/dist/ui/assets/kernel-worker-BAcS3WAP.js +0 -4673
- package/dist/ui/assets/lick-manager-ULemXDKa.js +0 -2
- package/dist/ui/assets/lick-urls-BZVq_P3x.js +0 -1
- package/dist/ui/assets/lick-ws-bridge-CDToX4F0.js +0 -1
- package/dist/ui/assets/live-session-snapshot-Dv20JKP2.js +0 -1
- package/dist/ui/assets/manager-Bl9b7X9m.js +0 -1
- package/dist/ui/assets/memory-curation-seam-BAJK5Abp.js +0 -1
- package/dist/ui/assets/memory-health-MhSOmzAf.js +0 -1
- package/dist/ui/assets/memory-v2-flag-D85UWdUr.js +0 -1
- package/dist/ui/assets/memory-write-execute-BOjUkUIG.js +0 -1
- package/dist/ui/assets/mount-CTTWc8xh.js +0 -1
- package/dist/ui/assets/mount-recovery-T6cjQxeX.js +0 -2
- package/dist/ui/assets/panel-rpc-handlers-BG91KHPa.js +0 -2
- package/dist/ui/assets/pi-edit-execution-NnXkvjSi.js +0 -2
- package/dist/ui/assets/provider-CbAKIAon.js +0 -1
- package/dist/ui/assets/provider-settings-BuhBOwFs.js +0 -1
- package/dist/ui/assets/provider-store-access-CrH5offR.js +0 -1
- package/dist/ui/assets/provider-store-access-DgZnuRxY.js +0 -1
- package/dist/ui/assets/realm-inprocess-Bmsz-kPh.js +0 -30
- package/dist/ui/assets/record-YqlVEfh_.js +0 -1
- package/dist/ui/assets/run-33hnsiVQ.js +0 -91
- package/dist/ui/assets/screencapture-media-Dc-3ljgR.js +0 -1
- package/dist/ui/assets/screencapture-media-shared-BDUdmMOP.js +0 -1
- package/dist/ui/assets/script-catalog-Bt94D0RP.js +0 -2
- package/dist/ui/assets/skills-DWkSI8sH.js +0 -5
- package/dist/ui/assets/slicc-version-DAFTorvi.js +0 -1
- package/dist/ui/assets/sync-sab-wire-Cacrunmz.js +0 -252
- package/dist/ui/assets/tray-runtime-config-CRZxBChd.js +0 -1
- package/dist/ui/assets/upgrade-detection-CyCnJlGg.js +0 -1
- package/dist/ui/assets/welcome-detection-DjgSxU4V.js +0 -1
- package/dist/ui/assets/write-verification-BOaZdtyk.js +0 -1
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./logger-LESFN7Hj.js";import{n}from"./bridge-protocol-DdqxTTSu.js";import{T as r,c as i,f as a,i as o,l as s,p as c,v as l,x as u,y as d}from"./db-DSIYsBgP.js";function ee(e){if(e==null)return null;if(Array.isArray(e)){let t=e.join(`, `).replace(/\n/g,`, `);return t.length===0?null:t}if(typeof e==`string`){let t=e.replace(/\n/g,`, `);return t.length===0?null:t}return null}function te(e,t){let n=e.length,r=t;for(;t<n&&e[t]!==`;`&&e[t]!==`,`&&!re(e[t]);)t++;return{value:e.slice(r,t),end:t}}function ne(e,t){let n=e.length;return t=h(e,t),t>=n||e[t]!==`=`?{value:``,end:t}:(t++,t=h(e,t),t<n&&e[t]===`"`?ie(e,t):te(e,t))}function f(e,t){let n=e.length,r=t;for(;t<n&&_(e.charCodeAt(t));)t++;return t<n&&e[t]===`*`&&t++,r===t?null:{name:e.slice(r,t).toLowerCase(),end:t}}function p(e,t){let n=[],r=e.length,i=t;for(;i<r&&(i=h(e,i),!(i>=r));){if(e[i]===`,`)return{params:n,endIndex:i+1};if(e[i]!==`;`)return{params:n,endIndex:g(e,i)};i++,i=h(e,i);let t=f(e,i);if(!t)return{params:n,endIndex:g(e,i)};let{value:r,end:a}=ne(e,t.end);n.push([t.name,r]),i=a}return{params:n,endIndex:i}}function m(e,t){let n=ee(e);if(n==null)return[];let r=[],i=n.length,a=0;for(;a<i&&(a=h(n,a),!(a>=i));){if(n[a]!==`<`){a=g(n,a);continue}let e=n.indexOf(`>`,a+1);if(e===-1)break;let i=n.slice(a+1,e),{params:o,endIndex:s}=p(n,e+1);a=s;let c=v(i,o,t);c&&r.push(c)}return r}function h(e,t){for(;t<e.length&&(e[t]===` `||e[t]===` `);)t++;return t}function re(e){return e===` `||e===` `}function g(e,t){let n=!1;for(;t<e.length;){let r=e[t];if(n){if(r===`\\`&&t+1<e.length){t+=2;continue}r===`"`&&(n=!1)}else if(r===`"`)n=!0;else if(r===`,`)return t+1;t++}return t}function ie(e,t){t++;let n=``;for(;t<e.length;){let r=e[t];if(r===`\\`)t++,t<e.length&&(n+=e[t],t++);else if(r===`"`)return{value:n,end:t+1};else n+=r,t++}return{value:n,end:t}}function _(e){if(e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122)return!0;switch(e){case 33:case 35:case 36:case 37:case 38:case 39:case 42:case 43:case 45:case 46:case 94:case 95:case 96:case 124:case 126:return!0}return!1}function v(e,t,n){let r={},i={};for(let[e,n]of t){if(e.endsWith(`*`)){let t=b(n);t!=null&&(i[e.slice(0,-1)]=t);continue}e===`rel`&&`rel`in r||(r[e]=n)}for(let[e,t]of Object.entries(i))r[e]=t;let a=y(e,n),o=r.anchor==null?void 0:y(r.anchor,n),s={href:a,rel:(r.rel??``).split(/[ \t]+/).filter(e=>e.length>0),params:r};return o!=null&&(s.anchor=o),r.type!=null&&(s.type=r.type),r.title!=null&&(s.title=r.title),r.hreflang!=null&&(s.hreflang=r.hreflang),s}function y(e,t){if(!t)return e;try{return new URL(e,t).toString()}catch{return e}}function b(e){let t=e.indexOf(`'`);if(t===-1)return null;let n=e.indexOf(`'`,t+1);if(n===-1||e.slice(0,t).toLowerCase()!==`utf-8`)return null;try{return decodeURIComponent(e.slice(n+1))}catch{return null}}function x(e){if(!e)return[];let t=[];for(let[n,r]of Object.entries(e))n.toLowerCase()===`link`&&typeof r==`string`&&r.length>0&&t.push(r);return t}function S(e){for(let t of e)if(t.rel.includes(`ai-catalog`))return{kind:`ai-catalog`,url:t.href};return null}function C(e){return[e.origin??``,e.kind??``,e.url??``].join(`\0`)}const w=`${n}/rel/handoff`,T=`${n}/rel/upskill`;function E(e){let t=e.replace(/\/+$/,``),n=t.toLowerCase();return n.endsWith(`/skill.md`)?t.slice(0,-9):n===`skill.md`?``:t}const ae=/^[A-Za-z0-9._/-]+$/,oe=/^[A-Za-z0-9._/-]+$/;function D(e){return!(e.length===0||e.length>250||!ae.test(e)||e.startsWith(`-`)||e.startsWith(`/`)||e.endsWith(`/`)||e.includes(`..`)||e.endsWith(`.lock`))}function O(e){return!(e.length===0||e.length>1024||!oe.test(e)||e.startsWith(`-`)||e.startsWith(`/`)||e.includes(`..`))}function se(e,t){let n=t.branch;typeof n==`string`&&D(n)&&(e.branch=n);let r=t.path;if(typeof r==`string`&&r.length>0){let t=E(r);t.length>0&&O(t)&&(e.path=t)}}function k(e){for(let t of e){if(t.rel.includes(w)){let e={verb:`handoff`,target:t.href};return t.title!=null&&t.title.length>0&&(e.instruction=t.title),e}if(t.rel.includes(T)){let e={verb:`upskill`,target:t.href};return t.title!=null&&t.title.length>0&&(e.instruction=t.title),se(e,t.params),e}}return null}function ce(e){return[e.verb,e.target,e.branch??``,e.path??``,e.instruction??``].join(`\0`)}function le(e,t){let n=x(e);if(n.length===0)return{match:null,links:[]};let r=m(n,t);return{match:k(r),links:r}}function A(e){return Date.UTC(e.y,e.m-1,e.d,e.h,e.i,e.s)}function j(e,t){return e.y===t.y&&e.m===t.m&&e.d===t.d&&e.h===t.h&&e.i===t.i&&e.s===t.s}function ue(e,t){let n=new Date(Date.parse(e));if(isNaN(n))throw Error(`Invalid ISO8601 passed to timezone parser.`);let r=e.substring(9);return r.includes(`Z`)||r.includes(`+`)||r.includes(`-`)?F(n.getUTCFullYear(),n.getUTCMonth()+1,n.getUTCDate(),n.getUTCHours(),n.getUTCMinutes(),n.getUTCSeconds(),`Etc/UTC`):F(n.getFullYear(),n.getMonth()+1,n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),t)}function M(e,t,n){return N(ue(e,t),n)}function N(e,t){let n=new Date(A(e)),r=P(n,e.tz),i=A(e)-A(r),a=new Date(n.getTime()+i),o=P(a,e.tz);if(j(o,e)){let t=new Date(a.getTime()-36e5);return j(P(t,e.tz),e)?t:a}let s=new Date(a.getTime()+A(e)-A(o));if(j(P(s,e.tz),e))return s;if(t)throw Error(`Invalid date passed to fromTZ()`);return a.getTime()>s.getTime()?a:s}function P(e,t){let n,r;try{n=new Intl.DateTimeFormat(`en-US`,{timeZone:t,year:`numeric`,month:`numeric`,day:`numeric`,hour:`numeric`,minute:`numeric`,second:`numeric`,hour12:!1}),r=n.formatToParts(e)}catch(e){let n=e instanceof Error?e.message:String(e);throw RangeError(`toTZ: Invalid timezone '${t}' or date. Please provide a valid IANA timezone (e.g., 'America/New_York', 'Europe/Stockholm'). Original error: ${n}`)}let i={year:0,month:0,day:0,hour:0,minute:0,second:0};for(let e of r)(e.type===`year`||e.type===`month`||e.type===`day`||e.type===`hour`||e.type===`minute`||e.type===`second`)&&(i[e.type]=parseInt(e.value,10));if(isNaN(i.year)||isNaN(i.month)||isNaN(i.day)||isNaN(i.hour)||isNaN(i.minute)||isNaN(i.second))throw Error(`toTZ: Failed to parse all date components from timezone '${t}'. This may indicate an invalid date or timezone configuration. Parsed components: ${JSON.stringify(i)}`);return i.hour===24&&(i.hour=0),{y:i.year,m:i.month,d:i.day,h:i.hour,i:i.minute,s:i.second,tz:t}}function F(e,t,n,r,i,a,o){return{y:e,m:t,d:n,h:r,i,s:a,tz:o}}var I=[1,2,4,8,16],L=class{pattern;timezone;mode;alternativeWeekdays;sloppyRanges;second;minute;hour;day;month;dayOfWeek;year;lastDayOfMonth;lastWeekday;nearestWeekdays;starDOM;starDOW;starYear;useAndLogic;constructor(e,t,n){this.pattern=e,this.timezone=t,this.mode=n?.mode??`auto`,this.alternativeWeekdays=n?.alternativeWeekdays??!1,this.sloppyRanges=n?.sloppyRanges??!1,this.second=Array(60).fill(0),this.minute=Array(60).fill(0),this.hour=Array(24).fill(0),this.day=Array(31).fill(0),this.month=Array(12).fill(0),this.dayOfWeek=Array(7).fill(0),this.year=Array(1e4).fill(0),this.lastDayOfMonth=!1,this.lastWeekday=!1,this.nearestWeekdays=Array(31).fill(0),this.starDOM=!1,this.starDOW=!1,this.starYear=!1,this.useAndLogic=!1,this.parse()}parse(){if(!(typeof this.pattern==`string`||this.pattern instanceof String))throw TypeError(`CronPattern: Pattern has to be of type string.`);this.pattern.indexOf(`@`)>=0&&(this.pattern=this.handleNicknames(this.pattern).trim());let e=this.pattern.match(/\S+/g)||[``],t=e.length;if(e.length<5||e.length>7)throw TypeError(`CronPattern: invalid configuration format ('`+this.pattern+`'), exactly five, six, or seven space separated parts are required.`);if(this.mode!==`auto`){let e;switch(this.mode){case`5-part`:e=5;break;case`6-part`:e=6;break;case`7-part`:e=7;break;case`5-or-6-parts`:e=[5,6];break;case`6-or-7-parts`:e=[6,7];break;default:e=0}if(!(Array.isArray(e)?e.includes(t):t===e)){let n=Array.isArray(e)?e.join(` or `):e.toString();throw TypeError(`CronPattern: mode '${this.mode}' requires exactly ${n} parts, but pattern '${this.pattern}' has ${t} parts.`)}}if(e.length===5&&e.unshift(`0`),e.length===6&&e.push(`*`),e[3].toUpperCase()===`LW`?(this.lastWeekday=!0,e[3]=``):e[3].toUpperCase().indexOf(`L`)>=0&&(e[3]=e[3].replace(/L/gi,``),this.lastDayOfMonth=!0),e[3]==`*`&&(this.starDOM=!0),e[6]==`*`&&(this.starYear=!0),e[4].length>=3&&(e[4]=this.replaceAlphaMonths(e[4])),e[5].length>=3&&(e[5]=this.alternativeWeekdays?this.replaceAlphaDaysQuartz(e[5]):this.replaceAlphaDays(e[5])),e[5].startsWith(`+`)&&(this.useAndLogic=!0,e[5]=e[5].substring(1),e[5]===``))throw TypeError(`CronPattern: Day-of-week field cannot be empty after '+' modifier.`);switch(e[5]==`*`&&(this.starDOW=!0),this.pattern.indexOf(`?`)>=0&&(e[0]=e[0].replace(/\?/g,`*`),e[1]=e[1].replace(/\?/g,`*`),e[2]=e[2].replace(/\?/g,`*`),e[3]=e[3].replace(/\?/g,`*`),e[4]=e[4].replace(/\?/g,`*`),e[5]=e[5].replace(/\?/g,`*`),e[6]&&=e[6].replace(/\?/g,`*`)),this.mode){case`5-part`:e[0]=`0`,e[6]=`*`;break;case`6-part`:e[6]=`*`;break;case`5-or-6-parts`:e[6]=`*`}this.throwAtIllegalCharacters(e),this.partToArray(`second`,e[0],0,1),this.partToArray(`minute`,e[1],0,1),this.partToArray(`hour`,e[2],0,1),this.partToArray(`day`,e[3],-1,1),this.partToArray(`month`,e[4],-1,1);let n=this.alternativeWeekdays?-1:0;this.partToArray(`dayOfWeek`,e[5],n,63),this.partToArray(`year`,e[6],0,1),!this.alternativeWeekdays&&this.dayOfWeek[7]&&(this.dayOfWeek[0]=this.dayOfWeek[7])}partToArray(e,t,n,r){let i=this[e],a=e===`day`&&this.lastDayOfMonth,o=e===`day`&&this.lastWeekday;if(t===``&&!a&&!o)throw TypeError(`CronPattern: configuration entry `+e+` (`+t+`) is empty, check for trailing spaces.`);if(t===`*`)return i.fill(r);let s=t.split(`,`);if(s.length>1)for(let t=0;t<s.length;t++)this.partToArray(e,s[t],n,r);else t.indexOf(`-`)!==-1&&t.indexOf(`/`)!==-1?this.handleRangeWithStepping(t,e,n,r):t.indexOf(`-`)===-1?t.indexOf(`/`)===-1?t!==``&&this.handleNumber(t,e,n,r):this.handleStepping(t,e,n,r):this.handleRange(t,e,n,r)}throwAtIllegalCharacters(e){for(let t=0;t<e.length;t++)if((t===3?/[^/*0-9,\-WwLl]+/:t===5?/[^/*0-9,\-#Ll]+/:/[^/*0-9,\-]+/).test(e[t]))throw TypeError(`CronPattern: configuration entry `+t+` (`+e[t]+`) contains illegal characters.`)}handleNumber(e,t,n,r){let i=this.extractNth(e,t),a=e.toUpperCase().includes(`W`);if(t!==`day`&&a)throw TypeError(`CronPattern: Nearest weekday modifier (W) only allowed in day-of-month.`);a&&(t=`nearestWeekdays`);let o=parseInt(i[0],10)+n;if(isNaN(o))throw TypeError(`CronPattern: `+t+` is not a number: '`+e+`'`);this.setPart(t,o,i[1]||r)}setPart(e,t,n){if(!Object.prototype.hasOwnProperty.call(this,e))throw TypeError(`CronPattern: Invalid part specified: `+e);if(e===`dayOfWeek`){if(t===7&&(t=0),t<0||t>6)throw RangeError(`CronPattern: Invalid value for dayOfWeek: `+t);this.setNthWeekdayOfMonth(t,n);return}if(e===`second`||e===`minute`){if(t<0||t>=60)throw RangeError(`CronPattern: Invalid value for `+e+`: `+t)}else if(e===`hour`){if(t<0||t>=24)throw RangeError(`CronPattern: Invalid value for `+e+`: `+t)}else if(e===`day`||e===`nearestWeekdays`){if(t<0||t>=31)throw RangeError(`CronPattern: Invalid value for `+e+`: `+t)}else if(e===`month`){if(t<0||t>=12)throw RangeError(`CronPattern: Invalid value for `+e+`: `+t)}else if(e===`year`&&(t<1||t>=1e4))throw RangeError(`CronPattern: Invalid value for `+e+`: `+t+` (supported range: 1-9999)`);this[e][t]=n}validateNotNaN(e,t){if(isNaN(e))throw TypeError(t)}validateRange(e,t,n,r,i){if(e>t)throw TypeError(`CronPattern: From value is larger than to value: '`+i+`'`);if(n!==void 0){if(n===0)throw TypeError(`CronPattern: Syntax error, illegal stepping: 0`);if(n>this[r].length)throw TypeError(`CronPattern: Syntax error, steps cannot be greater than maximum value of part (`+this[r].length+`)`)}}handleRangeWithStepping(e,t,n,r){if(e.toUpperCase().includes(`W`))throw TypeError(`CronPattern: Syntax error, W is not allowed in ranges with stepping.`);let i=this.extractNth(e,t),a=i[0].match(/^(\d+)-(\d+)\/(\d+)$/);if(a===null)throw TypeError(`CronPattern: Syntax error, illegal range with stepping: '`+e+`'`);let[,o,s,c]=a,l=parseInt(o,10)+n,u=parseInt(s,10)+n,d=parseInt(c,10);this.validateNotNaN(l,`CronPattern: Syntax error, illegal lower range (NaN)`),this.validateNotNaN(u,`CronPattern: Syntax error, illegal upper range (NaN)`),this.validateNotNaN(d,`CronPattern: Syntax error, illegal stepping: (NaN)`),this.validateRange(l,u,d,t,e);for(let e=l;e<=u;e+=d)this.setPart(t,e,i[1]||r)}extractNth(e,t){let n=e,r;if(n.includes(`#`)){if(t!==`dayOfWeek`)throw Error(`CronPattern: nth (#) only allowed in day-of-week field`);r=n.split(`#`)[1],n=n.split(`#`)[0]}else if(n.toUpperCase().endsWith(`L`)){if(t!==`dayOfWeek`)throw Error(`CronPattern: L modifier only allowed in day-of-week field (use L alone for day-of-month)`);r=`L`,n=n.slice(0,-1)}return[n,r]}handleRange(e,t,n,r){if(e.toUpperCase().includes(`W`))throw TypeError(`CronPattern: Syntax error, W is not allowed in a range.`);let i=this.extractNth(e,t),a=i[0].split(`-`);if(a.length!==2)throw TypeError(`CronPattern: Syntax error, illegal range: '`+e+`'`);let o=parseInt(a[0],10)+n,s=parseInt(a[1],10)+n;this.validateNotNaN(o,`CronPattern: Syntax error, illegal lower range (NaN)`),this.validateNotNaN(s,`CronPattern: Syntax error, illegal upper range (NaN)`),this.validateRange(o,s,void 0,t,e);for(let e=o;e<=s;e++)this.setPart(t,e,i[1]||r)}handleStepping(e,t,n,r){if(e.toUpperCase().includes(`W`))throw TypeError(`CronPattern: Syntax error, W is not allowed in parts with stepping.`);let i=this.extractNth(e,t),a=i[0].split(`/`);if(a.length!==2)throw TypeError(`CronPattern: Syntax error, illegal stepping: '`+e+`'`);if(this.sloppyRanges)a[0]===``&&(a[0]=`*`);else{if(a[0]===``)throw TypeError(`CronPattern: Syntax error, stepping with missing prefix ('`+e+`') is not allowed. Use wildcard (*/step) or range (min-max/step) instead.`);if(a[0]!==`*`)throw TypeError(`CronPattern: Syntax error, stepping with numeric prefix ('`+e+`') is not allowed. Use wildcard (*/step) or range (min-max/step) instead.`)}let o=0;a[0]!==`*`&&(o=parseInt(a[0],10)+n);let s=parseInt(a[1],10);this.validateNotNaN(s,`CronPattern: Syntax error, illegal stepping: (NaN)`),this.validateRange(0,this[t].length-1,s,t,e);for(let e=o;e<this[t].length;e+=s)this.setPart(t,e,i[1]||r)}replaceAlphaDays(e){return e.replace(/-sun/gi,`-7`).replace(/sun/gi,`0`).replace(/mon/gi,`1`).replace(/tue/gi,`2`).replace(/wed/gi,`3`).replace(/thu/gi,`4`).replace(/fri/gi,`5`).replace(/sat/gi,`6`)}replaceAlphaDaysQuartz(e){return e.replace(/sun/gi,`1`).replace(/mon/gi,`2`).replace(/tue/gi,`3`).replace(/wed/gi,`4`).replace(/thu/gi,`5`).replace(/fri/gi,`6`).replace(/sat/gi,`7`)}replaceAlphaMonths(e){return e.replace(/jan/gi,`1`).replace(/feb/gi,`2`).replace(/mar/gi,`3`).replace(/apr/gi,`4`).replace(/may/gi,`5`).replace(/jun/gi,`6`).replace(/jul/gi,`7`).replace(/aug/gi,`8`).replace(/sep/gi,`9`).replace(/oct/gi,`10`).replace(/nov/gi,`11`).replace(/dec/gi,`12`)}handleNicknames(e){let t=e.trim().toLowerCase();if(t===`@yearly`||t===`@annually`)return`0 0 1 1 *`;if(t===`@monthly`)return`0 0 1 * *`;if(t===`@weekly`)return`0 0 * * 0`;if(t===`@daily`||t===`@midnight`)return`0 0 * * *`;if(t===`@hourly`)return`0 * * * *`;if(t===`@reboot`)throw TypeError(`CronPattern: @reboot is not supported in this environment. This is an event-based trigger that requires system startup detection.`);return e}setNthWeekdayOfMonth(e,t){if(typeof t!=`number`&&t.toUpperCase()===`L`)this.dayOfWeek[e]=this.dayOfWeek[e]|32;else if(t===63)this.dayOfWeek[e]=63;else if(t<6&&t>0)this.dayOfWeek[e]=this.dayOfWeek[e]|I[t-1];else throw TypeError(`CronPattern: nth weekday out of range, should be 1-5 or L. Value: ${t}, Type: ${typeof t}`)}},R=[31,28,31,30,31,30,31,31,30,31,30,31],z=[[`month`,`year`,0],[`day`,`month`,-1],[`hour`,`day`,0],[`minute`,`hour`,0],[`second`,`minute`,0]],B=class e{tz;ms;second;minute;hour;day;month;year;constructor(t,n){if(this.tz=n,t&&t instanceof Date){if(!isNaN(t))this.fromDate(t);else throw TypeError(`CronDate: Invalid date passed to CronDate constructor`)}else if(t==null)this.fromDate(new Date);else if(t&&typeof t==`string`)this.fromString(t);else if(t instanceof e)this.fromCronDate(t);else throw TypeError(`CronDate: Invalid type (`+typeof t+`) passed to CronDate constructor`)}getLastDayOfMonth(e,t){return t===1?new Date(Date.UTC(e,t+1,0)).getUTCDate():R[t]}getLastWeekday(e,t){let n=this.getLastDayOfMonth(e,t),r=new Date(Date.UTC(e,t,n)).getUTCDay();return r===0?n-2:r===6?n-1:n}getNearestWeekday(e,t,n){let r=this.getLastDayOfMonth(e,t);if(n>r)return-1;let i=new Date(Date.UTC(e,t,n)).getUTCDay();return i===0?n===r?n-2:n+1:i===6?n===1?n+2:n-1:n}isNthWeekdayOfMonth(e,t,n,r){let i=new Date(Date.UTC(e,t,n)).getUTCDay(),a=0;for(let r=1;r<=n;r++)new Date(Date.UTC(e,t,r)).getUTCDay()===i&&a++;if(r&63&&I[a-1]&r)return!0;if(r&32){let r=this.getLastDayOfMonth(e,t);for(let a=n+1;a<=r;a++)if(new Date(Date.UTC(e,t,a)).getUTCDay()===i)return!1;return!0}return!1}fromDate(e){if(this.tz!==void 0){if(typeof this.tz==`number`)this.ms=e.getUTCMilliseconds(),this.second=e.getUTCSeconds(),this.minute=e.getUTCMinutes()+this.tz,this.hour=e.getUTCHours(),this.day=e.getUTCDate(),this.month=e.getUTCMonth(),this.year=e.getUTCFullYear(),this.apply();else try{let t=P(e,this.tz);this.ms=e.getMilliseconds(),this.second=t.s,this.minute=t.i,this.hour=t.h,this.day=t.d,this.month=t.m-1,this.year=t.y}catch(e){let t=e instanceof Error?e.message:String(e);throw TypeError(`CronDate: Failed to convert date to timezone '${this.tz}'. This may happen with invalid timezone names or dates. Original error: ${t}`)}}else this.ms=e.getMilliseconds(),this.second=e.getSeconds(),this.minute=e.getMinutes(),this.hour=e.getHours(),this.day=e.getDate(),this.month=e.getMonth(),this.year=e.getFullYear()}fromCronDate(e){this.tz=e.tz,this.year=e.year,this.month=e.month,this.day=e.day,this.hour=e.hour,this.minute=e.minute,this.second=e.second,this.ms=e.ms}apply(){if(this.month>11||this.month<0||this.day>R[this.month]||this.day<1||this.hour>59||this.minute>59||this.second>59||this.hour<0||this.minute<0||this.second<0){let e=new Date(Date.UTC(this.year,this.month,this.day,this.hour,this.minute,this.second,this.ms));return this.ms=e.getUTCMilliseconds(),this.second=e.getUTCSeconds(),this.minute=e.getUTCMinutes(),this.hour=e.getUTCHours(),this.day=e.getUTCDate(),this.month=e.getUTCMonth(),this.year=e.getUTCFullYear(),!0}return!1}fromString(e){if(typeof this.tz==`number`){let t=M(e);this.ms=t.getUTCMilliseconds(),this.second=t.getUTCSeconds(),this.minute=t.getUTCMinutes(),this.hour=t.getUTCHours(),this.day=t.getUTCDate(),this.month=t.getUTCMonth(),this.year=t.getUTCFullYear(),this.apply()}else return this.fromDate(M(e,this.tz))}findNext(e,t,n,r){return this._findMatch(e,t,n,r,1)}_findMatch(e,t,n,r,i){let a=this[t],o;n.lastDayOfMonth&&(o=this.getLastDayOfMonth(this.year,this.month));let s=!n.starDOW&&t==`day`?new Date(Date.UTC(this.year,this.month,1,0,0,0,0)).getUTCDay():void 0,c=this[t]+r,l=i===1?e=>e<n[t].length:e=>e>=0;for(let u=c;l(u);u+=i){let i=n[t][u];if(t===`day`&&!i){for(let e=0;e<n.nearestWeekdays.length;e++)if(n.nearestWeekdays[e]){let t=this.getNearestWeekday(this.year,this.month,e-r);if(t===-1)continue;if(t===u-r){i=1;break}}}if(t===`day`&&n.lastWeekday){let e=this.getLastWeekday(this.year,this.month);u-r===e&&(i=1)}if(t===`day`&&n.lastDayOfMonth&&u-r==o&&(i=1),t===`day`&&!n.starDOW){let t=n.dayOfWeek[(s+(u-r-1))%7];if(t&&t&63)t=+!!this.isNthWeekdayOfMonth(this.year,this.month,u-r,t);else if(t)throw Error(`CronDate: Invalid value for dayOfWeek encountered. ${t}`);n.useAndLogic?i&&=t:!e.domAndDow&&!n.starDOM?i||=t:i&&=t}if(i)return this[t]=u-r,a===this[t]?1:2}return 3}recurse(e,t,n){if(n===0&&!e.starYear){if(this.year>=0&&this.year<e.year.length&&e.year[this.year]===0){let t=-1;for(let n=this.year+1;n<e.year.length&&n<1e4;n++)if(e.year[n]===1){t=n;break}if(t===-1)return null;this.year=t,this.month=0,this.day=1,this.hour=0,this.minute=0,this.second=0,this.ms=0}if(this.year>=1e4)return null}let r=this.findNext(t,z[n][0],e,z[n][2]);if(r>1){let i=n+1;for(;i<z.length;)this[z[i][0]]=-z[i][2],i++;if(r===3){if(this[z[n][1]]++,this[z[n][0]]=-z[n][2],this.apply(),n===0&&!e.starYear){for(;this.year>=0&&this.year<e.year.length&&e.year[this.year]===0&&this.year<1e4;)this.year++;if(this.year>=1e4||this.year>=e.year.length)return null}return this.recurse(e,t,0)}if(this.apply())return this.recurse(e,t,n-1)}return n+=1,n>=z.length?this:(e.starYear?this.year>=3e3:this.year>=1e4)?null:this.recurse(e,t,n)}increment(e,t,n){return this.second+=t.interval!==void 0&&t.interval>1&&n?t.interval:1,this.ms=0,this.apply(),this.recurse(e,t,0)}decrement(e,t){return this.second-=t.interval!==void 0&&t.interval>1?t.interval:1,this.ms=0,this.apply(),this.recurseBackward(e,t,0,0)}recurseBackward(e,t,n,r=0){if(r>1e4)return null;if(n===0&&!e.starYear){if(this.year>=0&&this.year<e.year.length&&e.year[this.year]===0){let t=-1;for(let n=this.year-1;n>=0;n--)if(e.year[n]===1){t=n;break}if(t===-1)return null;this.year=t,this.month=11,this.day=31,this.hour=23,this.minute=59,this.second=59,this.ms=0}if(this.year<0)return null}let i=this.findPrevious(t,z[n][0],e,z[n][2]);if(i>1){let a=n+1;for(;a<z.length;){let t=z[a][0],n=z[a][2],r=this.getMaxPatternValue(t,e,n);this[t]=r,a++}if(i===3){if(this[z[n][1]]--,n===0){let e=this.getLastDayOfMonth(this.year,this.month);this.day>e&&(this.day=e)}if(n===1){if(this.day<=0)this.day=1;else{let e=this.year,t=this.month;for(;t<0;)t+=12,e--;for(;t>11;)t-=12,e++;let n=t===1?new Date(Date.UTC(e,t+1,0)).getUTCDate():R[t];this.day>n&&(this.day=n)}}this.apply();let i=z[n][0],a=z[n][2],o=this.getMaxPatternValue(i,e,a);if(i===`day`){let e=this.getLastDayOfMonth(this.year,this.month);this[i]=Math.min(o,e)}else this[i]=o;if(this.apply(),n===0){let t=z[1][2],n=this.getMaxPatternValue(`day`,e,t),r=this.getLastDayOfMonth(this.year,this.month),i=Math.min(n,r);i!==this.day&&(this.day=i,this.hour=this.getMaxPatternValue(`hour`,e,z[2][2]),this.minute=this.getMaxPatternValue(`minute`,e,z[3][2]),this.second=this.getMaxPatternValue(`second`,e,z[4][2]))}if(n===0&&!e.starYear){for(;this.year>=0&&this.year<e.year.length&&e.year[this.year]===0;)this.year--;if(this.year<0)return null}return this.recurseBackward(e,t,0,r+1)}if(this.apply())return this.recurseBackward(e,t,n-1,r+1)}return n+=1,n>=z.length?this:this.year<0?null:this.recurseBackward(e,t,n,r+1)}getMaxPatternValue(e,t,n){if(e===`day`&&t.lastDayOfMonth||e===`day`&&!t.starDOW)return this.getLastDayOfMonth(this.year,this.month);for(let r=t[e].length-1;r>=0;r--)if(t[e][r])return r-n;return t[e].length-1-n}findPrevious(e,t,n,r){return this._findMatch(e,t,n,r,-1)}getDate(e){return e||this.tz===void 0?new Date(this.year,this.month,this.day,this.hour,this.minute,this.second,this.ms):typeof this.tz==`number`?new Date(Date.UTC(this.year,this.month,this.day,this.hour,this.minute-this.tz,this.second,this.ms)):N(F(this.year,this.month+1,this.day,this.hour,this.minute,this.second,this.tz),!1)}getTime(){return this.getDate(!1).getTime()}match(e,t){if(!e.starYear&&(this.year<0||this.year>=e.year.length||e.year[this.year]===0))return!1;for(let n=0;n<z.length;n++){let r=z[n][0],i=z[n][2],a=this[r];if(a+i<0||a+i>=e[r].length)return!1;let o=e[r][a+i];if(r===`day`){if(!o){for(let t=0;t<e.nearestWeekdays.length;t++)if(e.nearestWeekdays[t]){let e=this.getNearestWeekday(this.year,this.month,t-i);if(e!==-1&&e===a){o=1;break}}}if(e.lastWeekday&&a===this.getLastWeekday(this.year,this.month)&&(o=1),e.lastDayOfMonth&&a===this.getLastDayOfMonth(this.year,this.month)&&(o=1),!e.starDOW){let n=new Date(Date.UTC(this.year,this.month,1,0,0,0,0)).getUTCDay(),r=e.dayOfWeek[(n+(a-1))%7];r&&r&63&&(r=+!!this.isNthWeekdayOfMonth(this.year,this.month,a,r)),e.useAndLogic?o&&=r:!t.domAndDow&&!e.starDOM?o||=r:o&&=r}}if(!o)return!1}return!0}};function V(e){if(e===void 0&&(e={}),delete e.name,e.legacyMode!==void 0&&e.domAndDow===void 0?e.domAndDow=!e.legacyMode:e.domAndDow===void 0&&(e.domAndDow=!1),e.legacyMode=!e.domAndDow,e.paused=e.paused!==void 0&&e.paused,e.maxRuns=e.maxRuns===void 0?1/0:e.maxRuns,e.catch=e.catch!==void 0&&e.catch,e.interval=e.interval===void 0?0:parseInt(e.interval.toString(),10),e.utcOffset=e.utcOffset===void 0?void 0:parseInt(e.utcOffset.toString(),10),e.dayOffset=e.dayOffset===void 0?0:parseInt(e.dayOffset.toString(),10),e.unref=e.unref!==void 0&&e.unref,e.mode=e.mode===void 0?`auto`:e.mode,e.alternativeWeekdays=e.alternativeWeekdays!==void 0&&e.alternativeWeekdays,e.sloppyRanges=e.sloppyRanges!==void 0&&e.sloppyRanges,![`auto`,`5-part`,`6-part`,`7-part`,`5-or-6-parts`,`6-or-7-parts`].includes(e.mode))throw Error(`CronOptions: mode must be one of 'auto', '5-part', '6-part', '7-part', '5-or-6-parts', or '6-or-7-parts'.`);if(e.startAt&&(e.startAt=new B(e.startAt,e.timezone)),e.stopAt&&(e.stopAt=new B(e.stopAt,e.timezone)),e.interval!==null){if(isNaN(e.interval))throw Error(`CronOptions: Supplied value for interval is not a number`);if(e.interval<0)throw Error(`CronOptions: Supplied value for interval can not be negative`)}if(e.utcOffset!==void 0){if(isNaN(e.utcOffset))throw Error(`CronOptions: Invalid value passed for utcOffset, should be number representing minutes offset from UTC.`);if(e.utcOffset<-870||e.utcOffset>870)throw Error(`CronOptions: utcOffset out of bounds.`);if(e.utcOffset!==void 0&&e.timezone)throw Error(`CronOptions: Combining 'utcOffset' with 'timezone' is not allowed.`)}if(e.unref!==!0&&e.unref!==!1)throw Error(`CronOptions: Unref should be either true, false or undefined(false).`);if(e.dayOffset!==void 0&&e.dayOffset!==0&&isNaN(e.dayOffset))throw Error(`CronOptions: Invalid value passed for dayOffset, should be a number representing days to offset.`);return e}function H(e){return Object.prototype.toString.call(e)===`[object Function]`||typeof e==`function`||e instanceof Function}function de(e){return H(e)}function fe(e){typeof Deno<`u`&&typeof Deno.unrefTimer<`u`?Deno.unrefTimer(e):e&&typeof e.unref<`u`&&e.unref()}var U=3e4,W=[],pe=class{name;options;_states;fn;getTz(){return this.options.timezone||this.options.utcOffset}applyDayOffset(e){if(this.options.dayOffset!==void 0&&this.options.dayOffset!==0){let t=this.options.dayOffset*24*60*60*1e3;return new Date(e.getTime()+t)}return e}constructor(e,t,n){let r,i;if(H(t))i=t;else if(typeof t==`object`)r=t;else if(t!==void 0)throw Error(`Cron: Invalid argument passed for optionsIn. Should be one of function, or object (options).`);if(H(n))i=n;else if(typeof n==`object`)r=n;else if(n!==void 0)throw Error(`Cron: Invalid argument passed for funcIn. Should be one of function, or object (options).`);if(this.name=r?.name,this.options=V(r),this._states={kill:!1,blocking:!1,previousRun:void 0,currentRun:void 0,once:void 0,currentTimeout:void 0,maxRuns:r?r.maxRuns:void 0,paused:r?r.paused:!1,pattern:new L(`* * * * *`,void 0,{mode:`auto`})},e&&(e instanceof Date||typeof e==`string`&&e.indexOf(`:`)>0)?this._states.once=new B(e,this.getTz()):this._states.pattern=new L(e,this.options.timezone,{mode:this.options.mode,alternativeWeekdays:this.options.alternativeWeekdays,sloppyRanges:this.options.sloppyRanges}),this.name){if(W.find(e=>e.name===this.name))throw Error(`Cron: Tried to initialize new named job '`+this.name+`', but name already taken.`);W.push(this)}return i!==void 0&&de(i)&&(this.fn=i,this.schedule()),this}nextRun(e){let t=this._next(e);return t?this.applyDayOffset(t.getDate(!1)):null}nextRuns(e,t){this._states.maxRuns!==void 0&&e>this._states.maxRuns&&(e=this._states.maxRuns);let n=t||this._states.currentRun||void 0;return this._enumerateRuns(e,n,`next`)}previousRuns(e,t){return this._enumerateRuns(e,t||void 0,`previous`)}_enumerateRuns(e,t,n){let r=[],i=t?new B(t,this.getTz()):null,a=n===`next`?this._next:this._previous;for(;e--;){let e=a.call(this,i);if(!e)break;let t=e.getDate(!1);r.push(this.applyDayOffset(t)),i=e}return r}match(e){if(this._states.once){let t=new B(e,this.getTz());t.ms=0;let n=new B(this._states.once,this.getTz());return n.ms=0,t.getTime()===n.getTime()}let t=new B(e,this.getTz());return t.ms=0,t.match(this._states.pattern,this.options)}getPattern(){if(!this._states.once)return this._states.pattern?this._states.pattern.pattern:void 0}getOnce(){return this._states.once?this._states.once.getDate():null}isRunning(){let e=this.nextRun(this._states.currentRun),t=!this._states.paused,n=this.fn!==void 0,r=!this._states.kill;return t&&n&&r&&e!==null}isStopped(){return this._states.kill}isBusy(){return this._states.blocking}currentRun(){return this._states.currentRun?this._states.currentRun.getDate():null}previousRun(){return this._states.previousRun?this._states.previousRun.getDate():null}msToNext(e){let t=this._next(e);return t?e instanceof B||e instanceof Date?t.getTime()-e.getTime():t.getTime()-new B(e).getTime():null}stop(){this._states.kill=!0,this._states.currentTimeout&&clearTimeout(this._states.currentTimeout);let e=W.indexOf(this);e>=0&&W.splice(e,1)}pause(){return this._states.paused=!0,!this._states.kill}resume(){return this._states.paused=!1,!this._states.kill}schedule(e){if(e&&this.fn)throw Error(`Cron: It is not allowed to schedule two functions using the same Croner instance.`);e&&(this.fn=e);let t=this.msToNext(),n=this.nextRun(this._states.currentRun);return t==null||isNaN(t)||n===null?this:(t>U&&(t=U),this._states.currentTimeout=setTimeout(()=>this._checkTrigger(n),t),this._states.currentTimeout&&this.options.unref&&fe(this._states.currentTimeout),this)}async _trigger(e){this._states.blocking=!0,this._states.currentRun=new B(void 0,this.getTz());try{if(this.options.catch)try{this.fn!==void 0&&await this.fn(this,this.options.context)}catch(e){if(H(this.options.catch))try{this.options.catch(e,this)}catch{}}else this.fn!==void 0&&await this.fn(this,this.options.context)}finally{this._states.previousRun=new B(e,this.getTz()),this._states.blocking=!1}}async trigger(){await this._trigger()}runsLeft(){return this._states.maxRuns}_checkTrigger(e){let t=new Date,n=!this._states.paused&&t.getTime()>=e.getTime(),r=this._states.blocking&&this.options.protect;n&&!r?(this._states.maxRuns!==void 0&&this._states.maxRuns--,this._trigger()):n&&r&&H(this.options.protect)&&setTimeout(()=>this.options.protect(this),0),this.schedule()}_next(e){let t=!!(e||this._states.currentRun),n=!1;!e&&this.options.startAt&&this.options.interval&&([e,t]=this._calculatePreviousRun(e,t),n=!e),e=new B(e,this.getTz()),this.options.startAt&&e&&e.getTime()<this.options.startAt.getTime()&&(e=this.options.startAt);let r=this._states.once||new B(e,this.getTz());return!n&&r!==this._states.once&&(r=r.increment(this._states.pattern,this.options,t)),this._states.once&&this._states.once.getTime()<=e.getTime()||r===null||this._states.maxRuns!==void 0&&this._states.maxRuns<=0||this._states.kill||this.options.stopAt&&r.getTime()>=this.options.stopAt.getTime()?null:r}_previous(e){let t=new B(e,this.getTz());this.options.stopAt&&t.getTime()>this.options.stopAt.getTime()&&(t=this.options.stopAt);let n=new B(t,this.getTz());return this._states.once?this._states.once.getTime()<t.getTime()?this._states.once:null:(n=n.decrement(this._states.pattern,this.options),n===null||this.options.startAt&&n.getTime()<this.options.startAt.getTime()?null:n)}_calculatePreviousRun(e,t){let n=new B(void 0,this.getTz()),r=e;if(this.options.startAt.getTime()<=n.getTime()){r=this.options.startAt;let e=r.getTime()+this.options.interval*1e3;for(;e<=n.getTime();)r=new B(r,this.getTz()).increment(this._states.pattern,this.options,!0),e=r.getTime()+this.options.interval*1e3;t=!0}return r===null&&(r=void 0),[r,t]}};function G(e,t){try{return new pe(e.trim(),{domAndDow:!0}).nextRun(t)??null}catch{return null}}var me=e({FORWARDABLE_TO_LEADER:()=>q,LickManager:()=>Y,buildActiveLicksError:()=>Q,getLickManager:()=>ge,lickScoopMatches:()=>X,lickTargetCandidates:()=>Z});const K=t(`lick-manager`),q=new Set([`navigate`,`discovery`]);function J(e){if(typeof e!=`object`||!e)return null;let t=e;return typeof t.verb!=`string`||typeof t.target!=`string`?null:ce({verb:t.verb,target:t.target,branch:typeof t.branch==`string`?t.branch:void 0,path:typeof t.path==`string`?t.path:void 0,instruction:typeof t.instruction==`string`?t.instruction:void 0})}function he(e){return!e.discoveryKind&&!e.discoveryUrl&&!e.discoveryOrigin?null:C({origin:e.discoveryOrigin,kind:e.discoveryKind,url:e.discoveryUrl})}var Y=class{webhooks=new Map;crontasks=new Map;cronInterval=null;eventHandler=null;forwarder=null;seenNavigateFingerprints=new Set;seenDiscoveryFingerprints=new Set;unitRoster=null;discoveryIgnore=null;async init(){await d();let e=await a();for(let t of e)this.webhooks.set(t.id,t);K.info(`Loaded webhooks`,{count:this.webhooks.size});let t=await s();for(let e of t)this.crontasks.set(e.id,e);K.info(`Loaded crontasks`,{count:this.crontasks.size}),await this.reconcileOrphans(),this.cronInterval=setInterval(()=>this.runCronScheduler(),6e4),K.info(`Cron scheduler started`)}setUnitRosterProvider(e){this.unitRoster=e}resolveLickTarget(e){let t=this.unitRoster?.();return t?t.some(t=>X(e,t.name,t.folder))?{status:`resolved`}:{status:`unresolved`,candidates:Z(t)}:{status:`unverifiable`}}setDiscoveryIgnore(e){this.discoveryIgnore=e}isOrphanedLick(e){return e?this.resolveLickTarget(e).status===`unresolved`:!1}async reconcileOrphans(){if(this.unitRoster){for(let e of Array.from(this.webhooks.values()))if(this.isOrphanedLick(e.scoop)){K.warn(`Removing orphaned webhook at init; target scoop no longer exists`,{id:e.id,name:e.name,scoop:e.scoop}),this.webhooks.delete(e.id);try{await i(e.id)}catch(t){K.warn(`Failed to delete orphaned webhook from DB`,{id:e.id,error:t instanceof Error?t.message:String(t)})}}for(let e of Array.from(this.crontasks.values()))if(this.isOrphanedLick(e.scoop)){K.warn(`Removing orphaned cron task at init; target scoop no longer exists`,{id:e.id,name:e.name,scoop:e.scoop}),this.crontasks.delete(e.id);try{await o(e.id)}catch(t){K.warn(`Failed to delete orphaned cron task from DB`,{id:e.id,error:t instanceof Error?t.message:String(t)})}}}}dispose(){this.cronInterval&&=(clearInterval(this.cronInterval),null)}setEventHandler(e){this.eventHandler=e}setForwarder(e){this.forwarder=e}dispatch(e){if(!(e.type===`discovery`&&this.shouldSuppressDiscovery(e))){if(this.forwarder&&q.has(e.type)){this.forwarder(e);return}this.eventHandler?.(e)}}handleForwardedEvent(e){e.type===`discovery`&&this.shouldSuppressDiscovery(e)||this.isDuplicateFingerprint(e)||this.eventHandler?.(e)}emitEvent(e){e.type===`discovery`&&this.shouldSuppressDiscovery(e)||this.isDuplicateFingerprint(e)||(K.info(`External lick event`,{type:e.type,target:e.targetScoop}),this.dispatch(e))}isDuplicateFingerprint(e){let t=null,n,r;if(e.type===`navigate`)t=J(e.body),n=this.seenNavigateFingerprints,r=`navigate`;else if(e.type===`discovery`)t=he(e),n=this.seenDiscoveryFingerprints,r=`discovery`;else return!1;return t===null?!1:n.has(t)?(K.debug(`Suppressing duplicate ${r} lick`,{fingerprint:t}),!0):(n.add(t),!1)}shouldSuppressDiscovery(e){return e.discoverySource===`live-navigation`?this.discoveryIgnore?.(e)?(K.debug(`Suppressing ignored llms.txt discovery`,{origin:e.discoveryOrigin}),!0):!1:(K.debug(`Suppressing discovery without live-navigation provenance`),!0)}async createWebhook(e,t,n){let i=this.generateId(),a={id:i,name:e,createdAt:new Date().toISOString(),filter:n,scoop:t};return n&&this.compileFilter(n,!0),this.webhooks.set(i,a),await r(a),K.info(`Webhook created`,{id:i,name:e,scoop:t}),a}async deleteWebhook(e){return this.webhooks.has(e)?(this.webhooks.delete(e),await i(e),K.info(`Webhook deleted`,{id:e}),!0):await l(e)!==null&&(await i(e),K.info(`Webhook deleted`,{id:e}),!0)}listWebhooks(){return Array.from(this.webhooks.values())}getWebhook(e){return this.webhooks.get(e)}handleWebhookEvent(e,t,n){let r=this.webhooks.get(e);if(!r)return K.warn(`Webhook not found`,{webhookId:e}),`unknown-webhook`;if(this.isOrphanedLick(r.scoop))return K.warn(`Webhook target scoop not found — dropping delivery`,{webhookId:e,name:r.name,scoop:r.scoop}),`unresolved-target`;let i={type:`webhook`,webhookId:e,webhookName:r.name,targetScoop:r.scoop,timestamp:new Date().toISOString(),headers:t,body:n};if(r.filter)try{let t=this.compileFilter(r.filter,!0)(i);if(t===!1)return K.debug(`Webhook event dropped by filter`,{webhookId:e,name:r.name}),`filtered`;typeof t==`object`&&t&&(i=t)}catch(t){K.error(`Webhook filter error`,{webhookId:e,error:t instanceof Error?t.message:String(t)})}return K.info(`Webhook event received`,{webhookId:e,name:r.name,targetScoop:r.scoop}),this.dispatch(i),`delivered`}async createCronTask(e,t,n,r){let i=G(t,new Date);if(!i)throw Error(`Invalid cron expression`);r&&this.compileFilter(r,!1);let a=this.generateId(),o={id:a,name:e,cron:t,scoop:n,filter:r,nextRun:i.toISOString(),lastRun:null,status:`active`,createdAt:new Date().toISOString()};return this.crontasks.set(a,o),await u(o),K.info(`Cron task created`,{id:a,name:e,cron:t,scoop:n}),o}async deleteCronTask(e){return this.crontasks.has(e)?(this.crontasks.delete(e),await o(e),K.info(`Cron task deleted`,{id:e}),!0):await c(e)!==null&&(await o(e),K.info(`Cron task deleted`,{id:e}),!0)}listCronTasks(){return Array.from(this.crontasks.values())}getCronTask(e){return this.crontasks.get(e)}getLicksForScoop(e,t){return{webhooks:Array.from(this.webhooks.values()).filter(n=>X(n.scoop,e,t)),cronTasks:Array.from(this.crontasks.values()).filter(n=>X(n.scoop,e,t))}}async getLicksForScoopFromDb(e,t){let[n,r]=await Promise.all([a(),s()]);return{webhooks:n.filter(n=>X(n.scoop,e,t)),cronTasks:r.filter(n=>X(n.scoop,e,t))}}async deleteIfOrphanedCron(e){if(!this.isOrphanedLick(e.scoop))return!1;K.warn(`Deleting orphaned cron task; target scoop no longer exists`,{id:e.id,name:e.name,scoop:e.scoop}),this.crontasks.delete(e.id);try{await o(e.id)}catch(t){K.warn(`Failed to delete orphaned cron task from DB`,{id:e.id,error:t instanceof Error?t.message:String(t)})}return!0}async runCronScheduler(){let e=new Date;for(let t of this.crontasks.values())await this.deleteIfOrphanedCron(t)||t.status===`active`&&t.nextRun&&(new Date(t.nextRun)>e||await this.runDueCronTask(t,e))}async runDueCronTask(e,t){let n={time:t.toISOString()};if(e.filter)try{let r=this.compileFilter(e.filter,!1)(null);if(r===!1){K.debug(`Cron task skipped by filter`,{id:e.id,name:e.name}),e.nextRun=G(e.cron,t)?.toISOString()??null,e.lastRun=t.toISOString(),await u(e);return}typeof r==`object`&&r&&(n=r)}catch(t){K.error(`Cron filter error`,{id:e.id,error:t instanceof Error?t.message:String(t)})}let r={type:`cron`,cronId:e.id,cronName:e.name,targetScoop:e.scoop,timestamp:t.toISOString(),body:n};K.info(`Cron task running`,{id:e.id,name:e.name}),this.dispatch(r),e.nextRun=G(e.cron,t)?.toISOString()??null,e.lastRun=t.toISOString(),await u(e)}generateId(){let e=``;for(let t=0;t<12;t++)e+=`abcdefghijklmnopqrstuvwxyz0123456789`[Math.floor(Math.random()*36)];return e}compileFilter(e,t){try{return t?Function(`event`,`return (${e})(event);`):Function(`return (${e})();`)}catch(e){throw Error(`Invalid filter function: ${e instanceof Error?e.message:String(e)}`)}}};function X(e,t,n){return e?e===t||e===n||`${e}-scoop`===n:!1}function Z(e){let t=new Set;for(let n of e)t.add(n.folder),n.name&&n.name!==n.folder&&t.add(n.name);return Array.from(t)}function Q(e,t,n){if(t.length===0&&n.length===0)return null;let r=[];t.length>0&&r.push(`${t.length} active webhook${t.length>1?`s`:``}`),n.length>0&&r.push(`${n.length} active cron task${n.length>1?`s`:``}`);let i=[...t.map(e=>` webhook delete ${e.id}`),...n.map(e=>` crontask delete ${e.id}`)].join(`
|
|
2
|
-
`);return Error(`Cannot remove scoop '${e}': it has ${r.join(` and `)}. Unregister them first:\n${i}`)}let $=null;function ge(){return $||=new Y,$}export{k as a,O as c,T as i,S as l,me as n,le as o,G as r,D as s,Q as t,m as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./logger-LESFN7Hj.js";import"./tray-runtime-config-CRZxBChd.js";const t=`slicc.followerTrayStatus`;function n(e){try{let t=globalThis.localStorage?.getItem(e);if(!t)return null;let n=JSON.parse(t);return typeof n?.state==`string`?n.state:null}catch{return null}}function r(){let e=n(t);return e!==null&&e!==`inactive`?`follower`:n(`slicc.leaderTrayStatus`)===`leader`?`leader`:`standalone`}let i={state:`inactive`,session:null,error:null};function a(e){return e?{workerBaseUrl:e.workerBaseUrl,trayId:e.trayId,createdAt:e.createdAt,controllerId:e.controllerId,controllerUrl:e.controllerUrl,joinUrl:e.joinUrl,webhookUrl:e.webhookUrl,runtime:e.runtime,...e.leaderKey===void 0?{}:{leaderKey:e.leaderKey},...e.leaderWebSocketUrl===void 0?{}:{leaderWebSocketUrl:e.leaderWebSocketUrl},...e.coneId===void 0?{}:{coneId:e.coneId}}:null}function o(){return{...i,session:a(i.session)}}function s(){let e=o();if(e.state!==`inactive`)return e;try{let e=globalThis.localStorage?.getItem(`slicc.leaderTrayStatus`);if(e){let t=JSON.parse(e);if(t?.state&&t.state!==`inactive`)return{...t,session:a(t.session)}}}catch{}return e}const c=new Set;function l(e){return c.add(e),()=>{c.delete(e)}}e(`tray-leader`);function u(e){let t=new URL(e);return`${t.protocol===`https:`?`wss:`:`ws:`}//${t.host}/licks-ws`}function d(e,t){return`${new URL(e).origin}/webhooks/${t}`}function f(e,t){return`${e.replace(/\/+$/,``)}/${t.replace(/^\/+/,``)}`}export{o as a,r as c,s as i,f as n,l as o,d as r,t as s,u as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./logger-LESFN7Hj.js";import{a as t,i as n,n as r,r as i,t as a}from"./lick-urls-BZVq_P3x.js";const o=e(`lick-ws-bridge`);function s(e){if(e.stopped)return;let t;try{t=e.wsFactory(e.wsUrl)}catch(t){o.error(`Failed to construct lick WebSocket`,{url:e.wsUrl,error:t instanceof Error?t.message:String(t)}),c(e,`construct-threw`);return}e.socket=t,t.onopen=()=>{e.consecutiveFailures>0?o.info(`Lick WebSocket recovered`,{attempts:e.consecutiveFailures}):o.info(`Lick WebSocket connected`),e.consecutiveFailures=0,e.unrecoverableSignalled=!1},t.onmessage=n=>{u(e,t,n.data).catch(e=>{let t=typeof n.data==`string`?n.data.slice(0,200):`[non-string payload]`;o.error(`Failed to process lick message`,{error:e instanceof Error?e.message:String(e),preview:t})})},t.onclose=n=>{if(e.socket===t&&(e.socket=null),e.stopped)return;let r=n.reason?` reason=${JSON.stringify(n.reason)}`:``;c(e,`disconnected code=${n.code}${r}`)},t.onerror=t=>{let n=t.target;o.error(`Lick WebSocket error`,{url:e.wsUrl,readyState:n?.readyState,eventType:t.type})}}function c(e,t){if(e.reconnectHandle!=null){o.debug(`Lick WS failure during pending reconnect — keeping existing timer`,{cause:t});return}e.consecutiveFailures++;let n=Math.min(e.baseDelay*2**(e.consecutiveFailures-1),6e4),r={url:e.wsUrl,attempt:e.consecutiveFailures,cause:t,retryInMs:n};if(e.consecutiveFailures>=3?o.error(`Lick WebSocket still down`,r):o.warn(`Lick WebSocket down`,r),e.consecutiveFailures===20&&!e.unrecoverableSignalled){e.unrecoverableSignalled=!0;try{e.lickManager.emitEvent({type:`session-reload`,targetScoop:void 0,timestamp:new Date().toISOString(),body:{reason:`lick-ws-bridge-down`,url:e.wsUrl,attempts:e.consecutiveFailures}})}catch(e){o.error(`Failed to emit lick-ws-bridge-down signal`,{error:e instanceof Error?e.message:String(e)})}}l(e,n)}function l(e,t){e.stopped||e.reconnectHandle!=null||(e.reconnectHandle=e.setTimer(()=>{e.reconnectHandle=null,s(e)},t))}async function u(e,t,n){let r=JSON.parse(typeof n==`string`?n:String(n));if(r.requestId){let n=r.requestId,i=await g(e,r,n);if(e.stopped||e.socket!==t||t.readyState!==1){o.warn(`Lick reply dropped — socket changed/closed mid-request`,{type:r.type,requestId:n});return}try{t.send(JSON.stringify(i))}catch(e){o.error(`ws.send() failed delivering lick reply`,{type:r.type,requestId:n,error:e instanceof Error?e.message:String(e)})}return}if(r.type===`webhook_event`){d(e.lickManager,r);return}if(r.type===`navigate_event`){p(e.lickManager,r);return}r.type===`hostfs_invalidate`&&h(e,r)}function d(e,t){let n=typeof t.webhookId==`string`?t.webhookId:null;if(!n)return o.error(`Malformed webhook_event from lick-ws`,{receivedKeys:Object.keys(t)}),`malformed`;let r=t.headers&&typeof t.headers==`object`?t.headers:{};try{return e.handleWebhookEvent(n,r,t.body)}catch(e){return o.error(`Webhook event dispatch failed`,{webhookId:n,error:e instanceof Error?e.message:String(e)}),`failed`}}function f(e){let t=typeof e.verb==`string`?e.verb:null,n=typeof e.target==`string`?e.target:null,r=typeof e.url==`string`&&e.url.length>0?e.url:null;if(t!==`handoff`&&t!==`upskill`||!n||!r)return null;let i={url:r,verb:t,target:n};return typeof e.instruction==`string`&&(i.instruction=e.instruction),typeof e.branch==`string`&&(i.branch=e.branch),typeof e.path==`string`&&(i.path=e.path),typeof e.title==`string`&&(i.title=e.title),{type:`navigate`,navigateUrl:r,targetScoop:void 0,timestamp:typeof e.timestamp==`string`?e.timestamp:new Date().toISOString(),body:i}}function p(e,t){let n=f(t);if(!n){o.debug(`navigate_event dropped — invalid payload`,{hasVerb:typeof t.verb==`string`,hasTarget:typeof t.target==`string`,hasUrl:typeof t.url==`string`&&t.url.length>0});return}e.emitEvent(n)}function m(e){if(typeof e.mount!=`string`||e.mount.length===0)return null;let t=e.paths,n=[];if(Array.isArray(t))for(let e of t)typeof e==`string`&&n.push(e);return{type:`hostfs_invalidate`,mount:e.mount,paths:n,timestamp:typeof e.timestamp==`string`?e.timestamp:void 0}}function h(e,t){let n=m(t);if(!n){o.debug(`hostfs_invalidate dropped — invalid payload`,{hasMount:typeof t.mount==`string`&&t.mount.length>0,pathsIsArray:Array.isArray(t.paths)});return}try{e.options.onHostfsInvalidate?.(n)}catch(e){o.warn(`hostfs_invalidate handler threw`,{mount:n.mount,error:e instanceof Error?e.message:String(e)})}}async function g(e,t,r){let{lickManager:i}=e;try{switch(t.type){case`list_webhooks`:return{type:`response`,requestId:r,data:i.listWebhooks().map(t=>({...t,url:_(e,t.id)}))};case`create_webhook`:{let n=await i.createWebhook(t.name||`default`,t.scoop,t.filter);return{type:`response`,requestId:r,data:{...n,url:_(e,n.id)}}}case`webhook_event`:return{type:`response`,requestId:r,data:{disposition:d(i,t)}};case`delete_webhook`:return await i.deleteWebhook(t.id)?{type:`response`,requestId:r,data:{ok:!0}}:{type:`response`,requestId:r,data:{error:`Webhook not found`}};case`list_crontasks`:return{type:`response`,requestId:r,data:i.listCronTasks()};case`create_crontask`:if(!t.name)throw Error(`name is required`);if(!t.cron)throw Error(`cron is required`);return{type:`response`,requestId:r,data:await i.createCronTask(t.name,t.cron,t.scoop,t.filter)};case`delete_crontask`:return await i.deleteCronTask(t.id)?{type:`response`,requestId:r,data:{ok:!0}}:{type:`response`,requestId:r,data:{error:`Cron task not found`}};case`tray_status`:{let e=n();return{type:`response`,requestId:r,data:{state:e.state,joinUrl:e.session?.joinUrl??null,workerBaseUrl:e.session?.workerBaseUrl??null,trayId:e.session?.trayId??null}}}default:return{type:`response`,requestId:r,error:`Unknown request type: ${t.type}`}}}catch(e){return{type:`response`,requestId:r,error:e instanceof Error?e.message:String(e)}}}function _(e,n){let a=t().session;return a?.webhookUrl?r(a.webhookUrl,n):e.webhookOriginOverride?`${e.webhookOriginOverride}/webhooks/${n}`:i(e.options.locationHref,n)}function v(e){if(e.stopped)return;e.stopped=!0,e.reconnectHandle!=null&&(e.clearTimer(e.reconnectHandle),e.reconnectHandle=null);let t=e.socket;if(e.socket=null,t)try{t.close()}catch(e){t.readyState!==3&&t.readyState!==2&&o.warn(`Lick socket close() threw before terminal state`,{readyState:t.readyState,error:e instanceof Error?e.message:String(e)})}}function y(e,t){try{new URL(t.locationHref)}catch(e){throw Error(`startLickWsBridge: invalid locationHref ${JSON.stringify(t.locationHref)}: ${e instanceof Error?e.message:String(e)}`)}let n=typeof t.lickWsUrl==`string`&&t.lickWsUrl.length>0?t.lickWsUrl:a(t.locationHref),r=null;if(typeof t.lickWsUrl==`string`&&t.lickWsUrl.length>0)try{let e=new URL(t.lickWsUrl);r=`${e.protocol===`wss:`?`https:`:`http:`}//${e.host}`}catch{r=null}let i={lickManager:e,options:t,wsUrl:n,webhookOriginOverride:r,baseDelay:t.reconnectDelayMs??3e3,wsFactory:t.webSocketFactory??(e=>new WebSocket(e)),setTimer:t.setTimeoutFn??setTimeout.bind(globalThis),clearTimer:t.clearTimeoutFn??clearTimeout.bind(globalThis),stopped:!1,socket:null,reconnectHandle:null,consecutiveFailures:0,unrecoverableSignalled:!1};return s(i),{stop(){v(i)}}}export{y as startLickWsBridge};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./logger-LESFN7Hj.js";import"./record-YqlVEfh_.js";import{t}from"./agent-message-to-chat-w7n13QEN.js";import{t as n}from"./types-D8gIX-W-.js";import{i as r,t as i}from"./frozen-archive-format-B4efpvB9.js";import{a,c as o,i as s,l as c,n as l,o as u,r as d,s as f,t as p,u as m}from"./frozen-archive-writer-B1ANvJgT.js";const h=e(`live-session-snapshot`);function g(e,t){return`/scoops/${e}/sessions/${t}`}function _(e){let n=e.cone.folder||`cone`,r=e.sessionsDir??`/sessions`,i=t(e.messages,{source:e.cone.label??n,uncapped:!0});return f(async()=>e.stillValid&&!e.stillValid()?(h.info(`Live session snapshot skipped: session gone before the write`,{cone:n,sessionsDir:r,trigger:e.trigger}),null):v(e,n,r,i),o(r))}async function v(e,t,n,r){let i=e.now??Date.now,o=await u(e.vfs,n),f=l(o,t),m=f?await C(e.vfs,n,f):null,g=m===null?0:f?.liveThrough??S(m),_=x(r,m??[],g),v=[...m??[],..._],y=Math.max(g,S(r)),b=f?.filename??a(t),w=f?.frozenAt??new Date(i()).toISOString(),T=f?.title??s(v),E=(f?.compactions??0)+1,D={cone:t,...t!==`cone`&&e.cone.label?{coneLabel:e.cone.label}:{}},O={id:f?.sessionId??crypto.randomUUID(),title:T,frozenAt:w,createdAt:v[0]?.timestamp||i(),updatedAt:i(),messageCount:v.length,messages:v,...D,live:!0,liveThrough:y,compactions:E},k={filename:b,sessionId:O.id,title:T,frozenAt:w,messageCount:v.length,...D,...f?.icon?{icon:f.icon}:{},live:!0,liveThrough:y,compactions:E};await p(e.vfs,n);let A=`${n}/${b}`;return await e.vfs.writeFile(A,d(O)),await c(e.vfs,k,n),await e.vfs.flush(),h.info(`Live session snapshot written`,{cone:t,sessionsDir:n,filename:b,trigger:e.trigger,appended:_.length,total:v.length,compactions:E}),{transcriptPath:A,entry:k,appended:_.length}}function y(e,t){let n=t||`cone`;return f(async()=>{let t=await u(e),r=l(t,n);if(!r)return!1;let{live:a,liveThrough:o,...s}=r,c={...s,pendingEnrichment:!0};return await m(e,t.map(e=>e===r?c:e)),await w(e,`${i}/${r.filename}`),await e.flush(),h.info(`Live session snapshot finalized`,{cone:n,filename:r.filename}),!0})}function b(e,t){let r=t||`cone`;return f(async()=>{let t=await u(e),a=t.filter(e=>e.live===!0&&(e.cone??`cone`)===r);if(a.length===0)return 0;await m(e,t.filter(e=>!a.includes(e)));for(let t of a){try{await e.rm(`${i}/${t.filename}`)}catch(e){if(!(e instanceof n)||e.code!==`ENOENT`)throw e}let{removeSessionJsonl:r}=await import(`./session-jsonl-f7vG8uaN.js`);await r(e,t.filename)}let{invalidateSessionSearchIndex:o}=await import(`./session-search-index-BQmbRVuk.js`);return await o(e),await e.flush(),h.info(`Live session snapshot discarded`,{cone:r,removed:a.length}),a.length})}function x(e,t,n){if(t.length===0)return e;let r=t.filter(e=>e.timestamp===n);return e.filter(e=>e.timestamp>n?!0:e.timestamp<n?!1:!r.some(t=>t.role===e.role&&t.content===e.content))}function S(e){let t=0;for(let n of e)n.timestamp>t&&(t=n.timestamp);return t}async function C(e,t,i){try{let n=await e.readFile(`${t}/${i.filename}`,{encoding:`utf-8`}),a=typeof n==`string`?n:new TextDecoder().decode(n);return r(a).messages}catch(e){if(!(e instanceof n)||e.code!==`ENOENT`)throw e;return h.warn(`Live snapshot archive missing; rewriting from the agent history`,{sessionsDir:t,filename:i.filename}),null}}async function w(e,t){try{let n=await e.readFile(t,{encoding:`utf-8`}),r=typeof n==`string`?n:new TextDecoder().decode(n),i=r.match(/^---\n([\s\S]*?)\n---\n/);if(!i)return;let a=i[1].replace(/^(live: true|liveThrough: \d+)\n?/gm,``);if(a===i[1])return;await e.writeFile(t,`---\n${a}\n---\n${r.slice(i[0].length)}`)}catch(e){if(e instanceof n&&e.code===`ENOENT`)return;throw e}}export{b as discardLiveSnapshot,y as finalizeLiveSnapshot,g as scoopSessionsDir,_ as snapshotLiveSession};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{E as e,_ as t,j as n,n as r,u as i,y as a}from"./record-YqlVEfh_.js";import{a as o,u as s}from"./descriptor-D-6Koktu.js";import{i as c,n as l}from"./key-GVxFyssW.js";function u(e,t=Date.now){let n=e.parentId===null,r=e.folder??e.name,i=n?e.config:d(e,r),a={jid:e.id??(n?`cone_${t()}`:`scoop_${r}_${t()}`),name:e.name,folder:r,requiresTrigger:!n,assistantLabel:n?`sliccy`:r,addedAt:new Date(t()).toISOString(),parentJid:e.parentId,...i?{config:i,configSchemaVersion:3}:{},...e.notifyOnComplete===!1?{notifyOnComplete:!1}:{},...!n&&e.onParentClose===`detach`?{onParentClose:`detach`}:{}};return n||(a.trigger=`@${r}`),a}function d(e,t){let r=n(e.workspace?.mode??e.config?.workspaceMode),i=e.workspace?.from??`/workspace`,a=o(r,t,{root:i},e.workspace?.from),s=e.config;return{...s,workspaceMode:r,visiblePaths:s?.visiblePaths===void 0?a.visiblePaths:s.visiblePaths,writablePaths:s?.writablePaths===void 0?a.writablePaths:s.writablePaths}}function f(e,t){if(e.parentId===null||e.workspace?.from!==void 0)return e;let n=t.getScoop(e.parentId);return n?{...e,workspace:{mode:e.workspace?.mode??e.config?.workspaceMode??`shared-readonly`,from:s(n).root}}:e}var p=class{host;constructor(e){this.host=e}async create(e){e.parentId===null&&e.workspace?.mode!==void 0&&n(e.workspace.mode);let r=u(f(e,this.host));if(v(r.jid,e=>this.host.getScoop(e)),e.parentId!==null){let n=this.host.getScoop(e.parentId);if(!n)throw Error(`Parent work unit not found: ${e.parentId}`);t(r,n)}return await this.host.registerScoop(r),this.get(r.jid).descriptor}async createMany(e){if(e.length===0)return[];y(e,e=>this.host.getScoop(e),()=>this.host.getScoops());let t=_(e);for(let e of t)e.id&&v(e.id,e=>this.host.getScoop(e));let n=x(t),r=[],i=new Map;try{for(let e of n){let t=await this.create(e);r.push(t.id),i.set(e,t)}}catch(e){for(let e=r.length-1;e>=0;e--)await this.close(r[e]).catch(()=>void 0);throw e}return t.map(e=>i.get(e))}async join(e,t){return(await this.host.waitForScoops(e,t?.timeoutMs)).map(e=>({id:e.jid,summary:e.summary,timedOut:e.timedOut}))}list(){return this.host.getScoops().map(e=>this.get(e.jid).descriptor)}get(e){return this.host.getScoop(e)?this.host.ensureLiveUnit(e):null}getParent(e){let t=this.host.getScoop(e)?.parentJid;return t?this.get(t):null}getChildren(e){return a(this.host.getScoops(),e).map(e=>this.get(e.jid)).filter(e=>e!==null)}roots(){return e(this.host.getScoops()).map(e=>this.get(e.jid)).filter(e=>e!==null)}resolveDefaultRoot(){return this.roots()[0]??null}rootOf(e){let t=new Set,n=this.host.getScoop(e);for(;n&&n.parentJid!==null;){if(t.has(n.jid))return null;t.add(n.jid),n=this.host.getScoop(n.parentJid)}return n?this.get(n.jid):null}abort(e,t){let n=this.get(e);return n?n.abort(t):Promise.resolve()}async promote(e){let t=this.host.getScoop(e);if(!t)throw Error(`Work unit not found: ${e}`);if(t.parentJid===null)return this.get(e).descriptor;let n=l(t),a=h(t,t.parentJid);t.parentJid=null,i(t);try{await this.host.persistScoop(t)}catch(e){throw g(t,a),e}return await this.host.rekeyConversation?.(n,{key:l(t),workUnitId:t.jid,workspaceId:c(t),folder:t.folder,legacyKeys:{agentSessionId:t.jid,chatSessionId:r(t)}}),await this.host.reinitLiveUnit(e),this.get(e).descriptor}detach(e){return this.promote(e)}async close(e,t){let n=this.get(e);if(!n)return;let r=this.getChildren(e);for(let e of r)m(e,t)===`detach`?await this.promote(e.descriptor.id):await this.close(e.descriptor.id,t);await n.close()}};function m(e,t){return t?.descendants??e.descriptor.onParentClose}function h(e,t){return{parentJid:t,trigger:e.trigger,requiresTrigger:e.requiresTrigger,approvesGuestRequests:e.approvesGuestRequests,onParentClose:e.onParentClose}}function g(e,t){e.parentJid=t.parentJid,e.trigger=t.trigger,e.requiresTrigger=t.requiresTrigger,e.approvesGuestRequests=t.approvesGuestRequests,e.onParentClose=t.onParentClose}function _(e){let t=Date.now();return e.map(e=>{if(e.id)return e;let n=e.folder??e.name,r=e.parentId===null?`cone_${t++}`:`scoop_${n}_${t++}`;return{...e,id:r}})}function v(e,t){if(t(e))throw Error(`Work unit already exists: ${e}`)}function y(e,t,n){let r=new Set;for(let n of e)if(n.id){if(r.has(n.id))throw Error(`Duplicate work unit id in createMany: ${n.id}`);v(n.id,t),r.add(n.id)}b(e,n);let i=[],a=new Set;for(let n of e)n.parentId!==null&&(t(n.parentId)||r.has(n.parentId)||a.has(n.parentId)||(a.add(n.parentId),i.push(n.parentId)));if(i.length>0)throw Error(`Parent work unit not found: ${i.join(`, `)}`)}function b(e,t){let n=new Set(t().map(e=>e.folder)),r=new Set;for(let t of e){let e=t.folder??t.name;if(r.has(e)||n.has(e))throw Error(`Duplicate work unit folder in createMany: ${e}`);r.add(e)}}function x(e){let t=e.length;if(t<=1)return e.slice();let n=new Map;for(let r=0;r<t;r++){let t=e[r].id;t&&n.set(t,r)}let r=Array(t).fill(0),i=Array.from({length:t},()=>[]);for(let a=0;a<t;a++){let t=e[a].parentId;if(t===null)continue;let o=n.get(t);o!==void 0&&(i[o].push(a),r[a]+=1)}let a=[];for(let e=0;e<t;e++)r[e]===0&&a.push(e);let o=[];for(let t=0;t<a.length;t++){let n=a[t];o.push(e[n]);for(let e of i[n])--r[e],r[e]===0&&a.push(e)}if(o.length!==t)throw Error(`createMany cycle: parentId edges in this batch form a cycle`);return o}export{u as n,p as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./logger-LESFN7Hj.js";import{n as t}from"./agent-bridge-D_5Sd3oe.js";import{t as n}from"./record-YqlVEfh_.js";import{n as r,o as i,r as a,u as o}from"./descriptor-D-6Koktu.js";import{n as s,t as c}from"./thinking-level-5x0UAu9N.js";import{a as l}from"./frozen-archive-format-B4efpvB9.js";import{a as u,r as d}from"./memory-budget-Bcf7Eolo.js";import"./cone-memory-budget-Cmi9vXV5.js";import{t as f}from"./MEMORY-Dl8Y_nOo.js";import{a as p,i as m,n as h,o as g,r as _,t as v}from"./instruction-frontmatter-B48EsYtA.js";const y=e(`agentic-memory`),b=e=>[e.memoryPath],x=e=>[`/sessions/`,`/shared/`,...i(e)],S=`awk.cat.cp.cut.date.diff.du.echo.file.find.grep.head.jq.ls.mkdir.mount.mv.nl.od.printf.readlink.rg.sed.sort.stat.tail.touch.tr.uniq.uname.upskill.wc.xxd`.split(`.`),ee={arrayKeys:new Set([`writablePaths`,`visiblePaths`,`allowedCommands`]),scalarKeys:new Set([`model`,`timeoutSeconds`,`dreamTimeoutSeconds`,`thinkingLevel`])},C=3e4;function w(e){return e===`cone`?`memory-curator`:`memory-curator-${e}`}const T={kind:`curate`,nameFor:w,rivalsFor:e=>[k(e)]},E=`{{TASK}}`;function D(e,t,n){return e.kind===`dream`?`**Consolidation pass** (the nightly dreaming): there is NO new session to mine — skip "Mining the session archive" entirely. Your whole job is to make the existing memory better: consolidated, current, and inside its budget. If the file is missing or empty, reply with one line saying so and stop; never invent memories. The run is hard-stopped after ${n} minutes; a run stopped at that bound lands whatever the memory file holds at that moment (every memory_write leaves a whole, budget-checked file), so consolidate section by section, writing as you go, and finish cleanly when you can.`:`**Curation pass**: mine the archived session at ${t} for what is worth carrying into future sessions, fold it into the memory, and consolidate the whole file in the same pass. Work fast: a pass should finish in well under 10 minutes and is hard-stopped after ${n} minutes — mine the three signals, write, and stop, rather than exploring the archive exhaustively.`}async function O(e){try{await e.stat(d);return}catch{}try{await e.mkdir(`/etc`,{recursive:!0}),await e.writeFile(d,f),y.info(`Seeded default ${d}`)}catch(e){y.warn(`Failed to seed ${d}`,{error:$(e)})}}function k(e){return e===`cone`?`memory-dreamer`:`memory-dreamer-${e}`}function A(e,t){let r=e.nameFor(t);return M.test(r)?r:e.nameFor(n)}function j(e,t){let r=M.test(e.nameFor(t))?t:n;return e.rivalsFor?.(r)??[]}const M=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/;function N(e,t){return`/scoops/agent-${A(e,t)}`}function P(e){return N(T,e)}const F=P(n);function I(e){return o({parentJid:null,folder:e?.folder??`cone`})}function L(e,t){if(t.root===r.root)return e;if(e===r.memoryPath)return t.memoryPath;if(e===`/workspace/skills`||e.startsWith(`/workspace/skills/`))return e;let n=`${r.root}/`;return e===r.root?t.root:e.startsWith(n)?`${t.root}/${e.slice(n.length)}`:e}function R(e,t){let n=`${a}/`,r=e=>e.some(e=>n.startsWith(e.endsWith(`/`)?e:`${e}/`)),i=e.map(e=>L(e,t));return r(e)&&!r(i)&&i.push(n),i}async function z(e){try{if(e.signal?.aborted)return{ok:!1,reason:`aborted`,legacyFallbackSafe:!1};let n=e.instructions??T,r=I(e.cone),i=N(n,e.cone?.folder??`cone`),a=await B(e.vfs,r),o=n.kind===`dream`?a.dreamTimeoutSeconds:a.timeoutSeconds,s=K(e.sessionArchivePath);try{await J(e.vfs,r.memoryPath,e.sessionArchivePath)}catch(e){return{ok:!1,reason:`snapshot: ${$(e)}`,legacyFallbackSafe:!0}}let c=n.kind===`dream`?`(no session archive this pass)`:e.sessionArchivePath,l=Math.max(1,Math.round(o/60)),d=D(n,c,l),f=X(a,o,Z(Q(a.promptTemplate.includes(E)?a.promptTemplate:`${a.promptTemplate.trimEnd()}\n\n${E}`,{MEMORY_PATH:s,SESSION_ARCHIVE_PATH:c,SESSION_COUNT:String(e.sessionCount),BUDGET_CHARS:String(u(e.sessionCount)),SCRATCH_DIR:i,TODAY:e.today??new Date().toISOString().slice(0,10),TIMEOUT_MINUTES:String(l),TASK:d}),i),e.sessionArchivePath,r,e.cone,n);e.signal&&(f.signal=e.signal);let p=await te(Promise.resolve().then(()=>e.spawn(f)),o*1e3+C,e.signal);if(p.type===`timeout`)return y.warn(`Agentic memory wait timed out past the in-run bound + grace`,{timeoutSeconds:o,graceMs:C}),{ok:!1,reason:`timeout`,legacyFallbackSafe:!1};if(p.type===`aborted`)return{ok:!1,reason:`aborted`,legacyFallbackSafe:!1};if(p.type===`error`)return{ok:!1,reason:$(p.error),legacyFallbackSafe:!0};if(p.result.exitCode!==0){let e=(p.result.finalText??``).startsWith(t);return{ok:!1,reason:p.result.finalText||`exit-${p.result.exitCode}`,legacyFallbackSafe:!e}}return{ok:!0,report:p.result.finalText}}catch(e){return y.warn(`Agentic memory pass failed`,{error:$(e)}),{ok:!1,reason:$(e),legacyFallbackSafe:!1}}}async function B(e,t=r){try{let n=await e.readFile(d,{encoding:`utf-8`});return V(typeof n==`string`?n:new TextDecoder().decode(n),t)}catch(e){return y.warn(`Could not load valid ${d}; using built-in default`,{error:$(e)}),V(f,t)}}function V(e,t=r){let n=p(e,`MEMORY.md`),i=v(n.frontmatter,ee),a=h(i,`writablePaths`,b(t));if(a.length===0)throw Error(`writablePaths must not be empty`);g(a,`writablePaths`);let o=h(i,`visiblePaths`,x(t));g(o,`visiblePaths`);let s=_(i.timeoutSeconds,600,1200),c=_(i.dreamTimeoutSeconds,3600,7200,`dreamTimeoutSeconds`),l=m(i.model,`model`);return{writablePaths:a.map(e=>L(e,t)),visiblePaths:R(o,t),allowedCommands:[...new Set([...S,...h(i,`allowedCommands`,[])])],...l?{model:l}:{},thinkingLevel:H(i.thinkingLevel),timeoutSeconds:s,dreamTimeoutSeconds:c,promptTemplate:n.body}}function H(e){if(e===void 0)return`medium`;if(typeof e!=`string`||!s(e))throw Error(`thinkingLevel must be one of ${c.join(`, `)}`);return e}function U(e){return`/sessions/.curated/${e.slice(e.lastIndexOf(`/`)+1)}`}function W(e){return`/sessions/.curation/${e.slice(e.lastIndexOf(`/`)+1)}`}function G(e){return`${W(e)}/base.md`}function K(e){return`${W(e)}/draft.md`}function q(e){return`${W(e)}/status.json`}async function J(e,t,n){let r=``;try{let n=await e.readFile(t,{encoding:`utf-8`});r=typeof n==`string`?n:new TextDecoder().decode(n)}catch{}await e.mkdir(W(n),{recursive:!0}),await e.writeFile(G(n),r),await e.writeFile(K(n),r)}function Y(e,t,n){let r=e.map(e=>e===t?n:e);return r.includes(n)?r:[...r,n]}function X(e,t,n,r,i,a,o){let s=e.model===`parent`||e.model===`cone`,c=G(r),l=K(r);return{cwd:i.root,writablePaths:Y(e.writablePaths,i.memoryPath,l),visiblePaths:[...e.visiblePaths,`${W(r)}/`],allowedCommands:e.allowedCommands,prompt:n,thinkingLevel:e.thinkingLevel,persistSession:!0,name:A(o,a?.folder??`cone`),exclusiveWith:j(o,a?.folder??`cone`),...a?.jid?{parentJid:a.jid}:{},notifyOnComplete:!0,successReceiptPath:U(r),mergeOnSuccess:{targetPath:i.memoryPath,basePath:c,draftPath:l},outcomeReceiptPath:q(r),maxWallClockMs:t*1e3,...!s&&e.model?{modelId:e.model}:{}}}function Z(e,t){if(t===F)return e;let n=`\0SCRATCH\0`;return e.replaceAll(t,n).replaceAll(F,t).replaceAll(n,t)}function Q(e,t){let n=e;for(let[e,r]of Object.entries(t))n=n.replaceAll(`{{${e}}}`,r);return n}function te(e,t,n){return new Promise(r=>{let i=!1,a=e=>{i||(i=!0,clearTimeout(s),n?.removeEventListener(`abort`,o),r(e))},o=()=>a({type:`aborted`}),s=setTimeout(()=>a({type:`timeout`}),t);n?.addEventListener(`abort`,o,{once:!0}),e.then(e=>a({type:`result`,result:e}),e=>a({type:`error`,error:e}))})}function $(e){return e instanceof Error?e.message:String(e)}const ne={kind:`dream`,nameFor:k,rivalsFor:e=>[w(e)]};function re(e,t){return`dream-${e}-${t}.md`}function ie(e){let t=e.today??new Date().toISOString().slice(0,10),n=e.cone?.folder??`cone`;return z({spawn:e.spawn,vfs:e.vfs,sessionArchivePath:`/sessions/${re(t,n)}`,sessionCount:e.sessionCount,today:t,instructions:ne,...e.cone?{cone:e.cone}:{},...e.signal?{signal:e.signal}:{}})}function ae(e){return O(e),{async curate(t){let n=globalThis.__slicc_agent;return n?z({spawn:e=>n.spawn(e),vfs:e,sessionArchivePath:t.sessionArchivePath,sessionCount:t.sessionCount,...t.cone?{cone:t.cone}:{}}):{ok:!1,reason:`agent bridge not published yet`,legacyFallbackSafe:!1}},async dream(t){let n=globalThis.__slicc_agent;if(!n)return{ok:!1,reason:`agent bridge not published yet`,legacyFallbackSafe:!1};let r=(await l(e)).length;return ie({spawn:e=>n.spawn(e),vfs:e,sessionCount:r,...t.cone?{cone:t.cone}:{},...t.today?{today:t.today}:{}})}}}function oe(e){globalThis.__slicc_memory=e}export{ae as createMemorySeam,oe as publishMemorySeam};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./record-YqlVEfh_.js";import{t,u as n}from"./descriptor-D-6Koktu.js";import{n as r}from"./frozen-archive-format-B4efpvB9.js";const i=`/sessions/.curation/health.json`;async function a(e,t){try{return(await c(e,n({parentJid:null,folder:t}).memoryPath)).length}catch(e){if(s(e))return null;throw e}}async function o(e){if(!e.readDir)return null;try{let n=await e.readDir(t);return new Set(n.filter(e=>e.type===`directory`).map(e=>e.name))}catch{return new Set}}function s(e){return e?.code===`ENOENT`||e instanceof Error&&e.message.includes(`ENOENT`)}async function c(e,t){let n=await e.readFile(t,{encoding:`utf-8`});return typeof n==`string`?n:new TextDecoder().decode(n)}async function l(e){let t;try{t=await c(e,r)}catch(e){return s(e)?{fresh:!0}:{failure:`sessions index unreadable at ${r}: ${e instanceof Error?e.message:String(e)}`}}try{let e=JSON.parse(t);return Array.isArray(e)?{entries:e}:{failure:`sessions index is not an array`}}catch{return{failure:`sessions index at ${r} is not valid JSON`}}}function u(e){return e.memoryFailed===void 0?e.memoryPending?`pending`:e.memoryCuratedAt===void 0?e.memorySkipped?`skipped`:`none`:`curated`:`failed`}function d(t){let n=new Map([[e,0]]);for(let e of t){if(u(e)!==`curated`)continue;let t=e.cone??`cone`;n.set(t,(n.get(t)??0)+1)}return n}async function f(e,t){let n=await o(e),r=[];for(let[i,o]of d(t))i!==`cone`&&n&&!n.has(i)||r.push({folder:i,curated:o,chars:await a(e,i)});return r}function p(e){return e.filter(e=>e.curated>0&&(e.chars??0)===0).map(e=>e.folder===`cone`?`${e.curated} archive(s) report successful curation but the primary memory file is missing or empty`:`${e.curated} archive(s) from cone "${e.folder}" report successful curation but its memory file is missing or empty`)}async function m(e,t=()=>new Date){let n={at:t().toISOString(),sessions:0,curation:{curated:0,failed:0,pending:0,skipped:0,none:0},primaryMemoryChars:null,cones:[],failures:[]};try{let t=await l(e);if(`failure`in t)return n.failures.push(t.failure),n;let r=`entries`in t?t.entries:[];n.sessions=r.length;for(let e of r)n.curation[u(e)]++;try{n.cones=await f(e,r)}catch(e){return n.failures.push(`memory file unreadable: ${e instanceof Error?e.message:String(e)}`),n}n.primaryMemoryChars=n.cones.find(e=>e.folder===`cone`)?.chars??null,n.curation.failed>0&&n.failures.push(`${n.curation.failed} archive(s) whose last curation attempt failed`),n.failures.push(...p(n.cones))}catch(e){n.failures.push(`health check itself failed: ${e instanceof Error?e.message:String(e)}`)}return n}async function h(e,t){let n=await m(e,t);return await e.mkdir(`/sessions/.curation`,{recursive:!0}),await e.writeFile(i,`${JSON.stringify(n,null,2)}\n`),n}function g(e,t){let{log:n}=t,r=async()=>{try{let t=await h(e);t.failures.length>0?(n.error??n.warn.bind(n))(`memory health check FAILED`,{failures:t.failures,report:i}):n.info(`memory health check ok`,{sessions:t.sessions,curation:t.curation})}catch(e){(n.error??n.warn.bind(n))(`memory health check could not persist its report`,e)}},a=setTimeout(()=>{r()},t.bootDelayMs??9e4),o=setInterval(()=>{r()},t.intervalMs??864e5);return()=>{clearTimeout(a),clearInterval(o)}}export{g as scheduleMemoryHealthChecks};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./feature-flags-Dl-xb1DG.js";function t(){return e(`memory-v2`)}export{t as isMemoryV2Enabled};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./path-utils-DNJG-zQf.js";import{a as t,o as n}from"./memory-budget-Bcf7Eolo.js";import{t as r}from"./write-verification-BOaZdtyk.js";function i(e){return Array.isArray(e)&&e.every(e=>typeof e==`object`&&!!e&&typeof e.oldText==`string`&&typeof e.newText==`string`)}function a(e,t){let n=e;for(let[e,r]of t.entries()){if(r.oldText.length===0)return{ok:!1,error:`edit ${e+1}: oldText must not be empty`};let t=n.indexOf(r.oldText);if(t===-1)return{ok:!1,error:`edit ${e+1}: oldText not found in the current file`};if(n.indexOf(r.oldText,t+1)!==-1)return{ok:!1,error:`edit ${e+1}: oldText occurs more than once; include more context to make it unique`};n=n.slice(0,t)+r.newText+n.slice(t+r.oldText.length)}return{ok:!0,content:n}}function o(e,t){return e<=t?`${e} chars, ${t-e} under the ${t}-char budget.`:`${e} chars, ${e-t} OVER the ${t}-char budget — the next write must be smaller than ${e} chars.`}function s(e,t,n){if(t<=n||t<e)return{allowed:!0};let r=t-n;return{allowed:!1,reason:`Rejected: the file would ${t===e?`stay at ${e} chars`:`grow from ${e} to ${t} chars`}, ${r} over the ${n}-char budget. Over budget, a write must shrink the file — cut a whole section rather than shaving characters, then write again.`}}async function c(e,t){try{let n=await e.readFile(t,{encoding:`utf-8`});return typeof n==`string`?n:new TextDecoder().decode(n)}catch(e){if(e?.code===`ENOENT`)return null;throw e}}function l(e,t,n){if(typeof e.content==`string`)return{ok:!0,next:e.content};if(!i(e.edits))return{ok:!1,error:"`edits` must be a list of { oldText, newText }"};if(t===null)return{ok:!1,error:`${n} does not exist yet — pass \`content\` to create it`};let r=a(t,e.edits);return r.ok?{ok:!0,next:r.content}:r}async function u(i,a,u){if(typeof u.path!=`string`||u.path.length===0)return{content:"memory_write: `path` is required",isError:!0};let d=e(u.path);if(!n(d))return{content:`memory_write: ${d} is not a memory file — use write_file or edit for ordinary files`,isError:!0};if(typeof u.content==`string`==(u.edits!==void 0))return{content:"memory_write: pass exactly one of `content` (whole file) or `edits` (exact replacements)",isError:!0};try{let e=await c(i,d),n=l(u,e,d);if(!n.ok)return{content:`memory_write: ${n.error}`,isError:!0};let f=t(await a.readSessionCount()),p=s(e?.length??0,n.next.length,f);if(!p.allowed)return{content:`memory_write: ${p.reason}`,isError:!0};await i.writeFile(d,n.next);let m=await r(i,d,n.next);return m?{content:m,isError:!0}:{content:`Wrote ${d}: ${o(n.next.length,f)}`}}catch(e){return{content:e instanceof Error?e.message:String(e),isError:!0}}}export{u as executeMemoryWrite};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t,t as n}from"./base64-DzRgusa4.js";import{t as r}from"./mime-types-D7IV6i7k.js";import{t as i}from"./types-D8gIX-W-.js";import{n as a}from"./multipart-form-data-DopbgwRR.js";import{t as o}from"./remote-cache-BE5T1-53.js";const s=`https://api.aem.live`;function c(e){let t=e.match(/^aem:\/\/([^/]+)\/([^/]+)(?:\/(.*))?$/);if(!t)throw Error(`invalid AEM source '${e}' — expected aem://org/site[/path]`);return{org:t[1],site:t[2],path:(t[3]??``).replace(/^\/+/,``).replace(/\/+$/,``)}}function l(e){if(!e)return``;let t=Date.parse(e);return Number.isNaN(t)?``:String(t)}function u(e){let t=Date.parse(e??``);return Number.isNaN(t)?0:t}function d(e){return e.map(e=>e[`content-type`]===`application/folder`||e.name.endsWith(`/`)?{name:e.name.replace(/\/+$/,``),kind:`directory`}:{name:e.name,kind:`file`,size:e.size,etag:l(e[`last-modified`]),lastModified:u(e[`last-modified`])})}var f=class{kind=`aem`;source;profile;mountId;parsed;cache;maxBodyBytes;transport;closed=!1;constructor(e){this.source=e.source,this.profile=e.profile,this.mountId=e.mountId??crypto.randomUUID(),this.parsed=c(e.source),this.cache=e.cache,this.maxBodyBytes=e.maxBodyBytes??5242880,this.transport=e.signedFetch}assertOpen(e){if(this.closed)throw new i(`EBADF`,`mount closed`,e)}toMountRelative(e){return e.replace(/^\/+/,``)}toSourcePath(e){let t=e.replace(/^\/+/,``).replace(/\/+$/,``),n=[this.parsed.path,t].filter(e=>e.length>0).join(`/`),r=`/${this.parsed.org}/sites/${this.parsed.site}/source`;return n?`${r}/${n}`:r}toListPath(e){return`${this.toSourcePath(e)}/`}request(e,t,n){return this.transport({method:e,path:t,origin:s,headers:n?.headers,body:n?.body})}async readFile(e){this.assertOpen(e);let t=this.toMountRelative(e),n=await this.cache.getBody(t);if(n&&!this.cache.isStale(n.cachedAt))return n.body;let r=await this.request(`GET`,this.toSourcePath(t));if(r.status===404)throw await this.cache.invalidateBody(t),new i(`ENOENT`,`no such file`,e);if(r.status===401||r.status===403)throw new i(`EACCES`,`aem access denied`,e);if(r.status>=400)throw new i(`EIO`,`aem readFile failed: ${r.status}`,e);let a=new Uint8Array(await r.arrayBuffer());if(a.byteLength>this.maxBodyBytes)throw new i(`EFBIG`,`body exceeds maxBodyBytes`,e);return await this.cache.putBody(t,a,l(r.headers.get(`last-modified`))),a}async assertUnchanged(e,t,n){if(!n)return;let r=await this.request(`HEAD`,this.toSourcePath(t));if(r.status===404)return;if(r.status>=400)throw new i(`EIO`,`aem precondition HEAD failed: ${r.status}`,e);let a=l(r.headers.get(`last-modified`));if(a&&a!==n)throw await this.cache.invalidateBody(t),new i(`EBUSY`,`remote modified since last read — re-read and retry`,e)}async writeFile(e,t){if(this.assertOpen(e),t.byteLength>this.maxBodyBytes)throw new i(`EFBIG`,`body exceeds maxBodyBytes`,e);let n=this.toMountRelative(e),r=await this.cache.getBody(n);await this.assertUnchanged(e,n,r?.etag??``);let a=await this.request(`PUT`,this.toSourcePath(n),{body:t});if(a.status===401||a.status===403)throw new i(`EACCES`,`aem write denied`,e);if(a.status>=400)throw new i(`EIO`,`aem writeFile failed: ${a.status}`,e);await this.cache.invalidateBody(n);let o=n.split(`/`).slice(0,-1).join(`/`);await this.cache.invalidateListing(o)}async readDir(e){this.assertOpen(e);let t=this.toMountRelative(e).replace(/\/+$/,``),n=await this.cache.getListing(t);if(n&&!this.cache.isStale(n.cachedAt))return n.entries;let r=await this.request(`GET`,this.toListPath(t));if(r.status===404)throw new i(`ENOENT`,`no such directory`,e);if(r.status===401||r.status===403)throw new i(`EACCES`,`aem access denied`,e);if(r.status>=400)throw new i(`EIO`,`aem list failed: ${r.status}`,e);let a=d(await r.json());return await this.cache.putListing(t,a),a}async stat(e){this.assertOpen(e);let t=this.toMountRelative(e);if(t===``)return{kind:`directory`,size:0,mtime:0};let n=await this.cache.getBody(t);if(n)return{kind:`file`,size:n.size,mtime:n.cachedAt,etag:n.etag};let r=t.split(`/`),a=r.pop()??``,o=r.join(`/`),s=await this.cache.getListing(o),c=(s&&!this.cache.isStale(s.cachedAt)?s.entries:await this.readDirQuietly(o))?.find(e=>e.name===a);if(!c)throw new i(`ENOENT`,`no such file or directory`,e);return c.kind===`directory`?{kind:`directory`,size:0,mtime:c.lastModified??0}:{kind:`file`,size:c.size??0,mtime:c.lastModified??0,etag:c.etag??``}}async readDirQuietly(e){try{return await this.readDir(e)}catch{return null}}async mkdir(e){}async remove(e){this.assertOpen(e);let t=this.toMountRelative(e),n=await this.request(`DELETE`,this.toSourcePath(t));if(n.status===404)throw new i(`ENOENT`,`no such file`,e);if(n.status===401||n.status===403)throw new i(`EACCES`,`aem delete denied`,e);if(n.status>=400)throw new i(`EIO`,`aem delete failed: ${n.status}`,e);await this.cache.invalidateBody(t);let r=t.split(`/`).slice(0,-1).join(`/`);await this.cache.invalidateListing(r)}async refresh(e){this.assertOpen(`/`);let t={added:[],removed:[],changed:[],unchanged:0,errors:[]},n=[``];for(;n.length>0;){let e=n.pop();try{await this.refreshDir(e,t,n)}catch(n){t.errors.push({path:e,message:n instanceof Error?n.message:String(n)})}}return e?.bodies&&await this.refreshBodies(t),t}async classifyFile(e,t,n){let r=await this.cache.getBody(e);r?t&&r.etag!==t?(await this.cache.invalidateBody(e),n.changed.push(e)):n.unchanged++:n.added.push(e)}async refreshDir(e,t,n){let r=await this.request(`GET`,this.toListPath(e));if(r.status===404){await this.cache.putListing(e,[]);return}if(r.status>=400){t.errors.push({path:e,message:`list failed: ${r.status}`});return}let i=d(await r.json());for(let r of i){let i=e?`${e}/${r.name}`:r.name;r.kind===`directory`?n.push(i):await this.classifyFile(i,r.etag??``,t)}await this.cache.putListing(e,i)}async refreshBodies(e){for(let t of e.changed)try{await this.readFile(t)}catch(n){e.errors.push({path:t,message:n instanceof Error?n.message:String(n)})}}describe(){return{displayName:`${this.parsed.org}/${this.parsed.site}${this.parsed.path?`/${this.parsed.path}`:``}`,source:this.source,profile:this.profile}}async close(){this.closed||=!0}};function p(e,t,n){let r=a([{name:`data`,file:{bytes:n,filename:e,contentType:t}}]);return{contentType:r.contentType,body:r.bytes}}function m(e){return e.split(`/`).pop()||`data`}function h(e){let t=e.match(/^da:\/\/([^/]+)\/([^/]+)(?:\/(.*))?$/);if(!t)throw Error(`invalid DA source '${e}' — expected da://org/repo[/path]`);return{org:t[1],repo:t[2],path:(t[3]??``).replace(/^\/+/,``).replace(/\/+$/,``)}}var g=class{kind=`da`;source;profile;mountId;parsed;cache;maxBodyBytes;transport;closed=!1;constructor(e){this.source=e.source,this.profile=e.profile,this.mountId=e.mountId??crypto.randomUUID(),this.parsed=h(e.source),this.cache=e.cache,this.maxBodyBytes=e.maxBodyBytes??5242880,this.transport=e.signedFetch}assertOpen(e){if(this.closed)throw new i(`EBADF`,`mount closed`,e)}toMountRelative(e){return e.replace(/^\/+/,``)}toSourcePath(e){let t=e.replace(/^\/+/,``).replace(/\/+$/,``),n=[this.parsed.path,t].filter(e=>e.length>0).join(`/`);return`/source/${this.parsed.org}/${this.parsed.repo}${n?`/${n}`:``}`}toListPath(e){let t=e.replace(/^\/+/,``).replace(/\/+$/,``),n=[this.parsed.path,t].filter(e=>e.length>0).join(`/`);return`/list/${this.parsed.org}/${this.parsed.repo}${n?`/${n}`:``}`}async readFile(e){this.assertOpen(e);let t=this.toMountRelative(e),n=await this.cache.getBody(t);if(n&&!this.cache.isStale(n.cachedAt))return n.body;let r={};n&&(r[`if-none-match`]=n.etag);let a=await this.transport({method:`GET`,path:this.toSourcePath(t),headers:r});if(a.status===304&&n)return await this.cache.putBody(t,n.body,n.etag),n.body;if(a.status===404)throw await this.cache.invalidateBody(t),new i(`ENOENT`,`no such file`,e);if(a.status===401||a.status===403)throw new i(`EACCES`,`da access denied`,e);if(a.status>=400)throw new i(`EIO`,`da readFile failed: ${a.status}`,e);let o=a.headers.get(`content-length`),s=o?Number(o):void 0;if(s!==void 0&&s>this.maxBodyBytes)throw new i(`EFBIG`,`body exceeds maxBodyBytes`,e);let c=new Uint8Array(await a.arrayBuffer());if(c.byteLength>this.maxBodyBytes)throw new i(`EFBIG`,`body exceeds maxBodyBytes`,e);let l=a.headers.get(`etag`)??``,u=l.startsWith(`W/`)?l.slice(2):l;return await this.cache.putBody(t,c,u),c}async writeFile(e,t){if(this.assertOpen(e),t.byteLength>this.maxBodyBytes)throw new i(`EFBIG`,`body exceeds maxBodyBytes`,e);let n=this.toMountRelative(e),a=await this.cache.getBody(n),o=p(m(e),r(e),t),s={"content-type":o.contentType,"content-length":String(o.body.byteLength)};a?.etag?s[`if-match`]=a.etag.startsWith(`W/`)?a.etag.slice(2):a.etag:a||(s[`if-none-match`]=`*`);let c=()=>this.transport({method:`POST`,path:this.toSourcePath(n),headers:s,body:o.body}),l,u=1;try{l=await c()}catch{u=2,l=await c()}if(l.status===412){if(u===2){let r=await this.transport({method:`HEAD`,path:this.toSourcePath(n)});if(r.status>=400)throw new i(`EIO`,`da reconcile HEAD failed: ${r.status}`,e);let a=r.headers.get(`etag`)??``;await this.cache.putBody(n,t,a);let o=n.split(`/`).slice(0,-1).join(`/`);await this.cache.invalidateListing(o);return}await this.cache.invalidateBody(n);try{await this.readFile(e)}catch{}throw new i(`EBUSY`,`remote modified since last read — re-read and retry`,e)}if(l.status===401||l.status===403)throw new i(`EACCES`,`da write denied`,e);if(l.status>=400)throw new i(`EIO`,`da writeFile failed: ${l.status}`,e);let d=l.headers.get(`etag`)??``;await this.cache.putBody(n,t,d);let f=n.split(`/`).slice(0,-1).join(`/`);await this.cache.invalidateListing(f)}async readDir(e){this.assertOpen(e);let t=this.toMountRelative(e).replace(/\/+$/,``),n=await this.cache.getListing(t);if(n&&!this.cache.isStale(n.cachedAt))return n.entries;let r=await this.transport({method:`GET`,path:this.toListPath(t)});if(r.status===404)throw new i(`ENOENT`,`no such directory`,e);if(r.status>=400)throw new i(`EIO`,`da list failed: ${r.status}`,e);let a=(await r.json()).map(e=>e.ext?{name:`${e.name}.${e.ext}`,kind:`file`,etag:e.etag,lastModified:e.lastModified}:{name:e.name,kind:`directory`,lastModified:e.lastModified});return await this.cache.putListing(t,a),a}async stat(e){this.assertOpen(e);let t=this.toMountRelative(e),n=await this.cache.getBody(t);if(n)return{kind:`file`,size:n.size,mtime:n.cachedAt,etag:n.etag};let r=t.split(`/`),a=r.pop()??``,o=r.join(`/`),s=await this.cache.getListing(o);if(s&&!this.cache.isStale(s.cachedAt)){let t=s.entries.find(e=>e.name===a);if(t?.kind===`file`&&t.size!==void 0)return{kind:`file`,size:t.size,mtime:t.lastModified??s.cachedAt,etag:t.etag??``};if(t?.kind===`directory`)return{kind:`directory`,size:0,mtime:t.lastModified??s.cachedAt};if(!t)throw new i(`ENOENT`,`no such file or directory`,e)}let c=await this.transport({method:`HEAD`,path:this.toSourcePath(t)});if(c.status===200){let e=Number(c.headers.get(`content-length`)??`0`),t=c.headers.get(`etag`)??``,n=c.headers.get(`last-modified`),r=n?Date.parse(n):0;if(s){let n=s.entries.map(n=>n.name===a&&n.kind===`file`?{...n,size:e,etag:t,lastModified:r}:n);await this.cache.putListing(o,n)}return{kind:`file`,size:e,mtime:r,etag:t}}if(c.status===404){let n=await this.cache.getListing(t);if(n)return{kind:`directory`,size:0,mtime:n.cachedAt};throw new i(`ENOENT`,`no such file or directory`,e)}throw new i(`EIO`,`da stat failed: ${c.status}`,e)}async mkdir(e){}async remove(e){this.assertOpen(e);let t=this.toMountRelative(e),n=await this.transport({method:`DELETE`,path:this.toSourcePath(t)});if(n.status===404)throw new i(`ENOENT`,`no such file`,e);if(n.status===401||n.status===403)throw new i(`EACCES`,`da delete denied`,e);if(n.status>=400)throw new i(`EIO`,`da delete failed: ${n.status}`,e);await this.cache.invalidateBody(t);let r=t.split(`/`).slice(0,-1).join(`/`);await this.cache.invalidateListing(r)}async refresh(e){this.assertOpen(`/`);let t={added:[],removed:[],changed:[],unchanged:0,errors:[]},n=[``];for(;n.length>0;){let e=n.pop();try{await this.refreshDir(e,t,n)}catch(n){t.errors.push({path:e,message:n instanceof Error?n.message:String(n)})}}return e?.bodies&&await this.refreshBodies(t),t}async classifyFile(e,t,n){let r=await this.cache.getBody(e);r?t&&r.etag!==t?(await this.cache.invalidateBody(e),n.changed.push(e)):n.unchanged++:n.added.push(e)}async refreshDir(e,t,n){let r=await this.transport({method:`GET`,path:this.toListPath(e)});if(r.status>=400){t.errors.push({path:e,message:`list failed: ${r.status}`});return}let i=await r.json(),a=[];for(let r of i)if(r.ext){let n=e?`${e}/${r.name}.${r.ext}`:`${r.name}.${r.ext}`;a.push({name:`${r.name}.${r.ext}`,kind:`file`,etag:r.etag,lastModified:r.lastModified}),await this.classifyFile(n,r.etag,t)}else a.push({name:r.name,kind:`directory`}),n.push(e?`${e}/${r.name}`:r.name);await this.cache.putListing(e,a)}async refreshBodies(e){for(let t of e.changed)try{await this.readFile(t)}catch(n){e.errors.push({path:t,message:n instanceof Error?n.message:String(n)})}}describe(){return{displayName:`${this.parsed.org}/${this.parsed.repo}${this.parsed.path?`/${this.parsed.path}`:``}`,source:this.source,profile:this.profile}}async close(){this.closed||=!0}};function _(e){let t=e.match(/^s3:\/\/([^/]+)(?:\/(.*))?$/);if(!t)throw Error(`invalid S3 source '${e}' — expected s3://bucket[/prefix]`);return{bucket:t[1],prefix:(t[2]??``).replace(/^\/+/,``).replace(/\/+$/,``)}}var v=class{kind=`s3`;source;profile;mountId;parsed;cache;maxBodyBytes;transport;closed=!1;constructor(e){this.source=e.source,this.profile=e.profile,this.mountId=e.mountId??crypto.randomUUID(),this.parsed=_(e.source),this.cache=e.cache,this.maxBodyBytes=e.maxBodyBytes??26214400,this.transport=e.signedFetch}assertOpen(e){if(this.closed)throw new i(`EBADF`,`mount closed`,e)}toMountRelative(e){return e.replace(/^\/+/,``)}toS3Key(e){let t=e.replace(/^\/+/,``).replace(/\/+$/,``);return[this.parsed.prefix,t].filter(e=>e.length>0).join(`/`)}toMountRelativeKey(e){return this.parsed.prefix?e.slice(this.parsed.prefix.length+1):e}async readFile(e){this.assertOpen(e);let t=this.toMountRelative(e),n=await this.cache.getBody(t);if(n&&!this.cache.isStale(n.cachedAt))return n.body;let r={};n&&(r[`if-none-match`]=n.etag);let a=await this.transport({method:`GET`,bucket:this.parsed.bucket,key:this.toS3Key(t),headers:r});if(a.status===304&&n)return await this.cache.putBody(t,n.body,n.etag),n.body;if(a.status===404)throw await this.cache.invalidateBody(t),new i(`ENOENT`,`no such file`,e);if(a.status===401||a.status===403)throw new i(`EACCES`,`s3 access denied`,e);if(a.status>=400)throw new i(`EIO`,`s3 readFile failed: ${a.status}`,e);let o=a.headers.get(`content-length`),s=o?Number(o):void 0;if(s!==void 0&&s>this.maxBodyBytes)throw new i(`EFBIG`,`body exceeds maxBodyBytes (${s} > ${this.maxBodyBytes})`,e);let c=new Uint8Array(await a.arrayBuffer());if(c.byteLength>this.maxBodyBytes)throw new i(`EFBIG`,`body exceeds maxBodyBytes`,e);let l=a.headers.get(`etag`)??``;return await this.cache.putBody(t,c,l),c}async writeFile(e,t){this.assertOpen(e);let n=this.toMountRelative(e);if(t.byteLength>this.maxBodyBytes)throw new i(`EFBIG`,`body exceeds maxBodyBytes`,e);let r=await this.cache.getBody(n),a={"content-type":`application/octet-stream`,"content-length":String(t.byteLength)};r?a[`if-match`]=r.etag:a[`if-none-match`]=`*`;let o=()=>this.transport({method:`PUT`,bucket:this.parsed.bucket,key:this.toS3Key(n),headers:a,body:t}),s,c=1;try{s=await o()}catch{c=2,s=await o()}if(s.status===412){if(c===2){let r=await this.transport({method:`HEAD`,bucket:this.parsed.bucket,key:this.toS3Key(n)});if(r.status>=400)throw new i(`EIO`,`s3 reconcile HEAD failed: ${r.status}`,e);let a=r.headers.get(`etag`)??``;await this.cache.putBody(n,t,a);let o=n.split(`/`).slice(0,-1).join(`/`);await this.cache.invalidateListing(o);return}await this.cache.invalidateBody(n);try{await this.readFile(e)}catch{}throw new i(`EBUSY`,`remote modified since last read — re-read and retry`,e)}if(s.status===401||s.status===403)throw new i(`EACCES`,`s3 write denied`,e);if(s.status>=400)throw new i(`EIO`,`s3 writeFile failed: ${s.status}`,e);let l=s.headers.get(`etag`)??``;await this.cache.putBody(n,t,l);let u=n.split(`/`).slice(0,-1).join(`/`);await this.cache.invalidateListing(u)}async listObjectsV2(){let e=[],t;do{let n={"list-type":`2`};this.parsed.prefix&&(n.prefix=`${this.parsed.prefix}/`),t&&(n[`continuation-token`]=t);let r=await this.transport({method:`GET`,bucket:this.parsed.bucket,key:``,query:n});if(r.status>=400)throw new i(`EIO`,`s3 list failed: ${r.status}`,`/`);let a=await r.text(),o=this.parseListingXml(a);e.push(...o.contents),t=o.nextContinuationToken}while(t);return e}parseListingXml(e){let t=[];for(let n of e.matchAll(/<Contents>([\s\S]*?)<\/Contents>/g)){let e=n[1],r=e.match(/<Key>([^<]+)<\/Key>/)?.[1]??``,i=e.match(/<ETag>([^<]+)<\/ETag>/)?.[1]??``,a=e.match(/<Size>([^<]+)<\/Size>/)?.[1]??`0`,o=e.match(/<LastModified>([^<]+)<\/LastModified>/)?.[1]??``;t.push({key:r,etag:i,size:Number(a),lastModified:o?Date.parse(o):0})}return{contents:t,nextContinuationToken:e.match(/<IsTruncated>([^<]+)<\/IsTruncated>/)?.[1]===`true`?e.match(/<NextContinuationToken>([^<]+)<\/NextContinuationToken>/)?.[1]:void 0}}async readDir(e){this.assertOpen(e);let t=this.toMountRelative(e).replace(/\/+$/,``),n=await this.cache.getListing(t);if(n&&!this.cache.isStale(n.cachedAt))return n.entries;let r=await this.listObjectsV2(),i=this.groupByDir(r);for(let[e,t]of i)await this.cache.putListing(e,t);return i.get(t)??[]}groupByDir(e){let t=new Map,n=e=>(t.has(e)||t.set(e,[]),t.get(e));n(``);for(let t of e){let e=this.toMountRelativeKey(t.key).split(`/`),r=e.pop();n(e.join(`/`)).push({name:r,kind:`file`,size:t.size,etag:t.etag,lastModified:t.lastModified});let i=``;for(let t of e){let e=i;i=i?`${i}/${t}`:t;let r=n(e);r.find(e=>e.name===t&&e.kind===`directory`)||r.push({name:t,kind:`directory`}),n(i)}}return t}async stat(e){this.assertOpen(e);let t=this.toMountRelative(e),n=await this.cache.getBody(t);if(n)return{kind:`file`,size:n.body.byteLength,mtime:n.cachedAt,etag:n.etag};let r=t.split(`/`),a=r.pop()??``,o=r.join(`/`),s=await this.cache.getListing(o);if(s&&!this.cache.isStale(s.cachedAt)){let t=s.entries.find(e=>e.name===a);if(t?.kind===`file`&&t.size!==void 0)return{kind:`file`,size:t.size,mtime:t.lastModified??s.cachedAt,etag:t.etag??``};if(t?.kind===`directory`)return{kind:`directory`,size:0,mtime:t.lastModified??s.cachedAt};if(!t)throw new i(`ENOENT`,`no such file or directory`,e)}let c=await this.transport({method:`HEAD`,bucket:this.parsed.bucket,key:this.toS3Key(t)});if(c.status===200){let e=Number(c.headers.get(`content-length`)??`0`),t=c.headers.get(`etag`)??``,n=c.headers.get(`last-modified`);return{kind:`file`,size:e,mtime:n?Date.parse(n):0,etag:t}}if(c.status===404){let n=await this.cache.getListing(t);if(n)return{kind:`directory`,size:0,mtime:n.cachedAt};throw new i(`ENOENT`,`no such file or directory`,e)}throw new i(`EIO`,`s3 stat failed: ${c.status}`,e)}async refresh(e){this.assertOpen(`/`);let t=await this.listObjectsV2(),n=new Set(t.map(e=>this.toMountRelativeKey(e.key))),r=new Map(t.map(e=>[this.toMountRelativeKey(e.key),e.etag])),i={added:[],removed:[],changed:[],unchanged:0,errors:[]};for(let e of n){let t=await this.cache.getBody(e),n=r.get(e);t?t.etag===n?i.unchanged++:(await this.cache.invalidateBody(e),i.changed.push(e)):i.added.push(e)}let a=this.groupByDir(t);for(let[e,t]of a)await this.cache.putListing(e,t);if(e?.bodies)for(let e of i.changed)try{await this.readFile(e)}catch(t){i.errors.push({path:e,message:t instanceof Error?t.message:String(t)})}return i}async mkdir(e){}async remove(e,t){this.assertOpen(e);let n=this.toMountRelative(e);if(t?.recursive)throw new i(`EINVAL`,`recursive remove not yet supported on S3`,e);let r=await this.transport({method:`DELETE`,bucket:this.parsed.bucket,key:this.toS3Key(n)});if(r.status===404)throw new i(`ENOENT`,`no such file`,e);if(r.status===401||r.status===403)throw new i(`EACCES`,`s3 delete denied`,e);if(r.status>=400)throw new i(`EIO`,`s3 delete failed: ${r.status}`,e);await this.cache.invalidateBody(n);let a=n.split(`/`).slice(0,-1).join(`/`);await this.cache.invalidateListing(a)}describe(){return{displayName:this.parsed.prefix?`${this.parsed.bucket}/${this.parsed.prefix}`:this.parsed.bucket,source:this.source,profile:this.profile}}async close(){this.closed||=!0}},y=class extends Error{constructor(e){super(e),this.name=`ProfileNotConfiguredError`}};async function b(){let{getAccounts:e}=await import(`./account-store-CScbFg3i.js`).then(e=>e.t),t=e().find(e=>e.providerId===`adobe`);if(!t?.accessToken)throw new y(`No Adobe IMS account found. Log in via Settings → Providers → Adobe first.`);return{identity:`adobe-ims`,getBearerToken:async()=>t.accessToken}}let x;function S(e){x=e}function C(){return x}const w=n,T=t,E=new Set([`invalid_profile`,`invalid_request`,`profile_not_configured`,`fetch_failed`,`internal`]),D=new Set([101,103,204,205,304]);function O(e){if(!e.ok)throw e.errorCode===`profile_not_configured`||e.errorCode===`invalid_profile`?new i(`EACCES`,e.error):e.errorCode===`invalid_request`?new i(`EINVAL`,e.error):e.errorCode===`fetch_failed`||e.errorCode===`internal`||E.has(String(e.errorCode))?new i(`EIO`,e.error):new i(`EINVAL`,`mount transport returned unrecognized errorCode '${e.errorCode}': ${e.error}`);let t;try{t=w(e.bodyBase64)}catch(e){throw new i(`EIO`,`mount transport: response body decode failed: ${e instanceof Error?e.message:String(e)}`)}let n=D.has(e.status)?null:t;return new Response(n,{status:e.status,headers:new Headers(e.headers)})}function k(e,t){return t===void 0?e===`node-rest`?` (SLICC backend at localhost may not be running)`:e===`extension-direct`||e===`extension-delegate`?` (extension service worker not responding)`:``:``}async function A(e){let t=C();if(!t)throw new i(`EIO`,`mount transport unavailable: setMountCapabilityBroker was never called for this float (composition bug — refusing to guess a transport for a privileged sign-and-forward request)`);let n=await t.mounts.signRequest(e);if(!n.ok){let e=`status`in n?n.status:void 0;throw new i(`EIO`,`mount transport failed: ${n.message}${k(t.adapter,e)}`)}return n.value}function j(e){return async t=>O(await A({backend:`s3`,envelope:{profile:e,method:t.method,bucket:t.bucket,key:t.key,query:t.query,headers:t.headers,bodyBase64:t.body?T(t.body):void 0}}))}function M(e){let t=e?.getImsToken??(async()=>(await b()).getBearerToken());return async e=>{let n;try{n=await t()}catch(e){throw new i(`EACCES`,`DA mount: ${e instanceof Error?e.message:String(e)}`)}return O(await A({backend:`da`,envelope:{imsToken:n,method:e.method,path:e.path,origin:e.origin,query:e.query,headers:e.headers,bodyBase64:e.body?T(e.body):void 0}}))}}var N=e({AEM_SOURCE_BUS_ORIGIN:()=>s,AemMountBackend:()=>f,DaMountBackend:()=>g,RemoteMountCache:()=>o,S3MountBackend:()=>v,makeSignedFetchDa:()=>M,makeSignedFetchS3:()=>j});export{v as a,f as c,S as i,M as n,g as o,j as r,s,N as t};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-Dd_uD5pT.js";import{i as t,n}from"./mount-index-CQfmUPuZ.js";import{a as r,c as i,n as a,o,r as s}from"./mount-CTTWc8xh.js";import{n as c}from"./mount-table-store-DrF_Ifaz.js";import{t as l}from"./remote-cache-BE5T1-53.js";var u=e({formatMountRecoveryPrompt:()=>_,mdInlineCode:()=>g,recoverMounts:()=>m,shellQuote:()=>h});function d(e){return e instanceof Error?e.message:String(e)}async function f(e,r,i,a){let o=await c(r.idbHandleKey),s=typeof o?.name==`string`?o.name:``,l={kind:`local`,path:e,dirName:s};if(!o||!(`queryPermission`in o))return{entry:l,ok:!1};let u;try{u=await o.queryPermission({mode:`readwrite`})}catch(t){return a?.warn?.(`queryPermission threw on persisted handle`,{path:e,error:d(t)}),{entry:l,ok:!1}}if(u!==`granted`)return{entry:l,ok:!1};try{let c=t.fromHandle(o,{mountId:r.mountId});return await i.mount(e,c,{limits:n}),a?.info?.(`Restored mount from previous session`,{path:e,name:s}),{entry:l,ok:!0}}catch(t){return a?.warn?.(`Failed to re-mount persisted handle`,{path:e,error:d(t)}),{entry:l,ok:!1}}}async function p(e,t,n,c){let{kind:u,source:f,profile:p,mountId:m}=t,h=u===`s3`?`S3`:u===`aem`?`AEM`:`DA`;try{let t={source:f,profile:p,cache:new l({mountId:m,ttlMs:3e4}),mountId:m},d=u===`s3`?new r({...t,signedFetch:s(p)}):u===`aem`?new i({...t,signedFetch:a()}):new o({...t,signedFetch:a()});return await n.mount(e,d),c?.info?.(`Restored ${h} mount from previous session`,{path:e,source:f}),{entry:{kind:u,path:e,source:f,profile:p,reason:``},ok:!0}}catch(t){let n=d(t);return c?.warn?.(`Failed to restore ${h} mount`,{path:e,error:n}),{entry:{kind:u,path:e,source:f,profile:p,reason:n},ok:!1}}}async function m(e,t,n){let r=[],i=[];for(let{targetPath:a,descriptor:o}of e){if(o.kind===`hostfs`)continue;let e=o.kind===`local`?await f(a,o,t,n):await p(a,o,t,n);(e.ok?r:i).push(e.entry)}return{restored:r,needsRecovery:i}}function h(e){return`'${e.replace(/'/g,`'\\''`)}'`}function g(e){let t=e.replace(/\r\n|[\r\n]/g,` `),n=t.match(/`+/g),r=n?Math.max(...n.map(e=>e.length))+1:1,i="`".repeat(r);return`${i}${t.startsWith("`")||t.endsWith("`")?` ${t} `:t}${i}`}function _(e){if(!Array.isArray(e)||e.length===0)return null;let t=e.length===1?`mount point`:`mount points`,n=e.length===1?`it`:`them`,r=e.filter(e=>e.kind===`local`),i=e.filter(e=>e.kind===`s3`||e.kind===`da`||e.kind===`aem`),a=[`[Session Reload] Mount recovery required for ${e.length} ${t}.`,``];if(r.length>0){let e=r.map(({path:e,dirName:t})=>{let n=t?` (previously mounted from ${g(t)})`:``;return`- ${g(e)}${n}`}),i=r.map(({path:e})=>` mount ${h(e)}`);a.push(`The page was reloaded and the following local ${t} lost filesystem permission. The browser cannot restore access without a fresh user gesture, so ${n} cannot be used until the user re-authorizes:`,``,...e,``,`Please tell the user what happened and ask whether they want to re-mount. If yes, run the corresponding command(s) so the folder picker opens and they can re-select the same directory:`,``,...i,``)}if(i.length>0){let e=i.map(({path:e,source:t,profile:n,reason:r})=>{let i=n==="default"?``:` --profile ${h(n)}`,a=`mount --source ${h(t)}${i} ${h(e)}`;return`- ${g(e)} (${g(t)}, profile ${g(n)}) — ${r}\n Retry: ${g(a)}`});a.push(`The following remote ${t} could not be auto-restored:`,``,...e,``)}return a.push("If the user no longer needs a mount, run `mount unmount <path>` (with the path shell-quoted the same way) to clear the stale entry instead."),a.join(`
|
|
2
|
-
`)}export{u as n,h as r,_ as t};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/secrets-bridge-client--VZ3E0yk.js","assets/rolldown-runtime-Dd_uD5pT.js","assets/port-bridge-client-Dn8JtUyP.js","assets/preload-helper-Czpn1I53.js","assets/logger-DDBAeTLF.js","assets/proxied-fetch-DyBveeCl.js","assets/base64-DJRlyqZu.js","assets/fetch-body-1l9I58Vk.js","assets/api-endpoint-DGxXvrur.js","assets/runtime-env-Dlaokqg1.js","assets/mount-bridge-client-CO2HxXrT.js","assets/types-D8gIX-W-.js","assets/page-approval-service-B8t-buCi.js","assets/float-topology-YtctpJaG.js","assets/speak-DivfwK0_.js","assets/speech-assets-bridge-CFYafE89.js","assets/transformers-env-7c5cDYNs.js","assets/wc-shell-CKhQ3qyn.js","assets/mime-types-D0xZwlMO.js","assets/bridge-protocol-06nbmp2X.js","assets/account-store-DEob4Tob.js","assets/core-BMcS6rur.js","assets/compat-qQM4gjF_.js","assets/models-BSkXF4T6.js","assets/diagnostics-DN_idNHx.js","assets/provider-env-CTOcDKrQ.js","assets/__vite-browser-external-5eBdwsFd.js","assets/openrouter.models-B-zmcypy.js","assets/libesm-BypnjKEL.js","assets/secret-topology-DLJBhHOi.js","assets/image-markers-BFDmhPy4.js","assets/tool-ui-eSQ1g2I1.js","assets/providers-BT71Fchh.js","assets/panel-rpc-B3MSVImO.js","assets/bedrock-camp-compat-BeCSBUrZ.js","assets/claude-model-version-aqjj5mtp.js","assets/telemetry-DJyRzh6X.js","assets/same-file-identity-DuEcSmPX.js","assets/icons-BM2l-_K7.js","assets/wc-shell-WkeczD9x.css","assets/shared-mBEktoxE.js","assets/hear-CybMJQVi.js","assets/permissions-surface-registry-CilCRwhh.js","assets/whisper-session-Ch3Rub5j.js","assets/esptool-operations-CiccBbBW.js","assets/rom-eeWiO07Z.js","assets/mount-picker-popup--ijSfN8u.js","assets/picker-popup-sQtXmfAo.js","assets/usb-claim-broker-Dacw2Z3M.js","assets/usb-device-registry--JwKRTYp.js","assets/theme-engine-B5SkYf3E.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{t as e}from"./preload-helper-Czpn1I53.js";import"./proxied-fetch-DyBveeCl.js";import{J as t,m as n}from"./account-store-DEob4Tob.js";import{a as r,t as i}from"./api-endpoint-DGxXvrur.js";import"./main-yKaIA_zV.js";import{n as a,r as o}from"./hid-device-registry-B2R-0rNt.js";import{a as s,i as c}from"./serial-port-registry-CCqklAEr.js";import{_ as l,a as u,c as d,d as ee,f,g as p,h as te,i as ne,l as re,m as ie,n as ae,o as oe,p as se,r as ce,s as le,t as ue,u as de,v as m}from"./hid-operations-C97SZtrY.js";import{a as h,i as g}from"./usb-device-registry--JwKRTYp.js";import{a as _,c as v,d as y,f as b,g as x,h as S,i as C,l as w,m as T,n as E,o as D,p as O,r as k,s as A,t as j,u as M}from"./usb-operations-v1mGAdRY.js";function N(e={}){let t=new Map;return{...z(),...B(e),...fe(),...V(e),...pe(e),...me(e),...he(e,t),...ge(),..._e(e),...ve(e),...be(e),...R(),...I(),...L(),...P(),...F(),...Oe(),...ke()}}function P(){return{"secrets-bridge":async({type:t,payload:n})=>{let{callSecretsBridge:r}=await e(async()=>{let{callSecretsBridge:e}=await import(`./secrets-bridge-client--VZ3E0yk.js`).then(e=>e.t);return{callSecretsBridge:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]));return{response:await r(t,n)}}}}function F(){return{"mount-sign-and-forward":async({type:t,envelope:n})=>{let{callMountBridge:r}=await e(async()=>{let{callMountBridge:e}=await import(`./mount-bridge-client-CO2HxXrT.js`);return{callMountBridge:e}},__vite__mapDeps([10,2,3,4,5,1,6,7,8,9,11]));return{response:await r(t,n)}}}}function I(){return{"sudo-request":async({request:t,mode:n})=>{let{resolveSudoApprovalInPage:r}=await e(async()=>{let{resolveSudoApprovalInPage:e}=await import(`./page-approval-service-B8t-buCi.js`);return{resolveSudoApprovalInPage:e}},__vite__mapDeps([12,4,13,5,1,3,6,7,8,9]));return r(t,n??`resolve`)}}}function L(){return{"secret-request":async t=>{let{getSecretRequestSurface:n}=await e(async()=>{let{getSecretRequestSurface:e}=await import(`./secret-request-registry-DrOMKR1H.js`);return{getSecretRequestSurface:e}},[]),r=n();return r?r(t):{stored:!1,reason:`unavailable`}}}}function R(){return{"proxied-fetch":async({url:t,method:n,headers:r,body:i})=>{let{collectViaExtensionDelegate:a}=await e(async()=>{let{collectViaExtensionDelegate:e}=await import(`./proxied-fetch-DyBveeCl.js`).then(e=>e.i);return{collectViaExtensionDelegate:e}},__vite__mapDeps([5,1,3,6,7,8,9])),{head:o,body:s}=await a(t,{method:n,headers:r,body:i});return{head:o,body:s}}}}function z(){return{"page-info":()=>({origin:window.location.origin,href:window.location.href,title:document.title||``}),screencapture:async({mimeType:t,quality:n,mode:r,durationMs:i,audio:a})=>{let{captureDisplayMedia:o}=await e(async()=>{let{captureDisplayMedia:e}=await import(`./screencapture-media-YBE2VnLF.js`);return{captureDisplayMedia:e}},[]),s=await o(r===`video`?{mode:`video`,mimeType:t,durationMs:i??5e3,audio:!!a}:{mode:`image`,mimeType:t,quality:n});return{bytes:s.bytes.buffer.slice(s.bytes.byteOffset,s.bytes.byteOffset+s.bytes.byteLength),width:s.width,height:s.height,mimeType:s.mimeType,...s.durationMs===void 0?{}:{durationMs:s.durationMs}}},"speak-text":async({text:t,lang:n,voice:r,rate:i,pitch:a,volume:o})=>{let{speak:s}=await e(async()=>{let{speak:e}=await import(`./speak-DivfwK0_.js`);return{speak:e}},__vite__mapDeps([14,3,4,9,15,16,17,1,18,6,19,20,21,22,23,24,25,26,27,28,5,7,8,29,13,0,2,30,31,32,33,34,35,36,37,38,39,40]));return await s({text:t,lang:n,voice:r,rate:i,pitch:a,volume:o}),{done:!0}},"list-voices":async()=>{let{kokoroVoicesIfReady:t}=await e(async()=>{let{kokoroVoicesIfReady:e}=await import(`./speak-DivfwK0_.js`);return{kokoroVoicesIfReady:e}},__vite__mapDeps([14,3,4,9,15,16,17,1,18,6,19,20,21,22,23,24,25,26,27,28,5,7,8,29,13,0,2,30,31,32,33,34,35,36,37,38,39,40])),n=t().map(e=>({name:e.id,lang:e.lang,default:!1,onDevice:e.onDevice}));if(typeof speechSynthesis>`u`){if(n.length>0)return{voices:n};throw Error(`speechSynthesis is unavailable in this page`)}let r=speechSynthesis.getVoices();if(r.length>0)return{voices:[...n,...r.map(Q)]};let i=await new Promise(e=>{let t=()=>{speechSynthesis.removeEventListener(`voiceschanged`,t),e(speechSynthesis.getVoices())};speechSynthesis.addEventListener(`voiceschanged`,t),setTimeout(()=>{speechSynthesis.removeEventListener(`voiceschanged`,t),e(speechSynthesis.getVoices())},1e3)});return{voices:[...n,...i.map(Q)]}},"speak-status":async()=>{let{kokoroStatus:t}=await e(async()=>{let{kokoroStatus:e}=await import(`./speak-DivfwK0_.js`);return{kokoroStatus:e}},__vite__mapDeps([14,3,4,9,15,16,17,1,18,6,19,20,21,22,23,24,25,26,27,28,5,7,8,29,13,0,2,30,31,32,33,34,35,36,37,38,39,40]));return t()},"speak-warmup":async()=>{let{kokoroWarmup:t}=await e(async()=>{let{kokoroWarmup:e}=await import(`./speak-DivfwK0_.js`);return{kokoroWarmup:e}},__vite__mapDeps([14,3,4,9,15,16,17,1,18,6,19,20,21,22,23,24,25,26,27,28,5,7,8,29,13,0,2,30,31,32,33,34,35,36,37,38,39,40]));return t()},"synthesize-to-wav":async({text:t,lang:n,voice:r,rate:i})=>{let{synthesizeToWav:a}=await e(async()=>{let{synthesizeToWav:e}=await import(`./speak-DivfwK0_.js`);return{synthesizeToWav:e}},__vite__mapDeps([14,3,4,9,15,16,17,1,18,6,19,20,21,22,23,24,25,26,27,28,5,7,8,29,13,0,2,30,31,32,33,34,35,36,37,38,39,40])),o=await a({text:t,...n===void 0?{}:{lang:n},...r===void 0?{}:{voice:r},...i===void 0?{}:{rate:i}});return{bytes:o.buffer.slice(o.byteOffset,o.byteOffset+o.byteLength)}},"play-audio":async({bytes:e,volume:t})=>{if(typeof AudioContext>`u`)throw Error(`Web Audio API is unavailable in this page`);let n=new AudioContext;try{let r=await n.decodeAudioData(e.slice(0)),i=n.createBufferSource();if(i.buffer=r,t!==void 0){let e=n.createGain();e.gain.value=Math.max(0,Math.min(1,t)),i.connect(e),e.connect(n.destination)}else i.connect(n.destination);await new Promise(e=>{i.onended=()=>e(),i.start()})}finally{try{await n.close()}catch{}}return{done:!0}},"play-chime":async({tone:e})=>{let t={success:[880,1320],error:[440,220],notify:[660,660]},[n,r]=t[e??`notify`]??t.notify;if(typeof AudioContext>`u`)throw Error(`Web Audio API is unavailable in this page`);let i=new AudioContext;try{let e=i.currentTime;for(let[t,a]of[n,r].entries()){let n=i.createOscillator();n.type=`sine`,n.frequency.value=a;let r=i.createGain();r.gain.setValueAtTime(1e-4,e+t*.18),r.gain.exponentialRampToValueAtTime(.2,e+t*.18+.02),r.gain.exponentialRampToValueAtTime(1e-4,e+t*.18+.18),n.connect(r),r.connect(i.destination),n.start(e+t*.18),n.stop(e+t*.18+.2)}await new Promise(e=>setTimeout(e,450))}finally{try{await i.close()}catch{}}return{done:!0}}}}function B(e={}){return{"clipboard-read-text":async()=>{if(!navigator.clipboard?.readText)throw Error(`clipboard API unavailable`);return{text:await navigator.clipboard.readText()}},"clipboard-write-text":async({text:e})=>{if(!navigator.clipboard?.writeText)throw Error(`clipboard API unavailable`);return await $(),await navigator.clipboard.writeText(e),{done:!0}},"clipboard-write-image":async({bytes:e,mimeType:t})=>{if(!navigator.clipboard?.write||typeof ClipboardItem>`u`)throw Error(`clipboard image API unavailable`);let n,r=new Blob([e],{type:t});return n=t===`image/png`?r:await De(r),await $(),await navigator.clipboard.write([new ClipboardItem({"image/png":n})]),{done:!0}},"window-open":async({url:e,target:t,features:n})=>({opened:window.open(e,t??`_blank`,n??`noopener,noreferrer`)!==null}),"oauth-popup":async({url:t})=>{let n=await e.delegateOAuthLogin?.(t);return n?.delegated?{redirectUrl:n.redirectUrl,error:n.error}:{redirectUrl:await Te(t,e.getPermissionsSurface)}},"oauth-route":async()=>({delegate:await e.shouldDelegateOAuth?.()===!0}),"capture-camera":async e=>await Ce(e),"enumerate-media-devices":async()=>{if(!navigator.mediaDevices?.enumerateDevices)throw Error(`enumerateDevices is not supported in this browser`);let e=await navigator.mediaDevices.enumerateDevices(),t=e=>({deviceId:e.deviceId,label:e.label||``,...e.groupId?{groupId:e.groupId}:{}});return{videoinputs:e.filter(e=>e.kind===`videoinput`).map(t),audioinputs:e.filter(e=>e.kind===`audioinput`).map(t)}}}}function fe(){return{"hear-capture":async t=>{let{hearCapture:n}=await e(async()=>{let{hearCapture:e}=await import(`./hear-CybMJQVi.js`);return{hearCapture:e}},__vite__mapDeps([41,4,42,43,3,16,17,1,18,6,19,20,21,22,23,24,25,26,27,28,5,7,8,9,29,13,0,2,30,31,32,33,34,35,36,37,38,39,40]));return await n(t??{})},"hear-transcribe":async({bytes:t,lang:n})=>{let{hearTranscribe:r}=await e(async()=>{let{hearTranscribe:e}=await import(`./hear-CybMJQVi.js`);return{hearTranscribe:e}},__vite__mapDeps([41,4,42,43,3,16,17,1,18,6,19,20,21,22,23,24,25,26,27,28,5,7,8,9,29,13,0,2,30,31,32,33,34,35,36,37,38,39,40]));return await r(t,n)},"hear-status":async()=>{let{hearStatus:t}=await e(async()=>{let{hearStatus:e}=await import(`./hear-CybMJQVi.js`);return{hearStatus:e}},__vite__mapDeps([41,4,42,43,3,16,17,1,18,6,19,20,21,22,23,24,25,26,27,28,5,7,8,9,29,13,0,2,30,31,32,33,34,35,36,37,38,39,40]));return t()},"hear-warmup":async()=>{let{hearWarmup:t}=await e(async()=>{let{hearWarmup:e}=await import(`./hear-CybMJQVi.js`);return{hearWarmup:e}},__vite__mapDeps([41,4,42,43,3,16,17,1,18,6,19,20,21,22,23,24,25,26,27,28,5,7,8,9,29,13,0,2,30,31,32,33,34,35,36,37,38,39,40]));return t()}}}function V(r){return{"tray-reset":async()=>{if(!r.resetTray)throw Error(`host reset: no active tray session to reset`);return await r.resetTray()},"tray-webhook-rotate":async()=>{if(!r.rotateWebhook)throw Error(`webhook rotate: no active leader tray`);return await r.rotateWebhook()},"tray-webhook-revoke":async e=>{if(!r.revokeWebhook)throw Error(`webhook delete: no active leader tray`);return await r.revokeWebhook(e.webhookId),{ok:!0}},"tray-open-preview":async e=>{if(!r.mintPreview)throw Error(`serve: no active leader tray; cannot mint preview`);return await r.mintPreview(e)},"tray-revoke-preview":async e=>{if(!r.revokePreview)throw Error(`serve: no active leader tray; cannot revoke preview`);return await r.revokePreview(e)},"tray-list-previews":async()=>{if(!r.listPreviews)throw Error(`serve: no active leader tray; cannot list previews`);return await r.listPreviews()},"tray-mint-biscotto":async e=>{if(!r.mintBiscotto)throw Error(`biscotto: no active leader tray; cannot mint a seat`);return await r.mintBiscotto(e)},"tray-revoke-biscotto":async e=>{if(!r.revokeBiscotto)throw Error(`biscotto revoke: no active leader tray; cannot revoke a seat`);return await r.revokeBiscotto(e)},"tray-list-biscotti":async()=>{if(!r.listBiscotti)throw Error(`biscotti: no active leader tray; cannot list seats`);return await r.listBiscotti()},"tray-preview-logs":async({previewToken:e})=>{if(!r.getPreviewLifecycleRecords)throw Error(`serve --logs: no active leader tray; cannot read preview logs`);return r.getPreviewLifecycleRecords(e)},"tray-preview-truncate":async({previewToken:e})=>{if(!r.truncatePreviewLifecycleRecords)throw Error(`serve --truncate: no active leader tray; cannot truncate preview logs`);return r.truncatePreviewLifecycleRecords(e)},"tray-leave":async({workerBaseUrl:e,requestId:t})=>{if(!r.leaveTray)throw Error(`host leave: tray leave is not available in this environment`);return await r.leaveTray({workerBaseUrl:e,requestId:t})},"tray-join":async({joinUrl:e,requestId:t})=>{if(!r.joinTray)throw Error(`host join: tray join is not available in this environment`);return await r.joinTray({joinUrl:e,requestId:t})},"cherry-emit":async({runtimeId:e,name:t,detail:n})=>{if(!r.emitCherrySliccEvent)throw Error(`cherry-emit: not available in this environment`);return{delivered:r.emitCherrySliccEvent(e,t,n)}},"tray-exec":async e=>{if(!r.execOnRemote)throw Error(`ssh: no active leader tray in this environment`);return await r.execOnRemote(e)},"tray-exec-signal":({execToken:e})=>(r.signalRemoteExec?.({execToken:e}),{ok:!0}),"oauth-extras-set":({providerId:e,domains:r})=>(t(e,r),{storeAfter:n()}),"silent-renew":async({providerId:t})=>{let{getRegisteredProviderConfig:n}=await e(async()=>{let{getRegisteredProviderConfig:e}=await import(`./providers-BT71Fchh.js`).then(e=>e.r);return{getRegisteredProviderConfig:e}},__vite__mapDeps([32,1,3])),r=n(t);return r?.onSilentRenew?{accessToken:await r.onSilentRenew()}:{accessToken:null}},"save-oauth-accounts":({accountsJson:e})=>(localStorage.setItem(`slicc_accounts`,e),{storedJson:localStorage.getItem(`slicc_accounts`)??e})}}function pe(e){let t=new Map,n=()=>{if(!e.sliccSidecar)throw Error(`slicc: sidecar attachments are not available in this environment`);return e.sliccSidecar},r=async(e,r)=>{let i=n(),a=new AbortController;t.set(e,a);try{return await r(i,a.signal)}finally{t.delete(e)}};return{"slicc-attach":async({joinUrl:e,name:t,connectTimeoutMs:r})=>await n().attach({joinUrl:e,name:t,connectTimeoutMs:r}),"slicc-detach":({name:e})=>({detached:n().detach(e)}),"slicc-list":()=>({attachments:n().list()}),"slicc-prompt":async({name:e,text:t,runToken:n,steer:i,timeoutMs:a})=>await r(n,async(n,r)=>await n.prompt(e,t,{steer:i,timeoutMs:a,signal:r})),"slicc-exec":async({name:e,command:t,runToken:n,cwd:i,env:a,timeoutMs:o,stdin:s})=>await r(n,async(n,r)=>await n.exec(e,t,{cwd:i,env:a,timeoutMs:o,stdin:s,signal:r})),"slicc-watch":async({name:e,runToken:t,durationMs:n,scoopJid:i,untilIdle:a})=>await r(t,async(t,r)=>await t.watch(e,{durationMs:n,scoopJid:i,untilIdle:a,signal:r})),"slicc-cancel":({runToken:e})=>(t.get(e)?.abort(),{ok:!0})}}function me(e){return xe(e.emitEvent),{"usb-list":async()=>({devices:await w(H(),G())}),"usb-request":async({filters:e})=>({device:await b(H(),G(),e)}),"usb-device-info":({handle:e})=>({device:A(H(),e)}),"usb-open":async({handle:e})=>(await M(H(),e),{done:!0}),"usb-close":async({handle:e,owner:t,force:n})=>(await C(H(),e,{owner:t,force:n}),{done:!0}),"usb-select-configuration":async({handle:e,configurationValue:t})=>(await T(H(),e,t),{done:!0}),"usb-claim-interface":async({handle:e,interfaceNumber:t,owner:n,wait:r})=>(await E(H(),e,t,{owner:n,wait:r}),{done:!0}),"usb-release-interface":async({handle:e,interfaceNumber:t,owner:n})=>(await y(H(),e,t,{owner:n}),{done:!0}),"usb-cancel-claim-wait":async({handle:e,interfaceNumber:t,owner:n})=>(await j(H(),e,t,n??`usb`),{done:!0}),"usb-drop-owner":async({owner:e})=>(await v(H(),e),{done:!0}),"usb-control-transfer-in":async({handle:e,setup:t,length:n})=>_(H(),e,t,n),"usb-control-transfer-out":async({handle:e,setup:t,bytes:n})=>D(H(),e,t,n),"usb-transfer-in":async({handle:e,endpointNumber:t,length:n})=>S(H(),e,t,n),"usb-transfer-out":async({handle:e,endpointNumber:t,bytes:n})=>x(H(),e,t,n),"usb-reset":async({handle:e,owner:t,force:n})=>(await O(H(),e,{owner:t,force:n}),{done:!0}),"usb-clear-halt":async({handle:e,direction:t,endpointNumber:n})=>(await k(H(),e,t,n),{done:!0})}}function he(e,t){return{"hid-list":async()=>({devices:await ce(K(),q())}),"hid-request":async({filters:e})=>({devices:await oe(K(),q(),e)}),"hid-device-info":({handle:e})=>({device:ae(K(),e)}),"hid-open":async({handle:e})=>(await ne(K(),e),{done:!0}),"hid-close":async({handle:e})=>(await ue(K(),e),{done:!0}),"hid-send-report":async({handle:e,reportId:t,bytes:n})=>(await d(K(),e,t,n),{done:!0}),"hid-send-feature-report":async({handle:e,reportId:t,bytes:n})=>(await le(K(),e,t,n),{done:!0}),"hid-receive-feature-report":async({handle:e,reportId:t})=>u(K(),e,t),"hid-subscribe-input-reports":async({handle:n})=>{t.get(n)?.();let r=await re(K(),n,t=>{e.emitEvent?.(`hid-input-report`,{handle:n,reportId:t.reportId,bytes:t.bytes})});return t.set(n,r),{done:!0}},"hid-unsubscribe-input-reports":({handle:e})=>(t.get(e)?.(),t.delete(e),{done:!0})}}function ge(){return{"serial-list":async()=>({devices:await se(J(),Y())}),"serial-request":async({filters:e})=>({device:await p(J(),Y(),e)}),"serial-device-info":({handle:e})=>({device:ee(J(),e)}),"serial-open":async({handle:e,options:t})=>(await ie(J(),e,t),{done:!0}),"serial-close":async({handle:e})=>(await de(J(),e),{done:!0}),"serial-read":async({handle:e,maxBytes:t,until:n,timeoutMs:r})=>{let i=await te(J(),e,{maxBytes:t,until:n?new Uint8Array(n):void 0,timeoutMs:r});return{bytes:i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength)}},"serial-write":async({handle:e,bytes:t})=>({bytesWritten:await m(J(),e,new Uint8Array(t))}),"serial-get-signals":async({handle:e})=>({signals:await f(J(),e)}),"serial-set-signals":async({handle:e,signals:t})=>(await l(J(),e,t),{done:!0})}}function _e(t){return{"esptool-chip-info":async({handle:n,baudRate:r})=>(await e(()=>import(`./esptool-operations-CiccBbBW.js`),__vite__mapDeps([44,1,3,45]))).esptoolChipInfo(J(),n,r,e=>t.emitEvent?.(`esptool-progress`,{handle:n,line:e})),"esptool-read-mac":async({handle:n,baudRate:r})=>(await e(()=>import(`./esptool-operations-CiccBbBW.js`),__vite__mapDeps([44,1,3,45]))).esptoolReadMac(J(),n,r,e=>t.emitEvent?.(`esptool-progress`,{handle:n,line:e})),"esptool-erase-flash":async({handle:n,baudRate:r})=>(await(await e(()=>import(`./esptool-operations-CiccBbBW.js`),__vite__mapDeps([44,1,3,45]))).esptoolEraseFlash(J(),n,r,e=>t.emitEvent?.(`esptool-progress`,{handle:n,line:e})),{done:!0}),"esptool-flash":async({handle:n,baudRate:r,eraseAll:i,segments:a})=>(await(await e(()=>import(`./esptool-operations-CiccBbBW.js`),__vite__mapDeps([44,1,3,45]))).esptoolFlash(J(),n,r,i,a.map(e=>({address:e.address,data:new Uint8Array(e.bytes)})),e=>t.emitEvent?.(`esptool-progress`,{handle:n,line:e})),{done:!0}),"esptool-read-flash":async({handle:n,baudRate:r,address:i,size:a})=>{let o=await(await e(()=>import(`./esptool-operations-CiccBbBW.js`),__vite__mapDeps([44,1,3,45]))).esptoolReadFlash(J(),n,r,i,a,e=>t.emitEvent?.(`esptool-progress`,{handle:n,line:e}));return{bytes:o.buffer.slice(o.byteOffset,o.byteOffset+o.byteLength)}},"esptool-read-reg":async({handle:n,baudRate:r,address:i})=>(await e(()=>import(`./esptool-operations-CiccBbBW.js`),__vite__mapDeps([44,1,3,45]))).esptoolReadReg(J(),n,r,i,e=>t.emitEvent?.(`esptool-progress`,{handle:n,line:e})),"esptool-flash-id":async({handle:n,baudRate:r})=>(await e(()=>import(`./esptool-operations-CiccBbBW.js`),__vite__mapDeps([44,1,3,45]))).esptoolFlashId(J(),n,r,e=>t.emitEvent?.(`esptool-progress`,{handle:n,line:e})),"esptool-erase-region":async({handle:n,baudRate:r,address:i,size:a})=>(await(await e(()=>import(`./esptool-operations-CiccBbBW.js`),__vite__mapDeps([44,1,3,45]))).esptoolEraseRegion(J(),n,r,i,a,e=>t.emitEvent?.(`esptool-progress`,{handle:n,line:e})),{done:!0}),"esptool-run":async({handle:n,baudRate:r})=>(await(await e(()=>import(`./esptool-operations-CiccBbBW.js`),__vite__mapDeps([44,1,3,45]))).esptoolRun(J(),n,r,e=>t.emitEvent?.(`esptool-progress`,{handle:n,line:e})),{done:!0})}}function ve(e){return{"list-remote-targets":async()=>e.listRemoteTargets?{targets:(await e.listRemoteTargets()).filter(e=>e.targetId.includes(`:`)).map(e=>({targetId:e.targetId,title:e.title,url:e.url}))}:{targets:[]},"remote-cdp-send":async({runtimeId:t,localTargetId:n,method:r,params:i,sessionId:a,timeout:o})=>{if(!e.remoteCdp)throw Error(`remote-cdp bridge not available`);return e.remoteCdp.send({runtimeId:t,localTargetId:n,method:r,params:i,sessionId:a,timeout:o})},"remote-cdp-subscribe":async({runtimeId:t,localTargetId:n,event:r})=>{if(!e.remoteCdp)throw Error(`remote-cdp bridge not available`);return e.remoteCdp.subscribe({runtimeId:t,localTargetId:n,event:r})},"remote-cdp-unsubscribe":async({runtimeId:t,localTargetId:n,event:r})=>{if(!e.remoteCdp)throw Error(`remote-cdp bridge not available`);return e.remoteCdp.unsubscribe({runtimeId:t,localTargetId:n,event:r})},"remote-cdp-detach":async({runtimeId:t,localTargetId:n})=>{if(!e.remoteCdp)throw Error(`remote-cdp bridge not available`);return e.remoteCdp.detach({runtimeId:t,localTargetId:n})},"remote-open-tab":async({runtimeId:t,url:n})=>{if(!e.remoteCdp)throw Error(`remote-cdp bridge not available`);return e.remoteCdp.openTab({runtimeId:t,url:n})}}}function ye(e,t){return t===void 0?e.length>0&&e.every(e=>e===`camera`||e===`microphone`):t}function be(t){return{"permission-request":async n=>{let r=t.getPermissionsSurface?.()??null;if(!r)throw Error(`permission-request: permission surface unavailable`);let i=await r.prompt({kinds:n.kinds,description:n.description,heading:n.heading,grantLabel:n.grantLabel,cancelLabel:n.cancelLabel,skipIfGranted:ye(n.kinds,n.skipIfGranted)});if(i.status!==`granted`){let e=i.message?`: ${i.message}`:``;throw Error(`permission-request: ${i.reason??i.status}${e}`)}let a=[];for(let t of i.grants)switch(t.kind){case`usb`:{let e=H().register(t.device);a.push({kind:`usb`,handle:e});break}case`hid`:{let e=K().register(t.device);a.push({kind:`hid`,handle:e});break}case`serial`:{let e=J().register(t.port);a.push({kind:`serial`,handle:e});break}case`filesystem`:{let{storePendingHandle:n}=await e(async()=>{let{storePendingHandle:e}=await import(`./mount-picker-popup--ijSfN8u.js`);return{storePendingHandle:e}},__vite__mapDeps([46,4,47,9])),r=`pendingMount:rpc-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`;await n(r,t.handle),a.push({kind:`filesystem`,idbKey:r,dirName:t.handle.name});break}case`camera`:case`microphone`:case`screenshare`:for(let e of t.stream.getTracks())e.stop();a.push({kind:t.kind,ok:!0})}return{grants:a}}}}function H(){return h()}var U=null,W;function xe(t){W=t,!(U||!t)&&e(()=>import(`./usb-claim-broker-Dacw2Z3M.js`).then(e=>{U||=e.addClaimListener(H(),e=>{W?.(`usb-claim-event`,e)})}),__vite__mapDeps([48,49,1]))}function G(){let e=g();if(!e)throw Error(`WebUSB is unavailable in this browser`);return e}function K(){return o()}function q(){let e=a();if(!e)throw Error(`WebHID is unavailable in this browser`);return e}function J(){return s()}function Y(){let e=c();if(!e)throw Error(`Web Serial is unavailable in this browser`);return e}var Se=1500;async function Ce(e){if(!navigator.mediaDevices?.getUserMedia)throw Error(`getUserMedia is not supported in this browser`);let t=e.mode===`photo`||e.captureVideo!==!1,n=!!e.captureAudio&&e.mode===`video`;if(!t&&!n)throw Error(`camera capture: at least one of video or audio must be requested`);let r=await we({wantVideo:t,videoDeviceId:t?await X(e.deviceId,`videoinput`):void 0,audioDeviceId:n?await X(e.audioDeviceId,`audioinput`):void 0,wantAudio:n,width:e.width,height:e.height,frameRate:e.frameRate,exact:!!e.exactSize});try{let n=null,i=0,a=0;if(t){n=document.createElement(`video`),n.srcObject=r,n.muted=!0,n.playsInline=!0;let e=n;await new Promise((t,n)=>{e.onloadedmetadata=()=>e.play().then(()=>t()).catch(n),e.onerror=()=>n(Error(`Failed to load camera stream`))}),await new Promise(e=>requestAnimationFrame(()=>e())),await new Promise(e=>requestAnimationFrame(()=>e())),i=e.videoWidth,a=e.videoHeight}if(e.mode===`photo`){if(!n)throw Error(`photo capture requires a video track`);let t=e.warmupMs??Se;t>0&&await new Promise(e=>setTimeout(e,t));let r=document.createElement(`canvas`);r.width=i,r.height=a;let o=r.getContext(`2d`);if(!o)throw Error(`Failed to get canvas context`);o.drawImage(n,0,0,i,a);let s=await new Promise((t,n)=>{r.toBlob(e=>e?t(e):n(Error(`Failed to encode photo`)),e.mimeType,e.quality)});return{bytes:await s.arrayBuffer(),mimeType:s.type||e.mimeType,width:i,height:a}}let o=Math.max(100,Math.min(e.durationMs??5e3,6e4)),s=typeof MediaRecorder<`u`&&MediaRecorder.isTypeSupported(e.mimeType)?e.mimeType:`video/webm`,c=new MediaRecorder(r,{mimeType:s}),l=[];c.ondataavailable=e=>{e.data&&e.data.size>0&&l.push(e.data)};let u=new Promise(e=>{c.onstop=()=>e()});c.start(),await new Promise(e=>setTimeout(e,o)),c.stop(),await u;let d=new Blob(l,{type:s});return{bytes:await d.arrayBuffer(),mimeType:d.type||s,width:i,height:a,durationMs:o}}finally{r.getTracks().forEach(e=>{e.stop()})}}async function X(e,t){if(e===void 0||e===``)return;if(!/^\d+$/.test(e))return e;if(!navigator.mediaDevices?.enumerateDevices)return;let n=parseInt(e,10);return(await navigator.mediaDevices.enumerateDevices()).filter(e=>e.kind===t)[n]?.deviceId}async function we(e){let t=t=>{if(!e.wantVideo)return!1;let n={};return e.videoDeviceId&&(n.deviceId={exact:e.videoDeviceId}),e.width&&(n.width=t===`exact`?{exact:e.width}:{ideal:e.width}),e.height&&(n.height=t===`exact`?{exact:e.height}:{ideal:e.height}),e.frameRate&&(n.frameRate=t===`exact`?{exact:e.frameRate}:{ideal:e.frameRate}),Object.keys(n).length>0?n:!0},n=()=>e.wantAudio?!e.audioDeviceId||{deviceId:{exact:e.audioDeviceId}}:!1;try{return await navigator.mediaDevices.getUserMedia({video:t(e.exact?`exact`:`ideal`),audio:n()})}catch(r){let i=r?.name;if(!e.exact||i!==`OverconstrainedError`&&i!==`NotReadableError`)throw r;return console.warn(`panel-rpc:capture-camera: exact ${e.width??`?`}x${e.height??`?`}@${e.frameRate??`?`} unmet, falling back to ideal`),await navigator.mediaDevices.getUserMedia({video:t(`ideal`),audio:n()})}}async function Te(e,t){if((typeof navigator<`u`?navigator.userActivation:void 0)?.isActive===!0)return Z(window.open(e,`_blank`,`width=500,height=700,popup=yes`));let n=t?.()??null;if(n){let t=await Ee(n,e);return t===void 0?null:Z(t)}return Z(window.open(e,`_blank`,`width=500,height=700,popup=yes`))}function Z(e){return new Promise(t=>{let n=!1,a=null,o=()=>{n||(n=!0,window.removeEventListener(`message`,s),clearTimeout(c),a&&clearInterval(a))},s=n=>{if(n.data?.type!==`oauth-callback`||n.origin!==window.location.origin||e&&n.source!==e)return;if(o(),n.data.error){console.error(`[panel-rpc:oauth-popup] OAuth error:`,n.data.error),t(null);return}let r=n.data.redirectUrl;(typeof r==`string`||r==null)&&t(r??null)};window.addEventListener(`message`,s),a=setInterval(async()=>{if(!n)try{let e=await fetch(r(`/api/oauth-result`),{headers:i()});if(e.status===204||!e.ok)return;let a=await e.json();if(n)return;if(o(),a.error){console.error(`[panel-rpc:oauth-popup] Server relay OAuth error:`,a.error),t(null);return}t(a.redirectUrl??null)}catch(e){console.warn(`[panel-rpc:oauth-popup] Poll failed:`,e instanceof Error?e.message:String(e))}},1e3);let c=setTimeout(()=>{o();try{e?.close()}catch{}t(null)},12e4)})}async function Ee(e,t){let n=await e.prompt({kinds:[`popup`],description:`Continue to sign in. A new window will open to the provider.`,grantLabel:`Continue`,requestOptions:{popup:{url:t}}});if(n.status!==`granted`)return;let r=n.grants.find(e=>e.kind===`popup`);return r&&r.kind===`popup`?r.window:null}function Q(e){return{name:e.name,lang:e.lang,default:e.default,onDevice:!1}}async function De(e){let t=URL.createObjectURL(e);try{let e=new Image;await new Promise((n,r)=>{e.onload=()=>n(),e.onerror=()=>r(Error(`Failed to load image for clipboard conversion`)),e.src=t});let n=document.createElement(`canvas`);n.width=e.naturalWidth,n.height=e.naturalHeight;let r=n.getContext(`2d`);if(!r)throw Error(`Failed to get canvas context`);return r.drawImage(e,0,0),await new Promise((e,t)=>{n.toBlob(n=>n?e(n):t(Error(`PNG re-encode failed`)),`image/png`)})}finally{URL.revokeObjectURL(t)}}async function $(e=3e5){typeof document>`u`||typeof document.hasFocus==`function`&&(document.hasFocus()||await new Promise((t,n)=>{let r=()=>{window.removeEventListener(`focus`,i),document.removeEventListener(`visibilitychange`,a),clearTimeout(o)},i=()=>{document.hasFocus()&&(r(),t())},a=()=>{document.visibilityState===`visible`&&document.hasFocus()&&(r(),t())},o=setTimeout(()=>{r(),n(Error(`timed out waiting for window focus`))},e);window.addEventListener(`focus`,i),document.addEventListener(`visibilitychange`,a)}))}function Oe(){return{"theme-apply":async({themeJson:t,action:n})=>{let{importTheme:r,saveCustomTheme:i,setActiveTheme:a,clearActiveTheme:o,applyThemeOverrides:s}=await e(async()=>{let{importTheme:e,saveCustomTheme:t,setActiveTheme:n,clearActiveTheme:r,applyThemeOverrides:i}=await import(`./theme-engine-B5SkYf3E.js`).then(e=>e.m);return{importTheme:e,saveCustomTheme:t,setActiveTheme:n,clearActiveTheme:r,applyThemeOverrides:i}},__vite__mapDeps([50,1,4]));if(n===`reset`)return o(),s(),{applied:null};if(t){let e=r(t);return i(e),a(e.id),s(),{applied:e.id}}return{applied:null}}}}function ke(){return{"layout-apply":async t=>{let{getLayoutApplier:n}=await e(async()=>{let{getLayoutApplier:e}=await import(`./layout-apply-registry-Cw730jao.js`);return{getLayoutApplier:e}},[]),r=n();return r?await r(t)??{applied:!0}:{applied:!1,error:`no layout is mounted`}}}}export{N as createStandalonePanelRpcHandlers};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as e,n as t,t as n}from"./path-utils-DNJG-zQf.js";import{t as r}from"./types-D8gIX-W-.js";import"./fs-DZGgOIET.js";import{t as i}from"./write-verification-BOaZdtyk.js";let a;function o(){return a??=import(`./edit-BnFODSzt.js`).then(({createEditTool:e})=>e()),a}function s(e){return{ok:!0,value:e}}function c(e){return{ok:!1,error:e}}var l=class extends Error{code;path;constructor(e,t,n,r){super(t,r===void 0?void 0:{cause:r}),this.code=e,this.path=n,this.name=`FileError`}},u=class extends Error{code=`shell_unavailable`;constructor(e){super(e),this.name=`ExecutionError`}};function d(e){if(!(e instanceof r))return`unknown`;switch(e.code){case`ENOENT`:return`not_found`;case`EACCES`:return`permission_denied`;case`ENOTDIR`:return`not_directory`;case`EISDIR`:return`is_directory`;case`EINVAL`:case`ELOOP`:return`invalid`;default:return`unknown`}}function f(e,t){if(e instanceof l)return e;let n=e instanceof Error?e:Error(String(e));return new l(d(e),n.message,t,n)}function p(e,t){return e?.aborted?c(new l(`aborted`,`aborted`,t)):null}var m=class{fs;cwd;constructor(e,t){this.fs=e,this.cwd=t}async absolutePath(e,r){return p(r,e)||s(t(e.startsWith(`/`)?e:n(this.cwd,e)))}async canonicalPath(e,t){let n=await this.absolutePath(e,t);if(!n.ok)return n;try{return s(await this.fs.realpath(n.value))}catch(e){return c(f(e,n.value))}}async fileInfo(t,n){let r=await this.absolutePath(t,n);if(!r.ok)return r;try{let t=await this.fs.lstat(r.value);return s({name:e(r.value).base,path:r.value,kind:t.type,size:t.size,mtimeMs:t.mtime})}catch(e){return c(f(e,r.value))}}async readTextFile(e,t){let n=await this.absolutePath(e,t);if(!n.ok)return n;try{let e=await this.fs.readTextFile(n.value);return p(t,n.value)??s(e)}catch(e){return c(f(e,n.value))}}async writeFile(e,t,n){let r=await this.absolutePath(e,n);if(!r.ok)return r;try{if(await this.fs.writeFile(r.value,t),typeof t==`string`){let e=await i(this.fs,r.value,t);if(e)return c(new l(`unknown`,e,r.value))}return p(n,r.value)??s(void 0)}catch(e){return c(f(e,r.value))}}unsupported(e,t){return c(new l(`not_supported`,`${e} is unavailable to the edit tool`,t))}async joinPath(e){return s(n(...e))}async readTextLines(e,t){let n=await this.readTextFile(e,t?.abortSignal);if(!n.ok)return n;let r=n.value.split(/\r?\n/);return s(t?.maxLines===void 0?r:r.slice(0,t.maxLines))}async readBinaryFile(e){return this.unsupported(`readBinaryFile`,e)}async appendFile(e){return this.unsupported(`appendFile`,e)}async renameFile(e){return this.unsupported(`renameFile`,e)}async listDir(e){return this.unsupported(`listDir`,e)}async exists(e){return this.unsupported(`exists`,e)}async createDir(e){return this.unsupported(`createDir`,e)}async remove(e){return this.unsupported(`remove`,e)}async createTempDir(){return this.unsupported(`createTempDir`)}async createTempFile(){return this.unsupported(`createTempFile`)}async exec(){return c(new u(`Shell is unavailable to the edit tool`))}async cleanup(){}};const h=new WeakMap;function g(e,t){let n=h.get(e);n||h.set(e,n=new Map);let r=n.get(t);return r||n.set(t,r=new m(e,t)),r}async function _(e,t,n,r){return{content:(await(await o()).execute(`slicc-edit`,n,r,void 0,{env:g(e,t)})).content.filter(e=>e.type===`text`).map(e=>e.text).join(`
|
|
2
|
-
`)}}export{_ as executePiEdit};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./logger-LESFN7Hj.js";import{i as t,s as n,t as r}from"./providers-C1P4Z_in.js";import{_ as i,l as a,r as o}from"./account-store-CScbFg3i.js";import{u as s}from"./core-DP-MJcag.js";import{t as c}from"./redirect-uri-CgKdq7-K.js";import{discoverAuth as l,refreshAccessToken as u,runAuthFlow as d}from"./oauth-DR6XMm1M.js";import{n as f}from"./store-BbZGuhdS.js";import"./provider-store-access-DgZnuRxY.js";const p=e(`mcp-provider`);function m(){return typeof globalThis<`u`&&globalThis.indexedDB!==void 0}function h(e){return`mcp:${e}`}const g=new Map,_=new Set;async function v(e){if(e)return e;let{createProxiedFetch:t}=await import(`./proxied-fetch-DEK8DT-z.js`).then(e=>e.i),n=t();return async(e,t)=>{let r=await n(e,{method:t?.method,headers:t?.headers,body:t?.body}),i=new TextDecoder().decode(r.body);return{ok:r.status>=200&&r.status<300,status:r.status,statusText:r.statusText,text:async()=>i,json:async()=>JSON.parse(i),headers:{get:e=>r.headers[e.toLowerCase()]??null}}}}async function y(e){let t=g.get(h(e.name));if(t)return t;let n=await v(e.fetchImpl),r=await l(e.serverUrl,void 0,n);return g.set(h(e.name),r),r}function b(e){let t=h(e.name),n=(()=>{try{return new URL(e.serverUrl).host}catch{return``}})();return{id:t,name:`MCP: ${e.name}`,description:`MCP server at ${e.serverUrl}`,requiresApiKey:!1,requiresBaseUrl:!1,isOAuth:!0,oauthTokenDomains:n?[n]:[],getModelIds:()=>[],onOAuthLogin:async(n,r)=>{let a=e.launcher??n,o=await v(e.fetchImpl),l=await y(e),u=await d({asMetadata:l,clientId:e.auth.clientId,scope:e.auth.scope,redirectUri:e.auth.redirectUri??await c(s()),launcher:a,fetchImpl:o});await i({providerId:t,accessToken:u.accessToken,refreshToken:u.refreshToken,tokenExpiresAt:u.expiresAt,scopes:u.scope}),r()},onSilentRenew:async()=>{if(!a(t))return null;let n=o().find(e=>e.providerId===t),r=n?.refreshToken;if(!r)return p.info(`No refresh token for MCP provider, skipping silent renewal`,{id:t}),null;try{let a=await y(e),o=a.grantTypes??[];if(o.length>0&&!o.includes(`refresh_token`))return p.info(`AS does not advertise refresh_token grant; skipping silent renewal`,{id:t}),null;let s=await v(e.fetchImpl),c=await u({tokenEndpoint:a.tokenEndpoint,clientId:e.auth.clientId,refreshToken:r,scope:e.auth.scope,fetchImpl:s});return await i({providerId:t,accessToken:c.accessToken,refreshToken:c.refreshToken??r,tokenExpiresAt:c.expiresAt,scopes:c.scope??n.scopes}),c.accessToken}catch(e){return p.warn(`MCP silent renewal failed`,{id:t,error:e instanceof Error?e.message:String(e)}),null}}}}function x(e){let n=h(e.name);if(_.has(n))return;let r=b(e);t(r),_.add(n),p.debug(`Registered MCP provider`,{id:n})}async function S(e,t={}){let n=h(e);if(_.has(n)&&r(n))return!0;if(!m())return!1;let i=await f(e);return i?(x({name:e,serverUrl:i.serverUrl,auth:i.auth,...t}),!0):!1}async function C(){if(!m())return[];let{readMcpAuthEntries:e}=await import(`./provider-store-access-DgZnuRxY.js`),t=await e(),n=[];for(let e of t)x({name:e.name,serverUrl:e.serverUrl,auth:e.auth}),n.push(h(e.name));return n}function w(e){let t=h(e);return _.delete(t),g.delete(t),n(t)}export{C as ensureAllMcpProvidersRegistered,S as ensureMcpProviderRegistered,x as registerMcpProvider,w as removeMcpProvider};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./logger-LESFN7Hj.js";import"./account-store-CScbFg3i.js";import"./core-DP-MJcag.js";import"./tray-runtime-config-CRZxBChd.js";e(`provider-settings`);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./provider-G-FXP5U3.js";export{e as readMcpAuthEntries};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./store-BbZGuhdS.js";export{e as readMcpAuthEntries};
|