sliccy 6.173.2 → 6.173.4
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/ui/.vite/manifest.json +182 -181
- package/dist/ui/assets/{account-store-DkCw0bWM.js → account-store-CuBy1FG0.js} +1 -1
- package/dist/ui/assets/{account-store-4k9IUmk7.js → account-store-R2TQ8zwQ.js} +1 -1
- package/dist/ui/assets/{adobe-DHU1Fb0F.js → adobe-Cf2MsrGa.js} +1 -1
- package/dist/ui/assets/{adobe-BbP-Vnpw.js → adobe-Ki3YvmN6.js} +1 -1
- package/dist/ui/assets/{agent-panels-DsmU_IkC.js → agent-panels-D_229BEu.js} +1 -1
- package/dist/ui/assets/{almost-bash-shell-headless-Ijx68emR.js → almost-bash-shell-headless-DZz4WL2S.js} +30 -30
- package/dist/ui/assets/{apply-layout-Dvj6HbU2.js → apply-layout-CeImH4Bl.js} +1 -1
- package/dist/ui/assets/{apps-BAduDa72.js → apps-CNPx3KfR.js} +1 -1
- package/dist/ui/assets/{azure-openai-DyMQeZHE.js → azure-openai-B7Cja9Yk.js} +1 -1
- package/dist/ui/assets/{azure-openai-DeXqIIPZ.js → azure-openai-C-u1XNix.js} +1 -1
- package/dist/ui/assets/{backend-hostfs-DRTKdm-T.js → backend-hostfs-BKMp2JUS.js} +1 -1
- package/dist/ui/assets/{cdp-BXJuSYNc.js → cdp-CI2EqSBn.js} +1 -1
- package/dist/ui/assets/{cerebras-nQKYN8JV.js → cerebras-DNn3XtbR.js} +1 -1
- package/dist/ui/assets/{cerebras-sB_xLT16.js → cerebras-n6IaTJmB.js} +1 -1
- package/dist/ui/assets/{composer-speech-D66bpqkf.js → composer-speech-KF-1MV65.js} +1 -1
- package/dist/ui/assets/{connect-surface-BVs2icQM.js → connect-surface-yMJCYVKF.js} +1 -1
- package/dist/ui/assets/{directed-approval-DraCPcvg.js → directed-approval-GsbJxVpV.js} +1 -1
- package/dist/ui/assets/{ensure-speech-assets-Ej2tXMnO.js → ensure-speech-assets-AMKv34W8.js} +1 -1
- package/dist/ui/assets/{frozen-archive-writer-Bm9FP0xd.js → frozen-archive-writer-Ba2rJGyG.js} +1 -1
- package/dist/ui/assets/{fs-YUdF6cLl.js → fs-9OcORTu3.js} +2 -2
- package/dist/ui/assets/{fs-CQMAQAxQ.js → fs-CTQO1m5q.js} +1 -1
- package/dist/ui/assets/{gelatiere-store-D9Z-7kVR.js → gelatiere-store-vZMdA_vO.js} +1 -1
- package/dist/ui/assets/{gelatiere-unit-ArKrgi6G.js → gelatiere-unit-cNWC87QD.js} +1 -1
- package/dist/ui/assets/{github-EZmHZIwn.js → github-DRKDMQJL.js} +1 -1
- package/dist/ui/assets/{github-auth-BihnA4qe.js → github-auth-C3FvgS7w.js} +1 -1
- package/dist/ui/assets/{github-copilot-CKAsR-g4.js → github-copilot-CM0Cfdn_.js} +1 -1
- package/dist/ui/assets/{github-copilot-BbLxbL7k.js → github-copilot-DNbsxJ6H.js} +1 -1
- package/dist/ui/assets/{github-install-DTQdHpGs.js → github-install-2qEU8XsC.js} +1 -1
- package/dist/ui/assets/{github-B7vUYtc9.js → github-r6Zk2Tcv.js} +2 -2
- package/dist/ui/assets/{github-zip-Ct2tllOn.js → github-zip-DAh-EMD1.js} +1 -1
- package/dist/ui/assets/{hear-CURm4j-1.js → hear-Cl7F59vQ.js} +1 -1
- package/dist/ui/assets/{help-Bjz_VoE4.js → help-BmBXowoR.js} +1 -1
- package/dist/ui/assets/{installer-BvUI5SgV.js → installer-D3IXpUYH.js} +1 -1
- package/dist/ui/assets/{js-realm-worker-B1RWXJiW.js → js-realm-worker-B5u17RNS.js} +1 -1
- package/dist/ui/assets/{jsh-executor-Cilk248m.js → jsh-executor-Jgo6qLbg.js} +2 -2
- package/dist/ui/assets/{kernel-worker-DVosTEfk.js → kernel-worker-BuXnCRO7.js} +9 -9
- package/dist/ui/assets/{lick-ws-bridge-D_tyNKtQ.js → lick-ws-bridge-BYACp6xa.js} +1 -1
- package/dist/ui/assets/{lick-ws-bridge-DzNcL2nk.js → lick-ws-bridge-ClgXvVOw.js} +1 -1
- package/dist/ui/assets/{live-session-snapshot-BvlykXYG.js → live-session-snapshot-DKkK_NW0.js} +1 -1
- package/dist/ui/assets/{local-llm-CnfnDBQO.js → local-llm-7GIJskO1.js} +1 -1
- package/dist/ui/assets/{local-llm-BeALjb4v.js → local-llm-BxOBQJB_.js} +1 -1
- package/dist/ui/assets/{main-Cb0XbEti.js → main-AUZMzMCG.js} +3 -3
- package/dist/ui/assets/{main-cherry-BxWM5CDl.js → main-cherry-CeZshaye.js} +1 -1
- package/dist/ui/assets/{memory-curation-seam-tqHuLkR5.js → memory-curation-seam-4tTERgVz.js} +1 -1
- package/dist/ui/assets/{memory-health-6_RNd2YD.js → memory-health-r17oW_pI.js} +1 -1
- package/dist/ui/assets/memory-v2-flag-DjjJhF1z.js +1 -0
- package/dist/ui/assets/{memory-write-execute-D_2dJsFl.js → memory-write-execute-BFbBBB5e.js} +1 -1
- package/dist/ui/assets/{mount-CdHDLFap.js → mount-Bw5JOkeu.js} +3 -3
- package/dist/ui/assets/{mount-CWRIDLnw.js → mount-ClZ1aHPk.js} +1 -1
- package/dist/ui/assets/{new-session-YYnEc0rh.js → new-session-C-XUASfz.js} +2 -2
- package/dist/ui/assets/{oauth-bootstrap-BvQ7H4Fc.js → oauth-bootstrap-C_CBS2FD.js} +2 -2
- package/dist/ui/assets/{onboarding-orchestrator-Bhki4A6y.js → onboarding-orchestrator-B9llE3S3.js} +1 -1
- package/dist/ui/assets/{openai-codex-Sw3fc7RC.js → openai-codex-FXrtSSz7.js} +1 -1
- package/dist/ui/assets/{openai-codex-ByEQctz7.js → openai-codex-y1fzTq6U.js} +1 -1
- package/dist/ui/assets/{openrouter-CQIZBRup.js → openrouter-BD1Hc4cX.js} +1 -1
- package/dist/ui/assets/{openrouter-free-CccA7qJ1.js → openrouter-free-C1G6wemT.js} +1 -1
- package/dist/ui/assets/{openrouter-free-CFBsj1-f.js → openrouter-free-DIOPVqci.js} +1 -1
- package/dist/ui/assets/{openrouter-oauth-nOZHXdpV.js → openrouter-oauth-DYjECjbt.js} +1 -1
- package/dist/ui/assets/{openrouter-oauth-Ch7Nrw0n.js → openrouter-oauth-DdyB4JIq.js} +1 -1
- package/dist/ui/assets/{openrouter-p1zOn6Go.js → openrouter-z_QQICiC.js} +1 -1
- package/dist/ui/assets/{opfs-mount-CCCFB1lu.js → opfs-mount-DgDgTG6u.js} +1 -1
- package/dist/ui/assets/panel-rpc-handlers-CgxPU2xR.js +2 -0
- package/dist/ui/assets/{panelize-shell-CnkbfDJk.js → panelize-shell-DkOXxyxM.js} +2 -2
- package/dist/ui/assets/{pi-edit-execution-DbUFiKM7.js → pi-edit-execution-CwmjQWdq.js} +1 -1
- package/dist/ui/assets/{provider-D4B-h8kd.js → provider-DRZ0Hu89.js} +2 -2
- package/dist/ui/assets/{provider-D1B3J3RN.js → provider-Yb1Ih_uN.js} +1 -1
- package/dist/ui/assets/{provider-settings-p5t61kGH.js → provider-settings-KZrYwGND.js} +1 -1
- package/dist/ui/assets/provider-store-access-CQ5vfl7F.js +1 -0
- package/dist/ui/assets/provider-store-access-pA7W4ObT.js +1 -0
- package/dist/ui/assets/{providers-CDax3A6k.js → providers-4K3zQNcH.js} +1 -1
- package/dist/ui/assets/{providers-DnT1iDuH.js → providers-DBXvwv80.js} +2 -2
- package/dist/ui/assets/{quick-llm-BFOKPe7I.js → quick-llm-D4NvsLET.js} +1 -1
- package/dist/ui/assets/{realm-inprocess-XfKjjRud.js → realm-inprocess-CfSOskOF.js} +1 -1
- package/dist/ui/assets/{recovery-screen-B1UAsFy_.js → recovery-screen-CFiZ1YgC.js} +1 -1
- package/dist/ui/assets/remote-terminal-view-KsMjkDGL.js +6 -0
- package/dist/ui/assets/{restore-D5t2KAmQ.js → restore-DrCB7SZ5.js} +1 -1
- package/dist/ui/assets/{run-CgxlL76m.js → run-BnzqoORL.js} +2 -2
- package/dist/ui/assets/{run-DcotndwI.js → run-BqNi3jTi.js} +1 -1
- package/dist/ui/assets/{run-CoCwk-OB.js → run-D6l0dn9A.js} +2 -2
- package/dist/ui/assets/{run-BZQBfxdX.js → run-DCZI4eQD.js} +1 -1
- package/dist/ui/assets/{run-D3nmKvU-.js → run-DGNerlsW.js} +2 -2
- package/dist/ui/assets/{run-B_wetOk2.js → run-DuL5R9qu.js} +2 -2
- package/dist/ui/assets/{session-command-memory-BQQMMPLh.js → session-command-memory-Cny8NMA4.js} +2 -2
- package/dist/ui/assets/{session-jsonl-BCu9CtLe.js → session-jsonl-BNoAvdoR.js} +1 -1
- package/dist/ui/assets/{session-jsonl-9JUEWu0l.js → session-jsonl-C6yz8LBK.js} +1 -1
- package/dist/ui/assets/{session-search-index-C5wImrW6.js → session-search-index-CEXxrOPk.js} +1 -1
- package/dist/ui/assets/{setup-feature-flags-remote-DflqLl_H.js → setup-feature-flags-remote-C0d6MehF.js} +1 -1
- package/dist/ui/assets/{signed-fetch-B9-3iveg.js → signed-fetch-BDxFIE_K.js} +1 -1
- package/dist/ui/assets/{silent-renew-backoff-BocjKSJh.js → silent-renew-backoff-DlNv8IBZ.js} +1 -1
- package/dist/ui/assets/slicc-version-D4sOoWeK.js +1 -0
- package/dist/ui/assets/{snapshot-m2h-QDIi.js → snapshot-DSlXQnSB.js} +1 -1
- package/dist/ui/assets/{snapshot-features-R0MTipyR.js → snapshot-features-BicvatgR.js} +1 -1
- package/dist/ui/assets/{soundscape-kWM_hjnI.js → soundscape-Do0XBT2G.js} +1 -1
- package/dist/ui/assets/{speak-BzdoLFEj.js → speak-BzRyR31N.js} +1 -1
- package/dist/ui/assets/{sprinkle-manager-DrIzSOf2.js → sprinkle-manager-DJQlLs3a.js} +1 -1
- package/dist/ui/assets/{sprinkle-renderer-D4YXEHTI.js → sprinkle-renderer-Q7sdKFHj.js} +1 -1
- package/dist/ui/assets/{state-Cr6DXj7q.js → state-Bw2C2vRx.js} +1 -1
- package/dist/ui/assets/{store-BK__rpca.js → store-DMF2xtTm.js} +1 -1
- package/dist/ui/assets/{store-BleFnPxU.js → store-iwOTg5EN.js} +1 -1
- package/dist/ui/assets/{sudo-HyFTbuY2.js → sudo-p2vavApA.js} +1 -1
- package/dist/ui/assets/{supervisor-D1_al9b2.js → supervisor-CbAt3-Rk.js} +1 -1
- package/dist/ui/assets/{sync-dialog-H6lHzzvI.js → sync-dialog-HWXR3F5O.js} +1 -1
- package/dist/ui/assets/{transformers-env-BVlqqoT4.js → transformers-env-D027UR_-.js} +1 -1
- package/dist/ui/assets/{tray-leader-CkymiaHT.js → tray-leader-CmfI_Viv.js} +1 -1
- package/dist/ui/assets/{tray-leave-runtime-rNjZV4uN.js → tray-leave-runtime-CXZ1NfKU.js} +1 -1
- package/dist/ui/assets/{tray-sidecar-CBsbTsua.js → tray-sidecar-CNNzT2aX.js} +1 -1
- package/dist/ui/assets/{upgrade-detection-B7lVgKlf.js → upgrade-detection-DXVzJjmG.js} +1 -1
- package/dist/ui/assets/{upskill-lick-skip-DeS03OSw.js → upskill-lick-skip-DzUf40Jq.js} +1 -1
- package/dist/ui/assets/{voice-reply-B1l9_Xo1.js → voice-reply-U4YiMVYG.js} +1 -1
- package/dist/ui/assets/{wc-attach-DhqcQmNK.js → wc-attach-DDFGbX3K.js} +2 -2
- package/dist/ui/assets/{wc-browser-CN_DJa1b.js → wc-browser-CT4Q9ygP.js} +1 -1
- package/dist/ui/assets/{wc-computers-BeLXdfFY.js → wc-computers-CV4c1txB.js} +1 -1
- package/dist/ui/assets/{wc-detached-BvbOJyLu.js → wc-detached-D9IRy9N1.js} +1 -1
- package/dist/ui/assets/{wc-extension-CEPLNli4.js → wc-extension-BBNDRV5I.js} +2 -2
- package/dist/ui/assets/{wc-follower-CX4Y7-cK.js → wc-follower-B05_9dgX.js} +3 -3
- package/dist/ui/assets/{wc-follower-oauth-Dnp2tACF.js → wc-follower-oauth-Bq88aJQb.js} +1 -1
- package/dist/ui/assets/{wc-gelatiere-B8nCJB4g.js → wc-gelatiere-DIF6qa_Y.js} +1 -1
- package/dist/ui/assets/wc-live-8V3Dgahq.js +427 -0
- package/dist/ui/assets/{wc-nav-tNldXZAt.js → wc-nav-BJu8zTe6.js} +2 -2
- package/dist/ui/assets/{wc-onboarding-B2H4AYp_.js → wc-onboarding-B1S9UU_d.js} +2 -2
- package/dist/ui/assets/{wc-permissions-CCA-0PP4.js → wc-permissions-BETEzRSV.js} +2 -2
- package/dist/ui/assets/{wc-placeholder-VBMLxjxW.js → wc-placeholder-D0rpz3qw.js} +3 -3
- package/dist/ui/assets/{wc-secret-request-D7dksNvu.js → wc-secret-request-DfWFHtrs.js} +1 -1
- package/dist/ui/assets/{wc-settings-BgqSJsTh.js → wc-settings-BwYsutUi.js} +3 -3
- package/dist/ui/assets/{wc-shell-DoXzfb-g.js → wc-shell-GgRX7gs9.js} +266 -238
- package/dist/ui/assets/{wc-shortcut-config-vhhAdCG-.js → wc-shortcut-config-CHCeKyQ3.js} +1 -1
- package/dist/ui/assets/{wc-sprinkles-Dzc2DnW1.js → wc-sprinkles-Cq-tpoxc.js} +2 -2
- package/dist/ui/assets/{wc-transcript-export-B662ne2t.js → wc-transcript-export-VQemk5fq.js} +2 -2
- package/dist/ui/assets/{wc-tray-Bo_zfGS7.js → wc-tray-BHXaNSba.js} +4 -4
- package/dist/ui/assets/welcome-detection-BWTlcUwd.js +1 -0
- package/dist/ui/assets/{whisper-session-D3PnODck.js → whisper-session-DG1DqQPR.js} +2 -2
- package/dist/ui/assets/{xai-grok-DcOcvq-e.js → xai-grok-Cd6nn6KT.js} +1 -1
- package/dist/ui/assets/{xai-grok-CWLMOzDS.js → xai-grok-DimecpnS.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/memory-v2-flag-BkIdgq2C.js +0 -1
- package/dist/ui/assets/panel-rpc-handlers-DNUkvoq3.js +0 -2
- package/dist/ui/assets/provider-store-access-C6lEZNGz.js +0 -1
- package/dist/ui/assets/provider-store-access-C9TCwJrp.js +0 -1
- package/dist/ui/assets/remote-terminal-view-CA-SfvvZ.js +0 -6
- package/dist/ui/assets/slicc-version-BPqTXAzA.js +0 -1
- package/dist/ui/assets/wc-live-CRMScpU8.js +0 -427
- package/dist/ui/assets/welcome-detection-BDANwOZO.js +0 -1
|
@@ -1,427 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/wc-shell-DoXzfb-g.js","assets/rolldown-runtime-Dd_uD5pT.js","assets/preload-helper-Czpn1I53.js","assets/logger-DDBAeTLF.js","assets/mime-types-D0xZwlMO.js","assets/base64-ELzoYfwP.js","assets/bridge-protocol-06nbmp2X.js","assets/account-store-DkCw0bWM.js","assets/core-DWdpOAZd.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/proxied-fetch-CnCvBaGV.js","assets/fetch-body-1l9I58Vk.js","assets/api-endpoint-DGxXvrur.js","assets/runtime-env-Dlaokqg1.js","assets/secret-topology-BrobAGSV.js","assets/float-topology-CyZCUfkj.js","assets/secrets-bridge-client-BJqZCK6Q.js","assets/port-bridge-client-CZFX4fUT.js","assets/image-markers-q8JQTtid.js","assets/tool-ui-eSQ1g2I1.js","assets/providers-DnT1iDuH.js","assets/panel-rpc-B3MSVImO.js","assets/bedrock-camp-compat-BeCSBUrZ.js","assets/claude-model-version-DZmbk9E2.js","assets/telemetry-CKoAhRMv.js","assets/same-file-identity-DuEcSmPX.js","assets/icons-BMNa26vG.js","assets/wc-shell-WkeczD9x.css","assets/mount-picker-popup--ijSfN8u.js","assets/picker-popup-sQtXmfAo.js","assets/usb-picker-O-2gFMNl.js","assets/serial-picker-BQF_Eitc.js","assets/hid-picker-sFJ8vzUj.js","assets/usb-device-registry--JwKRTYp.js","assets/serial-port-registry-CCqklAEr.js","assets/hid-device-registry-B2R-0rNt.js","assets/quick-llm-BFOKPe7I.js","assets/llm-session-id-bZQs6gBN.js","assets/session-jsonl-BCu9CtLe.js","assets/slugify-BYJ6QVAt.js","assets/types-D8gIX-W-.js","assets/main-Cb0XbEti.js","assets/modulepreload-polyfill-P2Xu9kJm.js","assets/tray-follower-status-BAjnN7Ar.js","assets/clipboard-eqmn97SP.js","assets/wc-placeholder-VBMLxjxW.js","assets/wc-attach-DhqcQmNK.js","assets/permissions-surface-registry-CilCRwhh.js","assets/wc-gelatiere-B8nCJB4g.js","assets/new-session-YYnEc0rh.js","assets/tray-leader-CkymiaHT.js","assets/mount-table-store-dY2IfQ5S.js","assets/legacy-styles-B3nS5QUo.js","assets/soundscape-kWM_hjnI.js","assets/voice-reply-B1l9_Xo1.js","assets/speak-BzdoLFEj.js","assets/speech-assets-bridge-CFYafE89.js","assets/transformers-env-BVlqqoT4.js","assets/shared-mBEktoxE.js","assets/remote-vfs-client-Cs1yUtQm.js","assets/writable-vfs-client-CQe6oZ75.js","assets/wc-onboarding-B2H4AYp_.js","assets/record-CCQFJXn_.js","assets/wc-browser-CN_DJa1b.js","assets/slicc-app-url-B9OxaBDe.js","assets/tab-teleport-BimzPYfT.js","assets/teleport-storage-CyYkSZfJ.js","assets/wc-computers-BeLXdfFY.js","assets/scale-D09IlqOK.js","assets/remote-terminal-view-CA-SfvvZ.js","assets/browser-DGwroBSO.js","assets/usb-operations-v1mGAdRY.js","assets/terminal-session-client-ADzaWGFd.js","assets/secret-env-DgrZZVFU.js","assets/wc-permissions-CCA-0PP4.js","assets/wc-permissions-providers-wSXekwkO.js","assets/wc-secret-request-D7dksNvu.js","assets/secret-request-registry-DrOMKR1H.js","assets/theme-DFKCBK8N.js","assets/theme-engine-B5SkYf3E.js","assets/panelize-shell-CnkbfDJk.js","assets/virtual-device-paths-D45tpPP6.js","assets/layout-apply-registry-Cw730jao.js","assets/wc-shortcut-config-vhhAdCG-.js","assets/remote-sprinkle-vfs-D-Wz5t8k.js","assets/bounded-walk-BjxKWNqp.js","assets/path-utils-DNJG-zQf.js","assets/wc-sprinkles-Dzc2DnW1.js","assets/wc-unit-context-DhQqWVxs.js","assets/agent-panels-DsmU_IkC.js","assets/apply-layout-Dvj6HbU2.js","assets/wc-tray-Bo_zfGS7.js","assets/transcript-export-DP-r8eDz.js","assets/wc-follower-oauth-Dnp2tACF.js","assets/sprinkle-renderer-D4YXEHTI.js","assets/hid-operations-C97SZtrY.js","assets/pending-request-table-k-D7ZZsL.js","assets/export-spool-CuNzzI8a.js","assets/src-BWaKqLvQ.js","assets/synthetic-cdp-transport-OUVdC4zy.js","assets/sprinkle-instances-B8n7h-oP.js","assets/wc-transcript-export-B662ne2t.js","assets/wc-nav-tNldXZAt.js","assets/composer-speech-D66bpqkf.js","assets/whisper-session-D3PnODck.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{n as e}from"./rolldown-runtime-Dd_uD5pT.js";import{n as t,r as n,t as r}from"./core-DWdpOAZd.js";import{t as i}from"./preload-helper-Czpn1I53.js";import{t as a}from"./compat-qQM4gjF_.js";import{t as o}from"./logger-DDBAeTLF.js";import{$ as s,C as c,Ct as l,D as u,E as d,M as f,O as p,P as m,S as h,St as g,T as _,Z as v,_ as y,a as b,b as ee,bt as x,c as S,ct as te,dt as ne,et as re,g as ie,i as ae,l as oe,lt as se,n as ce,o as le,ot as ue,r as de,rt as fe,t as pe,ut as me,v as he,w as ge,wt as _e,x as ve,xt as ye,y as be,yt as xe}from"./wc-shell-DoXzfb-g.js";import{r as Se,t as Ce}from"./base64-ELzoYfwP.js";import"./proxied-fetch-CnCvBaGV.js";import{a as we,i as Te,n as Ee,o as De,s as Oe}from"./sprinkle-renderer-D4YXEHTI.js";import{B as ke,T as Ae,V as je,f as Me,w as Ne}from"./account-store-DkCw0bWM.js";import{n as Pe}from"./runtime-env-Dlaokqg1.js";import{t as Fe}from"./slugify-BYJ6QVAt.js";import{a as Ie,i as Le,n as C,t as Re}from"./transcript-export-DP-r8eDz.js";import{S as ze,_ as w,a as Be,b as Ve,c as He,d as Ue,f as T,g as We,h as Ge,l as Ke,m as qe,n as Je,o as Ye,p as Xe,r as Ze,s as Qe,t as $e,u as et,v as E,x as D,y as tt}from"./session-jsonl-BCu9CtLe.js";import{a as nt,t as rt}from"./api-endpoint-DGxXvrur.js";import{n as it}from"./float-topology-CyZCUfkj.js";import"./secret-topology-BrobAGSV.js";import{n as at}from"./secrets-bridge-client-BJqZCK6Q.js";import{t as ot}from"./tool-ui-eSQ1g2I1.js";import{a as st,c as ct,l as lt,n as ut,p as dt,r as ft}from"./telemetry-CKoAhRMv.js";import{a as pt,i as mt,t as ht}from"./tray-follower-status-BAjnN7Ar.js";import{D as gt,M as _t,c as vt,i as yt,m as bt,o as xt,s as St,x as Ct,y as wt}from"./main-Cb0XbEti.js";import{n as Tt}from"./src-BWaKqLvQ.js";import{n as Et,r as Dt,t as Ot}from"./provider-budget-LCzMPlKv.js";import{t as kt}from"./permissions-surface-registry-CilCRwhh.js";import{t as At}from"./types-D8gIX-W-.js";import{n as jt,r as Mt}from"./hid-device-registry-B2R-0rNt.js";import"./browser-DGwroBSO.js";import{a as Nt,i as Pt}from"./serial-port-registry-CCqklAEr.js";import{c as Ft,d as It,g as Lt,i as Rt,l as zt,m as Bt,n as Vt,o as Ht,p as Ut,r as Wt,t as Gt,u as Kt}from"./hid-operations-C97SZtrY.js";import{a as qt,t as Jt}from"./icons-BMNa26vG.js";import{a as Yt,i as Xt}from"./usb-device-registry--JwKRTYp.js";import{f as Zt,i as Qt,l as $t,s as en,u as tn}from"./usb-operations-v1mGAdRY.js";import{a as nn,i as rn,r as an}from"./tray-leader-CkymiaHT.js";import{a as on,c as sn,f as cn,i as ln,l as un,m as dn,n as fn,o as pn,p as mn,s as hn,t as gn,u as O}from"./record-CCQFJXn_.js";import{a as _n,i as vn,n as yn,o as bn,r as xn,s as Sn,t as k}from"./descriptor-DzbI9z_9.js";import{n as Cn,t as A}from"./types-CFfBWsH5.js";import"./shared-mBEktoxE.js";import{a as wn,n as Tn,r as En}from"./theme-DFKCBK8N.js";import{a as Dn,c as On,f as kn,i as An,l as jn,m as Mn,n as Nn,o as Pn,p as Fn,r as In,s as Ln,t as Rn,u as zn}from"./wc-unit-context-DhQqWVxs.js";var Bn=new Set([`summarized`,`fallback`]);function Vn(e){if(!A(e)||e===null||e.origin!==`agent-history`)return[];let t=[];for(let n of e.entries)n.kind!==`tool-call`&&n.message&&t.push(n.message);return t}async function Hn(e,t={}){if(!A(e)||e===null)return[];if(e.origin===`ui-projection`){let t=[];for(let n of e.entries)n.kind!==`tool-call`&&n.chat&&t.push(n.chat);return Wn(t,e.markers)}let n=e.projectionPrefix??[],r=Vn(e);if(r.length===0)return Wn([...n],e.markers);let{agentMessagesToChatMessages:a}=await i(async()=>{let{agentMessagesToChatMessages:e}=await import(`./wc-shell-DoXzfb-g.js`).then(e=>e.st);return{agentMessagesToChatMessages:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33])),o=Un(a(r,t),e.attachments);return Wn([...n,...o],e.markers)}function Un(e,t){if(!t?.length)return e;let n=[...t].sort((e,t)=>e.timestamp-t.timestamp),r=new Set;return e.map(e=>{if(e.role!==`user`||e.attachments?.length)return e;let t=e.content.trim(),i=n.findIndex((e,n)=>!r.has(n)&&e.body.trim()===t);return i<0?e:(r.add(i),{...e,attachments:n[i].attachments})})}function Wn(e,t){let n=(t??[]).filter(e=>e.kind!==`compaction`||Bn.has(e.compaction.state));if(n.length===0)return e;let r=[...n].sort((e,t)=>e.timestamp-t.timestamp),i=[],a=0;for(let t of e){let e=Gn(t);for(;a<r.length&&r[a].timestamp<=e;)i.push(Kn(r[a++]));i.push(t)}for(;a<r.length;)i.push(Kn(r[a++]));return i}function Gn(e){let t=e.timestamp;if(typeof t==`number`&&Number.isFinite(t))return t;if(typeof t==`string`){let e=Date.parse(t);if(!Number.isNaN(e))return e}return-1/0}function Kn(e){return e.kind===`error`?{id:e.id,role:`assistant`,content:e.text,timestamp:e.timestamp,error:!0}:{id:e.id,role:`assistant`,content:``,timestamp:e.timestamp,compaction:e.compaction}}var qn=e({CanonicalSessionReader:()=>Xn,agentSessionFromRecord:()=>Yn,chatSessionFromRecord:()=>Jn});async function Jn(e){return{id:e.legacyKeys.chatSessionId,messages:await Hn(e),createdAt:e.createdAt,updatedAt:e.updatedAt}}function Yn(e){return{id:e.workUnitId,messages:Vn(e),config:{},createdAt:e.createdAt,updatedAt:e.updatedAt}}var Xn=class{store;constructor(e){this.store=e}async loadAgentSessions(){return(await this.latestPerUnit()).map(Yn)}async loadChatSessions(){return Promise.all((await this.latestPerUnit()).map(Jn))}async latestPerUnit(){let e=new Map;for(let t of await this.store.loadAll()){let n=e.get(t.workUnitId);(!n||t.updatedAt>n.updatedAt)&&e.set(t.workUnitId,t)}return[...e.values()]}async loadRootChatSession(e){let t=await this.store.loadLatestInWorkspace(Sn({parentJid:null,folder:e}).root);return t?Jn(t):null}async load(e){return e.startsWith(`session-`)?this.loadRootChatSession(e.slice(8)):null}},Zn=new Set([`scoop-notify`,`scoop-idle`,`scoop-wait`]);function Qn(e){return`e${e}`}function $n(e){let t=[];for(let n of e){let e=tr(n),r=rr(n);if(e===`assistant`){let e=t.length,i=Qn(e);t.push({id:i,seq:e,kind:`assistant`,timestamp:r,text:ar(n),message:n,model:ir(n)});for(let e of or(n)){let n=t.length;t.push({id:Qn(n),seq:n,kind:`tool-call`,timestamp:r,toolCallId:e.id,name:e.name,assistantEntryId:i})}continue}if(e===`toolResult`){let e=n,i=t.length;t.push({id:Qn(i),seq:i,kind:`tool-result`,timestamp:r,text:ar(n),message:n,toolCallId:e.toolCallId??``,isError:e.isError});continue}let i=ar(n),a=e===`user`?er(i):null,o=t.length,s=Qn(o);a===null?t.push({id:s,seq:o,kind:`user`,timestamp:r,text:i,message:n}):Zn.has(a)?t.push({id:s,seq:o,kind:`child-result`,timestamp:r,text:i,message:n,channel:a}):t.push({id:s,seq:o,kind:`external-event`,timestamp:r,text:i,message:n,channel:a})}return t}function er(e){for(let t of me(e)){let e=(t.sender?se(t.sender):null)??te(t.body);if(e)return e}return null}function tr(e){return e.role??``}function nr(e){if(typeof e==`number`)return e;if(typeof e==`string`){let t=Date.parse(e);return Number.isNaN(t)?0:t}return e instanceof Date?e.getTime():0}function rr(e){return nr(e.timestamp)}function ir(e){let t=e.model;return typeof t==`string`?t:void 0}function ar(e){let t=e.content;if(typeof t==`string`)return t;if(!Array.isArray(t))return``;let n=[];for(let e of t)e?.type===`text`&&n.push(e.text);return n.join(``)}function or(e){let t=e.content;if(!Array.isArray(t))return[];let n=[];for(let e of t){if(e?.type!==`toolCall`)continue;let t=e;n.push({id:t.id??``,name:t.name??``})}return n}var sr=e({CONVERSATION_DB_NAME:()=>cr,WorkUnitConversationStore:()=>ur}),j=o(`work-unit-conversation`),cr=`slicc-work-units`,lr=1,M=`conversations`,N=`migrations`,ur=class{dbPromise=null;dbName;writeChains=new Map;constructor(e={}){this.dbName=e.dbName??`slicc-work-units`}async load(e){let t=await this.read(e);return t.status===`ok`?t.record:null}async read(e){try{let t=await _r((await this.getDb()).transaction(M,`readonly`).objectStore(M).get(e));return t?A(t)?Array.isArray(t.entries)?{status:`ok`,record:t}:(j.warn(`Conversation record has no entry list`,{key:e}),{status:`malformed`,reason:`entries is not a list`}):(j.warn(`Ignoring conversation record from a newer schema`,{key:e,version:t.version}),{status:`incompatible`,version:t.version}):{status:`absent`}}catch(t){return j.warn(`Conversation record read failed`,{key:e,error:P(t)}),{status:`error`,reason:P(t)}}}async save(e){let t=e.version>2?e.version:Cn(e),n={...e,version:t},r=(await this.getDb()).transaction(M,`readwrite`);return r.objectStore(M).put(n),await vr(r),n}delete(e){return this.serialize(e,async()=>{try{let t=(await this.getDb()).transaction(M,`readwrite`);t.objectStore(M).delete(e),await vr(t)}catch(t){j.warn(`Conversation record delete failed`,{key:e,error:P(t)})}})}async rekey(e,t){if(e!==t.key)try{let n=await this.read(e);if(n.status!==`ok`)return;let r=await this.read(t.key);if(r.status===`incompatible`||r.status===`error`){j.warn(`Conversation rekey refused: target is not writable`,{fromKey:e,toKey:t.key,status:r.status});return}let i=Date.now();await this.save({...n.record,key:t.key,workUnitId:t.workUnitId,workspaceId:t.workspaceId,folder:t.folder,legacyKeys:t.legacyKeys,updatedAt:i}),await this.delete(e)}catch(n){j.warn(`Conversation rekey failed`,{fromKey:e,toKey:t.key,error:P(n)})}}async loadAll(){try{return(await _r((await this.getDb()).transaction(M,`readonly`).objectStore(M).getAll())).filter(e=>A(e)&&Array.isArray(e.entries))}catch(e){return j.warn(`Conversation record listing failed`,{error:P(e)}),[]}}async loadLatestInWorkspace(e){try{let t=`${e}::`,n=await _r((await this.getDb()).transaction(M,`readonly`).objectStore(M).getAll(IDBKeyRange.bound(t,`${t}\uffff`))),r=null;for(let e of n)!A(e)||!Array.isArray(e.entries)||(!r||e.updatedAt>r.updatedAt)&&(r=e);return r}catch(t){return j.warn(`Conversation workspace lookup failed`,{workspaceId:e,error:P(t)}),null}}async listKeys(){try{return(await _r((await this.getDb()).transaction(M,`readonly`).objectStore(M).getAllKeys())).map(String)}catch(e){return j.warn(`Conversation key listing failed`,{error:P(e)}),[]}}async syncAgentMessages(e,t,n={}){let r=n.now??Date.now(),i=$n(t);return this.serialize(e.key,()=>this.ingestEntries(e,i,n,r))}async ingestEntries(e,t,n,r){try{let i=await this.read(e.key);if(i.status===`incompatible`||i.status===`error`)return null;let a=i.status===`ok`?i.record:null,o=dr(a,t,e,`agent-history`,{createdAt:n.createdAt??r,now:r});return o?await this.save(o):a}catch(t){return j.warn(`Conversation record write failed`,{key:e.key,error:P(t)}),null}}async putMarker(e,t,n={}){return this.withRecord(e,n.createWith,e=>{let n=(e.markers??[]).filter(e=>e.id!==t.id);return n.push(t),n.sort((e,t)=>e.timestamp-t.timestamp),{...e,markers:n.slice(-64)}})}async putAttachments(e,t){if(t.length===0)return!1;let n=new Set(t.map(e=>e.id));return this.withRecord(e.key,e,e=>({...e,attachments:[...(e.attachments??[]).filter(e=>!n.has(e.id)),...t].sort((e,t)=>e.timestamp-t.timestamp).slice(-256)}))}async deleteMarker(e,t){return this.withRecord(e,void 0,e=>{let n=(e.markers??[]).filter(e=>e.id!==t);return n.length===(e.markers?.length??0)?null:{...e,markers:n}})}withRecord(e,t,n){return this.serialize(e,()=>this.mutateRecord(e,t,n))}async mutateRecord(e,t,n){try{let r=await this.read(e),i=r.status===`ok`?r.record:r.status===`absent`&&t?fr(t,Date.now()):null;if(!i)return!1;let a=n(i);return a?(await this.save({...a,updatedAt:Date.now()}),!0):!1}catch(t){return j.warn(`Conversation marker write failed`,{key:e,error:P(t)}),!1}}serialize(e,t){let n=(this.writeChains.get(e)??Promise.resolve()).then(t,t),r=n.then(()=>void 0,()=>void 0);return this.writeChains.set(e,r),r.then(()=>{this.writeChains.get(e)===r&&this.writeChains.delete(e)}),n}async getMigrationState(e){try{return await _r((await this.getDb()).transaction(N,`readonly`).objectStore(N).get(e))??null}catch(t){return j.warn(`Migration state read failed`,{id:e,error:P(t)}),null}}async putMigrationState(e){try{let t=(await this.getDb()).transaction(N,`readwrite`);t.objectStore(N).put(e),await vr(t)}catch(t){j.warn(`Migration state write failed`,{id:e.id,error:P(t)})}}async clearAll(){let e=(await this.getDb()).transaction([M,N],`readwrite`);e.objectStore(M).clear(),e.objectStore(N).clear(),await vr(e)}getDb(){return this.dbPromise||(this.dbPromise=gr(this.dbName).then(e=>(e.onversionchange=()=>{e.close(),this.dbPromise=null},e.onclose=()=>{this.dbPromise=null},e)),this.dbPromise.catch(()=>{this.dbPromise=null})),this.dbPromise}};function dr(e,t,n,r,i){if(!e)return t.length===0?null:{key:n.key,version:2,workUnitId:n.workUnitId,workspaceId:n.workspaceId,folder:n.folder,origin:r,entries:t,createdAt:i.createdAt,updatedAt:i.now,legacyKeys:n.legacyKeys};if(e.origin===`ui-projection`&&r===`agent-history`)return t.length===0?null:{...e,version:2,origin:r,entries:t,projectionPrefix:[...e.projectionPrefix??[],...pr(e)],updatedAt:i.now,legacyKeys:n.legacyKeys};let a=e.entries;if(t.length===a.length&&mr(a,t))return null;let o=t.length>a.length&&mr(a,t);return{...e,version:2,origin:r,entries:t,updatedAt:i.now,rewrites:o?e.rewrites:(e.rewrites??0)+1,legacyKeys:n.legacyKeys}}function fr(e,t){return{key:e.key,version:2,workUnitId:e.workUnitId,workspaceId:e.workspaceId,folder:e.folder,origin:`agent-history`,entries:[],createdAt:t,updatedAt:t,legacyKeys:e.legacyKeys}}function pr(e){let t=[];for(let n of e.entries)n.kind!==`tool-call`&&n.chat&&t.push(n.chat);return t}function mr(e,t){if(e.length>t.length)return!1;for(let n=0;n<e.length;n++)if(!hr(e[n],t[n]))return!1;return!0}function hr(e,t){return e.kind!==t.kind||e.seq!==t.seq?!1:e.kind===`tool-call`&&t.kind===`tool-call`?e.toolCallId===t.toolCallId&&e.name===t.name:(`text`in e?e.text:``)===(`text`in t?t.text:``)}function gr(e){return new Promise((t,n)=>{let r=indexedDB.open(e,lr);r.onupgradeneeded=()=>{let e=r.result;e.objectStoreNames.contains(M)||e.createObjectStore(M,{keyPath:`key`}),e.objectStoreNames.contains(N)||e.createObjectStore(N,{keyPath:`id`})},r.onsuccess=()=>t(r.result),r.onerror=()=>n(r.error)})}function _r(e){return new Promise((t,n)=>{e.onsuccess=()=>t(e.result),e.onerror=()=>n(e.error)})}function vr(e){return new Promise((t,n)=>{e.oncomplete=()=>t(),e.onerror=()=>n(e.error),e.onabort=()=>n(e.error)})}function P(e){return e instanceof Error?e.message:String(e)}var yr=e({getTranscriptExportService:()=>xr,registerTranscriptExportService:()=>br}),F=null;function br(e){return F=e,()=>{F===e&&(F=null)}}function xr(){if(!F)throw new C(`session-not-found`);return F}var Sr=e({broadcastToDips:()=>Br,disposeDips:()=>di,handleDipPickerAction:()=>fi,hydrateDips:()=>ui,mountDip:()=>B,setDipExecHandler:()=>Hr}),Cr=Pe();i(()=>import(`./screen-share-approval-live-D388fVD9.js`).then(e=>{e.listenScreenShareApprovalChannel()}),[]);function wr(e){if(typeof e!=`object`||!e||Array.isArray(e))return[];let t=e.filters;return Array.isArray(t)?t:[]}async function Tr(e,t){if(t?.aborted)throw new DOMException(`aborted`,`AbortError`);let n=await Or(e,!0,t);if(t?.aborted)throw new DOMException(`aborted`,`AbortError`);if(n===null)throw Error(`VFS read failed: ${e}`);return typeof n==`string`?n:new TextDecoder().decode(n)}var Er=null;function Dr(){if(Er)return Er;if(typeof BroadcastChannel>`u`)return null;try{Er=new BroadcastChannel(`preview-vfs`)}catch{return null}return Er}async function Or(e,t,n){let r=Dr();if(!r)return null;let i=`dip-${Date.now()}-${Math.random().toString(36).slice(2)}`;return new Promise(a=>{let o=!1,s=()=>{r.removeEventListener(`message`,c),n?.removeEventListener(`abort`,l)},c=e=>{if(!o&&e.data?.type===`preview-vfs-response`&&e.data.id===i){if(o=!0,s(),e.data.error){a(null);return}a(e.data.content??null)}},l=()=>{o||(o=!0,s(),a(null))};r.addEventListener(`message`,c),n?.addEventListener(`abort`,l),setTimeout(()=>{o||(o=!0,s(),a(null))},5e3),r.postMessage({type:`preview-vfs-read`,id:i,path:e,asText:t})})}var kr=[`/shared/sprinkles/`,`/workspace/skills/sprinkles/`,`/workspace/sprinkles/`],Ar=[`/shared/`,`/workspace/skills/sprinkles/`,`/workspace/sprinkles/`];function jr(e){return kr.some(t=>e.startsWith(t))}function Mr(e){return typeof e!=`string`||!e.startsWith(`/`)||e.includes(`..`)?!1:Ar.some(t=>e.startsWith(t))}var I=new WeakSet,Nr=`,
|
|
3
|
-
exec: Object.assign(function(cmd) {
|
|
4
|
-
return _vfsCall('dip-exec', { cmd: cmd }, function(m) { return m.result; });
|
|
5
|
-
}, { spawn: function(argv) {
|
|
6
|
-
return _vfsCall('dip-jsh', { op: 'spawn', args: [argv] }, function(m) { return m.result; });
|
|
7
|
-
} }),
|
|
8
|
-
agent: function(prompt, opts) {
|
|
9
|
-
return _vfsCall('dip-agent', { prompt: prompt, opts: opts || null },
|
|
10
|
-
function(m) { return m.result; });
|
|
11
|
-
}`,Pr=`,
|
|
12
|
-
fetch: function(url, init) {
|
|
13
|
-
return _vfsCall('dip-jsh', { op: 'fetch', args: [url, init || null] }, function(m) { return m.result; });
|
|
14
|
-
},
|
|
15
|
-
http: { client: function(cfg) {
|
|
16
|
-
function mk(method) { return function(path, opts) { return _vfsCall('dip-jsh', { op: 'http', args: [cfg, method, path, opts || null] }, function(m) { return m.result; }); }; }
|
|
17
|
-
return { get: mk('get'), post: mk('post'), put: mk('put'), patch: mk('patch'), 'delete': mk('delete') };
|
|
18
|
-
} },
|
|
19
|
-
browser: {
|
|
20
|
-
findTab: function(q) { return _vfsCall('dip-jsh', { op: 'browser', args: ['findTab', q] }, function(m) { return m.result; }); },
|
|
21
|
-
ensureTab: function(url, options) { return _vfsCall('dip-jsh', { op: 'browser', args: ['ensureTab', url, options || {}] }, function(m) { return m.result; }); },
|
|
22
|
-
eval: function(tab, code) { return _vfsCall('dip-jsh', { op: 'browser', args: ['eval', tab, code] }, function(m) { return m.result; }); },
|
|
23
|
-
evalAsync: function(tab, code) { return _vfsCall('dip-jsh', { op: 'browser', args: ['evalAsync', tab, code] }, function(m) { return m.result; }); },
|
|
24
|
-
cookie: function(tab, name) { return _vfsCall('dip-jsh', { op: 'browser', args: ['cookie', tab, name] }, function(m) { return m.result; }); },
|
|
25
|
-
localStorage: function(tab, key) { return _vfsCall('dip-jsh', { op: 'browser', args: ['localStorage', tab, key] }, function(m) { return m.result; }); },
|
|
26
|
-
fetch: function(tab, url, opts) { return _vfsCall('dip-jsh', { op: 'browser', args: ['fetch', tab, url, opts || {}] }, function(m) { return m.result; }); }
|
|
27
|
-
},
|
|
28
|
-
fetchToFile: function(url, path) {
|
|
29
|
-
return _vfsCall('dip-jsh', { op: 'fetchToFile', args: [url, path] }, function(m) { return m.result; });
|
|
30
|
-
}`,Fr=`,
|
|
31
|
-
_device: function(channel, op, args) {
|
|
32
|
-
return _vfsCall('dip-device-op',
|
|
33
|
-
{ channel: channel, op: op, args: args || [] },
|
|
34
|
-
function(m) { return m.result; });
|
|
35
|
-
},
|
|
36
|
-
hid: {
|
|
37
|
-
list: function() { return _vfsCall('dip-device-op', { channel: 'hid', op: 'list', args: [] }, function(m) { return m.result; }); },
|
|
38
|
-
request: function(filters) { return _vfsCall('dip-device-op', { channel: 'hid', op: 'request', args: [filters || []] }, function(m) { return m.result; }); },
|
|
39
|
-
open: function(handle) { return _vfsCall('dip-device-op', { channel: 'hid', op: 'open', args: [handle] }, function(m) { return m.result; }).then(function() {}); },
|
|
40
|
-
close: function(handle) { return _vfsCall('dip-device-op', { channel: 'hid', op: 'close', args: [handle] }, function(m) { return m.result; }).then(function() {}); },
|
|
41
|
-
sendReport: function(handle, reportId, data) { return _vfsCall('dip-device-op', { channel: 'hid', op: 'sendReport', args: [handle, reportId, data] }, function(m) { return m.result; }).then(function() {}); },
|
|
42
|
-
on: function(event, cb) { if (event === 'inputreport') _hidInputReportListeners.add(cb); },
|
|
43
|
-
off: function(event, cb) { if (event === 'inputreport') _hidInputReportListeners.delete(cb); }
|
|
44
|
-
},
|
|
45
|
-
serial: {
|
|
46
|
-
list: function() { return _vfsCall('dip-device-op', { channel: 'serial', op: 'list', args: [] }, function(m) { return m.result; }); },
|
|
47
|
-
request: function(filters) { return _vfsCall('dip-device-op', { channel: 'serial', op: 'request', args: [filters || []] }, function(m) { return m.result; }); },
|
|
48
|
-
open: function(handle, options) { return _vfsCall('dip-device-op', { channel: 'serial', op: 'open', args: [handle, options] }, function(m) { return m.result; }).then(function() {}); },
|
|
49
|
-
close: function(handle) { return _vfsCall('dip-device-op', { channel: 'serial', op: 'close', args: [handle] }, function(m) { return m.result; }).then(function() {}); }
|
|
50
|
-
},
|
|
51
|
-
usb: {
|
|
52
|
-
list: function() { return _vfsCall('dip-device-op', { channel: 'usb', op: 'list', args: [] }, function(m) { return m.result; }); },
|
|
53
|
-
request: function(filters) { return _vfsCall('dip-device-op', { channel: 'usb', op: 'request', args: [filters || []] }, function(m) { return m.result; }); },
|
|
54
|
-
open: function(handle) { return _vfsCall('dip-device-op', { channel: 'usb', op: 'open', args: [handle] }, function(m) { return m.result; }).then(function() {}); },
|
|
55
|
-
close: function(handle) { return _vfsCall('dip-device-op', { channel: 'usb', op: 'close', args: [handle] }, function(m) { return m.result; }).then(function() {}); }
|
|
56
|
-
}`;function Ir(e){return`(function() {
|
|
57
|
-
var _cbId = 0;
|
|
58
|
-
var _callbacks = {};
|
|
59
|
-
var _hidInputReportListeners = new Set();
|
|
60
|
-
|
|
61
|
-
function _vfsCall(type, params, extractResult) {
|
|
62
|
-
return new Promise(function(resolve, reject) {
|
|
63
|
-
var id = ++_cbId;
|
|
64
|
-
_callbacks[id] = function(msg) {
|
|
65
|
-
if (msg.error) reject(new Error(msg.error));
|
|
66
|
-
else resolve(extractResult ? extractResult(msg) : undefined);
|
|
67
|
-
};
|
|
68
|
-
var m = { type: type, id: id };
|
|
69
|
-
if (params) { for (var k in params) m[k] = params[k]; }
|
|
70
|
-
parent.postMessage(m, '*');
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
window.slicc = window.bridge = {
|
|
75
|
-
lick: function(event) {
|
|
76
|
-
var action = typeof event === 'string' ? event : event.action;
|
|
77
|
-
var data = typeof event === 'string' ? undefined : ('data' in event ? event.data : event);
|
|
78
|
-
parent.postMessage({ type: 'dip-lick', action: action, data: data }, '*');
|
|
79
|
-
},
|
|
80
|
-
/* Read-only VFS access. Mirrors the sprinkle bridge so dips can
|
|
81
|
-
check onboarding markers, profiles, etc. without a parent-side
|
|
82
|
-
handshake. */
|
|
83
|
-
readFile: function(path) {
|
|
84
|
-
return _vfsCall('dip-readfile', { path: path }, function(m) { return m.content; });
|
|
85
|
-
},
|
|
86
|
-
exists: function(path) {
|
|
87
|
-
return _vfsCall('dip-exists', { path: path }, function(m) { return m.exists; });
|
|
88
|
-
},
|
|
89
|
-
stat: function(path) {
|
|
90
|
-
return _vfsCall('dip-stat', { path: path }, function(m) { return m.stat; });
|
|
91
|
-
}${e?Nr:``}${e?Pr:``}${e?Fr:``}
|
|
92
|
-
};
|
|
93
|
-
function reportHeight() {
|
|
94
|
-
parent.postMessage({ type: 'dip-height',
|
|
95
|
-
height: document.documentElement.scrollHeight }, '*');
|
|
96
|
-
}
|
|
97
|
-
${we}
|
|
98
|
-
window.addEventListener('message', function(e) {
|
|
99
|
-
if (!e.data || typeof e.data.type !== 'string') return;
|
|
100
|
-
if (e.data.type === 'slicc-theme') {
|
|
101
|
-
applyIframeTheme(e);
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
/* Pushed device events (currently 'hid:inputreport'). The host
|
|
105
|
-
attaches the underlying listener on slicc.hid.open(handle) for
|
|
106
|
-
this dip; teardown happens automatically on dispose. */
|
|
107
|
-
if (e.data.type === 'dip-device-event' && e.data.channel === 'hid:inputreport') {
|
|
108
|
-
_hidInputReportListeners.forEach(function(cb) {
|
|
109
|
-
try { cb(e.data.payload); } catch(ex) {}
|
|
110
|
-
});
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
/* VFS callback responses target the originating call by id. */
|
|
114
|
-
if (e.data.id && _callbacks[e.data.id]) {
|
|
115
|
-
var cb = _callbacks[e.data.id];
|
|
116
|
-
delete _callbacks[e.data.id];
|
|
117
|
-
cb(e.data);
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
/* Forward any other slicc-* message to in-page listeners via a
|
|
121
|
-
CustomEvent. Dips can opt in with
|
|
122
|
-
window.addEventListener('slicc-message', (ev) => ev.detail). */
|
|
123
|
-
if (e.data.type.indexOf('slicc-') === 0) {
|
|
124
|
-
try {
|
|
125
|
-
document.dispatchEvent(new CustomEvent('slicc-message', { detail: e.data }));
|
|
126
|
-
} catch (ex) {}
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
|
-
window.addEventListener('load', function() {
|
|
130
|
-
reportHeight();
|
|
131
|
-
new ResizeObserver(reportHeight).observe(document.body);
|
|
132
|
-
});
|
|
133
|
-
/* Support data-action attributes (Tool UI compat) — auto-lick on click.
|
|
134
|
-
Also intercept <a href> clicks and relay to the parent so links open
|
|
135
|
-
despite the iframe sandbox blocking top-level navigation. */
|
|
136
|
-
document.addEventListener('click', function(e) {
|
|
137
|
-
var el = e.target;
|
|
138
|
-
while (el && el !== document.body) {
|
|
139
|
-
if (el.dataset && el.dataset.action) {
|
|
140
|
-
var actionData = el.dataset.actionData;
|
|
141
|
-
if (actionData) { try { actionData = JSON.parse(actionData); } catch(ex) {} }
|
|
142
|
-
/* Picker hint (e.g. data-picker="directory") needs the parent to
|
|
143
|
-
run File System Access API on the click activation chain.
|
|
144
|
-
Forward as a separate message so the parent can run
|
|
145
|
-
showDirectoryPicker, stash the handle in IDB, then dispatch
|
|
146
|
-
the lick with the IDB key. */
|
|
147
|
-
var picker = el.dataset.picker;
|
|
148
|
-
if (picker) {
|
|
149
|
-
parent.postMessage({
|
|
150
|
-
type: 'dip-picker-action',
|
|
151
|
-
action: el.dataset.action,
|
|
152
|
-
data: actionData || null,
|
|
153
|
-
picker: picker,
|
|
154
|
-
}, '*');
|
|
155
|
-
} else {
|
|
156
|
-
window.slicc.lick({ action: el.dataset.action, data: actionData || null });
|
|
157
|
-
}
|
|
158
|
-
e.preventDefault();
|
|
159
|
-
e.stopPropagation();
|
|
160
|
-
return;
|
|
161
|
-
}
|
|
162
|
-
if (el.tagName === 'A' && el.getAttribute('href')) {
|
|
163
|
-
var href = el.getAttribute('href');
|
|
164
|
-
/* Allow in-iframe anchor navigation (#foo). Skip javascript: for safety. */
|
|
165
|
-
if (href.charAt(0) === '#') return;
|
|
166
|
-
if (/^javascript:/i.test(href)) { e.preventDefault(); return; }
|
|
167
|
-
/* Resolve relative URLs against the iframe's base. */
|
|
168
|
-
var resolved;
|
|
169
|
-
try { resolved = new URL(href, document.baseURI).href; } catch(ex) { resolved = href; }
|
|
170
|
-
parent.postMessage({ type: 'dip-open-link', url: resolved }, '*');
|
|
171
|
-
e.preventDefault();
|
|
172
|
-
e.stopPropagation();
|
|
173
|
-
return;
|
|
174
|
-
}
|
|
175
|
-
el = el.parentElement;
|
|
176
|
-
}
|
|
177
|
-
});
|
|
178
|
-
})();`}var Lr=`html,body{margin:0;padding:0;overflow:hidden;background:transparent;box-sizing:border-box}
|
|
179
|
-
*,*::before,*::after{box-sizing:inherit}
|
|
180
|
-
/* Vertical breathing room around dip content. Horizontal padding is owned
|
|
181
|
-
by the dip's own content (e.g. .sprinkle-action-card__body) so shtml
|
|
182
|
-
widgets that already pad themselves don't end up double-indented. The
|
|
183
|
-
ResizeObserver on document.body reports the post-padding scrollHeight
|
|
184
|
-
correctly, so auto-height continues to work. The .sprinkle-inline rule
|
|
185
|
-
(set on the iframe body) carries 2px of horizontal padding so the 1px
|
|
186
|
-
focus ring (box-shadow:0 0 0 1px on inputs/select below) doesn't get
|
|
187
|
-
clipped at the iframe paint boundary. */
|
|
188
|
-
body{padding:12px 0;font-family:var(--s2-font-family, sans-serif);font-size:13px;color:var(--s2-content-default)}
|
|
189
|
-
.sprinkle-inline{padding:var(--s2-spacing-100) 2px}
|
|
190
|
-
.sprinkle-inline .sprinkle-btn{padding:4px 12px;font-size:12px;height:28px;box-shadow:none}
|
|
191
|
-
.sprinkle-inline .sprinkle-btn:not([class*="sprinkle-btn--"]){background:var(--s2-bg-elevated)}
|
|
192
|
-
.sprinkle-inline .sprinkle-card{box-shadow:none;margin:0}
|
|
193
|
-
.sprinkle-inline .sprinkle-action-card{margin:0;width:100%}
|
|
194
|
-
/* Stacked action cards in one dip need breathing room between them. The
|
|
195
|
-
margin:0 above zeroes the single-card case (iframe padding owns that
|
|
196
|
-
spacing); this adjacent-sibling rule outranks a plain authored class,
|
|
197
|
-
so multiple .sprinkle-action-card in one message no longer touch edge
|
|
198
|
-
to edge. See vfs-root/workspace/skills/dips/SKILL.md. */
|
|
199
|
-
.sprinkle-inline .sprinkle-action-card + .sprinkle-action-card{margin-top:12px}
|
|
200
|
-
.sprinkle-inline .sprinkle-action-card .sprinkle-table{width:100%}
|
|
201
|
-
.sprinkle-inline .sprinkle-grid{width:100%}
|
|
202
|
-
input[type="range"]{width:100%;height:4px;-webkit-appearance:none;appearance:none;background:var(--s2-gray-300);border-radius:2px;outline:none;cursor:default}
|
|
203
|
-
input[type="range"]::-webkit-slider-thumb{-webkit-appearance:none;width:18px;height:18px;border-radius:50%;background:var(--s2-accent);cursor:default;border:2px solid var(--s2-bg-base)}
|
|
204
|
-
input[type="range"]::-moz-range-thumb{width:14px;height:14px;border-radius:50%;background:var(--s2-accent);cursor:default;border:2px solid var(--s2-bg-base)}
|
|
205
|
-
input[type="text"],input[type="number"],textarea{width:100%;padding:7px 12px;font-size:13px;font-family:var(--s2-font-family,sans-serif);color:var(--s2-content-default);background:var(--s2-bg-layer-2);border:1px solid var(--s2-border-subtle,var(--s2-gray-300));border-radius:8px;outline:none;box-sizing:border-box}
|
|
206
|
-
input[type="text"]:focus,input[type="number"]:focus,textarea:focus{border-color:var(--s2-accent);box-shadow:0 0 0 1px var(--s2-accent)}
|
|
207
|
-
input[type="text"]::placeholder,textarea::placeholder{color:var(--s2-content-disabled,var(--s2-gray-400))}
|
|
208
|
-
select{padding:6px 12px;font-size:13px;font-family:var(--s2-font-family,sans-serif);color:var(--s2-content-default);background:var(--s2-bg-layer-2);border:1px solid var(--s2-border-subtle,var(--s2-gray-300));border-radius:8px;outline:none;cursor:default}
|
|
209
|
-
select:focus{border-color:var(--s2-accent);box-shadow:0 0 0 1px var(--s2-accent)}
|
|
210
|
-
button{display:inline-flex;align-items:center;justify-content:center;gap:6px;height:28px;padding:4px 12px;border:1px solid var(--s2-border-default,var(--s2-gray-300));border-radius:9999px;background:transparent;color:var(--s2-content-default);font-size:12px;font-weight:700;font-family:var(--s2-font-family,sans-serif);cursor:default;transition:background 130ms ease}
|
|
211
|
-
button:hover{background:color-mix(in srgb,var(--s2-content-default) 6%,transparent)}
|
|
212
|
-
button:disabled{opacity:0.4;pointer-events:none}
|
|
213
|
-
canvas{display:block;width:100%;border-radius:8px}
|
|
214
|
-
mark{background:color-mix(in srgb,var(--s2-accent) 25%,transparent);color:inherit;border-radius:2px;padding:0 2px}
|
|
215
|
-
.c-purple{background:#3C3489;color:#EEEDFE}.c-teal{background:#085041;color:#E1F5EE}
|
|
216
|
-
.c-coral{background:#712B13;color:#FAECE7}.c-pink{background:#72243E;color:#FBEAF0}
|
|
217
|
-
.c-gray{background:#444441;color:#F1EFE8}.c-blue{background:#0C447C;color:#E6F1FB}
|
|
218
|
-
.c-amber{background:#633806;color:#FAEEDA}.c-red{background:#791F1F;color:#FCEBEB}
|
|
219
|
-
.c-green{background:#27500A;color:#EAF3DE}`,Rr=`(function(){
|
|
220
|
-
window.addEventListener('message', function(e){
|
|
221
|
-
if (!e.data || e.data.type !== 'dip-draft-update') return;
|
|
222
|
-
var content = typeof e.data.content === 'string' ? e.data.content : '';
|
|
223
|
-
document.body.innerHTML = content;
|
|
224
|
-
if (window.lucide && typeof window.lucide.createIcons === 'function') {
|
|
225
|
-
try { window.lucide.createIcons(); } catch(ex){}
|
|
226
|
-
}
|
|
227
|
-
});
|
|
228
|
-
})();`;function zr(e,t,n=!1){let r=Ee(),i=Tn()?` class="theme-light"`:``,a=t||e.includes(`<slicc-editor`),o=t||e.includes(`<slicc-diff`),s=t?`<script>${Rr}<\/script>`:``;return`<!DOCTYPE html>
|
|
229
|
-
<html${i}><head>
|
|
230
|
-
<meta charset="utf-8">
|
|
231
|
-
<style>${r}</style>
|
|
232
|
-
<style>${Lr}</style>
|
|
233
|
-
<script>${Ir(n&&!t)}<\/script>
|
|
234
|
-
${s}
|
|
235
|
-
${a?`<script src="/slicc-editor.js"><\/script>`:``}
|
|
236
|
-
${o?`<script src="/slicc-diff.js"><\/script>`:``}
|
|
237
|
-
<script src="/lucide-icons.js"><\/script>
|
|
238
|
-
</head>
|
|
239
|
-
<body class="sprinkle-inline">${e}</body></html>`}var L=new Set;function Br(e){if(typeof e?.type!=`string`||e.type.indexOf(`slicc-`)!==0)throw Error(`broadcastToDips: payload.type must start with 'slicc-'`);for(let t of L)try{t.postMessage(e,`*`)}catch{}}var Vr;function Hr(e){Vr=e}function R(e){return e.length===0?`''`:`'${e.replace(/'/g,`'\\''`)}'`}function Ur(e,t){let n=t?.cwd??`.`,r=t?.allowedCommands??`*`,i=[`agent`];return t?.model&&i.push(`--model`,R(t.model)),t?.thinking&&i.push(`--thinking`,R(t.thinking)),t?.readOnly&&i.push(`--read-only`,R(t.readOnly)),i.push(R(n),R(r),R(e)),i.join(` `)}async function Wr(e){if(!Vr)return{stdout:``,stderr:`exec: shell bridge not available
|
|
240
|
-
`,exitCode:127};try{return await Vr(e)}catch(e){return{stdout:``,stderr:`exec: ${e instanceof Error?e.message:String(e)}\n`,exitCode:1}}}async function Gr(e,t){let n=await Wr(Ur(e,t));return{stdout:n.stdout||n.stderr,exitCode:n.exitCode}}async function Kr(e,t){let n=await Te(Wr,e,t);if(e===`fetch`){let e=n,t=atob(e.bodyBase64),r=new Uint8Array(t.length);for(let e=0;e<t.length;e++)r[e]=t.charCodeAt(e);return{...e,body:new TextDecoder(`utf-8`).decode(r)}}return n}var z=new WeakMap;function qr(e,t){try{e.postMessage({type:`dip-device-event`,channel:`hid:inputreport`,payload:t},`*`)}catch{}}async function Jr(e,t){let n=z.get(e);if(n||(n=new Map,z.set(e,n)),n.has(t))return;let r=await zt(Mt(),t,n=>{let r=n.bytes instanceof Uint8Array?n.bytes:new Uint8Array(n.bytes);qr(e,{handle:t,reportId:n.reportId,data:r})});n.set(t,r)}async function Yr(e,t){let n=z.get(e);if(!n)return;let r=n.get(t);if(r){n.delete(t);try{await Promise.resolve(r())}catch{}}n.size===0&&z.delete(e)}function Xr(e){let t=z.get(e);if(t){for(let e of t.values())try{Promise.resolve(e()).catch(()=>{})}catch{}z.delete(e)}}function Zr(e){if(e instanceof Uint8Array)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e)){let t=e;return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}if(Array.isArray(e))return new Uint8Array(e);throw Error(`expected Uint8Array, ArrayBuffer, or number[]`)}async function Qr(e,t,n){let r=Mt();switch(t){case`list`:{let e=jt();if(!e)throw Error(`WebHID is unavailable in this browser`);return Wt(r,e)}case`request`:{let e=jt();if(!e)throw Error(`WebHID is unavailable in this browser`);return Ht(r,e,n[0]??[])}case`info`:return Vt(r,n[0]);case`open`:{let t=n[0];return await Rt(r,t),await Jr(e,t),{ok:!0}}case`close`:{let t=n[0];return await Yr(e,t),await Gt(r,t),{ok:!0}}case`sendReport`:{let e=n[0],t=n[1],i=Zr(n[2]),a=i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength);return await Ft(r,e,t,a),{ok:!0}}default:throw Error(`hid: unknown op '${t}'`)}}async function $r(e,t){let n=Nt();switch(e){case`list`:{let e=Pt();if(!e)throw Error(`Web Serial is unavailable in this browser`);return Ut(n,e)}case`request`:{let e=Pt();if(!e)throw Error(`Web Serial is unavailable in this browser`);return Lt(n,e,t[0]??[])}case`info`:return It(n,t[0]);case`open`:{let e=t[0],r=t[1]??{baudRate:9600};return await Bt(n,e,r),{ok:!0}}case`close`:return await Kt(n,t[0]),{ok:!0};default:throw Error(`serial: unknown op '${e}'`)}}async function ei(e,t){let n=Yt();switch(e){case`list`:{let e=Xt();if(!e)throw Error(`WebUSB is unavailable in this browser`);return $t(n,e)}case`request`:{let e=Xt();if(!e)throw Error(`WebUSB is unavailable in this browser`);return Zt(n,e,t[0]??[])}case`info`:return en(n,t[0]);case`open`:return await tn(n,t[0]),{ok:!0};case`close`:return await Qt(n,t[0]),{ok:!0};default:throw Error(`usb: unknown op '${e}'`)}}async function ti(e,t,n,r){switch(t){case`hid`:return Qr(e,n,r);case`serial`:return $r(n,r);case`usb`:return ei(n,r);default:throw Error(`unknown device channel '${t}'`)}}async function ni(e,t){if(!e||typeof t.id!=`number`)return!1;let n=n=>{try{e.postMessage({...n,id:t.id},`*`)}catch{}};if(!I.has(e))return n({type:`dip-device-op-response`,error:`device access not allowed for this dip`}),!0;let r=t.channel;if(r!==`hid`&&r!==`serial`&&r!==`usb`)return n({type:`dip-device-op-response`,error:`unknown device channel '${r}'`}),!0;try{n({type:`dip-device-op-response`,result:await ti(e,r,typeof t.op==`string`?t.op:``,Array.isArray(t.args)?t.args:[])})}catch(e){n({type:`dip-device-op-response`,error:e instanceof Error?e.message:String(e)})}return!0}async function ri(e,t){if(!e||typeof t.id!=`number`)return!1;let n=n=>{try{e.postMessage({...n,id:t.id},`*`)}catch{}};if(!I.has(e))return n({type:`${t.type}-response`,error:`exec not allowed for this dip`}),!0;if(t.type===`dip-exec`)return n({type:`dip-exec-response`,result:await Wr(typeof t.cmd==`string`?t.cmd:``)}),!0;if(t.type===`dip-agent`)return n({type:`dip-agent-response`,result:await Gr(typeof t.prompt==`string`?t.prompt:``,t.opts)}),!0;if(t.type===`dip-jsh`){try{n({type:`dip-jsh-response`,result:await Kr(typeof t.op==`string`?t.op:``,Array.isArray(t.args)?t.args:[])})}catch(e){n({type:`dip-jsh-response`,error:e instanceof Error?e.message:String(e)})}return!0}return!1}function B(e,t,n,r=!1){let i=zr(t,!1,r);if(Cr)return yi(e,i,n,r);let a=document.createElement(`iframe`);a.setAttribute(`sandbox`,`allow-scripts allow-same-origin`),a.style.cssText=`width:100%;border:none;overflow:hidden;display:block;`,a.srcdoc=i,e.appendChild(a),a.contentWindow&&(En(a.contentWindow),L.add(a.contentWindow),r&&I.add(a.contentWindow)),a.addEventListener(`load`,()=>{En(a.contentWindow),a.contentWindow&&(L.add(a.contentWindow),r&&I.add(a.contentWindow)),De()&&Oe(a)},{once:!0});let o=e=>{if(e.source!==a.contentWindow)return;let t=e.data;t?.type&&(t.type===`dip-lick`?n(t.action,t.data):t.type===`dip-height`?a.style.height=t.height+`px`:t.type===`dip-open-link`?ai(t.url):t.type===`dip-picker-action`?fi(t,n):t.type===`dip-readfile`||t.type===`dip-exists`||t.type===`dip-stat`?ii(a.contentWindow,t):t.type===`dip-exec`||t.type===`dip-agent`||t.type===`dip-jsh`?ri(a.contentWindow,t):t.type===`dip-device-op`&&ni(a.contentWindow,t))};window.addEventListener(`message`,o);let s=null;if(De()&&typeof IntersectionObserver<`u`){let e=!1,t=new IntersectionObserver(n=>{if(n[n.length-1].isIntersecting){if(e){e=!1;return}t.unobserve(a),Oe(a,()=>{e=!0,t.observe(a)})}});s=t,t.observe(a)}return{dispose(){s?.disconnect(),window.removeEventListener(`message`,o),wn(a.contentWindow),a.contentWindow&&(L.delete(a.contentWindow),I.delete(a.contentWindow),Xr(a.contentWindow)),a.remove()}}}async function ii(e,t){if(!e||typeof t.id!=`number`)return!1;let n=typeof t.path==`string`?t.path:``,r=n=>{try{e.postMessage({...n,id:t.id},`*`)}catch{}};if(!I.has(e))return r({type:`${t.type}-response`,error:`VFS access not allowed for this dip`}),!0;if(!Mr(n))return r({type:`${t.type}-response`,error:`VFS path not allowed: ${n}`}),!0;if(t.type===`dip-readfile`){let e=await Or(n,!0);return e===null?(r({type:`dip-readfile-response`,error:`Read failed`}),!0):(r({type:`dip-readfile-response`,content:typeof e==`string`?e:new TextDecoder().decode(e)}),!0)}if(t.type===`dip-exists`)return r({type:`dip-exists-response`,exists:await Or(n,!0)!==null}),!0;if(t.type===`dip-stat`){let e=await Or(n,!1);return e===null?(r({type:`dip-stat-response`,error:`Stat failed`}),!0):(r({type:`dip-stat-response`,stat:{isFile:!0,isDirectory:!1,size:typeof e==`string`?e.length:e.byteLength,mtimeMs:0}}),!0)}return!1}function ai(e){if(!(typeof e!=`string`||!e)&&/^(https?:|mailto:)/i.test(e))try{window.open(e,`_blank`,`noopener,noreferrer`)}catch{}}var oi=new WeakMap;function si(){return typeof Element.prototype.moveBefore==`function`}function ci(e,t,n){let r=e.findIndex(e=>{let n=oi.get(e);return n?.key===t&&n.wrapper.isConnected}),i=e[r],a=i&&oi.get(i);if(!a)return null;try{n.parentNode.moveBefore(a.wrapper,n)}catch{return null}return n.remove(),e.splice(r,1),i}function li(e,t,n){return oi.set(e,{key:t,wrapper:n}),e}function ui(e,t,n={}){let r=[],i=[...n.previous??[]],a=si(),o=n.streaming===!0&&!a,s=e.querySelectorAll(`pre > code.language-shtml`);for(let e of s){let n=e.parentElement,s=e.textContent??``,c=`shtml:${s}`;if(o){n.replaceWith(n.ownerDocument.createRange().createContextualFragment(v));continue}let l=a?ci(i,c,n):null;if(l){r.push(l);continue}let u=document.createElement(`div`);u.className=`msg__dip`,n.replaceWith(u),r.push(li(B(u,s,t,!1),c,u))}let c=e.querySelectorAll(`img[src$=".shtml"]`);for(let e of c){let n=e.getAttribute(`src`);if(!n||o)continue;let s=`img:${n}`,c=a?ci(i,s,e):null;if(c){r.push(c);continue}let l=document.createElement(`div`);l.className=`msg__dip`,e.alt&&l.setAttribute(`title`,e.alt),e.replaceWith(l);let u=new AbortController,d=null,f=!1;r.push(li({dispose(){f=!0,u.abort(),d&&=(d.dispose(),null)}},s,l));let p=n.startsWith(`/`),m=typeof navigator<`u`&&!!navigator.serviceWorker?.controller,h=p?`/preview${n}`:n,g=async()=>{if(p&&!m)return Tr(n,u.signal);let e;try{e=await fetch(h,{signal:u.signal})}catch(e){if(e?.name===`AbortError`)throw e;if(p)return Tr(n,u.signal);throw e}if(e.ok)return e.text();if(p)return Tr(n,u.signal);throw Error(`HTTP ${e.status}`)},_=p&&jr(n);g().then(e=>{f||!l.isConnected||(d=B(l,e,t,_))}).catch(e=>{f||e?.name===`AbortError`||(l.textContent=`Failed to load dip: ${n}`,l.style.cssText=`padding:8px;font-size:12px;color:var(--s2-negative);font-family:var(--s2-font-mono)`)})}return di(i),r}function di(e){for(let t of e)try{t.dispose()}catch{}e.length=0}async function fi(e,t){let n=wr(e.data);if(e.picker===`screenshare`){await mi(e.action,t);return}if(Cr){await pi(e.picker,e.action,n,t);return}switch(e.picker){case`directory`:await hi(e.action,t);return;case`usb-device`:await gi(e.action,n,t);return;case`serial-port`:await _i(e.action,n,t);return;case`hid-device`:await vi(e.action,n,t);return;default:t(e.action,e.data);return}}async function pi(e,t,n,r){try{switch(e){case`directory`:{let{openMountPickerPopup:e}=await i(async()=>{let{openMountPickerPopup:e}=await import(`./mount-picker-popup--ijSfN8u.js`);return{openMountPickerPopup:e}},__vite__mapDeps([34,3,35,19])),n=await e();n.cancelled?r(t,{cancelled:!0}):n.error?r(t,{error:n.error}):n.idbKey?r(t,{handleInIdb:!0,idbKey:n.idbKey,dirName:n.dirName??``}):r(t,{error:`mount picker returned no handle key`});return}case`usb-device`:{let{openUsbPickerPopup:e}=await i(async()=>{let{openUsbPickerPopup:e}=await import(`./usb-picker-O-2gFMNl.js`).then(e=>e.t);return{openUsbPickerPopup:e}},__vite__mapDeps([36,1,35,19])),a=await e(n);`cancelled`in a?r(t,{cancelled:!0}):`error`in a?r(t,{error:a.error}):r(t,{granted:!0,info:a.info});return}case`serial-port`:{let{openSerialPickerPopup:e}=await i(async()=>{let{openSerialPickerPopup:e}=await import(`./serial-picker-BQF_Eitc.js`);return{openSerialPickerPopup:e}},__vite__mapDeps([37,35,19])),a=await e(n);`cancelled`in a?r(t,{cancelled:!0}):`error`in a?r(t,{error:a.error}):r(t,{granted:!0,info:a.info});return}case`hid-device`:{let{openHidPickerPopup:e}=await i(async()=>{let{openHidPickerPopup:e}=await import(`./hid-picker-sFJ8vzUj.js`);return{openHidPickerPopup:e}},__vite__mapDeps([38,35,19])),a=await e(n);`cancelled`in a?r(t,{cancelled:!0}):`error`in a?r(t,{error:a.error}):r(t,{granted:!0,info:a.info});return}default:r(t,{error:`unknown picker kind: ${e??`(none)`}`});return}}catch(e){r(t,{error:e instanceof Error?e.message:String(e)})}}async function V(e,t){let n=kt();if(!n)return null;let r={current:null},i=t=>{let n=t.detail;n.kind===e&&(r.current=n)};n.addEventListener(`slicc-permission-deny`,i);try{let i=await n.request(e,t);if(i)return{ok:!0,grant:i};let a=r.current;return{ok:!1,reason:a?.reason??`error`,...a?.message?{message:a.message}:{}}}finally{n.removeEventListener(`slicc-permission-deny`,i)}}function H(e,t,n,r){if(t.reason===`cancelled`){r(e,{cancelled:!0});return}if(t.reason===`unavailable`){r(e,{error:n});return}r(e,{error:t.message??`unknown error`})}async function mi(e,t){let n=await V(`screenshare`,{constraints:{video:!0}});if(!n){t(e,{error:`screen capture is not available`});return}if(!n.ok){H(e,n,`screen capture is not available`,t);return}let r=n.grant,{adoptDisplayStream:a,displaySessions:o}=await i(async()=>{let{adoptDisplayStream:e,displaySessions:t}=await import(`./screencapture-media-CM5E2g6c.js`);return{adoptDisplayStream:e,displaySessions:t}},[]);try{let n=await a(r.stream);if(!n.handle){t(e,{error:`screen share produced no handle`});return}let{keepAdoptedScreenShare:s}=await i(async()=>{let{keepAdoptedScreenShare:e}=await import(`./screen-share-approval-live-D388fVD9.js`);return{keepAdoptedScreenShare:e}},[]);if(!s(n.handle,e=>o.stop(e))){t(e,{cancelled:!0});return}t(e,{granted:!0,handle:n.handle})}catch(n){t(e,{error:n instanceof Error?n.message:String(n)})}}async function hi(e,t){let n=await V(`filesystem`);if(!n){t(e,{error:`File System Access API not available`});return}if(!n.ok){H(e,n,`File System Access API not available`,t);return}let r=n.grant.handle,a=`pendingMount:dip-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`;try{let{storePendingHandle:e}=await i(async()=>{let{storePendingHandle:e}=await import(`./mount-picker-popup--ijSfN8u.js`);return{storePendingHandle:e}},__vite__mapDeps([34,3,35,19]));await e(a,r)}catch(n){t(e,{error:`failed to store directory handle: ${n instanceof Error?n.message:String(n)}`});return}t(e,{handleInIdb:!0,idbKey:a,dirName:r.name})}async function gi(e,t,n){let r=await V(`usb`,{filters:t});if(!r){n(e,{error:`WebUSB is not available`});return}if(!r.ok){H(e,r,`WebUSB is not available`,n);return}let a=r.grant,{getSharedUsbRegistry:o,deviceToInfo:s}=await i(async()=>{let{getSharedUsbRegistry:e,deviceToInfo:t}=await import(`./usb-device-registry--JwKRTYp.js`).then(e=>e.c);return{getSharedUsbRegistry:e,deviceToInfo:t}},__vite__mapDeps([39,1])),c=o().register(a.device);n(e,{granted:!0,handle:c,info:s(c,a.device)})}async function _i(e,t,n){let r=await V(`serial`,t.length?{filters:t}:void 0);if(!r){n(e,{error:`Web Serial is not available`});return}if(!r.ok){H(e,r,`Web Serial is not available`,n);return}let a=r.grant,o=await i(()=>import(`./serial-port-registry-CCqklAEr.js`).then(e=>e.o),__vite__mapDeps([40,1])),s=o.getSharedSerialRegistry(),c=s.register(a.port),l=s.get(c);n(e,{granted:!0,handle:c,info:l?o.deviceToInfo(c,l):{handle:c}})}async function vi(e,t,n){let r=await V(`hid`,{filters:t});if(!r){n(e,{error:`WebHID is not available`});return}if(!r.ok){H(e,r,`WebHID is not available`,n);return}let a=r.grant,{getSharedHidRegistry:o,hidDeviceToInfo:s}=await i(async()=>{let{getSharedHidRegistry:e,hidDeviceToInfo:t}=await import(`./hid-device-registry-B2R-0rNt.js`).then(e=>e.a);return{getSharedHidRegistry:e,hidDeviceToInfo:t}},__vite__mapDeps([41,1])),c=o(),l=a.devices.map(e=>{let t=c.register(e);return s(t,e)}),u=l[0];n(e,{granted:!0,handle:u.handle,info:u,devices:l})}function yi(e,t,n,r=!1){let i=document.createElement(`iframe`);i.src=chrome.runtime.getURL(`sprinkle-sandbox.html`),i.style.cssText=`width:100%;border:none;overflow:hidden;display:block;`,e.appendChild(i);let a=e=>{if(e.source!==i.contentWindow)return;let t=e.data;t?.type&&(t.type===`dip-lick`?n(t.action,t.data):t.type===`dip-height`?i.style.height=t.height+`px`:t.type===`dip-open-link`?ai(t.url):t.type===`dip-readfile`||t.type===`dip-exists`||t.type===`dip-stat`?ii(i.contentWindow,t):t.type===`dip-exec`||t.type===`dip-agent`||t.type===`dip-jsh`?ri(i.contentWindow,t):t.type===`dip-device-op`?ni(i.contentWindow,t):t.type===`dip-picker-action`&&fi(t,n))};return window.addEventListener(`message`,a),i.addEventListener(`load`,()=>{En(i.contentWindow),i.contentWindow&&(L.add(i.contentWindow),r&&I.add(i.contentWindow)),i.contentWindow?.postMessage({type:`dip-render`,srcdoc:t,isLight:Tn()},`*`)},{once:!0}),{dispose(){window.removeEventListener(`message`,a),wn(i.contentWindow),i.contentWindow&&(L.delete(i.contentWindow),I.delete(i.contentWindow),Xr(i.contentWindow)),i.remove()}}}var bi=`---
|
|
241
|
-
writablePaths:
|
|
242
|
-
- /workspace/CLAUDE.md
|
|
243
|
-
- /shared/wiki/
|
|
244
|
-
visiblePaths:
|
|
245
|
-
- /sessions/
|
|
246
|
-
- /shared/
|
|
247
|
-
- /workspace/
|
|
248
|
-
allowedCommands:
|
|
249
|
-
- awk
|
|
250
|
-
- cat
|
|
251
|
-
- cp
|
|
252
|
-
- cut
|
|
253
|
-
- echo
|
|
254
|
-
- file
|
|
255
|
-
- find
|
|
256
|
-
- grep
|
|
257
|
-
- head
|
|
258
|
-
- jq # structured reads of JSON stores such as /shared/loose-ends.json and /sessions/index.json
|
|
259
|
-
- ls
|
|
260
|
-
- mkdir
|
|
261
|
-
- mv
|
|
262
|
-
- od # read-only byte inspection of corrupted stores
|
|
263
|
-
- printf
|
|
264
|
-
- rg # recursive, .gitignore-aware search; what the pass actually uses over find|xargs grep. Exit 1 = no match (\`-c\` prints nothing, not \`0\`); exit 2 = searchable-byte limit (stderr names the budget). Later commands still run.
|
|
265
|
-
- sed
|
|
266
|
-
- sort
|
|
267
|
-
- tail
|
|
268
|
-
- tr
|
|
269
|
-
- uniq
|
|
270
|
-
- uname # \`uname -r\` prints the running SLICC version; pin runtime claims to it rather than to a version named in the (possibly stale) snapshot
|
|
271
|
-
- upskill
|
|
272
|
-
- wc
|
|
273
|
-
timeoutSeconds: 1200
|
|
274
|
-
dreamTimeoutSeconds: 3600
|
|
275
|
-
thinkingLevel: medium
|
|
276
|
-
---
|
|
277
|
-
|
|
278
|
-
# Memory pass
|
|
279
|
-
|
|
280
|
-
You maintain one cone's durable memory: the file at {{MEMORY_PATH}}. Today's date is {{TODAY}}; {{SESSION_COUNT}} sessions are archived. The whole file has a hard budget of {{BUDGET_CHARS}} characters, with no exempt region.
|
|
281
|
-
|
|
282
|
-
## This pass
|
|
283
|
-
|
|
284
|
-
{{TASK}}
|
|
285
|
-
|
|
286
|
-
Read the entire current memory at {{MEMORY_PATH}} first. Every part of the file is editable and counts toward the budget.
|
|
287
|
-
|
|
288
|
-
## Mining the session archive (curation passes only)
|
|
289
|
-
|
|
290
|
-
Three things carry across sessions, and each has its own place in the archive:
|
|
291
|
-
|
|
292
|
-
| Look for | Where it lives |
|
|
293
|
-
| --------------- | ---------------------------------------------------------------------- |
|
|
294
|
-
| **Preferences** | the user's own messages — how they want things done, and what to avoid |
|
|
295
|
-
| **Projects** | tool-call arguments — the paths, repos and files actually worked on |
|
|
296
|
-
| **Pitfalls** | failed tool calls — what broke, and the error that proves it |
|
|
297
|
-
|
|
298
|
-
Pitfalls are the highest-value and most-often-lost category: a failure that cost half an hour is worth one line next time. Keep the error text that identifies it, not the stack trace.
|
|
299
|
-
|
|
300
|
-
**Never \`cat\` the archive and never \`head\` it.** Archives reach several megabytes, and the machine-readable \`<!-- slicc:session-data ... -->\` block is a _single line_ holding the whole session as JSON — roughly half the file. Reading it costs a fortune and tells you nothing the prose below it does not. Whole \`### Tool\` result bodies are the other half and are equally not worth reading.
|
|
301
|
-
|
|
302
|
-
Check the size first, then pull the three signals separately. Together they run about 1% of the archive, so these work on a 2.5 MB file as happily as on a small one.
|
|
303
|
-
|
|
304
|
-
\`\`\`bash
|
|
305
|
-
wc -c {{SESSION_ARCHIVE_PATH}}
|
|
306
|
-
|
|
307
|
-
# Preferences — what the user asked for, in their words.
|
|
308
|
-
sed '/^<!-- slicc:session-data$/,/^-->$/d' {{SESSION_ARCHIVE_PATH}} \\
|
|
309
|
-
| awk '/^## User/{p=1;next} /^## (Assistant|Summary)/{p=0} /^### Tool/{p=0} p'
|
|
310
|
-
|
|
311
|
-
# Projects — the paths touched most, which name the work.
|
|
312
|
-
sed '/^<!-- slicc:session-data$/,/^-->$/d' {{SESSION_ARCHIVE_PATH}} \\
|
|
313
|
-
| grep -o '/[A-Za-z0-9_][A-Za-z0-9_./-]\\{3,\\}' \\
|
|
314
|
-
| sort | uniq -c | sort -rn | head -40
|
|
315
|
-
|
|
316
|
-
# Pitfalls — failed calls with the input that caused them.
|
|
317
|
-
sed '/^<!-- slicc:session-data$/,/^-->$/d' {{SESSION_ARCHIVE_PATH}} \\
|
|
318
|
-
| grep -B6 '^Result:.*\\(rror\\|not found\\|failed\\|denied\\|ENOENT\\|fatal\\)' \\
|
|
319
|
-
| cut -c1-200
|
|
320
|
-
\`\`\`
|
|
321
|
-
|
|
322
|
-
Only if something is still missing, reach into one specific block with \`grep -n\` plus a bounded \`sed -n 'START,ENDp'\`. Never widen these to the whole file.
|
|
323
|
-
|
|
324
|
-
### Suggesting a skill
|
|
325
|
-
|
|
326
|
-
A recurring pitfall is often a missing skill. Once you know what broke and what the work was, spend **one** lookup on it — no more, and skip it entirely when the session had no failures:
|
|
327
|
-
|
|
328
|
-
\`\`\`bash
|
|
329
|
-
upskill search <a few words from the pitfall>
|
|
330
|
-
upskill list # what is already installed — never suggest a duplicate
|
|
331
|
-
\`\`\`
|
|
332
|
-
|
|
333
|
-
\`upskill ai-ecoverse/skills\` and \`upskill adobe/skills\` list a repo's skills without installing anything. **Never install.** You have no write access to the skills tree, so an install attempt will fail or interrupt the user for approval; recommending is your job, deciding is theirs. Put any suggestion in your closing message, with the pitfall it addresses — that message is delivered to the main agent.
|
|
334
|
-
|
|
335
|
-
## Consolidating (every pass)
|
|
336
|
-
|
|
337
|
-
The file accumulates under time pressure; every pass leaves it better than it found it:
|
|
338
|
-
|
|
339
|
-
1. **Merge duplicates.** Across weeks the same preference or project fact accumulates near-identical phrasings. Keep one — the most recent, most specific version.
|
|
340
|
-
2. **Supersede contradictions.** When two lines contradict, the newer-dated one wins; rewrite in place so only one version stands — a claim and its correction must never survive together as prose. When the refuted claim is a trap worth remembering, record it under a \`## Not true\` section as \`- not: <refuted claim> — why: <evidence> — instead: <correction> (YYYY-MM-DD)\`. A fact contradicted by the session titles in the index (a project renamed, a tool replaced) goes too. Count contradictory claim pairs before and after the rewrite and put both numbers in the closing report; if the pass could not reduce the count, say so.
|
|
341
|
-
3. **Retire stale ephemera.** An entry whose \`stale_after: YYYY-MM-DD\` date has passed is unverified — re-verify it against the index or drop it. Sections whose last-verified date is old AND whose subject no longer appears in recent session titles are candidates for deletion — check before deleting:
|
|
342
|
-
|
|
343
|
-
\`\`\`bash
|
|
344
|
-
# Recent activity, to test whether an old section still matters.
|
|
345
|
-
jq -r '.[] | "\\(.frozenAt[0:10]) \\(.cone // "cone") \\(.title)"' /sessions/index.json | tail -40
|
|
346
|
-
\`\`\`
|
|
347
|
-
|
|
348
|
-
4. **Reorganize.** Fold orphan bullets into the per-topic section they belong to; split a section that has become two topics; order sections so the most-used topics lead. Every \`##\` and \`###\` heading keeps (or gains) its last-verified date in \`YYYY-MM-DD\` form.
|
|
349
|
-
5. **Move knowledge to the wiki.** When the file is over budget and a section is reference knowledge — facts about a domain, a system, a person — rather than working preferences or pitfalls, move it to a page under \`/shared/wiki/\` following \`/shared/wiki/WIKI.md\` (update \`index.md\`, append an \`ingest\` entry to \`log.md\`), and replace the section with one line naming the page. Move at most a couple of sections per pass; the memory file must keep working standalone.
|
|
350
|
-
6. **Land under budget.** The hard budget is {{BUDGET_CHARS}} characters for the whole file, no exempt region. When over budget, compact or remove the oldest-dated sections first.
|
|
351
|
-
|
|
352
|
-
A pass never adds facts that are not in the session archive, the file or the wiki, never installs anything, and never touches any file other than {{MEMORY_PATH}} and the wiki.
|
|
353
|
-
|
|
354
|
-
## Entry grammar: provenance and supersession
|
|
355
|
-
|
|
356
|
-
Facts age. Write every entry so a later pass can tell whether it still holds:
|
|
357
|
-
|
|
358
|
-
- Prefix entries with their actor: \`human:\` for what the user said, \`process:\` for what you inferred from tool output. Example: \`- human: prefers rebase over merge (2026-09-11)\`.
|
|
359
|
-
- Version-pin claims that can rot: name the version, commit, or file the claim was verified against, e.g. \`- process: coverage floor is 83% (coverage-thresholds.json @ 6.146.2)\`. Runtime version comes from \`uname -r\`, not from a version named in this file. Never record a confidence score — what ages is the pin, not a probability.
|
|
360
|
-
- A claim with a known expiry carries \`stale_after: YYYY-MM-DD\`, an absolute date, never a duration. Past that date the claim counts as unverified.
|
|
361
|
-
- **Supersede, never append.** When a session proves a stored claim wrong, rewrite the claim in place — a claim and its correction must never both stand as prose (see step 2 above for the \`## Not true\` form).
|
|
362
|
-
|
|
363
|
-
## Working within the budget
|
|
364
|
-
|
|
365
|
-
Measure, decide, then write. Do not converge on the budget by trial and error — each attempt re-reads your whole context and is billed accordingly.
|
|
366
|
-
|
|
367
|
-
1. \`wc -c {{MEMORY_PATH}}\` to get the current size, and subtract {{BUDGET_CHARS}} to get the exact surplus. Per-section costs come out of \`awk\`: \`awk '/^## /{h=$0} {c[h]+=length($0)+1} END{for(k in c) printf "%7d %s\\n", c[k], k}' {{MEMORY_PATH}} | sort -rn\` tells you which sections pay for the surplus.
|
|
368
|
-
2. Decide up front which sections absorb that surplus, oldest-dated first, and roughly what each one costs. Budget the whole cut before editing anything.
|
|
369
|
-
3. Write with the \`memory_write\` tool (\`path: {{MEMORY_PATH}}\`). It is the only tool that can write the memory file — \`write_file\`, \`edit\`, \`cp\` and \`cat >\` are refused on it — and it refuses any write that would leave the file over budget without shrinking it. Prefer \`edits\` (exact replacements, one section at a time): every write leaves a whole, budget-checked file, and a run stopped at its bound lands whatever the file holds at that moment, so finished sections are never lost; use \`content\` for a whole-file rewrite at most once, already inside the budget, and never draft the whole file elsewhere first — emitting it twice is what runs a pass out of time. Never write a version you know to be over budget «to fix in the next step»: the pass can be killed at any moment, and the file you leave behind is the one the next session inherits.
|
|
370
|
-
4. Read the size and the remaining room from the tool's result — it reports both, so do not spend a turn on \`wc -c\` afterwards. If it says you are still over, cut a whole section rather than shaving a few characters at a time.
|
|
371
|
-
|
|
372
|
-
Scratch for notes (not for drafting the whole file) is \`{{SCRATCH_DIR}}/\`: your own folder, writable without a grant and without an approval prompt, private to this pass, and deleted when the pass ends.
|
|
373
|
-
|
|
374
|
-
If the pass is running long, drop the oldest-dated section wholesale and write. An under-budget file missing one stale section is a good outcome; an over-budget file is a broken one.
|
|
375
|
-
|
|
376
|
-
## Rules
|
|
377
|
-
|
|
378
|
-
- Keep durable preferences, stable project facts, validated approaches, named resources, and the pitfalls worth not repeating.
|
|
379
|
-
- Organize retained information into concise per-topic sections rather than one flat list. Let the topic lead the heading; preferences, projects and pitfalls are what to look for, not a required table of contents.
|
|
380
|
-
- Never write next to the memory file: backups and scratch copies beside it are noise. Do not draft in the shared \`/tmp/\` root either — every other unit can read and overwrite what you leave there.
|
|
381
|
-
- Shell tools only. Interpreters such as \`python3\` and \`node -e\` are not on your allow-list, so reaching for one costs an approval round-trip and may fail even when approved — \`awk\`, \`sed\`, \`wc\` and \`sort\` cover every measurement this pass needs.
|
|
382
|
-
- End every \`##\` and \`###\` section heading with its last-verified date in \`YYYY-MM-DD\` form, for example \`## Deployment pipeline (2026-08-06)\`. Dates are UTC, matching the session archive timestamps, so a late-evening freeze west of UTC stamps the next day.
|
|
383
|
-
- Re-stamp a heading with {{TODAY}} only when you wrote or actually re-verified its content this pass; otherwise keep its existing date. Treat undated headings as maximally stale and date them on this pass.
|
|
384
|
-
- Prioritize re-verifying the oldest-dated sections. Drop ephemera and duplicates; delete or merge sections that are stale, superseded, or unverifiable.
|
|
385
|
-
- Preserve concrete identifiers such as file paths, URLs, IDs, and names verbatim.
|
|
386
|
-
- Write the result to {{MEMORY_PATH}}; do not merely return it in your response.
|
|
387
|
-
- Close with a two-or-three-line report of what you kept, merged and dropped (plus any skill worth suggesting, and the contradiction-pair counts before and after) — that report is delivered to the cone.
|
|
388
|
-
|
|
389
|
-
<!-- How to customize
|
|
390
|
-
Add instructions here, for example: never drop sections mentioning a named project, or also consolidate a knowledge base at /path (extend visiblePaths or writablePaths above to grant access to extra stores). One document drives both passes: the per-session curation pass the freezer runs after a chat ends, and the nightly consolidation ("dreaming") pass the gelatiere starts with \`memory dream --all\` (\`memory dream\` runs one by hand). The runtime fills {{TASK}} with which pass this is; everything else in the document applies to both.
|
|
391
|
-
|
|
392
|
-
timeoutSeconds bounds a curation pass and dreamTimeoutSeconds a consolidation pass — the run is hard-stopped at the bound, and a rewrite only lands through the merge below, which is why the budget section asks for section-wise edits. The nightly has no time pressure, so its bound is generous; the curation pass runs while the user waits for memory to settle.
|
|
393
|
-
|
|
394
|
-
{{MEMORY_PATH}} resolves to a staged draft under /sessions/.curation/, not the live memory file: the pass snapshots the live file when it spawns, rewrites the draft, and on a successful exit the runtime three-way-merges the rewrite back onto the live file. Edits the cone or the user makes to the live memory while the pass runs survive; where both sides changed the same lines the pass's version wins. An entry in writablePaths naming the memory file is substituted with the draft automatically, so this file keeps working unchanged. A run stopped at its wall-clock bound has its draft merged as a truncated success (\`memory_write\` never leaves it half-written); any other failure leaves the live memory untouched. Either outcome is recorded at /sessions/.curation/<key>/status.json. Writes under /shared/wiki/ are NOT staged — a wiki page lands immediately — which is safe because wiki moves are additive; the pointer line replacing the moved section only lands if the pass completes.
|
|
395
|
-
|
|
396
|
-
writablePaths defaults to the memory file plus the wiki rather than /workspace/, because the pass can run upskill and a directory-wide grant would also let it install skills into /workspace/skills. Widen it only as far as a task genuinely needs; a single file is a valid entry, not just a directory.
|
|
397
|
-
|
|
398
|
-
Scratch space needs no entry here. Each pass spawns under a fixed per-cone name (memory-curator / memory-dreamer for the primary cone, -<folder> suffixed for extra cones), so the bridge grants it {{SCRATCH_DIR}} — private to the run, writable without a prompt, and removed when the pass ends. Parallel passes over DIFFERENT memory files never collide; two passes over the SAME file serialize. $TMPDIR is writable too and is this unit's own directory, but it outlives the run and stays readable by the cone, so durable memory does not belong there.
|
|
399
|
-
|
|
400
|
-
thinkingLevel accepts off, minimal, low, medium, high, or xhigh. Curation is cheaper with reasoning than without: an unreasoned pass converges on the budget by trial and error, and because every turn re-reads the whole context, turn count is what the pass costs. Lower it to off only if you also shrink the prompt to a single mechanical instruction.
|
|
401
|
-
|
|
402
|
-
This file is user-edited only: the pass intentionally cannot rewrite its own instructions. A bare / is rejected in writablePaths. It is seeded only when absent, so edits survive later boots; \`upgrade\` three-way-merges a changed bundled version onto your edits.
|
|
403
|
-
|
|
404
|
-
Frontmatter supports a strict YAML subset. Arrays may use the block form above (with optional # comment tails) or inline form such as [cat, grep]. \`allowedCommands\` is additive: listed commands extend the built-in base set without replacing it. Inline entries containing commas must be quoted, for example ["/knowledge/lars,rebecca/"].
|
|
405
|
-
-->
|
|
406
|
-
`,xi=`/etc/MEMORY.md`,Si=4e3,Ci=2e3;function wi(e){return Math.round(Si+Ci*Math.log2((Number.isFinite(e)&&e>=0?e:0)+2))}var Ti=`abject.abortive.abrasive.absolute.abstruse.abundant.abyssal.accessible.acerbic.acrid.adamant.adept.adlerian.adornian.adroit.adventurous.aeolian.aerated.aesthetic.affable.aged.ageless.agile.airborne.airlocked.airy.akkadian.alabaster.alacritous.alert.alien.alloyed.allusive.aloof.alpha.alpine.alternate.altruistic.amaranthine.amber.ambidextrous.ambivalent.ambrosial.amiable.amorphous.ample.analog.analytical.ancestral.ancient.angelic.animated.animist.anomalous.antediluvian.antic.antlered.apollinairian.apollonian.apt.aquatic.arbitrary.arcadian.arcane.archaic.archimedean.ardent.arduous.arendtian.argent.argentine.argive.aristotelian.armstrongian.aromatic.arresting.artful.arthurian.articulate.artificial.artisanal.artless.ascetic.ashen.ashy.asimovian.aspiring.assiduous.assyrian.asteroidal.astral.astute.asynchronous.athenian.atlantean.atomic.attentive.attic.audacious.audenesque.augmented.august.augustan.aureate.auric.auroral.austenian.austere.austral.authentic.autonomous.autumnal.avalonian.avid.avuncular.aztec.azure.babbagean.babylonian.bacchic.bachian.bactrian.ballardian.ballistic.balmy.banksian.barefoot.barreled.barthesian.bartokian.bashy.baudelairean.bayesian.beatific.beckettesque.beckettian.beethovenian.beguiling.bellicose.bemused.benevolent.benign.benjaminian.bergmanesque.beta.bewitched.binary.bionic.bismarckian.bitter.bitwise.blackened.blakean.blameless.bland.blazar.blazing.blended.blessed.blissful.blistered.blithe.blooming.blunt.blustery.boeotian.boggy.bohrian.boingy.boisterous.bold.bolted.bombastic.bonny.boolean.boreal.borgesian.borgian.bosky.botticellian.bottled.bouncy.boundless.bountiful.bourbon.bradburyan.brahmsian.braised.brambly.brash.brave.brazen.bready.breathless.brechtian.breezy.briared.briery.bright.brilliant.brined.briny.brisk.bristling.briton.brittenesque.broadband.brontean.bronzed.brooding.browned.browningesque.brucknerian.brumal.brusque.bubbling.bubbly.bucolic.budding.bunuelian.buoyant.burnished.burnt.buttered.buttery.bygone.byronic.bytewise.byzantine.cacophonous.caesarean.callow.calm.candescent.candid.candied.canny.cantorian.capable.capricious.caramelized.caravaggesque.carbon.carefree.carolingian.cartesian.carved.casked.cast.cavafian.cavalier.celebrated.celestial.celtic.ceramic.cerebral.ceremonious.cerulean.cervantine.cezannesque.chagallian.chalky.chaplinesque.charcoal.charismatic.charmed.charming.charred.chaucerian.cheeky.cheerful.chekhovian.cherished.cherubic.chewy.chilled.chilly.chimerical.chipper.chirpy.chivalrous.chopinesque.chromospheric.chronal.chthonic.chubby.chunky.churchillian.cimmerian.cindered.circumspect.circumstellar.citrusy.civil.clandestine.clangy.clarified.clarkean.classic.clement.clever.cloaked.clockwork.clompy.cloned.cloudlike.cloudy.clunky.clustered.coastal.cobalt.cognitive.coherent.coleridgean.colossal.coltranesque.comely.cometary.compiled.complacent.composite.concurrent.conradian.constablean.convivial.copernican.copious.coplandesque.cordial.corinthian.corked.cornelian.coronal.cortical.cosmic.coy.cozy.cracked.crackling.crafty.cranky.crashy.creamy.credible.crepuscular.cretan.crimson.crisp.crispy.crowned.crumbly.crunchy.crushed.cryo.cryofrozen.cryogenic.cryonic.cryptic.crystalline.cuddly.cumulative.cunning.cupric.cured.curious.cursed.cursory.cushy.cybernetic.cyberpunk.cynical.cyprian.daliesque.dancy.dandy.dantean.dantesque.dapper.dappled.daring.dark.darwinian.dashing.dashy.dauntless.davisian.dawning.dazzling.deathless.debonair.deboned.debussyan.decanted.decompiled.decorous.decrypted.deep.deferential.deft.degasian.delectable.deleuzian.delian.deliberate.delicate.delirious.delphic.delta.demure.depressurized.derridean.destined.devout.dewy.dexterous.diaphanous.diced.dickensian.dickian.dickinsonian.didactic.dieselpunk.diffident.digital.dignified.diligent.dimensional.dinky.dionysian.discerning.discreet.disheveled.disparate.distant.distinct.distributed.diurnal.divine.dizzy.docile.docked.dogged.doomed.dorian.dormant.dostoevskian.dotty.doughty.doughy.downy.dozy.draconic.dreamful.dreamy.drifting.dripping.drizzly.droll.drowsy.druidic.dulcet.dun.dunky.durkheimian.dusky.dwarven.dynamic.dystopian.eager.earnest.earthy.eastward.easygoing.ebony.ebullient.eclectic.eclipsed.ecstatic.edenic.edwardian.effervescent.effulgent.effusive.einsteinian.elamite.elastic.elated.eldritch.electric.electronic.elegant.elegiac.elgarian.eliotian.eliotic.elizabethan.ellingtonian.eloquent.elusive.elven.elvish.elysian.embered.emergent.eminent.emphatic.emulsified.enchanted.encoded.encrypted.endearing.endless.endogenous.energetic.enhanced.enigmatic.enthralling.ephemeral.epic.epicurean.equanimous.errant.erudite.escherian.esoteric.esteemed.eternal.ethereal.ethiopian.etruscan.euclidean.eulerian.euphonious.euphoric.evanescent.evening.eventide.everlasting.evocative.exacting.exalted.exemplary.exo.exogenous.expansive.expressive.exquisite.extraterrestrial.extruded.exuberant.fabled.fabulous.facetious.faithful.fallow.fanciful.fantastic.faradayic.faraway.farmhouse.fastidious.fated.fateful.fathomless.faulknerian.faunal.fearless.feathered.feathery.fecund.federated.feisty.felicitous.felliniesque.fenny.fermented.ferny.ferrous.fervent.fervid.festive.fetching.fey.fickle.fierce.fiery.filleted.filtered.fitzgeraldian.fizzy.flaky.flamboyant.flamed.flashy.flawless.fleecy.fleet.fleeting.flexible.flickering.flinty.floral.florid.flouncy.flourishing.flowering.fluent.fluffy.fluid.fluvial.foamy.folded.fond.foraged.forged.formidable.forthright.fortuitous.forward.foucauldian.fourier.fractal.fragrant.frank.frankish.freckled.free.fresh.freudian.friedmanite.frisky.frizzy.frolicsome.frosted.frosty.frothy.frozen.frugal.fruiting.fruity.funky.furred.furtive.futuristic.fuzzy.gaelic.galactic.galbraithian.galilean.gallant.gallic.galvanic.gamesome.gamma.gandhian.garlanded.garrulous.gauguinesque.gaussian.gauzy.generous.genetic.genial.genomic.genteel.gentle.geomagnetic.georgian.gershwinesque.ghostly.giant.gibsonian.giddy.gifted.giga.giggly.gilded.giottesque.glacial.glad.glazed.gleaming.gleeful.glimmering.glistening.glorious.glossy.glowing.gnomish.godardian.godelian.goethean.goethesque.gogolian.golden.gooey.goofy.gorgeous.gorsy.gossamer.gothic.gowned.goyaesque.graceful.gracious.grainy.grand.grassy.grated.gravitic.gregarious.grilled.groovy.ground.grounded.guileless.gushy.gusty.habermasian.habsburg.hadrianic.halcyon.hale.hallowed.haloed.halved.hamiltonian.han.handelian.handmade.handsome.hanoverian.hapless.happy.hardy.hardyesque.harmonious.hashed.haunted.haydnesque.hayekian.hazy.heady.heaneyesque.hearthside.hearty.heathen.heathered.heavenly.hegelian.heideggerian.heinesque.heinleinian.heirloom.heisenbergian.heliacal.hellenic.hellish.hemingwayesque.herbal.herbertian.herculean.hermetic.heroic.hexed.hibernal.hilbertian.histrionic.hitchcockian.hittite.hoar.hoary.hobbesian.hobbitish.hogarthian.holderlinian.holo.holographic.holy.homerian.homeric.homeward.honest.honeyed.honky.hooded.hooved.hopeful.hopkinsian.hopperesque.hoppy.horatian.horned.hospitable.hot.housemade.huggy.humble.humean.humming.humorous.hunky.hunnish.hurrian.hushed.hydraulic.hyper.hyperborean.hypersonic.hyperspatial.hypnotic.iberian.ibsenite.iced.icy.ideal.idyllic.igneous.illustrious.imaginative.immaculate.immense.immortal.impassioned.impeccable.impetuous.impish.impressive.incan.incandescent.incisive.incorrigible.indefatigable.indelible.indigo.indolent.indomitable.industrious.ineffable.inexorable.infernal.infinite.infra.infrared.infused.ingenious.ingenuous.inimitable.innocuous.inquisitive.insatiable.inspired.intense.intergalactic.interstellar.intragalactic.intrepid.intricate.intrinsic.intuitive.inventive.inveterate.invincible.inward.ionian.ionic.ionospheric.irenic.iridescent.irrepressible.ithacan.itinerant.ivory.jacobean.jammy.jangly.jaunty.jazzy.jeffersonian.jiggly.jingly.jocular.jocund.johnsonian.jolly.jouncy.jovial.jovian.joycean.joyful.joyous.jubilant.judicious.juiced.juicy.jumped.jumpy.jungian.junky.justinianic.jute.kafkaesque.kandinskian.kantian.keatonesque.keatsian.keen.keplerian.keynesian.kierkegaardian.kindly.kindred.kinetic.kiplingesque.klimtian.knowing.kooky.kubrickian.kurosawan.lacanian.laconic.lacquered.lacustrine.lacy.lamarckian.lambda.lambent.laminated.landed.languid.lanky.laplacian.larkinesque.laser.latent.lathed.latin.lattice.laudable.launched.laureled.lavish.layered.leaden.leafy.lean.learned.legendary.leguinian.leibnizian.lemian.lemurian.lenient.leonardesque.liberal.libyan.lidar.light.lighthearted.likable.lilac.lilting.liminal.limpid.lincolnesque.lingering.linnaean.lissome.lisztian.literate.lithe.littoral.lively.loamy.local.lockean.lofty.logical.loopy.loose.loquacious.lorcaesque.lorcan.lossless.lossy.lovecraftian.lovelacean.loyal.lucent.lucid.lucky.ludic.lukewarm.luminal.luminous.lunar.luscious.lush.lushy.lusitanian.lustrous.lydian.lynchian.lyotardian.lyric.lyrical.macerated.machiavellian.macro.magical.magnanimous.magnetar.magnetic.magnetospheric.magnificent.magrittean.mahlerian.majestic.mallarmean.malleable.malthusian.malty.mandelan.manetesque.manifold.marbled.marshy.martial.martian.marvelous.marxian.maser.masked.masterful.matchless.matin.matissean.mature.matutinal.mauve.maverick.mawkish.maxwellian.mayan.meandering.mechanical.median.medicean.mega.mellifluous.mellow.melodic.mendelian.merciful.mercurial.merovingian.merry.meshed.meta.metamorphic.meteoric.meticulous.metternichian.mettlesome.michelangelesque.micro.microwave.midnight.mighty.mild.milled.miltonian.miltonic.minced.mindful.mineral.ming.mingusian.minoan.minty.miraculous.mired.miroesque.mirthful.mischievous.misty.mobile.modest.modular.molecular.molieresque.momentous.mondrianesque.monetian.monkish.mono.montane.moonless.moonlit.mordant.morning.mossy.motley.mottled.mouthwatering.mozartian.mughal.multiversal.munificent.murmuring.mushy.musical.mutable.mutant.mycenaean.mysterious.mystical.mythic.nabokovian.nameless.nano.nanoscale.napoleonic.narrowband.nascent.natty.neat.nebular.nebulous.nefarious.neptunian.nerudian.networked.neural.neutron.neutronic.newtonian.nietzschean.nifty.nimble.noble.nocturnal.nonchalant.nonpareil.noontide.norse.northward.nostalgic.notable.novel.nozickian.nuanced.nubian.nuclear.numinous.nutty.oaky.obdurate.oblique.observant.obstinate.obtuse.oceanic.ochre.odyssean.olden.olympian.omega.omni.onward.opaline.opportune.optical.optimistic.opulent.oracular.orbital.orbiting.orderly.original.ornate.orphic.orwellian.osirian.ostentatious.otherworldly.otiose.ottoman.outgoing.outspoken.outward.overcast.overclocked.ovidian.pacific.pagan.painstaking.palatial.pale.pallid.palpable.paradisal.paradoxical.parallel.paramount.parkerish.parsonian.parthian.passionate.pastoral.patched.pathless.patient.pavlovian.peaceable.peaceful.peachy.pearly.peaty.pebbly.peeled.peered.peerless.pelagic.pellucid.penetrating.pensive.peppered.peppery.peppy.perceptive.perennial.perfect.perfumed.perky.persian.persistent.perspicacious.persuasive.pert.pervasive.pessoan.petaled.petrarchan.phantom.pharaonic.phased.philosophical.phlegmatic.phoenician.photonic.photospheric.phrygian.picassoesque.pickled.pictish.picturesque.pillowy.pindaric.pinteresque.piping.piquant.pirandellian.pithy.pivotal.pixelated.placid.planckian.planetary.planetoid.plangent.plasmic.plathian.platinum.platonic.playful.pleasant.plentiful.pliant.plinky.plonky.plucky.plumed.plummy.plush.plushy.plutonian.plutonic.pneumatic.poached.poesque.poetic.poignant.poised.polished.polite.pollockian.poly.polygonal.polymer.polynesian.popean.popped.popular.portly.posh.positronic.posthuman.potent.pouncy.powdery.powerful.pragmatic.prancy.precise.precocious.precognitive.preeminent.premier.prescient.pressed.pressurized.prestigious.pretty.primeval.primordial.princely.printed.pristine.private.prized.prodigious.profane.proficient.profound.profuse.prokofievian.prolific.promethean.prompt.proper.prophetic.prosaic.prosperous.protean.proto.protostellar.proud.proustian.providential.prudent.psionic.puccinian.puckish.pudgy.puffed.pulled.pulsar.punctilious.punctual.pungent.punic.pure.purposeful.pushkinian.pynchonesque.pythagorean.quaint.quantum.quartered.quasar.questing.quick.quiescent.quiet.quintessential.quirky.quixotic.rabelaisian.racinian.radar.radiant.radio.rainwashed.rainy.rakish.rambunctious.raphaelesque.rapid.rapturous.rare.rational.ravelian.rawlsian.raytraced.ready.reasonable.rebooted.receptive.recondite.recursive.redolent.reduced.reedy.refined.reflective.refulgent.regal.relativistic.relaxed.reliable.remarkable.rembrandtesque.remote.rendered.renoiresque.renowned.replete.replicated.resilient.resinous.resolute.resourceful.respectful.resplendent.responsive.restful.restive.restless.reticent.retro.reverent.rhapsodic.rhodian.rhythmic.ricardian.rich.richelieuvian.riemannian.rigorous.rilkean.rimbaudian.rimed.ringed.ripe.ripening.rippling.risible.riverine.riveted.roaming.roaring.roasted.robed.robotic.robust.rolled.roly.roman.romanov.romantic.rompy.rooseveltian.roseate.rosy.rothkoesque.rousing.rousseauian.rowdy.royal.rubenesque.ruddy.runic.rushy.russet.rustic.sabine.sable.sacred.sagacious.sage.saintly.salient.saline.salingeresque.salted.salty.salubrious.samian.sandaled.sandy.sanguine.sapid.sapient.sapphic.sardonic.sarmatian.sartrean.sassy.satiny.saturnian.saturnine.saucy.savory.savvy.saxon.scalding.scarlet.schielesque.schillerian.schoenbergian.scholarly.schubertian.schumannesque.schumpeterian.scintillating.scorched.scorsesean.scrappy.scruffy.scrupulous.scythian.seaborne.seamless.seared.seasonal.seaward.secure.sedate.sedgy.sedimentary.sedulous.seemly.seismic.selenic.selfless.sensible.sensitive.sentient.sentimental.seraphic.sere.serene.seuratian.shaded.shadowed.shadowy.shaggy.shaken.shakespearean.shamanic.shannonian.sharded.sharp.shaved.shavian.shelleyan.shielded.shimmering.shiny.shoreless.shostakovian.shrewd.shucked.sibelian.sibilant.sibylline.sicilian.sidereal.sienna.sifted.sigma.silicon.silken.silky.silly.silty.silver.silvered.simmering.simulated.sincere.singed.singing.singular.sinuous.sisyphean.sizzling.skeptical.skillful.skinnerian.skittish.skyward.sleek.sleepless.sleepy.slender.sliced.slick.slipstreamed.slow.sly.smart.smashy.smithian.smoked.smoky.smoldering.smooth.snappy.snazzy.snoozy.snowy.snug.snuggly.soaring.sociable.socratic.sodden.soft.sogdian.solar.solarpunk.solemn.solid.somnolent.sonar.song.sonic.sonorous.sooty.soporific.soulful.sound.soundless.sour.southward.sovereign.spaceborne.spacefaring.spacious.sparkling.sparkly.spartan.special.speckled.spectacular.spectral.speedy.spellbound.spiced.spicy.spielbergian.spiffy.spinozan.spirited.splashy.splendid.split.sploshy.spontaneous.spooky.sporty.spotless.spotted.sprightly.sproingy.spry.spun.spunky.squally.squashy.squelchy.squiggly.squishy.staid.stainless.stalwart.starborn.starfaring.starless.starlit.stasisbound.stately.steadfast.steady.steaming.steampunk.steely.steeped.steinbeckian.stellar.stellarborn.sticky.stirred.stirring.stoic.stoical.stolid.stompy.stoppardian.storied.stormy.stout.strained.stratospheric.straussian.stravinskian.streaky.stretched.striking.strindbergian.striped.strong.stuart.stubby.studious.stunning.sturdy.stygian.suave.subatomic.sublime.suborbital.subsonic.substantial.subtle.succinct.succulent.sudsy.sugared.sugary.sumerian.summery.sunless.sunlit.sunny.sunward.superb.supergalactic.superlative.superluminal.supersonic.supple.supreme.sure.surreptitious.svelte.swanky.sweeping.sweet.swift.swiftian.swirled.swooshy.sylvan.sympathetic.synaptic.synchronous.synthetic.syrupy.tableside.tachyonic.taciturn.talented.talleyrandian.tame.tang.tangy.tarantinoesque.tarkovskian.tart.tasteful.tattered.taut.tawny.tectonic.telekinetic.telepathic.temperate.tempered.temporal.tenacious.tender.tennysonian.tenuous.tepid.tera.terran.terrific.terse.textured.thackerayan.thankful.thawed.theban.thessalian.theta.thorny.thorough.thoughtful.thracian.threadbare.thriving.thundery.tidal.tidy.timeless.timely.timeworn.tinkly.tiny.tipsy.tireless.titanesque.titanian.titanic.titanium.titianesque.toasted.toasty.tocharian.tokenized.tolerant.tolkienesque.tolstoyan.tonic.tonky.toothsome.torched.totemic.tough.towering.trackless.tranquil.transcendent.transhuman.treacly.treasured.tremendous.tremulous.trenchant.tricky.trim.triumphant.trojan.trollopian.truculent.true.truffautian.truffled.trusty.truthful.tudor.turbo.turingian.turneresque.twangy.twilight.twilit.twinkling.twinkly.ubiquitous.ultra.ultrasonic.ultraviolet.umami.umber.unassuming.unbounded.uncanny.uncorked.unctuous.undaunted.underworldly.undocked.undying.unearthly.unerring.unflappable.unique.unknown.unruffled.upbeat.upgraded.upright.upstanding.upward.uranian.urbane.utopian.vacuous.valeryan.valiant.valorous.vandal.vangoghian.vast.veblenian.vectorized.vedic.vehement.veiled.velazquezian.velvet.velvety.venerable.venturous.venusian.veracious.verbose.verdant.verdian.verdurous.verlainian.vermeerian.vermilion.vernal.verneian.versatile.vesper.vespertine.vibrant.victorian.vigilant.vigorous.vintage.violet.virgilian.virtual.virtuous.visceral.vital.vivacious.vivid.vocal.voidborn.voidward.volcanic.voltairean.voluble.vonnegutian.voracious.voxel.vroomy.wacky.wagnerian.wakeful.waking.wan.wandering.warholian.warm.warped.wary.washingtonian.wayward.wealthy.weathered.weberian.welcome.welded.wellesian.wellsian.westward.whacky.whimsical.whimsy.whipped.whisked.whispering.whistlerian.whitmanesque.whole.wholesome.whooshy.wide.wiggly.wild.wildean.willowy.wilsonian.wily.windswept.windy.winged.winning.winsome.wintry.wired.wireframe.wireless.wise.wishful.wispy.wistful.wittgensteinian.witty.wobbly.wodehousian.wondrous.wonky.wooded.woody.woolly.woozy.wordless.wordsworthian.wormholed.worthy.wraithlike.wreathed.wriggly.wry.xenial.xeno.yanky.yearning.yeasty.yeatsian.young.youthful.yuletide.yummy.zany.zappy.zealous.zested.zestful.zesty.zeta.zingy.zippy.zodiacal.zonked.zonky.zoomy.zoroastrian`.split(`.`),Ei=`abalone.absinthe.absyrtus.accelerator.achilles.acorn.acquerello.actuator.adobo.adonis.aeetes.aegis.aello.aeneas.aengus.aether.affogato.afterburner.agartha.agate.agni.agnolotti.aioli.airlock.ajax.aji.albatross.alder.ale.alecto.aleppo.alfheim.allegory.alliteration.almond.amaranth.amaretto.amaterasu.ambrosia.americano.amphiaraus.anago.anapest.ancho.anchovy.android.andromeda.anise.annal.annwn.ansible.antaeus.antenna.anthem.antigone.antimony.antistrophe.anubis.aoidos.aperol.aphelion.aphrodite.apogee.apollo.apple.apricot.aquamarine.aquavit.aqueduct.arabica.arachne.arawn.arbor.arborio.arc.arcadia.arch.archipelago.ares.argo.argon.argonaut.aria.ariadne.ark.arke.armagnac.array.arrow.artemis.arthur.artichoke.artifact.arugula.asgard.asgardia.ash.asparagus.aspen.assam.assonance.asteroid.astronaut.atalanta.athena.atlantis.atlas.atoll.atom.atropos.aubergine.augean.aura.aurora.avalon.avalonia.avocado.awning.axion.axle.azurite.bacchus.bagna.baharat.balder.ballad.balladeer.banana.banshee.baozi.bard.barge.barium.barley.barn.basalt.basil.basilisk.basmati.bastet.bastion.bay.bayleaf.beacon.beam.bean.bearing.beech.beetroot.behemoth.bellini.beowulf.bergamot.berth.beryl.beryllium.bifrost.biodome.birch.biscotti.bismuth.bisque.bit.bittern.blackberry.blast.blaster.blini.block.blodeuwedd.bloodstone.blossom.bluebell.blueberry.bolt.bomba.bonito.boom.borage.boson.botargo.bottarga.bouillon.boundary.bow.bower.bragi.bramble.bran.branch.brandy.branwen.breeze.brew.bridge.brigid.brioche.broccoli.brook.brulee.brunhild.brush.bucatini.buckler.buckwheat.buffer.bulkhead.bunting.burrata.burst.bus.busiris.butte.butter.buttercup.butterscotch.byte.cabbage.cabin.cacao.cachaca.cache.cacus.cadence.caesura.calamarata.calamari.calcite.caldera.calliope.calvados.calypso.cam.camellia.camelot.camembert.campari.canal.cannelloni.cannoli.canopy.cantaloupe.cantata.canticle.canvas.canyon.canzone.capacitor.capellini.caper.capon.cappelletti.cappuccino.capsule.caramel.cardamom.cardoon.carillon.carnaroli.carnation.carol.carrier.carrot.cascade.cashew.cassandra.cassis.castle.castor.cavatelli.caviar.cayenne.cedar.celaeno.celeriac.cell.centaur.cerberi.cerberus.cernunnos.ceryneian.cesium.ceto.ceylon.chaff.chaffinch.chai.chain.chalk.chamomile.champagne.chandra.channel.chanson.chanterelle.chard.charon.chartreuse.cheddar.cherry.chert.chervil.chestnut.chickweed.chicory.chili.chime.chimera.chimichurri.chimney.chip.chipotle.chirashi.chiron.chive.chocolate.chorale.chorizo.chorus.chronicle.chrysanthemum.chrysaor.chrysomallus.chutney.ciabatta.cibola.cider.cilantro.cinder.cinnamon.cipher.circe.circlet.circuit.cirque.cistern.citadel.citrine.citron.clementine.cliff.clio.clipper.cloak.clotho.cloud.clove.clover.cluster.coal.cobbler.cockaigne.cockpit.cocoa.coconut.codex.coffee.cog.cognac.coif.coil.col.colchis.collider.colony.combe.comet.compote.concerto.conchiglie.conduit.confit.console.consomme.consonance.continuum.contour.cookies.coordinate.core.coriander.cormorant.corona.coronet.cortado.corvette.cosmos.cottage.couplet.course.couscous.cove.cowl.cowslip.crab.craft.crag.cranberry.crane.crayon.cream.creme.crepe.cress.crocus.croissant.crosne.crown.cruiser.crumble.cryopod.cryosleep.crystal.cuchulainn.cuckoo.cucumber.cuirass.cumin.cupid.curlew.currant.current.curry.custard.cyborg.cycle.cyclops.cyclotron.cylinder.dactyl.daedalus.daemon.daffodil.dagda.dahlia.daiquiri.dais.daisy.dale.dam.dandelion.danu.daphne.darjeeling.dart.dashi.date.dawn.daydream.deck.deirdre.demeter.destroyer.dew.diadem.diary.dill.dimension.diode.diomedean.dionysus.ditalini.ditch.djinn.dock.doenjang.domain.donburi.donjon.door.doppio.dove.downlink.dreadnought.dream.drift.droid.dryad.dukkah.dulce.dumpling.dune.durga.dusk.dust.dyke.eagle.earlgrey.easel.echidna.echo.eclair.eclipse.ecliptic.edamame.eddy.edelweiss.edge.egret.einsteinium.elderflower.eldorado.electra.elegy.elm.elysium.ember.endive.enigma.enjambment.enkidu.envoi.eos.epigram.epistle.epode.erato.erinyes.eros.erymanthian.escargot.espresso.estuary.eumenides.euryale.eurybia.eurydice.eurytion.excalibur.exoplanet.fable.fafnir.falcon.fancy.farfalle.fate.feather.feldspar.fell.fence.fennel.fenrir.fenugreek.fermion.fern.fettuccine.fiddlehead.field.fig.finch.finn.fionn.firebird.firefly.fission.fizz.fjord.flake.flame.flare.flash.flicker.flint.flue.fluorite.flux.flywheel.focaccia.fog.folio.fondant.forge.fortress.foxglove.fragment.fraise.frame.frangipane.frappe.freesia.fregola.freighter.freya.frigate.frigg.frost.fudge.fugue.fumarole.furies.fusilli.fusion.gaia.galahad.galangal.galatea.galaxy.galette.galleon.gallium.ganache.ganesh.gannet.gantry.ganymede.garam.gardenia.garlic.garuda.gateway.gauntlet.gawain.gazebo.gear.gelato.gemelli.genmaicha.genoise.geranium.germ.germanium.geryon.geyser.ghazal.ghee.ghost.gilgamesh.ginger.gingko.ginnungagap.girder.glacier.glade.glaze.gleam.gleeman.glen.glimmer.glint.glitter.gloss.glow.gluon.gnocchi.gochujang.goldfinch.golem.goose.gooseberry.gorgon.gouda.governor.gradient.graeae.granary.granite.grapefruit.grappa.gratin.graviton.greave.grebe.gremolata.grenadine.grendel.grid.griffin.gruyere.guajillo.guava.gudrun.guinevere.gunkan.gwydion.gyoza.gyroscope.habanero.habitat.hades.hadron.haiku.hall.halloumi.halo.halva.hamachi.hangar.hanuman.harissa.harpies.harpy.harvest.hatch.hauberk.hawthorn.haze.hazel.hazelnut.heading.headland.heap.heart.hearth.heather.hecate.hedge.heimdall.hel.helheim.helios.helium.helix.helle.hellebore.helm.hemistich.hephaestus.hera.hermes.heron.hesperides.hestia.hibiscus.hippogriff.hirame.hive.hoisin.hojicha.hollandaise.hollow.holly.hologram.honey.honeycomb.honeysuckle.hood.hoopoe.horizon.horseradish.horus.hrothgar.hub.huckleberry.hue.huginn.hull.husk.hut.hyacinth.hydra.hydras.hylas.hymn.hyperborea.hypercube.hyperdrive.hyperion.hyperspace.hyssop.iamb.ibis.icarus.idas.idunn.idyll.igniter.igraine.ikura.indium.indra.inductor.infusion.injector.ink.inlet.inspiration.ion.iridium.iris.ishtar.isis.isolde.isotope.ivy.iwashi.izanagi.jackdaw.jackfruit.jalapeno.janus.jasmine.jason.jasper.javelin.jay.jet.jiaozi.jongleur.jonquil.jormungandr.jotunheim.journal.julep.jumpgate.juniper.juno.jupiter.kaffir.kale.kali.kampachi.karaage.karasumi.katsu.keel.keep.kefir.kelpie.kenning.kernel.kestrel.khinkali.kiln.kimchi.kingfisher.kinmedai.kirsch.kite.kitsune.kiwi.koan.kohlrabi.kombucha.koshihikari.kraken.krypton.kumquat.kvass.lachesis.lacquer.ladon.ladons.laertes.lager.lagoon.lake.lakshmi.lambic.lament.lance.lancelot.lander.lane.langoustine.lantern.lapis.lark.larkspur.lasagna.latte.laureate.laurel.lava.lavender.leaf.leda.leek.legend.lemon.lemonbalm.lemongrass.lemuria.lens.lentil.lepton.lernaean.lethe.letter.levee.lever.leviathan.lightyear.lily.lime.limerick.limoncello.linden.linguine.link.linnet.lir.lithium.lityerses.lobster.loch.lock.lodge.loki.loop.loquat.lotus.lovage.lugh.lullaby.lungo.luster.lychee.lynceus.lyonesse.lyricist.macadamia.macaron.macchiato.madai.madeleine.madrigal.magma.magnolia.magpie.mail.mainframe.maki.makrut.malachite.manannan.mango.manicotti.manor.manti.manticore.mantle.mantou.manuscript.maple.marble.marduk.margarita.marigold.marjoram.marquee.marrow.martini.marvel.marzipan.masago.masala.mascarpone.mast.matcha.matrix.mead.meadow.mech.medea.medusa.megaera.meleager.memoir.mentaiko.mercury.meringue.merlin.merlot.mesa.mesh.metaphor.meteor.meter.mezcal.mezzaluna.mica.midas.midgard.mill.mimir.mimosa.minerva.minotaur.minstrel.mint.minuet.miracle.mirin.mirror.miso.missive.mist.mjolnir.mocha.module.moira.mojito.molasses.mole.momo.monolith.moonbase.moonbeam.moonstone.moor.mopsus.mordred.morel.morgana.morpheus.morrigan.moss.mote.motet.mousse.mu.mulberry.muninn.muon.muse.muspelheim.mustard.myrtle.mystery.myth.nadir.naga.naiad.nanite.nanobot.narcissus.neapolitan.nebula.nectarine.needle.negroni.nemean.nemesis.neon.neptune.neptunium.nereid.nereus.nessus.nest.nestor.net.nettle.neutrino.nexus.niamh.nib.nibble.nibiru.niflheim.nightingale.nigiri.nike.niobe.njord.nocturne.node.nog.nori.norn.note.nougat.nova.nozzle.nuada.nutmeg.nyx.oak.oasis.oat.obelisk.oberon.obsidian.oceanid.oceanus.octave.octavo.ocypete.ode.odin.odysseus.oisin.okonomiyaki.olive.olympus.oni.onigiri.oolong.oracle.orange.orb.orbit.orbiter.orchard.orchid.oreads.orecchiette.oregano.orion.orpheus.orthros.orthrus.orzo.oscillator.osiris.osmium.osprey.ouroboros.outline.outpost.ouzo.oven.overture.owl.oyster.paccheri.packet.padron.page.palace.palette.palladium.palm.pan.pandan.pandora.panettone.pansotti.pansy.pantoum.papaya.pappardelle.paprika.papyrus.parable.paradox.parcae.parchment.parfait.parmesan.parsec.parsley.parsnip.particle.partridge.parvati.pasilla.passionfruit.pastel.pastis.patina.pavilion.pavlova.peach.peak.pear.pebble.pecan.pegasi.pegasus.pekoe.peleus.pelican.pelmeni.pen.pencil.penelope.penne.peony.pepper.peppermint.percival.peregrine.pergola.peridot.perigee.perihelion.perry.persephone.perseus.persillade.persimmon.pesto.petal.petrel.phase.pheasant.phoenix.pholus.phorcys.photon.phrixus.pickle.pierogi.pigment.pimento.pine.pineapple.ping.pinot.pipe.pipit.piquillo.pisco.pistachio.piston.pith.plane.plasma.plate.plover.plum.plume.pluto.plutonium.poblano.pod.podarge.poet.polenta.pollux.polyphemus.pomegranate.pomelo.pond.pontus.ponzu.pooka.pool.poplar.poppy.porcini.port.portal.porter.porthole.poseidon.positron.prairie.praline.prelude.primrose.prism.probe.profile.prometheus.prosciutto.prosecco.proteus.protocol.psalm.psyche.pudding.puffin.pulse.pumice.pumpkin.purslane.pwyll.pylon.pyrrhic.quadrant.quail.quark.quarto.quartz.quatrain.qubit.quetzalcoatl.queue.quill.quince.quinoa.quiver.radish.radium.radon.ragnarok.rain.rama.ramen.ramp.rampart.ramson.raspberry.ratatoskr.raven.ravioli.ray.reactor.realm.reaper.reed.reef.refrain.region.register.relay.relic.remnant.requiem.reservoir.residue.resistor.resonator.reverie.rhapsode.rhapsody.rhea.rhiannon.rhodium.rhododendron.rhubarb.rhyme.ricotta.riddle.ridge.riesling.rigatoni.rim.ring.risotto.ristretto.river.roast.robin.robusta.roc.rocket.rod.romesco.rondeau.rooibos.rook.root.rose.rosemary.rosewater.roundel.rover.rowan.rubidium.rum.rune.saba.saffron.saga.saison.sake.salmoriglio.salsa.salsify.sambal.sambuca.samphire.sancerre.sandpiper.sangria.sanma.sansho.saraswati.sashimi.sasquatch.satellite.satyr.sauternes.savanna.sawara.sazerac.scaffold.scalar.scallop.scansion.scepter.schnapps.schooner.scop.scorzonera.scotchbonnet.scroll.sector.seed.sekhmet.selene.selenite.selenium.selkie.sencha.sensor.sequoia.serenade.serrano.servo.sesame.sestina.sextet.shack.shade.shadow.shaft.shale.shallot.shambhala.shard.shed.sheen.sherbet.sherry.shield.shimmer.ship.shishito.shiso.shiva.shoyu.shrub.shumai.shuttle.sibyl.sif.signal.sigurd.silhouette.silo.simile.simurgh.singularity.siren.sita.skadi.skald.skiff.skuld.skylark.slant.slate.sleipnir.sling.slipstream.sliver.sloop.sluice.smithy.smoke.snowdrop.socket.sofrito.sonata.sonnet.soot.sorbet.sorrel.souffle.soul.soy.spaceport.spaghetti.spark.sparkle.sparrow.spear.speck.specter.speculoos.spelt.sphere.sphinx.sphinxes.spindle.spinel.spiral.spire.spirit.splinter.spoke.spondee.spore.spring.spritz.spruce.sriracha.ssamjang.stack.stanza.starbase.starlight.starling.starport.starship.stasis.station.steam.stellarator.steppe.stheno.stork.stracciatella.strawberry.stream.strontium.strophe.strozzapreti.strut.stylus.stymphalian.styx.subspace.sumac.summit.sunbeam.sunstone.supernova.surge.surya.susanoo.sushi.svartalfheim.swallow.swan.swarm.sycamore.syleus.synchrotron.tabard.tachyon.tagliatelle.tahini.takoyaki.taliesin.tamari.tamarind.tangerine.tanka.tanker.tapenade.tapioca.tarako.taranis.tare.tarn.tarragon.tartarus.telamon.telemetry.teleporter.tellurium.temaki.tempura.tengu.tensor.tent.tequila.tercet.teriyaki.terminal.tern.terraform.tesseract.tethys.thalassa.thalia.thallium.thaumas.themis.theseus.thistle.thor.thorium.thoth.threshold.throne.throttle.thrush.thruster.thule.thunderbird.thyme.tiamat.tiara.tide.tint.tintagel.tiphys.tiramisu.tirnanog.tisane.tisiphone.titan.tobiko.toccata.toddy.toffee.tofu.tokamak.tomatillo.tomato.tome.tone.tonka.tonkatsu.tor.tortellini.torus.tourmaline.tower.trace.track.transducer.transistor.treacle.trellis.triolet.tristan.triton.trochee.trofie.trope.troubadour.trouvere.truffle.trunk.truss.tug.tulip.tundra.tungsten.turbine.turmeric.turquoise.turret.twinkle.typhon.tyr.udon.ulysses.unagi.uni.unicorn.uplink.uramaki.urania.uranium.urd.urfa.uther.vale.valhalla.valkyrie.valve.vanadium.vanaheim.vanilla.vapor.vareniki.varnish.varuna.vector.veil.vellum.vent.venus.verbena.verdandi.verge.verjus.vermouth.verse.vessel.vesta.vestige.vialone.viewport.villanelle.vishnu.vodka.volcano.volta.volume.vortex.vulcan.wall.walnut.waltz.warbler.warpgate.wasabi.wash.watercress.watermelon.wave.waypoint.web.weir.well.wendigo.wheat.whisky.whisper.wiglaf.willow.wimple.window.wisteria.wonder.wonton.woodcock.woodpecker.word.wormhole.wraith.wren.wyrm.wyvern.xenon.yacht.yakitori.yama.yarrow.yeti.yew.yggdrasil.yokai.yuzu.zaatar.zabaglione.zenith.zephyr.zeus.zinnia.zircon.zirconium.ziti.zone.zucchini`.split(`.`);Ti.length*Ei.length;var Di=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function Oi(e){return typeof e==`string`&&Di.includes(e)}o(`agent-bridge`);var ki=`agent: name already in use`,Ai=o(`cone-memory-budget`),ji=1.25,Mi=k.memoryPath,Ni=`/sessions/index.json`,Pi=4096,Fi=/^## Auto-extracted/m,Ii=`Consolidate the auto-extracted memory bullets below into a single tighter set of durable memories.
|
|
407
|
-
|
|
408
|
-
Rules:
|
|
409
|
-
- Output ONLY a single \`## Auto-extracted (consolidated)\` heading followed by markdown bullets.
|
|
410
|
-
- One fact per bullet. Drop duplicates and superseded facts. Keep the most recent / specific phrasing.
|
|
411
|
-
- Preserve concrete identifiers (file paths, URLs, IDs, names) verbatim.
|
|
412
|
-
- Be terse. Aim well under the original size.
|
|
413
|
-
- Do NOT add preamble, commentary, or any heading other than the single consolidated one.`;function Li(e){let t=Fi.exec(e);if(!t)return{header:e,autoExtracted:``};let n=t.index;return{header:e.slice(0,n),autoExtracted:e.slice(n)}}async function Ri(e){try{let t=await e.readFile(Ni,{encoding:`utf-8`}),n=typeof t==`string`?t:new TextDecoder().decode(t),r=JSON.parse(n);return Array.isArray(r)?r.length:0}catch{return 0}}async function zi(e){let{header:t,autoExtracted:n}=Li(e.currentContent);if(!n.trim())return e.currentContent;let r=`You are a memory consolidation assistant. You are given a markdown file's "auto-extracted" section — a list of memory bullets accumulated across sessions of an AI coding assistant. Your job is to rewrite that section as a tighter, deduplicated set of durable memories that fits well within ${e.budget} characters.
|
|
414
|
-
|
|
415
|
-
<auto-extracted>
|
|
416
|
-
${n}
|
|
417
|
-
</auto-extracted>`,i={role:`user`,content:[{type:`text`,text:Ii}],timestamp:Date.now()},o=await a(e.model,{systemPrompt:r,messages:[i]},{apiKey:e.apiKey,maxTokens:Pi,headers:e.headers,signal:e.signal});if(o.stopReason===`error`)throw Error(`Restructure call failed: ${o.errorMessage||`Unknown error`}`);let s=o.content.filter(e=>e.type===`text`).map(e=>e.text).join(`
|
|
418
|
-
`).trim();if(!s)throw Error(`Restructure call returned empty content`);return`${t}${t.length===0||t.endsWith(`
|
|
419
|
-
`)?``:`
|
|
420
|
-
`}${s}\n`}async function Bi(e){if(!e.model||!e.apiKey)return{restructured:!1,reason:`no-llm`};let t=e.memoryPath??Mi,n=``;try{let r=await e.vfs.readFile(t,{encoding:`utf-8`});n=typeof r==`string`?r:new TextDecoder().decode(r)}catch{return{restructured:!1,reason:`missing-file`}}let r=await Ri(e.vfs),i=wi(r),a=i*ji;if(n.length<=a)return{restructured:!1,reason:`under-threshold`};Ai.info(`Cone memory over threshold — restructuring`,{size:n.length,budget:i,threshold:a,sessionCount:r});try{let r=await zi({currentContent:n,budget:i,model:e.model,apiKey:e.apiKey,headers:e.headers,signal:e.signal});return await e.vfs.writeFile(t,r),Ai.info(`Cone memory restructured`,{before:n.length,after:r.length}),{restructured:!0}}catch(e){return Ai.warn(`Cone memory restructure failed — leaving appended content in place`,{error:e instanceof Error?e.message:String(e)}),{restructured:!1,reason:`error`}}}var Vi=o(`agentic-memory`),Hi=1200,Ui=3600,Wi=7200,Gi=e=>[e.memoryPath],Ki=e=>[`/sessions/`,`/shared/`,...vn(e)],qi=`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(`.`),Ji={arrayKeys:new Set([`writablePaths`,`visiblePaths`,`allowedCommands`]),scalarKeys:new Set([`model`,`timeoutSeconds`,`dreamTimeoutSeconds`,`thinkingLevel`])},Yi=`medium`,Xi=3e4;function Zi(e){return e===`cone`?`memory-curator`:`memory-curator-${e}`}var Qi={kind:`curate`,nameFor:Zi,rivalsFor:e=>[na(e)]},$i=`{{TASK}}`,ea=`(no session archive this pass)`;function ta(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.`}function na(e){return e===`cone`?`memory-dreamer`:`memory-dreamer-${e}`}function ra(e,t){let n=e.nameFor(t);return aa.test(n)?n:e.nameFor(gn)}function ia(e,t){let n=aa.test(e.nameFor(t))?t:gn;return e.rivalsFor?.(n)??[]}var aa=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/;function oa(e,t){return`/scoops/agent-${ra(e,t)}`}function sa(e){return oa(Qi,e)}var ca=sa(gn);function la(e){return Sn({parentJid:null,folder:e?.folder??`cone`})}function ua(e,t){if(t.root===k.root)return e;if(e===k.memoryPath)return t.memoryPath;if(e===`/workspace/skills`||e.startsWith(`/workspace/skills/`))return e;let n=`${k.root}/`;return e===k.root?t.root:e.startsWith(n)?`${t.root}/${e.slice(n.length)}`:e}function da(e,t){let n=`${yn}/`,r=e=>e.some(e=>n.startsWith(e.endsWith(`/`)?e:`${e}/`)),i=e.map(e=>ua(e,t));return r(e)&&!r(i)&&i.push(n),i}async function fa(e){try{if(e.signal?.aborted)return{ok:!1,reason:`aborted`,legacyFallbackSafe:!1};let t=e.instructions??Qi,n=la(e.cone),r=oa(t,e.cone?.folder??`cone`),i=await pa(e.vfs,n),a=t.kind===`dream`?i.dreamTimeoutSeconds:i.timeoutSeconds,o=va(e.sessionArchivePath);try{await ba(e.vfs,n.memoryPath,e.sessionArchivePath)}catch(e){return{ok:!1,reason:`snapshot: ${W(e)}`,legacyFallbackSafe:!0}}let s=t.kind===`dream`?ea:e.sessionArchivePath,c=Math.max(1,Math.round(a/60)),l=ta(t,s,c),u=Sa(i,a,Ca(wa(i.promptTemplate.includes($i)?i.promptTemplate:`${i.promptTemplate.trimEnd()}\n\n${$i}`,{MEMORY_PATH:o,SESSION_ARCHIVE_PATH:s,SESSION_COUNT:String(e.sessionCount),BUDGET_CHARS:String(wi(e.sessionCount)),SCRATCH_DIR:r,TODAY:e.today??new Date().toISOString().slice(0,10),TIMEOUT_MINUTES:String(c),TASK:l}),r),e.sessionArchivePath,n,e.cone,t);e.signal&&(u.signal=e.signal);let d=await Ta(Promise.resolve().then(()=>e.spawn(u)),a*1e3+Xi,e.signal);if(d.type===`timeout`)return Vi.warn(`Agentic memory wait timed out past the in-run bound + grace`,{timeoutSeconds:a,graceMs:Xi}),{ok:!1,reason:`timeout`,legacyFallbackSafe:!1};if(d.type===`aborted`)return{ok:!1,reason:`aborted`,legacyFallbackSafe:!1};if(d.type===`error`)return{ok:!1,reason:W(d.error),legacyFallbackSafe:!0};if(d.result.exitCode!==0){let e=(d.result.finalText??``).startsWith(ki);return{ok:!1,reason:d.result.finalText||`exit-${d.result.exitCode}`,legacyFallbackSafe:!e}}return{ok:!0,report:d.result.finalText}}catch(e){return Vi.warn(`Agentic memory pass failed`,{error:W(e)}),{ok:!1,reason:W(e),legacyFallbackSafe:!1}}}async function pa(e,t=k){try{let n=await e.readFile(xi,{encoding:`utf-8`});return ma(typeof n==`string`?n:new TextDecoder().decode(n),t)}catch(e){return Vi.warn(`Could not load valid ${xi}; using built-in default`,{error:W(e)}),ma(bi,t)}}function ma(e,t=k){let n=l(e,`MEMORY.md`),r=xe(n.frontmatter,Ji),i=x(r,`writablePaths`,Gi(t));if(i.length===0)throw Error(`writablePaths must not be empty`);_e(i,`writablePaths`);let a=x(r,`visiblePaths`,Ki(t));_e(a,`visiblePaths`);let o=ye(r.timeoutSeconds,600,Hi),s=ye(r.dreamTimeoutSeconds,Ui,Wi,`dreamTimeoutSeconds`),c=g(r.model,`model`);return{writablePaths:i.map(e=>ua(e,t)),visiblePaths:da(a,t),allowedCommands:[...new Set([...qi,...x(r,`allowedCommands`,[])])],...c?{model:c}:{},thinkingLevel:ha(r.thinkingLevel),timeoutSeconds:o,dreamTimeoutSeconds:s,promptTemplate:n.body}}function ha(e){if(e===void 0)return Yi;if(typeof e!=`string`||!Oi(e))throw Error(`thinkingLevel must be one of ${Di.join(`, `)}`);return e}function ga(e){return`/sessions/.curated/${e.slice(e.lastIndexOf(`/`)+1)}`}function U(e){return`/sessions/.curation/${e.slice(e.lastIndexOf(`/`)+1)}`}function _a(e){return`${U(e)}/base.md`}function va(e){return`${U(e)}/draft.md`}function ya(e){return`${U(e)}/status.json`}async function ba(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(U(n),{recursive:!0}),await e.writeFile(_a(n),r),await e.writeFile(va(n),r)}function xa(e,t,n){let r=e.map(e=>e===t?n:e);return r.includes(n)?r:[...r,n]}function Sa(e,t,n,r,i,a,o){let s=e.model===`parent`||e.model===`cone`,c=_a(r),l=va(r);return{cwd:i.root,writablePaths:xa(e.writablePaths,i.memoryPath,l),visiblePaths:[...e.visiblePaths,`${U(r)}/`],allowedCommands:e.allowedCommands,prompt:n,thinkingLevel:e.thinkingLevel,persistSession:!0,name:ra(o,a?.folder??`cone`),exclusiveWith:ia(o,a?.folder??`cone`),...a?.jid?{parentJid:a.jid}:{},notifyOnComplete:!0,successReceiptPath:ga(r),mergeOnSuccess:{targetPath:i.memoryPath,basePath:c,draftPath:l},outcomeReceiptPath:ya(r),maxWallClockMs:t*1e3,...!s&&e.model?{modelId:e.model}:{}}}function Ca(e,t){if(t===ca)return e;let n=`\0SCRATCH\0`;return e.replaceAll(t,n).replaceAll(ca,t).replaceAll(n,t)}function wa(e,t){let n=e;for(let[e,r]of Object.entries(t))n=n.replaceAll(`{{${e}}}`,r);return n}function Ta(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 W(e){return e instanceof Error?e.message:String(e)}var Ea=e({PENDING_SESSION_ATTEMPT_LIMIT:()=>3,SESSIONS_INDEX_PATH:()=>E,curateFrozenSessionMemories:()=>Ma,enrichPendingSession:()=>io,freezeConeSession:()=>ja,listPendingEnrichments:()=>to,markSnapshotUnavailable:()=>So,processPendingSessions:()=>no,readSessionsIndex:()=>D}),G=o(`session-freezer`),Da=4,Oa=2048,ka=40,Aa=`${w}/attachments`;async function ja(e){let t=await Ya(e.sessionStore,qa(e));if(!t||t.messages.length<Da)return G.info(`Skipping freeze: session below threshold or missing`,{messageCount:t?.messages.length??0}),null;let n=Za(t.messages),r=e.mode??`full`,i=r===`full`&&!!(e.apiKey&&e.model);!e.agenticMemorySpawn&&e.memory!==`skip`&&await Fa(e,n,i);let a=await Ia(e,n,i)||He(t.messages);return await La(e,t,a,r,i?await Na(e,a):void 0,!!e.agenticMemorySpawn&&e.memory!==`skip`)}async function Ma(e,t){let n=Za(t.archive.messages),r;try{r=await fa({spawn:e.agenticMemorySpawn,vfs:e.vfs,sessionArchivePath:tt(t),sessionCount:await Ri(e.vfs),...e.cone?{cone:e.cone}:{}})}catch(e){r={ok:!1,reason:e instanceof Error?e.message:String(e),legacyFallbackSafe:!1}}if(r.ok){let n=await _o(e.vfs,t.filename);return await so(e.vfs,t.filename),n?(delete t.memoryPending,G.info(`Agentic memory pass completed`,{filename:t.filename}),n):(G.info(`Agentic memory pass completed; index entry already gone`,{filename:t.filename}),null)}return await yo(e.vfs,t.filename,r.reason),r.legacyFallbackSafe?(G.warn(`Agentic memory pass failed after finishing — falling back to legacy extraction`,{filename:t.filename,reason:r.reason}),await Fa(e,n,!0),null):(G.warn(`Agentic memory pass unfinished — entry stays pending for boot catch-up`,{filename:t.filename,reason:r.reason,attemptLimit:3}),null)}async function Na(e,t){try{return Pa(await(e.pickIcon??(await i(async()=>{let{pickLucideIcon:e}=await import(`./quick-llm-BFOKPe7I.js`).then(e=>e.n);return{pickLucideIcon:e}},__vite__mapDeps([42,1,9,10,11,2,12,13,14,3,7,8,15,16,5,17,18,19,20,21,22,23,24,25,26,27,28,29,43,32]))).pickLucideIcon)({subject:`"${t}" — an archived chat session`})??void 0)}catch(e){G.warn(`Icon pick failed (freeze still proceeds)`,{error:e instanceof Error?e.message:String(e)});return}}function Pa(e){if(e)return Jt(e)?e:void 0}async function Fa(e,t,i){if(!i){G.info(`LLM unavailable — skipping memory extraction; freezing anyway`);return}let a=``;try{a=await n({messages:t,instruction:r,model:e.model,apiKey:e.apiKey,maxTokens:Oa,headers:e.headers})}catch(e){G.warn(`Memory extraction call failed (freeze still proceeds)`,{error:e instanceof Error?e.message:String(e)});return}if(!a.trim()||a.trim()===`NONE`){G.info(`Memory extraction returned no durable memories`);return}try{await eo(e.vfs,Ja(qa(e)),a.trim(),`new-session`,{model:e.model,apiKey:e.apiKey,headers:e.headers}),G.info(`Memory extracted and appended on new-session`)}catch(e){G.warn(`Memory append failed`,{error:e instanceof Error?e.message:String(e)})}}async function Ia(e,r,i){if(!i)return``;try{return Qa(await n({messages:r,instruction:t,model:e.model,apiKey:e.apiKey,maxTokens:ka,headers:e.headers}))}catch(e){return G.warn(`Title generation call failed (using heuristic)`,{error:e instanceof Error?e.message:String(e)}),``}}async function La(e,t,n,r,a,o=!1){let s=new Date().toISOString(),c=qa(e),l=await Xa(e.vfs,c),u=l?.sessionId??crypto.randomUUID(),d=l?.filename??(r===`quick`?`pending-${Xe()}.md`:`${s.replace(/[:.]/g,`-`)}-${qe(n)}.md`),f=Ra(t.messages),p={cone:c,...c!==`cone`&&e.cone?.label?{coneLabel:e.cone.label}:{}},m={filename:d,sessionId:u,title:n,frozenAt:s,messageCount:t.messages.length,...f??{},...p,...a?{icon:a}:{},...r===`quick`||l?{pendingEnrichment:!0}:{},...o?{memoryPending:!0}:{},...e.memory===`skip`?{memorySkipped:!0}:{}};try{await $a(e.vfs,w);let r=await Va(e.vfs,t.messages,d.replace(/\.md$/,``)),a={id:t.id,title:n,frozenAt:s,createdAt:t.createdAt,updatedAt:t.updatedAt,messageCount:t.messages.length,messages:r,...f??{},...p,...e.memory===`skip`?{memorySkipped:!0}:{}};if(gt(`memory-v2`)){let{writeArchiveBundle:t}=await i(async()=>{let{writeArchiveBundle:e}=await import(`./session-jsonl-BCu9CtLe.js`).then(e=>e.i);return{writeArchiveBundle:e}},__vite__mapDeps([44,1,0,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,45,46]));await t(e.vfs,d,a)}else await e.vfs.writeFile(`${w}/${d}`,Qe(a));return await Ge(e.vfs,m),await e.vfs.flush(),G.info(`Cone session frozen`,{filename:d,title:n,cone:c,messageCount:t.messages.length,completedLiveSnapshot:!!l}),{...m,archive:a}}catch(e){return G.warn(`Failed to write frozen session to VFS`,{error:e instanceof Error?e.message:String(e)}),null}}function Ra(e){let t={total:0,input:0,output:0,cacheRead:0,cacheWrite:0},n=new Map,r=!1;for(let i of e){if(i.role!==`assistant`)continue;let{model:e,usage:a}=i;if(!e||!a||!Ba(a))return null;let o=a.cost;r=!0,t.total+=o.total,t.input+=o.input,t.output+=o.output,t.cacheRead+=o.cacheRead,t.cacheWrite+=o.cacheWrite;let s=n.get(e)??{model:e,cost:0,turns:0,tokens:0};s.cost+=o.total,s.turns+=1,s.tokens+=a.input+a.output+a.cacheRead+a.cacheWrite,n.set(e,s)}return r?{cost:t,models:[...n.values()].sort((e,t)=>t.cost-e.cost)}:null}function za(e){return typeof e==`number`&&Number.isFinite(e)}function Ba(e){let{cost:t}=e;return[e.input,e.output,e.cacheRead,e.cacheWrite].every(za)&&[t.input,t.output,t.cacheRead,t.cacheWrite,t.total].every(za)}async function Va(e,t,n){let r={vfs:e,archiveDir:`${Aa}/${n}`,copiedPaths:new Map,fileIndex:0},i=[];for(let e of t){if(!e.attachments?.some(Wa)){i.push(e);continue}let t=[];for(let n of e.attachments)t.push(await Ha(r,n));i.push({...e,attachments:t})}return i}async function Ha(e,t){if(!Wa(t))return t;let n=e.copiedPaths.get(t.path);if(n)return{...t,path:n};let r=await Ua(e.vfs,t.path);if(!r)return Ka(t);let i=t.name.replace(/[^A-Za-z0-9._-]+/g,`_`)||`attachment`,a=`${e.archiveDir}/${e.fileIndex++}-${i}`;return await $a(e.vfs,e.archiveDir),await e.vfs.writeFile(a,r),e.copiedPaths.set(t.path,a),{...t,path:a}}async function Ua(e,t){try{if(!await Ga(e,t))return null;let n=await e.readFile(t,{encoding:`binary`});if(!(n instanceof Uint8Array))throw Error(`Expected binary attachment content at ${t}`);return n}catch{return null}}function Wa(e){return typeof e.path==`string`&&e.path.startsWith(`/tmp/`)&&e.data===void 0&&e.text===void 0}async function Ga(e,t){let n=t.split(`/`).slice(1);if(n.length<2||n[0]!==`tmp`||n.some(e=>!e||e===`.`||e===`..`))return!1;let r=`/`;for(let t=0;t<n.length;t+=1){let i=(await e.readDir(r)).find(e=>e.name===n[t]);if(!i)return!1;if(t===n.length-1)return i.type===`file`;if(i.type!==`directory`)return!1;r=r===`/`?`/${n[t]}`:`${r}/${n[t]}`}return!1}function Ka(e){let{path:t,...n}=e;return{...n,error:e.error??`Archived attachment file is missing or unsafe to preserve.`}}function qa(e){return e.cone?.folder||`cone`}function Ja(e){return Sn({parentJid:null,folder:e}).memoryPath}async function Ya(e,t){let n=fn({folder:t});try{return await e.load(n)}catch(e){return G.warn(`Failed to load cone chat session`,{sessionId:n,error:e instanceof Error?e.message:String(e)}),null}}async function Xa(e,t){try{return Ye(await et(e),t)}catch(e){G.warn(`Sessions index unreadable while looking for a live snapshot`,{error:e instanceof Error?e.message:String(e)});return}}function Za(e){return e.map(e=>({role:e.role,content:[{type:`text`,text:e.content}],timestamp:e.timestamp}))}function Qa(e){let t=e.trim();return t=t.replace(/^["'`]+|["'`]+$/g,``).trim(),t=t.replace(/\s+/g,` `),t.length>80&&(t=t.slice(0,80).trimEnd()),t}async function $a(e,t){try{await e.mkdir(t,{recursive:!0})}catch{}}async function eo(e,t,n,r,i){let a=t,o=``;try{let t=await e.readFile(a,{encoding:`utf-8`});o=typeof t==`string`?t:new TextDecoder().decode(t)}catch(t){if(!(t instanceof At)||t.code!==`ENOENT`)throw t;await $a(e,a.slice(0,a.lastIndexOf(`/`)))}let s=`## Auto-extracted (${new Date().toISOString().slice(0,10)}, ${r})`,c=`${o.length===0||o.endsWith(`
|
|
421
|
-
`)?``:`
|
|
422
|
-
`}\n${s}\n\n${n}\n`;await e.writeFile(a,o+c);try{await Bi({vfs:e,memoryPath:a,model:i?.model,apiKey:i?.apiKey,headers:i?.headers,signal:i?.signal})}catch(e){G.warn(`Cone memory budget step threw (append already committed)`,{error:e instanceof Error?e.message:String(e)})}}async function to(e){return(await D(e)).filter(e=>(e.pendingEnrichment===!0||e.memoryPending===!0)&&ro(e)<3)}async function no(e){let t={attempted:0,completed:0};if(!e.model||!e.apiKey)return t;try{for(let t of await D(e.vfs))t.memoryPending===!0&&t.memoryFailed===void 0&&ro(t)>=3&&await yo(e.vfs,t.filename,`catch-up retries exhausted (3)`);let n=await to(e.vfs);for(let r of n)try{let n=await vo(e.vfs,r.filename);if(!n)continue;t.attempted+=1,await io(e.vfs,n,{model:e.model,apiKey:e.apiKey,headers:e.headers})&&(t.completed+=1)}catch(e){G.warn(`Pending session catch-up attempt failed`,{filename:r.filename,error:e instanceof Error?e.message:String(e)})}}catch(e){G.warn(`Pending session catch-up failed`,{error:e instanceof Error?e.message:String(e)})}return t}function ro(e){let t=e.pendingAttemptCount;return typeof t==`number`&&Number.isInteger(t)&&t>0?t:0}async function io(e,t,n){if(!t.pendingEnrichment&&!t.memoryPending)return null;let r=await lo(e,t);if(r===null)return null;let i=await uo(e,t,r);if(i===null)return null;let a=t.memoryPending===!0&&n.skipMemory!==!0&&await oo(e,t),o=a||t.memorySkipped===!0?{...n,skipMemory:!0}:n,s=await fo(t,i,o);if(s===null)return null;let c=await co(o,s.newTitle);await po(e,t,s.bullets,o);let l=await ho(e,t,r,s.newTitle,c,n.skipMemory===!0);return l&&a&&(await so(e,t.filename),await bo(e,l.filename),await ao(e,t.filename)),l}async function ao(e,t){for(let n of[_a(`/sessions/${t}`),va(`/sessions/${t}`)])try{await e.rm(n)}catch{}}async function oo(e,t){try{return await e.stat(ga(`/sessions/${t.filename}`)),!0}catch{return!1}}async function so(e,t){try{await e.rm(ga(`/sessions/${t}`))}catch{}}async function co(e,t){if(e.pickIcon)try{return await Pa(await e.pickIcon({subject:`"${t}" — an archived chat session`})??void 0)}catch(e){G.warn(`Enrichment icon pick failed (continuing without icon)`,{error:e instanceof Error?e.message:String(e)});return}}async function lo(e,t){try{let n=await e.readFile(tt(t),{encoding:`utf-8`});return typeof n==`string`?n:new TextDecoder().decode(n)}catch(e){return e?.code===`ENOENT`?G.info(`Pending archive missing — treating as already enriched`,{filename:t.filename}):G.warn(`Failed to read pending archive (entry stays pending)`,{filename:t.filename,error:e instanceof Error?e.message:String(e)}),null}}async function uo(e,t,n){let r;try{r=(await Je(e,n,t.filename)).messages}catch(e){return G.warn(`Failed to parse pending archive — leaving entry intact`,{filename:t.filename,error:e instanceof Error?e.message:String(e)}),null}return r.length===0?(G.info(`Pending archive has no messages — skipping enrichment`,{filename:t.filename}),null):Za(r)}async function fo(e,i,a){let o=``;if(!a.skipMemory)try{o=await n({messages:i,instruction:r,model:a.model,apiKey:a.apiKey,maxTokens:Oa,headers:a.headers})}catch(t){return G.warn(`Enrichment memory call failed (entry stays pending)`,{filename:e.filename,error:t instanceof Error?t.message:String(t)}),null}let s=``;try{s=Qa(await n({messages:i,instruction:t,model:a.model,apiKey:a.apiKey,maxTokens:ka,headers:a.headers}))}catch(t){return G.warn(`Enrichment title call failed (entry stays pending)`,{filename:e.filename,error:t instanceof Error?t.message:String(t)}),null}return s?{bullets:o,newTitle:s}:(G.info(`Enrichment title call returned empty — entry stays pending`,{filename:e.filename}),null)}async function po(e,t,n,r){let i=n.trim();if(!(!i||i===`NONE`))try{await eo(e,Ja(t.cone||`cone`),i,`pending-enrichment`,{model:r.model,apiKey:r.apiKey,headers:r.headers})}catch(e){G.warn(`Enrichment memory append failed (continuing with title rewrite)`,{filename:t.filename,error:e instanceof Error?e.message:String(e)})}}function mo(e,t,n,r,i){let a=r??e.icon;return{filename:t,title:n,frozenAt:e.frozenAt,messageCount:e.messageCount,...e.cost?{cost:e.cost}:{},...e.models?{models:e.models}:{},...e.cone?{cone:e.cone}:{},...e.coneLabel?{coneLabel:e.coneLabel}:{},...e.sessionId?{sessionId:e.sessionId}:{},...a?{icon:a}:{},...e.completeSnapshotUnavailable?{completeSnapshotUnavailable:!0}:{},...i&&e.memoryPending?{memoryPending:!0}:{},...e.memorySkipped?{memorySkipped:!0}:{}}}async function ho(e,t,n,r,i,a=!1){let o=tt(t),s=Ke(t.filename),c=s?r:t.title,l=s?`${t.frozenAt.replace(/[:.]/g,`-`)}-${qe(r)}.md`:t.filename,u=`${w}/${l}`;if(s)try{await $a(e,w);let r=go(n,c),i=Be(t.filename),a=Be(l),s=Ue(r,o,u);if(s=Ue(s,i,a),i!==a){let e=i.slice(i.lastIndexOf(`/`)+1),t=a.slice(a.lastIndexOf(`/`)+1);s=s.split(`sidecar: ${e}`).join(`sidecar: ${t}`)}await e.writeFile(u,s),await $e(e,t.filename,l)}catch(e){return G.warn(`Enrichment write failed (entry stays pending)`,{filename:t.filename,error:e instanceof Error?e.message:String(e)}),null}let d=mo(t,l,c,i,a);try{await xo(e,t.filename,d)}catch(e){return G.warn(`Enrichment index update failed (entry may stay pending)`,{filename:t.filename,error:e instanceof Error?e.message:String(e)}),null}if(u!==o){try{await e.rm(o)}catch(e){G.info(`Stale pending archive cleanup failed (harmless)`,{oldPath:o,error:e instanceof Error?e.message:String(e)})}try{await Ze(e,t.filename)}catch(e){G.info(`Stale pending sidecar cleanup failed (harmless)`,{filename:t.filename,error:e instanceof Error?e.message:String(e)})}}try{await e.flush()}catch{}return G.info(`Pending session enriched`,{oldFilename:t.filename,newFilename:l,title:c}),d}function go(e,t){let n=e.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);if(!n)return e;let r=n[1].replace(/^title:\s*.+$/m,`title: ${JSON.stringify(t)}`),i=n[2];return i=i.replace(/^#\s+[^\n]*$/m,`# ${t}`),`---\n${r}\n---\n${i}`}async function _o(e,t){let n=null,r=T(async()=>{let r=await D(e),i=r.findIndex(e=>e.filename===t);if(i===-1)return;let{memoryPending:a,pendingEnrichment:o,pendingAttemptCount:s,memoryFailed:c,...l}=r[i],u={...l,memoryCuratedAt:new Date().toISOString()},d=r.slice();d[i]=u,await e.writeFile(E,JSON.stringify(d,null,2)),await e.flush(),n=u});try{await r}catch(e){G.warn(`Failed to clear agentic memory pending marker`,{filename:t,error:e instanceof Error?e.message:String(e)})}return n}async function vo(e,t){let n=null;return await T(async()=>{let r=await D(e),i=r.findIndex(e=>e.filename===t);if(i===-1)return;let a=r[i];if(!a.pendingEnrichment&&!a.memoryPending)return;let o=ro(a);if(o>=3)return;n={...a,pendingAttemptCount:o+1};let s=r.slice();s[i]=n,await e.writeFile(E,JSON.stringify(s,null,2)),await e.flush()}),n}async function yo(e,t,n){let r=T(async()=>{let r=await D(e),i=r.findIndex(e=>e.filename===t);if(i===-1)return;let a=r.slice();a[i]={...r[i],memoryFailed:n.slice(0,300)},await e.writeFile(E,JSON.stringify(a,null,2)),await e.flush()});try{await r}catch(e){G.warn(`Failed to record curator failure in sessions index`,{filename:t,error:e instanceof Error?e.message:String(e)})}}async function bo(e,t){let n=T(async()=>{let n=await D(e),r=n.findIndex(e=>e.filename===t);if(r===-1)return;let{memoryFailed:i,...a}=n[r],o=n.slice();o[r]={...a,memoryCuratedAt:new Date().toISOString()},await e.writeFile(E,JSON.stringify(o,null,2)),await e.flush()});try{await n}catch(e){G.warn(`Failed to record curator completion in sessions index`,{filename:t,error:e instanceof Error?e.message:String(e)})}}async function xo(e,t,n){return T(async()=>{let r=[];try{let t=await e.readFile(E,{encoding:`utf-8`}),n=typeof t==`string`?t:new TextDecoder().decode(t),i=JSON.parse(n);Array.isArray(i)&&(r=i)}catch(e){if(!(e instanceof At)||e.code!==`ENOENT`)throw e}let i=r.findIndex(e=>e.filename===t),a;i===-1?a=[n,...r.filter(e=>e.filename!==n.filename)]:(a=r.slice(),a[i]=n,a=a.filter((e,t)=>t===i||e.filename!==n.filename)),await e.writeFile(E,JSON.stringify(a,null,2))})}async function So(e,t){return T(async()=>{let n=[];try{let t=await e.readFile(E,{encoding:`utf-8`}),r=typeof t==`string`?t:new TextDecoder().decode(t),i=JSON.parse(r);Array.isArray(i)&&(n=i)}catch(e){if(!(e instanceof At)||e.code!==`ENOENT`)throw e;return}if(!n.find(e=>e.filename===t))return;let r=n.map(e=>e.filename===t?{...e,completeSnapshotUnavailable:!0}:e);await e.writeFile(E,JSON.stringify(r,null,2))})}var Co=`slicc:followers-changed`;function wo(e){let t=e.replace(/^follower-/,``);return t.length>12?`${t.slice(0,8)}…`:t}function To(e){return e.floatType===`ios`?`iOS`:e.floatType===`electron`?`Electron`:e.floatType===`extension`?`Extension`:e.floatType===`standalone`?`Standalone`:e.runtime?.includes(`cli`)?`CLI`:`Follower`}function Eo(e){return e.floatType===`ios`?`smartphone`:e.floatType===`electron`||e.floatType===`standalone`?`monitor`:e.floatType===`extension`?`blocks`:e.runtime?.includes(`cli`)?`terminal`:`radio`}function Do(e,t=Date.now()){if(!e)return null;let n=new Date(e).getTime();if(!Number.isFinite(n))return null;let r=Math.max(0,Math.floor((t-n)/1e3));return r<60?`${r}s`:r<3600?`${Math.floor(r/60)}m`:r<86400?`${Math.floor(r/3600)}h`:`${Math.floor(r/86400)}d`}function Oo(e){return e.health===`stalled`?`warn`:e.peerState===`connecting`?`idle`:e.peerState===`connected`&&e.health===`live`?`active`:`idle`}function ko(e,t=Date.now()){let n=e.health===`stalled`?`stalled`:e.peerState===`connecting`?`connecting`:`connected`,r=Do(e.connectedAt,t);return r?`${n} ${r}`:n}function Ao(e){let t=[];return e.exec&&t.push(`can run commands`),e.computer&&t.push(`native screen`),e.cdp&&t.push(`hosts tabs`),t}function jo(e){return`${To(e)} · ${wo(e.runtimeId)}`}function Mo(e){return e.motd??e.runtime??void 0}function No(e,t=Date.now()){return e.map(e=>({id:e.runtimeId,icon:Eo(e),title:jo(e),detail:Mo(e),state:Oo(e),stateText:ko(e,t),chips:Ao(e)}))}function Po(e){return e.length>=8&&e[0]===137&&e[1]===80&&e[2]===78?`image/png`:e.length>=3&&e[0]===255&&e[1]===216&&e[2]===255?`image/jpeg`:null}function Fo(e){if(e instanceof Uint8Array){let t=new Uint8Array(e.byteLength);return t.set(e),t}if(e instanceof ArrayBuffer)return new Uint8Array(e.slice(0));if(ArrayBuffer.isView(e)){let t=e;return new Uint8Array(t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength))}return Array.isArray(e)?Uint8Array.from(e):e&&typeof e==`object`?Lo(e):new Uint8Array}function Io(e){if(typeof e.byteLength==`number`)return e.byteLength;if(typeof e.length==`number`)return e.length;let t=-1;for(let n of Object.keys(e)){if(!/^\d+$/.test(n))continue;let e=Number(n);e>t&&(t=e)}return t+1}function Lo(e){let t=Io(e),n=new Uint8Array(t);for(let r=0;r<t;r++){let t=e[r];typeof t==`number`&&(n[r]=t&255)}return n}var Ro=2,zo=768,Bo=class{computers=[];frames=new Map;listListeners=new Set;frameListeners=new Set;invocationListeners=new Set;sender=null;watchSubs=new Map;kernelWatch=new Map;nextWatchToken=1;invocations=new Map;list(){return this.computers.slice()}get(e){return this.computers.find(t=>t.id===e)??null}lastFrame(e){return this.frames.get(e)??null}onList(e){return this.listListeners.add(e),()=>this.listListeners.delete(e)}onFrame(e){return this.frameListeners.add(e),()=>this.frameListeners.delete(e)}onInvocations(e){return this.invocationListeners.add(e),()=>this.invocationListeners.delete(e)}setSender(e){this.sender=e}isWatching(e){return(this.watchSubs.get(e)?.length??0)>0}watchRefCount(e){return this.watchSubs.get(e)?.length??0}watch(e,t=Ro,n=zo){if(!this.sender)throw Error(`computers store has no kernel sender`);let r=this.nextWatchToken++,i=this.watchSubs.get(e)??[];return i.push({token:r,fps:t,maxWidth:n}),this.watchSubs.set(e,i),this.syncKernelWatch(e),r}unwatch(e,t){if(!this.sender)throw Error(`computers store has no kernel sender`);let n=this.watchSubs.get(e);if(!n?.length)return;let r=t===void 0?n.length-1:n.findIndex(e=>e.token===t);if(!(r<0)){if(n.splice(r,1),n.length===0){this.watchSubs.delete(e),this.kernelWatch.delete(e),this.sender({type:`computer-unwatch`,id:e});return}this.syncKernelWatch(e)}}syncKernelWatch(e){let t=this.watchSubs.get(e);if(!t?.length||!this.sender)return;let n=Math.max(...t.map(e=>e.fps)),r=Math.max(...t.map(e=>e.maxWidth)),i=this.kernelWatch.get(e);i&&i.fps===n&&i.maxWidth===r||(this.kernelWatch.set(e,{fps:n,maxWidth:r}),this.sender({type:`computer-watch`,id:e,fps:n,maxWidth:r}))}input(e,t){if(!this.sender)throw Error(`computers store has no kernel sender`);this.sender({type:`computer-input`,id:e,events:t})}recordInvocation(e,t){this.invocations.set(e,t);for(let e of[...this.invocationListeners])e()}newestInvocation(e){return this.invocations.get(e)??null}applyList(e){this.computers=e.computers.slice();let t=new Set(this.computers.map(e=>e.id));for(let e of[...this.invocations.keys()])t.has(e)||this.invocations.delete(e);for(let e of[...this.frames.keys()])t.has(e)||this.frames.delete(e);for(let e of[...this.listListeners])e(this.computers)}applyFrame(e){let t=this.frames.get(e.id);if(t&&t.seq>e.seq)return;let n={seq:e.seq,mime:e.mime,width:e.width,height:e.height,bytes:Fo(e.bytes),...e.overCap?{overCap:!0}:{}};this.frames.set(e.id,n);for(let t of[...this.frameListeners])t(e.id,n)}},Vo=null;function Ho(){return Vo||=new Bo,Vo}var Uo=`__slicc_binary__`,Wo=`b64`;function Go(e){if(!e||typeof e!=`object`)return!1;let t=e;return t[Uo]===Wo&&typeof t.data==`string`}function Ko(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&!(e instanceof Uint8Array)}function qo(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&!(e instanceof Uint8Array)&&!Go(e)}function Jo(e){if(e instanceof Uint8Array)return{[Uo]:Wo,data:Se(e)};if(Array.isArray(e))return e.map(Jo);if(Ko(e)){let t={};for(let[n,r]of Object.entries(e))t[n]=Jo(r);return t}return e}function Yo(e){if(Go(e))return Ce(e.data);if(Array.isArray(e))return e.map(Yo);if(qo(e)){let t={};for(let[n,r]of Object.entries(e))t[n]=Yo(r);return t}return e}var Xo=o(`panel-transport`);function Zo(e){return typeof e==`object`&&!!e&&`source`in e&&`payload`in e}function Qo(){return{onMessage:e=>{let t=(t,n,r)=>(Zo(t)&&e(Yo(t)),!1);return chrome.runtime.onMessage.addListener(t),()=>chrome.runtime.onMessage.removeListener(t)},send:(e,t)=>{let n=Jo(e);chrome.runtime.sendMessage({source:`panel`,payload:n}).catch(e=>{Xo.error(`failed to send to offscreen`,{error:e instanceof Error?e.message:String(e)})})}}}var $o={summarizing:`summarizing`,fallback:`fallback`,cancelled:`discarded`,idle:`summarized`},es=class{mintId;open=new Map;settled=new Map;constructor(e){this.mintId=e}apply(e,t,n,r){if(t===`extracting-memory`)return null;let i=this.open.get(e)??this.lateRetraction(e,t,n)??r;if(t!==`summarizing`&&!i)return null;t!==`summarizing`&&(this.open.delete(e),this.settled.delete(e));let a=i??this.mintId(e);if(t===`summarizing`&&this.open.set(e,a),(t===`idle`||t===`fallback`)&&n.roundId&&this.settled.set(e,{messageId:a,roundId:n.roundId}),t===`cancelled`)return{kind:`retract`,messageId:a};let o={trigger:n.trigger,state:$o[t],...n.transcriptPath?{transcriptPath:n.transcriptPath}:{}};return t===`summarizing`?{kind:`open`,messageId:a,marker:o}:{kind:`settle`,messageId:a,marker:o}}forget(e){this.open.delete(e),this.settled.delete(e)}lateRetraction(e,t,n){if(t!==`cancelled`||!n.roundId)return;let r=this.settled.get(e);return r?.roundId===n.roundId?r.messageId:void 0}},ts=2e3,K=o(`offscreen-client`),ns=class{eventListeners=new Set;backgroundEventListeners=new Set;backgroundMessageId=new Map;callbacks;scoops=[];scoopStatuses=new Map;currentMessageId=new Map;compactionRows=new es(e=>`compaction-${e}-${q()}`);toolDepth=new Map;ready=!1;stateRetryTimer=null;localFs=null;pendingClearAcks=new Map;pendingWebhookDeliveries=new Map;pendingAgentSpawnRequests=new Map;pendingThinkingAcks=new Map;pendingModelAcks=new Map;pendingTranscriptRequests=new Map;pendingChatMessagesRequests=new Map;pendingStatsRequests=new Map;pendingSudoRequests=new Map;transport;_selectedScoopJid=null;get selectedScoopJid(){return this._selectedScoopJid}scoopSelectedListeners=new Set;onScoopSelected(e){return this.scoopSelectedListeners.add(e),()=>{this.scoopSelectedListeners.delete(e)}}setSelectedScoopJid(e){if(this._selectedScoopJid!==e&&(this.handOverOpenMessages(this._selectedScoopJid,e),this._selectedScoopJid=e,e!==null))for(let t of this.scoopSelectedListeners)try{t(e)}catch(e){K.error(`onScoopSelected handler threw`,{error:e instanceof Error?e.message:String(e)})}}locked=!1;constructor(e,t){this.callbacks=e,this.transport=t??Qo(),this.setupMessageListener(),Ho().setSender(e=>this.send(e))}setLocalFS(e){this.localFs=e}getTransport(){return this.transport}emitAgentError(e){this.emitToUI({type:`error`,error:e})}createAgentHandle(){return{sendMessage:(e,t,n,r)=>{if(!this.selectedScoopJid){this.emitToUI({type:`error`,error:`No scoop selected`});return}this.send({type:`user-message`,scoopJid:this.selectedScoopJid,text:e,attachments:n,messageId:t??`msg-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,...r?.steer?{steer:!0}:{},...r?.guestGate?{guestGate:r.guestGate}:{}})},onEvent:e=>(this.eventListeners.add(e),()=>this.eventListeners.delete(e)),stop:()=>{this.selectedScoopJid&&this.send({type:`abort`,scoopJid:this.selectedScoopJid})}}}getScoops(){return this.scoops}getScoop(e){return this.scoops.find(t=>t.jid===e)}isProcessing(e){return this.scoopStatuses.get(e)===`processing`}async registerScoop(e,t={}){if(!O(e))throw Error(`OffscreenClient.registerScoop is cone-only; use scoop_scoop for non-cone scoops`);this.scoops.find(t=>t.name===e.name)||(this.scoops.push(e),this.scoopStatuses.set(e.jid,`initializing`)),this.send({type:`cone-create`,name:e.name,...t.description?{description:t.description}:{},...t.prompt?{prompt:t.prompt}:{},...e.model?{model:e.model}:{}})}async unregisterScoop(e){let t=this.scoops.find(t=>t.jid===e);if(t&&O(t)&&cn(this.scoops).length<=1)throw Error(`Cannot remove the last cone`);this.send({type:`scoop-drop`,scoopJid:e}),this.scoops=this.scoops.filter(t=>t.jid!==e),this.scoopStatuses.delete(e)}createScoopTab(e){}async getGlobalMemory(){if(!this.localFs)return``;try{let e=await this.localFs.readFile(`/shared/CLAUDE.md`,{encoding:`utf-8`});return typeof e==`string`?e:new TextDecoder().decode(e)}catch{return``}}getScoopContext(e){if(this.localFs)return{getFS:()=>this.localFs}}getSharedFS(){return this.localFs}stopScoop(e){this.send({type:`abort`,scoopJid:e})}async clearQueuedMessages(e){}async deleteQueuedMessage(e,t){this.send({type:`delete-queued-message`,scoopJid:e,messageId:t})}updateModel(){this.send({type:`refresh-model`})}setScoopModel(e,t){let n=`model-${q()}`,r=new Promise(e=>{this.pendingModelAcks.set(n,e)});return this.send({type:`set-scoop-model`,requestId:n,scoopJid:e,model:t}),Promise.race([r,new Promise(e=>setTimeout(()=>e(!1),5e3))]).finally(()=>this.pendingModelAcks.delete(n))}setLocked(e){this.locked=e}setScoopThinkingLevel(e,t,n){let r=`thinking-${q()}`,i=new Promise(e=>{this.pendingThinkingAcks.set(r,e)});return this.send({type:`set-thinking-level`,requestId:r,scoopJid:e,level:t,effortOverride:n}),Promise.race([i,new Promise(e=>setTimeout(()=>e(!1),5e3))]).finally(()=>this.pendingThinkingAcks.delete(r))}async clearAllMessages(e,t={}){let n=`clear-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,r=new Promise(e=>{this.pendingClearAcks.set(n,e)});this.send({type:`clear-chat`,requestId:n,...e?{scoopJid:e}:{},...t.discardLiveSnapshot?{discardLiveSnapshot:!0}:{}}),await Promise.race([r,new Promise(e=>setTimeout(e,5e3))]),this.pendingClearAcks.delete(n)}spawnAgent(e){let t=`agent-${q()}`,n=new Promise((e,n)=>{this.pendingAgentSpawnRequests.set(t,{resolve:e,reject:n})}),{signal:r,...i}=e;return this.send({type:`agent-spawn-request`,requestId:t,options:i}),r&&(r.aborted?this.send({type:`agent-spawn-abort`,requestId:t}):r.addEventListener(`abort`,()=>this.send({type:`agent-spawn-abort`,requestId:t}),{once:!0})),n}clearFilesystem(){this.send({type:`clear-filesystem`})}requestScoopMessages(e){this.send({type:`request-scoop-messages`,scoopJid:e})}async getScoopTranscript(e){let t=`tr-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,n=new Promise(e=>{this.pendingTranscriptRequests.set(t,e)});this.send({type:`request-scoop-transcript`,requestId:t,scoopJid:e});let r=await Promise.race([n,new Promise(e=>setTimeout(()=>e(``),5e3))]);return this.pendingTranscriptRequests.delete(t),r}async getMessagesForScoop(e){let t=`cm-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,n=new Promise(e=>{this.pendingChatMessagesRequests.set(t,e)});this.send({type:`request-scoop-chat-messages`,requestId:t,scoopJid:e});let r=!1,i=await Promise.race([n,new Promise(e=>setTimeout(()=>{r=!0,e([])},5e3))]);return this.pendingChatMessagesRequests.delete(t),r&&K.warn(`getMessagesForScoop timed out`,{scoopJid:e}),i}async requestSudoApproval(e,t=6e5){let n=`sudo-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,r=new Promise(e=>{this.pendingSudoRequests.set(n,e)});this.send({type:`request-sudo-approval`,requestId:n,request:e});let i=await Promise.race([r,new Promise(e=>setTimeout(()=>e({decision:`deny`}),t))]);return this.pendingSudoRequests.delete(n),i}async getSessionStats(){let e=`st-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,t=new Promise(t=>{this.pendingStatsRequests.set(e,t)});this.send({type:`request-session-stats`,requestId:e});let n=await Promise.race([t,new Promise(e=>setTimeout(()=>e(null),5e3))]);return this.pendingStatsRequests.delete(e),n}requestState(){this.send({type:`request-state`});let e=0;this.stateRetryTimer=setInterval(()=>{if(e++,this.ready||e>20){this.stateRetryTimer&&=(clearInterval(this.stateRetryTimer),null);return}K.debug(`Retrying request-state`,{attempt:e}),this.send({type:`request-state`})},500)}isReady(){return this.ready}sprinkleOpHandler=null;forwardLickHandler=null;sendSprinkleLick(e,t,n,r){this.send({type:`sprinkle-lick`,sprinkleName:e,body:t,targetScoop:n,origin:r})}sendToolUiAction(e,t,n){this.send({type:`tool-ui-action`,requestId:e,action:t,data:n})}async sendWebhookEvent(e,t,n){let r=`wh-${q()}`,i=new Promise(e=>{this.pendingWebhookDeliveries.set(r,e)});this.send({type:`lick-webhook-event`,webhookId:e,headers:t,body:n,requestId:r});try{return await Promise.race([i,new Promise(e=>setTimeout(()=>e(null),ts))])}finally{this.pendingWebhookDeliveries.delete(r)}}sendSetFollowerForwarding(e){this.send({type:`set-follower-forwarding`,enabled:e})}sendForwardedLick(e){this.send({type:`inject-forwarded-lick`,event:e})}setForwardLickHandler(e){this.forwardLickHandler=e}sendCherryHostEvent(e,t,n){this.send({type:`lick-cherry-host-event`,cherryRuntimeId:e,name:t,detail:n})}sendPreviewLick(e){this.send({type:`lick-preview`,event:e})}setSprinkleOpHandler(e){this.sprinkleOpHandler=e}sendRaw(e){this.send(e)}setupMessageListener(){this.transport.onMessage(e=>{if(e.source!==`offscreen`)return;let t=e.payload;t?.type===`sprinkle-op`&&this.sprinkleOpHandler?this.sprinkleOpHandler(t):this.handleOffscreenMessage(e.payload)})}handleOffscreenMessage(e){if(!this.applySurfacePush(e))switch(e.type){case`offscreen-ready`:this.ready?(K.warn(`Offscreen restarted — re-requesting state`),this.ready=!1):K.info(`Offscreen engine ready`),this.send({type:`request-state`});break;case`agent-event`:this.handleAgentEvent(e);break;case`scoop-status`:this.handleScoopStatus(e);break;case`compaction-state`:this.handleCompactionState(e);break;case`clear-chat-ack`:{let t=this.pendingClearAcks.get(e.requestId);t&&(this.pendingClearAcks.delete(e.requestId),t());break}case`lick-webhook-delivery`:{let t=this.pendingWebhookDeliveries.get(e.requestId);t&&(this.pendingWebhookDeliveries.delete(e.requestId),t(e.disposition));break}case`agent-spawn-result`:this.handleAgentSpawnResult(e);break;case`set-scoop-model-ack`:this.handleScoopModelAck(e);break;case`set-thinking-level-ack`:this.handleThinkingLevelAck(e);break;case`scoop-created`:this.handleScoopCreated(e);break;case`scoop-list`:this.handleScoopList(e);break;case`state-snapshot`:this.handleStateSnapshot(e);break;case`error`:this.handleError(e);break;case`lick-backpressure`:this.callbacks.onLickBackpressure?.(e.scoopJid,{count:e.count,waitingMs:e.waitingMs});break;case`incoming-message`:this.handleIncomingMessage(e);break;case`message-updated`:this.handleMessageUpdated(e);break;case`scoop-messages-replaced`:{let t=e;this.resyncStreamPointer(t.scoopJid,t.messages),this.callbacks.onScoopMessagesReplaced?.(t.scoopJid,t.messages,t.queuedIds);break}case`scoop-transcript`:{let t=e,n=this.pendingTranscriptRequests.get(t.requestId);n&&(this.pendingTranscriptRequests.delete(t.requestId),n(t.transcript));break}case`scoop-chat-messages`:{let t=e,n=this.pendingChatMessagesRequests.get(t.requestId);n&&(this.pendingChatMessagesRequests.delete(t.requestId),n(t.messages));break}case`sudo-approval`:{let t=e,n=this.pendingSudoRequests.get(t.requestId);n&&(this.pendingSudoRequests.delete(t.requestId),n(t.decision));break}case`session-stats`:{let t=e,n=this.pendingStatsRequests.get(t.requestId);n&&(this.pendingStatsRequests.delete(t.requestId),n({totalCost:t.totalCost,burnRate:t.burnRate,fills:t.fills,models:t.models??[],scoops:t.scoops??[],...t.budget?{budget:t.budget}:{}}));break}case`tray-runtime-status`:{let t=e;rs(t.leader,t.follower);break}case`forward-lick`:this.forwardLickHandler?.(e.event)}}applySurfacePush(e){if(e.type===`computers`)return Ho().applyList(e),!0;if(e.type===`computer-frame`)return Ho().applyFrame(e),!0;switch(e.type){case`terminal-status`:case`terminal-output`:case`terminal-media-preview`:case`terminal-exit`:case`terminal-cleared`:for(let t of this.terminalEventListeners)try{t(e)}catch(e){K.error(`terminal event listener error`,{error:e instanceof Error?e.message:String(e)})}return!0;default:return!1}}handleAgentSpawnResult(e){let t=this.pendingAgentSpawnRequests.get(e.requestId);t&&(this.pendingAgentSpawnRequests.delete(e.requestId),e.ok?t.resolve(e.result):t.reject(Error(e.error)))}terminalEventListeners=new Set;onTerminalEvent(e){return this.terminalEventListeners.add(e),()=>this.terminalEventListeners.delete(e)}resyncStreamPointer(e,t){let n;for(let e=t.length-1;e>=0;e--){let r=t[e];if(r.role===`assistant`&&r.isStreaming){n=r.id;break}}n===void 0?this.currentMessageId.delete(e):this.currentMessageId.set(e,n)}trackToolPhase(e,t){let n=this.toolDepth.get(e)??0,r=t===null?0:Math.max(0,n+t);r===0?this.toolDepth.delete(e):this.toolDepth.set(e,r),n>0!=r>0&&this.callbacks.onScoopPhaseChange?.(e,r>0?`tool`:`thinking`)}handleToolUiAgentEvent(e){if(e.displayScoopJid){let t=`tool-ui-${e.requestId??``}`;e.eventType===`tool_ui`?this.emitToUI({type:`tool_ui`,messageId:t,toolName:e.toolName??``,requestId:e.requestId??``,html:e.html??``}):e.eventType===`tool_ui_done`&&this.emitToUI({type:`tool_ui_done`,messageId:t,requestId:e.requestId??``});return}if(e.eventType===`tool_ui`){let t=this.currentMessageId.get(e.scoopJid);t||(t=`scoop-${e.scoopJid}-${q()}`,this.currentMessageId.set(e.scoopJid,t),this.emitToUI({type:`message_start`,messageId:t})),this.emitToUI({type:`tool_ui`,messageId:t,toolName:e.toolName??``,requestId:e.requestId??``,html:e.html??``});return}let t=this.currentMessageId.get(e.scoopJid);t&&(e.eventType===`tool_ui_done`?this.emitToUI({type:`tool_ui_done`,messageId:t,requestId:e.requestId??``}):e.progress&&this.emitToUI({type:`tool_progress`,messageId:t,toolName:e.toolName??``,progress:e.progress,toolCallId:e.toolCallId}))}handleAgentEvent(e){switch(e.eventType){case`text_delta`:case`tool_start`:case`tool_ui`:case`turn_end`:this.callbacks.onScoopActivity?.(e.scoopJid)}switch(e.eventType){case`tool_start`:this.trackToolPhase(e.scoopJid,1);break;case`tool_end`:this.trackToolPhase(e.scoopJid,-1);break;case`turn_end`:this.trackToolPhase(e.scoopJid,null)}if((e.displayScoopJid??e.scoopJid)!==this.selectedScoopJid){this.translateTranscriptEvent(e,this.backgroundMessageId,t=>this.emitBackground(e.scoopJid,t));return}switch(e.eventType){case`tool_ui`:case`tool_ui_done`:case`tool_progress`:this.handleToolUiAgentEvent(e);break;default:this.translateTranscriptEvent(e,this.currentMessageId,e=>this.emitToUI(e))}}translateTranscriptEvent(e,t,n){let r=()=>{let r=t.get(e.scoopJid);return r||(r=`scoop-${e.scoopJid}-${q()}`,t.set(e.scoopJid,r),n({type:`message_start`,messageId:r})),r};switch(e.eventType){case`text_delta`:n({type:`content_delta`,messageId:r(),text:e.text??``});break;case`tool_start`:n({type:`tool_use_start`,messageId:r(),toolName:e.toolName??``,toolInput:e.toolInput,toolCallId:e.toolCallId});break;case`tool_end`:{let r=t.get(e.scoopJid);r&&n({type:`tool_result`,messageId:r,toolName:e.toolName??``,result:e.toolResult??``,isError:e.isError,toolCallId:e.toolCallId});break}case`response_done`:{let r=t.get(e.scoopJid);r&&(n({type:`content_done`,messageId:r,model:e.model,usage:e.usage}),t.delete(e.scoopJid));break}case`turn_end`:{let r=t.get(e.scoopJid)??`done-${e.scoopJid}-${q()}`;t.delete(e.scoopJid),n({type:`turn_end`,messageId:r});break}}}handOverOpenMessages(e,t){let n=(e,t)=>{t&&this.emitBackground(e,{type:`content_done`,messageId:t})};e&&n(e,this.currentMessageId.get(e)),t&&(n(t,this.backgroundMessageId.get(t)),this.backgroundMessageId.delete(t))}onBackgroundUnitEvent(e){return this.backgroundEventListeners.add(e),()=>this.backgroundEventListeners.delete(e)}emitBackground(e,t){for(let n of this.backgroundEventListeners)try{n(e,t)}catch(e){K.error(`Background listener error`,{error:e instanceof Error?e.message:String(e)})}}renderCompactionNotice(e,t,n,r){let i=this.compactionRows.apply(e,t,n,r);i&&e===this.selectedScoopJid&&this.emitToUI({type:`compaction_notice`,messageId:i.messageId,marker:i.kind===`retract`?{trigger:n.trigger,state:`discarded`}:i.marker})}handleCompactionState(e){let t={trigger:e.trigger??`threshold`,...e.transcriptPath?{transcriptPath:e.transcriptPath}:{},...e.failure?{failure:e.failure}:{},...e.roundId?{roundId:e.roundId}:{}};this.callbacks.onCompactionStateChange?.(e.scoopJid,e.state,t),this.renderCompactionNotice(e.scoopJid,e.state,t,e.rowId)}handleScoopStatus(e){let t=this.scoopStatuses.get(e.scoopJid);this.scoopStatuses.set(e.scoopJid,e.status),t!==e.status&&this.trackToolPhase(e.scoopJid,null),this.callbacks.onStatusChange(e.scoopJid,e.status)}handleScoopCreated(e){let t=this.msgScoopToRegistered(e.scoop);this.scoops=this.scoops.filter(e=>e.name!==t.name||e.jid===t.jid),this.scoops.find(e=>e.jid===t.jid)||this.scoops.push(t),this.scoopStatuses.set(t.jid,e.scoop.status),this.callbacks.onScoopCreated(t)}wireScoops(){return this.scoops.map(e=>{let t=ln(e),n=un(e),r={...e.config,...t?{modelId:t.id,modelProviderId:t.provider}:{},...n.level?{thinkingLevel:n.level}:{},...n.effortOverride?{effortOverride:n.effortOverride}:{}};return{jid:e.jid,name:e.name,folder:e.folder,parentId:e.parentJid,assistantLabel:e.assistantLabel,status:this.scoopStatuses.get(e.jid)??`ready`,...Object.keys(r).length>0?{config:r}:{}}})}handleScoopModelAck(e){if(e.applied){let t=this.getScoop(e.scoopJid);t&&(t.model=e.model?{...e.model}:void 0,this.callbacks.onScoopListUpdate(this.wireScoops()))}this.pendingModelAcks.get(e.requestId)?.(e.applied)}handleThinkingLevelAck(e){if(e.applied){let t=this.getScoop(e.scoopJid);t&&sn(t,e.level===void 0?void 0:{level:e.level,effortOverride:e.effortOverride})}this.pendingThinkingAcks.get(e.requestId)?.(e.applied)}handleScoopList(e){this.scoops=e.scoops.map(e=>this.msgScoopToRegistered(e));for(let t of e.scoops)this.scoopStatuses.set(t.jid,t.status);this.callbacks.onScoopListUpdate(e.scoops)}handleStateSnapshot(e){K.info(`Received state snapshot`,{scoopCount:e.scoops.length}),this.scoops=e.scoops.map(e=>this.msgScoopToRegistered(e));for(let t of e.scoops)this.scoopStatuses.set(t.jid,t.status);e.trayRuntimeStatus&&rs(e.trayRuntimeStatus.leader,e.trayRuntimeStatus.follower);let t=!this.ready;t&&(this.ready=!0,this.stateRetryTimer&&=(clearInterval(this.stateRetryTimer),null)),this.callbacks.onScoopListUpdate(e.scoops),t&&this.callbacks.onReady?.()}handleError(e){let t={type:`error`,error:e.error,...e.endTurn===!1?{endTurn:!1}:{}};e.scoopJid===this.selectedScoopJid?this.emitToUI(t):e.scoopJid&&this.emitBackground(e.scoopJid,t)}handleIncomingMessage(e){this.callbacks.onIncomingMessage(e.scoopJid,e.message)}handleMessageUpdated(e){this.callbacks.onMessageUpdate?.(e.scoopJid,{messageId:e.messageId,lickId:e.lickId,lickState:e.lickState})}msgScoopToRegistered(e){return on({jid:e.jid,name:e.name,folder:e.folder,parentJid:e.parentId,requiresTrigger:e.parentId!==null,assistantLabel:e.assistantLabel,addedAt:new Date().toISOString(),...e.config?{config:{...e.config}}:{}})}emitToUI(e){for(let t of this.eventListeners)try{t(e)}catch(e){K.error(`Listener error`,{error:e instanceof Error?e.message:String(e)})}}send(e){if(this.locked){this.emitToUI({type:`error`,error:`This window is detached. Close it and use the detached tab.`});return}this.transport.send(e)}};function q(){return Date.now().toString(36)+Math.random().toString(36).slice(2,8)}function rs(e,t){rn({state:e.state,error:e.error,reconnectAttempts:e.reconnectAttempts,session:e.session?{...e.session}:null}),mt({state:t.state,joinUrl:t.joinUrl,trayId:t.trayId,error:t.error,lastError:t.lastError,reconnectAttempts:t.reconnectAttempts,attachAttempts:t.attachAttempts,lastAttachCode:t.lastAttachCode,connectingSince:t.connectingSince,lastPingTime:t.lastPingTime})}function is(e){let t=e.createAgentHandle(),n=null,r=null;return{onAgentEvent:e=>t.onEvent(e),sendSprinkleLick:(t,n,r,i)=>e.sendSprinkleLick(t,n,r,i?{unitJid:i}:void 0),sendToolUiAction:(t,n,r)=>e.sendToolUiAction(t,n,r),deleteQueuedMessage:(t,n)=>e.deleteQueuedMessage(t,n),emitAgentError:t=>e.emitAgentError(t),getRecord:t=>e.getScoops().find(e=>e.jid===t),speaksReplies:!0,takeAttachments:()=>n?.(),onTurnIdle:()=>r?.(),welcome:{intercept:null},setAttachmentSource:e=>{n=e},setTurnIdleHook:e=>{r=e}}}var as={onAgentEvent:()=>()=>void 0,sendSprinkleLick:()=>void 0,sendToolUiAction:()=>void 0,deleteQueuedMessage:()=>Promise.resolve(),emitAgentError:()=>void 0},os=`A follower cannot cancel the leader’s queued message`;function ss(e){return{onAgentEvent:e.onAgentEvent,sendSprinkleLick:(t,n,r)=>e.getSync()?.sendSprinkleLick(t,n,r),sendToolUiAction:()=>void 0,deleteQueuedMessage:()=>Promise.reject(Error(os)),emitAgentError:e.onAgentError,readOnlyToolUi:!0}}function cs(e){return!e.includes(`\0`)}function ls(e){if(typeof window>`u`||window.localStorage===void 0)return()=>void 0;let t=window.localStorage,n=typeof Storage<`u`&&t instanceof Storage,r=n?Storage.prototype.setItem:t.setItem.bind(t),i=n?Storage.prototype.removeItem:t.removeItem.bind(t),a=n?Storage.prototype.clear:t.clear.bind(t);if(n){let n=Storage.prototype;n.setItem=function(n,i){if(r.call(this,n,i),this===t){if(!cs(n)){console.warn(`[page-storage-sync] dropping localStorage write with NUL in key`,n);return}e.send({type:`local-storage-set`,key:n,value:i})}},n.removeItem=function(n){if(i.call(this,n),this===t){if(!cs(n)){console.warn(`[page-storage-sync] dropping localStorage remove with NUL in key`,n);return}e.send({type:`local-storage-remove`,key:n})}},n.clear=function(){a.call(this),this===t&&e.send({type:`local-storage-clear`})}}else{let n=(e,n)=>{Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0,enumerable:!1})};n(`setItem`,(t,n)=>{if(r(t,n),!cs(t)){console.warn(`[page-storage-sync] dropping localStorage write with NUL in key`,t);return}e.send({type:`local-storage-set`,key:t,value:n})}),n(`removeItem`,t=>{if(i(t),!cs(t)){console.warn(`[page-storage-sync] dropping localStorage remove with NUL in key`,t);return}e.send({type:`local-storage-remove`,key:t})}),n(`clear`,()=>{a(),e.send({type:`local-storage-clear`})})}let o=n=>{if(n.storageArea===t){if(n.key===null){e.send({type:`local-storage-clear`});return}if(cs(n.key)){if(n.newValue===null){e.send({type:`local-storage-remove`,key:n.key});return}e.send({type:`local-storage-set`,key:n.key,value:n.newValue})}}};return window.addEventListener(`storage`,o),()=>{if(n)Storage.prototype.setItem=r,Storage.prototype.removeItem=i,Storage.prototype.clear=a;else{let e=(e,n)=>{Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0,enumerable:!1})};e(`setItem`,r),e(`removeItem`,i),e(`clear`,a)}window.removeEventListener(`storage`,o)}}function us(e){let t=!1,n=()=>{t||(t=!0,typeof e.start==`function`&&e.start())};return{onMessage:t=>{let r=e=>{t(e.data)};return e.addEventListener(`message`,r),n(),()=>{e.removeEventListener(`message`,r)}},send:(t,n)=>{n&&n.length>0?e.postMessage(t,n):e.postMessage(t)}}}function ds(e){let t=us(e);return{onMessage:e=>t.onMessage(e),send:(e,n)=>{t.send({source:`panel`,payload:e},n)}}}async function fs(e,t,n,r,i,a){let o=e;if(o?.type){if(o.type===`cdp-cmd`){let r=e;if((r.gen??a())<a()){n.send({type:`cdp-response`,id:r.id,error:`dropped: command crossed a CDP connection reset in flight`});return}try{i&&t.state!==`connected`&&t.superseded!==!0&&await i();let e=await t.send(r.method,r.params,r.sessionId);n.send({type:`cdp-response`,id:r.id,result:e})}catch(e){n.send({type:`cdp-response`,id:r.id,error:e instanceof Error?e.message:String(e)})}return}if(o.type===`cdp-subscribe`){let i=e;if(r.has(i.event))return;let a=e=>{n.send({type:`cdp-event`,method:i.event,params:e})};r.set(i.event,a),t.on(i.event,a);return}if(o.type===`cdp-unsubscribe`){let n=e,i=r.get(n.event);if(!i)return;r.delete(n.event),t.off(n.event,i)}}}function ps(e,t){for(let[n,r]of t)e.off(n,r),e.on(n,r)}var ms=1e4;function hs(e){return new Promise((t,n)=>{let r=!1,i=null,a=null,o=e=>{r||(r=!0,clearTimeout(s),a&&clearInterval(a),i?.(),e?n(e):t())},s=setTimeout(()=>o(Error(`page CDP client is still connecting`)),ms),c=e=>{e===`connected`?o():e===`disconnected`&&o(Error(`page CDP client failed to reconnect`))};e.onStateChange?i=e.onStateChange(e=>c(e)):a=setInterval(()=>c(e.state),50),c(e.state)})}function gs(e,t,n={}){let r=us(e),i=null,a=n.reconnect?()=>(i||=(t.state===`connecting`?hs(t):n.reconnect()).finally(()=>{i=null}),i):null,o=new Map,s=r.onMessage(e=>{fs(e,t,r,o,a,()=>l)}),c=t.state,l=0,u=t.onStateChange?.((e,n)=>{if(e!==c){if(c=e,e===`disconnected`){l+=1,r.send({type:`cdp-reset`,reason:n??`page CDP client disconnected`});return}e===`connected`&&(ps(t,o),r.send({type:`cdp-ready`}))}});return()=>{s(),u?.();for(let[e,n]of o)t.off(e,n);o.clear()}}function _s(){let e={};if(typeof localStorage>`u`)return e;for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);if(n===null)continue;let r=localStorage.getItem(n);r!==null&&(e[n]=r)}return e}function vs(e,t,n){let r=()=>{};return{ready:new Promise((i,a)=>{let o=null,s=null,c=()=>{o!==null&&(clearTimeout(o),o=null)},l=Math.max(1,t.readyStallLimit??(t.onReadyStall?3:1)),u=Date.now(),d=0,f=!1,p=()=>{c(),o=setTimeout(()=>{if(d+=1,d<l){t.onReadyStall?.({elapsedMs:Date.now()-u,stalls:d}),p();return}t.onLateReady?c():r(),f=!0,a(Error(`Kernel worker did not signal ready within ${n*l}ms`))},n)};r=()=>{s!==null&&(e.removeEventListener(`message`,s),s=null),c()},s=e=>{let n=e.data;if(n?.type===`kernel-worker-boot-progress`){d=0,p();return}if(n?.type===`kernel-worker-ready`){if(r(),f){t.onLateReady?.();return}i();return}if(n?.type===`kernel-worker-boot-error`){r();let e=n.message??`unknown error`,t=n.code,i=Error(`Kernel worker boot failed: ${e}`);t&&(i.code=t),a(i)}},e.addEventListener(`message`,s),p()}),cleanup:()=>r()}}function ys(e){let{worker:t,realCdpTransport:n}=e,r=e.readyTimeoutMs??3e4,i=e.localStorageSeed??{},a=new MessageChannel,o=new MessageChannel,s=ds(a.port1),c=e.makeClient(s);e.onWorkerScriptError&&e.worker.addEventListener?.(`error`,()=>e.onWorkerScriptError());let l=gs(o.port1,n,{...e.reconnectCdp?{reconnect:e.reconnectCdp}:{}}),{ready:u,cleanup:d}=vs(a.port1,e,r),f={type:`kernel-worker-init`,kernelPort:a.port2,cdpPort:o.port2,localStorageSeed:i,instanceId:e.instanceId,localApiBaseUrl:e.localApiBaseUrl??null,bridgeToken:e.bridgeToken??null,syncFsBridgeEnabled:e.syncFsBridgeEnabled??!1,syncFsChannelNonce:e.syncFsChannelNonce??null,localLickWsUrl:e.localLickWsUrl??null,extensionDelegateId:e.extensionDelegateId??null,pageBuildId:`6.173.2-mu9d9uuv`,pageLoadedAt:globalThis.performance?.timeOrigin??Date.now(),flagFloat:e.flagFloat??null,appPageUrl:globalThis.location?.href??null};t.postMessage(f,[a.port2,o.port2]);let p=!1;return{client:c,ready:u,dispose(){if(!p){p=!0,d(),l();try{t.postMessage({type:`kernel-worker-shutdown`})}catch{}t.terminate(),a.port1.close(),o.port1.close()}}}}function bs(e){return ys({worker:e.workerUrl?new Worker(e.workerUrl,{type:`module`}):new Worker(new URL(`/assets/kernel-worker-DVosTEfk.js`,``+import.meta.url),{type:`module`}),realCdpTransport:e.realCdpTransport,reconnectCdp:e.reconnectCdp,makeClient:e.makeClient,readyTimeoutMs:e.readyTimeoutMs,localStorageSeed:e.localStorageSeed??_s(),instanceId:e.instanceId,localApiBaseUrl:e.localApiBaseUrl,bridgeToken:e.bridgeToken,syncFsBridgeEnabled:e.syncFsBridgeEnabled,syncFsChannelNonce:e.syncFsChannelNonce,localLickWsUrl:e.localLickWsUrl,extensionDelegateId:e.extensionDelegateId,flagFloat:e.flagFloat,onWorkerScriptError:e.onWorkerScriptError,onReadyStall:e.onReadyStall,readyStallLimit:e.readyStallLimit,onLateReady:e.onLateReady})}var xs=1048576,Ss=`r`;function Cs(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function ws(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ts(e,t,n){if(typeof e==`string`){n.push({pointer:t,value:e});return}if(Array.isArray(e)){for(let r=0;r<e.length;r++)Ts(e[r],`${t}/${r}`,n);return}if(ws(e))for(let[r,i]of Object.entries(e))Ts(i,`${t}/${Cs(r)}`,n)}function Es(e,t,n){if(typeof e==`string`)return n.get(t)??e;if(Array.isArray(e)){let r=!1,i=[];for(let a=0;a<e.length;a++){let o=Es(e[a],`${t}/${a}`,n);o!==e[a]&&(r=!0),i.push(o)}return r?i:e}if(ws(e)){let r=!1,i={};for(let[a,o]of Object.entries(e)){let e=Es(o,`${t}/${Cs(a)}`,n);e!==o&&(r=!0),i[a]=e}return r?i:e}return e}function Ds(e,t,n){if(ws(e))return Es(e,t,n);if(typeof e==`string`)return n.get(t)??e;if(Array.isArray(e)){let r=!1,i=[];for(let a=0;a<e.length;a++){let o=Ds(e[a],`${t}/${a}`,n);o!==e[a]&&(r=!0),i.push(o)}return r?i:e}return e}function Os(e){let t=new Map;for(let n of e.matchAll(/⟦REDACTED:([^:⟧]+):([^⟧]+)⟧/g)){let e=n[0],r=t.get(e);r?r.count++:t.set(e,{category:n[1],id:n[2],count:1})}return t}async function ks(e,t,n){let r=[],i=0;for(;i<e.length;){if(n?.aborted)throw new C(`redaction-unavailable`);let a=0,o=i;for(;o<e.length;){let t=e[o].length;if(o>i&&a+t>xs)break;a+=t,o++}let s=e.slice(i,o),c;try{c=await t.redact(s,n)}catch{throw new C(`redaction-unavailable`)}if(c.length!==s.length)throw new C(`redaction-unavailable`);r.push(...c),i=o}return r}function As(e,t,n,r){let i=[],a=Os(e);for(let{category:e,id:t}of a.values())i.push({id:t,category:e,detector:`pre-obfuscated`,target:n});let o=Os(t);for(let[e,{category:t,id:r,count:s}]of o)s>(a.get(e)?.count??0)&&i.push({id:r,category:t,detector:`known-secret`,target:n});let{text:s,matches:c,nextId:l}=ze(t,Ss,r);for(let{id:e,category:t}of c)i.push({id:e,category:t,detector:`credential-pattern`,target:n});return{finalText:s,redactions:i,nextId:l}}function js(e,t,n){for(let{redactions:r}of e)for(let e of r)t.push(e),n[e.category]=(n[e.category]??0)+1}async function Ms(e,t,n,r){if(r?.aborted)throw new C(`redaction-unavailable`);let{privacy:i,...a}=e,o=[];Ts(a,``,o);let s=o.filter(e=>!Le(e.pointer)),c=[...t.entries()],l=await ks([...s.map(e=>e.value),...c.map(([,e])=>e)],n,r),u=[],d={},f=1,p=new Map,m=[];for(let e=0;e<s.length;e++){let t=s[e],n=As(t.value,l[e],{kind:`json`,pointer:t.pointer},f);f=n.nextId,n.finalText!==t.value&&p.set(t.pointer,n.finalText),m.push(n)}js(m,u,d);let h=new Map,g=s.length,_=[];for(let e=0;e<c.length;e++){let[t,n]=c[e],r=As(n,l[g+e],{kind:`attachment`,attachmentId:t},f);f=r.nextId,h.set(t,r.finalText),_.push(r)}js(_,u,d);let v=Ds(e,``,p);return{document:{...v,privacy:{...v.privacy,redactionCounts:d,redactions:u}},textAttachments:h}}function Ns(e,t){let n=e.startsWith(`text/`)||e===`application/json`,r=/\.(?:txt|md|json|csv|xml|ya?ml|js|mjs|cjs|ts|tsx|css|html)$/i.test(t);return n||r?`text-redacted`:`binary-unchanged`}async function Ps(e){let t=e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength),n=await crypto.subtle.digest(`SHA-256`,t);return Array.from(new Uint8Array(n)).map(e=>e.toString(16).padStart(2,`0`)).join(``)}var Fs={"image/png":`.png`,"image/jpeg":`.jpg`,"image/gif":`.gif`,"image/webp":`.webp`,"image/svg+xml":`.svg`,"image/bmp":`.bmp`,"application/pdf":`.pdf`,"application/zip":`.zip`,"application/gzip":`.gz`,"application/json":`.json`,"text/plain":`.txt`,"text/markdown":`.md`,"text/csv":`.csv`,"text/html":`.html`,"text/xml":`.xml`,"application/xml":`.xml`};function Is(e,t){return Fs[e]??(t===`text-redacted`?`.txt`:`.bin`)}function Ls(e,t,n){return`attachments/att-${String(e+1).padStart(4,`0`)}${Is(t,n)}`}function Rs(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}function zs(e){let t=[];for(let n of e.conversations){let e=0;for(let r of n.messages){let i=r.role;if(i!==`user`&&i!==`assistant`&&i!==`tool-result`)continue;let a=0;for(let o of r.content)o.type===`attachment-ref`&&(t.push({attachmentId:o.attachmentId,conversationId:n.id,messageId:r.id,role:i,userOrdinal:e,imgIndex:a}),a++);i===`user`&&e++}}return t}async function Bs(e,t,n,r,i){let a=Ns(e.mimeType,e.name),o={attachmentId:t,originalName:e.name,mimeType:e.mimeType,handling:a,present:!0,sourceConversationId:n,sourceMessageId:r};if(a===`text-redacted`){let t;if(e.text!==void 0)t=e.text;else if(e.data!==void 0)t=new TextDecoder().decode(Rs(e.data));else if(e.path!==void 0&&i!==void 0)try{t=new TextDecoder().decode(await i(e.path))}catch{return{...o,present:!1,missingReason:`attachment-file-missing`}}return t===void 0?{...o,present:!1,missingReason:`attachment-file-missing`}:{...o,rawText:t}}let s;if(e.data!==void 0)s=Rs(e.data);else if(e.path!==void 0&&i!==void 0)try{s=await i(e.path)}catch{return{...o,present:!1,missingReason:`attachment-file-missing`}}return s===void 0?{...o,present:!1,missingReason:`attachment-file-missing`}:{...o,rawBytes:s}}function Vs(e,t,n,r){let i=[],a=new Set,o=new Set;for(let s of e){if(s.role!==`user`){let e=n.get(s.attachmentId);e===void 0?i.push(Promise.resolve({attachmentId:s.attachmentId,originalName:`unknown`,mimeType:`application/octet-stream`,handling:`binary-unchanged`,present:!1,missingReason:`attachment-file-missing`,sourceConversationId:s.conversationId,sourceMessageId:s.messageId})):i.push(Promise.resolve({attachmentId:s.attachmentId,originalName:`image-${s.imgIndex}`,mimeType:e.mimeType,handling:`binary-unchanged`,rawBytes:Rs(e.data),present:!0,sourceConversationId:s.conversationId,sourceMessageId:s.messageId}));continue}let e=(t.get(s.conversationId)??[]).filter(e=>e.role===`user`)[s.userOrdinal];if(e===void 0){a.add(s.conversationId),i.push(Promise.resolve({attachmentId:s.attachmentId,originalName:`unknown`,mimeType:`application/octet-stream`,handling:`binary-unchanged`,present:!1,missingReason:`attachment-association-unavailable`,sourceConversationId:s.conversationId,sourceMessageId:s.messageId}));continue}let c=(e.attachments??[]).map((e,t)=>({a:e,i:t})).filter(({a:e})=>e.kind===`image`||e.kind===`file`&&e.data!==void 0)[s.imgIndex];if(c===void 0){i.push(Promise.resolve({attachmentId:s.attachmentId,originalName:`unknown`,mimeType:`application/octet-stream`,handling:`binary-unchanged`,present:!1,missingReason:`attachment-file-missing`,sourceConversationId:s.conversationId,sourceMessageId:s.messageId}));continue}o.add(`${s.conversationId}:${e.id}:${c.i}`),i.push(Bs(c.a,s.attachmentId,s.conversationId,s.messageId,r))}return{pendingPromises:i,mismatchedConvIds:a,processedUiPositions:o}}function Hs(e,t,n){return(e.attachments??[]).map((e,t)=>({a:e,i:t})).filter(({a:r,i})=>(r.kind===`text`||r.kind===`file`&&(r.data!==void 0||r.path!==void 0))&&!n.has(`${t}:${e.id}:${i}`))}function Us(e,t,n,r,i,a,o){let s=Hs(t,n,i),c=[];for(let t=0;t<s.length;t++){let{a:i}=s[t],l=`${e.id}-file-${t}`;r.has(l)||(a.push(Bs(i,l,n,e.id,o)),c.push({type:`attachment-ref`,attachmentId:l}))}return c}function Ws(e,t,n,r,i){let a=new Map,o=[];for(let s of e.conversations){let e=(t.get(s.id)??[]).filter(e=>e.role===`user`),c=0;for(let t of s.messages){if(t.role!==`user`)continue;let l=e[c];if(c++,l===void 0)continue;let u=Us(t,l,s.id,n,r,o,i);u.length>0&&(a.has(s.id)||a.set(s.id,new Map),a.get(s.id).set(t.id,[...t.content,...u]))}}return{updates:a,additionalPendingPromises:o}}function Gs(e,t){let n=new Map,r=0,i=new Map;for(let t of e)t.handling===`text-redacted`&&t.rawText!==void 0&&n.set(t.attachmentId,t.rawText),t.present&&i.set(t.attachmentId,Ls(r++,t.mimeType,t.handling));for(let n of e)!n.present&&n.missingReason!==void 0&&t.add(n.missingReason);return{rawAttachments:e.map(e=>e.present?{id:e.attachmentId,path:i.get(e.attachmentId),originalName:e.originalName,mimeType:e.mimeType,byteLength:0,sha256:``,sourceConversationId:e.sourceConversationId,sourceMessageId:e.sourceMessageId,handling:e.handling,present:!0}:{id:e.attachmentId,path:``,originalName:e.originalName,mimeType:e.mimeType,byteLength:0,sha256:``,sourceConversationId:e.sourceConversationId,sourceMessageId:e.sourceMessageId,handling:e.handling,present:!1,missingReason:e.missingReason??`attachment-file-missing`}),textMap:n}}async function Ks(e,t,n,r,i){let{rawAttachments:a,textMap:o}=Gs(e,n),s,c;try{let e=await Ms({...t,attachments:a},o,r,i);s=e.document,c=e.textAttachments}catch(e){throw e instanceof C?e:new C(`attachment-unreadable`)}let l=new Map;for(let t of e){if(l.has(t.attachmentId))throw new C(`schema-invalid`);l.set(t.attachmentId,t)}let u=new Map,d=await Promise.all(s.attachments.map(async e=>{if(!e.present||!e.path)return e;let t=l.get(e.id);if(t===void 0)throw new C(`schema-invalid`);let n=t.handling===`text-redacted`?new TextEncoder().encode(c.get(t.attachmentId)??t.rawText??``):t.rawBytes,r=await Ps(n);return u.set(e.path,n),{...e,byteLength:n.length,sha256:r}}));return{redactedDocument:{...s,attachments:d},bundleFiles:u}}async function qs(e){let{document:t,chatMessagesByConversation:n,knownSecrets:r,signal:i}=e,a=e.canonicalImages??new Map,o=e.vfsReader,s=new Set,{pendingPromises:c,mismatchedConvIds:l,processedUiPositions:u}=Vs(zs(t),n,a,o);l.size>0&&s.add(`attachment-association-unavailable`);for(let e of t.conversations)e.messages.filter(e=>e.role===`user`).length>(n.get(e.id)??[]).filter(e=>e.role===`user`).length&&s.add(`attachment-association-unavailable`);let d=await Promise.all(c),{updates:f,additionalPendingPromises:p}=Ws(t,n,new Set(d.map(e=>e.attachmentId)),u,o),m=await Promise.all(p),h=[...d,...m],g=t;f.size>0&&(g={...t,conversations:t.conversations.map(e=>{let t=f.get(e.id);return t?{...e,messages:e.messages.map(e=>{let n=t.get(e.id);return n?{...e,content:n}:e})}:e})});let{redactedDocument:_,bundleFiles:v}=await Ks(h,g,s,r,i),y=[..._.session.completeness.missing.filter(e=>!s.has(e)),...s];return{document:{..._,session:{..._.session,completeness:{status:y.length>0?`partial`:_.session.completeness.status,missing:y}}},bundleFiles:v}}var Js=50;function Ys(e){return fn(e)}function Xs(e,t){return e.map(e=>{let n=t.isProcessing(e.jid)?`1`:`0`,r=t.getAgentMessages(e.jid);if(r===null)return`${e.jid}:${n}:null`;let i=r.length,a=r[i-1],o=a?.role??``,s=a&&`timestamp`in a?a.timestamp:-1,c=a&&`toolCallId`in a?a.toolCallId:``;return`${e.jid}:${n}:${i}:${o}:${s}:${c}`}).join(`,`)}function Zs(e,t,n,r){let i=new Map;for(let e of t)i.set(e.id,e);let a=new Map;for(let e of n)a.set(e.id,e);let o=[],s=new Map;for(let t of e){let e=r.getAgentMessages(t.jid)??i.get(t.jid)?.messages??[],n={id:t.jid,kind:O(t)?`cone`:`scoop`,name:t.name,...t.folder&&!O(t)?{folder:t.folder}:{},...t.parentJid?{parentConversationId:t.parentJid}:{},...t.originToolCallId?{originToolCallId:t.originToolCallId}:{},messages:e};o.push(n);let c=Ys(t),l=a.get(c);l&&s.set(t.jid,l.messages)}return{sources:o,chatMessagesByConversation:s}}async function Qs(e,t,n={}){let r=e=>n.rootJid===void 0?e:mn(e,n.rootJid);for(;;){let n=r(e.listScoops());for(;n.some(t=>e.isProcessing(t.jid));)if(t?.aborted||(await e.wait(Js,t),t?.aborted))throw new C(`transfer-aborted`);let i=Xs(n,e),[a,o]=await Promise.all([e.loadPersistedSessions(),e.loadUiChatSessions()]);if(t?.aborted)throw new C(`transfer-aborted`);let s=r(e.listScoops());if(i===Xs(s,e))return Zs(s,a,o,e)}}function $s(e,t){return`${e}-msg-${t.toString().padStart(6,`0`)}`}function ec(e,t){return{type:`attachment-ref`,attachmentId:`${e}-img-${t}`}}function tc(e,t){if(typeof e==`string`)return e?[{type:`text`,text:e}]:[];let n=[],r=0;for(let i of e)i.type===`text`?i.text&&n.push({type:`text`,text:i.text}):i.type===`image`&&n.push(ec(t,r++));return n}function nc(e,t){let n=[],r=new Map,i=0,a=0;for(let o of e)if(o.type===`thinking`)i+=1;else if(o.type===`text`)o.text&&n.push({type:`text`,text:o.text});else if(o.type===`toolCall`)n.push({type:`tool-call`,id:o.id??``,name:o.name??``,input:o.arguments??{}});else if(o.type===`image`){let e=ec(t,a++);n.push(e),o.data&&o.mimeType&&r.set(e.attachmentId,{data:o.data,mimeType:o.mimeType})}return{blocks:n,excluded:i,images:r}}function rc(e,t){let n=[],r=new Map,i=0;for(let a of e)if(a.type===`text`)a.text&&n.push({type:`text`,text:a.text});else if(a.type===`image`){let e=ec(t,i++);n.push(e),a.data&&a.mimeType&&r.set(e.attachmentId,{data:a.data,mimeType:a.mimeType})}return{blocks:n,images:r}}function ic(e,t,n){let r=$s(t,n),i=tc(e.content,r);return{message:{id:r,sequence:n,role:`user`,timestamp:new Date(e.timestamp).toISOString(),content:i},excludedReasoningBlocks:0,images:new Map}}function ac(e,t,n){let r=$s(t,n),{blocks:i,excluded:a,images:o}=nc(e.content,r);return{message:{id:r,sequence:n,role:`assistant`,timestamp:new Date(e.timestamp).toISOString(),content:i,model:{provider:e.provider,id:e.model,api:e.api},usage:e.usage,stopReason:e.stopReason,...e.errorMessage?{error:e.errorMessage}:{}},excludedReasoningBlocks:a,images:o}}function oc(e,t,n){let r=$s(t,n),{blocks:i,images:a}=rc(e.content,r);return{message:{id:r,sequence:n,role:`tool-result`,timestamp:new Date(e.timestamp).toISOString(),content:i,toolCallId:e.toolCallId,isError:e.isError},excludedReasoningBlocks:0,images:a}}function sc(e,t,n){return e.role===`user`?ic(e,t,n):e.role===`assistant`?ac(e,t,n):e.role===`toolResult`?oc(e,t,n):{message:null,excludedReasoningBlocks:0,images:new Map}}function cc(e){let t=[];for(let n of e){if(!n.parentConversationId)continue;let e={sourceConversationId:n.parentConversationId,targetConversationId:n.id};n.originToolCallId&&(e.toolCallId=n.originToolCallId),t.push(e)}return t}function lc(e){let t=0,n=new Map;return{conversations:e.map(e=>{let r=e.messages.flatMap((r,i)=>{let a=sc(r,e.id,i+1);t+=a.excludedReasoningBlocks;for(let[e,t]of a.images)n.set(e,t);return a.message?[a.message]:[]});return{id:e.id,kind:e.kind,name:e.name,...e.folder?{folder:e.folder}:{},...e.parentConversationId?{parentConversationId:e.parentConversationId}:{},...e.createdAt?{createdAt:e.createdAt}:{},...e.updatedAt?{updatedAt:e.updatedAt}:{},messages:r}}),delegations:cc(e),excludedReasoningBlocks:t,canonicalImages:n}}var uc=(()=>{let e=new Uint32Array(256);for(let t=0;t<256;t++){let n=t;for(let e=0;e<8;e++)n=n&1?3988292384^n>>>1:n>>>1;e[t]=n}return e})();function dc(e){let t=-1>>>0;for(let n=0;n<e.length;n++)t=t>>>8^uc[(t^e[n])&255];return~t>>>0}var fc=new TextEncoder;function J(e,t,n){e[t]=n&255,e[t+1]=n>>>8&255}function Y(e,t,n){e[t]=n&255,e[t+1]=n>>>8&255,e[t+2]=n>>>16&255,e[t+3]=n>>>24&255}function pc(e,t,n){let r=new Uint8Array(30+e.length);return r[0]=80,r[1]=75,r[2]=3,r[3]=4,J(r,4,20),J(r,6,2048),J(r,8,0),J(r,10,0),J(r,12,0),Y(r,14,n),Y(r,18,t),Y(r,22,t),J(r,26,e.length),J(r,28,0),r.set(e,30),r}function mc(e,t,n,r){let i=new Uint8Array(46+e.length);return i[0]=80,i[1]=75,i[2]=1,i[3]=2,J(i,4,20),J(i,6,20),J(i,8,2048),J(i,10,0),J(i,12,0),J(i,14,0),Y(i,16,n),Y(i,20,t),Y(i,24,t),J(i,28,e.length),J(i,30,0),J(i,32,0),J(i,34,0),J(i,36,0),Y(i,38,0),Y(i,42,r),i.set(e,46),i}function hc(e,t,n){let r=new Uint8Array(22);return r[0]=80,r[1]=75,r[2]=5,r[3]=6,J(r,4,0),J(r,6,0),J(r,8,e),J(r,10,e),Y(r,12,t),Y(r,16,n),J(r,20,0),r}function gc(e){if(!e||e.startsWith(`/`)||e.includes(`\0`)||e.includes(`\\`))return!1;for(let t of e.split(`/`))if(t===``||t===`.`||t===`..`)return!1;return!0}function _c(e){let t=e.export.generatedAt.slice(0,10),n=e.export.id.slice(0,8);return`slicc-${t}-${Fe(e.session.title,{maxLen:40,fallback:`transcript`})}-${n}.zip`}async function*vc(e,t,n,r,i){if(n?.aborted)throw i(new C(`transfer-aborted`)),new C(`transfer-aborted`);let a=()=>i(new C(`transfer-aborted`));n?.addEventListener(`abort`,a,{once:!0});let o=Tt.create(),s=0,c=0,l=[],u=!1;function*d(e){o.update(e),s+=e.byteLength,c+=e.byteLength,yield e}try{let i=new TextEncoder().encode(JSON.stringify(e,null,2)),a=fc.encode(`transcript.json`),f=dc(i),p=pc(a,i.length,f);if(l.push({nameBytes:a,size:i.length,crc:f,localOffset:c}),n?.aborted||(yield*d(p),n?.aborted))throw new C(`transfer-aborted`);yield*d(i);for(let[e,r]of t){if(n?.aborted)throw new C(`transfer-aborted`);let t=fc.encode(e),i=dc(r),a=pc(t,r.length,i);if(l.push({nameBytes:t,size:r.length,crc:i,localOffset:c}),yield*d(a),n?.aborted)throw new C(`transfer-aborted`);yield*d(r)}let m=c;for(let e of l){if(n?.aborted)throw new C(`transfer-aborted`);yield*d(mc(e.nameBytes,e.size,e.crc,e.localOffset))}if(n?.aborted)throw new C(`transfer-aborted`);yield*d(hc(l.length,c-m,m)),u=!0,r({byteLength:s,sha256:o.hex()})}catch(e){throw u=!0,i(e),e}finally{n?.removeEventListener(`abort`,a),u||(u=!0,i(new C(`transfer-aborted`)))}}var yc=4294967295,bc=65535;function xc(e,t,n){for(let e of t.keys())if(!gc(e))throw new C(`schema-invalid`);if(t.size+1>bc)throw new C(`schema-invalid`);for(let e of t.values())if(e.byteLength>yc)throw new C(`schema-invalid`);let r,i,a=new Promise((e,t)=>{r=e,i=t});return{filename:_c(e),chunks:vc(e,t,n,r,i),completion:a}}function Sc(e,t,n,r,i,a={}){return{schemaVersion:1,export:{id:crypto.randomUUID(),generatedAt:new Date().toISOString(),producer:{application:`slicc`,version:i},format:Re},session:{id:e,title:t,state:n,completeness:{status:`complete`,missing:[]},...a},privacy:{reasoningExcluded:!0,excludedReasoningBlocks:r.excludedReasoningBlocks,binaryAttachments:`included-unchanged`,redactionCounts:{},redactions:[]},conversations:r.conversations,delegations:r.delegations,attachments:[]}}function Cc(e,t){let n=[],r=1;for(let i of e){if(i.role!==`user`&&i.role!==`assistant`)continue;let e=`${t}-msg-${String(r).padStart(6,`0`)}`;n.push({id:e,sequence:r++,role:i.role,timestamp:new Date(i.timestamp||0).toISOString(),content:i.content?[{type:`text`,text:i.content}]:[]})}return n}function wc(e){let t=Ie(e);if(!t.ok)throw new C(`schema-invalid`,t.error)}function Tc(e,t,n){let r=new Map;for(let i of e)if(!(!i.present||!i.path)){if(i.handling===`text-redacted`){let e=t.get(i.id);e!==void 0&&r.set(i.path,new TextEncoder().encode(e))}else{let e=n.get(i.path);e&&r.set(i.path,e)}}return r}async function Ec(e,t){return Promise.all(e.map(async e=>{if(!e.present||!e.path||e.handling!==`text-redacted`)return e;let n=t.get(e.path);if(!n)return e;let r=n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength),i=await crypto.subtle.digest(`SHA-256`,r),a=Array.from(new Uint8Array(i)).map(e=>e.toString(16).padStart(2,`0`)).join(``);return{...e,byteLength:n.length,sha256:a}}))}function Dc(e){let t=e.match(/^---\n([\s\S]*?)\n---\n/);if(!t)return{};let n=t[1],r={},i=n.match(/^createdAt:\s*(\d+)\s*$/m),a=n.match(/^updatedAt:\s*(\d+)\s*$/m);return i&&(r.createdAt=new Date(Number(i[1])).toISOString()),a&&(r.updatedAt=new Date(Number(a[1])).toISOString()),r}var Oc=class{deps;constructor(e){this.deps=e}async export(e,t={}){let{signal:n,onProgress:r}=t,i;return i=e.kind===`active`?await this.buildActiveSnapshot(n,r):await this.buildFrozenSnapshot(e.sessionId,n,r),wc(i.document),r?.({phase:`packaging`}),xc(i.document,i.bundleFiles,n)}async captureFrozen(e,t){let n=await Qs(this.deps.collection,t,{...e.rootJid?{rootJid:e.rootJid}:{}});if(e.rootJid&&n.sources.length===0)return;let r=lc(n.sources),{document:i,bundleFiles:a}=await qs({document:Sc(e.sessionId,e.title,`frozen`,r,this.deps.version,{frozenAt:e.frozenAt,createdAt:new Date(e.createdAt).toISOString(),updatedAt:new Date(e.updatedAt).toISOString()}),chatMessagesByConversation:n.chatMessagesByConversation,knownSecrets:this.deps.knownSecrets,canonicalImages:r.canonicalImages,vfsReader:e=>this.readBinaryFromVfs(e),signal:t});wc(i),await this.deps.snapshotStore.write(e.sessionId,{document:i,attachments:a})}async buildActiveSnapshot(e,t){t?.({phase:`waiting-for-conversations`}),t?.({phase:`collecting`});let n=await Qs(this.deps.collection,e),r=lc(n.sources),{id:i,title:a}=this.deps.getActiveSessionInfo(),o=Sc(i,a,`active`,r,this.deps.version);return t?.({phase:`redacting`}),qs({document:o,chatMessagesByConversation:n.chatMessagesByConversation,knownSecrets:this.deps.knownSecrets,canonicalImages:r.canonicalImages,vfsReader:e=>this.readBinaryFromVfs(e),signal:e})}async buildFrozenSnapshot(e,t,n){let r=await this.deps.snapshotStore.read(e);return r?(n?.({phase:`redacting`}),this.reredactStoredSnapshot(r,t)):this.buildLegacyPartial(e,t,n)}async reredactStoredSnapshot(e,t){let n=new Map;for(let t of e.document.attachments){if(t.handling!==`text-redacted`||!t.present||!t.path)continue;let r=e.attachments.get(t.path);r&&n.set(t.id,new TextDecoder().decode(r))}let r,i;try{let a=await Ms(e.document,n,this.deps.knownSecrets,t);r=a.document,i=a.textAttachments}catch{throw new C(`redaction-unavailable`)}let a=Tc(r.attachments,i,e.attachments),o=await Ec(r.attachments,a);return{document:{...r,attachments:o},bundleFiles:a}}async buildLegacyPartial(e,t,n){let r=(await D(this.deps.vfs)).find(t=>t.sessionId===e||!t.sessionId&&t.filename===e);if(!r)throw new C(`session-not-found`);let a;try{let e=await this.deps.vfs.readFile(`/sessions/${r.filename}`,{encoding:`utf-8`});a=typeof e==`string`?e:new TextDecoder().decode(e)}catch{throw new C(`session-not-found`)}let{loadFrozenArchive:o}=await i(async()=>{let{loadFrozenArchive:e}=await import(`./session-jsonl-BCu9CtLe.js`).then(e=>e.i);return{loadFrozenArchive:e}},__vite__mapDeps([44,1,0,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,45,46])),{title:s,messages:c}=await o(this.deps.vfs,a,r.filename),l=`legacy-cone`,u=Cc(c,l),d=Dc(a),f={schemaVersion:1,export:{id:crypto.randomUUID(),generatedAt:new Date().toISOString(),producer:{application:`slicc`,version:this.deps.version},format:Re},session:{id:e,title:s,state:`frozen`,...r.frozenAt?{frozenAt:r.frozenAt}:{},...d,completeness:{status:`partial`,missing:[`complete-snapshot-unavailable`,`canonical-agent-history-unavailable`]}},privacy:{reasoningExcluded:!0,excludedReasoningBlocks:0,binaryAttachments:`included-unchanged`,redactionCounts:{},redactions:[]},conversations:[{id:l,kind:`cone`,name:s,messages:u}],delegations:[],attachments:[]},p=new Map([[l,c]]);return n?.({phase:`redacting`}),qs({document:f,chatMessagesByConversation:p,knownSecrets:this.deps.knownSecrets,vfsReader:e=>this.readBinaryFromVfs(e),signal:t})}async readBinaryFromVfs(e){let t=await this.deps.vfs.readFile(e,{encoding:`binary`});if(!(t instanceof Uint8Array))throw new C(`attachment-unreadable`);return t}},kc=`/sessions/data`,Ac=`document.json`;async function jc(e){let t=e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength),n=await crypto.subtle.digest(`SHA-256`,t);return Array.from(new Uint8Array(n)).map(e=>e.toString(16).padStart(2,`0`)).join(``)}function Mc(e){if(e.length===0||/[/\\\x00]/.test(e)||e===`..`||e===`.`||e.includes(`..`)||!/^[a-zA-Z0-9._-]+$/.test(e))throw new C(`session-not-found`)}function Nc(e){return`${kc}/${e}`}function Pc(e){return`${kc}/.tmp-${e}`}async function Fc(e,t){try{await e.mkdir(t,{recursive:!0})}catch{}}async function Ic(e,t){let n;try{n=await e.readDir(t)}catch{return}for(let r of n){let n=`${t}/${r.name}`;r.type===`directory`&&await Ic(e,n);try{await e.rm(n)}catch{}}try{await e.rm(t)}catch{}}async function Lc(e,t,n){await Fc(e,n);let r=await e.readDir(t);for(let i of r){let r=`${t}/${i.name}`,a=`${n}/${i.name}`;if(i.type===`directory`)await Lc(e,r,a);else{let t=await e.readFile(r,{encoding:`binary`});await e.writeFile(a,t)}}}async function Rc(e,t,n){Mc(t);let r=Pc(t),i=Nc(t),a=new Map(n.document.attachments.filter(e=>e.present&&e.path).map(e=>[e.path,e]));for(let[e]of n.attachments)if(!a.has(e))throw new C(`schema-invalid`);await Ic(e,i),await Fc(e,r);try{let t=[...n.document.attachments];for(let[e,r]of n.attachments){let n=await jc(r),i=a.get(e);if(i!==void 0){let e=t.indexOf(i);e!==-1&&(t[e]={...i,sha256:n,byteLength:r.length})}}let o={...n.document,attachments:t},s=JSON.stringify(o,null,2);if(await e.writeFile(`${r}/${Ac}`,s),n.attachments.size>0)for(let[t,i]of n.attachments){let n=`${r}/${t}`,a=t.lastIndexOf(`/`);a!==-1&&await Fc(e,`${r}/${t.slice(0,a)}`),await e.writeFile(n,i)}await e.flush(),await Lc(e,r,i),await e.flush()}catch(t){throw await Ic(e,r),t}await Ic(e,r)}async function zc(e,t){Mc(t);let n=Nc(t),r=`${n}/${Ac}`,i;try{let t=await e.readFile(r,{encoding:`utf-8`});i=typeof t==`string`?t:new TextDecoder().decode(t)}catch{throw new C(`session-not-found`)}let a;try{a=JSON.parse(i)}catch{throw new C(`schema-invalid`)}if(!Ie(a).ok)throw new C(`schema-invalid`);let o=new Map;for(let t of a.attachments){if(!t.present||!t.path)continue;let r=`${n}/${t.path}`,i;try{let t=await e.readFile(r,{encoding:`binary`});i=t instanceof Uint8Array?t:new TextEncoder().encode(t)}catch{throw new C(`transfer-corrupt`)}if(await jc(i)!==t.sha256)throw new C(`transfer-corrupt`);o.set(t.path,i)}return{document:a,attachments:o}}function Bc(e){return`error`in e}function X(){throw new C(`redaction-unavailable`)}function Vc(e,t){return(typeof e!=`object`||!e||!Array.isArray(e.texts)||e.texts.length!==t)&&X(),e.texts}function Hc(){return{async redact(e){let t;try{t=await fetch(nt(`/api/secrets/redact-export`),{method:`POST`,headers:rt({"content-type":`application/json`}),body:JSON.stringify({texts:e})})}catch{X()}t.ok||X();let n;try{n=await t.json()}catch{X()}return Vc(n,e.length)}}}function Uc(){return{async redact(e){let t;try{t=await new Promise(t=>{chrome.runtime.sendMessage({type:`secrets.redact-export`,texts:e},e=>{chrome.runtime.lastError,t(e??null)})})}catch{X()}return typeof t==`object`&&t&&Bc(t)&&X(),Vc(t,e.length)}}}function Wc(){return{async redact(e){let t;try{t=await at(`secrets.redact-export`,{texts:e})}catch{X()}return t??X(),typeof t==`object`&&t&&Bc(t)&&X(),Vc(t,e.length)}}}function Gc(){return{async redact(e){X()}}}function Kc(){let e=it();return e===`connect`?Gc():e===`extension-direct`?Uc():e===`extension-delegate`?Wc():Hc()}function Z(e){switch(e){case`processing`:return`working`;case`error`:return`broken`;case`initializing`:return`initializing`;default:return`idle`}}function qc(e,t={}){let n=Z(t.status),r=ln(e);return{id:e.jid,parentId:e.parentJid,role:O(e)?`primary`:`child`,name:e.name,folder:e.folder,assistantLabel:e.assistantLabel,state:n,...n===`working`&&t.phase?{phase:t.phase}:{},...n===`idle`&&t.awaiting?{awaiting:!0}:{},fill:typeof t.fill==`number`?Math.round(t.fill*100):0,...typeof t.turns==`number`?{turns:t.turns}:{},...r?{model:r}:{},...e.trigger?{trigger:e.trigger}:{},...e.addedAt?{addedAt:e.addedAt}:{}}}function Jc(e,t=Date.now){let n=e.parentId===null,r=e.folder??e.name,i=n?e.config:Yc(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 Yc(e,t){let n=dn(e.workspace?.mode??e.config?.workspaceMode),r=e.workspace?.from??`/workspace`,i=xn(n,t,{root:r},e.workspace?.from),a=e.config;return{...a,workspaceMode:n,visiblePaths:a?.visiblePaths===void 0?i.visiblePaths:a.visiblePaths,writablePaths:a?.writablePaths===void 0?i.writablePaths:a.writablePaths}}var Xc=`padding:0.5rem 1.25rem;border-radius:0.375rem;cursor:pointer;font:inherit;font-size:0.875rem;`,Zc=`${Xc}border:none;background:var(--s2-accent-color,#0265dc);color:#fff;`,Qc=`${Xc}border:none;background:#d23;color:#fff;`,$c=`${Xc}background:transparent;border:1px solid var(--s2-border-color,#e0e0e0);color:inherit;`;function el(e,t,n){return{...Jc({parentId:null,name:e,folder:`cone-pending-${t.length+1}`}),assistantLabel:e,...n?{model:n}:{}}}function tl(e,t){let n=e.createElement(`slicc-dialog`);n.setAttribute(`heading`,t.heading),n.append(t.body);for(let r of t.actions){let t=e.createElement(`button`);t.setAttribute(`slot`,`footer`),t.type=`button`,t.dataset.coneAction=r.data,t.textContent=r.text,t.style.cssText=r.style,t.addEventListener(`click`,r.onClick),n.append(t)}return n.addEventListener(`slicc-dialog-close`,()=>t.onDismiss(n)),n}function nl(e,t){let n=e.createElement(`form`);n.style.cssText=`display:flex;flex-direction:column;gap:0.5rem;padding:0.25rem 0;`;let r=`font-size:0.9375rem;padding:0.5rem 0.625rem;border:1px solid var(--s2-border-color,#e0e0e0);border-radius:0.375rem;background:transparent;color:inherit;font-family:inherit;`,i=e.createElement(`input`);i.type=`text`,i.name=`name`,i.placeholder=`Name`,i.setAttribute(`aria-label`,`Cone name`),i.maxLength=40,i.autocomplete=`off`,i.required=!0,i.style.cssText=r;let a=e.createElement(`textarea`);a.name=`brief`,a.placeholder=`What should it work on? (optional)`,a.setAttribute(`aria-label`,`What the cone should work on`),a.rows=3,a.style.cssText=`${r}resize:vertical;`,n.append(i,a);let o=()=>({name:i.value.trim(),brief:a.value.trim()});return n.addEventListener(`submit`,e=>{e.preventDefault(),t(o())}),a.addEventListener(`keydown`,e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),t(o()))}),n.readDraft=o,n}function rl(e){let{freezer:t,client:n,log:r}=e,i=t.ownerDocument,a=null,o=!1,s=null,c=()=>t.querySelector(`slicc-freezer-new`),l=()=>Dn(e.getUnits(),e.getSelected()),u=t=>e.getUnits().find(e=>e.id===t.jid)??qc(t),d=()=>{if(!s)return;let e=s;s=null,e.hide?.(),e.remove()},f=e=>{d();let t=tl(i,{...e,onDismiss:e=>{s===e&&(s=null),e.remove()}});s=t,i.body.append(t),t.show?.()},p=t=>{if(!t.name)return;d();let i=l(),o=el(t.name,n.getScoops(),Fn(e.getUnits(),i?.id));a=t.name,n.registerScoop(o,t.brief?{description:t.brief,prompt:t.brief}:{}).catch(e=>r.warn(`WC cone create failed`,e)),_()},m=()=>{let e=nl(i,p);f({heading:`New cone`,body:e,actions:[{text:`Create`,style:Zc,data:`create`,onClick:()=>p(e.readDraft())},{text:`Cancel`,style:$c,data:`cancel`,onClick:d}]}),queueMicrotask(()=>e.querySelector(`input`)?.focus())},h=t=>{d();let i=cn(n.getScoops()),a=i.find(e=>e.jid===t);if(!a||i.length<=1||o){_();return}o=!0,_(),(async()=>{try{await e.freezeCone(a)}catch(e){r.warn(`WC cone freeze before drop failed`,e)}let t=l()?.id===a.jid;try{await n.unregisterScoop(a.jid)}catch(e){r.warn(`WC cone drop failed`,e)}if(t){let t=cn(n.getScoops()).find(e=>e.jid!==a.jid);t&&e.selectScoop(u(t))}o=!1,_()})()},g=e=>{let t=Pn(e),n=i.createElement(`p`);n.textContent=`Its chat goes to the Freezer.`,n.style.cssText=`font-size:0.875rem;margin:0;`,f({heading:`Drop ${t}?`,body:n,actions:[{text:`Drop`,style:Qc,data:`drop`,onClick:()=>h(e.id)},{text:`Cancel`,style:$c,data:`cancel`,onClick:d}]})},_=()=>{let t=cn(n.getScoops());if(a!==null){let n=t.find(e=>e.name===a&&!e.folder.startsWith(`cone-pending-`));n&&(a=null,e.getSelected()?.id!==n.jid&&e.selectScoop(u(n)))}let r=c();r?.setAttribute(`cones`,String(t.length)),r?.toggleAttribute(`busy`,o)};return t.addEventListener(`new-cone`,m),t.addEventListener(`drop-cone`,()=>{let e=l();!e||cn(n.getScoops()).length<=1||o||g(e)}),_(),{refresh:_,dialog:()=>s}}var il={"gelatiere-dismiss":{consume:!0,mode:`dismiss`},"gelatiere-install":{consume:!1,mode:`take`},"gelatiere-try":{consume:!1,mode:`take`}};function al(e){return t=>{if(t.type!==`sprinkle`||t.sprinkleName!==`welcome`&&t.sprinkleName!==`inline`&&t.sprinkleName!==`suggestions`)return!1;let n=t.body,r=il[typeof n?.action==`string`?n.action:``];if(!r)return!1;let a=n?.data,o=typeof a?.id==`string`&&a.id?a.id:null;return o&&e.openVfs().then(async e=>{let t=await i(()=>import(`./wc-shell-DoXzfb-g.js`).then(e=>e.ft),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33]));return r.mode===`dismiss`?t.dismissGelatiereSuggestion(e,o):t.takeGelatiereSuggestion(e,o)}).catch(t=>e.log.warn(`gelatiere card settlement failed`,t)),r.consume}}var ol=5e3,sl=class{deps;listListeners=new Set;unitListeners=new Map;lastSnapshots=new Map;orphanedReplays=new Map;retriedSnapshots=new Set;pendingSnapshots=new Map;constructor(e){this.deps=e}toSummary(e){return qc(e,{awaiting:this.deps.getAwaiting?.()===e.jid,fill:this.deps.fills.get(e.jid),phase:this.deps.phases.get(e.jid),status:this.deps.statuses.get(e.jid),turns:this.deps.turns?.get(e.jid)})}snapshotFor(e,t,n){let r=this.deps.getClient()?.getScoops().find(t=>t.jid===e);return r?{summary:this.toSummary(r),messages:t,...n?{queuedIds:n}:{}}:null}currentUnits(){return(this.deps.getClient()?.getScoops()??[]).map(e=>this.toSummary(e))}publishSnapshot(e,t){this.retriedSnapshots.delete(e),this.lastSnapshots.set(e,t),this.emit(e,{snapshot:t,type:`snapshot`});let n=this.pendingSnapshots.get(e);if(n){this.pendingSnapshots.delete(e);for(let e of n)e(t)}}drainOrphanedReplays(){for(let[e,t]of this.orphanedReplays){let n=this.snapshotFor(e,t.messages,t.queuedIds);n&&(this.orphanedReplays.delete(e),this.publishSnapshot(e,n))}}recoverUnanswered(e){if(this.unitListeners.has(e)){if(this.retriedSnapshots.has(e)){this.publishRecovery(e);return}this.retriedSnapshots.add(e),this.deps.getClient()?.requestScoopMessages(e),setTimeout(()=>{this.retriedSnapshots.has(e)&&this.publishRecovery(e)},ol)}}publishRecovery(e){if(!this.unitListeners.has(e))return;let t=this.lastSnapshots.get(e),n=this.deps.getClient()?.getScoops().find(t=>t.jid===e);this.emit(e,{snapshot:{messages:t?.messages??[],...n?{summary:this.toSummary(n)}:{}},type:`snapshot`})}forgetWaiter(e,t){let n=this.pendingSnapshots.get(e);n&&(n.delete(t),n.size===0&&this.pendingSnapshots.delete(e))}emitList(){if(this.drainOrphanedReplays(),this.listListeners.size===0)return;let e=this.currentUnits();for(let t of this.listListeners)t(e)}emit(e,t){let n=this.unitListeners.get(e);if(n)for(let e of n)e(t)}wrapCallbacks(e){return{...e,onStatusChange:(t,n)=>{e.onStatusChange(t,n),this.emit(t,{state:Z(n),type:`status`}),this.emitList()},onScoopCreated:t=>{e.onScoopCreated(t),this.emitList()},onScoopListUpdate:t=>{e.onScoopListUpdate(t),this.emitList()},onScoopPhaseChange:(t,n)=>{e.onScoopPhaseChange?.(t,n),this.emitList()},onIncomingMessage:(t,n)=>{e.onIncomingMessage(t,n),this.emit(t,{message:n,type:`message`})},onScoopMessagesReplaced:(t,n,r)=>{e.onScoopMessagesReplaced?.(t,n,r);let i=n,a=this.snapshotFor(t,i,r);a?this.publishSnapshot(t,a):this.orphanedReplays.set(t,{messages:i,queuedIds:r})}}}list(){return Promise.resolve(this.currentUnits())}subscribeList(e){return this.listListeners.add(e),e(this.currentUnits()),()=>{this.listListeners.delete(e)}}subscribe(e,t){let n=this.unitListeners.get(e)??new Set;n.add(t),this.unitListeners.set(e,n);let r=this.lastSnapshots.get(e);return this.pendingSnapshots.has(e)||(r?t({snapshot:r,type:`snapshot`}):this.deps.getClient()?.requestScoopMessages(e)),()=>{n.delete(t),n.size===0&&this.unitListeners.delete(e)}}snapshot(e){let t=this.deps.getClient();if(!t)return Promise.reject(Error(`kernel client not attached`));let n=this.pendingSnapshots.get(e)??new Set;this.pendingSnapshots.set(e,n);let r=()=>{},i=new Promise(e=>{r=e,n.add(e)});t.setSelectedScoopJid(e),t.requestScoopMessages(e);let a,o=new Promise(t=>{a=setTimeout(()=>{a=void 0;let n=this.pendingSnapshots.get(e)?.has(r)===!0;this.forgetWaiter(e,r),n&&this.recoverUnanswered(e),t(this.snapshotFor(e,[],void 0))},ol)});return Promise.race([i.then(e=>(a!==void 0&&(clearTimeout(a),a=void 0),e)),o]).then(t=>{if(!t)throw Error(`unknown work unit: ${e}`);return t})}send(e,t){let n=this.deps.getClient();return n?(n.sendRaw({attachments:t.attachments,messageId:t.messageId??`msg-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,scoopJid:e,text:t.text,type:`user-message`,...t.steer?{steer:!0}:{},...t.guestGate?{guestGate:t.guestGate}:{}}),Promise.resolve()):Promise.reject(Error(`kernel client not attached`))}setModel(e,t){let n=this.deps.getClient();return n?n.setScoopModel(e,t):Promise.reject(Error(`kernel client not attached`))}signal(e,t){if(t!==`stop`)return Promise.resolve();let n=this.deps.getClient();return n?(n.stopScoop(e),Promise.resolve()):Promise.reject(Error(`kernel client not attached`))}};function Q(e){return e.workUnits??=new sl({fills:e.fills,getAwaiting:()=>e.awaitingInput,getClient:()=>e.getClient(),phases:e.phases,statuses:e.statuses,turns:e.turns}),e.workUnits}function cl(e){let t=Q(e),n=()=>e.refreshScoops?.(),r=()=>(e.refs.thread.getAttribute(`context`)??``).startsWith(`freezer:`),i=()=>{if(e.getSelected()||r())return;let n=t.currentUnits(),i=e.pendingUrlContext;if(i?.startsWith(`freezer:`))return;if(i?.startsWith(`scoop:`)||i?.startsWith(`cone:`)){let t=On(n,i);if(t){e.pendingUrlContext=null,e.selectScoop(t);return}}let a=Rn(n);a&&(e.pendingUrlContext=null,e.selectScoop(a))};return t.wrapCallbacks({onStatusChange:(t,r)=>{let i=e.statuses.get(t),a=r;e.statuses.set(t,a),i!==a&&e.notifyUnitStatus?.(t,a),a!==`ready`&&e.awaitingInput===t&&(e.awaitingInput=null),Z(i)===`working`&&Z(a)!==`working`&&e.turns.set(t,(e.turns.get(t)??0)+1),Z(i)!==Z(a)&&(n(),e.notifyScoopStateChanged?.()),e.getSelected()?.id===t&&e.getController()?.setProcessing(r===`processing`)},onScoopCreated:t=>{n(),!e.getSelected()&&!r()&&!e.pendingUrlContext&&e.selectScoop(qc(t,{fill:e.fills.get(t.jid),phase:e.phases.get(t.jid),status:e.statuses.get(t.jid)}))},onScoopListUpdate:t=>{let r=new Set(t.map(e=>e.jid));for(let t of e.lickBackpressure.keys())r.has(t)||e.lickBackpressure.delete(t);for(let t of e.turns.keys())r.has(t)||e.turns.delete(t);n(),i()},onScoopActivity:t=>{e.refs.switcher.setAttribute(`attention`,t)},onScoopPhaseChange:(t,r)=>{e.phases.set(t,r),n(),e.notifyScoopStateChanged?.()},onIncomingMessage:(t,n)=>{e.refs.switcher.setAttribute(`attention`,t),e.lastActivity.set(t,String(n.content??``).slice(0,600)),e.getSelected()?.id===t&&n.channel!==`web`&&ne(n.channel)&&e.getController()?.addLickMessage(n.id,n.content,n.channel,new Date(n.timestamp).getTime(),n.lickId)},onLickBackpressure:(t,n)=>{n.count<=0?e.lickBackpressure.delete(t):e.lickBackpressure.set(t,n);let r=e.getSelected();if(r?.id!==t)return;let i=zn(r);e.getController()?.setLickBackpressure(n.count,n.waitingMs,i)},onMessageUpdate:(t,n)=>{e.getSelected()?.id===t&&n.lickId&&n.lickState&&e.getController()?.updateLickState(n.lickId,n.lickState)},onReady:()=>{n(),i(),e.notifyReady?.()}})}var ll=`slicc:leader-local-model-state-changed`;function ul(e=window){e.dispatchEvent(new Event(ll))}var dl=`slicc:leader-model-catalog-changed`;function fl(e=window){e.dispatchEvent(new Event(dl))}var pl={off:`off`,low:`low`,medium:`medium`,high:`high`,xhigh:`xhigh`,max:`xhigh`},ml={off:`off`,minimal:`low`,low:`low`,medium:`medium`,high:`high`,xhigh:`xhigh`};function hl(e){return e?pl[e]:void 0}function gl(e){return e===`max`?`max`:void 0}function _l(e,t){return t===`max`?`max`:(e&&ml[e])??`off`}var vl=2e3,yl=1e4,bl=12e4;function xl(e){let t=[],n=null,r=new Map,i=e.modelPickerEnabled!==!1,a=e.catalogRetryDelayMs??vl,o=e.catalogRetryMaxDelayMs??yl,s=e.catalogRetryWindowMs??bl,c=0,l=null,u=null,d=()=>{if(!i||u!==null)return;let t=Date.now();if(l===null&&(l=t+s),t>=l)return;let n=Math.min(a*2**c,o);u=setTimeout(()=>{u=null;let t=e.getSync();t?.requestModels&&(c+=1,t.requestModels())},n)},f=()=>{u!==null&&clearTimeout(u),u=null,c=0,l=null},p=e=>{if(e.length===0)return;let t=new Set(e.map(e=>e.id));for(let e of r.keys())t.has(e)||r.delete(e)},m=()=>{let t=e.getSelectedScoopJid(),i=e.getUnits();if(p(i),n&&(i.length===0||!t))return n.activeModelId;if(n&&t&&n.scoopJid===t){let e=pn(n.activeModelId);return e&&r.set(t,e),n.activeModelId}let a=Fn(i,t,t?r.get(t):void 0);return t&&a&&r.set(t,a),a?hn(a):void 0},h=()=>{let r=m(),a=r?t.find(e=>e.modelId===r):void 0;if(!i||!n||!a){e.composerMeta.style.display=`none`,d();return}e.composerMeta.model=a.modelName,e.composerMeta.setAttribute(`thinking`,_l(n.thinkingLevel,n.effortOverride)),e.composerMeta.toggleAttribute(`no-thinking`,!a.reasoning),e.composerMeta.style.removeProperty(`display`),f()},g=t=>{e.interceptLocalHandlers&&t.stopImmediatePropagation()},_=t=>{let i=e.getSync();if(!i)return;g(t);let a=t.detail?.id,o=e.getSelectedScoopJid()??n?.scoopJid,s=a?pn(a):null;s&&o?(r.set(o,s),e.setModel(o,s)):a&&i.selectModel(a,o??void 0),h()};e.composerMeta.addEventListener(`model-change`,_,{capture:e.interceptLocalHandlers});let v=t=>{let r=e.getSync();if(!r)return;if(g(t),e.getLockedEffortLevel?.()){h();return}let i=t.detail?.thinking,a=hl(i),o=e.getSelectedScoopJid()??n?.scoopJid;o&&a&&a!==`max`&&r.setThinkingLevel(o,a,gl(i)),h()};e.composerMeta.addEventListener(`thinking-change`,v,{capture:e.interceptLocalHandlers});let y=()=>{t=[],n=null,r.clear(),f(),e.composerMeta.models=[],e.composerMeta.style.display=`none`};return y(),{onModelsList(n){t=n,e.composerMeta.models=n.map(e=>({id:e.modelId,name:e.modelName,provider:e.providerName})),h()},onModelState(e){n=e,h()},onShownUnitChanged(){h()},reset:y,dispose(){e.composerMeta.removeEventListener(`model-change`,_,{capture:e.interceptLocalHandlers}),e.composerMeta.removeEventListener(`thinking-change`,v,{capture:e.interceptLocalHandlers}),y(),e.composerMeta.style.removeProperty(`display`)}}}async function Sl(e,t,n,r,i=ul){let a=await e.setScoopThinkingLevel(t,n,r);return a&&i(),a}function Cl(e,t){return In(e)===null||new URL(t.location.href).searchParams.get(`cherry`)===`1`||bt(t.localStorage)}async function wl(e,t,n,r,a){let o=jn(t),s=Nn(o);e.thread.setAttribute(`context`,Ln(t));let c=kn(t),l=p({isRoot:c,name:t.name});e.thread.setAttribute(`accent`,l),e.switcher.setAttribute(`active`,t.id),de(e,c?{kind:`cone`}:{kind:`scoop`,accent:l}),ce(e,s);let u=localStorage.getItem(`slicc_locked_effort_level`),d=r?.(t.id);if(d||u){let t=d?un(d):{};e.composerMeta.setAttribute(`thinking`,_l(u??t.level,t.effortOverride))}if(!a?.skipModelPill)try{let{resolveCurrentModel:r,resolveModelById:a}=await i(async()=>{let{resolveCurrentModel:e,resolveModelById:t}=await import(`./main-Cb0XbEti.js`).then(e=>e.t);return{resolveCurrentModel:e,resolveModelById:t}},__vite__mapDeps([47,1,48,8,9,10,11,2,12,13,14,15,3,16,5,17,18,19,20,21,22,23,24,25,6,7,26,27,28,29,30,49,50])),o=Fn(n,t.id),s=o?a(o.id,o.provider):r();e.composerMeta.setAttribute(`model`,s.name??s.id),e.composerMeta.toggleAttribute(`no-thinking`,s.reasoning!==!0||!!u)}catch{}}async function Tl(e){if(Cl(e.pendingUrlContext,e.win))return;let t=In(e.pendingUrlContext);if(t===null)return;let[{CanonicalSessionReader:n},{WorkUnitConversationStore:r}]=await Promise.all([i(()=>Promise.resolve().then(()=>qn),void 0),i(()=>Promise.resolve().then(()=>sr),void 0)]),a=await new n(new r).loadRootChatSession(t);a&&a.messages.length>0&&!e.hasSelection()&&(e.loadMessages(a.messages),e.onHydrated())}function El(e){let{boot:t,client:n,openReader:r,log:a}=e,{refs:o}=t;i(async()=>{let{createPlaceholderRefresher:e}=await import(`./wc-placeholder-VBMLxjxW.js`);return{createPlaceholderRefresher:e}},__vite__mapDeps([51,2,0,1,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33])).then(({createPlaceholderRefresher:n})=>{e.setRefreshPlaceholder(n({inputCard:o.inputCard,getMessages:()=>t.getController()?.getMessages()??[],defaultPlaceholder:o.inputCard.getAttribute(`placeholder`)??`Ask sliccy, or describe a change…`}))}),Tl({pendingUrlContext:t.wiring.pendingUrlContext,win:window,hasSelection:()=>!!t.getSelected(),loadMessages:e=>t.getController()?.loadMessages(e),onHydrated:e.triggerPlaceholder}).catch(e=>a.warn(`WC session hydration failed`,e));let s=null;return i(async()=>{let{wireWcAttach:e}=await import(`./wc-attach-DhqcQmNK.js`);return{wireWcAttach:e}},__vite__mapDeps([52,2,5,53])).then(({wireWcAttach:t})=>{s=t({inputCard:o.inputCard,freezer:o.freezer,composer:o.composer,openReader:r,openWriter:e.openWriter,secretEntry:!0,listConversations:async()=>{let{readSessionsIndex:e}=await i(async()=>{let{readSessionsIndex:e}=await Promise.resolve().then(()=>Ea);return{readSessionsIndex:e}},void 0);return(await e(await r())).map(e=>({id:e.filename,label:e.title,sub:`${e.messageCount} turns`}))},log:a})}).catch(e=>a.error(`WC add-menu wiring failed`,e)),i(async()=>{let{wireWcHistoryNav:e}=await import(`./wc-history-nav-C5w8ianG.js`);return{wireWcHistoryNav:e}},[]).then(({wireWcHistoryNav:e})=>e({thread:o.thread,inputCard:o.inputCard})).catch(e=>a.error(`WC history nav wiring failed`,e)),o.composerMeta.addEventListener(`thinking-change`,e=>{if(localStorage.getItem(`slicc_locked_effort_level`))return;let r=e.detail?.thinking,i=hl(r),o=gl(r),s=t.getSelected();s&&i&&Sl(n,s.id,i,o).catch(e=>a.warn(`local thinking update failed`,e))}),{getAttachStage:()=>s}}var Dl=`slicc:leader-run-new-session`,Ol=`slicc:leader-broadcast-snapshot`;function kl(e){if(!(!e.cone||e.cone===`cone`))return e.coneLabel||e.cone.replace(/^cone-/,``)}function Al(e){let t=`${new Date(e.frozenAt).toLocaleDateString(void 0,{month:`short`,day:`numeric`})} · ${e.messageCount} turns`;return e.live?`${t} · in progress`:t}function jl(e){let t=document.createElement(`slicc-freezer-card`);return t.setAttribute(`title`,e.title),t.setAttribute(`meta`,Al(e)),t.setAttribute(`slug`,e.filename),e.icon&&t.setAttribute(`icon`,e.icon),t}async function Ml(e){let t=new Map;for(let n of e.entries){if(n.icon||n.pendingEnrichment)continue;let r=await e.pickIcon(`"${n.title}" — an archived chat session`);r&&t.set(n.filename,r)}if(t.size===0)return;let n=await Nl(e.reader);if(n===null||n.length===0)return;let r=n.map(e=>{let n=!e.icon&&t.has(e.filename)?t.get(e.filename):void 0;return n?{...e,icon:n}:e});await e.writer.writeFile(E,JSON.stringify(r,null,2));for(let n of e.freezer.querySelectorAll(`slicc-freezer-card`)){let e=t.get(n.getAttribute(`slug`)??``);e&&!n.hasAttribute(`icon`)&&n.setAttribute(`icon`,e)}}async function Nl(e){let t=await Pl(e);return t.kind===`ok`?t.entries:t.kind===`missing`?[]:null}async function Pl(e){let t;try{let n=await e.readFile(E,{encoding:`utf-8`});t=typeof n==`string`?n:new TextDecoder().decode(n)}catch(e){return e?.code===`ENOENT`?{kind:`missing`}:{kind:`fault`}}try{let e=JSON.parse(t);return Array.isArray(e)?{kind:`ok`,entries:e}:{kind:`corrupt`}}catch{return{kind:`corrupt`}}}async function Fl(e){let t;try{t=(await e.readDir(`/sessions`)).filter(e=>e.type===`file`&&e.name.endsWith(`.md`)).map(e=>e.name)}catch{return[]}let n=[];for(let r of t)try{let t=await e.readFile(`/sessions/${r}`,{encoding:`utf-8`}),i=typeof t==`string`?t:new TextDecoder().decode(t);n.push(Il(r,i))}catch{}return n.sort((e,t)=>t.frozenAt.localeCompare(e.frozenAt)),n}function Il(e,t){let n=t.slice(0,2e3),r=/^title:\s*"?(.*?)"?\s*$/m.exec(n)?.[1]??e,i=/^frozenAt:\s*"?(.*?)"?\s*$/m.exec(n)?.[1]??new Date(0).toISOString(),a=Number(/^messageCount:\s*(\d+)\s*$/m.exec(n)?.[1]??0),o=Ve(t),s=e.startsWith(`pending-`)||e.startsWith(`live-`)&&!o.live;return{filename:e,title:r,frozenAt:i,messageCount:a,...o.cost?{cost:o.cost}:{},...o.models?{models:o.models}:{},...o.cone?{cone:o.cone}:{},...o.coneLabel?{coneLabel:o.coneLabel}:{},...o.memorySkipped?{memorySkipped:!0}:{},...o.live?{live:!0}:{},...o.live&&o.liveThrough?{liveThrough:o.liveThrough}:{},...o.live&&o.compactions?{compactions:o.compactions}:{},...o.id?{sessionId:o.id}:{},...s?{pendingEnrichment:!0}:{}}}function Ll(e,t){for(let t of Array.from(e.querySelectorAll(`slicc-freezer-card`)))t.remove();e.append(...t.map(jl))}async function Rl(e,t){let n=await e.readFile(tt(t),{encoding:`utf-8`}),r=typeof n==`string`?n:new TextDecoder().decode(n),i=await Je(e,r,t.filename);return{title:i.title||t.title,messages:i.messages}}async function zl(e,t){let{getTranscriptExportService:n}=await i(async()=>{let{getTranscriptExportService:e}=await Promise.resolve().then(()=>yr);return{getTranscriptExportService:e}},void 0);await n().captureFrozen({sessionId:t.sessionId??t.archive.id,title:t.archive.title,frozenAt:t.archive.frozenAt,createdAt:t.archive.createdAt,updatedAt:t.archive.updatedAt,...e?{rootJid:e.jid}:{}})}function Bl(e,t){if(t)return e.getScoops().find(e=>e.jid===t.id)}function Vl(e){return{folder:e.folder,label:Pn({assistantLabel:e.assistantLabel,name:e.name,role:O(e)?`primary`:`child`}),jid:e.jid}}async function Hl(e){let{root:t}=e,n=t?Vl(t):void 0,r=e=>zl(t,e),a=t=>{i(async()=>{let{notifyGelatiereOfSessionEnd:e}=await import(`./wc-gelatiere-B8nCJB4g.js`);return{notifyGelatiereOfSessionEnd:e}},__vite__mapDeps([54,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,47,48,49,50])).then(({notifyGelatiereOfSessionEnd:r})=>r({client:e.client,vfs:e.writer,log:e.log,cone:n,archive:t?.filename})).catch(t=>e.log.warn(`gelatiere notification failed to load`,t))};if(e.action!==`save`){await e.runNewSessionFreezeQuick({vfs:e.writer,cone:n,captureCompleteSnapshot:r,onSessionSettled:a});return}await e.runNewSessionFreeze({vfs:e.writer,cone:n,agenticMemorySpawn:t=>e.client.spawnAgent(t),captureCompleteSnapshot:r,onSessionSettled:a,onProgress:t=>{let n=e.freezerNew();n&&(t===null?n.removeAttribute(`progress`):n.setAttribute(`progress`,String(t)))},onBackgroundEnriched:e.refreshFreezer})}async function Ul(e,t){e!==`erase`&&await Hl({...t,action:e})}async function Wl(e){try{await e.resetNewSessionTmp(e.writer,e.tmpDir)}catch(t){e.log.warn(`WC new session /tmp reset failed — clearing anyway`,t)}await e.client.clearAllMessages(e.root?.jid,e.discardLiveSnapshot?{discardLiveSnapshot:!0}:{}),e.getController()?.loadMessages([]),window.dispatchEvent(new CustomEvent(Ol)),i(async()=>{let{resetDictationPriming:e}=await import(`./wc-shell-DoXzfb-g.js`).then(e=>e.tt);return{resetDictationPriming:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33])).then(({resetDictationPriming:e})=>e()).catch(()=>void 0)}function Gl(e,t){(e.thread.inner??e.thread).prepend(Kl(e.thread.ownerDocument,t)),e.thread.setAttribute(`accent`,pe),de(e,{kind:`freezer`}),e.inputCard.setAttribute(`disabled`,``),e.switcher.removeAttribute(`active`)}function Kl(e,t){let n=t?kl(t):void 0,r=e.createElement(`slicc-day-separator`);return r.setAttribute(`label`,n?`Frozen chat · from cone ${n}`:`Frozen chat`),r.setAttribute(`data-frozen-provenance`,n??``),r}function ql(e){let{refs:t,openVfs:n,client:r,getController:a,getSelected:o,clearSelection:s,log:c}=e,l=[],u=null,d=t=>{u=null,e.selectScoop(t)},f=0,p=!1,m=()=>{let e=++f;n().then(async({reader:n,writer:r})=>{let a=await Nl(n);if(a===null){if((await Pl(n)).kind!==`corrupt`||(c.warn(`WC freezer index corrupt — rebuilding from archives`),a=await Fl(n),a.length===0))return;await r.writeFile(E,JSON.stringify(a,null,2))}e===f&&(l=a,Ll(t.freezer,a),!p&&a.some(e=>!e.icon&&!e.pendingEnrichment)&&(p=!0,i(async()=>{let{pickLucideIcon:e}=await import(`./quick-llm-BFOKPe7I.js`).then(e=>e.n);return{pickLucideIcon:e}},__vite__mapDeps([42,1,9,10,11,2,12,13,14,3,7,8,15,16,5,17,18,19,20,21,22,23,24,25,26,27,28,29,43,32])).then(({pickLucideIcon:e})=>Ml({reader:n,writer:r,freezer:t.freezer,entries:a,pickIcon:t=>e({subject:t})})).catch(e=>c.warn(`WC freezer icon enrichment failed`,e)).finally(()=>{p=!1})))}).catch(e=>c.error(`WC freezer refresh failed`,e))},h=!1,g=()=>t.freezer.querySelector(`slicc-freezer-new`),_=t=>{h||(h=!0,g()?.setAttribute(`busy`,``),(async()=>{let s=Bl(r,Dn(e.getUnits(),o()));try{let{writer:o}=await n(),{resetNewSessionTmp:l,runNewSessionFreeze:u,runNewSessionFreezeQuick:f}=await i(async()=>{let{resetNewSessionTmp:e,runNewSessionFreeze:t,runNewSessionFreezeQuick:n}=await import(`./new-session-YYnEc0rh.js`);return{resetNewSessionTmp:e,runNewSessionFreeze:t,runNewSessionFreezeQuick:n}},__vite__mapDeps([55,2,3,7,1,8,9,10,11,12,13,14,15,16,5,17,18,19,20,21,22,23,24,25,26,27,28,29,47,48,6,30,49,50,43]));await Ul(t,{writer:o,root:s,client:r,freezerNew:g,refreshFreezer:m,runNewSessionFreeze:u,runNewSessionFreezeQuick:f,log:c}),await Wl({writer:o,root:s,client:r,getController:a,log:c,resetNewSessionTmp:l,tmpDir:bn(r.getScoops(),s),discardLiveSnapshot:t===`erase`}),m();let p=e.getUnits().find(e=>e.id===s?.jid)??Rn(e.getUnits());p&&d(p)}catch(e){c.error(`WC new session failed`,e)}finally{h=!1;let e=g();e?.removeAttribute(`busy`),e?.removeAttribute(`progress`)}})())};for(let e of[`save`,`skip`,`erase`])t.freezer.addEventListener(`new-chat-${e}`,()=>_(e));let v=async e=>{let{writer:t}=await n(),{runNewSessionArchiveOnly:r}=await i(async()=>{let{runNewSessionArchiveOnly:e}=await import(`./new-session-YYnEc0rh.js`);return{runNewSessionArchiveOnly:e}},__vite__mapDeps([55,2,3,7,1,8,9,10,11,12,13,14,15,16,5,17,18,19,20,21,22,23,24,25,26,27,28,29,47,48,6,30,49,50,43]));await r({vfs:t,cone:Vl(e),captureCompleteSnapshot:t=>zl(e,t)}),m()};gt(`agentic-memory`)&&g()?.setAttribute(`no-skip`,``),window.addEventListener(Dl,e=>{let t=e.detail?.action;(t===`save`||t===`skip`||t===`erase`)&&_(t)});let y=async r=>{let i=l.find(e=>e.filename===r);try{let{reader:o}=await n();i||=(await Nl(o)??[]).find(e=>e.filename===r);let{messages:c}=await Rl(o,i??{filename:r,title:r,frozenAt:``,messageCount:0});t.thread.setAttribute(`context`,`freezer:${i?.filename??r}`),u=i?.sessionId??i?.filename??null,e.holdQueuedPile(),a()?.loadMessages(c),Gl(t,i),s()}catch(t){if(c.error(`WC thaw failed`,t),!o()){let t=An(e.getUnits(),i?.cone);t&&d(t)}}};return t.freezer.addEventListener(`freezer-card-select`,e=>{let t=e.detail?.slug;t&&y(t)}),{refreshFreezer:m,openFrozen:y,getViewedFrozenSessionId:()=>u,freezeCone:v}}o(`scoops.tray-leave`),o(`scoops.tray-join`);var Jl=null;function Yl(e){Jl=e}function Xl(){return Jl?.()??[]}var Zl=null;function Ql(e){Zl=e}function $l(){return Zl??void 0}var eu=`slicc.leaderTrayFollowers`;function tu(){return nu()}function nu(){if(Jl)return Jl();try{let e=globalThis.localStorage?.getItem(eu);if(e)return JSON.parse(e)}catch{}return[]}function ru(e,t=globalThis.localStorage){try{t?.setItem(eu,JSON.stringify(e))}catch{}}function iu(e){try{let t=JSON.parse(e);return{processes:(t.processes??[]).filter(e=>e.status===`running`||e.status===`pending`).map(e=>({pid:Number(e.pid??0),argv:String(e.argv??``),status:String(e.status??`unknown`)})),terminated:Number(t.stats?.terminated??0)}}catch{return{processes:[],terminated:0}}}function au(e){let t=ht();if(t.state!==`inactive`)return{role:`follower`,state:t.state,joinUrl:t.joinUrl,sessionId:t.trayId,workerBaseUrl:wt(t.joinUrl)?.workerBaseUrl??null,stalled:t.stalled};let n=an();if(n.state!==`inactive`)return{role:`leader`,state:n.state,joinUrl:n.session?.joinUrl,sessionId:n.session?.trayId,workerBaseUrl:n.session?.workerBaseUrl};let r=null;try{r=_t(e.getItem(Ct))}catch{}return{role:`standalone`,state:`inactive`,workerBaseUrl:r}}function ou(e){let{client:t,openReader:n,storage:r}=e;return{getScoops:()=>t.getScoops(),isProcessing:e=>t.isProcessing(e),getCronTasks:async()=>{let{getAllCronTasks:e}=await i(async()=>{let{getAllCronTasks:e}=await import(`./tray-leader-CkymiaHT.js`).then(e=>e.o);return{getAllCronTasks:e}},__vite__mapDeps([56,1,3,16,2,5,17,18,19,47,48,8,9,10,11,12,13,14,15,20,21,22,23,24,25,6,7,26,27,28,29,30,49,50]));return e()},getWebhooks:async()=>{let{getAllWebhooks:e}=await i(async()=>{let{getAllWebhooks:e}=await import(`./tray-leader-CkymiaHT.js`).then(e=>e.o);return{getAllWebhooks:e}},__vite__mapDeps([56,1,3,16,2,5,17,18,19,47,48,8,9,10,11,12,13,14,15,20,21,22,23,24,25,6,7,26,27,28,29,30,49,50]));return e()},getMounts:async()=>{let{getAllMountEntries:e,loadMountHandle:t}=await i(async()=>{let{getAllMountEntries:e,loadMountHandle:t}=await import(`./mount-table-store-dY2IfQ5S.js`).then(e=>e.r);return{getAllMountEntries:e,loadMountHandle:t}},__vite__mapDeps([57,1])),n=await e();return Promise.all(n.map(async e=>{if(e.descriptor.kind!==`local`)return e;try{let n=await(await t(e.descriptor.idbHandleKey))?.queryPermission?.({mode:`readwrite`});return{...e,valid:n===`granted`}}catch{return{...e,valid:!1}}}))},getMcpServers:async()=>{try{let e=await(await n()).readFile(`/workspace/.mcp/servers.json`,{encoding:`utf-8`});return JSON.parse(typeof e==`string`?e:new TextDecoder().decode(e)).servers??{}}catch{return{}}},getOAuthProviders:()=>{try{let e=new Set,t=[];for(let n of Me()){if(e.has(n.providerId))continue;if(e.add(n.providerId),!Ae(n.providerId)?.isOAuth){t.push({providerId:n.providerId});continue}let r=Ne(n.providerId),i=n.loggedOut?!1:r?!r.expired:!1;t.push({providerId:n.providerId,valid:i})}return t}catch{return[]}},getSessionStats:async()=>t.getSessionStats?.()??null,getProcesses:async()=>{try{let e=await(await n()).readFile(`/proc/table`,{encoding:`utf-8`});return iu(typeof e==`string`?e:new TextDecoder().decode(e))}catch{return{processes:[],terminated:0}}},getTrayInfo:()=>au(r),getConnectedFollowers:Xl}}var su=`sync-fs-nonce`;function cu(e={}){let t=e.navigator??(typeof navigator<`u`?navigator:void 0),n=e.document??(typeof document<`u`?document:void 0),r=e.window??(typeof window<`u`?window:void 0),i=e.randomUUID??(()=>crypto.randomUUID()),a=!!t?.serviceWorker?.controller,o=a?i():void 0;if(!o||!t?.serviceWorker)return{syncFsBridgeEnabled:a,syncFsChannelNonce:o};let s=t.serviceWorker,c={type:su,nonce:o},l=()=>s.controller?.postMessage(c);return l(),s.addEventListener(`controllerchange`,l),s.addEventListener(`message`,e=>{e.data?.type===`sync-fs-need-nonce`&&l()}),n?.addEventListener(`visibilitychange`,()=>{n.visibilityState===`visible`&&l()}),r?.addEventListener(`focus`,l),{syncFsBridgeEnabled:a,syncFsChannelNonce:o}}var lu=class{#e=new Map;#t=new Map;#n=new Map;sync(e,t){let n=new Set;for(let r of e){if(!kn(r))continue;n.add(r.id);let e=this.#r(r);e>0&&r.id!==t&&this.#e.set(r.id,(this.#e.get(r.id)??0)+e)}t&&this.#e.delete(t);for(let e of[...this.#e.keys()])n.has(e)||this.#e.delete(e);for(let e of[...this.#t.keys()])n.has(e)||this.#t.delete(e);for(let e of[...this.#n.keys()])n.has(e)||this.#n.delete(e);return this.counts()}#r(e){let t=this.#t.get(e.id),n=this.#t.has(e.id);if(this.#t.set(e.id,e.state),typeof e.turns==`number`&&Number.isFinite(e.turns)){let t=this.#n.get(e.id)??(n?0:void 0);return this.#n.set(e.id,e.turns),t===void 0?0:e.turns>t?Math.floor(e.turns-t):0}return this.#n.delete(e.id),n&&t===`working`&&e.state!==`working`?1:0}counts(){return new Map(this.#e)}};function uu(e,t){let n=e=>{t.onError?.(e instanceof Error?e.message:String(e))};return{sendMessage:(r,i,a,o)=>{let s=t.getSelectedId();if(!s){t.onError?.(`No scoop selected`);return}e.send(s,{text:r,...i?{messageId:i}:{},...a?{attachments:a}:{},...o?.steer?{steer:!0}:{},...o?.guestGate?{guestGate:o.guestGate}:{}}).catch(n)},onEvent:e=>t.onEvent(e),stop:()=>{let r=t.getSelectedId();r&&e.signal(r,`stop`).catch(n)}}}var du=`<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg>`;function fu(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n.role===`assistant`&&!n.isStreaming&&!n.queued)return n.content}for(let t=e.length-1;t>=0;t--)if(e[t].role===`assistant`)return e[t].content;return null}function pu(e){let t=e.writeText??(e=>navigator.clipboard.writeText(e)),n=document.createElement(`div`);n.className=`wc-copy-row`,n.style.cssText=`display:flex;justify-content:flex-start;margin:-8px 0 14px;`;let r=document.createElement(`slicc-press-button`);r.setAttribute(`tooltip`,`Copy last response · hold to copy chat`),r.setAttribute(`label`,`Copy last response — hold to copy entire chat`),r.setAttribute(`disable-double-click`,``),r.style.cssText=`color:var(--txt-3);cursor:pointer;display:inline-flex;`;let i=document.createRange();r.append(i.createContextualFragment(du));let a=()=>{r.style.color=`var(--green)`,setTimeout(()=>{r.style.color=`var(--txt-3)`},1500)};return r.addEventListener(`short-click`,()=>{(async()=>{let n=fu(e.getMessages());await t(n??We([...e.getMessages()])),a()})()}),r.addEventListener(`long-press`,()=>{(async()=>{let n=We([...e.getMessages()]);n&&(await t(n),a())})()}),n.append(r),n}function $(){return`msg-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}function mu(e){try{let t=new DOMParser().parseFromString(e,`text/html`).querySelector(`.sprinkle-action-card__header`);if(t){t.querySelector(`.sprinkle-badge`)?.remove(),t.querySelector(`.sprinkle-action-card__meta`)?.remove();let e=t.textContent?.trim();if(e)return e}}catch{}return`Approval requested`}function hu(e){return`
|
|
423
|
-
<div class="sprinkle-action-card">
|
|
424
|
-
<div class="sprinkle-action-card__header">${qt(mu(e))} <span class="sprinkle-badge sprinkle-badge--informative">pending</span></div>
|
|
425
|
-
<div class="sprinkle-action-card__body">Waiting for approval on the leader…</div>
|
|
426
|
-
</div>
|
|
427
|
-
`}function gu(e){let t={id:e.id,text:e.content};return e.attachments?.length&&(t.attachments=e.attachments.length),t}var _u=class e{#e;#t;#n;#r;#i;#a=null;#o;#s;#c;#l;#u;#d;#f;#p;#m;#h;#g;#_;#v;#y=[];#b=[];#x=null;#S=new Map;#C=null;#w=null;#T=``;#E=null;#D=null;#O=!1;#k=`thinking`;#A=0;#j=null;#M=new Set;#N=new Map;#P=new Map;#F=new Set;#I=!1;#L=null;constructor(e){this.#e=e.thread,this.#t=e.agent,this.#n=e.onProcessingChange,this.#r=e.onBusyPhaseChange,this.#i=e.onToolProgressChange,this.#o=e.onMessageRendered,this.#s=e.onMessageDisposed,this.#c=e.onTurnComplete,this.#l=e.resolveTelemetryContext,this.#u=e.onQueuedChange,this.#d=e.onLickBackpressureChange,this.#f=e.onQueuedCancel,this.#p=e.onToolUiAction,this.#m=e.readOnlyToolUi??!1,this.#h=e.agent.onEvent(e=>this.#J(e)),this.#v=e=>this.#ge(e),this.#e.addEventListener(`slicc-error-retry`,this.#v)}dispose(){this.#h(),this.#e.removeEventListener(`slicc-error-retry`,this.#v);for(let e of[...this.#N.keys()])this.#he(e);this.#P.clear(),this.#F.clear(),this.#me()}setReadOnly(e){if(this.#I!==e&&(this.#I=e,e))for(let e of[...this.#N.keys()])this.#he(e)}get readOnly(){return this.#I}get processing(){return this.#O}getMessages(){return this.#y.map(e=>({...e}))}setAgent(e){this.#h(),this.#t=e,this.#h=e.onEvent(e=>this.#J(e))}setOnLocalUserMessage(e){this.#g=e}setOnLocalProcessingChange(e){this.#_=e}addUserMessage(e,t,n){this.#ye({id:$(),role:`user`,content:e,timestamp:Date.now(),...n?{source:n}:{}})}getQueuedMessages(){return this.#b.map(gu)}removeQueuedMessage(e){let t=this.#b.filter(t=>t.id!==e);t.length!==this.#b.length&&(this.#b=t,this.#B())}stashQueued(){let e=this.#L??[];this.#L=null;let t=this.#b;return t.length===0?e:(this.#b=[],this.#B(),[...e,...t])}restoreQueued(e){this.#L=e.length>0?[...e]:null}heldBackendPendingIds(e){if(!this.#L||!e?.length)return new Set;let t=new Set(e);return new Set(this.#L.filter(e=>t.has(e.id)).map(e=>e.id))}#R(e,t){if(!this.#L)return;let n=this.heldBackendPendingIds(t),r=new Set(e.map(e=>e.id)),i=this.#L.filter(e=>!r.has(e.id)||n.has(e.id));if(this.#L=null,i.length===0)return;if(!t){this.#b=i,this.#B();return}let a=new Map(t.map((e,t)=>[e,t])),o=i.filter(e=>a.has(e.id)).sort((e,t)=>(a.get(e.id)??0)-(a.get(t.id)??0)),s=i.filter(e=>!a.has(e.id));if(this.#b=this.#O?o:[...o,...s],this.#B(),this.#O)for(let e of s)this.#ye(e)}#z(){if(this.#b.length===0)return;let e=this.#b;this.#b=[];for(let t of e)this.#ye(t);this.#B()}#B(){this.#u?.(this.#b.map(gu))}#V(){this.#d?.(this.#x)}setLickBackpressure(e,t,n){if(e<=0){if(!this.#x)return;this.#x=null,this.#V();return}this.#x={text:`${e} events waiting for the current turn`},this.#V();try{st(n,t)}catch{}}addAssistantMessage(e){this.#ye({id:$(),role:`assistant`,content:e,timestamp:Date.now()})}loadMessages(e,t){for(let e of this.#S.keys())this.#s?.(e);for(let e of[...this.#N.keys()])this.#he(e);this.#P.clear(),this.#F.clear(),this.#me();let n=this.#b.length>0;if(this.#b.length>0){if(this.#f)for(let e of this.#b)try{this.#f(e.id)}catch(e){console.error(`onQueuedCancel hook threw`,e)}this.#b=[]}n&&this.#B();let r=this.heldBackendPendingIds(t),i=r.size>0?e.filter(e=>!r.has(e.id)):e;this.#y=be(i);let a=[...this.#y].reverse().find(e=>e.isStreaming);this.#C=a?.id??null,a&&(this.#w=a.id),this.#Q(),this.#S.clear();let o=[],s=``;for(let e of this.#y){let t=new Date(e.timestamp).toDateString();t!==s&&(o.push(ee(e.timestamp)),s=t);let n=this.#ve(e);this.#S.set(e.id,n),o.push(...n)}let c=this.#e;typeof c.replaceContent==`function`?c.replaceContent(...o):c.replaceChildren(...o),this.#Ce();for(let e of this.#y)this.#o?.(e,this.#S.get(e.id)??[]);this.#q(),this.#Te(),this.#H(),this.#R(e,t)}#H(){if(this.#e.getAttribute(`context`)!==`cone`||this.#y.length===0||!xt()||this.#O)return;let e=this.#y[this.#y.length-1];e.role!==`user`||e.source===`lick`||e.source===`delegation`||e.queued||this.#ge(new Event(`slicc-error-retry`))}sendUserMessage(e,t,n){let r=e.trim();if(!r&&!t?.length)return;let i=n?.dictation?this.#U(r):r,a={id:$(),role:`user`,content:i,timestamp:Date.now(),attachments:t?.length?t:void 0};this.#O&&!n?.steer?(this.#b.push(a),this.#B()):this.#ye(a),n?.steer?this.#t.sendMessage(i,a.id,a.attachments,{steer:!0}):this.#t.sendMessage(i,a.id,a.attachments),this.#W();try{let e=n?.dictation?fe(i):i;this.#g?.(e,a.id,a.attachments)}catch(e){console.error(`onLocalUserMessage hook threw`,e)}}#U(e){return s(e,re())}#W(){if(this.#l)try{let e=this.#l();if(!e)return;ut(e.scoopName,e.model)}catch{}}addLickMessage(e,t,n,r,i){let a=this.#y[this.#y.length-1];if(!(i||a?.lickId)&&a&&a.source===`lick`&&a.channel===n){a.lickParts=[...a.lickParts??[a.content],t],a.lickCount=a.lickParts.length,a.content+=`\n\n${t}`,this.#be(a);return}this.#ye({id:e,role:`user`,content:t,timestamp:r,source:`lick`,channel:n,lickId:i,lickState:i?`pending`:void 0,queued:this.#O?!0:void 0})}updateLickState(e,t){let n=this.#y.find(t=>t.lickId===e);n&&(n.lickState=t,this.#be(n))}setProcessing(e){if(this.#O!==e){this.#O=e,e&&(this.#w=null),e&&(this.#A=0,this.#G(`thinking`)),e&&this.#z(),e||(this.#x&&(this.#x=null,this.#V()),this.#q()),this.#n?.(e);try{this.#_?.(e)}catch(e){console.error(`onLocalProcessingChange hook threw`,e)}e||this.#K()}}#G(e){this.#k!==e&&(this.#k=e,this.#r?.(e))}#K(){let e=this.#w;if(this.#w=null,!this.#c)return;let t=e?this.#_e(e):null;this.#c(t?{...t}:null)}#q(){let e=this.#y[this.#y.length-1];if(!(e?.role===`assistant`&&!e.isStreaming)){this.#j?.remove();return}this.#j??=pu({getMessages:()=>this.getMessages()}),(this.#e.inner??this.#e).append(this.#j)}#J(e){switch(e.type){case`message_start`:this.#Y(e.messageId);break;case`content_delta`:this.#X(e.messageId,e.text);break;case`content_done`:this.#$(e.messageId,e.model,e.usage);break;case`tool_use_start`:this.#te(e.messageId,e.toolName,e.toolInput,e.toolCallId);break;case`tool_result`:this.#re(e.messageId,e.toolName,e.result,e.isError,e.toolCallId);break;case`tool_ui`:this.#le(e.messageId,e.requestId,e.html);break;case`tool_ui_done`:this.#ue(e.requestId);break;case`tool_progress`:this.#de(e.messageId,e.toolName,e.progress,e.toolCallId);break;case`turn_end`:this.#oe(e.messageId);break;case`compaction_notice`:this.#ie(e.messageId,e.marker);break;case`error`:this.#se(e.error,e.endTurn!==!1)}}#Y(e){this.setProcessing(!0),this.#C=e,this.#w=e,this.#ye({id:e,role:`assistant`,content:``,timestamp:Date.now(),isStreaming:!0,toolCalls:[]})}#X(e,t){this.#_e(e)&&(this.#E!==e&&this.#Z(),this.#E=e,this.#T+=t,this.#D??=requestAnimationFrame(()=>this.#Z()))}#Z(){let e=this.#E,t=this.#T;this.#Q();let n=t&&e?this.#_e(e):void 0;n&&(n.content+=t,this.#be(n))}#Q(){this.#D!==null&&cancelAnimationFrame(this.#D),this.#D=null,this.#T=``,this.#E=null}#$(e,t,n){let r=this.#_e(e);r&&(t&&(r.model=t),n&&(r.usage=n),this.#E===e&&(r.content+=this.#T,this.#Q()),r.isStreaming=!1,this.#be(r))}static#ee(e,t){return`${e}:${t}`}#te(t,n,r,i){let a=this.#_e(t);if(!a)return;a.toolCalls=a.toolCalls??[];let o=i?e.#ee(t,i):$();this.#F.add(o),a.toolCalls.push({id:o,name:n,input:r}),this.#A+=1,this.#G(`tool`),this.#be(a)}#ne(t,n,r){let i=t?.toolCalls??[];if(r){let n=t?e.#ee(t.id,r):void 0;return i.find(e=>e.id===n)??i.find(e=>e.id===r)}return[...i].reverse().find(e=>e.name===n&&e.result===void 0)}#re(e,t,n,r,i){let a=this.#_e(e),o=this.#ne(a,t,i);!a||!o||(o.result=n,o.isError=r,o.id&&(this.#P.delete(o.id),this.#me()),this.#A=Math.max(0,this.#A-1),this.#A===0&&this.#G(`thinking`),this.#be(a))}#ie(e,t){let n=this.#_e(e);if(t.state===`discarded`){n&&this.#ae(n);return}if(n){n.compaction=t,this.#be(n);return}this.#ye({id:e,role:`assistant`,content:``,timestamp:Date.now(),compaction:t})}#ae(e){this.#Se(),this.#s?.(e.id);for(let t of this.#S.get(e.id)??[])t.remove();this.#S.delete(e.id),this.#y=this.#y.filter(t=>t!==e),this.#Ce(),this.#pe()}#oe(e){let t=this.#_e(e);t?.isStreaming&&(t.isStreaming=!1,this.#be(t)),this.#C=null,this.setProcessing(!1)}#se(e,t=!0){t&&this.setProcessing(!1),this.#ye({id:$(),role:`assistant`,content:typeof e==`string`?e:lt(e)??``,timestamp:Date.now(),error:!0}),this.#ce(e)}#ce(e){try{let t=typeof e==`string`?e:ct(e);if(typeof t==`string`&&dt(t))return;ft(`error-card`,e)}catch{}}#le(e,t,n){if(this.#I)return;this.#he(t);let r=document.createElement(`div`);if(r.className=`msg__dip`,r.setAttribute(`data-tool-ui-request`,t),(this.#e.inner??this.#e).append(r),this.#m){let e=B(r,hu(n),()=>{},!1);this.#N.set(t,{instance:e,container:r});return}let i=B(r,n,(e,n)=>{this.#p?.(t,e,n)},!1);this.#N.set(t,{instance:i,container:r}),this.#p?.(t,ot,void 0)}#ue(e){this.#he(e)}#de(e,t,n,r){let i=this.#_e(e),a=this.#ne(i,t,r);a?.id&&(n.phase===`end`?this.#P.delete(a.id):this.#P.set(a.id,n),this.#fe(a.id),this.#me())}#fe(e){let t=this.#e.querySelector(`slicc-action-row[data-tool-id="${CSS.escape(e)}"]`);t&&he(t,this.#P.get(e)??null),this.#pe()}#pe(){let e=this.#e.querySelectorAll(`slicc-tool-cluster`);for(let t of e){let e=[...t.querySelectorAll(`slicc-action-row[data-tool-id]`)].filter(e=>e.dataset.toolId&&this.#F.has(e.dataset.toolId)).map(e=>{let t=e.dataset.toolId,n=e.getAttribute(`result`);return{done:n!==null&&n!==`…`,fraction:this.#P.get(t)?.fraction}});y(t,ie(e))}}#me(){let e=null,t=[...this.#P.values()];t.length>0&&t.every(e=>typeof e.fraction==`number`)&&(e=t.reduce((e,t)=>e+t.fraction,0)/t.length),e!==this.#a&&(this.#a=e,this.#i?.(e))}#he(e){let t=this.#N.get(e);if(t){this.#N.delete(e);try{t.instance.dispose()}catch{}t.container.remove()}}#ge(e){if(this.#O)return;let t=e.detail?.messageId??null,n=this.#y.length;if(t){let e=this.#y.findIndex(e=>e.id===t);e>=0&&(n=e)}let r=n>0?this.#y[n-1]:void 0;if(r&&r.source===`lick`&&!r.queued){this.#t.sendMessage(r.content,$(),r.attachments);return}let i;for(let e=n-1;e>=0;e--){let t=this.#y[e];if(t.role===`user`&&t.source!==`lick`&&t.source!==`delegation`&&!t.queued){i=t;break}}i&&this.#t.sendMessage(i.content,$(),i.attachments)}#_e(e){return this.#y.find(t=>t.id===e)}#ve(e){try{return ve(e,{readOnly:this.#I})}catch(t){console.error(`[wc-chat] message render failed — degrading to plain bubble`,t);let n=document.createElement(e.role===`assistant`?`slicc-agent-message`:`slicc-user-message`);return n.setAttribute(`text`,String(e.content??``)),[n]}}#ye(e){this.#Se(),this.#y.push(e);let t=this.#ve(e);this.#S.set(e.id,t),this.#e.append(...t),this.#Ce(),this.#o?.(e,t),e.role===`user`?this.#Te():this.#Ee()}#be(e){this.#Se();let t=this.#S.get(e.id)??[],n=this.#ve(e),r=t[0]??null,i=r?.parentNode;if(i)for(let e of n)i.insertBefore(e,r);else this.#e.append(...n);this.#S.set(e.id,n),this.#o?.(e,n);for(let e of t)e.remove();for(let t of e.toolCalls??[])t.id&&this.#P.has(t.id)&&this.#fe(t.id);this.#Ce(),this.#pe(),this.#Ee()}#xe(){return this.#e.inner??this.#e}#Se(){c(this.#xe(),this.#M)}#Ce(){h(this.#xe(),{openClusterAnchors:this.#M,toolCallLookup:(e,t)=>this.#we(e,t)})}#we(e,t){return this.#y.find(t=>t.id===e)?.toolCalls?.find(e=>e.id===t)}#Te(){this.#e.scrollTop=this.#e.scrollHeight}#Ee(){let e=this.#e;typeof e.requestFollow==`function`?e.requestFollow():this.#Te()}};function vu(e,t,n,r,a,o){let s=new Map;i(async()=>{let{loadDipStyles:e}=await import(`./legacy-styles-B3nS5QUo.js`);return{loadDipStyles:e}},__vite__mapDeps([58,2])).then(({loadDipStyles:e})=>e()).catch(()=>void 0);let c=[];n.subscribeList(e=>{c=e});let l=()=>t.addressableUnitId?t.addressableUnitId():r()?.id??null,u=uu(n,{getSelectedId:l,onError:e=>t.emitAgentError(e),onEvent:e=>t.onAgentEvent(e)});u.onEvent(t=>{(t.type===`tool_use_start`||t.type===`tool_result`)&&(t.type===`tool_result`&&t.isError&&e.switcher.glower(),i(async()=>{let{playCue:e}=await import(`./soundscape-kWM_hjnI.js`);return{playCue:e}},__vite__mapDeps([59,3,0,1,2,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33])).then(({playCue:e})=>e(t.type===`tool_use_start`?`tool-start`:`tool-finish`)).catch(()=>void 0))});let d=new _u({thread:e.thread,agent:u,resolveTelemetryContext:()=>{let e=r();if(!e)return null;let t=zn(e);try{let n=Fn(c,e.id);return{scoopName:t,model:(n?je(n.id,n.provider):ke()).id}}catch{return{scoopName:t,model:``}}},onTurnComplete:e=>{t.speaksReplies&&i(async()=>{let{consumeVoiceSubmission:e,speakReplyMarkdown:t}=await import(`./voice-reply-B1l9_Xo1.js`);return{consumeVoiceSubmission:e,speakReplyMarkdown:t}},__vite__mapDeps([60,3,0,1,2,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,61,62,63,64])).then(async({consumeVoiceSubmission:t,speakReplyMarkdown:n})=>{if(!t())return;let{endVoiceTurn:r,setTtsActive:a}=await i(async()=>{let{endVoiceTurn:e,setTtsActive:t}=await import(`./soundscape-kWM_hjnI.js`);return{endVoiceTurn:e,setTtsActive:t}},__vite__mapDeps([59,3,0,1,2,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33]));try{if(e?.content){a(!0);try{await n(e.content)}finally{a(!1)}}}finally{r()}}).catch(()=>void 0)},onProcessingChange:t=>{e.frame.toggleAttribute(`data-processing`,t),e.inputCard.querySelector(`slicc-send-button`)?.toggleAttribute(`busy`,t),t||a?.()},onBusyPhaseChange:t=>{e.inputCard.querySelector(`slicc-send-button`)?.setAttribute(`phase`,t)},onToolProgressChange:t=>{let n=e.inputCard.querySelector(`slicc-send-button`);n&&(t===null?n.removeAttribute(`progress`):n.setAttribute(`progress`,t.toFixed(3)))},onMessageDisposed:e=>{let t=s.get(e);t&&(di(t),s.delete(e))},onMessageRendered:(e,n)=>{let r=s.get(e.id),i=n[0];if(!i){r&&di(r),s.delete(e.id);return}t.onMessageRendered?.(i);let a=l()??void 0;s.set(e.id,ui(i,(e,n)=>{let r={type:`sprinkle`,sprinkleName:`inline`,timestamp:new Date().toISOString(),body:{action:e,data:n}};o?.intercept?.(r)||t.sendSprinkleLick(`inline`,{action:e,data:n},void 0,a)},{previous:r,streaming:e.isStreaming===!0}))},onQueuedChange:t=>e.queuedStack.setMessages(t),onLickBackpressureChange:t=>{e.lickBackpressureNotice.textContent=t?.text??``,e.lickBackpressureNotice.toggleAttribute(`hidden`,t===null)},onToolUiAction:(e,n,r)=>{t.sendToolUiAction(e,n,r)},onQueuedCancel:e=>{let n=r()?.id;n&&t.deleteQueuedMessage(n,e).catch(()=>void 0)},...t.readOnlyToolUi?{readOnlyToolUi:!0}:{}});return e.queuedStack.addEventListener(`slicc-queued-remove`,e=>{let n=e.detail?.id;if(!n)return;d.removeQueuedMessage(n);let i=r()?.id;i&&t.deleteQueuedMessage(i,n).catch(()=>void 0)}),{controller:d,agentHandle:u}}function yu(e,t){let n=new lu,r=()=>{let r=t.currentUnits(),i=e.getSelected()?.id;e.refs.switcher.scoops=Mn(r,i,p,n.sync(r,i)),e.refreshConeActions?.()};return e.refreshScoops=r,t.subscribeList(()=>r()),r}function bu(e,t,n){let{refs:r}=e;e.setChatTransport(t,n);let{controller:a,agentHandle:o}=vu(r,n,t,()=>e.getSelected(),n.onTurnIdle,n.welcome);e.setController(a);let s=yu(e.wiring,t);return r.switcher.addEventListener(`slicc-scoop-select`,n=>{let r=n.detail?.key,i=t.currentUnits().find(e=>e.id===r);i&&i.id!==e.getSelected()?.id&&e.selectScoop(i)}),r.switcher.setAttribute(`gaze-target`,`slicc-input-card`),r.inputCard.addEventListener(`input`,()=>{r.switcher.scrutinize(),r.switcher.wake()}),r.inputCard.addEventListener(`submit`,t=>{let o=le(t),s=n.takeAttachments?.();if(!o&&!s?.length)return;e.wiring.awaitingInput=null,e.wiring.refreshScoops?.(),e.wiring.notifyScoopStateChanged?.();let c=t.detail?.source===`dictation`;c&&n.speaksReplies&&(i(async()=>{let{markVoiceSubmission:e}=await import(`./voice-reply-B1l9_Xo1.js`);return{markVoiceSubmission:e}},__vite__mapDeps([60,3,0,1,2,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,61,62,63,64])).then(({markVoiceSubmission:e})=>e()).catch(()=>void 0),i(async()=>{let{beginVoiceTurn:e,playCue:t}=await import(`./soundscape-kWM_hjnI.js`);return{beginVoiceTurn:e,playCue:t}},__vite__mapDeps([59,3,0,1,2,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33])).then(({beginVoiceTurn:e,playCue:t})=>{e(),t(`sent`)}).catch(()=>void 0)),a.sendUserMessage(o??``,s,{dictation:c,steer:b(t)}),r.inputCard.clear?.();let l=e.getSelected()?.id;l&&(r.switcher.setAttribute(`attention`,l),e.wiring.lastActivity.set(l,(o??``).slice(0,600)))}),r.inputCard.addEventListener(`stop`,()=>{e.getController()?.processing&&o.stop()}),{agentHandle:o,controller:a,publishStrip:s}}var xu=e({floatKindForRuntimeMode:()=>wu,floatLabelForKind:()=>Cu,resolveStandaloneFloatKind:()=>Tu}),Su={"slicc-server":`sliccstart`,"slicc-node-server":`npx`};function Cu(e){return f(e)}function wu(e){switch(e){case`extension`:case`extension-detached`:return`extension`;case`cherry`:return`cherry`;case`hosted-leader`:return`hosted`;case`electron-overlay`:return`electron`;case`follower`:return`standalone`;default:return`standalone`}}async function Tu(e){let t=e?.fetchFn??fetch,n=e?.timeoutMs??1500;try{let e=new AbortController,r=setTimeout(()=>e.abort(),n),i=await t(nt(`/api/status`),{cache:`no-store`,signal:e.signal,headers:rt()}).finally(()=>clearTimeout(r));if(!i.ok)return`standalone`;let a=await i.json();return(a.service?Su[a.service]:void 0)??`standalone`}catch{return`standalone`}}function Eu(e,t){let n=t.label??Cu(t.floatKind);e.setAttribute(`label`,n),e.setAttribute(`float-kind`,t.floatKind);let r=an(),i=ht(),a=()=>{let t=Du(r,i);e.setAttribute(`connection`,t.connection),t.trayRole===`none`?e.removeAttribute(`tray-role`):e.setAttribute(`tray-role`,t.trayRole)},o=nn(e=>{r=e,a()}),s=pt(e=>{i=e,a()});return a(),()=>{o(),s()}}function Du(e,t){return e.state===`inactive`?t.state===`inactive`?{connection:`offline`,trayRole:`none`}:{connection:ku(t),trayRole:`follower`}:{connection:Ou(e),trayRole:`leader`}}function Ou(e){switch(e.state){case`connecting`:return`connecting`;case`leader`:return`live`;case`reconnecting`:return`reconnecting`;case`error`:return`error`;default:return`offline`}}function ku(e){if(e.stalled)return`stalled`;switch(e.state){case`connecting`:return`connecting`;case`connected`:return`live`;case`reconnecting`:return`reconnecting`;case`error`:return`error`;default:return`offline`}}async function Au(e,t,n){let r=n.floatLabel??Cu(n.floatKind),i=Jd(e,r);Eu(i.refs.floatbar,{floatKind:n.floatKind,label:r});let a=await n.connect(i),o=bu(i,a.client,a.host);return await a.workbench?.(i,o),t.info(`WC shell mounted`,{floatKind:n.floatKind}),{boot:i,chat:o}}var ju=36e5,Mu=2e3,Nu=class{#e=[];#t;#n;constructor(e=ju,t=Mu){this.#t=Math.max(1,Math.floor(e)),this.#n=Math.max(2,Math.floor(t))}get windowMs(){return this.#t}push(e){this.#e.push(e);let t=e.at-this.#t;for(;this.#e.length>0&&this.#e[0].at<t;)this.#e.shift();for(;this.#e.length>this.#n;)this.#e.shift()}get size(){return this.#e.length}series(e){if(!(this.#e.length<2))return{points:this.#e.map(t=>({at:t.at,value:t[e]})),windowMs:this.#t}}peak(e){return this.#e.length===0?null:this.#e.reduce((t,n)=>Math.max(t,n[e]),-1/0)}windowLabel(){if(this.#e.length<2)return null;let e=this.#e[this.#e.length-1].at-this.#e[0].at,t=Math.max(1,Math.round(e/1e3));if(t<90)return`last ${t}s`;let n=Math.round(t/60);return n<90?`last ${n}m`:`last ${Math.round(n/60)}h`}};function Pu(e){return m(e,ge)}async function Fu(e,t=k.memoryPath){let n=``;try{let r=await e.readFile(t,{encoding:`utf-8`});n=typeof r==`string`?r:new TextDecoder().decode(r)}catch{n=``}return Pu(n)}function Iu(e){let t=e.filter(e=>e.health===`stalled`).length,n=e.filter(e=>e.health!==`stalled`&&e.peerState===`connecting`).length,r=e.length-t-n,i=[r>0?`${r} connected`:``,n>0?`${n} connecting`:``,t>0?`${t} stalled`:``].filter(Boolean);return{id:`followers`,label:`Followers`,icon:`radio`,count:e.filter(e=>e.peerState===`connected`).length,meta:i.join(` · `)||`none paired`,accent:`cyan`,emptyText:`No followers connected yet. Pair a phone, tablet, or CLI follower to this tray.`,rows:e.map(e=>{let t=e.motd??e.runtime??`Connected follower`,n=e.hostOrigin?`${t} · ${e.hostOrigin}`:t,r=[e.exec?`ssh`:``,e.cdp?`playwright`:``].filter(Boolean);return{name:jo(e),sublabel:n,meta:ko(e),icon:Eo(e),badges:r,status:Oo(e)}})}}function Lu(e){return e.stalled||e.state===`reconnecting`?`warn`:e.state===`error`?`error`:e.state===`leader`||e.state===`connected`?`active`:`idle`}function Ru(e){return e.stalled?`stalled`:e.state===`leader`?`connected`:e.state}function zu(e){let t=Ru(e),n=e.sessionId?`Session ${wo(e.sessionId)}`:null,r=e.workerBaseUrl?`Worker · ${e.workerBaseUrl}`:null;return{id:`tray`,label:`Tray`,icon:e.role===`follower`?`radio`:`cloud`,count:1,meta:`${e.role} · ${t}`,accent:`waffle`,status:Lu(e),rows:[{name:e.role[0].toUpperCase()+e.role.slice(1),sublabel:[n,r].filter(Boolean).join(` · `)||`No tray session`,meta:t,icon:e.role===`follower`?`radio`:`cloud`,badges:e.joinUrl?[`join URL`]:[],status:Lu(e)}]}}function Bu(e,t){let n=e.filter(e=>O(e)),r=t=>e.filter(e=>!O(e)&&e.parentJid===t),i=(e,n)=>{let r=t(e.jid);return{name:O(e)?`${e.name||`sliccy`} (cone)`:e.name,meta:r?`working`:`idle`,active:r,depth:n}},a=n.flatMap(e=>[i(e,0),...r(e.jid).map(e=>i(e,1))]),o=new Set(a.map(e=>e.name));for(let t of e){let e=i(t,0);o.has(e.name)||a.push(e)}let s=e.filter(e=>t(e.jid)).length;return{id:`scoops`,label:`Scoops`,icon:`bot`,count:e.length,meta:`${e.length} · ${s} working`,accent:`violet`,status:`active`,emptyText:`Delegate a focused task and its scoop will show up here.`,rows:a}}function Vu(e){let t=e.filter(e=>e.valid===!1).length;return{id:`mounts`,label:`Mounts`,icon:`hard-drive`,count:e.length,meta:t>0?`${e.length} · ${t} need${t===1?`s`:``} re-grant`:`${e.length} · all granted`,status:t>0?`warn`:`active`,emptyText:`Mount a folder to give the workspace access to files on disk.`,rows:e.map(e=>({name:e.targetPath,meta:e.valid===!1?`permission lost`:e.descriptor.kind,status:e.valid===!0?`active`:e.valid===!1?`warn`:`idle`}))}}function Hu(e,t){let n=t.filter(e=>e.valid===!1).length,r=e.reduce((e,[,t])=>e+(t.tools?.length??0),0),i=[`${e.length} server${e.length===1?``:`s`}`,`${r} tool${r===1?``:`s`}`,n>0?`${n} account expired`:`${t.length} accounts valid`].join(` · `);return{id:`integrations`,label:`Integrations`,icon:`blocks`,count:e.length+t.length,meta:i,accent:`waffle`,status:n>0?`error`:`active`,emptyText:`Connect an MCP server or a provider account to extend the workspace.`,rows:[...e.map(([e,t])=>{let n=t.tools?.length??0;return{name:e,meta:`MCP · ${n} tool${n===1?``:`s`}`,status:`active`}}),...t.map(e=>({name:e.providerId,meta:e.valid===!1?`session expired`:`account`,status:e.valid===!0?`active`:e.valid===!1?`error`:`idle`}))]}}function Uu(e,t){let n=[`${t.length} webhook${t.length===1?``:`s`}`,e.length>0?`${e.length} cron task${e.length===1?``:`s`}`:`no cron tasks`].join(` · `);return{id:`automations`,label:`Automations`,icon:`calendar-clock`,count:e.length+t.length,meta:n,accent:`amber`,emptyText:`Scheduled tasks and webhook-driven licks will appear here.`,rows:[...e.map(e=>({name:e.name,meta:e.cron,status:e.status===`active`?`active`:`idle`})),...t.map(e=>({name:e.name,meta:e.scoop?`→ ${e.scoop}`:`→ cone`,status:`idle`}))]}}function Wu(e){let t=Ot({percent:e.percent,status:e.status});return t===`critical`?`error`:t===`warn`?`warn`:`active`}function Gu(e,t){let n=`${Et(e.percent)}% used`,r=Dt(e.resetsAt,t);return{name:`${e.window[0]?.toUpperCase()??``}${e.window.slice(1)} budget`,sublabel:e.providerId?`${e.providerId} · rolling window`:`rolling window`,meta:e.status===`rate-limited`?`rate-limited · ${n}`:n,badges:r?[r]:void 0,status:Wu(e)}}function Ku(e,t){let n=e?.budget,r=e?.models??[],i=e?`$${e.totalCost.toFixed(2)} across ${r.length} models`:``,a=n?[n.status===`rate-limited`?`rate-limited`:``,`${Et(n.percent)}% of ${n.window} budget`,i].filter(Boolean).join(` · `):e?i:`no spend yet`;return{id:`cost`,label:`Cost`,icon:`receipt`,count:r.length,meta:a,accent:`rose`,status:n?Wu(n):void 0,emptyText:`Model usage will be summarized after the first turn.`,rows:[...n?[Gu(n,t)]:[],...r.map(e=>({name:e.model,meta:`$${e.cost.toFixed(4)}`,status:`idle`}))]}}function qu(e){let t=[],n=Ju(e.budget,e.now??Date.now());n&&t.push(n);for(let n of e.oauthProviders)n.valid===!1&&t.push({id:`oauth:${n.providerId}`,severity:`error`,icon:`key-round`,title:`${n.providerId} session expired`,detail:`Tool calls through this provider will fail until it is signed in again.`});let r=Lu(e.tray);(r===`error`||r===`warn`)&&t.push({id:`tray`,severity:r===`error`?`error`:`warn`,icon:`cloud-off`,title:`Tray ${Ru(e.tray)}`,detail:e.tray.workerBaseUrl?`Worker · ${e.tray.workerBaseUrl}`:`No tray session is established.`});for(let n of e.followers)Oo(n)===`warn`&&t.push({id:`follower:${n.runtimeId}`,severity:`warn`,icon:`radio`,title:`${jo(n)} stopped answering`,detail:n.motd??n.runtime??`No heartbeat from this follower.`,age:ko(n)});for(let n of e.mounts)n.valid===!1&&t.push({id:`mount:${n.targetPath}`,severity:`warn`,icon:`folder-lock`,title:`${n.targetPath} needs re-grant`,detail:`File System Access permission is no longer granted for this handle.`});return t.sort((e,t)=>e.severity===t.severity?0:e.severity===`error`?-1:1)}function Ju(e,t){if(!e||Ot({percent:e.percent,status:e.status})===`ok`)return null;let n=Dt(e.resetsAt,t),r=`${Et(e.percent)}%`;if(e.status===`rate-limited`)return{id:`budget:rate-limited`,severity:`error`,icon:`octagon-alert`,title:`${e.window} budget is rate-limited`,detail:`The provider is refusing calls until the window resets. ${r} of the allowance is used.`,age:n};let i=e.percent>=95;return{id:`budget:near-limit`,severity:i?`error`:`warn`,icon:`gauge`,title:`${r} of the ${e.window} budget used`,detail:i?`Past 95% of the allowance — calls may start being refused.`:`Past 80% of the allowance. Long runs may not finish before it resets.`,age:n}}function Yu(e){return e>=100?`$${Math.round(e)}`:`$${e.toFixed(2)}`}function Xu(e){let{stats:t,workingUnits:n,totalUnits:r,liveProcesses:i,terminated:a,history:o}=e,s=o?.windowLabel(),c=t?.burnRate??0,l=t?.fills??[],u=l.reduce((e,t)=>Math.max(e,t.fill),0),d=t?.budget,f=[{id:`burn`,label:`Burn rate`,value:Yu(c),unit:`/hour`,hero:!d,accent:d?`rose`:void 0,series:o?.series(`burnRate`),foot:[t?`$${t.totalCost.toFixed(2)} this session`:`no spend yet`,s].filter(Boolean).join(` · `)},{id:`load`,label:`Agent load`,value:String(n),unit:`of ${r} working`,accent:`violet`,series:o?.series(`workingUnits`),foot:s??void 0}];return d||f.push({id:`processes`,label:`Live processes`,value:String(i),unit:i===1?`process`:`processes`,accent:`cyan`,series:o?.series(`liveProcesses`),foot:a>0?`${a.toLocaleString()} exited this session`:s??void 0}),l.length>0&&f.push({id:`context`,label:`Context fill`,value:String(Math.round(u*100)),unit:`%`,ratio:u,markers:Qu(l,e.units??[]),accent:u>=.9?`rose`:u>=.7?`amber`:`green`,foot:`fullest of ${l.length} context window${l.length===1?``:`s`}`}),d?[Zu(d,t,e.now??Date.now()),...f]:f}function Zu(e,t,n){let r=Ot({percent:e.percent,status:e.status});return{id:`budget`,label:`${e.window[0]?.toUpperCase()??``}${e.window.slice(1)} budget`,value:Et(e.percent),unit:`% used`,hero:!0,ratio:Math.min(1,Math.max(0,e.percent/100)),accent:r===`critical`?`rose`:r===`warn`?`amber`:`green`,foot:[e.status===`rate-limited`?`rate-limited`:``,Dt(e.resetsAt,n)??``,t?`$${t.totalCost.toFixed(2)} this session`:``].filter(Boolean).join(` · `)}}function Qu(e,t){let n=new Map(t.map(e=>[e.jid,e]));return e.map(({jid:e,fill:t})=>{let r=n.get(e),i=r?O(r):!1,a=r?.name||(r?`sliccy`:e);return{id:e,ratio:t,color:p({isRoot:i,name:a}),label:`${i?`${a} (cone)`:a} — ${Math.round(t*100)}% full`}})}var $u={running:`R`,pending:`S`,exited:`Z`,killed:`K`};function ed(e,t){if(!e)return;let n=Math.max(0,Math.round((t-e)/1e3));if(n<60)return`${n}s`;let r=Math.floor(n/60);return r<60?`${r}m ${n%60}s`:`${Math.floor(r/60)}h ${r%60}m`}function td(e,t){return{pid:e.pid,ppid:e.ppid,state:$u[e.status]??`?`,status:e.status,command:e.argv,scoop:e.scoop,started:e.startedAt?new Date(e.startedAt).toTimeString().slice(0,5):void 0,elapsed:ed(e.startedAt,t)}}async function nd(e,t){let n=e.getScoops(),r=e.getTrayInfo(),i=e.getConnectedFollowers(),[a,o,s,c,l,u]=await Promise.all([e.getCronTasks().catch(()=>[]),e.getWebhooks().catch(()=>[]),e.getMounts().catch(()=>[]),e.getMcpServers().catch(()=>({})),e.getSessionStats().catch(()=>null),e.getProcesses().catch(()=>({processes:[],terminated:0}))]),{processes:d,terminated:f}=u,p=e.getOAuthProviders(),m=Object.entries(c),h=n.filter(t=>e.isProcessing(t.jid)).length,g=Date.now();return t?.push({at:g,burnRate:l?.burnRate??0,workingUnits:h,liveProcesses:d.length}),{updated:`Streaming · updated just now`,vitals:Xu({stats:l,workingUnits:h,totalUnits:n.length,liveProcesses:d.length,terminated:f,history:t,units:n,now:g}),alerts:qu({tray:r,followers:i,mounts:s,oauthProviders:p,budget:l?.budget,now:g}),sections:[zu(r),Iu(i),Bu(n,t=>e.isProcessing(t)),Vu(s),Hu(m,p),Uu(a,o),Ku(l,g)],processes:{rows:d.map(e=>td(e,g)),terminated:f}}}var rd=`/shared`,id=3,ad=200;async function od(e,t,n){let r;try{r=await e.readDir(t)}catch{return[]}let i=r.filter(e=>e.type===`directory`).sort((e,t)=>e.name.localeCompare(t.name)),a=r.filter(e=>e.type===`file`).sort((e,t)=>e.name.localeCompare(t.name)),o=[...i,...a].slice(0,ad),s=new Map,c=[];for(let e of o){if(e.type!==`file`)continue;let n=`${t}/${e.name}`;e.size===void 0?c.push(n):s.set(n,e.size)}let l=await Promise.allSettled(c.map(t=>e.stat(t)));c.forEach((e,t)=>{let n=l[t];n?.status===`fulfilled`&&s.set(e,n.value.size)});let u=[];for(let r of o){let i=`${t}/${r.name}`;if(r.type===`directory`)u.push({kind:`dir`,id:i,label:r.name,children:n<id?await od(e,i,n+1):[]});else{let e=s.get(i);u.push({kind:`file`,id:i,label:r.name,path:i,size:e})}}return u}async function sd(e,t=k.root){let n=[];for(let r of[t,rd])n.push({kind:`dir`,id:r,label:r.replace(/^\/(cones\/)?/,``),open:!0,children:await od(e,r,1)});return n}var cd=200,ld=1e3,ud=3e3,dd=45e3;function fd(e){let t=null,n=!1,r=!1,i=!1,a=0,o=0,s=null,c=null,l=0,u=()=>{let t=++o;e.openFs().then(async n=>{let i=await sd(n,e.getWorkspace().root);t===o&&(e.fileTree.items=i,r||(r=!0,oe({fileTree:e.fileTree,openFs:e.openFs,openWriter:e.openWriter,insertReference:e.insertReference,toPreviewUrl:ue,log:e.log})))}).catch(t=>e.log.error(`WC file tree refresh failed`,t))},d=()=>{if(!i)return;let e=Date.now();if(c==null)l=e;else if(e-l>=ld){clearTimeout(c),c=null,u();return}c!=null&&clearTimeout(c),c=setTimeout(()=>{c=null,u()},cd)},f=()=>{t??=setInterval(u,ud)},p=()=>{let t=++a;s?.(),s=null;let n=[e.getWorkspace().root,rd];e.openFs().then(async e=>{if(!e.watch){t===a&&i&&f();return}let r=await e.watch(n,d);if(t!==a||!i){r();return}s=r}).catch(n=>{e.log.error(`WC file tree watch failed — falling back to polling`,n),t===a&&i&&f()})},m=()=>{n=!1,i=!1,a++,s?.(),s=null,c!=null&&(clearTimeout(c),c=null),t!=null&&(clearInterval(t),t=null)};return{open(){m(),i=!0,n=!0,e.onKernelReady(()=>{n&&(n=!1,u(),p())})},close:m,repoint(){!i||n||(u(),p())}}}function pd(e){let t=!1,n=!1,r=!1,i=0,a=null,o=new Nu,s=fd(e),c=()=>{a!=null&&(clearInterval(a),a=null)},l=()=>{let t=++i;e.openFs().then(async n=>{let r=await Fu(n,e.getWorkspace().memoryPath);t===i&&(e.memoryHost.setRows?e.memoryHost.setRows(r):e.memoryHost.replaceChildren(...r))}).catch(t=>e.log.error(`WC memory refresh failed`,t))},u=()=>{(async()=>{try{e.monitor.model=await nd(e.getMonitorDeps(),o)}catch(t){e.log.error(`WC monitor refresh failed`,t)}})()};return e.monitor.addEventListener(`slicc-monitor-refresh`,u),{activate(i){if(i===`files`){s.open();return}if(i===`memory`){r=!0,l();return}if(i===`monitor`){c(),u(),a=setInterval(u,5e3);return}if(i===`term`&&!t){t=!0;let r=!1,i=n?null:setTimeout(()=>{r||(n=!0,t=!1,e.log.error(`WC terminal mount did not settle within ${dd}ms; re-arming so the next term activation retries`))},dd);e.mountTerminal(e.termSurface).catch(n=>{t=!1,e.log.error(`WC terminal mount failed`,n)}).finally(()=>{r=!0,i&&clearTimeout(i)})}},deactivate(e){e===`files`?s.close():e===`monitor`?c():e===`memory`&&(r=!1)},refreshMemory(){r&&l()},refreshFiles(){s.repoint()}}}var md=[`/workspace`,`/shared`,`/memory`,`/scoops`,`/mnt`],hd=new Set([`node_modules`,`.git`,`dist`,`build`,`out`,`coverage`,`.cache`,`.venv`,`venv`,`__pycache__`,`target`,`vendor`,`.next`,`.turbo`,`python_wheels`]),gd=2e4,_d=12,vd=3e4;function yd(e){let t=e.trim();for(;t.startsWith(`./`)||t.startsWith(`../`);)t=t.slice(t.startsWith(`./`)?2:3);return t.startsWith(`~/`)&&(t=t.slice(2)),t.replace(/\/{2,}/g,`/`)}function bd(e){return e.slice(e.lastIndexOf(`/`)+1)}function xd(e,t){return e===t?!0:e.endsWith(t)?e[e.length-t.length-1]===`/`:!1}function Sd(e,t){let n=yd(e);return t.includes(`/`)?xd(n,t):bd(n)===t}function Cd(e,t){let n=[],r=new Set;for(let i=t.length-1;i>=0;--i){let a=t[i];if(!(a===void 0||r.has(a))&&Sd(a,e)&&(r.add(a),n.push(yd(a)),n.length>=wd))break}return n}var wd=4,Td=class{#e;#t;#n;#r;#i;#a;#o=0;#s=null;#c=null;#l=new Map;#u=new Map;constructor(e,t={}){this.#e=e,this.#t=t.roots??md,this.#n=t.ignoredDirs??hd,this.#r=t.maxEntries??gd,this.#i=t.maxDepth??_d,this.#a=t.ttlMs??vd}resolve(e,t=[]){this.#g();let n=yd(e),r=this.#d(n),i=Cd(n,t);return i.length===0?r:this.#f(n,r,i)}resolveAll(e,t=[]){return Promise.all(e.map(e=>this.resolve(e,t)))}invalidate(){this.#s=null,this.#c=null,this.#l.clear(),this.#u.clear()}#d(e){let t=this.#l.get(e);if(t)return t;let n=this.#m(e).catch(()=>({query:e,matches:[]}));return this.#l.set(e,n),n}async#f(e,t,n){let{matches:r}=await t,i=new Set(r),a=[];for(let e of n)!e.startsWith(`/`)||i.has(e)||await this.#p(e)&&a.push(e);let o=e=>n.findIndex(t=>xd(e,t)),s=r.filter(e=>o(e)>=0).sort((e,t)=>o(e)-o(t)),c=new Set(s),l=r.filter(e=>!c.has(e));return{query:e,matches:[...a,...s,...l]}}#p(e){let t=this.#u.get(e);if(t)return t;let n=this.#h(e);return this.#u.set(e,n),n}async#m(e){if(e.startsWith(`/`))return{query:e,matches:await this.#h(e)?[e]:[]};let t=(await this.#_()).get(bd(e))??[];return e.includes(`/`)?{query:e,matches:t.filter(t=>xd(t,e)).sort(Ed)}:{query:e,matches:[...t].sort(Ed)}}async#h(e){try{return(await this.#e.stat(e)).type===`file`}catch{return!1}}#g(){!this.#s||this.#a===1/0||Date.now()-this.#o<this.#a||this.invalidate()}#_(){return this.#s?Promise.resolve(this.#s):(this.#c??=this.#v().then(e=>(this.#s=e,this.#o=Date.now(),e)),this.#c)}async#v(){let e=new Map,t={left:this.#r};for(let n of this.#t){if(t.left<=0)break;await this.#y(n,0,e,t)}return e}async#y(e,t,n,r){if(r.left<=0||t>this.#i)return;let i;try{i=await this.#e.readDir(e)}catch{return}let a=this.#b(e,i,n,r);for(let e of a){if(r.left<=0)break;await this.#y(e,t+1,n,r)}}#b(e,t,n,r){let i=[];for(let a of t){if(r.left<=0)break;let t=e===`/`?`/${a.name}`:`${e}/${a.name}`;if(a.type===`directory`){this.#n.has(a.name)||i.push(t);continue}let o=n.get(a.name);o?o.push(t):n.set(a.name,[t]),--r.left}return i}};function Ed(e,t){let n=e.split(`/`).length,r=t.split(`/`).length;return n===r?e.localeCompare(t):n-r}var Dd=`file-mention`,Od=`data-file-mentions`;function kd(e){return`${e.childNodes.length}:${e.textContent?.length??0}`}var Ad=new Set([`A`,`PRE`,`SCRIPT`,`STYLE`,`TEXTAREA`]),jd=`file-mention-open`;async function Md(e,t,n=[]){let r=kd(e);if(e.getAttribute(Od)===r)return;let i=Nd(e);if(i.length===0){e.setAttribute(Od,r);return}let a=[],o=new Set;for(let e of i){let t=u(e.data);if(t.length!==0){a.push({node:e,mentions:t});for(let e of t)o.add(e.path)}}if(a.length===0){e.setAttribute(Od,r);return}let s=[...o],c=await t.resolveAll(s,n),l=new Map(s.map((e,t)=>[e,c[t]?.matches??[]]));for(let{node:e,mentions:t}of a){if(!e.isConnected)continue;let n=t.filter(e=>(l.get(e.path)?.length??0)>0);n.length!==0&&Pd(e,n,l)}e.setAttribute(Od,kd(e))}function Nd(e){let t=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode(t){if(!t.nodeValue||t.nodeValue.trim().length===0)return NodeFilter.FILTER_REJECT;for(let n=t.parentElement;n&&n!==e;n=n.parentElement)if(Ad.has(n.tagName)||n.classList.contains(`file-mention`))return NodeFilter.FILTER_REJECT;return NodeFilter.FILTER_ACCEPT}}),n=[];for(let e=t.nextNode();e!==null;e=t.nextNode())n.push(e);return n}function Pd(e,t,n){let r=e.ownerDocument,i=e.data,a=r.createDocumentFragment(),o=0;for(let e of t){let t=n.get(e.path)??[],s=t[0];s&&(e.start>o&&a.appendChild(r.createTextNode(i.slice(o,e.start))),a.appendChild(Fd(r,i.slice(e.start,e.end),s,t,e.line)),o=e.end)}o<i.length&&a.appendChild(r.createTextNode(i.slice(o))),e.parentNode?.replaceChild(a,e)}function Fd(e,t,n,r,i){let a=e.createElement(`a`);return a.className=Dd,a.textContent=t,a.href=`#${n}`,a.dataset.path=n,i!==void 0&&(a.dataset.line=String(i)),a.title=r.length>1?`${n}\n(+${r.length-1} other match${r.length>2?`es`:``})`:n,a.addEventListener(`click`,e=>{e.preventDefault(),e.stopPropagation();let t={path:n,alternatives:r,...i===void 0?{}:{line:i}};a.dispatchEvent(new CustomEvent(jd,{detail:t,bubbles:!0,composed:!0}))}),a}var Id=`slicc-agent-message`,Ld=`slicc-action-row[${_}]`;function Rd(e,t){let n=[],r=e.querySelectorAll(Ld);for(let e of r){if(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_FOLLOWING)break;n.push(e.getAttribute(`data-file-paths`)??``)}return n.slice(-40).flatMap(e=>d(e))}function zd(e){let t=globalThis.requestIdleCallback;typeof t==`function`?t(e):setTimeout(e,0)}function Bd(e){try{return Vd(e)}catch(t){return e.log.error(`File mention wiring failed; continuing without it`,t),()=>{}}}function Vd(e){let{thread:t,openFs:n,log:r}=e;if(!(t instanceof Node))return()=>{};let i=null,a=()=>(i??=n().then(e=>new Td(e)),i),o=e=>{if(!(e instanceof HTMLElement)||e.hasAttribute(`streaming`))return;let n=e.querySelector(`.body`)??e;u(n.textContent??``).length!==0&&zd(()=>{let i=Rd(t,e);a().then(e=>Md(n,e,i)).catch(e=>r.error(`File mention linking failed`,e))})},s=e=>{for(let t of e.querySelectorAll(Id))o(t)};s(t);let c=new MutationObserver(e=>{for(let t of e){if(t.type===`attributes`){t.target instanceof HTMLElement&&o(t.target);continue}for(let e of t.addedNodes)e instanceof HTMLElement&&(e.tagName.toLowerCase()===Id?o(e):s(e));let e=t.target?.closest?.(Id);e&&o(e)}});c.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`streaming`]});let l=e=>{let{path:t,line:i}=e.detail;n().then(e=>S(e,t,i===void 0?{}:{line:i})).catch(e=>r.error(`File mention preview failed`,e))};return t.addEventListener(jd,l),()=>{c.disconnect(),t.removeEventListener(jd,l)}}var Hd=e({DEFAULT_DOCK_TREE_ON_BOOT:()=>cf,DOCK_TREE_STORAGE_KEY:()=>sf,attachWcWorkbench:()=>df,bootLeaderFloat:()=>ff,makeSprinkleAttachImage:()=>uf,prepareWcShell:()=>Jd,wireDockTreePersistence:()=>lf,wireWcChipTips:()=>tf,workspaceForSelection:()=>Kd});function Ud(e){let{controller:t,held:n,jid:r,roster:i}=e,a=t?.stashQueued()??[];if(a.length===0)return;let o=i.find(e=>e.id===r),s=o?Dn(i,o)?.id??o.id:r;n.set(s,[...n.get(s)??[],...a])}function Wd(e){let{controller:t,destination:n,held:r,previousJid:i,roster:a}=e;if(i&&i!==n&&Ud({controller:t,held:r,jid:i,roster:a}),a.some(e=>e.id===n))for(let e of[...r.keys()])a.some(t=>t.id===e)||r.delete(e);let o=r.get(n);o&&(r.delete(n),t?.restoreQueued(o))}function Gd(e,t){let n=null,r=null;return{shownUnitId:()=>r,watch:i=>{r===i&&n||(n?.(),r=i,n=e().subscribe(i,e=>{e.type===`snapshot`&&r===i&&t(e.snapshot.messages,e.snapshot.queuedIds)}))}}}function Kd(e){let{client:t,selectedId:n}=e,r=n===void 0?void 0:t.getScoop(n);return n!==void 0&&!r&&e.clearSelection(),_n(t.getScoops(),r)}function qd(e){let{refs:t}=e,n=null,r=new Map;return{clear:()=>{n=null},getSelected:()=>n,holdQueue:()=>{let t=n?.id;t&&Ud({controller:e.controller(),held:r,jid:t,roster:e.client().currentUnits()})},selectScoop:i=>{let a=n?.id??null;n=i;let o=Nn(jn(i)),s=e.host();Wd({controller:e.controller(),destination:i.id,held:r,previousJid:a,roster:e.client().currentUnits()});let c=e.lickBackpressure.get(i.id);e.controller()?.setLickBackpressure(c?.count??0,c?.waitingMs??0,zn(i)),e.controller()?.setReadOnly(o),o||t.inputCard.removeAttribute(`disabled`),wl(t,i,e.client().currentUnits(),s.getRecord?.bind(s),{skipModelPill:s.ownsModelPill===!0}),e.client().snapshot(i.id).catch(()=>void 0),e.watchUnit(i.id),e.controller()?.setProcessing(e.client().currentUnits().find(e=>e.id===i.id)?.state===`working`),t.switcher.hasAttribute(`attention`)||t.switcher.setAttribute(`attention`,i.id),e.wiring().refreshScoops?.(),e.workbench()?.refreshMemory(),e.workbench()?.refreshFiles(),s.onSelectionApplied?.()}}}function Jd(e,t){let n=ae(e,{messages:[],scoops:[],floatLabel:t,placeholder:`Ask sliccy, or describe a change…`,urlState:!0}),r=null,i=null,a=as,o=null,s=()=>o??Q(h),c=new Map,l=!1,u=null,d=new Set,f=Gd(()=>s(),(e,t)=>{r?.loadMessages(e,t),a.onSnapshotRendered?.(e)}).watch,p=qd({client:s,controller:()=>r,host:()=>a,lickBackpressure:c,refs:n,watchUnit:f,wiring:()=>h,workbench:()=>u}),m=p.selectScoop,h={refs:n,statuses:new Map,fills:new Map,phases:new Map,turns:new Map,lickBackpressure:c,lastActivity:new Map,pendingUrlContext:n.thread.urlContext??null,getController:()=>r,getClient:()=>i,getSelected:()=>p.getSelected(),selectScoop:m,notifyReady:()=>{l=!0;for(let e of d)e()}};return{refs:n,wiring:h,setClient:e=>{i=e},setChatTransport:(e,t)=>{o=e,a=t},getChatHost:()=>a,selectScoop:m,getSelected:()=>p.getSelected(),clearSelection:()=>p.clear(),holdQueuedPile:()=>p.holdQueue(),watchUnit:f,getController:()=>r,setController:e=>{r=e},setActivateSurface:e=>{u=e;let t=new Set(n.dockTree.getSurfaceIds());for(let n of[`files`,`term`,`memory`,`monitor`])t.has(n)&&(l?e.activate(n):d.add(()=>e.activate(n)))},onClientReady:e=>{d.add(e),l&&e()}}}function Yd(e){let t=null;return()=>(t??=(async()=>{let[{createRemoteVfsClient:t},{createRemoteWritableVfsClient:n}]=await Promise.all([i(()=>import(`./remote-vfs-client-Cs1yUtQm.js`),__vite__mapDeps([65,46])),i(()=>import(`./writable-vfs-client-CQe6oZ75.js`),__vite__mapDeps([66,46]))]);return{reader:t({transport:e.getTransport()}),writer:n({transport:e.getTransport()})}})(),t)}function Xd(e,t,n,r,a){e.onClientReady(()=>{r.intercept||i(async()=>{let{wireWcOnboarding:e}=await import(`./wc-onboarding-B2H4AYp_.js`);return{wireWcOnboarding:e}},__vite__mapDeps([67,2,3,47,1,48,8,9,10,11,12,13,14,15,16,5,17,18,19,20,21,22,23,24,25,6,7,26,27,28,29,30,49,50,68])).then(({wireWcOnboarding:r})=>r({client:t,getController:()=>e.getController(),openVfs:n,log:a})).then(e=>{r.intercept=e.interceptWelcomeLick}).catch(e=>a.error(`WC onboarding wiring failed`,e))})}function Zd(e,t){let n=()=>{t.getSessionStats?.().then(t=>{if(!t)return;e.refs.floatbar.setAttribute(`spent`,t.totalCost.toFixed(2)),typeof t.burnRate==`number`&&Number.isFinite(t.burnRate)?e.refs.floatbar.setAttribute(`rate`,t.burnRate.toFixed(2)):e.refs.floatbar.removeAttribute(`rate`);let n=e.refs.floatbar;t.models&&(n.costModels=t.models),t.scoops&&(n.costScoops=t.scoops),n.budget=t.budget?{percent:t.budget.percent,status:t.budget.status,window:t.budget.window,resets:Dt(t.budget.resetsAt)}:null,e.fills.clear();for(let n of t.fills)e.fills.set(n.jid,n.fill);e.refreshScoops?.()})};return setInterval(n,15e3),n}function Qd(e,t,n){let r=t.standalone;r&&i(async()=>{let{wireWcBrowser:e}=await import(`./wc-browser-CN_DJa1b.js`);return{wireWcBrowser:e}},__vite__mapDeps([69,70,6,71,3,72,73,0,1,2,4,5,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,74])).then(({wireWcBrowser:t})=>t({refs:e.refs,browser:r.browser,log:n})).catch(e=>n.error(`WC browser overlay wiring failed`,e))}function $d(e){return{assistantLabel:e.assistantLabel,name:e.name,role:O(e)?`primary`:`child`}}function ef(e){return()=>{e.triggerPlaceholder();let t=e.boot.getSelected()?.id;if(e.boot.wiring.awaitingInput=t??null,e.boot.wiring.refreshScoops?.(),e.boot.wiring.notifyScoopStateChanged?.(),e.refreshStats(),!t)return;e.boot.refs.switcher.setAttribute(`attention`,t);let n=e.boot.getController()?.getMessages().filter(e=>e.role===`assistant`).at(-1);n&&e.boot.wiring.lastActivity.set(t,String(n.content??``).slice(0,600))}}function tf(e){let t=new Map,n=new Set;e.switcher.addEventListener(`pointerover`,r=>{let a=r.target?.closest?.(`.slicc-agent-tabs__segment`);if(!a||!e.switcher.contains(a))return;let o=a.dataset.k??``,s=e.getScoops().find(e=>e.jid===o);if(!s)return;let c=e.lastActivity.get(o)??``,l=t.get(o);if(l&&l.activity===c){a.title=l.tip;return}a.title||=Pn($d(s)),!(!c||n.has(o))&&(n.add(o),(async()=>{try{let n=await(e.labelFn??(await i(async()=>{let{quickLabel:e}=await import(`./quick-llm-BFOKPe7I.js`).then(e=>e.n);return{quickLabel:e}},__vite__mapDeps([42,1,9,10,11,2,12,13,14,3,7,8,15,16,5,17,18,19,20,21,22,23,24,25,26,27,28,29,43,32]))).quickLabel)({system:`One line for a hover tooltip: at most 14 words, present tense, no quotes, no trailing period.`,prompt:`Summarize what this agent has been doing.\nAgent: ${O(s)?`${Pn($d(s))} (a main agent)`:s.name}\nMost recent activity:\n${c}`,maxTokens:40});n&&(t.set(o,{activity:c,tip:n}),a.title=n)}finally{n.delete(o)}})())})}async function nf(e,t,n){let{RemoteTerminalView:r}=await i(async()=>{let{RemoteTerminalView:e}=await import(`./remote-terminal-view-CA-SfvvZ.js`);return{RemoteTerminalView:e}},__vite__mapDeps([75,1,2,25,3,53,34,35,19,41,76,15,40,39,77,78])),{fetchSecretEnvVars:a}=await i(async()=>{let{fetchSecretEnvVars:e}=await import(`./secret-env-DgrZZVFU.js`);return{fetchSecretEnvVars:e}},__vite__mapDeps([79,3,16,1,2,5,17,18,19,21,20,22,23])),o=await a(),s=new r({client:t,cwd:`/`,env:Object.keys(o).length>0?o:void 0});await new Promise(t=>e.onClientReady(t)),await s.mount(n),globalThis.__slicc_terminal_view=s,window.addEventListener(`beforeunload`,()=>s.dispose(),{once:!0})}function rf(e,t,n){let r=t=>{if(t.startsWith(`freezer:`)){n(t.slice(8));return}let r=On(Q(e.wiring).currentUnits(),t);r&&r.id!==e.getSelected()?.id&&e.selectScoop(r)};e.refs.thread.addEventListener(`slicc-url-context`,e=>{let t=e.detail?.context;t&&r(t)});let i=e.wiring.pendingUrlContext;i?.startsWith(`freezer:`)&&e.onClientReady(()=>{e.wiring.pendingUrlContext===i&&(e.wiring.pendingUrlContext=null,r(i))})}function af(e,t,n,r){i(async()=>{let{installLeaderPermissionsSurface:e,installMountPendingConsumer:t}=await import(`./wc-permissions-CCA-0PP4.js`);return{installLeaderPermissionsSurface:e,installMountPendingConsumer:t}},__vite__mapDeps([80,2,3,53])).then(async({installLeaderPermissionsSurface:r,installMountPendingConsumer:a})=>{let o=n.standalone?.runtimeMode??`standalone`,{buildLeaderPermissionProviders:s,isExtensionRuntime:c}=await i(async()=>{let{buildLeaderPermissionProviders:e,isExtensionRuntime:t}=await import(`./wc-permissions-providers-wSXekwkO.js`);return{buildLeaderPermissionProviders:e,isExtensionRuntime:t}},__vite__mapDeps([81,2,19]));r({runtimeMode:o,providers:await s(c()||o===`extension`||o===`extension-detached`)}),a({runShell:of(e,t)})}).catch(e=>r.warn(`WC permissions surface wiring failed`,e)),(n.standalone?.runtimeMode??`standalone`)!==`cherry`&&i(async()=>{let{installSecretRequestSurface:e}=await import(`./wc-secret-request-D7dksNvu.js`);return{installSecretRequestSurface:e}},__vite__mapDeps([82,3,0,1,2,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,83])).then(({installSecretRequestSurface:e})=>e()).catch(e=>r.warn(`WC secret request surface wiring failed`,e))}function of(e,t){let n=null,r=()=>(n||=(async()=>{await new Promise(t=>e.onClientReady(t));let{TerminalSessionClient:n}=await i(async()=>{let{TerminalSessionClient:e}=await import(`./terminal-session-client-ADzaWGFd.js`).then(e=>e.n);return{TerminalSessionClient:e}},__vite__mapDeps([78,1])),r=new n({client:t,sid:`mount-drop-${Date.now()}`});return await r.open({cwd:`/workspace`}),r})().catch(e=>{throw n=null,e}),n);return async e=>(await r()).exec(e)}var sf=`slicc-dock-tree:default`,cf={zones:{top:null,left:{type:`leaf`,surfaceId:`chat`},middle:null,right:null,bottom:null},rowFr:{top:1,center:1,bottom:1},colFr:{left:3,middle:1,right:1}};function lf(e,t){let n=e.dockTree,r=e.dockTree,i=e=>{try{localStorage.setItem(sf,JSON.stringify(e))}catch{}};n.addEventListener(`dock-tree-change`,e=>{i(e.detail?.tree)}),n.addEventListener(`dock-tree-resize`,e=>{i(e.detail?.tree)});try{let e=localStorage.getItem(sf);r.setTree(e?JSON.parse(e):cf)}catch(e){t.warn(`WC dock-tree restore failed — seeding the default layout`,e),r.setTree(cf)}}function uf(e,t){return(n,r,i)=>{let a=e.getAttachStage();if(!a){t.warn(`sprinkle attachImage dropped: composer stage not ready yet`);return}let o=n.match(/^data:(image\/[^;]+);base64,([A-Za-z0-9+/=]+)$/),s=o?o[2]:n,c=o?o[1]:i??`image/png`,l=c.split(`/`)[1]?.replace(`jpeg`,`jpg`).replace(`svg+xml`,`svg`)??`png`,u=r??`annotation-${Date.now()}.${l}`;a.add({id:`att-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,name:u,mimeType:c,size:Math.floor(s.length*3/4),kind:`image`,data:s})}}function df(e,t,n,r,a,o={}){i(async()=>{let{initTimestampPreference:e}=await import(`./wc-shell-DoXzfb-g.js`).then(e=>e.X);return{initTimestampPreference:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33])).then(({initTimestampPreference:e})=>e()).catch(()=>void 0);let{refs:s}=e;e.setClient(t),i(async()=>{let{watchSprinkleThemeBroadcast:e}=await import(`./theme-DFKCBK8N.js`).then(e=>e.i);return{watchSprinkleThemeBroadcast:e}},__vite__mapDeps([84,1,85,3])).then(({watchSprinkleThemeBroadcast:e})=>e()).catch(()=>void 0),i(async()=>{let{applyThemeOverrides:e}=await import(`./theme-engine-B5SkYf3E.js`).then(e=>e.m);return{applyThemeOverrides:e}},__vite__mapDeps([85,1,3])).then(({applyThemeOverrides:e})=>e()).catch(()=>void 0);let c=gt(`panel-layouts`);s.dockTree.tilesMovable=c,c||lf(s,a);let l=null,u=Zd(e.wiring,t),d=()=>l?.(),f=r.welcome??{intercept:null},p=Q(e.wiring),{agentHandle:m}=n;e.onClientReady(u);let h=Yd(t),g=async()=>(await h()).reader;o.standalone?.runtimeMode!==`cherry`&&o.standalone?.runtimeMode!==`hosted-leader`?Xd(e,t,h,f,a):f.intercept=al({openVfs:async()=>(await h()).writer,log:a});let _=El({boot:e,client:t,setRefreshPlaceholder:e=>{l=e},triggerPlaceholder:d,openReader:g,openWriter:async()=>(await h()).writer,log:a});r.setAttachmentSource(()=>_.getAttachStage()?.take()),r.setTurnIdleHook(ef({boot:e,triggerPlaceholder:d,refreshStats:u})),tf({switcher:s.switcher,getScoops:()=>t.getScoops(),lastActivity:e.wiring.lastActivity}),Qd(e,o,a),i(async()=>{let{installWcComputers:e}=await import(`./wc-computers-BeLXdfFY.js`);return{installWcComputers:e}},__vite__mapDeps([73,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,74])).then(({installWcComputers:e})=>e({openFs:g,log:a})).catch(e=>a.error(`WC computers wiring failed`,e)),af(e,t,o,a);let v=pd({fileTree:s.fileTree,termSurface:s.termSurface,memoryHost:s.memoryHost,monitor:s.monitor,openFs:g,openWriter:async()=>(await h()).writer,onKernelReady:t=>e.onClientReady(t),getMonitorDeps:()=>ou({client:t,openReader:g,storage:window.localStorage}),getWorkspace:()=>Kd({client:t,clearSelection:e.clearSelection,selectedId:e.getSelected()?.id}),mountTerminal:n=>nf(e,t,n),insertReference:e=>{let t=s.inputCard,n=t.value.trim();t.value=n?`${n} @${e}`:`@${e}`,t.focus()},log:a});e.setActivateSurface(v),c&&i(async()=>{let{panelizeShell:e}=await import(`./panelize-shell-CnkbfDJk.js`);return{panelizeShell:e}},__vite__mapDeps([86,3,0,1,2,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,87,88])).then(({panelizeShell:e})=>e(s,void 0,void 0,{onToolPanelActivate:e=>v.activate(e),onToolPanelDeactivate:e=>v.deactivate(e)})).catch(e=>a.error(`panelize failed — keeping the classic shell`,e)),Bd({thread:s.thread,openFs:g,log:a}),s.floatbar.addEventListener(`click`,()=>{let e=s.dock;e.active===`monitor`?e.collapse():e.selectItem(`monitor`)});let y=ql({refs:s,openVfs:h,client:t,getUnits:()=>p.currentUnits(),getController:()=>e.getController(),getSelected:()=>e.getSelected(),selectScoop:e.selectScoop,clearSelection:e.clearSelection,holdQueuedPile:e.holdQueuedPile,log:a}),{refreshFreezer:b,openFrozen:ee,getViewedFrozenSessionId:x}=y;if(b(),e.onClientReady(b),gt(`multiple-cones`)){let n=rl({freezer:s.freezer,client:t,getSelected:()=>e.getSelected(),getUnits:()=>p.currentUnits(),selectScoop:e.selectScoop,freezeCone:y.freezeCone,log:a});e.wiring.refreshConeActions=n.refresh,e.onClientReady(n.refresh)}rf(e,t,ee),e.onClientReady(()=>{h().then(async({reader:e,writer:t})=>{let{loadShortcutConfig:n}=await i(async()=>{let{loadShortcutConfig:e}=await import(`./wc-shortcut-config-vhhAdCG-.js`);return{loadShortcutConfig:e}},__vite__mapDeps([89,3,0,1,2,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33]));await n({reader:e,writer:t,apply:({keymap:e,trigger:t})=>{s.shortcuts.setKeymap(e),s.shortcuts.setTrigger(t)}})}).catch(e=>a.warn(`WC shortcut config load failed`,e))}),h().then(async({reader:e})=>{let{installPreviewVfsResponder:t}=await i(async()=>{let{installPreviewVfsResponder:e}=await import(`./preview-vfs-responder-Vn6wxJvK.js`);return{installPreviewVfsResponder:e}},[]);t({channel:new BroadcastChannel(`preview-vfs`),getReader:()=>e,logger:a})}).catch(e=>a.warn(`WC page-VFS support wiring failed`,e)),h().then(async({reader:n,writer:r})=>{let{createRemoteSprinkleVfs:c}=await i(async()=>{let{createRemoteSprinkleVfs:e}=await import(`./remote-sprinkle-vfs-D-Wz5t8k.js`);return{createRemoteSprinkleVfs:e}},__vite__mapDeps([90,91,92,46])),l=(await i(async()=>{let{getPanelizedShell:e}=await import(`./panelize-shell-CnkbfDJk.js`);return{getPanelizedShell:e}},__vite__mapDeps([86,3,0,1,2,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,87,88]))).getPanelizedShell(),{wireWcSprinkles:u}=await i(async()=>{let{wireWcSprinkles:e}=await import(`./wc-sprinkles-Dzc2DnW1.js`);return{wireWcSprinkles:e}},__vite__mapDeps([93,2,0,1,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,94,68])),d=await u({refs:s,client:t,getUnits:()=>p.currentUnits(),getSelected:()=>e.getSelected(),interceptWelcomeLick:e=>f.intercept?.(e)??!1,fs:c({reader:n,writer:r}),instanceId:o.instanceId,onAttachImage:uf(_,a),onToolPanelActivate:e=>v.activate(e),onToolPanelDeactivate:e=>v.deactivate(e),hostSprinkleSurface:l?(e,t)=>l.hostSprinkleSurface(e,t):void 0,removeSprinkleSurface:l?e=>l.removeSprinkleSurface(e):void 0,log:a});e.onClientReady(()=>void d.resync());let{getPanelizedShell:y}=await i(async()=>{let{getPanelizedShell:e}=await import(`./panelize-shell-CnkbfDJk.js`);return{getPanelizedShell:e}},__vite__mapDeps([86,3,0,1,2,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,87,88])),b=y();if(b){let e=c({reader:n,writer:r});b.attachFs(e);let{registerAgentPanels:t}=await i(async()=>{let{registerAgentPanels:e}=await import(`./agent-panels-DsmU_IkC.js`);return{registerAgentPanels:e}},__vite__mapDeps([95,3,0,1,2,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33]));await t(e).catch(e=>a.warn(`agent panel discovery failed`,e))}else{let{setLayoutApplier:e}=await i(async()=>{let{setLayoutApplier:e}=await import(`./layout-apply-registry-Cw730jao.js`);return{setLayoutApplier:e}},[]),{applyLayout:t}=await i(async()=>{let{applyLayout:e}=await import(`./apply-layout-Dvj6HbU2.js`);return{applyLayout:e}},__vite__mapDeps([96,93,2,0,1,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,94,68]));e(e=>t(d.zone,e))}if(o.standalone&&o.instanceId){let{wireWcTray:n}=await i(async()=>{let{wireWcTray:e}=await import(`./wc-tray-Bo_zfGS7.js`);return{wireWcTray:e}},__vite__mapDeps([97,2,3,0,1,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,70,98,99,100,41,40,101,39,77,64,84,85,49,102,68,103,104,47,48,50,53,92,78,56,72,105,106,94])),r=d.zone.callbacks(),c=await n({refs:s,client:t,browser:o.standalone.browser,realCdpTransport:o.standalone.realCdpTransport,instanceId:o.instanceId,runtimeMode:o.standalone.runtimeMode,sprinkleManager:d.manager,addSprinkle:(e,t,n)=>r.addSprinkle(e,t,n),removeSprinkle:e=>r.removeSprinkle(e),getController:()=>e.getController(),getSelectedJid:()=>e.getSelected()?.id??`cone`,agentHandle:m,workUnits:p,restoreLocalChrome:()=>{e.wiring.refreshScoops?.();let n=e.getSelected();n&&wl(s,n,p.currentUnits(),e=>t.getScoop(e))},openFs:g,openWriter:async()=>(await h()).writer,window,log:a});e.wiring.notifyScoopStateChanged=()=>c.scheduleScoopsListBroadcast(),e.wiring.notifyUnitStatus=(e,t)=>c.broadcastUnitStatus(e,t===`processing`?`processing`:`ready`)}}).catch(e=>a.error(`WC sprinkle/tray wiring failed`,e));{let n=new Xn(new ur),r=br(new Oc({collection:{listScoops:()=>t.getScoops(),isProcessing:e=>t.isProcessing(e),getAgentMessages:()=>null,loadPersistedSessions:()=>n.loadAgentSessions(),loadUiChatSessions:()=>n.loadChatSessions(),wait:e=>new Promise(t=>setTimeout(t,e))},knownSecrets:Kc(),snapshotStore:{read:async e=>{let{reader:t}=await h();return zc(t,e)},write:async(e,t)=>{let{writer:n}=await h();return Rc(n,e,t)}},vfs:{readFile:async(e,t)=>(await h()).reader.readFile(e,t),readDir:async e=>(await h()).reader.readDir(e),stat:async e=>(await h()).reader.stat(e)},getActiveSessionInfo:()=>{let t=Rn(Q(e.wiring).currentUnits());return{id:t?.id??`session-${Date.now()}`,title:t?.name??`Active Session`}},version:`6.173.2`}));window.addEventListener(`unload`,r,{once:!0})}let S=!1,te=()=>S?Promise.resolve():(S=!0,(async()=>{try{let[{getTranscriptExportService:e},{transcriptZipToBlob:t,downloadTranscriptBlob:n}]=await Promise.all([i(()=>Promise.resolve().then(()=>yr),void 0),i(()=>import(`./wc-transcript-export-B662ne2t.js`),__vite__mapDeps([107,2,98,103,104,1]))]),r=x(),a=r==null?{kind:`active`}:{kind:`frozen`,sessionId:r},o=await e().export(a,{}),{filename:s}=o;await n(await t(o),s)}catch(e){a.error(`Transcript export failed`,e),i(async()=>{let{showTranscriptExportFailure:e}=await import(`./wc-transcript-export-B662ne2t.js`);return{showTranscriptExportFailure:e}},__vite__mapDeps([107,2,98,103,104,1])).then(({showTranscriptExportFailure:t})=>t(e)).catch(e=>a.error(`Transcript export notice failed`,e))}finally{S=!1}})());if(i(async()=>{let{wireWcNav:e}=await import(`./wc-nav-tNldXZAt.js`);return{wireWcNav:e}},__vite__mapDeps([108,2,19,49,50,1,47,48,8,9,10,11,12,13,14,15,3,16,5,17,18,20,21,22,23,24,25,6,7,26,27,28,29,30,56,68,94])).then(({wireWcNav:e})=>e({refs:s,client:t,workUnits:p,getUnits:()=>p.currentUnits(),log:a,onExportTranscript:te,shortcuts:s.shortcuts,persistKeyboardTrigger:async e=>{let{writer:t,reader:n}=await h(),{writeShortcutTrigger:r}=await i(async()=>{let{writeShortcutTrigger:e}=await import(`./wc-shortcut-config-vhhAdCG-.js`);return{writeShortcutTrigger:e}},__vite__mapDeps([89,3,0,1,2,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33]));await r({reader:n,writer:t},e)}})).catch(e=>a.error(`WC nav wiring failed`,e)),i(async()=>{let{getComposerSpeech:e,setComposerSpeechInstanceId:t}=await import(`./composer-speech-D66bpqkf.js`);return{getComposerSpeech:e,setComposerSpeechInstanceId:t}},__vite__mapDeps([109,3,0,1,2,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,53,62,63,64,110])).then(({getComposerSpeech:e,setComposerSpeechInstanceId:t})=>{let n=s.composer;t(o.instanceId),n.speech=e(),n.setAttribute(`ptt`,``)}).catch(e=>a.error(`WC push-to-talk wiring failed`,e)),i(async()=>{let{setSpeakAssetsInstanceId:e}=await import(`./speak-BzdoLFEj.js`);return{setSpeakAssetsInstanceId:e}},__vite__mapDeps([61,2,3,19,62,63,0,1,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,20,21,22,23,24,25,26,27,28,29,30,31,32,33,64])).then(({setSpeakAssetsInstanceId:e})=>e(o.instanceId)).catch(e=>a.error(`WC say warmup wiring failed`,e)),o.standalone)return()=>{i(async()=>{let{schedulePendingSessionCatchup:e}=await import(`./new-session-YYnEc0rh.js`);return{schedulePendingSessionCatchup:e}},__vite__mapDeps([55,2,3,7,1,8,9,10,11,12,13,14,15,16,5,17,18,19,20,21,22,23,24,25,26,27,28,29,47,48,6,30,49,50,43])).then(({schedulePendingSessionCatchup:e})=>e({openVfs:async()=>(await h()).writer,onComplete:b})).catch(e=>a.warn(`Pending session catch-up scheduling failed`,e))}}async function ff(e,t,n=`standalone`){let{browser:r,realCdpTransport:a,instanceId:o,localApiBaseUrl:s,bridgeToken:c,localLickWsUrl:l,extensionDelegateId:u,attachLickForwardingClient:d}=await yt({runtimeMode:n,envBaseUrl:null,window,log:t}),{floatKindForRuntimeMode:f,floatLabelForKind:p,resolveStandaloneFloatKind:m}=await i(async()=>{let{floatKindForRuntimeMode:e,floatLabelForKind:t,resolveStandaloneFloatKind:n}=await Promise.resolve().then(()=>xu);return{floatKindForRuntimeMode:e,floatLabelForKind:t,resolveStandaloneFloatKind:n}},void 0),h=n===`standalone`?await m():f(n),g=p(h);o&&vt(o);let{syncFsBridgeEnabled:_,syncFsChannelNonce:v}=cu(),y=!1,b,ee,{boot:x}=await Au(e,t,{floatKind:h,floatLabel:g,connect:e=>{b=bs({realCdpTransport:a,reconnectCdp:()=>r.reconnectIfNeeded(),instanceId:o,makeClient:t=>new ns(cl(e.wiring),t),localApiBaseUrl:s,bridgeToken:c,syncFsBridgeEnabled:_,syncFsChannelNonce:v,localLickWsUrl:l,extensionDelegateId:u,flagFloat:n,onWorkerScriptError:()=>{St()},onReadyStall:e=>{y=!0,i(()=>import(`./boot-stall-overlay-Pxp4nHfq.js`).then(t=>t.showBootStallOverlay(document,e)),[])},onLateReady:()=>{St()}}),ls({send:e=>b.client.sendRaw(e)}),d?.(b.client);let f=is(b.client);return{client:Q(e.wiring),host:f,workbench:(e,i)=>{ee=df(e,b.client,i,f,t,{instanceId:o,standalone:{browser:r,floatKind:h,realCdpTransport:a,runtimeMode:n}})}}}}),{setupSudoStandalone:S}=await i(async()=>{let{setupSudoStandalone:e}=await import(`./main-Cb0XbEti.js`).then(e=>e.a);return{setupSudoStandalone:e}},__vite__mapDeps([47,1,48,8,9,10,11,2,12,13,14,15,3,16,5,17,18,19,20,21,22,23,24,25,6,7,26,27,28,29,30,49,50]));await S({log:t});try{await b.ready}finally{y&&i(()=>import(`./boot-stall-overlay-Pxp4nHfq.js`).then(e=>e.removeBootStallOverlay(document)),[])}x.wiring.notifyReady?.(),globalThis.__slicc_kernel_ready=!0,t.info(`WC live shell ready`,{scoops:b.client.getScoops().length}),ee?.();let{consumeAutoPrompt:te}=await i(async()=>{let{consumeAutoPrompt:e}=await import(`./auto-prompt-Mj-vUQeB.js`);return{consumeAutoPrompt:e}},[]),ne=te(window.location.search);ne&&(x.getController()?.sendUserMessage(ne),t.info(`Auto-prompt submitted`,{length:ne.length}))}export{Eo as A,Br as B,ns as C,Co as D,Po as E,Ma as F,yr as H,io as I,ja as L,Oo as M,jo as N,Ao as O,No as P,So as R,is as S,Fo as T,ur as U,Sr as V,Xn as W,ul as _,lu as a,Q as b,$l as c,ru as d,Ol as f,dl as g,ll as h,uu as i,ko as j,Mo as k,Yl as l,xl as m,Hd as n,Xl as o,Dl as p,Au as r,tu as s,df as t,Ql as u,fl as v,Ho as w,ss as x,cl as y,no as z};
|