sliccy 6.165.0 → 6.167.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/node-server/_shared/base64.d.ts.map +1 -1
- package/dist/node-server/_shared/base64.js +7 -3
- package/dist/node-server/_shared/base64.js.map +1 -1
- package/dist/node-server/_shared/computer-protocol.d.ts +110 -0
- package/dist/node-server/_shared/computer-protocol.d.ts.map +1 -0
- package/dist/node-server/_shared/computer-protocol.js +10 -0
- package/dist/node-server/_shared/computer-protocol.js.map +1 -0
- package/dist/node-server/_shared/index.d.ts +1 -0
- package/dist/node-server/_shared/index.d.ts.map +1 -1
- package/dist/node-server/_shared/index.js +1 -0
- package/dist/node-server/_shared/index.js.map +1 -1
- package/dist/node-server/_shared/tray-sync-protocol.d.ts +66 -2
- package/dist/node-server/_shared/tray-sync-protocol.d.ts.map +1 -1
- package/dist/node-server/_shared/tray-sync-protocol.js +75 -2
- package/dist/node-server/_shared/tray-sync-protocol.js.map +1 -1
- package/dist/ui/.vite/manifest.json +285 -261
- package/dist/ui/assets/{SKILL-C8DJkgFD.js → SKILL-BGEZa-y0.js} +1 -1
- package/dist/ui/assets/SKILL-CWR-bsvH.js +1 -0
- package/dist/ui/assets/SKILL-DEFDsScb.js +1 -0
- package/dist/ui/assets/{SKILL-0AeLgxT3.js → SKILL-DZoCcID_.js} +1 -1
- package/dist/ui/assets/{account-store-lzZlhljv.js → account-store-B05_LKnj.js} +1 -1
- package/dist/ui/assets/{account-store-CJHBoL7P.js → account-store-CNTI4kr_.js} +2 -2
- package/dist/ui/assets/{adobe-DbBJWbF9.js → adobe-CRRWEbtf.js} +2 -2
- package/dist/ui/assets/{adobe-DUaaJHme.js → adobe-nu3irXcy.js} +1 -1
- package/dist/ui/assets/{agent-panels-DQh4wRpa.js → agent-panels-DvH_qfTh.js} +1 -1
- package/dist/ui/assets/{almost-bash-shell-headless-DdfO5taA.js → almost-bash-shell-headless-BA5r_r61.js} +506 -508
- package/dist/ui/assets/{apply-layout-DeIHdw5o.js → apply-layout-CASSSWEy.js} +1 -1
- package/dist/ui/assets/{apps-X6cH7Ngi.js → apps-BGe9_zJ7.js} +1 -1
- package/dist/ui/assets/{azure-openai-DoDPxnFq.js → azure-openai-C-Iw82HZ.js} +1 -1
- package/dist/ui/assets/{azure-openai-DS5DA5ql.js → azure-openai-DuJciOKd.js} +1 -1
- package/dist/ui/assets/{backend-hostfs-9Xwjq8kU.js → backend-hostfs-DdAVlPMP.js} +1 -1
- package/dist/ui/assets/{base64-DzRgusa4.js → base64-BPBW1Gzr.js} +1 -1
- package/dist/ui/assets/{base64-DJRlyqZu.js → base64-ELzoYfwP.js} +1 -1
- package/dist/ui/assets/bridge-protocol-31SWTdS5.js +1 -0
- package/dist/ui/assets/{capability-Ci9JmpEG.js → capability-C2eJ1wdx.js} +2 -2
- package/dist/ui/assets/{cdp-Bi4OGeyp.js → cdp-DG8TVjf3.js} +1 -1
- package/dist/ui/assets/{cerebras-D9Xp_f8D.js → cerebras-BXwtUxTj.js} +1 -1
- package/dist/ui/assets/{cerebras-BzQeaK2Z.js → cerebras-Xadzrxfp.js} +1 -1
- package/dist/ui/assets/{client-B6iKb_ye.js → client-BDN4zG90.js} +1 -1
- package/dist/ui/assets/{composer-speech-BVpldTNH.js → composer-speech-_uq5e0Bo.js} +1 -1
- package/dist/ui/assets/{connect-surface-CyUMMhhU.js → connect-surface-odDz37TJ.js} +1 -1
- package/dist/ui/assets/{core-BMcS6rur.js → core-BoFWHLIW.js} +1 -1
- package/dist/ui/assets/{core-DP-MJcag.js → core-Bvc89tkf.js} +1 -1
- package/dist/ui/assets/{directed-approval-CaEocD9T.js → directed-approval-D_AXAvuz.js} +1 -1
- package/dist/ui/assets/{discovery-preference-Bw3Fi0jd.js → discovery-preference-TziZ7Yxu.js} +1 -1
- package/dist/ui/assets/encode-frame-B8GkHc2t.js +1 -0
- package/dist/ui/assets/engine-D531XNHE.js +1 -0
- package/dist/ui/assets/{ensure-speech-assets-B9REkBI_.js → ensure-speech-assets-DTj236n-.js} +1 -1
- package/dist/ui/assets/{extension-media-capture-BvLVZFQ0.js → extension-media-capture-DMB4r9UQ.js} +1 -1
- package/dist/ui/assets/{extension-ops-B0oi7ypc.js → extension-ops-DNPAsYbK.js} +1 -1
- package/dist/ui/assets/fake-computer-Jawax3MO.js +352 -0
- package/dist/ui/assets/{float-topology-YtctpJaG.js → float-topology-CurCyQFy.js} +1 -1
- package/dist/ui/assets/{follower-navigate-watcher-DnnHgZbM.js → follower-navigate-watcher-C98XMw_C.js} +1 -1
- package/dist/ui/assets/{frozen-archive-writer-BWuT2QtJ.js → frozen-archive-writer-BIzZxx8R.js} +1 -1
- package/dist/ui/assets/{fs-CmCsE1zE.js → fs-Bq8bUwe2.js} +1 -1
- package/dist/ui/assets/{fs-C3QG5M_q.js → fs-CJs9n90Q.js} +2 -2
- package/dist/ui/assets/{gelatiere-store-ijXRupBc.js → gelatiere-store-BY0hZvSS.js} +1 -1
- package/dist/ui/assets/{gelatiere-unit-BlRXo_Ch.js → gelatiere-unit-DrQwRL3O.js} +1 -1
- package/dist/ui/assets/{github-2vLuAY6J.js → github-D1gd3q6u.js} +2 -2
- package/dist/ui/assets/{github-auth-87ZWWpe-.js → github-auth-CzzE1eDf.js} +1 -1
- package/dist/ui/assets/{github-copilot-DaHQ2cTA.js → github-copilot-Bx2lXrwK.js} +1 -1
- package/dist/ui/assets/{github-copilot-CdwPARvl.js → github-copilot-DidNEEe_.js} +1 -1
- package/dist/ui/assets/{github-install-CCQJ7A9f.js → github-install--_xp8s-S.js} +1 -1
- package/dist/ui/assets/{github-Zcx-gHTn.js → github-uDwUwz5H.js} +1 -1
- package/dist/ui/assets/{github-zip-D4jSHksq.js → github-zip-Bs35nBig.js} +1 -1
- package/dist/ui/assets/{guest-tool-gate-Mu-876Hm.js → guest-tool-gate-B-lZT9hl.js} +1 -1
- package/dist/ui/assets/{handoff-link-NCw3cxSG.js → handoff-link-B3It6xQY.js} +1 -1
- package/dist/ui/assets/{hear-CovWNOND.js → hear-BNmJphKg.js} +1 -1
- package/dist/ui/assets/{help-BmMJZSmm.js → help-C7Nq107k.js} +1 -1
- package/dist/ui/assets/host-iTtS0MRF.js +1 -0
- package/dist/ui/assets/{image-markers-DuyWsic3.js → image-markers-CwM1dvoI.js} +1 -1
- package/dist/ui/assets/{image-markers-BFDmhPy4.js → image-markers-q8JQTtid.js} +1 -1
- package/dist/ui/assets/{installer-BOAaojqu.js → installer-C0xiAs69.js} +1 -1
- package/dist/ui/assets/js-realm-worker-B9Rz0g1p.js +50 -0
- package/dist/ui/assets/jsh-CmIpo35m.js +1 -0
- package/dist/ui/assets/jsh-executor-C7QPZ2Qr.js +18 -0
- package/dist/ui/assets/jsh-runtime-extensions-ddeGEOUw.js +1 -0
- package/dist/ui/assets/{kernel-worker-CrTnmx6N.js → kernel-worker-4aPSVJ1C.js} +38 -38
- package/dist/ui/assets/keys-Dexx8cLD.js +1 -0
- package/dist/ui/assets/{lick-ws-bridge-56mwSRdV.js → lick-ws-bridge-BcAhlead.js} +1 -1
- package/dist/ui/assets/{lick-ws-bridge-D4FyZHWP.js → lick-ws-bridge-DZ0vVYNF.js} +1 -1
- package/dist/ui/assets/{live-session-snapshot-ZXxxxzvO.js → live-session-snapshot-COMr2v0o.js} +1 -1
- package/dist/ui/assets/{local-llm-B6tgSQ84.js → local-llm-DdGb9WMG.js} +1 -1
- package/dist/ui/assets/{local-llm-BDbJaGUp.js → local-llm-DqeU7kV3.js} +1 -1
- package/dist/ui/assets/{main-cherry-D1lfDTVL.js → main-cherry-BGZmJFd_.js} +1 -1
- package/dist/ui/assets/{main-Dxem3Ydy.js → main-jc6OS8lz.js} +3 -3
- package/dist/ui/assets/{memory-curation-seam-ZGh8tSbe.js → memory-curation-seam-B8pprlUo.js} +1 -1
- package/dist/ui/assets/{memory-health-CZHaK5wO.js → memory-health-CGkpyA7o.js} +1 -1
- package/dist/ui/assets/memory-v2-flag-DVbOtPFF.js +1 -0
- package/dist/ui/assets/{memory-write-execute-Csx1-nfE.js → memory-write-execute-B-ahXjaO.js} +1 -1
- package/dist/ui/assets/{mount-DCCYSZwW.js → mount-BzdPNQoA.js} +3 -3
- package/dist/ui/assets/{mount-ByktCqqU.js → mount-FkNAB0be.js} +1 -1
- package/dist/ui/assets/{mount-bridge-client-3a86Q6J0.js → mount-bridge-client-BO0N4wwP.js} +1 -1
- package/dist/ui/assets/{mount-bridge-client-CO2HxXrT.js → mount-bridge-client-CRnohfom.js} +1 -1
- package/dist/ui/assets/{new-session-CG_ht0Kw.js → new-session-B8iOhaK0.js} +2 -2
- package/dist/ui/assets/{oauth-bootstrap-CQmrSZN1.js → oauth-bootstrap-B9PwK4-d.js} +2 -2
- package/dist/ui/assets/{oauth-service-BsW9nY_u.js → oauth-service-Bkaz0Dt4.js} +1 -1
- package/dist/ui/assets/{oauth-service-IlBYPvwr.js → oauth-service-UTPOqIwj.js} +1 -1
- package/dist/ui/assets/{onboarding-orchestrator-DZFSsW4q.js → onboarding-orchestrator-Cc8Glrem.js} +1 -1
- package/dist/ui/assets/{openai-codex-ebHt4iSf.js → openai-codex-BrQ1tsgu.js} +1 -1
- package/dist/ui/assets/{openai-codex-dKSgjDc_.js → openai-codex-DmHr_2RR.js} +1 -1
- package/dist/ui/assets/{openrouter-BQhA4-TP.js → openrouter-BvM36eS5.js} +1 -1
- package/dist/ui/assets/{openrouter-CsPQehN8.js → openrouter-C6WDBJvB.js} +1 -1
- package/dist/ui/assets/{openrouter-free-BppbTow1.js → openrouter-free-CFBzPY5J.js} +1 -1
- package/dist/ui/assets/{openrouter-free-kxAwjRgT.js → openrouter-free-CUKlyrhq.js} +1 -1
- package/dist/ui/assets/{openrouter-oauth-B3y32yAJ.js → openrouter-oauth-DOdpRMfw.js} +1 -1
- package/dist/ui/assets/{openrouter-oauth-D0vfD1T8.js → openrouter-oauth-RC0CxY4X.js} +1 -1
- package/dist/ui/assets/{opfs-mount-ld8qlksz.js → opfs-mount-B78yj9gx.js} +1 -1
- package/dist/ui/assets/{page-approval-service-B8t-buCi.js → page-approval-service-Dy-UA1aK.js} +1 -1
- package/dist/ui/assets/panel-rpc-handlers-CQ_iaU6N.js +2 -0
- package/dist/ui/assets/panelize-shell-CFPiIneK.js +4 -0
- package/dist/ui/assets/{pi-edit-execution-CoRFZcs7.js → pi-edit-execution-BDl_Xp_M.js} +1 -1
- package/dist/ui/assets/{port-bridge-client-Ds3xwapn.js → port-bridge-client-H03Pohgj.js} +1 -1
- package/dist/ui/assets/{port-bridge-client-Dn8JtUyP.js → port-bridge-client-ff8DctEN.js} +1 -1
- package/dist/ui/assets/{provider-DE1pR-oR.js → provider-1ByYSphI.js} +2 -2
- package/dist/ui/assets/{provider-CNKZIWc1.js → provider-Df8LFEZ7.js} +1 -1
- package/dist/ui/assets/{provider-settings-D8qwiWrG.js → provider-settings-Bk-fk9dp.js} +1 -1
- package/dist/ui/assets/provider-store-access-BJPbOUku.js +1 -0
- package/dist/ui/assets/provider-store-access-BrjCBzpb.js +1 -0
- package/dist/ui/assets/{providers-InF4o-U9.js → providers-Q92pCQ8h.js} +2 -2
- package/dist/ui/assets/{providers-CUF9nsUE.js → providers-T_FH_8cU.js} +1 -1
- package/dist/ui/assets/{proxied-fetch-DyBveeCl.js → proxied-fetch-Bl8AeYdt.js} +1 -1
- package/dist/ui/assets/{proxied-fetch-DEK8DT-z.js → proxied-fetch-DARKNygr.js} +1 -1
- package/dist/ui/assets/{quick-llm-CQWR6xvc.js → quick-llm-CbGHjrhX.js} +1 -1
- package/dist/ui/assets/realm-inprocess-CWMnXeN3.js +30 -0
- package/dist/ui/assets/{recovery-screen-DWMb8zIg.js → recovery-screen-DhUqOdby.js} +1 -1
- package/dist/ui/assets/{redirect-uri-CgKdq7-K.js → redirect-uri-Dd0j1fSp.js} +1 -1
- package/dist/ui/assets/registry-Bq_j-EXx.js +1 -0
- package/dist/ui/assets/{request-body-DkfS6k_a.js → request-body-BF4moGct.js} +1 -1
- package/dist/ui/assets/{rest-ops-C8YK53pT.js → rest-ops-CQOwDiTR.js} +1 -1
- package/dist/ui/assets/{rest-ops-DNanZY2-.js → rest-ops-DkUeDpiM.js} +1 -1
- package/dist/ui/assets/{restore-PqiSHlx3.js → restore-CVkulBmU.js} +1 -1
- package/dist/ui/assets/{run-BOkp5G58.js → run-1aYSFTwj.js} +2 -2
- package/dist/ui/assets/{run-F7Bv3Fcu.js → run-BX9uHbIi.js} +1 -1
- package/dist/ui/assets/{run-DJQAmghw.js → run-COfTem8j.js} +1 -1
- package/dist/ui/assets/{run-Bqg_NW7f.js → run-CUCg2cJM.js} +2 -2
- package/dist/ui/assets/{run-Bld9B0W0.js → run-CreCrLyX.js} +1 -1
- package/dist/ui/assets/{run-Do5pAlQf.js → run-DgVV_DFr.js} +3 -3
- package/dist/ui/assets/{run-D0C4PgZM.js → run-DuW-7oJj.js} +2 -2
- package/dist/ui/assets/run-DvD576xV.js +53 -0
- package/dist/ui/assets/{run-w1tdYqAg.js → run-IexPmM2B.js} +2 -2
- package/dist/ui/assets/{run-DoD-L3x8.js → run-ZmpHaamT.js} +2 -2
- package/dist/ui/assets/{screencapture-media-B1iFS6Qy.js → screencapture-media-DL5YxrlG.js} +1 -1
- package/dist/ui/assets/{screencapture-run-XrgS6hEd.js → screencapture-run-yMA5c_HS.js} +1 -1
- package/dist/ui/assets/{secret-env-CDLWFhsq.js → secret-env-BhWGz7yx.js} +1 -1
- package/dist/ui/assets/secret-topology-CVneCnID.js +1 -0
- package/dist/ui/assets/{secrets-bridge-client-ZpBL1Zhl.js → secrets-bridge-client-BS3V1JBF.js} +1 -1
- package/dist/ui/assets/{secrets-bridge-client--VZ3E0yk.js → secrets-bridge-client-C0tvQeuX.js} +1 -1
- package/dist/ui/assets/{session-command-memory-BKzFoCAZ.js → session-command-memory-DzuRy-nC.js} +2 -2
- package/dist/ui/assets/{session-jsonl-DjDV9zx6.js → session-jsonl-D01HYAS2.js} +1 -1
- package/dist/ui/assets/{session-jsonl-C7a0swa5.js → session-jsonl-iOOR_32X.js} +1 -1
- package/dist/ui/assets/{session-search-index-CMRSS2CP.js → session-search-index-CABvtt-r.js} +1 -1
- package/dist/ui/assets/{setup-feature-flags-remote-BmKhybEI.js → setup-feature-flags-remote-CvstKwBW.js} +1 -1
- package/dist/ui/assets/{signed-fetch-DDtJ0TE5.js → signed-fetch-7NwdVmf1.js} +1 -1
- package/dist/ui/assets/{silent-renew-backoff-CBUhiIba.js → silent-renew-backoff-CXHqSiPb.js} +1 -1
- package/dist/ui/assets/{silent-renew-backoff-DIMz5UqB.js → silent-renew-backoff-Dmz3DJHb.js} +1 -1
- package/dist/ui/assets/slicc-version-CN6V2aMa.js +1 -0
- package/dist/ui/assets/{snapshot-DyCo7e-C.js → snapshot-BcYaw9Ip.js} +1 -1
- package/dist/ui/assets/{snapshot-features-BIG7eB0k.js → snapshot-features-3xslkGtL.js} +1 -1
- package/dist/ui/assets/{soundscape-bHynTI4A.js → soundscape-TygolFwj.js} +1 -1
- package/dist/ui/assets/{speak-DbL0fEQT.js → speak-BCLm04Z2.js} +1 -1
- package/dist/ui/assets/{sprinkle-manager-Bhwou11b.js → sprinkle-manager-DDzNanda.js} +1 -1
- package/dist/ui/assets/{sprinkle-renderer-CEIEQSMS.js → sprinkle-renderer-B-CADNjq.js} +1 -1
- package/dist/ui/assets/{state-BdNtTsoR.js → state-BCTAzK_L.js} +1 -1
- package/dist/ui/assets/{store-CJD-1zaX.js → store-C-AW4ogv.js} +1 -1
- package/dist/ui/assets/{store-BRXCCWDC.js → store-CzlK9KIc.js} +1 -1
- package/dist/ui/assets/{sudo-QHJEgCZR.js → sudo-BtkDnUA_.js} +1 -1
- package/dist/ui/assets/{supervisor-DILjXQCB.js → supervisor-B6-QPxI3.js} +1 -1
- package/dist/ui/assets/{sync-dialog-8D9LiBVV.js → sync-dialog-B4G7kCwj.js} +1 -1
- package/dist/ui/assets/tab-ToMhjbM4.js +1 -0
- package/dist/ui/assets/{transformers-env-jBVeNAIF.js → transformers-env-1TbBNkOp.js} +1 -1
- package/dist/ui/assets/{tray-leader-BxfP0EC1.js → tray-leader-_KISvFyF.js} +1 -1
- package/dist/ui/assets/{tray-leave-runtime-1j0s9Yqq.js → tray-leave-runtime-CRsRkPHc.js} +1 -1
- package/dist/ui/assets/tray-runtime-config-BVgVR3H2.js +1 -0
- package/dist/ui/assets/{tray-sidecar-BUsex5hw.js → tray-sidecar-BRvCb-i7.js} +1 -1
- package/dist/ui/assets/{upgrade-detection-DCwNWWGX.js → upgrade-detection-C5daiUbn.js} +1 -1
- package/dist/ui/assets/{upskill-lick-skip-C9u8AmfA.js → upskill-lick-skip-C2ZQ0c2-.js} +1 -1
- package/dist/ui/assets/v86-BfdTUFBK.js +1 -0
- package/dist/ui/assets/v86-vm-DCm7zA2r.js +2 -0
- package/dist/ui/assets/voice-reply-Dk4ztuZL.js +1 -0
- package/dist/ui/assets/{wc-attach-CJV3boxa.js → wc-attach-CFj2ZF5_.js} +3 -3
- package/dist/ui/assets/wc-browser-BFL2Tl8W.js +1 -0
- package/dist/ui/assets/wc-computers-CcJuQUyG.js +3 -0
- package/dist/ui/assets/{wc-detached-BZT3Rtc5.js → wc-detached-ncc8KuL1.js} +1 -1
- package/dist/ui/assets/{wc-extension-CZ1sQn79.js → wc-extension-DppNe2VK.js} +2 -2
- package/dist/ui/assets/{wc-follower-DO4HcEvu.js → wc-follower-CcxFCW-y.js} +3 -3
- package/dist/ui/assets/wc-follower-oauth-DQ-JPxl6.js +5 -0
- package/dist/ui/assets/{wc-gelatiere-C4XI_usG.js → wc-gelatiere-CANPh9TU.js} +1 -1
- package/dist/ui/assets/wc-live-BLozTZsg.js +427 -0
- package/dist/ui/assets/{wc-nav-ClJyDfXq.js → wc-nav-BlLpBAJG.js} +2 -2
- package/dist/ui/assets/{wc-onboarding-BUUyiqjJ.js → wc-onboarding-OKaUOQ3X.js} +2 -2
- package/dist/ui/assets/{wc-placeholder-Sji0t7ST.js → wc-placeholder-BrX9-mPv.js} +3 -3
- package/dist/ui/assets/{wc-secret-request-IsuAxr4v.js → wc-secret-request-QPmTs_eW.js} +1 -1
- package/dist/ui/assets/{wc-settings-lgNdcEqb.js → wc-settings-BFgFDtTk.js} +3 -3
- package/dist/ui/assets/{wc-shell-Cj705NBI.js → wc-shell-CCKjmASt.js} +242 -187
- package/dist/ui/assets/{wc-shortcut-config-ByZ7W9gP.js → wc-shortcut-config-CeUoljrV.js} +1 -1
- package/dist/ui/assets/{wc-sprinkles-D7Cv7m3r.js → wc-sprinkles-BNp18_jW.js} +2 -2
- package/dist/ui/assets/{wc-transcript-export-IV61nDvZ.js → wc-transcript-export-DJnnZ8L-.js} +2 -2
- package/dist/ui/assets/wc-tray-f1LxbB98.js +5 -0
- package/dist/ui/assets/welcome-detection-Dg9THpkh.js +1 -0
- package/dist/ui/assets/{whisper-session-FGrrhHcr.js → whisper-session-CMiImrJg.js} +2 -2
- package/dist/ui/assets/{xai-grok-BdK9whs2.js → xai-grok-BMr5udF6.js} +1 -1
- package/dist/ui/assets/{xai-grok-Z7FTSyzw.js → xai-grok-Dzeo18XM.js} +1 -1
- package/dist/ui/index.html +11 -11
- package/dist/ui/packages/webapp/index.html +11 -11
- package/package.json +1 -1
- package/dist/ui/assets/SKILL-CtxHowg1.js +0 -96
- package/dist/ui/assets/bridge-protocol-DdqxTTSu.js +0 -1
- package/dist/ui/assets/engine-B-OPe78i.js +0 -1
- package/dist/ui/assets/js-realm-worker-Dfep1BlZ.js +0 -50
- package/dist/ui/assets/jsh-executor-D4Y05hfn.js +0 -18
- package/dist/ui/assets/jsh-runtime-extensions-Bcb8_nba.js +0 -1
- package/dist/ui/assets/memory-v2-flag-BkWGkfSv.js +0 -1
- package/dist/ui/assets/panel-rpc-handlers-DpxMB-do.js +0 -2
- package/dist/ui/assets/panelize-shell-BdV-wKTx.js +0 -4
- package/dist/ui/assets/provider-store-access-BCysAaQ-.js +0 -1
- package/dist/ui/assets/provider-store-access-D-QWySrs.js +0 -1
- package/dist/ui/assets/realm-inprocess-BdTkrnDI.js +0 -30
- package/dist/ui/assets/secret-topology-DLJBhHOi.js +0 -1
- package/dist/ui/assets/slicc-version-Cu6HjDRg.js +0 -1
- package/dist/ui/assets/tray-runtime-config-CRZxBChd.js +0 -1
- package/dist/ui/assets/voice-reply-CgvrHu7l.js +0 -1
- package/dist/ui/assets/wc-browser-DO1Pnegi.js +0 -1
- package/dist/ui/assets/wc-follower-oauth-CEpYsbPr.js +0 -5
- package/dist/ui/assets/wc-live-Dz2OSXcJ.js +0 -427
- package/dist/ui/assets/wc-tray-XTl0wqt5.js +0 -5
- package/dist/ui/assets/welcome-detection-B6Zr7LKu.js +0 -1
|
@@ -1,427 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/wc-shell-Cj705NBI.js","assets/rolldown-runtime-Dd_uD5pT.js","assets/preload-helper-Czpn1I53.js","assets/logger-DDBAeTLF.js","assets/mime-types-D0xZwlMO.js","assets/base64-DJRlyqZu.js","assets/bridge-protocol-06nbmp2X.js","assets/account-store-CJHBoL7P.js","assets/core-BMcS6rur.js","assets/compat-qQM4gjF_.js","assets/models-BSkXF4T6.js","assets/diagnostics-DN_idNHx.js","assets/provider-env-CTOcDKrQ.js","assets/__vite-browser-external-5eBdwsFd.js","assets/openrouter.models-B-zmcypy.js","assets/libesm-BypnjKEL.js","assets/proxied-fetch-DyBveeCl.js","assets/fetch-body-1l9I58Vk.js","assets/api-endpoint-DGxXvrur.js","assets/runtime-env-Dlaokqg1.js","assets/secret-topology-DLJBhHOi.js","assets/float-topology-YtctpJaG.js","assets/secrets-bridge-client--VZ3E0yk.js","assets/port-bridge-client-Dn8JtUyP.js","assets/image-markers-BFDmhPy4.js","assets/tool-ui-eSQ1g2I1.js","assets/providers-InF4o-U9.js","assets/panel-rpc-B3MSVImO.js","assets/bedrock-camp-compat-BeCSBUrZ.js","assets/claude-model-version-aqjj5mtp.js","assets/telemetry-DJyRzh6X.js","assets/same-file-identity-DuEcSmPX.js","assets/icons-BM2l-_K7.js","assets/wc-shell-WkeczD9x.css","assets/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-CQWR6xvc.js","assets/llm-session-id-bZQs6gBN.js","assets/session-jsonl-DjDV9zx6.js","assets/slugify-BYJ6QVAt.js","assets/types-D8gIX-W-.js","assets/main-Dxem3Ydy.js","assets/modulepreload-polyfill-P2Xu9kJm.js","assets/tray-follower-status-BAjnN7Ar.js","assets/clipboard-eqmn97SP.js","assets/wc-placeholder-Sji0t7ST.js","assets/wc-attach-CJV3boxa.js","assets/permissions-surface-registry-CilCRwhh.js","assets/wc-gelatiere-C4XI_usG.js","assets/new-session-CG_ht0Kw.js","assets/tray-leader-BxfP0EC1.js","assets/mount-table-store-dY2IfQ5S.js","assets/legacy-styles-B3nS5QUo.js","assets/soundscape-bHynTI4A.js","assets/voice-reply-CgvrHu7l.js","assets/speak-DbL0fEQT.js","assets/speech-assets-bridge-CFYafE89.js","assets/transformers-env-jBVeNAIF.js","assets/shared-mBEktoxE.js","assets/remote-vfs-client-Dhv8nI7h.js","assets/writable-vfs-client-pZwewNEw.js","assets/wc-onboarding-BUUyiqjJ.js","assets/record-CCQFJXn_.js","assets/wc-browser-DO1Pnegi.js","assets/slicc-app-url-B9OxaBDe.js","assets/tab-teleport-BimzPYfT.js","assets/teleport-storage-CyYkSZfJ.js","assets/remote-terminal-view-D4Ah4AQY.js","assets/browser-DGwroBSO.js","assets/usb-operations-v1mGAdRY.js","assets/terminal-session-client-ADzaWGFd.js","assets/secret-env-CDLWFhsq.js","assets/wc-permissions-BsGMi4OQ.js","assets/wc-permissions-providers-wSXekwkO.js","assets/wc-secret-request-IsuAxr4v.js","assets/secret-request-registry-DrOMKR1H.js","assets/theme-DFKCBK8N.js","assets/theme-engine-B5SkYf3E.js","assets/panelize-shell-BdV-wKTx.js","assets/virtual-device-paths-D45tpPP6.js","assets/layout-apply-registry-Cw730jao.js","assets/wc-shortcut-config-ByZ7W9gP.js","assets/remote-sprinkle-vfs-D-Wz5t8k.js","assets/bounded-walk-BjxKWNqp.js","assets/path-utils-DNJG-zQf.js","assets/wc-sprinkles-D7Cv7m3r.js","assets/wc-unit-context-DhQqWVxs.js","assets/agent-panels-DQh4wRpa.js","assets/apply-layout-DeIHdw5o.js","assets/wc-tray-XTl0wqt5.js","assets/transcript-export-DP-r8eDz.js","assets/wc-follower-oauth-CEpYsbPr.js","assets/sprinkle-renderer-CEIEQSMS.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-IV61nDvZ.js","assets/wc-nav-ClJyDfXq.js","assets/composer-speech-BVpldTNH.js","assets/whisper-session-FGrrhHcr.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-BMcS6rur.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{C as s,D as c,E as l,J as u,N as d,O as f,S as p,T as m,X as h,Z as g,_,_t as v,a as y,at as b,b as ee,bt as te,c as x,ct as ne,et as re,g as ie,gt as ae,i as oe,j as se,l as ce,n as le,o as ue,ot as de,r as fe,rt as pe,st as me,t as he,v as ge,vt as _e,w as ve,x as ye,xt as be,y as xe,yt as Se}from"./wc-shell-Cj705NBI.js";import{r as Ce,t as we}from"./base64-DJRlyqZu.js";import"./proxied-fetch-DyBveeCl.js";import{a as Te,i as Ee,n as De,o as Oe,s as ke}from"./sprinkle-renderer-CEIEQSMS.js";import{B as Ae,T as je,V as Me,f as Ne,w as Pe}from"./account-store-CJHBoL7P.js";import{n as Fe}from"./runtime-env-Dlaokqg1.js";import{t as Ie}from"./slugify-BYJ6QVAt.js";import{a as Le,i as Re,n as S,t as ze}from"./transcript-export-DP-r8eDz.js";import{S as Be,_ as C,a as Ve,b as He,c as Ue,d as We,f as w,g as Ge,h as Ke,l as qe,m as Je,n as Ye,o as Xe,p as Ze,r as Qe,s as $e,t as et,u as tt,v as T,x as E,y as nt}from"./session-jsonl-DjDV9zx6.js";import{a as rt,t as it}from"./api-endpoint-DGxXvrur.js";import{n as at}from"./float-topology-YtctpJaG.js";import"./secret-topology-DLJBhHOi.js";import{n as ot}from"./secrets-bridge-client--VZ3E0yk.js";import{t as st}from"./tool-ui-eSQ1g2I1.js";import{a as ct,c as lt,l as ut,n as dt,p as ft,r as pt}from"./telemetry-DJyRzh6X.js";import{a as mt,i as ht,t as gt}from"./tray-follower-status-BAjnN7Ar.js";import{D as _t,M as vt,c as yt,i as bt,m as xt,o as St,s as Ct,x as wt,y as Tt}from"./main-Dxem3Ydy.js";import{n as Et}from"./src-BWaKqLvQ.js";import{n as Dt,r as Ot,t as kt}from"./provider-budget-LCzMPlKv.js";import{t as At}from"./permissions-surface-registry-CilCRwhh.js";import{t as jt}from"./types-D8gIX-W-.js";import{n as Mt,r as Nt}from"./hid-device-registry-B2R-0rNt.js";import"./browser-DGwroBSO.js";import{a as Pt,i as Ft}from"./serial-port-registry-CCqklAEr.js";import{c as It,d as Lt,g as Rt,i as zt,l as Bt,m as Vt,n as Ht,o as Ut,p as Wt,r as Gt,t as Kt,u as qt}from"./hid-operations-C97SZtrY.js";import{a as Jt,t as Yt}from"./icons-BM2l-_K7.js";import{a as Xt,i as Zt}from"./usb-device-registry--JwKRTYp.js";import{f as Qt,i as $t,l as en,s as tn,u as nn}from"./usb-operations-v1mGAdRY.js";import{a as rn,i as an,r as on}from"./tray-leader-BxfP0EC1.js";import{a as sn,c as cn,f as D,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-Cj705NBI.js`).then(e=>e.it);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?de(t.sender):null)??b(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 P((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:F(t)}),{status:`error`,reason:F(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 _r(r),n}delete(e){return this.serialize(e,async()=>{try{let t=(await this.getDb()).transaction(M,`readwrite`);t.objectStore(M).delete(e),await _r(t)}catch(t){j.warn(`Conversation record delete failed`,{key:e,error:F(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:F(n)})}}async loadAll(){try{return(await P((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:F(e)}),[]}}async loadLatestInWorkspace(e){try{let t=`${e}::`,n=await P((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:F(t)}),null}}async listKeys(){try{return(await P((await this.getDb()).transaction(M,`readonly`).objectStore(M).getAllKeys())).map(String)}catch(e){return j.warn(`Conversation key listing failed`,{error:F(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:F(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:F(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 P((await this.getDb()).transaction(N,`readonly`).objectStore(N).get(e))??null}catch(t){return j.warn(`Migration state read failed`,{id:e,error:F(t)}),null}}async putMigrationState(e){try{let t=(await this.getDb()).transaction(N,`readwrite`);t.objectStore(N).put(e),await _r(t)}catch(t){j.warn(`Migration state write failed`,{id:e.id,error:F(t)})}}async clearAll(){let e=(await this.getDb()).transaction([M,N],`readwrite`);e.objectStore(M).clear(),e.objectStore(N).clear(),await _r(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 P(e){return new Promise((t,n)=>{e.onsuccess=()=>t(e.result),e.onerror=()=>n(e.error)})}function _r(e){return new Promise((t,n)=>{e.oncomplete=()=>t(),e.onerror=()=>n(e.error),e.onabort=()=>n(e.error)})}function F(e){return e instanceof Error?e.message:String(e)}var vr=e({getTranscriptExportService:()=>br,registerTranscriptExportService:()=>yr}),I=null;function yr(e){return I=e,()=>{I===e&&(I=null)}}function br(){if(!I)throw new S(`session-not-found`);return I}var xr=e({broadcastToDips:()=>zr,disposeDips:()=>ui,handleDipPickerAction:()=>di,hydrateDips:()=>li,mountDip:()=>V,setDipExecHandler:()=>Vr}),Sr=Fe();function Cr(e){if(typeof e!=`object`||!e||Array.isArray(e))return[];let t=e.filters;return Array.isArray(t)?t:[]}async function wr(e,t){if(t?.aborted)throw new DOMException(`aborted`,`AbortError`);let n=await Dr(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 Tr=null;function Er(){if(Tr)return Tr;if(typeof BroadcastChannel>`u`)return null;try{Tr=new BroadcastChannel(`preview-vfs`)}catch{return null}return Tr}async function Dr(e,t,n){let r=Er();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 Or=[`/shared/sprinkles/`,`/workspace/skills/sprinkles/`,`/workspace/sprinkles/`],kr=[`/shared/`,`/workspace/skills/sprinkles/`,`/workspace/sprinkles/`];function Ar(e){return Or.some(t=>e.startsWith(t))}function jr(e){return typeof e!=`string`||!e.startsWith(`/`)||e.includes(`..`)?!1:kr.some(t=>e.startsWith(t))}var L=new WeakSet,Mr=`,
|
|
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
|
-
}`,Nr=`,
|
|
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
|
-
}`,Pr=`,
|
|
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 Fr(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?Mr:``}${e?Nr:``}${e?Pr:``}
|
|
92
|
-
};
|
|
93
|
-
function reportHeight() {
|
|
94
|
-
parent.postMessage({ type: 'dip-height',
|
|
95
|
-
height: document.documentElement.scrollHeight }, '*');
|
|
96
|
-
}
|
|
97
|
-
${Te}
|
|
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 Ir=`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}`,Lr=`(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 Rr(e,t,n=!1){let r=De(),i=Tn()?` class="theme-light"`:``,a=t||e.includes(`<slicc-editor`),o=t||e.includes(`<slicc-diff`),s=t?`<script>${Lr}<\/script>`:``;return`<!DOCTYPE html>
|
|
229
|
-
<html${i}><head>
|
|
230
|
-
<meta charset="utf-8">
|
|
231
|
-
<style>${r}</style>
|
|
232
|
-
<style>${Ir}</style>
|
|
233
|
-
<script>${Fr(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 R=new Set;function zr(e){if(typeof e?.type!=`string`||e.type.indexOf(`slicc-`)!==0)throw Error(`broadcastToDips: payload.type must start with 'slicc-'`);for(let t of R)try{t.postMessage(e,`*`)}catch{}}var Br;function Vr(e){Br=e}function z(e){return e.length===0?`''`:`'${e.replace(/'/g,`'\\''`)}'`}function Hr(e,t){let n=t?.cwd??`.`,r=t?.allowedCommands??`*`,i=[`agent`];return t?.model&&i.push(`--model`,z(t.model)),t?.thinking&&i.push(`--thinking`,z(t.thinking)),t?.readOnly&&i.push(`--read-only`,z(t.readOnly)),i.push(z(n),z(r),z(e)),i.join(` `)}async function Ur(e){if(!Br)return{stdout:``,stderr:`exec: shell bridge not available
|
|
240
|
-
`,exitCode:127};try{return await Br(e)}catch(e){return{stdout:``,stderr:`exec: ${e instanceof Error?e.message:String(e)}\n`,exitCode:1}}}async function Wr(e,t){let n=await Ur(Hr(e,t));return{stdout:n.stdout||n.stderr,exitCode:n.exitCode}}async function Gr(e,t){let n=await Ee(Ur,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 B=new WeakMap;function Kr(e,t){try{e.postMessage({type:`dip-device-event`,channel:`hid:inputreport`,payload:t},`*`)}catch{}}async function qr(e,t){let n=B.get(e);if(n||(n=new Map,B.set(e,n)),n.has(t))return;let r=await Bt(Nt(),t,n=>{let r=n.bytes instanceof Uint8Array?n.bytes:new Uint8Array(n.bytes);Kr(e,{handle:t,reportId:n.reportId,data:r})});n.set(t,r)}async function Jr(e,t){let n=B.get(e);if(!n)return;let r=n.get(t);if(r){n.delete(t);try{await Promise.resolve(r())}catch{}}n.size===0&&B.delete(e)}function Yr(e){let t=B.get(e);if(t){for(let e of t.values())try{Promise.resolve(e()).catch(()=>{})}catch{}B.delete(e)}}function Xr(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 Zr(e,t,n){let r=Nt();switch(t){case`list`:{let e=Mt();if(!e)throw Error(`WebHID is unavailable in this browser`);return Gt(r,e)}case`request`:{let e=Mt();if(!e)throw Error(`WebHID is unavailable in this browser`);return Ut(r,e,n[0]??[])}case`info`:return Ht(r,n[0]);case`open`:{let t=n[0];return await zt(r,t),await qr(e,t),{ok:!0}}case`close`:{let t=n[0];return await Jr(e,t),await Kt(r,t),{ok:!0}}case`sendReport`:{let e=n[0],t=n[1],i=Xr(n[2]),a=i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength);return await It(r,e,t,a),{ok:!0}}default:throw Error(`hid: unknown op '${t}'`)}}async function Qr(e,t){let n=Pt();switch(e){case`list`:{let e=Ft();if(!e)throw Error(`Web Serial is unavailable in this browser`);return Wt(n,e)}case`request`:{let e=Ft();if(!e)throw Error(`Web Serial is unavailable in this browser`);return Rt(n,e,t[0]??[])}case`info`:return Lt(n,t[0]);case`open`:{let e=t[0],r=t[1]??{baudRate:9600};return await Vt(n,e,r),{ok:!0}}case`close`:return await qt(n,t[0]),{ok:!0};default:throw Error(`serial: unknown op '${e}'`)}}async function $r(e,t){let n=Xt();switch(e){case`list`:{let e=Zt();if(!e)throw Error(`WebUSB is unavailable in this browser`);return en(n,e)}case`request`:{let e=Zt();if(!e)throw Error(`WebUSB is unavailable in this browser`);return Qt(n,e,t[0]??[])}case`info`:return tn(n,t[0]);case`open`:return await nn(n,t[0]),{ok:!0};case`close`:return await $t(n,t[0]),{ok:!0};default:throw Error(`usb: unknown op '${e}'`)}}async function ei(e,t,n,r){switch(t){case`hid`:return Zr(e,n,r);case`serial`:return Qr(n,r);case`usb`:return $r(n,r);default:throw Error(`unknown device channel '${t}'`)}}async function ti(e,t){if(!e||typeof t.id!=`number`)return!1;let n=n=>{try{e.postMessage({...n,id:t.id},`*`)}catch{}};if(!L.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 ei(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 ni(e,t){if(!e||typeof t.id!=`number`)return!1;let n=n=>{try{e.postMessage({...n,id:t.id},`*`)}catch{}};if(!L.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 Ur(typeof t.cmd==`string`?t.cmd:``)}),!0;if(t.type===`dip-agent`)return n({type:`dip-agent-response`,result:await Wr(typeof t.prompt==`string`?t.prompt:``,t.opts)}),!0;if(t.type===`dip-jsh`){try{n({type:`dip-jsh-response`,result:await Gr(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 V(e,t,n,r=!1){let i=Rr(t,!1,r);if(Sr)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),R.add(a.contentWindow),r&&L.add(a.contentWindow)),a.addEventListener(`load`,()=>{En(a.contentWindow),a.contentWindow&&(R.add(a.contentWindow),r&&L.add(a.contentWindow)),Oe()&&ke(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`?ii(t.url):t.type===`dip-picker-action`?di(t,n):t.type===`dip-readfile`||t.type===`dip-exists`||t.type===`dip-stat`?ri(a.contentWindow,t):t.type===`dip-exec`||t.type===`dip-agent`||t.type===`dip-jsh`?ni(a.contentWindow,t):t.type===`dip-device-op`&&ti(a.contentWindow,t))};window.addEventListener(`message`,o);let s=null;if(Oe()&&typeof IntersectionObserver<`u`){let e=!1,t=new IntersectionObserver(n=>{if(n[n.length-1].isIntersecting){if(e){e=!1;return}t.unobserve(a),ke(a,()=>{e=!0,t.observe(a)})}});s=t,t.observe(a)}return{dispose(){s?.disconnect(),window.removeEventListener(`message`,o),wn(a.contentWindow),a.contentWindow&&(R.delete(a.contentWindow),L.delete(a.contentWindow),Yr(a.contentWindow)),a.remove()}}}async function ri(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(!L.has(e))return r({type:`${t.type}-response`,error:`VFS access not allowed for this dip`}),!0;if(!jr(n))return r({type:`${t.type}-response`,error:`VFS path not allowed: ${n}`}),!0;if(t.type===`dip-readfile`){let e=await Dr(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 Dr(n,!0)!==null}),!0;if(t.type===`dip-stat`){let e=await Dr(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 ii(e){if(!(typeof e!=`string`||!e)&&/^(https?:|mailto:)/i.test(e))try{window.open(e,`_blank`,`noopener,noreferrer`)}catch{}}var ai=new WeakMap;function oi(){return typeof Element.prototype.moveBefore==`function`}function si(e,t,n){let r=e.findIndex(e=>{let n=ai.get(e);return n?.key===t&&n.wrapper.isConnected}),i=e[r],a=i&&ai.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 ci(e,t,n){return ai.set(e,{key:t,wrapper:n}),e}function li(e,t,n={}){let r=[],i=[...n.previous??[]],a=oi(),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(u));continue}let l=a?si(i,c,n):null;if(l){r.push(l);continue}let d=document.createElement(`div`);d.className=`msg__dip`,n.replaceWith(d),r.push(ci(V(d,s,t,!1),c,d))}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?si(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(ci({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 wr(n,u.signal);let e;try{e=await fetch(h,{signal:u.signal})}catch(e){if(e?.name===`AbortError`)throw e;if(p)return wr(n,u.signal);throw e}if(e.ok)return e.text();if(p)return wr(n,u.signal);throw Error(`HTTP ${e.status}`)},_=p&&Ar(n);g().then(e=>{f||!l.isConnected||(d=V(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 ui(i),r}function ui(e){for(let t of e)try{t.dispose()}catch{}e.length=0}async function di(e,t){let n=Cr(e.data);if(Sr){await fi(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 fi(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 pi(e,t){let n=At();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 mi(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 hi(e,t){let n=await pi(`filesystem`);if(!n){t(e,{error:`File System Access API not available`});return}if(!n.ok){mi(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 pi(`usb`,{filters:t});if(!r){n(e,{error:`WebUSB is not available`});return}if(!r.ok){mi(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 pi(`serial`,t.length?{filters:t}:void 0);if(!r){n(e,{error:`Web Serial is not available`});return}if(!r.ok){mi(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 pi(`hid`,{filters:t});if(!r){n(e,{error:`WebHID is not available`});return}if(!r.ok){mi(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`?ii(t.url):t.type===`dip-readfile`||t.type===`dip-exists`||t.type===`dip-stat`?ri(i.contentWindow,t):t.type===`dip-exec`||t.type===`dip-agent`||t.type===`dip-jsh`?ni(i.contentWindow,t):t.type===`dip-device-op`?ti(i.contentWindow,t):t.type===`dip-picker-action`&&di(t,n))};return window.addEventListener(`message`,a),i.addEventListener(`load`,()=>{En(i.contentWindow),i.contentWindow&&(R.add(i.contentWindow),r&&L.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&&(R.delete(i.contentWindow),L.delete(i.contentWindow),Yr(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: ${U(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:U(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:U(e)}),{ok:!1,reason:U(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:U(e)}),ma(bi,t)}}function ma(e,t=k){let n=te(e,`MEMORY.md`),r=ae(n.frontmatter,Ji),i=v(r,`writablePaths`,Gi(t));if(i.length===0)throw Error(`writablePaths must not be empty`);be(i,`writablePaths`);let a=v(r,`visiblePaths`,Ki(t));be(a,`visiblePaths`);let o=_e(r.timeoutSeconds,600,Hi),s=_e(r.dreamTimeoutSeconds,Ui,Wi,`dreamTimeoutSeconds`),c=Se(r.model,`model`);return{writablePaths:i.map(e=>ua(e,t)),visiblePaths:da(a,t),allowedCommands:[...new Set([...qi,...v(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 H(e){return`/sessions/.curation/${e.slice(e.lastIndexOf(`/`)+1)}`}function _a(e){return`${H(e)}/base.md`}function va(e){return`${H(e)}/draft.md`}function ya(e){return`${H(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(H(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,`${H(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 U(e){return e instanceof Error?e.message:String(e)}var Ea=e({PENDING_SESSION_ATTEMPT_LIMIT:()=>3,SESSIONS_INDEX_PATH:()=>T,curateFrozenSessionMemories:()=>Ma,enrichPendingSession:()=>io,freezeConeSession:()=>ja,listPendingEnrichments:()=>to,markSnapshotUnavailable:()=>So,processPendingSessions:()=>no,readSessionsIndex:()=>E}),W=o(`session-freezer`),Da=4,Oa=2048,ka=40,Aa=`${C}/attachments`;async function ja(e){let t=await Ya(e.sessionStore,qa(e));if(!t||t.messages.length<Da)return W.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)||Ue(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:nt(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,W.info(`Agentic memory pass completed`,{filename:t.filename}),n):(W.info(`Agentic memory pass completed; index entry already gone`,{filename:t.filename}),null)}return await yo(e.vfs,t.filename,r.reason),r.legacyFallbackSafe?(W.warn(`Agentic memory pass failed after finishing — falling back to legacy extraction`,{filename:t.filename,reason:r.reason}),await Fa(e,n,!0),null):(W.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-CQWR6xvc.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){W.warn(`Icon pick failed (freeze still proceeds)`,{error:e instanceof Error?e.message:String(e)});return}}function Pa(e){if(e)return Yt(e)?e:void 0}async function Fa(e,t,i){if(!i){W.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){W.warn(`Memory extraction call failed (freeze still proceeds)`,{error:e instanceof Error?e.message:String(e)});return}if(!a.trim()||a.trim()===`NONE`){W.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}),W.info(`Memory extracted and appended on new-session`)}catch(e){W.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 W.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-${Ze()}.md`:`${s.replace(/[:.]/g,`-`)}-${Je(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,C);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(_t(`memory-v2`)){let{writeArchiveBundle:t}=await i(async()=>{let{writeArchiveBundle:e}=await import(`./session-jsonl-DjDV9zx6.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(`${C}/${d}`,$e(a));return await Ke(e.vfs,m),await e.vfs.flush(),W.info(`Cone session frozen`,{filename:d,title:n,cone:c,messageCount:t.messages.length,completedLiveSnapshot:!!l}),{...m,archive:a}}catch(e){return W.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 W.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 Xe(await tt(e),t)}catch(e){W.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 jt)||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){W.warn(`Cone memory budget step threw (append already committed)`,{error:e instanceof Error?e.message:String(e)})}}async function to(e){return(await E(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 E(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){W.warn(`Pending session catch-up attempt failed`,{filename:r.filename,error:e instanceof Error?e.message:String(e)})}}catch(e){W.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){W.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(nt(t),{encoding:`utf-8`});return typeof n==`string`?n:new TextDecoder().decode(n)}catch(e){return e?.code===`ENOENT`?W.info(`Pending archive missing — treating as already enriched`,{filename:t.filename}):W.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 Ye(e,n,t.filename)).messages}catch(e){return W.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?(W.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 W.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 W.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}:(W.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){W.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=nt(t),s=qe(t.filename),c=s?r:t.title,l=s?`${t.frozenAt.replace(/[:.]/g,`-`)}-${Je(r)}.md`:t.filename,u=`${C}/${l}`;if(s)try{await $a(e,C);let r=go(n,c),i=Ve(t.filename),a=Ve(l),s=We(r,o,u);if(s=We(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 et(e,t.filename,l)}catch(e){return W.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 W.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){W.info(`Stale pending archive cleanup failed (harmless)`,{oldPath:o,error:e instanceof Error?e.message:String(e)})}try{await Qe(e,t.filename)}catch(e){W.info(`Stale pending sidecar cleanup failed (harmless)`,{filename:t.filename,error:e instanceof Error?e.message:String(e)})}}try{await e.flush()}catch{}return W.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=w(async()=>{let r=await E(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(T,JSON.stringify(d,null,2)),await e.flush(),n=u});try{await r}catch(e){W.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 w(async()=>{let r=await E(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(T,JSON.stringify(s,null,2)),await e.flush()}),n}async function yo(e,t,n){let r=w(async()=>{let r=await E(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(T,JSON.stringify(a,null,2)),await e.flush()});try{await r}catch(e){W.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=w(async()=>{let n=await E(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(T,JSON.stringify(o,null,2)),await e.flush()});try{await n}catch(e){W.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 w(async()=>{let r=[];try{let t=await e.readFile(T,{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 jt)||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(T,JSON.stringify(a,null,2))})}async function So(e,t){return w(async()=>{let n=[];try{let t=await e.readFile(T,{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 jt)||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(T,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.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)}))}var Po=`__slicc_binary__`,Fo=`b64`;function Io(e){if(!e||typeof e!=`object`)return!1;let t=e;return t[Po]===Fo&&typeof t.data==`string`}function Lo(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&!(e instanceof Uint8Array)}function Ro(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&!(e instanceof Uint8Array)&&!Io(e)}function zo(e){if(e instanceof Uint8Array)return{[Po]:Fo,data:Ce(e)};if(Array.isArray(e))return e.map(zo);if(Lo(e)){let t={};for(let[n,r]of Object.entries(e))t[n]=zo(r);return t}return e}function Bo(e){if(Io(e))return we(e.data);if(Array.isArray(e))return e.map(Bo);if(Ro(e)){let t={};for(let[n,r]of Object.entries(e))t[n]=Bo(r);return t}return e}var Vo=o(`panel-transport`);function Ho(e){return typeof e==`object`&&!!e&&`source`in e&&`payload`in e}function Uo(){return{onMessage:e=>{let t=(t,n,r)=>(Ho(t)&&e(Bo(t)),!1);return chrome.runtime.onMessage.addListener(t),()=>chrome.runtime.onMessage.removeListener(t)},send:(e,t)=>{let n=zo(e);chrome.runtime.sendMessage({source:`panel`,payload:n}).catch(e=>{Vo.error(`failed to send to offscreen`,{error:e instanceof Error?e.message:String(e)})})}}}var Wo={summarizing:`summarizing`,fallback:`fallback`,cancelled:`discarded`,idle:`summarized`},Go=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:Wo[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}},Ko=2e3,G=o(`offscreen-client`),qo=class{eventListeners=new Set;callbacks;scoops=[];scoopStatuses=new Map;currentMessageId=new Map;compactionRows=new Go(e=>`compaction-${e}-${K()}`);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._selectedScoopJid=e,e!==null))for(let t of this.scoopSelectedListeners)try{t(e)}catch(e){G.error(`onScoopSelected handler threw`,{error:e instanceof Error?e.message:String(e)})}}locked=!1;constructor(e,t){this.callbacks=e,this.transport=t??Uo(),this.setupMessageListener()}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)&&D(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-${K()}`,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-${K()}`,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-${K()}`,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&&G.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}G.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-${K()}`,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),Ko))])}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){switch(e.type){case`offscreen-ready`:this.ready?(G.warn(`Offscreen restarted — re-requesting state`),this.ready=!1):G.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;Jo(t.leader,t.follower);break}case`forward-lick`:this.forwardLickHandler?.(e.event);break;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){G.error(`terminal event listener error`,{error:e instanceof Error?e.message:String(e)})}}}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}-${K()}`,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)switch(e.eventType){case`text_delta`:{let t=this.currentMessageId.get(e.scoopJid);t||(t=`scoop-${e.scoopJid}-${K()}`,this.currentMessageId.set(e.scoopJid,t),this.emitToUI({type:`message_start`,messageId:t})),this.emitToUI({type:`content_delta`,messageId:t,text:e.text??``});break}case`tool_start`:{let t=this.currentMessageId.get(e.scoopJid);t||(t=`scoop-${e.scoopJid}-${K()}`,this.currentMessageId.set(e.scoopJid,t),this.emitToUI({type:`message_start`,messageId:t})),this.emitToUI({type:`tool_use_start`,messageId:t,toolName:e.toolName??``,toolInput:e.toolInput,toolCallId:e.toolCallId});break}case`tool_end`:{let t=this.currentMessageId.get(e.scoopJid);t&&this.emitToUI({type:`tool_result`,messageId:t,toolName:e.toolName??``,result:e.toolResult??``,isError:e.isError,toolCallId:e.toolCallId});break}case`tool_ui`:case`tool_ui_done`:case`tool_progress`:this.handleToolUiAgentEvent(e);break;case`response_done`:{let t=this.currentMessageId.get(e.scoopJid);t&&(this.emitToUI({type:`content_done`,messageId:t,model:e.model,usage:e.usage}),this.currentMessageId.delete(e.scoopJid));break}case`turn_end`:{let t=this.currentMessageId.get(e.scoopJid)??`done-${e.scoopJid}-${K()}`;this.currentMessageId.delete(e.scoopJid),this.emitToUI({type:`turn_end`,messageId:t});break}}}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.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&&cn(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){G.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&&Jo(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){e.scoopJid===this.selectedScoopJid&&this.emitToUI({type:`error`,error:e.error})}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 sn({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){G.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 K(){return Date.now().toString(36)+Math.random().toString(36).slice(2,8)}function Jo(e,t){an({state:e.state,error:e.error,reconnectAttempts:e.reconnectAttempts,session:e.session?{...e.session}:null}),ht({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 Yo(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 Xo={onAgentEvent:()=>()=>void 0,sendSprinkleLick:()=>void 0,sendToolUiAction:()=>void 0,deleteQueuedMessage:()=>Promise.resolve(),emitAgentError:()=>void 0},Zo=`A follower cannot cancel the leader’s queued message`;function Qo(e){return{onAgentEvent:e.onAgentEvent,sendSprinkleLick:(t,n,r)=>e.getSync()?.sendSprinkleLick(t,n,r),sendToolUiAction:()=>void 0,deleteQueuedMessage:()=>Promise.reject(Error(Zo)),emitAgentError:e.onAgentError,readOnlyToolUi:!0}}function q(e){return!e.includes(`\0`)}function $o(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(!q(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(!q(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),!q(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),!q(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(q(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 es(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 ts(e){let t=es(e);return{onMessage:e=>t.onMessage(e),send:(e,n)=>{t.send({source:`panel`,payload:e},n)}}}async function ns(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 rs(e,t){for(let[n,r]of t)e.off(n,r),e.on(n,r)}var is=1e4;function as(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`)),is),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 os(e,t,n={}){let r=es(e),i=null,a=n.reconnect?()=>(i||=(t.state===`connecting`?as(t):n.reconnect()).finally(()=>{i=null}),i):null,o=new Map,s=r.onMessage(e=>{ns(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`&&(rs(t,o),r.send({type:`cdp-ready`}))}});return()=>{s(),u?.();for(let[e,n]of o)t.off(e,n);o.clear()}}function ss(){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 cs(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 ls(e){let{worker:t,realCdpTransport:n}=e,r=e.readyTimeoutMs??3e4,i=e.localStorageSeed??{},a=new MessageChannel,o=new MessageChannel,s=ts(a.port1),c=e.makeClient(s);e.onWorkerScriptError&&e.worker.addEventListener?.(`error`,()=>e.onWorkerScriptError());let l=os(o.port1,n,{...e.reconnectCdp?{reconnect:e.reconnectCdp}:{}}),{ready:u,cleanup:d}=cs(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.165.0-mu61e2g3`,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 us(e){return ls({worker:e.workerUrl?new Worker(e.workerUrl,{type:`module`}):new Worker(new URL(`/assets/kernel-worker-CrTnmx6N.js`,``+import.meta.url),{type:`module`}),realCdpTransport:e.realCdpTransport,reconnectCdp:e.reconnectCdp,makeClient:e.makeClient,readyTimeoutMs:e.readyTimeoutMs,localStorageSeed:e.localStorageSeed??ss(),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 ds=1048576,fs=`r`;function ps(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function ms(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function hs(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++)hs(e[r],`${t}/${r}`,n);return}if(ms(e))for(let[r,i]of Object.entries(e))hs(i,`${t}/${ps(r)}`,n)}function gs(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=gs(e[a],`${t}/${a}`,n);o!==e[a]&&(r=!0),i.push(o)}return r?i:e}if(ms(e)){let r=!1,i={};for(let[a,o]of Object.entries(e)){let e=gs(o,`${t}/${ps(a)}`,n);e!==o&&(r=!0),i[a]=e}return r?i:e}return e}function _s(e,t,n){if(ms(e))return gs(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=_s(e[a],`${t}/${a}`,n);o!==e[a]&&(r=!0),i.push(o)}return r?i:e}return e}function vs(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 ys(e,t,n){let r=[],i=0;for(;i<e.length;){if(n?.aborted)throw new S(`redaction-unavailable`);let a=0,o=i;for(;o<e.length;){let t=e[o].length;if(o>i&&a+t>ds)break;a+=t,o++}let s=e.slice(i,o),c;try{c=await t.redact(s,n)}catch{throw new S(`redaction-unavailable`)}if(c.length!==s.length)throw new S(`redaction-unavailable`);r.push(...c),i=o}return r}function bs(e,t,n,r){let i=[],a=vs(e);for(let{category:e,id:t}of a.values())i.push({id:t,category:e,detector:`pre-obfuscated`,target:n});let o=vs(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}=Be(t,fs,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 xs(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 Ss(e,t,n,r){if(r?.aborted)throw new S(`redaction-unavailable`);let{privacy:i,...a}=e,o=[];hs(a,``,o);let s=o.filter(e=>!Re(e.pointer)),c=[...t.entries()],l=await ys([...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=bs(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)}xs(m,u,d);let h=new Map,g=s.length,_=[];for(let e=0;e<c.length;e++){let[t,n]=c[e],r=bs(n,l[g+e],{kind:`attachment`,attachmentId:t},f);f=r.nextId,h.set(t,r.finalText),_.push(r)}xs(_,u,d);let v=_s(e,``,p);return{document:{...v,privacy:{...v.privacy,redactionCounts:d,redactions:u}},textAttachments:h}}function Cs(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 ws(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 Ts={"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 Es(e,t){return Ts[e]??(t===`text-redacted`?`.txt`:`.bin`)}function Ds(e,t,n){return`attachments/att-${String(e+1).padStart(4,`0`)}${Es(t,n)}`}function Os(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 ks(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 As(e,t,n,r,i){let a=Cs(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(Os(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=Os(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 js(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:Os(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(As(c.a,s.attachmentId,s.conversationId,s.messageId,r))}return{pendingPromises:i,mismatchedConvIds:a,processedUiPositions:o}}function Ms(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 Ns(e,t,n,r,i,a,o){let s=Ms(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(As(i,l,n,e.id,o)),c.push({type:`attachment-ref`,attachmentId:l}))}return c}function Ps(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=Ns(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 Fs(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,Ds(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 Is(e,t,n,r,i){let{rawAttachments:a,textMap:o}=Fs(e,n),s,c;try{let e=await Ss({...t,attachments:a},o,r,i);s=e.document,c=e.textAttachments}catch(e){throw e instanceof S?e:new S(`attachment-unreadable`)}let l=new Map;for(let t of e){if(l.has(t.attachmentId))throw new S(`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 S(`schema-invalid`);let n=t.handling===`text-redacted`?new TextEncoder().encode(c.get(t.attachmentId)??t.rawText??``):t.rawBytes,r=await ws(n);return u.set(e.path,n),{...e,byteLength:n.length,sha256:r}}));return{redactedDocument:{...s,attachments:d},bundleFiles:u}}async function Ls(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}=js(ks(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}=Ps(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 Is(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 Rs=50;function zs(e){return fn(e)}function Bs(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 Vs(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=zs(t),l=a.get(c);l&&s.set(t.jid,l.messages)}return{sources:o,chatMessagesByConversation:s}}async function Hs(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(Rs,t),t?.aborted))throw new S(`transfer-aborted`);let i=Bs(n,e),[a,o]=await Promise.all([e.loadPersistedSessions(),e.loadUiChatSessions()]);if(t?.aborted)throw new S(`transfer-aborted`);let s=r(e.listScoops());if(i===Bs(s,e))return Vs(s,a,o,e)}}function Us(e,t){return`${e}-msg-${t.toString().padStart(6,`0`)}`}function Ws(e,t){return{type:`attachment-ref`,attachmentId:`${e}-img-${t}`}}function Gs(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(Ws(t,r++));return n}function Ks(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=Ws(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 qs(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=Ws(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 Js(e,t,n){let r=Us(t,n),i=Gs(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 Ys(e,t,n){let r=Us(t,n),{blocks:i,excluded:a,images:o}=Ks(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 Xs(e,t,n){let r=Us(t,n),{blocks:i,images:a}=qs(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 Zs(e,t,n){return e.role===`user`?Js(e,t,n):e.role===`assistant`?Ys(e,t,n):e.role===`toolResult`?Xs(e,t,n):{message:null,excludedReasoningBlocks:0,images:new Map}}function Qs(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 $s(e){let t=0,n=new Map;return{conversations:e.map(e=>{let r=e.messages.flatMap((r,i)=>{let a=Zs(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:Qs(e),excludedReasoningBlocks:t,canonicalImages:n}}var ec=(()=>{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 tc(e){let t=-1>>>0;for(let n=0;n<e.length;n++)t=t>>>8^ec[(t^e[n])&255];return~t>>>0}var nc=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 rc(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 ic(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 ac(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 oc(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 sc(e){let t=e.export.generatedAt.slice(0,10),n=e.export.id.slice(0,8);return`slicc-${t}-${Ie(e.session.title,{maxLen:40,fallback:`transcript`})}-${n}.zip`}async function*cc(e,t,n,r,i){if(n?.aborted)throw i(new S(`transfer-aborted`)),new S(`transfer-aborted`);let a=()=>i(new S(`transfer-aborted`));n?.addEventListener(`abort`,a,{once:!0});let o=Et.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=nc.encode(`transcript.json`),f=tc(i),p=rc(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 S(`transfer-aborted`);yield*d(i);for(let[e,r]of t){if(n?.aborted)throw new S(`transfer-aborted`);let t=nc.encode(e),i=tc(r),a=rc(t,r.length,i);if(l.push({nameBytes:t,size:r.length,crc:i,localOffset:c}),yield*d(a),n?.aborted)throw new S(`transfer-aborted`);yield*d(r)}let m=c;for(let e of l){if(n?.aborted)throw new S(`transfer-aborted`);yield*d(ic(e.nameBytes,e.size,e.crc,e.localOffset))}if(n?.aborted)throw new S(`transfer-aborted`);yield*d(ac(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 S(`transfer-aborted`)))}}var lc=4294967295,uc=65535;function dc(e,t,n){for(let e of t.keys())if(!oc(e))throw new S(`schema-invalid`);if(t.size+1>uc)throw new S(`schema-invalid`);for(let e of t.values())if(e.byteLength>lc)throw new S(`schema-invalid`);let r,i,a=new Promise((e,t)=>{r=e,i=t});return{filename:sc(e),chunks:cc(e,t,n,r,i),completion:a}}function fc(e,t,n,r,i,a={}){return{schemaVersion:1,export:{id:crypto.randomUUID(),generatedAt:new Date().toISOString(),producer:{application:`slicc`,version:i},format:ze},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 pc(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 mc(e){let t=Le(e);if(!t.ok)throw new S(`schema-invalid`,t.error)}function hc(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 gc(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 _c(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 vc=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),mc(i.document),r?.({phase:`packaging`}),dc(i.document,i.bundleFiles,n)}async captureFrozen(e,t){let n=await Hs(this.deps.collection,t,{...e.rootJid?{rootJid:e.rootJid}:{}});if(e.rootJid&&n.sources.length===0)return;let r=$s(n.sources),{document:i,bundleFiles:a}=await Ls({document:fc(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});mc(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 Hs(this.deps.collection,e),r=$s(n.sources),{id:i,title:a}=this.deps.getActiveSessionInfo(),o=fc(i,a,`active`,r,this.deps.version);return t?.({phase:`redacting`}),Ls({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 Ss(e.document,n,this.deps.knownSecrets,t);r=a.document,i=a.textAttachments}catch{throw new S(`redaction-unavailable`)}let a=hc(r.attachments,i,e.attachments),o=await gc(r.attachments,a);return{document:{...r,attachments:o},bundleFiles:a}}async buildLegacyPartial(e,t,n){let r=(await E(this.deps.vfs)).find(t=>t.sessionId===e||!t.sessionId&&t.filename===e);if(!r)throw new S(`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 S(`session-not-found`)}let{loadFrozenArchive:o}=await i(async()=>{let{loadFrozenArchive:e}=await import(`./session-jsonl-DjDV9zx6.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=pc(c,l),d=_c(a),f={schemaVersion:1,export:{id:crypto.randomUUID(),generatedAt:new Date().toISOString(),producer:{application:`slicc`,version:this.deps.version},format:ze},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`}),Ls({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 S(`attachment-unreadable`);return t}},yc=`/sessions/data`,bc=`document.json`;async function xc(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 Sc(e){if(e.length===0||/[/\\\x00]/.test(e)||e===`..`||e===`.`||e.includes(`..`)||!/^[a-zA-Z0-9._-]+$/.test(e))throw new S(`session-not-found`)}function Cc(e){return`${yc}/${e}`}function wc(e){return`${yc}/.tmp-${e}`}async function Tc(e,t){try{await e.mkdir(t,{recursive:!0})}catch{}}async function Ec(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 Ec(e,n);try{await e.rm(n)}catch{}}try{await e.rm(t)}catch{}}async function Dc(e,t,n){await Tc(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 Dc(e,r,a);else{let t=await e.readFile(r,{encoding:`binary`});await e.writeFile(a,t)}}}async function Oc(e,t,n){Sc(t);let r=wc(t),i=Cc(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 S(`schema-invalid`);await Ec(e,i),await Tc(e,r);try{let t=[...n.document.attachments];for(let[e,r]of n.attachments){let n=await xc(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}/${bc}`,s),n.attachments.size>0)for(let[t,i]of n.attachments){let n=`${r}/${t}`,a=t.lastIndexOf(`/`);a!==-1&&await Tc(e,`${r}/${t.slice(0,a)}`),await e.writeFile(n,i)}await e.flush(),await Dc(e,r,i),await e.flush()}catch(t){throw await Ec(e,r),t}await Ec(e,r)}async function kc(e,t){Sc(t);let n=Cc(t),r=`${n}/${bc}`,i;try{let t=await e.readFile(r,{encoding:`utf-8`});i=typeof t==`string`?t:new TextDecoder().decode(t)}catch{throw new S(`session-not-found`)}let a;try{a=JSON.parse(i)}catch{throw new S(`schema-invalid`)}if(!Le(a).ok)throw new S(`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 S(`transfer-corrupt`)}if(await xc(i)!==t.sha256)throw new S(`transfer-corrupt`);o.set(t.path,i)}return{document:a,attachments:o}}function Ac(e){return`error`in e}function X(){throw new S(`redaction-unavailable`)}function jc(e,t){return(typeof e!=`object`||!e||!Array.isArray(e.texts)||e.texts.length!==t)&&X(),e.texts}function Mc(){return{async redact(e){let t;try{t=await fetch(rt(`/api/secrets/redact-export`),{method:`POST`,headers:it({"content-type":`application/json`}),body:JSON.stringify({texts:e})})}catch{X()}t.ok||X();let n;try{n=await t.json()}catch{X()}return jc(n,e.length)}}}function Nc(){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&&Ac(t)&&X(),jc(t,e.length)}}}function Pc(){return{async redact(e){let t;try{t=await ot(`secrets.redact-export`,{texts:e})}catch{X()}return t??X(),typeof t==`object`&&t&&Ac(t)&&X(),jc(t,e.length)}}}function Fc(){return{async redact(e){X()}}}function Ic(){let e=at();return e===`connect`?Fc():e===`extension-direct`?Nc():e===`extension-delegate`?Pc():Mc()}function Z(e){switch(e){case`processing`:return`working`;case`error`:return`broken`;case`initializing`:return`initializing`;default:return`idle`}}function Lc(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 Rc(e,t=Date.now){let n=e.parentId===null,r=e.folder??e.name,i=n?e.config:zc(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 zc(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 Bc=`padding:0.5rem 1.25rem;border-radius:0.375rem;cursor:pointer;font:inherit;font-size:0.875rem;`,Vc=`${Bc}border:none;background:var(--s2-accent-color,#0265dc);color:#fff;`,Hc=`${Bc}border:none;background:#d23;color:#fff;`,Uc=`${Bc}background:transparent;border:1px solid var(--s2-border-color,#e0e0e0);color:inherit;`;function Wc(e,t,n){return{...Rc({parentId:null,name:e,folder:`cone-pending-${t.length+1}`}),assistantLabel:e,...n?{model:n}:{}}}function Gc(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 Kc(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 qc(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)??Lc(t),d=()=>{if(!s)return;let e=s;s=null,e.hide?.(),e.remove()},f=e=>{d();let t=Gc(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=Wc(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=Kc(i,p);f({heading:`New cone`,body:e,actions:[{text:`Create`,style:Vc,data:`create`,onClick:()=>p(e.readDraft())},{text:`Cancel`,style:Uc,data:`cancel`,onClick:d}]}),queueMicrotask(()=>e.querySelector(`input`)?.focus())},h=t=>{d();let i=D(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=D(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:Hc,data:`drop`,onClick:()=>h(e.id)},{text:`Cancel`,style:Uc,data:`cancel`,onClick:d}]})},_=()=>{let t=D(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||D(n.getScoops()).length<=1||o||g(e)}),_(),{refresh:_,dialog:()=>s}}var Jc={"gelatiere-dismiss":{consume:!0,mode:`dismiss`},"gelatiere-install":{consume:!1,mode:`take`},"gelatiere-try":{consume:!1,mode:`take`}};function Yc(e){return t=>{if(t.type!==`sprinkle`||t.sprinkleName!==`welcome`&&t.sprinkleName!==`inline`&&t.sprinkleName!==`suggestions`)return!1;let n=t.body,r=Jc[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-Cj705NBI.js`).then(e=>e.lt),__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 Xc=5e3,Zc=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 Lc(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)},Xc)}}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))},Xc)});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 Zc({fills:e.fills,getAwaiting:()=>e.awaitingInput,getClient:()=>e.getClient(),phases:e.phases,statuses:e.statuses,turns:e.turns}),e.workUnits}function Qc(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(Lc(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 $c=`slicc:leader-local-model-state-changed`;function el(e=window){e.dispatchEvent(new Event($c))}var tl=`slicc:leader-model-catalog-changed`;function nl(e=window){e.dispatchEvent(new Event(tl))}var rl={off:`off`,low:`low`,medium:`medium`,high:`high`,xhigh:`xhigh`,max:`xhigh`},il={off:`off`,minimal:`low`,low:`low`,medium:`medium`,high:`high`,xhigh:`xhigh`};function al(e){return e?rl[e]:void 0}function ol(e){return e===`max`?`max`:void 0}function sl(e,t){return t===`max`?`max`:(e&&il[e])??`off`}var cl=2e3,ll=1e4,ul=12e4;function dl(e){let t=[],n=null,r=new Map,i=e.modelPickerEnabled!==!1,a=e.catalogRetryDelayMs??cl,o=e.catalogRetryMaxDelayMs??ll,s=e.catalogRetryWindowMs??ul,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`,sl(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=al(i),o=e.getSelectedScoopJid()??n?.scoopJid;o&&a&&a!==`max`&&r.setThinkingLevel(o,a,ol(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 fl(e,t,n,r,i=el){let a=await e.setScoopThinkingLevel(t,n,r);return a&&i(),a}function pl(e,t){return In(e)===null||new URL(t.location.href).searchParams.get(`cherry`)===`1`||xt(t.localStorage)}async function ml(e,t,n,r,a){let o=jn(t),s=Nn(o);e.thread.setAttribute(`context`,Ln(t));let c=kn(t),l=f({isRoot:c,name:t.name});e.thread.setAttribute(`accent`,l),e.switcher.setAttribute(`active`,t.id),fe(e,c?{kind:`cone`}:{kind:`scoop`,accent:l}),le(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`,sl(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-Dxem3Ydy.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 hl(e){if(pl(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 gl(e){let{boot:t,client:n,openReader:r,log:a}=e,{refs:o}=t;i(async()=>{let{createPlaceholderRefresher:e}=await import(`./wc-placeholder-Sji0t7ST.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…`}))}),hl({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-CJV3boxa.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=al(r),o=ol(r),s=t.getSelected();s&&i&&fl(n,s.id,i,o).catch(e=>a.warn(`local thinking update failed`,e))}),{getAttachStage:()=>s}}var _l=`slicc:leader-run-new-session`,vl=`slicc:leader-broadcast-snapshot`;function yl(e){if(!(!e.cone||e.cone===`cone`))return e.coneLabel||e.cone.replace(/^cone-/,``)}function bl(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 xl(e){let t=document.createElement(`slicc-freezer-card`);return t.setAttribute(`title`,e.title),t.setAttribute(`meta`,bl(e)),t.setAttribute(`slug`,e.filename),e.icon&&t.setAttribute(`icon`,e.icon),t}async function Sl(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 Cl(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(T,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 Cl(e){let t=await wl(e);return t.kind===`ok`?t.entries:t.kind===`missing`?[]:null}async function wl(e){let t;try{let n=await e.readFile(T,{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 Tl(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(El(r,i))}catch{}return n.sort((e,t)=>t.frozenAt.localeCompare(e.frozenAt)),n}function El(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=He(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 Dl(e,t){for(let t of Array.from(e.querySelectorAll(`slicc-freezer-card`)))t.remove();e.append(...t.map(xl))}async function Ol(e,t){let n=await e.readFile(nt(t),{encoding:`utf-8`}),r=typeof n==`string`?n:new TextDecoder().decode(n),i=await Ye(e,r,t.filename);return{title:i.title||t.title,messages:i.messages}}async function kl(e,t){let{getTranscriptExportService:n}=await i(async()=>{let{getTranscriptExportService:e}=await Promise.resolve().then(()=>vr);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 Al(e,t){if(t)return e.getScoops().find(e=>e.jid===t.id)}function jl(e){return{folder:e.folder,label:Pn({assistantLabel:e.assistantLabel,name:e.name,role:O(e)?`primary`:`child`}),jid:e.jid}}async function Ml(e){let{root:t}=e,n=t?jl(t):void 0,r=e=>kl(t,e),a=t=>{i(async()=>{let{notifyGelatiereOfSessionEnd:e}=await import(`./wc-gelatiere-C4XI_usG.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 Nl(e,t){e!==`erase`&&await Ml({...t,action:e})}async function Pl(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(vl)),i(async()=>{let{resetDictationPriming:e}=await import(`./wc-shell-Cj705NBI.js`).then(e=>e.Q);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 Fl(e,t){(e.thread.inner??e.thread).prepend(Il(e.thread.ownerDocument,t)),e.thread.setAttribute(`accent`,he),fe(e,{kind:`freezer`}),e.inputCard.setAttribute(`disabled`,``),e.switcher.removeAttribute(`active`)}function Il(e,t){let n=t?yl(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 Ll(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 Cl(n);if(a===null){if((await wl(n)).kind!==`corrupt`||(c.warn(`WC freezer index corrupt — rebuilding from archives`),a=await Tl(n),a.length===0))return;await r.writeFile(T,JSON.stringify(a,null,2))}e===f&&(l=a,Dl(t.freezer,a),!p&&a.some(e=>!e.icon&&!e.pendingEnrichment)&&(p=!0,i(async()=>{let{pickLucideIcon:e}=await import(`./quick-llm-CQWR6xvc.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})=>Sl({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=Al(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-CG_ht0Kw.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 Nl(t,{writer:o,root:s,client:r,freezerNew:g,refreshFreezer:m,runNewSessionFreeze:u,runNewSessionFreezeQuick:f,log:c}),await Pl({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-CG_ht0Kw.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:jl(e),captureCompleteSnapshot:t=>kl(e,t)}),m()};_t(`agentic-memory`)&&g()?.setAttribute(`no-skip`,``),window.addEventListener(_l,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 Cl(o)??[]).find(e=>e.filename===r);let{messages:c}=await Ol(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),Fl(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 Rl=null;function zl(e){Rl=e}function Bl(){return Rl?.()??[]}var Vl=null;function Hl(e){Vl=e}function Ul(){return Vl??void 0}var Wl=`slicc.leaderTrayFollowers`;function Gl(){return Kl()}function Kl(){if(Rl)return Rl();try{let e=globalThis.localStorage?.getItem(Wl);if(e)return JSON.parse(e)}catch{}return[]}function ql(e,t=globalThis.localStorage){try{t?.setItem(Wl,JSON.stringify(e))}catch{}}function Jl(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 Yl(e){let t=gt();if(t.state!==`inactive`)return{role:`follower`,state:t.state,joinUrl:t.joinUrl,sessionId:t.trayId,workerBaseUrl:Tt(t.joinUrl)?.workerBaseUrl??null,stalled:t.stalled};let n=on();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=vt(e.getItem(wt))}catch{}return{role:`standalone`,state:`inactive`,workerBaseUrl:r}}function Xl(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-BxfP0EC1.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-BxfP0EC1.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 Ne()){if(e.has(n.providerId))continue;if(e.add(n.providerId),!je(n.providerId)?.isOAuth){t.push({providerId:n.providerId});continue}let r=Pe(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 Jl(typeof e==`string`?e:new TextDecoder().decode(e))}catch{return{processes:[],terminated:0}}},getTrayInfo:()=>Yl(r),getConnectedFollowers:Bl}}var Zl=`sync-fs-nonce`;function Ql(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:Zl,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 $l=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 eu(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 tu=`<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 nu(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 ru(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(tu));let a=()=>{r.style.color=`var(--green)`,setTimeout(()=>{r.style.color=`var(--txt-3)`},1500)};return r.addEventListener(`short-click`,()=>{(async()=>{let n=nu(e.getMessages());await t(n??Ge([...e.getMessages()])),a()})()}),r.addEventListener(`long-press`,()=>{(async()=>{let n=Ge([...e.getMessages()]);n&&(await t(n),a())})()}),n.append(r),n}function $(){return`msg-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}function iu(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 au(e){return`
|
|
423
|
-
<div class="sprinkle-action-card">
|
|
424
|
-
<div class="sprinkle-action-card__header">${Jt(iu(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 ou(e){let t={id:e.id,text:e.content};return e.attachments?.length&&(t.attachments=e.attachments.length),t}var su=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(ou)}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(ou))}#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{ct(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=xe(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||!St()||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?re(i):i;this.#g?.(e,a.id,a.attachments)}catch(e){console.error(`onLocalUserMessage hook threw`,e)}}#U(e){return h(e,g())}#W(){if(this.#l)try{let e=this.#l();if(!e)return;dt(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??=ru({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)}}#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){this.setProcessing(!1),this.#ye({id:$(),role:`assistant`,content:typeof e==`string`?e:ut(e)??``,timestamp:Date.now(),error:!0}),this.#ce(e)}#ce(e){try{let t=typeof e==`string`?e:lt(e);if(typeof t==`string`&&ft(t))return;pt(`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=V(r,au(n),()=>{},!1);this.#N.set(t,{instance:e,container:r});return}let i=V(r,n,(e,n)=>{this.#p?.(t,e,n)},!1);this.#N.set(t,{instance:i,container:r}),this.#p?.(t,st,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&&ge(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}});_(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 ye(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(){s(this.#xe(),this.#M)}#Ce(){p(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 cu(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=eu(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-bHynTI4A.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 su({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?Me(n.id,n.provider):Ae()).id}}catch{return{scoopName:t,model:``}}},onTurnComplete:e=>{t.speaksReplies&&i(async()=>{let{consumeVoiceSubmission:e,speakReplyMarkdown:t}=await import(`./voice-reply-CgvrHu7l.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-bHynTI4A.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&&(ui(t),s.delete(e))},onMessageRendered:(e,n)=>{let r=s.get(e.id),i=n[0];if(!i){r&&ui(r),s.delete(e.id);return}t.onMessageRendered?.(i);let a=l()??void 0;s.set(e.id,li(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 lu(e,t){let n=new $l,r=()=>{let r=t.currentUnits(),i=e.getSelected()?.id;e.refs.switcher.scoops=Mn(r,i,f,n.sync(r,i)),e.refreshConeActions?.()};return e.refreshScoops=r,t.subscribeList(()=>r()),r}function uu(e,t,n){let{refs:r}=e;e.setChatTransport(t,n);let{controller:a,agentHandle:o}=cu(r,n,t,()=>e.getSelected(),n.onTurnIdle,n.welcome);e.setController(a);let s=lu(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=ue(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-CgvrHu7l.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-bHynTI4A.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:y(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 du=e({floatKindForRuntimeMode:()=>mu,floatLabelForKind:()=>pu,resolveStandaloneFloatKind:()=>hu}),fu={"slicc-server":`sliccstart`,"slicc-node-server":`npx`};function pu(e){return se(e)}function mu(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 hu(e){let t=e?.fetchFn??fetch,n=e?.timeoutMs??1500;try{let e=new AbortController,r=setTimeout(()=>e.abort(),n),i=await t(rt(`/api/status`),{cache:`no-store`,signal:e.signal,headers:it()}).finally(()=>clearTimeout(r));if(!i.ok)return`standalone`;let a=await i.json();return(a.service?fu[a.service]:void 0)??`standalone`}catch{return`standalone`}}function gu(e,t){let n=t.label??pu(t.floatKind);e.setAttribute(`label`,n),e.setAttribute(`float-kind`,t.floatKind);let r=on(),i=gt(),a=()=>{let t=_u(r,i);e.setAttribute(`connection`,t.connection),t.trayRole===`none`?e.removeAttribute(`tray-role`):e.setAttribute(`tray-role`,t.trayRole)},o=rn(e=>{r=e,a()}),s=mt(e=>{i=e,a()});return a(),()=>{o(),s()}}function _u(e,t){return e.state===`inactive`?t.state===`inactive`?{connection:`offline`,trayRole:`none`}:{connection:yu(t),trayRole:`follower`}:{connection:vu(e),trayRole:`leader`}}function vu(e){switch(e.state){case`connecting`:return`connecting`;case`leader`:return`live`;case`reconnecting`:return`reconnecting`;case`error`:return`error`;default:return`offline`}}function yu(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 bu(e,t,n){let r=n.floatLabel??pu(n.floatKind),i=Rd(e,r);gu(i.refs.floatbar,{floatKind:n.floatKind,label:r});let a=await n.connect(i),o=uu(i,a.client,a.host);return await a.workbench?.(i,o),t.info(`WC shell mounted`,{floatKind:n.floatKind}),{boot:i,chat:o}}var xu=36e5,Su=2e3,Cu=class{#e=[];#t;#n;constructor(e=xu,t=Su){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 wu(e){return d(e,ve)}async function Tu(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 wu(n)}function Eu(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 Du(e){return e.stalled||e.state===`reconnecting`?`warn`:e.state===`error`?`error`:e.state===`leader`||e.state===`connected`?`active`:`idle`}function Ou(e){return e.stalled?`stalled`:e.state===`leader`?`connected`:e.state}function ku(e){let t=Ou(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:Du(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:Du(e)}]}}function Au(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 ju(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 Mu(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 Nu(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 Pu(e){let t=kt({percent:e.percent,status:e.status});return t===`critical`?`error`:t===`warn`?`warn`:`active`}function Fu(e,t){let n=`${Dt(e.percent)}% used`,r=Ot(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:Pu(e)}}function Iu(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`:``,`${Dt(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?Pu(n):void 0,emptyText:`Model usage will be summarized after the first turn.`,rows:[...n?[Fu(n,t)]:[],...r.map(e=>({name:e.model,meta:`$${e.cost.toFixed(4)}`,status:`idle`}))]}}function Lu(e){let t=[],n=Ru(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=Du(e.tray);(r===`error`||r===`warn`)&&t.push({id:`tray`,severity:r===`error`?`error`:`warn`,icon:`cloud-off`,title:`Tray ${Ou(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 Ru(e,t){if(!e||kt({percent:e.percent,status:e.status})===`ok`)return null;let n=Ot(e.resetsAt,t),r=`${Dt(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 zu(e){return e>=100?`$${Math.round(e)}`:`$${e.toFixed(2)}`}function Bu(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:zu(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:Hu(l,e.units??[]),accent:u>=.9?`rose`:u>=.7?`amber`:`green`,foot:`fullest of ${l.length} context window${l.length===1?``:`s`}`}),d?[Vu(d,t,e.now??Date.now()),...f]:f}function Vu(e,t,n){let r=kt({percent:e.percent,status:e.status});return{id:`budget`,label:`${e.window[0]?.toUpperCase()??``}${e.window.slice(1)} budget`,value:Dt(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`:``,Ot(e.resetsAt,n)??``,t?`$${t.totalCost.toFixed(2)} this session`:``].filter(Boolean).join(` · `)}}function Hu(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:f({isRoot:i,name:a}),label:`${i?`${a} (cone)`:a} — ${Math.round(t*100)}% full`}})}var Uu={running:`R`,pending:`S`,exited:`Z`,killed:`K`};function Wu(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 Gu(e,t){return{pid:e.pid,ppid:e.ppid,state:Uu[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:Wu(e.startedAt,t)}}async function Ku(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:Bu({stats:l,workingUnits:h,totalUnits:n.length,liveProcesses:d.length,terminated:f,history:t,units:n,now:g}),alerts:Lu({tray:r,followers:i,mounts:s,oauthProviders:p,budget:l?.budget,now:g}),sections:[ku(r),Eu(i),Au(n,t=>e.isProcessing(t)),ju(s),Mu(m,p),Nu(a,o),Iu(l,g)],processes:{rows:d.map(e=>Gu(e,g)),terminated:f}}}var qu=`/shared`,Ju=3,Yu=200;async function Xu(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,Yu),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<Ju?await Xu(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 Zu(e,t=k.root){let n=[];for(let r of[t,qu])n.push({kind:`dir`,id:r,label:r.replace(/^\/(cones\/)?/,``),open:!0,children:await Xu(e,r,1)});return n}var Qu=200,$u=1e3,ed=3e3,td=45e3;function nd(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 Zu(n,e.getWorkspace().root);t===o&&(e.fileTree.items=i,r||(r=!0,ce({fileTree:e.fileTree,openFs:e.openFs,openWriter:e.openWriter,insertReference:e.insertReference,toPreviewUrl:pe,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>=$u){clearTimeout(c),c=null,u();return}c!=null&&clearTimeout(c),c=setTimeout(()=>{c=null,u()},Qu)},f=()=>{t??=setInterval(u,ed)},p=()=>{let t=++a;s?.(),s=null;let n=[e.getWorkspace().root,qu];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 rd(e){let t=!1,n=!1,r=!1,i=0,a=null,o=new Cu,s=nd(e),c=()=>{a!=null&&(clearInterval(a),a=null)},l=()=>{let t=++i;e.openFs().then(async n=>{let r=await Tu(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 Ku(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 ${td}ms; re-arming so the next term activation retries`))},td);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 id=[`/workspace`,`/shared`,`/memory`,`/scoops`,`/mnt`],ad=new Set([`node_modules`,`.git`,`dist`,`build`,`out`,`coverage`,`.cache`,`.venv`,`venv`,`__pycache__`,`target`,`vendor`,`.next`,`.turbo`,`python_wheels`]),od=2e4,sd=12,cd=3e4;function ld(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 ud(e){return e.slice(e.lastIndexOf(`/`)+1)}function dd(e,t){return e===t?!0:e.endsWith(t)?e[e.length-t.length-1]===`/`:!1}function fd(e,t){let n=ld(e);return t.includes(`/`)?dd(n,t):ud(n)===t}function pd(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))&&fd(a,e)&&(r.add(a),n.push(ld(a)),n.length>=md))break}return n}var md=4,hd=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??id,this.#n=t.ignoredDirs??ad,this.#r=t.maxEntries??od,this.#i=t.maxDepth??sd,this.#a=t.ttlMs??cd}resolve(e,t=[]){this.#g();let n=ld(e),r=this.#d(n),i=pd(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=>dd(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(ud(e))??[];return e.includes(`/`)?{query:e,matches:t.filter(t=>dd(t,e)).sort(gd)}:{query:e,matches:[...t].sort(gd)}}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 gd(e,t){let n=e.split(`/`).length,r=t.split(`/`).length;return n===r?e.localeCompare(t):n-r}var _d=`file-mention`,vd=`data-file-mentions`;function yd(e){return`${e.childNodes.length}:${e.textContent?.length??0}`}var bd=new Set([`A`,`PRE`,`SCRIPT`,`STYLE`,`TEXTAREA`]),xd=`file-mention-open`;async function Sd(e,t,n=[]){let r=yd(e);if(e.getAttribute(vd)===r)return;let i=Cd(e);if(i.length===0){e.setAttribute(vd,r);return}let a=[],o=new Set;for(let e of i){let t=c(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(vd,r);return}let s=[...o],l=await t.resolveAll(s,n),u=new Map(s.map((e,t)=>[e,l[t]?.matches??[]]));for(let{node:e,mentions:t}of a){if(!e.isConnected)continue;let n=t.filter(e=>(u.get(e.path)?.length??0)>0);n.length!==0&&wd(e,n,u)}e.setAttribute(vd,yd(e))}function Cd(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(bd.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 wd(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(Td(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 Td(e,t,n,r,i){let a=e.createElement(`a`);return a.className=_d,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(xd,{detail:t,bubbles:!0,composed:!0}))}),a}var Ed=`slicc-agent-message`,Dd=`slicc-action-row[${m}]`;function Od(e,t){let n=[],r=e.querySelectorAll(Dd);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=>l(e))}function kd(e){let t=globalThis.requestIdleCallback;typeof t==`function`?t(e):setTimeout(e,0)}function Ad(e){try{return jd(e)}catch(t){return e.log.error(`File mention wiring failed; continuing without it`,t),()=>{}}}function jd(e){let{thread:t,openFs:n,log:r}=e;if(!(t instanceof Node))return()=>{};let i=null,a=()=>(i??=n().then(e=>new hd(e)),i),o=e=>{if(!(e instanceof HTMLElement)||e.hasAttribute(`streaming`))return;let n=e.querySelector(`.body`)??e;c(n.textContent??``).length!==0&&kd(()=>{let i=Od(t,e);a().then(e=>Sd(n,e,i)).catch(e=>r.error(`File mention linking failed`,e))})},s=e=>{for(let t of e.querySelectorAll(Ed))o(t)};s(t);let l=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()===Ed?o(e):s(e));let e=t.target?.closest?.(Ed);e&&o(e)}});l.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`streaming`]});let u=e=>{let{path:t,line:i}=e.detail;n().then(e=>x(e,t,i===void 0?{}:{line:i})).catch(e=>r.error(`File mention preview failed`,e))};return t.addEventListener(xd,u),()=>{l.disconnect(),t.removeEventListener(xd,u)}}var Md=e({DEFAULT_DOCK_TREE_ON_BOOT:()=>Zd,DOCK_TREE_STORAGE_KEY:()=>Xd,attachWcWorkbench:()=>ef,bootLeaderFloat:()=>tf,makeSprinkleAttachImage:()=>$d,prepareWcShell:()=>Rd,wireDockTreePersistence:()=>Qd,wireWcChipTips:()=>Gd,workspaceForSelection:()=>Id});function Nd(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 Pd(e){let{controller:t,destination:n,held:r,previousJid:i,roster:a}=e;if(i&&i!==n&&Nd({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 Fd(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 Id(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 Ld(e){let{refs:t}=e,n=null,r=new Map;return{clear:()=>{n=null},getSelected:()=>n,holdQueue:()=>{let t=n?.id;t&&Nd({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();Pd({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`),ml(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 Rd(e,t){let n=oe(e,{messages:[],scoops:[],floatLabel:t,placeholder:`Ask sliccy, or describe a change…`,urlState:!0}),r=null,i=null,a=Xo,o=null,s=()=>o??Q(h),c=new Map,l=!1,u=null,d=new Set,f=Fd(()=>s(),(e,t)=>{r?.loadMessages(e,t),a.onSnapshotRendered?.(e)}).watch,p=Ld({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 zd(e){let t=null;return()=>(t??=(async()=>{let[{createRemoteVfsClient:t},{createRemoteWritableVfsClient:n}]=await Promise.all([i(()=>import(`./remote-vfs-client-Dhv8nI7h.js`),__vite__mapDeps([65,46])),i(()=>import(`./writable-vfs-client-pZwewNEw.js`),__vite__mapDeps([66,46]))]);return{reader:t({transport:e.getTransport()}),writer:n({transport:e.getTransport()})}})(),t)}function Bd(e,t,n,r,a){e.onClientReady(()=>{r.intercept||i(async()=>{let{wireWcOnboarding:e}=await import(`./wc-onboarding-BUUyiqjJ.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 Vd(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:Ot(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 Hd(e,t,n){let r=t.standalone;r&&i(async()=>{let{wireWcBrowser:e}=await import(`./wc-browser-DO1Pnegi.js`);return{wireWcBrowser:e}},__vite__mapDeps([69,70,6,71,3,72])).then(({wireWcBrowser:t})=>t({refs:e.refs,browser:r.browser,log:n})).catch(e=>n.error(`WC browser overlay wiring failed`,e))}function Ud(e){return{assistantLabel:e.assistantLabel,name:e.name,role:O(e)?`primary`:`child`}}function Wd(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 Gd(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(Ud(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-CQWR6xvc.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(Ud(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 Kd(e,t,n){let{RemoteTerminalView:r}=await i(async()=>{let{RemoteTerminalView:e}=await import(`./remote-terminal-view-D4Ah4AQY.js`);return{RemoteTerminalView:e}},__vite__mapDeps([73,1,2,25,3,53,34,35,19,41,74,15,40,39,75,76])),{fetchSecretEnvVars:a}=await i(async()=>{let{fetchSecretEnvVars:e}=await import(`./secret-env-CDLWFhsq.js`);return{fetchSecretEnvVars:e}},__vite__mapDeps([77,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 qd(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 Jd(e,t,n,r){i(async()=>{let{installLeaderPermissionsSurface:e,installMountPendingConsumer:t}=await import(`./wc-permissions-BsGMi4OQ.js`);return{installLeaderPermissionsSurface:e,installMountPendingConsumer:t}},__vite__mapDeps([78,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([79,2,19]));r({runtimeMode:o,providers:await s(c()||o===`extension`||o===`extension-detached`)}),a({runShell:Yd(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-IsuAxr4v.js`);return{installSecretRequestSurface:e}},__vite__mapDeps([80,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,81])).then(({installSecretRequestSurface:e})=>e()).catch(e=>r.warn(`WC secret request surface wiring failed`,e))}function Yd(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([76,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 Xd=`slicc-dock-tree:default`,Zd={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 Qd(e,t){let n=e.dockTree,r=e.dockTree,i=e=>{try{localStorage.setItem(Xd,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(Xd);r.setTree(e?JSON.parse(e):Zd)}catch(e){t.warn(`WC dock-tree restore failed — seeding the default layout`,e),r.setTree(Zd)}}function $d(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 ef(e,t,n,r,a,o={}){i(async()=>{let{initTimestampPreference:e}=await import(`./wc-shell-Cj705NBI.js`).then(e=>e.q);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([82,1,83,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([83,1,3])).then(({applyThemeOverrides:e})=>e()).catch(()=>void 0);let c=_t(`panel-layouts`);s.dockTree.tilesMovable=c,c||Qd(s,a);let l=null,u=Vd(e.wiring,t),d=()=>l?.(),f=r.welcome??{intercept:null},p=Q(e.wiring),{agentHandle:m}=n;e.onClientReady(u);let h=zd(t),g=async()=>(await h()).reader;o.standalone?.runtimeMode!==`cherry`&&o.standalone?.runtimeMode!==`hosted-leader`?Bd(e,t,h,f,a):f.intercept=Yc({openVfs:async()=>(await h()).writer,log:a});let _=gl({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(Wd({boot:e,triggerPlaceholder:d,refreshStats:u})),Gd({switcher:s.switcher,getScoops:()=>t.getScoops(),lastActivity:e.wiring.lastActivity}),Hd(e,o,a),Jd(e,t,o,a);let v=rd({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:()=>Xl({client:t,openReader:g,storage:window.localStorage}),getWorkspace:()=>Id({client:t,clearSelection:e.clearSelection,selectedId:e.getSelected()?.id}),mountTerminal:n=>Kd(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-BdV-wKTx.js`);return{panelizeShell:e}},__vite__mapDeps([84,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,85,86])).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)),Ad({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=Ll({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:te}=y;if(b(),e.onClientReady(b),_t(`multiple-cones`)){let n=qc({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)}qd(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-ByZ7W9gP.js`);return{loadShortcutConfig:e}},__vite__mapDeps([87,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([88,89,90,46])),l=(await i(async()=>{let{getPanelizedShell:e}=await import(`./panelize-shell-BdV-wKTx.js`);return{getPanelizedShell:e}},__vite__mapDeps([84,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,85,86]))).getPanelizedShell(),{wireWcSprinkles:u}=await i(async()=>{let{wireWcSprinkles:e}=await import(`./wc-sprinkles-D7Cv7m3r.js`);return{wireWcSprinkles:e}},__vite__mapDeps([91,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,92,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:$d(_,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-BdV-wKTx.js`);return{getPanelizedShell:e}},__vite__mapDeps([84,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,85,86])),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-DQh4wRpa.js`);return{registerAgentPanels:e}},__vite__mapDeps([93,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-DeIHdw5o.js`);return{applyLayout:e}},__vite__mapDeps([94,91,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,92,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-XTl0wqt5.js`);return{wireWcTray:e}},__vite__mapDeps([95,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,96,97,98,41,40,99,39,75,64,82,83,49,100,68,101,102,47,48,50,53,90,76,56,72,103,104,92])),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&&ml(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=yr(new vc({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:Ic(),snapshotStore:{read:async e=>{let{reader:t}=await h();return kc(t,e)},write:async(e,t)=>{let{writer:n}=await h();return Oc(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.165.0`}));window.addEventListener(`unload`,r,{once:!0})}let x=!1,ne=()=>x?Promise.resolve():(x=!0,(async()=>{try{let[{getTranscriptExportService:e},{transcriptZipToBlob:t,downloadTranscriptBlob:n}]=await Promise.all([i(()=>Promise.resolve().then(()=>vr),void 0),i(()=>import(`./wc-transcript-export-IV61nDvZ.js`),__vite__mapDeps([105,2,96,101,102,1]))]),r=te(),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-IV61nDvZ.js`);return{showTranscriptExportFailure:e}},__vite__mapDeps([105,2,96,101,102,1])).then(({showTranscriptExportFailure:t})=>t(e)).catch(e=>a.error(`Transcript export notice failed`,e))}finally{x=!1}})());if(i(async()=>{let{wireWcNav:e}=await import(`./wc-nav-ClJyDfXq.js`);return{wireWcNav:e}},__vite__mapDeps([106,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,92])).then(({wireWcNav:e})=>e({refs:s,client:t,workUnits:p,getUnits:()=>p.currentUnits(),log:a,onExportTranscript:ne,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-ByZ7W9gP.js`);return{writeShortcutTrigger:e}},__vite__mapDeps([87,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-BVpldTNH.js`);return{getComposerSpeech:e,setComposerSpeechInstanceId:t}},__vite__mapDeps([107,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,108])).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-DbL0fEQT.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-CG_ht0Kw.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 tf(e,t,n=`standalone`){let{browser:r,realCdpTransport:a,instanceId:o,localApiBaseUrl:s,bridgeToken:c,localLickWsUrl:l,extensionDelegateId:u,attachLickForwardingClient:d}=await bt({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(()=>du);return{floatKindForRuntimeMode:e,floatLabelForKind:t,resolveStandaloneFloatKind:n}},void 0),h=n===`standalone`?await m():f(n),g=p(h);o&&yt(o);let{syncFsBridgeEnabled:_,syncFsChannelNonce:v}=Ql(),y=!1,b,ee,{boot:te}=await bu(e,t,{floatKind:h,floatLabel:g,connect:e=>{b=us({realCdpTransport:a,reconnectCdp:()=>r.reconnectIfNeeded(),instanceId:o,makeClient:t=>new qo(Qc(e.wiring),t),localApiBaseUrl:s,bridgeToken:c,syncFsBridgeEnabled:_,syncFsChannelNonce:v,localLickWsUrl:l,extensionDelegateId:u,flagFloat:n,onWorkerScriptError:()=>{Ct()},onReadyStall:e=>{y=!0,i(()=>import(`./boot-stall-overlay-Pxp4nHfq.js`).then(t=>t.showBootStallOverlay(document,e)),[])},onLateReady:()=>{Ct()}}),$o({send:e=>b.client.sendRaw(e)}),d?.(b.client);let f=Yo(b.client);return{client:Q(e.wiring),host:f,workbench:(e,i)=>{ee=ef(e,b.client,i,f,t,{instanceId:o,standalone:{browser:r,floatKind:h,realCdpTransport:a,runtimeMode:n}})}}}}),{setupSudoStandalone:x}=await i(async()=>{let{setupSudoStandalone:e}=await import(`./main-Dxem3Ydy.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 x({log:t});try{await b.ready}finally{y&&i(()=>import(`./boot-stall-overlay-Pxp4nHfq.js`).then(e=>e.removeBootStallOverlay(document)),[])}te.wiring.notifyReady?.(),globalThis.__slicc_kernel_ready=!0,t.info(`WC live shell ready`,{scoops:b.client.getScoops().length}),ee?.();let{consumeAutoPrompt:ne}=await i(async()=>{let{consumeAutoPrompt:e}=await import(`./auto-prompt-Mj-vUQeB.js`);return{consumeAutoPrompt:e}},[]),re=ne(window.location.search);re&&(te.getController()?.sendUserMessage(re),t.info(`Auto-prompt submitted`,{length:re.length}))}export{jo as A,ur as B,qo as C,Eo as D,Mo as E,So as F,no as I,zr as L,Ma as M,io as N,ko as O,ja as P,xr as R,Yo as S,Ao as T,Xn as V,el as _,$l as a,Q as b,Ul as c,ql as d,vl as f,tl as g,$c as h,eu as i,No as j,Oo as k,zl as l,dl as m,Md as n,Bl as o,_l as p,bu as r,Gl as s,ef as t,Hl as u,nl as v,Co as w,Qo as x,Qc as y,vr as z};
|