sliccy 6.239.1 → 6.240.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ui/.vite/manifest.json +221 -219
- package/dist/ui/assets/{account-store-BspEP7gu.js → account-store-C-NiHHQY.js} +1 -1
- package/dist/ui/assets/{account-store-BMuQVHFz.js → account-store-CtGPvHvd.js} +1 -1
- package/dist/ui/assets/{adobe-Bno0A9Rh.js → adobe-D5hgWlms.js} +1 -1
- package/dist/ui/assets/{adobe-lvs94eE-.js → adobe-nBjoxFtq.js} +1 -1
- package/dist/ui/assets/{agent-panels-Dw3EUkgf.js → agent-panels-DWqSZGxf.js} +1 -1
- package/dist/ui/assets/{almost-bash-shell-headless-DjH45LFx.js → almost-bash-shell-headless-CZbWjwJm.js} +499 -499
- package/dist/ui/assets/{apply-layout-OjpkOPJI.js → apply-layout-Bk_e9oqd.js} +1 -1
- package/dist/ui/assets/{azure-openai-Dd5EJ5OF.js → azure-openai-BRf15lgF.js} +1 -1
- package/dist/ui/assets/{azure-openai-BPfNF8uA.js → azure-openai-CHfa8r_n.js} +1 -1
- package/dist/ui/assets/{cdp-C1aEyl98.js → cdp-D5mBrwwS.js} +1 -1
- package/dist/ui/assets/{cerebras-CCfRW5qr.js → cerebras-Cw7KXUM3.js} +1 -1
- package/dist/ui/assets/{cerebras-BIXXLNra.js → cerebras-Cy2j1Ui_.js} +1 -1
- package/dist/ui/assets/{composer-speech-CGejp4Op.js → composer-speech-BWjTBIUx.js} +1 -1
- package/dist/ui/assets/{connect-surface-C-YnHz9O.js → connect-surface-CuJ3Reds.js} +1 -1
- package/dist/ui/assets/context-compaction-BCsq-2e6.js +58 -0
- package/dist/ui/assets/core-BFRZk2b-.js +62 -0
- package/dist/ui/assets/{core-C1m4D34S.js → core-EGZ5TU35.js} +1 -1
- package/dist/ui/assets/{directed-approval-Dqeeo7Ur.js → directed-approval-CR57DTOL.js} +1 -1
- package/dist/ui/assets/{emscripten-vfs-hook-DIUvgf55.js → emscripten-vfs-hook-CpfmtemG.js} +1 -1
- package/dist/ui/assets/{frozen-archive-writer-1Sfd3_hn.js → frozen-archive-writer-CQj4KU4Z.js} +1 -1
- package/dist/ui/assets/{frozen-archive-writer-BCuzFGRS.js → frozen-archive-writer-Dtee_g3m.js} +1 -1
- package/dist/ui/assets/{frozen-session-delete-DknkxXFd.js → frozen-session-delete-B69rr58N.js} +1 -1
- package/dist/ui/assets/{frozen-session-identity-pkUWEifZ.js → frozen-session-identity-hKpX_Wns.js} +1 -1
- package/dist/ui/assets/{frozen-session-identity-Ba-yRITY.js → frozen-session-identity-vrVfUkEJ.js} +1 -1
- package/dist/ui/assets/{gelatiere-unit-BANCZ9x3.js → gelatiere-unit-Ahwb21GE.js} +1 -1
- package/dist/ui/assets/{github-DCZKorBz.js → github-COORmPyK.js} +1 -1
- package/dist/ui/assets/{github-BlMprkf6.js → github-Cv5SjCCJ.js} +1 -1
- package/dist/ui/assets/{github-copilot-D23XZpG6.js → github-copilot-CpHEaEoF.js} +1 -1
- package/dist/ui/assets/{github-copilot-C8Hqj_iR.js → github-copilot-DnY7C0vv.js} +1 -1
- package/dist/ui/assets/{go-driver-CvHJRpyw.js → go-driver-Bl_pd-vs.js} +1 -1
- package/dist/ui/assets/{guest-tool-gate-CXdRgkkb.js → guest-tool-gate-83ZVVYjM.js} +1 -1
- package/dist/ui/assets/{hear-BHugiT-P.js → hear-Cg_l3xI4.js} +1 -1
- package/dist/ui/assets/icons-BJTFywJo.js +1 -0
- package/dist/ui/assets/{idle-compaction-pwltoPDa.js → idle-compaction-DGln8tkz.js} +1 -1
- package/dist/ui/assets/{interrupted-work-recovery-DSX617ic.js → interrupted-work-recovery-CWSaMQsO.js} +1 -1
- package/dist/ui/assets/{js-realm-worker-CmibdX_h.js → js-realm-worker-CBw_mwZz.js} +2 -2
- package/dist/ui/assets/{jsh-executor-DHAF6dFq.js → jsh-executor-CQjOV2Rz.js} +2 -2
- package/dist/ui/assets/{kernel-worker-Dd6UT_Hw.js → kernel-worker-bxQFQR0N.js} +78 -78
- package/dist/ui/assets/{lick-ws-bridge-LW2pivtS.js → lick-ws-bridge-B8QaH0Pf.js} +1 -1
- package/dist/ui/assets/{lick-ws-bridge-B6GPqj60.js → lick-ws-bridge-CDo81_q8.js} +1 -1
- package/dist/ui/assets/{live-session-curation-B6nC2IwS.js → live-session-curation-BkxJa78s.js} +1 -1
- package/dist/ui/assets/live-session-curation-DmTewcBv.js +186 -0
- package/dist/ui/assets/{live-session-snapshot-BhWFvQrZ.js → live-session-snapshot-BlD0vbcV.js} +1 -1
- package/dist/ui/assets/{local-llm-_r9oESrG.js → local-llm-C5Mw5oib.js} +1 -1
- package/dist/ui/assets/{local-llm-bB4uQj3y.js → local-llm-CjqUAhTS.js} +1 -1
- package/dist/ui/assets/main-6hbXaflT.js +22 -0
- package/dist/ui/assets/{main-cherry-Cg_eulXT.js → main-cherry-ChIZgtW1.js} +1 -1
- package/dist/ui/assets/{mcp-command-Br5ePgQj.js → mcp-command-CZ0dP9jt.js} +9 -9
- package/dist/ui/assets/{memory-curation-seam-D74FwxQn.js → memory-curation-seam-CzM3y0O_.js} +1 -1
- package/dist/ui/assets/{memory-health-CpD91kc7.js → memory-health-BX2lnaGt.js} +1 -1
- package/dist/ui/assets/{memory-write-execute-B7mSsyNT.js → memory-write-execute-CNtHUYEr.js} +1 -1
- package/dist/ui/assets/{merge-folded-cost-into-frozen-9g-oWfCg.js → merge-folded-cost-into-frozen-DAqbDB81.js} +1 -1
- package/dist/ui/assets/{new-session-BEyoS6w7.js → new-session-DBeXyiOz.js} +2 -2
- package/dist/ui/assets/oauth-bootstrap-CbyjrWqJ.js +2 -0
- package/dist/ui/assets/{onboarding-orchestrator-CUANwcPE.js → onboarding-orchestrator-8slcbG6R.js} +1 -1
- package/dist/ui/assets/{openai-codex-BWzG7p7O.js → openai-codex-C61wrKlC.js} +1 -1
- package/dist/ui/assets/{openai-codex-Dqq1RGXY.js → openai-codex-Dj9y9W7z.js} +1 -1
- package/dist/ui/assets/{openrouter-CYjM-kZx.js → openrouter-BHpmKURm.js} +1 -1
- package/dist/ui/assets/{openrouter-DZ-E1wuB.js → openrouter-fAEMsV54.js} +1 -1
- package/dist/ui/assets/{openrouter-free-BOWeJi1P.js → openrouter-free-CJy-TuXT.js} +1 -1
- package/dist/ui/assets/{openrouter-free-D9nGhI8x.js → openrouter-free-CiiM1Gjs.js} +1 -1
- package/dist/ui/assets/{openrouter-oauth-wf55kglO.js → openrouter-oauth-7nM0b7Jo.js} +1 -1
- package/dist/ui/assets/{openrouter-oauth-CtSL7Qxf.js → openrouter-oauth-Cvd_-gjS.js} +1 -1
- package/dist/ui/assets/panel-rpc-handlers-DDdB1M8b.js +2 -0
- package/dist/ui/assets/{panelize-shell-C04CGO5Z.js → panelize-shell-DpeA6cvD.js} +1 -1
- package/dist/ui/assets/{pi-edit-execution-CKBidACs.js → pi-edit-execution-BXlFQhnB.js} +1 -1
- package/dist/ui/assets/{process-worker-Qo-KJQnm.js → process-worker-B_jMhtwi.js} +1 -1
- package/dist/ui/assets/{provider-B6KB41WB.js → provider-30BKUHu6.js} +1 -1
- package/dist/ui/assets/{provider-BvJJikM5.js → provider-jAi7a3_L.js} +1 -1
- package/dist/ui/assets/{provider-settings-D5h7Kn8Y.js → provider-settings-D94LxvnC.js} +1 -1
- package/dist/ui/assets/provider-store-access-D_a8X9pQ.js +1 -0
- package/dist/ui/assets/provider-store-access-GlTLXpic.js +1 -0
- package/dist/ui/assets/{providers-H2QVvHIo.js → providers-BzMeirCU.js} +1 -1
- package/dist/ui/assets/providers-DPjGqnnZ.js +2 -0
- package/dist/ui/assets/{quick-llm-CVspCSPa.js → quick-llm-Ds2TLGFz.js} +1 -1
- package/dist/ui/assets/{realm-inprocess-BcXidk7x.js → realm-inprocess-BRdFlTB1.js} +2 -2
- package/dist/ui/assets/{realm-unhandled-rejections-C17KMSUA.js → realm-unhandled-rejections-BMZKXRkX.js} +1 -1
- package/dist/ui/assets/{realm-unhandled-rejections-C_hJHL3a.js → realm-unhandled-rejections-f3NQhko5.js} +1 -1
- package/dist/ui/assets/{recovery-screen-B3EIqd1H.js → recovery-screen-Ar1gewgj.js} +1 -1
- package/dist/ui/assets/{remote-terminal-view-B8c0sr0S.js → remote-terminal-view-DzxSx53x.js} +2 -2
- package/dist/ui/assets/{restore-D0xn5gYN.js → restore-38QkEUrK.js} +1 -1
- package/dist/ui/assets/{run-E8fkhkYA.js → run-0TklT6x-.js} +1 -1
- package/dist/ui/assets/{run-x2hyttPz.js → run-BYqCvTd8.js} +2 -2
- package/dist/ui/assets/{run-yIEzBr4M.js → run-BnVYcWap.js} +1 -1
- package/dist/ui/assets/{run-C3Hy4SBY.js → run-D1iXNNpZ.js} +2 -2
- package/dist/ui/assets/{run-DKWaudm_.js → run-DW65sPip.js} +12 -12
- package/dist/ui/assets/{session-command-memory-LPNx4Ykm.js → session-command-memory-nk61yZd5.js} +2 -2
- package/dist/ui/assets/{session-jsonl-DzjYDmn3.js → session-jsonl-BGYnLhO2.js} +1 -1
- package/dist/ui/assets/{session-jsonl-C2urTY7z.js → session-jsonl-DmNevCGc.js} +1 -1
- package/dist/ui/assets/{session-search-index-Eq_qfrjB.js → session-search-index-BpfPtbUp.js} +1 -1
- package/dist/ui/assets/{setup-feature-flags-remote-Ch1uljUD.js → setup-feature-flags-remote-CfuFdg1B.js} +1 -1
- package/dist/ui/assets/{setup-model-catalog-DTQU8cnr.js → setup-model-catalog-o-lxwTfe.js} +1 -1
- package/dist/ui/assets/{silent-renew-backoff-ClxUKo41.js → silent-renew-backoff-BsUcHR9C.js} +1 -1
- package/dist/ui/assets/slicc-version-KlsjiTIs.js +1 -0
- package/dist/ui/assets/{soundscape-DmMhiSiT.js → soundscape-DGsKTL7n.js} +1 -1
- package/dist/ui/assets/{speak-B-nz5uMy.js → speak-DQq-78bT.js} +1 -1
- package/dist/ui/assets/{sprinkle-manager-I5F18apA.js → sprinkle-manager-D3kZi8c1.js} +1 -1
- package/dist/ui/assets/{sprinkle-renderer-BtNj8eVS.js → sprinkle-renderer-BSZ6849V.js} +1 -1
- package/dist/ui/assets/{sudo-CR-Y4poZ.js → sudo-Bh0Nyu2S.js} +1 -1
- package/dist/ui/assets/{supervisor-rbjp5Jxz.js → supervisor-CgK-g-6U.js} +1 -1
- package/dist/ui/assets/{sync-dialog-Cjgp-t5Q.js → sync-dialog-BLnO9spb.js} +1 -1
- package/dist/ui/assets/{transformers-env-CCuheXlU.js → transformers-env-CGv03PAS.js} +1 -1
- package/dist/ui/assets/{tray-leader-CnIx31Lw.js → tray-leader-ChyMsq5K.js} +1 -1
- package/dist/ui/assets/{tray-leave-runtime-D1qkvSFd.js → tray-leave-runtime-uSx_wlpd.js} +1 -1
- package/dist/ui/assets/{tray-sidecar-DQO-4oRP.js → tray-sidecar-CEUzqaCB.js} +1 -1
- package/dist/ui/assets/{turn-journal-EgGBqAjY.js → turn-journal-CVQtwHPx.js} +1 -1
- package/dist/ui/assets/{upgrade-detection-bn5ZPVwB.js → upgrade-detection-CRfiGZtd.js} +1 -1
- package/dist/ui/assets/utf16-clip-Dcxt-q1C.js +1 -0
- package/dist/ui/assets/{voice-reply-ByGMcwzr.js → voice-reply-CmTXBNIY.js} +1 -1
- package/dist/ui/assets/{wasi-runtime-D50sf0fY.js → wasi-runtime-BBxEcrtW.js} +5 -5
- package/dist/ui/assets/wc-attach-BMrT2hbz.js +13 -0
- package/dist/ui/assets/{wc-browser-D8-89DQs.js → wc-browser-SiC_HbcV.js} +1 -1
- package/dist/ui/assets/{wc-computers-BSwZi2VG.js → wc-computers-CbxHjQwk.js} +1 -1
- package/dist/ui/assets/{wc-detached-BmB8d_Yi.js → wc-detached-pGIdhxB4.js} +1 -1
- package/dist/ui/assets/wc-extension-N1war_PP.js +2 -0
- package/dist/ui/assets/wc-follower-CgTZ9JBz.js +17 -0
- package/dist/ui/assets/{wc-follower-oauth-Dm8dPxfI.js → wc-follower-oauth-B260JoLu.js} +1 -1
- package/dist/ui/assets/{wc-gelatiere-DVODoBJi.js → wc-gelatiere-BlsqWkHN.js} +1 -1
- package/dist/ui/assets/wc-live-ZUBUivnE.js +248 -0
- package/dist/ui/assets/wc-nav-DdROtTx2.js +2 -0
- package/dist/ui/assets/{wc-onboarding-BRP76Hoi.js → wc-onboarding-C30GH-OF.js} +2 -2
- package/dist/ui/assets/{wc-permissions-Bah1z66z.js → wc-permissions-CBJYM_hx.js} +2 -2
- package/dist/ui/assets/{wc-placeholder-KZttIyjU.js → wc-placeholder-BuoA4euI.js} +3 -3
- package/dist/ui/assets/{wc-secret-request-BHU1XUwC.js → wc-secret-request-B01vmSA2.js} +1 -1
- package/dist/ui/assets/{wc-settings-DrY7SIeo.js → wc-settings-DGUNaOtw.js} +3 -3
- package/dist/ui/assets/{wc-shell-Bt8UzfFa.js → wc-shell-BEqDPo9n.js} +4 -4
- package/dist/ui/assets/{wc-shortcut-config-D7PIvlOi.js → wc-shortcut-config-DBFBwkp1.js} +1 -1
- package/dist/ui/assets/wc-sprinkles-HVofkAHe.js +2 -0
- package/dist/ui/assets/{wc-transcript-export-BPYmvVFN.js → wc-transcript-export-A3G5Te93.js} +2 -2
- package/dist/ui/assets/{wc-tray-BO3RL4ye.js → wc-tray-HziHRnx8.js} +4 -4
- package/dist/ui/assets/welcome-detection-02ejBHCj.js +1 -0
- package/dist/ui/assets/whisper-session-CRowBEuo.js +2 -0
- package/dist/ui/assets/{xai-grok-BWDHZnXP.js → xai-grok-Bb6A-2nI.js} +1 -1
- package/dist/ui/assets/{xai-grok-DS8TkopE.js → xai-grok-Bi7RG8b2.js} +1 -1
- package/dist/ui/index.html +5 -4
- package/dist/ui/lucide-icons.js +358 -355
- package/dist/ui/packages/webapp/index.html +5 -4
- package/package.json +1 -1
- package/dist/ui/assets/context-compaction-B8b3xc1C.js +0 -58
- package/dist/ui/assets/core-Cx9N3lmn.js +0 -62
- package/dist/ui/assets/icons-2DY2vYOc.js +0 -1
- package/dist/ui/assets/live-session-curation-Cj_Et3yL.js +0 -186
- package/dist/ui/assets/main-DJ1JbcDS.js +0 -22
- package/dist/ui/assets/oauth-bootstrap-Cbq8G8pM.js +0 -2
- package/dist/ui/assets/panel-rpc-handlers-Xpdj6WbR.js +0 -2
- package/dist/ui/assets/provider-store-access-Dfk23puf.js +0 -1
- package/dist/ui/assets/provider-store-access-g6Y5oeM5.js +0 -1
- package/dist/ui/assets/providers-CrXalGVD.js +0 -2
- package/dist/ui/assets/slicc-version-DRlU9ovU.js +0 -1
- package/dist/ui/assets/wc-attach-AkwSo7Fl.js +0 -13
- package/dist/ui/assets/wc-extension-CaM9V86I.js +0 -2
- package/dist/ui/assets/wc-follower-B7ksSDDH.js +0 -17
- package/dist/ui/assets/wc-live-DF9dh-BS.js +0 -248
- package/dist/ui/assets/wc-nav-CKnUmkye.js +0 -2
- package/dist/ui/assets/wc-sprinkles-BWilXn3I.js +0 -2
- package/dist/ui/assets/welcome-detection-DrCUfyTd.js +0 -1
- package/dist/ui/assets/whisper-session-DL1fUZYq.js +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
import{CHAT_SURFACE_ID as e}from"./wc-sprinkles-
|
|
1
|
+
import{CHAT_SURFACE_ID as e}from"./wc-sprinkles-HVofkAHe.js";var t=`focus`,n={type:`leaf`,surfaceId:`chat`};function r(e,t={},n={}){return{zones:{top:null,left:null,middle:null,right:null,bottom:null,...e},rowFr:{top:1,center:1,bottom:1,...n},colFr:{left:1,middle:1,right:1,...t}}}var i={focus:{name:`focus`,tree:r({left:n},{left:3,middle:1})}};function a(e){return i[e]??null}function o(n,r){switch(r.kind){case`set`:n.applyLayout(r.tree);break;case`reset`:{let e=a(t);e&&n.applyLayout(e.tree);break}case`chat`:n.moveSurfaceToZone(e,r.zone);break;case`open`:n.placeSurface(r.zone,r.surfaceId);break;case`close`:n.removeSurface(r.surfaceId);break;case`move`:n.moveSurfaceToZone(r.surfaceId,r.zone);break;case`size`:n.setSurfaceSize(r.surfaceId,r.size)}}export{o as applyLayout};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as e,o as t}from"./account-store-
|
|
1
|
+
import{c as e,o as t}from"./account-store-C-NiHHQY.js";import{a as n}from"./diagnostics-Cag7MsZI.js";import{t as r}from"./models-CET5SEuw.js";import{a as i}from"./compat-nGhSz-U1.js";import{n as a,t as o}from"./pi-transcript-context-4pjVPiVC.js";import{r as s,t as c}from"./transform-messages-BeurHGV0.js";function l(e,t,n,r,i){if(r===`m`)throw TypeError(`Private method is not writable`);if(r===`a`&&!i)throw TypeError(`Private accessor was defined without a setter`);if(typeof t==`function`?e!==t||!i:!t.has(e))throw TypeError(`Cannot write private member to an object whose class did not declare it`);return r===`a`?i.call(e,n):i?i.value=n:t.set(e,n),n}function u(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)}let d=function(){let{crypto:e}=globalThis;if(e?.randomUUID)return d=e.randomUUID.bind(e),e.randomUUID();let t=new Uint8Array(1),n=e?()=>e.getRandomValues(t)[0]:()=>Math.random()*255&255;return`10000000-1000-4000-8000-100000000000`.replace(/[018]/g,e=>(e^n()&15>>e/4).toString(16))};function f(e){return typeof e==`object`&&!!e&&(`name`in e&&e.name===`AbortError`||`message`in e&&String(e.message).includes(`FetchRequestCanceledException`))}const p=e=>{if(e instanceof Error)return e;if(typeof e==`object`&&e){try{if(Object.prototype.toString.call(e)===`[object Error]`){let t=Error(e.message,e.cause?{cause:e.cause}:{});return e.stack&&(t.stack=e.stack),e.cause&&!t.cause&&(t.cause=e.cause),e.name&&(t.name=e.name),t}}catch{}try{return Error(JSON.stringify(e))}catch{}}return Error(e)};var m=class extends Error{},h=class e extends m{constructor(t,n,r,i){super(`${e.makeMessage(t,n,r)}`),this.status=t,this.headers=i,this.requestID=i?.get(`x-request-id`),this.error=n;let a=n;this.code=a?.code,this.param=a?.param,this.type=a?.type}static makeMessage(e,t,n){let r=t?.message?typeof t.message==`string`?t.message:JSON.stringify(t.message):t?JSON.stringify(t):n;return e&&r?`${e} ${r}`:e?`${e} status code (no body)`:r||`(no status code or body)`}static generate(t,n,r,i){if(!t||!i)return new _({message:r,cause:p(n)});let a=n?.error;return t===400?new y(t,a,r,i):t===401?new b(t,a,r,i):t===403?new x(t,a,r,i):t===404?new ee(t,a,r,i):t===409?new te(t,a,r,i):t===422?new ne(t,a,r,i):t===429?new re(t,a,r,i):t>=500?new ie(t,a,r,i):new e(t,a,r,i)}},g=class extends h{constructor({message:e}={}){super(void 0,void 0,e||`Request was aborted.`,void 0)}},_=class extends h{constructor({message:e,cause:t}){super(void 0,void 0,e||`Connection error.`,void 0),t&&(this.cause=t)}},v=class extends _{constructor({message:e}={}){super({message:e??`Request timed out.`})}},y=class extends h{},b=class extends h{},x=class extends h{},ee=class extends h{},te=class extends h{},ne=class extends h{},re=class extends h{},ie=class extends h{},ae=class extends m{constructor(){super(`Could not parse response content as the length limit was reached`)}},oe=class extends m{constructor(){super(`Could not parse response content as the request was rejected by the content filter`)}},se=class extends Error{constructor(e){super(e)}},ce=class extends h{constructor(e,t,n){let r=`OAuth2 authentication error`,i;if(t&&typeof t==`object`){let e=t;i=e.error;let n=e.error_description;n&&typeof n==`string`?r=n:i&&(r=i)}super(e,t,r,n),this.error_code=i}},le=class extends m{constructor(e,t,n){super(e),this.provider=t,this.cause=n}};const ue=/^[a-z][a-z0-9+.-]*:/i,de=e=>ue.test(e);let S=e=>(S=Array.isArray,S(e)),fe=S;function pe(e){return typeof e==`object`?e??{}:{}}function me(e){if(!e)return!0;for(let t in e)return!1;return!0}function he(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function C(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const ge=(e,t)=>{if(typeof t!=`number`||!Number.isInteger(t))throw new m(`${e} must be an integer`);if(t<0)throw new m(`${e} must be a positive integer`);return t},_e=e=>{try{return JSON.parse(e)}catch{return}},ve=e=>new Promise(t=>setTimeout(t,e));function ye(){if(typeof fetch<`u`)return fetch;throw Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new OpenAI({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function be(...e){let t=globalThis.ReadableStream;if(t===void 0)throw Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new t(...e)}function xe(e){let t=Symbol.asyncIterator in e?e[Symbol.asyncIterator]():e[Symbol.iterator]();return be({start(){},async pull(e){let{done:n,value:r}=await t.next();n?e.close():e.enqueue(r)},async cancel(){await t.return?.()}})}function Se(e){if(e[Symbol.asyncIterator])return e;let t=e.getReader();return{async next(){try{let e=await t.read();return e?.done&&t.releaseLock(),e}catch(e){throw t.releaseLock(),e}},async return(){let e=t.cancel();return t.releaseLock(),await e,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function Ce(e){if(typeof e!=`object`||!e)return;if(e[Symbol.asyncIterator]){await e[Symbol.asyncIterator]().return?.();return}let t=e.getReader(),n=t.cancel();t.releaseLock(),await n}let we;function w(e){let t;return(we??=(t=new globalThis.TextEncoder,t.encode.bind(t)))(e)}let Te;function Ee(e){let t;return(Te??=(t=new globalThis.TextDecoder,t.decode.bind(t)))(e)}var De,T,E,D,Oe,ke,Ae;const je=65536;var Me=class{constructor(){De.add(this),T.set(this,void 0),E.set(this,void 0),D.set(this,void 0),Oe.set(this,void 0),ke.set(this,void 0),l(this,T,new Uint8Array,`f`),l(this,E,0,`f`),l(this,D,0,`f`),l(this,Oe,0,`f`),l(this,ke,!1,`f`)}decode(e){if(e==null)return[];let t;if(t=e instanceof ArrayBuffer?new Uint8Array(e):typeof e==`string`?w(e):e,t.length===0||u(this,ke,`f`)&&(l(this,ke,!1,`f`),t[0]===10&&(t=t.subarray(1)),t.length===0))return[];u(this,De,`m`,Ae).call(this,t);let n=[],r;for(;(r=Ne(u(this,T,`f`),u(this,Oe,`f`),u(this,D,`f`)))!=null;){let e=Ee(u(this,T,`f`).subarray(u(this,E,`f`),r.preceding));n.push(e),l(this,E,r.index,`f`),r.carriage&&(u(this,E,`f`)<u(this,D,`f`)&&u(this,T,`f`)[u(this,E,`f`)]===10?l(this,E,u(this,E,`f`)+1,`f`):u(this,E,`f`)===u(this,D,`f`)&&l(this,ke,!0,`f`)),l(this,Oe,u(this,E,`f`),`f`)}if(l(this,Oe,u(this,D,`f`),`f`),u(this,E,`f`)===u(this,D,`f`))l(this,E,0,`f`),l(this,D,0,`f`),l(this,Oe,0,`f`),u(this,T,`f`).length>je&&l(this,T,new Uint8Array,`f`);else if(n.length>0&&u(this,T,`f`).length>je){let e=u(this,D,`f`)-u(this,E,`f`);if(e<=je||u(this,T,`f`).length>e*4){let t=e<=je?Math.min(Math.max(e*2,256),je):e*2,n=new Uint8Array(t);n.set(u(this,T,`f`).subarray(u(this,E,`f`),u(this,D,`f`))),l(this,T,n,`f`),l(this,E,0,`f`),l(this,D,e,`f`),l(this,Oe,e,`f`)}}return n}flush(){return l(this,ke,!1,`f`),u(this,E,`f`)===u(this,D,`f`)?[]:this.decode(`
|
|
2
2
|
`)}};T=new WeakMap,E=new WeakMap,D=new WeakMap,Oe=new WeakMap,ke=new WeakMap,De=new WeakSet,Ae=function(e){if(u(this,D,`f`)+e.length>u(this,T,`f`).length){let t=u(this,D,`f`)-u(this,E,`f`);if(u(this,E,`f`)>=u(this,T,`f`).length/2&&t+e.length<=u(this,T,`f`).length)u(this,T,`f`).copyWithin(0,u(this,E,`f`),u(this,D,`f`));else{let n=Math.max(u(this,T,`f`).length*2,t+e.length,256),r=new Uint8Array(n);r.set(u(this,T,`f`).subarray(u(this,E,`f`),u(this,D,`f`))),l(this,T,r,`f`)}l(this,Oe,u(this,Oe,`f`)-u(this,E,`f`),`f`),l(this,D,t,`f`),l(this,E,0,`f`)}u(this,T,`f`).set(e,u(this,D,`f`)),l(this,D,u(this,D,`f`)+e.length,`f`)},Me.NEWLINE_CHARS=new Set([`
|
|
3
3
|
`,`\r`]),Me.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function Ne(e,t,n){for(let r=t;r<n;r++){if(e[r]===10)return{preceding:r,index:r+1,carriage:!1};if(e[r]===13)return{preceding:r,index:r+1,carriage:!0}}return null}function Pe(e){for(let t=0;t<e.length-1;t++){let n=Fe(e,t);if(n>0){let r=t+n,i=Fe(e,r);if(i>0)return r+i}}return-1}function Fe(e,t){return e[t]===10?1:e[t]===13?e[t+1]===10?2:1:0}const Ie={off:0,error:200,warn:300,info:400,debug:500},Le=(e,t,n)=>{if(e){if(he(Ie,e))return e;O(n).warn(`${t} was set to ${JSON.stringify(e)}, expected one of ${JSON.stringify(Object.keys(Ie))}`)}};function Re(){}function ze(e,t,n){return!t||Ie[e]>Ie[n]?Re:t[e].bind(t)}const Be={error:Re,warn:Re,info:Re,debug:Re};let Ve=new WeakMap;function O(e){let t=e.logger,n=e.logLevel??`off`;if(!t)return Be;let r=Ve.get(t);if(r&&r[0]===n)return r[1];let i={error:ze(`error`,t,n),warn:ze(`warn`,t,n),info:ze(`info`,t,n),debug:ze(`debug`,t,n)};return Ve.set(t,[n,i]),i}const He=e=>(e.options&&(e.options={...e.options},delete e.options.headers),e.headers&&=Object.fromEntries((e.headers instanceof Headers?[...e.headers]:Object.entries(e.headers)).map(([e,t])=>[e,e.toLowerCase()===`authorization`||e.toLowerCase()===`api-key`||e.toLowerCase()===`x-api-key`||e.toLowerCase()===`x-amz-security-token`||e.toLowerCase()===`cookie`||e.toLowerCase()===`set-cookie`?`***`:t])),`retryOfRequestLogID`in e&&(e.retryOfRequestLogID&&(e.retryOf=e.retryOfRequestLogID),delete e.retryOfRequestLogID),e);var Ue,We=class e{constructor(e,t,n){Ue.set(this,void 0),this.iterator=e,this.controller=t,l(this,Ue,n,`f`)}static fromSSEResponse(t,n,r,i){let a=!1,o=r?O(r):console;async function*s(){if(a)throw new m("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");a=!0;let e=!1,r=!1;try{for await(let e of Ge(t,n)){if(e.data.startsWith(`[DONE]`)){r=!0;break}if(e.event===null||!e.event.startsWith(`thread.`)){let n;try{n=JSON.parse(e.data)}catch(t){throw o.error(`Could not parse message into JSON:`,e.data),o.error(`From chunk:`,e.raw),t}if(n&&n.error)throw new h(void 0,n.error,void 0,t.headers);yield i?{event:e.event,data:n}:n}else{let t;try{t=JSON.parse(e.data)}catch(t){throw console.error(`Could not parse message into JSON:`,e.data),console.error(`From chunk:`,e.raw),t}if(e.event===`error`)throw new h(void 0,t.error,t.message,void 0);yield{event:e.event,data:t}}}e=!0}catch(e){if(r||f(e)||n.signal.aborted&&e===n.signal.reason)return;throw e}finally{e||n.abort()}}return new e(s,n,r)}static fromReadableStream(t,n,r){let i=!1;async function*a(){let e=new Me,r=t.getReader(),i=!1,a,o=()=>{a??=r.cancel(),a.catch(()=>void 0)};n.signal.addEventListener(`abort`,o,{once:!0});try{if(n.signal.aborted){o();return}for(;;){let{value:t,done:a}=await r.read();if(a){i=!0;break}if(n.signal.aborted)return;for(let r of e.decode(t)){if(n.signal.aborted)return;yield r}}if(n.signal.aborted)return;for(let t of e.flush()){if(n.signal.aborted)return;yield t}}finally{n.signal.removeEventListener(`abort`,o),i||o(),r.releaseLock()}}async function*o(){if(i)throw new m("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let e=!1;try{for await(let t of a())e||t&&(yield JSON.parse(t));e=!0}catch(e){if(n.signal.aborted||f(e))return;throw e}finally{e||n.abort()}}return new e(o,n,r)}[(Ue=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let t=[],n=[],r=this.iterator(),i=e=>({next:()=>{if(e.length===0){let e=r.next();t.push(e),n.push(e)}return e.shift()}});return[new e(()=>i(t),this.controller,u(this,Ue,`f`)),new e(()=>i(n),this.controller,u(this,Ue,`f`))]}toReadableStream(){let e;return be({start:async()=>{e=this[Symbol.asyncIterator]()},async pull(t){try{let{value:n,done:r}=await e.next();if(r)return t.close();let i=w(JSON.stringify(n)+`
|
|
4
4
|
`);t.enqueue(i)}catch(e){t.error(e)}},async cancel(){await e.return?.()}})}};async function*Ge(e,t){if(!e.body)throw t.abort(),globalThis.navigator!==void 0&&globalThis.navigator.product===`ReactNative`?new m(`The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api`):new m(`Attempted to iterate over a response with no body`);let n=new qe,r=new Me,i=Se(e.body);for await(let e of Ke(i))for(let t of r.decode(e)){let e=n.decode(t);e&&(yield e)}for(let e of r.flush()){let t=n.decode(e);t&&(yield t)}}async function*Ke(e){let t=new Uint8Array,n=0,r=0,i=0;for await(let a of e){if(a==null)continue;let e;if(e=a instanceof ArrayBuffer?new Uint8Array(a):typeof a==`string`?w(a):a,r+e.length>t.length){let a=r-n;if(n>=t.length/2&&a+e.length<=t.length)t.copyWithin(0,n,r);else{let i=new Uint8Array(Math.max(t.length*2,a+e.length));i.set(t.subarray(n,r)),t=i}i-=n,n=0,r=a}t.set(e,r),r+=e.length;let o;for(;(o=Pe(t.subarray(i,r)))!==-1;)o+=i,yield t.slice(n,o),n=o,i=n;i=Math.max(n,r-3)}r>n&&(yield t.slice(n,r))}var qe=class{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith(`\r`)&&(e=e.slice(0,-1)),!e){if(!this.event&&!this.data.length)return null;let e={event:this.event,data:this.data.join(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as e}from"./diagnostics-Cag7MsZI.js";import{t}from"./models-Xc0Gclrk.js";import{a as n}from"./compat-BAGLwgqY.js";import{b as r,g as i}from"./account-store-
|
|
1
|
+
import{a as e}from"./diagnostics-Cag7MsZI.js";import{t}from"./models-Xc0Gclrk.js";import{a as n}from"./compat-BAGLwgqY.js";import{b as r,g as i}from"./account-store-CtGPvHvd.js";import{r as a,t as o}from"./transform-messages-k2mfzJwY.js";import{n as s,t as c}from"./pi-transcript-context-miZCMig3.js";function l(e,t,n,r,i){if(r===`m`)throw TypeError(`Private method is not writable`);if(r===`a`&&!i)throw TypeError(`Private accessor was defined without a setter`);if(typeof t==`function`?e!==t||!i:!t.has(e))throw TypeError(`Cannot write private member to an object whose class did not declare it`);return r===`a`?i.call(e,n):i?i.value=n:t.set(e,n),n}function u(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)}var d=function(){let{crypto:e}=globalThis;if(e?.randomUUID)return d=e.randomUUID.bind(e),e.randomUUID();let t=new Uint8Array(1),n=e?()=>e.getRandomValues(t)[0]:()=>Math.random()*255&255;return`10000000-1000-4000-8000-100000000000`.replace(/[018]/g,e=>(e^n()&15>>e/4).toString(16))};function f(e){return typeof e==`object`&&!!e&&(`name`in e&&e.name===`AbortError`||`message`in e&&String(e.message).includes(`FetchRequestCanceledException`))}var p=e=>{if(e instanceof Error)return e;if(typeof e==`object`&&e){try{if(Object.prototype.toString.call(e)===`[object Error]`){let t=Error(e.message,e.cause?{cause:e.cause}:{});return e.stack&&(t.stack=e.stack),e.cause&&!t.cause&&(t.cause=e.cause),e.name&&(t.name=e.name),t}}catch{}try{return Error(JSON.stringify(e))}catch{}}return Error(e)},m=class extends Error{},h=class e extends m{constructor(t,n,r,i){super(`${e.makeMessage(t,n,r)}`),this.status=t,this.headers=i,this.requestID=i?.get(`x-request-id`),this.error=n;let a=n;this.code=a?.code,this.param=a?.param,this.type=a?.type}static makeMessage(e,t,n){let r=t?.message?typeof t.message==`string`?t.message:JSON.stringify(t.message):t?JSON.stringify(t):n;return e&&r?`${e} ${r}`:e?`${e} status code (no body)`:r||`(no status code or body)`}static generate(t,n,r,i){if(!t||!i)return new _({message:r,cause:p(n)});let a=n?.error;return t===400?new y(t,a,r,i):t===401?new b(t,a,r,i):t===403?new x(t,a,r,i):t===404?new ee(t,a,r,i):t===409?new te(t,a,r,i):t===422?new ne(t,a,r,i):t===429?new re(t,a,r,i):t>=500?new ie(t,a,r,i):new e(t,a,r,i)}},g=class extends h{constructor({message:e}={}){super(void 0,void 0,e||`Request was aborted.`,void 0)}},_=class extends h{constructor({message:e,cause:t}){super(void 0,void 0,e||`Connection error.`,void 0),t&&(this.cause=t)}},v=class extends _{constructor({message:e}={}){super({message:e??`Request timed out.`})}},y=class extends h{},b=class extends h{},x=class extends h{},ee=class extends h{},te=class extends h{},ne=class extends h{},re=class extends h{},ie=class extends h{},ae=class extends m{constructor(){super(`Could not parse response content as the length limit was reached`)}},oe=class extends m{constructor(){super(`Could not parse response content as the request was rejected by the content filter`)}},se=class extends Error{constructor(e){super(e)}},ce=class extends h{constructor(e,t,n){let r=`OAuth2 authentication error`,i;if(t&&typeof t==`object`){let e=t;i=e.error;let n=e.error_description;n&&typeof n==`string`?r=n:i&&(r=i)}super(e,t,r,n),this.error_code=i}},le=class extends m{constructor(e,t,n){super(e),this.provider=t,this.cause=n}},ue=/^[a-z][a-z0-9+.-]*:/i,de=e=>ue.test(e),S=e=>(S=Array.isArray,S(e)),fe=S;function pe(e){return typeof e==`object`?e??{}:{}}function me(e){if(!e)return!0;for(let t in e)return!1;return!0}function he(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function C(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var ge=(e,t)=>{if(typeof t!=`number`||!Number.isInteger(t))throw new m(`${e} must be an integer`);if(t<0)throw new m(`${e} must be a positive integer`);return t},_e=e=>{try{return JSON.parse(e)}catch{return}},ve=e=>new Promise(t=>setTimeout(t,e));function ye(){if(typeof fetch<`u`)return fetch;throw Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new OpenAI({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function be(...e){let t=globalThis.ReadableStream;if(t===void 0)throw Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new t(...e)}function xe(e){let t=Symbol.asyncIterator in e?e[Symbol.asyncIterator]():e[Symbol.iterator]();return be({start(){},async pull(e){let{done:n,value:r}=await t.next();n?e.close():e.enqueue(r)},async cancel(){await t.return?.()}})}function Se(e){if(e[Symbol.asyncIterator])return e;let t=e.getReader();return{async next(){try{let e=await t.read();return e?.done&&t.releaseLock(),e}catch(e){throw t.releaseLock(),e}},async return(){let e=t.cancel();return t.releaseLock(),await e,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function Ce(e){if(typeof e!=`object`||!e)return;if(e[Symbol.asyncIterator]){await e[Symbol.asyncIterator]().return?.();return}let t=e.getReader(),n=t.cancel();t.releaseLock(),await n}var we;function w(e){let t;return(we??=(t=new globalThis.TextEncoder,t.encode.bind(t)))(e)}var Te;function Ee(e){let t;return(Te??=(t=new globalThis.TextDecoder,t.decode.bind(t)))(e)}var De,T,E,D,O,Oe,ke,Ae=65536,je=class{constructor(){De.add(this),T.set(this,void 0),E.set(this,void 0),D.set(this,void 0),O.set(this,void 0),Oe.set(this,void 0),l(this,T,new Uint8Array,`f`),l(this,E,0,`f`),l(this,D,0,`f`),l(this,O,0,`f`),l(this,Oe,!1,`f`)}decode(e){if(e==null)return[];let t;if(t=e instanceof ArrayBuffer?new Uint8Array(e):typeof e==`string`?w(e):e,t.length===0||u(this,Oe,`f`)&&(l(this,Oe,!1,`f`),t[0]===10&&(t=t.subarray(1)),t.length===0))return[];u(this,De,`m`,ke).call(this,t);let n=[],r;for(;(r=Me(u(this,T,`f`),u(this,O,`f`),u(this,D,`f`)))!=null;){let e=Ee(u(this,T,`f`).subarray(u(this,E,`f`),r.preceding));n.push(e),l(this,E,r.index,`f`),r.carriage&&(u(this,E,`f`)<u(this,D,`f`)&&u(this,T,`f`)[u(this,E,`f`)]===10?l(this,E,u(this,E,`f`)+1,`f`):u(this,E,`f`)===u(this,D,`f`)&&l(this,Oe,!0,`f`)),l(this,O,u(this,E,`f`),`f`)}if(l(this,O,u(this,D,`f`),`f`),u(this,E,`f`)===u(this,D,`f`))l(this,E,0,`f`),l(this,D,0,`f`),l(this,O,0,`f`),u(this,T,`f`).length>Ae&&l(this,T,new Uint8Array,`f`);else if(n.length>0&&u(this,T,`f`).length>Ae){let e=u(this,D,`f`)-u(this,E,`f`);if(e<=Ae||u(this,T,`f`).length>e*4){let t=e<=Ae?Math.min(Math.max(e*2,256),Ae):e*2,n=new Uint8Array(t);n.set(u(this,T,`f`).subarray(u(this,E,`f`),u(this,D,`f`))),l(this,T,n,`f`),l(this,E,0,`f`),l(this,D,e,`f`),l(this,O,e,`f`)}}return n}flush(){return l(this,Oe,!1,`f`),u(this,E,`f`)===u(this,D,`f`)?[]:this.decode(`
|
|
2
2
|
`)}};T=new WeakMap,E=new WeakMap,D=new WeakMap,O=new WeakMap,Oe=new WeakMap,De=new WeakSet,ke=function(e){if(u(this,D,`f`)+e.length>u(this,T,`f`).length){let t=u(this,D,`f`)-u(this,E,`f`);if(u(this,E,`f`)>=u(this,T,`f`).length/2&&t+e.length<=u(this,T,`f`).length)u(this,T,`f`).copyWithin(0,u(this,E,`f`),u(this,D,`f`));else{let n=Math.max(u(this,T,`f`).length*2,t+e.length,256),r=new Uint8Array(n);r.set(u(this,T,`f`).subarray(u(this,E,`f`),u(this,D,`f`))),l(this,T,r,`f`)}l(this,O,u(this,O,`f`)-u(this,E,`f`),`f`),l(this,D,t,`f`),l(this,E,0,`f`)}u(this,T,`f`).set(e,u(this,D,`f`)),l(this,D,u(this,D,`f`)+e.length,`f`)},je.NEWLINE_CHARS=new Set([`
|
|
3
3
|
`,`\r`]),je.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function Me(e,t,n){for(let r=t;r<n;r++){if(e[r]===10)return{preceding:r,index:r+1,carriage:!1};if(e[r]===13)return{preceding:r,index:r+1,carriage:!0}}return null}function Ne(e){for(let t=0;t<e.length-1;t++){let n=Pe(e,t);if(n>0){let r=t+n,i=Pe(e,r);if(i>0)return r+i}}return-1}function Pe(e,t){return e[t]===10?1:e[t]===13?e[t+1]===10?2:1:0}var Fe={off:0,error:200,warn:300,info:400,debug:500},Ie=(e,t,n)=>{if(e){if(he(Fe,e))return e;k(n).warn(`${t} was set to ${JSON.stringify(e)}, expected one of ${JSON.stringify(Object.keys(Fe))}`)}};function Le(){}function Re(e,t,n){return!t||Fe[e]>Fe[n]?Le:t[e].bind(t)}var ze={error:Le,warn:Le,info:Le,debug:Le},Be=new WeakMap;function k(e){let t=e.logger,n=e.logLevel??`off`;if(!t)return ze;let r=Be.get(t);if(r&&r[0]===n)return r[1];let i={error:Re(`error`,t,n),warn:Re(`warn`,t,n),info:Re(`info`,t,n),debug:Re(`debug`,t,n)};return Be.set(t,[n,i]),i}var Ve=e=>(e.options&&(e.options={...e.options},delete e.options.headers),e.headers&&=Object.fromEntries((e.headers instanceof Headers?[...e.headers]:Object.entries(e.headers)).map(([e,t])=>[e,e.toLowerCase()===`authorization`||e.toLowerCase()===`api-key`||e.toLowerCase()===`x-api-key`||e.toLowerCase()===`x-amz-security-token`||e.toLowerCase()===`cookie`||e.toLowerCase()===`set-cookie`?`***`:t])),`retryOfRequestLogID`in e&&(e.retryOfRequestLogID&&(e.retryOf=e.retryOfRequestLogID),delete e.retryOfRequestLogID),e),He,Ue=class e{constructor(e,t,n){He.set(this,void 0),this.iterator=e,this.controller=t,l(this,He,n,`f`)}static fromSSEResponse(t,n,r,i){let a=!1,o=r?k(r):console;async function*s(){if(a)throw new m("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");a=!0;let e=!1,r=!1;try{for await(let e of We(t,n)){if(e.data.startsWith(`[DONE]`)){r=!0;break}if(e.event===null||!e.event.startsWith(`thread.`)){let n;try{n=JSON.parse(e.data)}catch(t){throw o.error(`Could not parse message into JSON:`,e.data),o.error(`From chunk:`,e.raw),t}if(n&&n.error)throw new h(void 0,n.error,void 0,t.headers);yield i?{event:e.event,data:n}:n}else{let t;try{t=JSON.parse(e.data)}catch(t){throw console.error(`Could not parse message into JSON:`,e.data),console.error(`From chunk:`,e.raw),t}if(e.event===`error`)throw new h(void 0,t.error,t.message,void 0);yield{event:e.event,data:t}}}e=!0}catch(e){if(r||f(e)||n.signal.aborted&&e===n.signal.reason)return;throw e}finally{e||n.abort()}}return new e(s,n,r)}static fromReadableStream(t,n,r){let i=!1;async function*a(){let e=new je,r=t.getReader(),i=!1,a,o=()=>{a??=r.cancel(),a.catch(()=>void 0)};n.signal.addEventListener(`abort`,o,{once:!0});try{if(n.signal.aborted){o();return}for(;;){let{value:t,done:a}=await r.read();if(a){i=!0;break}if(n.signal.aborted)return;for(let r of e.decode(t)){if(n.signal.aborted)return;yield r}}if(n.signal.aborted)return;for(let t of e.flush()){if(n.signal.aborted)return;yield t}}finally{n.signal.removeEventListener(`abort`,o),i||o(),r.releaseLock()}}async function*o(){if(i)throw new m("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let e=!1;try{for await(let t of a())e||t&&(yield JSON.parse(t));e=!0}catch(e){if(n.signal.aborted||f(e))return;throw e}finally{e||n.abort()}}return new e(o,n,r)}[(He=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let t=[],n=[],r=this.iterator(),i=e=>({next:()=>{if(e.length===0){let e=r.next();t.push(e),n.push(e)}return e.shift()}});return[new e(()=>i(t),this.controller,u(this,He,`f`)),new e(()=>i(n),this.controller,u(this,He,`f`))]}toReadableStream(){let e;return be({start:async()=>{e=this[Symbol.asyncIterator]()},async pull(t){try{let{value:n,done:r}=await e.next();if(r)return t.close();let i=w(JSON.stringify(n)+`
|
|
4
4
|
`);t.enqueue(i)}catch(e){t.error(e)}},async cancel(){await e.return?.()}})}};async function*We(e,t){if(!e.body)throw t.abort(),globalThis.navigator!==void 0&&globalThis.navigator.product===`ReactNative`?new m(`The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api`):new m(`Attempted to iterate over a response with no body`);let n=new qe,r=new je,i=Se(e.body);for await(let e of Ke(i))for(let t of r.decode(e)){let e=n.decode(t);e&&(yield e)}for(let e of r.flush()){let t=n.decode(e);t&&(yield t)}}var Ge=3;async function*Ke(e){let t=new Uint8Array,n=0,r=0,i=0;for await(let a of e){if(a==null)continue;let e;if(e=a instanceof ArrayBuffer?new Uint8Array(a):typeof a==`string`?w(a):a,r+e.length>t.length){let a=r-n;if(n>=t.length/2&&a+e.length<=t.length)t.copyWithin(0,n,r);else{let i=new Uint8Array(Math.max(t.length*2,a+e.length));i.set(t.subarray(n,r)),t=i}i-=n,n=0,r=a}t.set(e,r),r+=e.length;let o;for(;(o=Ne(t.subarray(i,r)))!==-1;)o+=i,yield t.slice(n,o),n=o,i=n;i=Math.max(n,r-Ge)}r>n&&(yield t.slice(n,r))}var qe=class{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith(`\r`)&&(e=e.slice(0,-1)),!e){if(!this.event&&!this.data.length)return null;let e={event:this.event,data:this.data.join(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{t as e}from"./logger-DDBAeTLF.js";import"./navigation-watcher-CPcnZL9l.js";import"./wc-follower-oauth-Dm8dPxfI.js";import{d as t,l as n,u as r}from"./main-DJ1JbcDS.js";import{n as i,t as a}from"./pending-request-table-k-D7ZZsL.js";var o=e(`cdp`);function s(e){return e===4001?`CDP connection superseded by another SLICC tab/window on this instance`:e===4002?`CDP connection reset by proxy (upstream Chrome connection was re-established)`:`CDP connection closed`}var c=class{ws=null;nextId=1;_superseded=!1;pending=new a;listeners=new Map;_state=`disconnected`;stateListeners=new Set;lastNotifiedState=`disconnected`;lastNotifiedReason;get state(){return this._state}onStateChange(e){return this.stateListeners.add(e),()=>{this.stateListeners.delete(e)}}get superseded(){return this._superseded}async connect(e){if(this._state!==`disconnected`)throw Error(`Cannot connect: state is ${this._state}`);if(!e?.url)throw Error(`CDPClient.connect() requires a WebSocket URL`);let{url:t,timeout:n=5e3,protocols:r}=e;return this._state=`connecting`,new Promise((e,i)=>{let a=setTimeout(()=>{this.cleanup(),i(Error(`CDP connection timed out after ${n}ms`))},n);try{this.ws=r===void 0?new WebSocket(t):new WebSocket(t,r)}catch(e){clearTimeout(a),this._state=`disconnected`,i(e);return}this.ws.onopen=()=>{clearTimeout(a),this._state=`connected`,this._superseded=!1,o.info(`Connected`,{url:t}),this.notifyState(`connected`),e()},this.ws.onerror=e=>{clearTimeout(a),this._state===`connecting`&&(o.error(`Connection failed`,{url:t}),this.cleanup(),i(Error(`CDP WebSocket connection failed`)))},this.ws.onmessage=e=>{this.handleMessage(e.data)},this.ws.onclose=e=>{this.handleClose(e?.code)}})}disconnect(){this.ws&&(this.ws.onclose=null,this.ws.close()),this._superseded=!1,this.cleanup(),o.info(`Disconnected`)}async send(e,t,n,r=3e4){if(this._state!==`connected`||!this.ws)throw Error(`CDP client is not connected`);let i=this.nextId++,a={id:i,method:e};t&&(a.params=t),n&&(a.sessionId=n),o.debug(`Send`,{method:e,id:i,sessionId:n});let s=this.pending.issue(i,r,`CDP command timed out after ${r}ms: ${e}`);return this.ws.send(JSON.stringify(a)),s}on(e,t){let n=this.listeners.get(e);n||(n=new Set,this.listeners.set(e,n)),n.add(t)}off(e,t){let n=this.listeners.get(e);n&&(n.delete(t),n.size===0&&this.listeners.delete(e))}once(e,t=3e4){return i(t=>(this.on(e,t),()=>this.off(e,t)),t,`Timed out waiting for event: ${e}`)}handleMessage(e){let t;try{t=JSON.parse(e)}catch{return}if(`id`in t&&typeof t.id==`number`){let e=t;o.debug(`Response`,{id:e.id,hasError:!!e.error}),e.error?(o.error(`Command error`,{id:e.id,code:e.error.code,message:e.error.message}),this.pending.reject(e.id,Error(`CDP error: ${e.error.message} (${e.error.code})`))):this.pending.resolve(e.id,e.result??{});return}if(`method`in t){let e=t;o.debug(`Event`,{method:e.method,sessionId:e.sessionId});let n=this.listeners.get(e.method);if(n){let t=e.sessionId?{...e.params,sessionId:e.sessionId}:e.params??{};for(let e of n)try{e(t)}catch{}}}}handleClose(e){e===4001?(this._superseded=!0,o.warn(`CDP slot superseded by another SLICC tab/window on this instance`,{code:e})):e===4002?o.warn(`CDP proxy reset its upstream Chrome connection — sessions dropped`,{code:e,pendingCommands:this.pending.size}):o.error(`Connection closed unexpectedly`,{pendingCommands:this.pending.size}),this.cleanup(s(e))}cleanup(e=`CDP client disconnected`){this.ws=null,this._state=`disconnected`,this.pending.rejectAll(e),this.notifyState(`disconnected`,e)}notifyState(e,t){if(e!==this.lastNotifiedState||t!==this.lastNotifiedReason){this.lastNotifiedState=e,this.lastNotifiedReason=t;for(let n of this.stateListeners)try{n(e,t)}catch{}}}},l=`ws://localhost:5710/cdp`;function u(e=typeof window<`u`?window.location:null){return e?.host?`${e.protocol===`https:`?`wss:`:`ws:`}//${e.host}/cdp`:l}var d=class{lastConnectOptions=null;supersededHandler=null;supersededNotified=!1;reconnectAttempt=0;reconnectNotBefore=0;bridgeRejection=null;bridgeRejectedHandler=null;bridgeRejectedNotified=!1;classifyConnectFailure=async()=>`transient`;primeConnectOptions(e){this.lastConnectOptions=e?{...e}:{}}setSupersededHandler(e){this.supersededHandler=e}setBridgeRejectedHandler(e){this.bridgeRejectedHandler=e}setConnectFailureClassifier(e){this.classifyConnectFailure=e}async connect(e,t){if(this.bridgeRejection)throw this.notifyBridgeRejected(),new n(this.bridgeRejection);this.lastConnectOptions=t?{...t}:{};try{await e.connect({url:t?.url??u(),timeout:t?.timeout,...t?.protocols===void 0?{}:{protocols:t.protocols}})}catch(e){throw await this.noteReconnectFailure(t),this.bridgeRejection?new n(this.bridgeRejection):e}this.noteReconnectSuccess()}async ensureLocalConnected(e){if(e.superseded===!0){this.notifySuperseded();return}if(e.state===`disconnected`){this.throwIfReconnectPaused();let t=this.lastConnectOptions;try{await e.connect({url:t?.url??u(),...t?.timeout===void 0?{}:{timeout:t.timeout},...t?.protocols===void 0?{}:{protocols:t.protocols}})}catch(e){throw await this.noteReconnectFailure(t??void 0),this.bridgeRejection?new n(this.bridgeRejection):e}this.noteReconnectSuccess()}}async ensureConnected(e){if(e.client.superseded===!0){this.notifySuperseded();return}if(e.client.state===`disconnected`){this.throwIfReconnectPaused();let t=e.client;e.restoreLocalAfterRemoteDrop(),e.clearSessionsForTransport(t),e.getClient().state===`disconnected`&&await this.connect(e.getClient(),this.lastConnectOptions??void 0)}}throwIfReconnectPaused(){if(this.bridgeRejection)throw this.notifyBridgeRejected(),new n(this.bridgeRejection);if(Date.now()<this.reconnectNotBefore)throw new r}noteReconnectSuccess(){this.reconnectAttempt=0,this.reconnectNotBefore=0,this.supersededNotified=!1}async noteReconnectFailure(e){if(await this.classifyConnectFailure({url:e?.url??``,...e?.protocols===void 0?{}:{protocols:e.protocols}})===`terminal`){this.bridgeRejection=new n().message,this.notifyBridgeRejected();return}let r=t(this.reconnectAttempt);this.reconnectAttempt+=1,this.reconnectNotBefore=Date.now()+r}notifyBridgeRejected(){if(!this.bridgeRejectedNotified){this.bridgeRejectedNotified=!0;try{this.bridgeRejectedHandler?.()}catch{}}}notifySuperseded(){if(!this.supersededNotified){this.supersededNotified=!0;try{this.supersededHandler?.()}catch{}}}},f=class extends Error{step;name=`CommandAbortedError`;constructor(e){super(`Browser command aborted while ${e}. A CDP round trip already in flight cannot be cancelled, so it may still have been applied to the page; nothing after it was started.`),this.step=e}};function p(e,t){if(e?.aborted)throw new f(t)}function m(e,t){return e?{signal:e,error:()=>new f(t)}:void 0}function h(e,t,n){return new Promise((r,i)=>{if(t?.aborted){i(new f(n));return}let a=()=>{clearTimeout(o),i(new f(n))},o=setTimeout(()=>{t?.removeEventListener(`abort`,a),r()},e);t?.addEventListener(`abort`,a,{once:!0})})}function ee(e,t,n){return t?t.aborted?Promise.reject(new f(n)):new Promise((r,i)=>{let a=()=>i(new f(n));t.addEventListener(`abort`,a,{once:!0}),e.then(()=>{t.removeEventListener(`abort`,a),r()},e=>{t.removeEventListener(`abort`,a),i(e instanceof Error?e:Error(String(e)))})}):e}var g=class{contexts=new Map;for(e,t){let n=`${t}:${e}`,r=this.contexts.get(n);return r||(r=new Map,this.contexts.set(n,r)),r}peek(e,t){return this.contexts.get(`${t}:${e}`)}drop(e){this.contexts.delete(`main:${e}`),this.contexts.delete(`isolated:${e}`)}get size(){return this.contexts.size}},_=e(`har-recorder`),v=class{recordings=new Map;client;fs;eventCleanup=new Map;constructor(e,t){this.client=e,this.fs=t}async startRecording(e,t,n,r){let i=`rec-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;p(r,`about to enable Network on tab ${e}`),await this.client.send(`Network.enable`,{},t),p(r,`about to enable Page on tab ${e}`),await this.client.send(`Page.enable`,{},t),p(r,`about to read the URL of tab ${e}`);let a=(await this.client.send(`Runtime.evaluate`,{expression:`location.href`,returnByValue:!0},t)).result?.value??`about:blank`,o={id:i,targetId:e,sessionId:t,filterCode:n,pendingRequests:new Map,entries:[],startTime:Date.now(),currentUrl:a,snapshotCount:0};return this.recordings.set(i,o),this.setupEventListeners(o),await this.ensureDir(`/recordings/${i}`),_.debug(`Started recording`,{recordingId:i,targetId:e,currentUrl:a}),i}setupEventListeners(e){let{sessionId:t,id:n}=e,r=n=>{let r=n;r.sessionId===t&&this.handleRequestWillBeSent(e,r)},i=n=>{let r=n;r.sessionId===t&&this.handleResponseReceived(e,r)},a=r=>{let i=r;i.sessionId===t&&this.handleLoadingFinished(e,i).catch(e=>{_.error(`Failed to process loadingFinished event`,{recordingId:n,requestId:i.requestId,error:e instanceof Error?e.message:String(e)})})},o=n=>{let r=n;r.sessionId===t&&this.handleLoadingFailed(e,r)},s=r=>{let i=r;if(i.sessionId!==t)return;let a=i.frame;if(!a?.parentId&&a?.url){let t=[...e.entries],r=e.currentUrl;e.currentUrl=a.url,e.entries=[],e.pendingRequests.clear(),this.saveSnapshotWithEntries(e,`navigation`,t,r).catch(e=>{_.error(`Failed to save navigation snapshot`,{recordingId:n,error:e instanceof Error?e.message:String(e)})})}};this.client.on(`Network.requestWillBeSent`,r),this.client.on(`Network.responseReceived`,i),this.client.on(`Network.loadingFinished`,a),this.client.on(`Network.loadingFailed`,o),this.client.on(`Page.frameNavigated`,s),this.eventCleanup.set(n,()=>{this.client.off(`Network.requestWillBeSent`,r),this.client.off(`Network.responseReceived`,i),this.client.off(`Network.loadingFinished`,a),this.client.off(`Network.loadingFailed`,o),this.client.off(`Page.frameNavigated`,s)})}handleRequestWillBeSent(e,t){let{requestId:n,request:r,timestamp:i}=t;!n||!r||i==null||e.pendingRequests.set(n,{requestId:n,startTime:i*1e3,request:{method:r.method,url:r.url,headers:r.headers,postData:r.postData}})}handleResponseReceived(e,t){let{requestId:n,response:r}=t;if(!n||!r)return;let i=e.pendingRequests.get(n);i&&(i.response={status:r.status,statusText:r.statusText,headers:r.headers,mimeType:r.mimeType},i.timing=r.timing)}async handleLoadingFinished(e,t){let{requestId:n,timestamp:r}=t;if(!n||r==null)return;let i=e.pendingRequests.get(n);if(!i)return;i.endTime=r*1e3;try{let t=await this.client.send(`Network.getResponseBody`,{requestId:n},e.sessionId);i.responseBody=t.body,i.responseBodyBase64=t.base64Encoded===!0}catch{}let a=this.buildHarEntry(i);a&&e.entries.push(a),e.pendingRequests.delete(n)}handleLoadingFailed(e,t){let{requestId:n}=t;n&&e.pendingRequests.delete(n)}buildHarEntry(e){if(!e.response)return null;let{request:t,response:n,timing:r,startTime:i,endTime:a,responseBody:o,responseBodyBase64:s}=e,c=a?a-i:0,l=[];try{let e=new URL(t.url);l=Array.from(e.searchParams.entries()).map(([e,t])=>({name:e,value:t}))}catch{}let u=r?(()=>{let e=(e,t)=>{if(e==null||t==null||e<0||t<0)return-1;let n=t-e;return n>=0?n:-1},t=r.dnsStart>=0?r.dnsStart:r.connectStart>=0?r.connectStart:0;return{blocked:t>0?t:-1,dns:e(r.dnsStart,r.dnsEnd),connect:e(r.connectStart,r.connectEnd),ssl:e(r.sslStart,r.sslEnd),send:e(r.sendStart,r.sendEnd),wait:e(r.sendEnd,r.receiveHeadersStart),receive:e(r.receiveHeadersStart,r.receiveHeadersEnd)}})():{blocked:-1,dns:-1,connect:-1,ssl:-1,send:0,wait:c,receive:0},d={size:o?.length??0,mimeType:n.mimeType??`application/octet-stream`};o&&(d.text=o,s&&(d.encoding=`base64`));let f;return t.postData&&(f={mimeType:t.headers[`content-type`]??t.headers[`Content-Type`]??`text/plain`,text:t.postData}),{startedDateTime:new Date(i).toISOString(),time:c,request:{method:t.method,url:t.url,httpVersion:`HTTP/1.1`,cookies:[],headers:Object.entries(t.headers).map(([e,t])=>({name:e,value:t})),queryString:l,postData:f,headersSize:-1,bodySize:t.postData?.length??0},response:{status:n.status,statusText:n.statusText,httpVersion:`HTTP/1.1`,cookies:[],headers:Object.entries(n.headers).map(([e,t])=>({name:e,value:t})),content:d,redirectURL:n.headers.location??n.headers.Location??``,headersSize:-1,bodySize:d.size},cache:{},timings:u}}async saveSnapshot(e,t){return this.saveSnapshotWithEntries(e,t,e.entries,e.currentUrl)}async applyFilter(e,t){return y(e,t)}async saveSnapshotWithEntries(e,t,n,r){if(n.length===0)return _.debug(`No entries to save`,{recordingId:e.id,trigger:t}),null;let i=e.filterCode?await this.applyFilter(n,e.filterCode):n;if(i.length===0)return _.debug(`All entries filtered out`,{recordingId:e.id,trigger:t}),null;e.snapshotCount++;let a=new Date().toISOString().replace(/[:.]/g,`-`),o=this.urlToSlug(r),s=`${e.snapshotCount.toString().padStart(3,`0`)}-${a}-${t}-${o}.har`,c=`/recordings/${e.id}/${s}`,l={log:{version:`1.2`,creator:{name:`SLICC HAR Recorder`,version:`1.0.0`},entries:i}};return await this.fs.writeFile(c,JSON.stringify(l,null,2)),_.debug(`Saved HAR snapshot`,{recordingId:e.id,path:c,entryCount:i.length}),c}urlToSlug(e){try{let t=new URL(e);return`${t.hostname}${t.pathname}`.replace(/[^a-zA-Z0-9]/g,`-`).replace(/-+/g,`-`).replace(/^-|-$/g,``).slice(0,50)||`page`}catch{return`page`}}async stopRecording(e){let t=this.recordings.get(e);if(!t)throw Error(`Recording not found: ${e}`);await this.saveSnapshot(t,`close`);let n=this.eventCleanup.get(e);n&&(n(),this.eventCleanup.delete(e));try{await this.client.send(`Network.disable`,{},t.sessionId)}catch{}this.recordings.delete(e);let r=`/recordings/${e}`;return _.debug(`Stopped recording`,{recordingId:e,snapshotCount:t.snapshotCount}),r}getRecording(e){return this.recordings.get(e)}getRecordingByTarget(e){for(let[t,n]of this.recordings)if(n.targetId===e)return t}async ensureDir(e){await this.fs.mkdir(e,{recursive:!0})}};function y(e,t){try{let n=Function(`entry`,`return (${t})(entry);`),r=[];for(let t of e)try{let e=n(t);if(e===!1)continue;typeof e==`object`&&e?r.push(e):r.push(t)}catch(e){_.error(`Filter function error on entry, keeping it`,{error:e instanceof Error?e.message:String(e)}),r.push(t)}return r}catch(t){return _.error(`Failed to compile filter, returning unfiltered`,{error:t instanceof Error?t.message:String(t)}),e}}var b=class{maxSessions;onEvict;sessions=new Map;pinnedTargets=new Map;appliedSends=new Map;constructor(e=32,t){this.maxSessions=e,this.onEvict=t}get size(){return this.sessions.size}get(e){return this.sessions.get(e)}has(e){return this.sessions.has(e)}values(){return this.sessions.values()}entries(){return this.sessions.entries()}snapshot(){return[...this.sessions]}remember(e,t){this.pruneAppliedSends(),this.sessions.set(e,t),this.enforceCap(e)}touch(e,t){this.sessions.delete(e),this.sessions.set(e,t)}take(e){let t=this.sessions.get(e);return t&&this.sessions.delete(e),t}delete(e){this.sessions.delete(e)}clear(){this.sessions.clear()}pin(e){this.pinnedTargets.set(e,(this.pinnedTargets.get(e)??0)+1);let t=!1;return()=>{if(t)return;t=!0;let n=(this.pinnedTargets.get(e)??1)-1;n>0?this.pinnedTargets.set(e,n):this.pinnedTargets.delete(e),this.enforceCap()}}isPinned(e){return this.pinnedTargets.has(e)}enforceCap(e){for(;this.sessions.size>this.maxSessions;){let t;for(let n of this.sessions.keys())if(!(n===e||this.pinnedTargets.has(n))){t=n;break}if(t===void 0)return;let n=this.sessions.get(t);this.sessions.delete(t),n&&this.onEvict?.(t,n)}}noteApplied(e){this.appliedSends.set(e,(this.appliedSends.get(e)??0)+1)}appliedCount(e){return this.appliedSends.get(e)??0}pruneAppliedSends(){if(this.appliedSends.size<=this.maxSessions*4)return;let e=new Set([...this.sessions.values()].map(e=>e.sessionId));for(let t of[...this.appliedSends.keys()])e.has(t)||this.appliedSends.delete(t)}findBySessionId(e){for(let[t,n]of this.sessions)if(n.sessionId===e)return[t,n]}findByTargetOrLocalId(e){let t=[];for(let[n,r]of this.sessions)(n===e||r.remote?.localTargetId===e)&&t.push([n,r]);return t}anyOnTransport(e){for(let t of this.sessions.values())if(t.transport===e)return!0;return!1}anyMatchingRemote(e,t){for(let n of this.sessions.values())if(n.remote?.runtimeId===e&&n.remote.localTargetId===t)return!0;return!1}},x=`slicc.ariaRefs`,S=[`textbox`,`button`,`link`,`checkbox`,`radio`,`iframe`];function C(e=0){return`(${w})(${Number.isSafeInteger(e)&&e>0?e:0})`}function te(e){return`(function(ref) {
|
|
1
|
+
import{t as e}from"./logger-DDBAeTLF.js";import"./navigation-watcher-CPcnZL9l.js";import"./wc-follower-oauth-B260JoLu.js";import{d as t,l as n,u as r}from"./main-6hbXaflT.js";import{n as i,t as a}from"./pending-request-table-k-D7ZZsL.js";var o=e(`cdp`);function s(e){return e===4001?`CDP connection superseded by another SLICC tab/window on this instance`:e===4002?`CDP connection reset by proxy (upstream Chrome connection was re-established)`:`CDP connection closed`}var c=class{ws=null;nextId=1;_superseded=!1;pending=new a;listeners=new Map;_state=`disconnected`;stateListeners=new Set;lastNotifiedState=`disconnected`;lastNotifiedReason;get state(){return this._state}onStateChange(e){return this.stateListeners.add(e),()=>{this.stateListeners.delete(e)}}get superseded(){return this._superseded}async connect(e){if(this._state!==`disconnected`)throw Error(`Cannot connect: state is ${this._state}`);if(!e?.url)throw Error(`CDPClient.connect() requires a WebSocket URL`);let{url:t,timeout:n=5e3,protocols:r}=e;return this._state=`connecting`,new Promise((e,i)=>{let a=setTimeout(()=>{this.cleanup(),i(Error(`CDP connection timed out after ${n}ms`))},n);try{this.ws=r===void 0?new WebSocket(t):new WebSocket(t,r)}catch(e){clearTimeout(a),this._state=`disconnected`,i(e);return}this.ws.onopen=()=>{clearTimeout(a),this._state=`connected`,this._superseded=!1,o.info(`Connected`,{url:t}),this.notifyState(`connected`),e()},this.ws.onerror=e=>{clearTimeout(a),this._state===`connecting`&&(o.error(`Connection failed`,{url:t}),this.cleanup(),i(Error(`CDP WebSocket connection failed`)))},this.ws.onmessage=e=>{this.handleMessage(e.data)},this.ws.onclose=e=>{this.handleClose(e?.code)}})}disconnect(){this.ws&&(this.ws.onclose=null,this.ws.close()),this._superseded=!1,this.cleanup(),o.info(`Disconnected`)}async send(e,t,n,r=3e4){if(this._state!==`connected`||!this.ws)throw Error(`CDP client is not connected`);let i=this.nextId++,a={id:i,method:e};t&&(a.params=t),n&&(a.sessionId=n),o.debug(`Send`,{method:e,id:i,sessionId:n});let s=this.pending.issue(i,r,`CDP command timed out after ${r}ms: ${e}`);return this.ws.send(JSON.stringify(a)),s}on(e,t){let n=this.listeners.get(e);n||(n=new Set,this.listeners.set(e,n)),n.add(t)}off(e,t){let n=this.listeners.get(e);n&&(n.delete(t),n.size===0&&this.listeners.delete(e))}once(e,t=3e4){return i(t=>(this.on(e,t),()=>this.off(e,t)),t,`Timed out waiting for event: ${e}`)}handleMessage(e){let t;try{t=JSON.parse(e)}catch{return}if(`id`in t&&typeof t.id==`number`){let e=t;o.debug(`Response`,{id:e.id,hasError:!!e.error}),e.error?(o.error(`Command error`,{id:e.id,code:e.error.code,message:e.error.message}),this.pending.reject(e.id,Error(`CDP error: ${e.error.message} (${e.error.code})`))):this.pending.resolve(e.id,e.result??{});return}if(`method`in t){let e=t;o.debug(`Event`,{method:e.method,sessionId:e.sessionId});let n=this.listeners.get(e.method);if(n){let t=e.sessionId?{...e.params,sessionId:e.sessionId}:e.params??{};for(let e of n)try{e(t)}catch{}}}}handleClose(e){e===4001?(this._superseded=!0,o.warn(`CDP slot superseded by another SLICC tab/window on this instance`,{code:e})):e===4002?o.warn(`CDP proxy reset its upstream Chrome connection — sessions dropped`,{code:e,pendingCommands:this.pending.size}):o.error(`Connection closed unexpectedly`,{pendingCommands:this.pending.size}),this.cleanup(s(e))}cleanup(e=`CDP client disconnected`){this.ws=null,this._state=`disconnected`,this.pending.rejectAll(e),this.notifyState(`disconnected`,e)}notifyState(e,t){if(e!==this.lastNotifiedState||t!==this.lastNotifiedReason){this.lastNotifiedState=e,this.lastNotifiedReason=t;for(let n of this.stateListeners)try{n(e,t)}catch{}}}},l=`ws://localhost:5710/cdp`;function u(e=typeof window<`u`?window.location:null){return e?.host?`${e.protocol===`https:`?`wss:`:`ws:`}//${e.host}/cdp`:l}var d=class{lastConnectOptions=null;supersededHandler=null;supersededNotified=!1;reconnectAttempt=0;reconnectNotBefore=0;bridgeRejection=null;bridgeRejectedHandler=null;bridgeRejectedNotified=!1;classifyConnectFailure=async()=>`transient`;primeConnectOptions(e){this.lastConnectOptions=e?{...e}:{}}setSupersededHandler(e){this.supersededHandler=e}setBridgeRejectedHandler(e){this.bridgeRejectedHandler=e}setConnectFailureClassifier(e){this.classifyConnectFailure=e}async connect(e,t){if(this.bridgeRejection)throw this.notifyBridgeRejected(),new n(this.bridgeRejection);this.lastConnectOptions=t?{...t}:{};try{await e.connect({url:t?.url??u(),timeout:t?.timeout,...t?.protocols===void 0?{}:{protocols:t.protocols}})}catch(e){throw await this.noteReconnectFailure(t),this.bridgeRejection?new n(this.bridgeRejection):e}this.noteReconnectSuccess()}async ensureLocalConnected(e){if(e.superseded===!0){this.notifySuperseded();return}if(e.state===`disconnected`){this.throwIfReconnectPaused();let t=this.lastConnectOptions;try{await e.connect({url:t?.url??u(),...t?.timeout===void 0?{}:{timeout:t.timeout},...t?.protocols===void 0?{}:{protocols:t.protocols}})}catch(e){throw await this.noteReconnectFailure(t??void 0),this.bridgeRejection?new n(this.bridgeRejection):e}this.noteReconnectSuccess()}}async ensureConnected(e){if(e.client.superseded===!0){this.notifySuperseded();return}if(e.client.state===`disconnected`){this.throwIfReconnectPaused();let t=e.client;e.restoreLocalAfterRemoteDrop(),e.clearSessionsForTransport(t),e.getClient().state===`disconnected`&&await this.connect(e.getClient(),this.lastConnectOptions??void 0)}}throwIfReconnectPaused(){if(this.bridgeRejection)throw this.notifyBridgeRejected(),new n(this.bridgeRejection);if(Date.now()<this.reconnectNotBefore)throw new r}noteReconnectSuccess(){this.reconnectAttempt=0,this.reconnectNotBefore=0,this.supersededNotified=!1}async noteReconnectFailure(e){if(await this.classifyConnectFailure({url:e?.url??``,...e?.protocols===void 0?{}:{protocols:e.protocols}})===`terminal`){this.bridgeRejection=new n().message,this.notifyBridgeRejected();return}let r=t(this.reconnectAttempt);this.reconnectAttempt+=1,this.reconnectNotBefore=Date.now()+r}notifyBridgeRejected(){if(!this.bridgeRejectedNotified){this.bridgeRejectedNotified=!0;try{this.bridgeRejectedHandler?.()}catch{}}}notifySuperseded(){if(!this.supersededNotified){this.supersededNotified=!0;try{this.supersededHandler?.()}catch{}}}},f=class extends Error{step;name=`CommandAbortedError`;constructor(e){super(`Browser command aborted while ${e}. A CDP round trip already in flight cannot be cancelled, so it may still have been applied to the page; nothing after it was started.`),this.step=e}};function p(e,t){if(e?.aborted)throw new f(t)}function m(e,t){return e?{signal:e,error:()=>new f(t)}:void 0}function h(e,t,n){return new Promise((r,i)=>{if(t?.aborted){i(new f(n));return}let a=()=>{clearTimeout(o),i(new f(n))},o=setTimeout(()=>{t?.removeEventListener(`abort`,a),r()},e);t?.addEventListener(`abort`,a,{once:!0})})}function ee(e,t,n){return t?t.aborted?Promise.reject(new f(n)):new Promise((r,i)=>{let a=()=>i(new f(n));t.addEventListener(`abort`,a,{once:!0}),e.then(()=>{t.removeEventListener(`abort`,a),r()},e=>{t.removeEventListener(`abort`,a),i(e instanceof Error?e:Error(String(e)))})}):e}var g=class{contexts=new Map;for(e,t){let n=`${t}:${e}`,r=this.contexts.get(n);return r||(r=new Map,this.contexts.set(n,r)),r}peek(e,t){return this.contexts.get(`${t}:${e}`)}drop(e){this.contexts.delete(`main:${e}`),this.contexts.delete(`isolated:${e}`)}get size(){return this.contexts.size}},_=e(`har-recorder`),v=class{recordings=new Map;client;fs;eventCleanup=new Map;constructor(e,t){this.client=e,this.fs=t}async startRecording(e,t,n,r){let i=`rec-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;p(r,`about to enable Network on tab ${e}`),await this.client.send(`Network.enable`,{},t),p(r,`about to enable Page on tab ${e}`),await this.client.send(`Page.enable`,{},t),p(r,`about to read the URL of tab ${e}`);let a=(await this.client.send(`Runtime.evaluate`,{expression:`location.href`,returnByValue:!0},t)).result?.value??`about:blank`,o={id:i,targetId:e,sessionId:t,filterCode:n,pendingRequests:new Map,entries:[],startTime:Date.now(),currentUrl:a,snapshotCount:0};return this.recordings.set(i,o),this.setupEventListeners(o),await this.ensureDir(`/recordings/${i}`),_.debug(`Started recording`,{recordingId:i,targetId:e,currentUrl:a}),i}setupEventListeners(e){let{sessionId:t,id:n}=e,r=n=>{let r=n;r.sessionId===t&&this.handleRequestWillBeSent(e,r)},i=n=>{let r=n;r.sessionId===t&&this.handleResponseReceived(e,r)},a=r=>{let i=r;i.sessionId===t&&this.handleLoadingFinished(e,i).catch(e=>{_.error(`Failed to process loadingFinished event`,{recordingId:n,requestId:i.requestId,error:e instanceof Error?e.message:String(e)})})},o=n=>{let r=n;r.sessionId===t&&this.handleLoadingFailed(e,r)},s=r=>{let i=r;if(i.sessionId!==t)return;let a=i.frame;if(!a?.parentId&&a?.url){let t=[...e.entries],r=e.currentUrl;e.currentUrl=a.url,e.entries=[],e.pendingRequests.clear(),this.saveSnapshotWithEntries(e,`navigation`,t,r).catch(e=>{_.error(`Failed to save navigation snapshot`,{recordingId:n,error:e instanceof Error?e.message:String(e)})})}};this.client.on(`Network.requestWillBeSent`,r),this.client.on(`Network.responseReceived`,i),this.client.on(`Network.loadingFinished`,a),this.client.on(`Network.loadingFailed`,o),this.client.on(`Page.frameNavigated`,s),this.eventCleanup.set(n,()=>{this.client.off(`Network.requestWillBeSent`,r),this.client.off(`Network.responseReceived`,i),this.client.off(`Network.loadingFinished`,a),this.client.off(`Network.loadingFailed`,o),this.client.off(`Page.frameNavigated`,s)})}handleRequestWillBeSent(e,t){let{requestId:n,request:r,timestamp:i}=t;!n||!r||i==null||e.pendingRequests.set(n,{requestId:n,startTime:i*1e3,request:{method:r.method,url:r.url,headers:r.headers,postData:r.postData}})}handleResponseReceived(e,t){let{requestId:n,response:r}=t;if(!n||!r)return;let i=e.pendingRequests.get(n);i&&(i.response={status:r.status,statusText:r.statusText,headers:r.headers,mimeType:r.mimeType},i.timing=r.timing)}async handleLoadingFinished(e,t){let{requestId:n,timestamp:r}=t;if(!n||r==null)return;let i=e.pendingRequests.get(n);if(!i)return;i.endTime=r*1e3;try{let t=await this.client.send(`Network.getResponseBody`,{requestId:n},e.sessionId);i.responseBody=t.body,i.responseBodyBase64=t.base64Encoded===!0}catch{}let a=this.buildHarEntry(i);a&&e.entries.push(a),e.pendingRequests.delete(n)}handleLoadingFailed(e,t){let{requestId:n}=t;n&&e.pendingRequests.delete(n)}buildHarEntry(e){if(!e.response)return null;let{request:t,response:n,timing:r,startTime:i,endTime:a,responseBody:o,responseBodyBase64:s}=e,c=a?a-i:0,l=[];try{let e=new URL(t.url);l=Array.from(e.searchParams.entries()).map(([e,t])=>({name:e,value:t}))}catch{}let u=r?(()=>{let e=(e,t)=>{if(e==null||t==null||e<0||t<0)return-1;let n=t-e;return n>=0?n:-1},t=r.dnsStart>=0?r.dnsStart:r.connectStart>=0?r.connectStart:0;return{blocked:t>0?t:-1,dns:e(r.dnsStart,r.dnsEnd),connect:e(r.connectStart,r.connectEnd),ssl:e(r.sslStart,r.sslEnd),send:e(r.sendStart,r.sendEnd),wait:e(r.sendEnd,r.receiveHeadersStart),receive:e(r.receiveHeadersStart,r.receiveHeadersEnd)}})():{blocked:-1,dns:-1,connect:-1,ssl:-1,send:0,wait:c,receive:0},d={size:o?.length??0,mimeType:n.mimeType??`application/octet-stream`};o&&(d.text=o,s&&(d.encoding=`base64`));let f;return t.postData&&(f={mimeType:t.headers[`content-type`]??t.headers[`Content-Type`]??`text/plain`,text:t.postData}),{startedDateTime:new Date(i).toISOString(),time:c,request:{method:t.method,url:t.url,httpVersion:`HTTP/1.1`,cookies:[],headers:Object.entries(t.headers).map(([e,t])=>({name:e,value:t})),queryString:l,postData:f,headersSize:-1,bodySize:t.postData?.length??0},response:{status:n.status,statusText:n.statusText,httpVersion:`HTTP/1.1`,cookies:[],headers:Object.entries(n.headers).map(([e,t])=>({name:e,value:t})),content:d,redirectURL:n.headers.location??n.headers.Location??``,headersSize:-1,bodySize:d.size},cache:{},timings:u}}async saveSnapshot(e,t){return this.saveSnapshotWithEntries(e,t,e.entries,e.currentUrl)}async applyFilter(e,t){return y(e,t)}async saveSnapshotWithEntries(e,t,n,r){if(n.length===0)return _.debug(`No entries to save`,{recordingId:e.id,trigger:t}),null;let i=e.filterCode?await this.applyFilter(n,e.filterCode):n;if(i.length===0)return _.debug(`All entries filtered out`,{recordingId:e.id,trigger:t}),null;e.snapshotCount++;let a=new Date().toISOString().replace(/[:.]/g,`-`),o=this.urlToSlug(r),s=`${e.snapshotCount.toString().padStart(3,`0`)}-${a}-${t}-${o}.har`,c=`/recordings/${e.id}/${s}`,l={log:{version:`1.2`,creator:{name:`SLICC HAR Recorder`,version:`1.0.0`},entries:i}};return await this.fs.writeFile(c,JSON.stringify(l,null,2)),_.debug(`Saved HAR snapshot`,{recordingId:e.id,path:c,entryCount:i.length}),c}urlToSlug(e){try{let t=new URL(e);return`${t.hostname}${t.pathname}`.replace(/[^a-zA-Z0-9]/g,`-`).replace(/-+/g,`-`).replace(/^-|-$/g,``).slice(0,50)||`page`}catch{return`page`}}async stopRecording(e){let t=this.recordings.get(e);if(!t)throw Error(`Recording not found: ${e}`);await this.saveSnapshot(t,`close`);let n=this.eventCleanup.get(e);n&&(n(),this.eventCleanup.delete(e));try{await this.client.send(`Network.disable`,{},t.sessionId)}catch{}this.recordings.delete(e);let r=`/recordings/${e}`;return _.debug(`Stopped recording`,{recordingId:e,snapshotCount:t.snapshotCount}),r}getRecording(e){return this.recordings.get(e)}getRecordingByTarget(e){for(let[t,n]of this.recordings)if(n.targetId===e)return t}async ensureDir(e){await this.fs.mkdir(e,{recursive:!0})}};function y(e,t){try{let n=Function(`entry`,`return (${t})(entry);`),r=[];for(let t of e)try{let e=n(t);if(e===!1)continue;typeof e==`object`&&e?r.push(e):r.push(t)}catch(e){_.error(`Filter function error on entry, keeping it`,{error:e instanceof Error?e.message:String(e)}),r.push(t)}return r}catch(t){return _.error(`Failed to compile filter, returning unfiltered`,{error:t instanceof Error?t.message:String(t)}),e}}var b=class{maxSessions;onEvict;sessions=new Map;pinnedTargets=new Map;appliedSends=new Map;constructor(e=32,t){this.maxSessions=e,this.onEvict=t}get size(){return this.sessions.size}get(e){return this.sessions.get(e)}has(e){return this.sessions.has(e)}values(){return this.sessions.values()}entries(){return this.sessions.entries()}snapshot(){return[...this.sessions]}remember(e,t){this.pruneAppliedSends(),this.sessions.set(e,t),this.enforceCap(e)}touch(e,t){this.sessions.delete(e),this.sessions.set(e,t)}take(e){let t=this.sessions.get(e);return t&&this.sessions.delete(e),t}delete(e){this.sessions.delete(e)}clear(){this.sessions.clear()}pin(e){this.pinnedTargets.set(e,(this.pinnedTargets.get(e)??0)+1);let t=!1;return()=>{if(t)return;t=!0;let n=(this.pinnedTargets.get(e)??1)-1;n>0?this.pinnedTargets.set(e,n):this.pinnedTargets.delete(e),this.enforceCap()}}isPinned(e){return this.pinnedTargets.has(e)}enforceCap(e){for(;this.sessions.size>this.maxSessions;){let t;for(let n of this.sessions.keys())if(!(n===e||this.pinnedTargets.has(n))){t=n;break}if(t===void 0)return;let n=this.sessions.get(t);this.sessions.delete(t),n&&this.onEvict?.(t,n)}}noteApplied(e){this.appliedSends.set(e,(this.appliedSends.get(e)??0)+1)}appliedCount(e){return this.appliedSends.get(e)??0}pruneAppliedSends(){if(this.appliedSends.size<=this.maxSessions*4)return;let e=new Set([...this.sessions.values()].map(e=>e.sessionId));for(let t of[...this.appliedSends.keys()])e.has(t)||this.appliedSends.delete(t)}findBySessionId(e){for(let[t,n]of this.sessions)if(n.sessionId===e)return[t,n]}findByTargetOrLocalId(e){let t=[];for(let[n,r]of this.sessions)(n===e||r.remote?.localTargetId===e)&&t.push([n,r]);return t}anyOnTransport(e){for(let t of this.sessions.values())if(t.transport===e)return!0;return!1}anyMatchingRemote(e,t){for(let n of this.sessions.values())if(n.remote?.runtimeId===e&&n.remote.localTargetId===t)return!0;return!1}},x=`slicc.ariaRefs`,S=[`textbox`,`button`,`link`,`checkbox`,`radio`,`iframe`];function C(e=0){return`(${w})(${Number.isSafeInteger(e)&&e>0?e:0})`}function te(e){return`(function(ref) {
|
|
2
2
|
var store = window[Symbol.for(${JSON.stringify(x)})];
|
|
3
3
|
var held = store && store.byRef.get(ref);
|
|
4
4
|
var el = held && (typeof held.deref === 'function' ? held.deref() : held);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./account-store-
|
|
1
|
+
import{a as e}from"./account-store-C-NiHHQY.js";import{a as t}from"./diagnostics-Cag7MsZI.js";import{a as n}from"./compat-nGhSz-U1.js";import{r,s as i}from"./legacy-api-aliases--xyLjPgC.js";import{n as a}from"./pi-transcript-context-4pjVPiVC.js";const o=`cerebras`,s=`https://api.cerebras.ai/v1`,c=`openai-completions`,l=`${o}-openai`,u=`slicc-cerebras-models`;let d=[];const f=[{id:`gpt-oss-120b`,name:`GPT OSS 120B`,api:`openai`,reasoning:!0,input:[`text`],context_window:131072,max_tokens:40960},{id:`gemma-4-31b`,name:`Gemma 4 31B`,api:`openai`,reasoning:!1,input:[`text`,`image`],context_window:131072,max_tokens:40960},{id:`zai-glm-4.7`,name:`Z.AI GLM-4.7`,api:`openai`,reasoning:!1,input:[`text`],context_window:131072,max_tokens:40960}];function p(e){try{localStorage.setItem(u,JSON.stringify(e))}catch{}}function m(){try{let e=localStorage.getItem(u);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)&&t.length>0?t:[]}catch{return[]}}function h(e){let t=e.id??``,n=f.find(e=>e.id===t);return{id:t,name:e.name??n?.name??t,api:`openai`,reasoning:e.capabilities?.reasoning??n?.reasoning??!1,input:e.capabilities?.vision?[`text`,`image`]:n?.input??[`text`],context_window:e.limits?.max_context_length??n?.context_window??8192,max_tokens:e.limits?.max_completion_tokens??n?.max_tokens??4096}}async function g(e){let t=await fetch(`${s}/models`,{headers:{Authorization:`Bearer ${e}`}});if(!t.ok)throw Error(`GET /v1/models → ${t.status} ${t.statusText}`);let n=((await t.json()).data??[]).map(h).filter(e=>e.id.length>0);n.length>0&&(d=n,p(n))}function _(e,t){return{type:`error`,reason:`error`,error:{role:`assistant`,content:[],api:l,provider:o,model:e.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:`error`,errorMessage:t instanceof Error?t.message:String(t),timestamp:Date.now()}}}function v(e){console.error(`[cerebras] Stream error:`,e instanceof Error?e.message:String(e))}const y=(e,n,r={})=>{let i=t();return b(i,e,n,r).catch(v),i};async function b(e,t,n,i){try{let o={...t,baseUrl:s,api:c},l=r(o,a(n),i);for await(let t of l)e.push(t);e.end()}catch(n){v(n),e.push(_(t,n)),e.end()}}const x=(e,n,r)=>{let i=t();return S(i,e,n,r).catch(v),i};async function S(e,t,n,r){try{let o={...t,baseUrl:s,api:c},l=i(o,a(n),r);for await(let t of l)e.push(t);e.end()}catch(n){v(n),e.push(_(t,n)),e.end()}}const C={id:o,name:`Cerebras`,description:`Ultra-fast inference on Cerebras hardware. Get an API key at cloud.cerebras.ai.`,requiresApiKey:!0,requiresBaseUrl:!1,getModelIds:()=>{if(d.length>0)return d;let e=m();return e.length>0?e:f},refreshModels:async t=>{let n=t??e(o)??``;if(n)try{await g(n)}catch(e){console.warn(`[cerebras] Failed to refresh model list:`,e instanceof Error?e.message:String(e))}}};function w(){n({api:l,stream:y,streamSimple:x})}export{C as config,w as register};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./diagnostics-Cag7MsZI.js";import{a as t}from"./compat-BAGLwgqY.js";import{r as n,s as r}from"./legacy-api-aliases-BjgG1CsY.js";import{h as i}from"./account-store-
|
|
1
|
+
import{a as e}from"./diagnostics-Cag7MsZI.js";import{a as t}from"./compat-BAGLwgqY.js";import{r as n,s as r}from"./legacy-api-aliases-BjgG1CsY.js";import{h as i}from"./account-store-CtGPvHvd.js";import{n as a}from"./pi-transcript-context-miZCMig3.js";var o=`cerebras`,s=`https://api.cerebras.ai/v1`,c=`openai-completions`,l=`${o}-openai`,u=`slicc-cerebras-models`,d=[],f=[{id:`gpt-oss-120b`,name:`GPT OSS 120B`,api:`openai`,reasoning:!0,input:[`text`],context_window:131072,max_tokens:40960},{id:`gemma-4-31b`,name:`Gemma 4 31B`,api:`openai`,reasoning:!1,input:[`text`,`image`],context_window:131072,max_tokens:40960},{id:`zai-glm-4.7`,name:`Z.AI GLM-4.7`,api:`openai`,reasoning:!1,input:[`text`],context_window:131072,max_tokens:40960}];function p(e){try{localStorage.setItem(u,JSON.stringify(e))}catch{}}function m(){try{let e=localStorage.getItem(u);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)&&t.length>0?t:[]}catch{return[]}}function h(e){let t=e.id??``,n=f.find(e=>e.id===t);return{id:t,name:e.name??n?.name??t,api:`openai`,reasoning:e.capabilities?.reasoning??n?.reasoning??!1,input:e.capabilities?.vision?[`text`,`image`]:n?.input??[`text`],context_window:e.limits?.max_context_length??n?.context_window??8192,max_tokens:e.limits?.max_completion_tokens??n?.max_tokens??4096}}async function g(e){let t=await fetch(`${s}/models`,{headers:{Authorization:`Bearer ${e}`}});if(!t.ok)throw Error(`GET /v1/models → ${t.status} ${t.statusText}`);let n=((await t.json()).data??[]).map(h).filter(e=>e.id.length>0);n.length>0&&(d=n,p(n))}function _(e,t){return{type:`error`,reason:`error`,error:{role:`assistant`,content:[],api:l,provider:o,model:e.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:`error`,errorMessage:t instanceof Error?t.message:String(t),timestamp:Date.now()}}}function v(e){console.error(`[cerebras] Stream error:`,e instanceof Error?e.message:String(e))}var y=(t,n,r={})=>{let i=e();return b(i,t,n,r).catch(v),i};async function b(e,t,r,i){try{let o={...t,baseUrl:s,api:c},l=n(o,a(r),i);for await(let t of l)e.push(t);e.end()}catch(n){v(n),e.push(_(t,n)),e.end()}}var x=(t,n,r)=>{let i=e();return S(i,t,n,r).catch(v),i};async function S(e,t,n,i){try{let o={...t,baseUrl:s,api:c},l=r(o,a(n),i);for await(let t of l)e.push(t);e.end()}catch(n){v(n),e.push(_(t,n)),e.end()}}var C={id:o,name:`Cerebras`,description:`Ultra-fast inference on Cerebras hardware. Get an API key at cloud.cerebras.ai.`,requiresApiKey:!0,requiresBaseUrl:!1,getModelIds:()=>{if(d.length>0)return d;let e=m();return e.length>0?e:f},refreshModels:async e=>{let t=e??i(o)??``;if(t)try{await g(t)}catch(e){console.warn(`[cerebras] Failed to refresh model list:`,e instanceof Error?e.message:String(e))}}};function w(){t({api:l,stream:y,streamSimple:x})}export{C as config,w as register};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./logger-DDBAeTLF.js";import{st as t}from"./wc-shell-
|
|
1
|
+
import{t as e}from"./logger-DDBAeTLF.js";import{st as t}from"./wc-shell-BEqDPo9n.js";import{n}from"./runtime-env-Dlaokqg1.js";import{t as r}from"./permissions-surface-registry-CilCRwhh.js";import{t as i}from"./speech-assets-bridge-CFYafE89.js";import{o as a}from"./transformers-env-CGv03PAS.js";import{i as o,t as s}from"./whisper-session-CRowBEuo.js";var c=e(`speech:composer`),l=5e3,u=(e,t,n)=>new Promise((r,i)=>{let a=setTimeout(()=>i(Error(`${n} timed out after ${t}ms`)),t);e.then(e=>{clearTimeout(a),r(e)},e=>{clearTimeout(a),i(e)})}),d=class{#e;#t;#n;#r;#i;#a=null;#o=!1;#s={engine:`builtin`,state:`idle`};#c=a();#l=new Set;#u=null;constructor(e={}){this.#e=e.builtin??t(),this.#t=e.loadWhisper??o,this.#n=e.startSession??s,this.#r=e.getPermissionSurface??f,this.#i=e.ensureAssets??v}permission(){return this.#e.permission()}async requestPermission(){let e=this.#r();if(e)try{let t=await e.request(`microphone`);return t?(this.#p(t.stream),!0):!1}catch(e){return c.warn(`permission surface microphone request failed`,e),!1}return this.#e.requestPermission()}microphones(){return this.#e.microphones()}status(){return this.#s}onStatus(e){return this.#l.add(e),e(this.#s),()=>this.#l.delete(e)}warmup(){this.#o||(this.#o=!0,this.#c=a(),this.#_({engine:`builtin`,state:`downloading`}),this.#d().then(e=>{this.#a=e,this.#_({engine:`enhanced`,state:`ready`})},e=>{this.#o=!1,this.#_({engine:`builtin`,state:`unavailable`,message:m(e)}),c.warn(`enhanced speech engine unavailable`,e)}))}async#d(){let e=null;try{await this.#i(e=>this.#h(e))}catch(t){e=t,c.warn(`speech asset staging failed; trying already-present assets`,t)}try{return await this.#t(e=>this.#g(e))}catch(t){throw e??t}}async start(e){let t=this.#a;if(t){let n=null;try{return n=await this.#f(e.deviceId),await this.#n(t,{deviceId:e.deviceId,lang:e.lang,onPartial:e.onPartial,onError:e.onError,stream:n??void 0})}catch(e){if(n)for(let e of n.getTracks())e.stop();c.warn(`whisper session failed to start; falling back to builtin`,e)}}return this.#e.start(e)}async#f(e){let t=e&&e!=="default"?e:void 0,n=this.#m();if(n){if(!t&&p(n))return n;for(let e of n.getTracks())e.stop()}let r=this.#r();if(!r)return null;let i={audio:!t||{deviceId:{exact:t}}},a=await u(r.request(`microphone`,{constraints:i}),l,`microphone capture`);if(!a)throw Error(`microphone permission denied`);return a.stream}#p(e){if(this.#u&&this.#u!==e)for(let e of this.#u.getTracks())e.stop();this.#u=e}#m(){let e=this.#u;return this.#u=null,e}get enhancedReady(){return this.#a!==null}#h(e){if(this.#s.state!==`downloading`)return;(e.bytesTotal!=null||e.bytesLoaded!=null)&&this.#c.update(e.asset,e.bytesLoaded??0,e.bytesTotal??0);let t=this.#c.snapshot();t.total<=0||this.#_({engine:`builtin`,state:`downloading`,download:{loaded:t.loaded,total:t.total,etaSeconds:t.etaSeconds}})}#g(e){this.#s.state===`downloading`&&this.#_({engine:`builtin`,state:`downloading`,download:{loaded:e.loaded,total:e.total,etaSeconds:e.etaSeconds}})}#_(e){this.#s=e;for(let t of this.#l)t(e)}};function f(){let e=r();return e?{async request(t,n){let r=await e.request(t,n);return r?.kind===`microphone`?{kind:`microphone`,stream:r.stream}:null}}:null}function p(e){let t=e.getTracks();return t.length>0&&t.some(e=>e.readyState!==`ended`)}function m(e){return`Enhanced speech unavailable: ${e instanceof Error?e.message:String(e)}`}var h=n,g;function _(e){g=e}function v(e){return h()?Promise.resolve():i({instanceId:g,onProgress:e})}var y=null;function b(){return y??=new d,y}export{b as getComposerSpeech,_ as setComposerSpeechInstanceId};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{R as e,d as t,u as n,w as r}from"./account-store-
|
|
1
|
+
import{R as e,d as t,u as n,w as r}from"./account-store-CtGPvHvd.js";import{a as i}from"./main-6hbXaflT.js";var a=`slicc_cloud_model_catalog`,o=`adobe`;function s(e){if(e===o)return!1;let t=r(e);return!(t.hidden||t.onOAuthLoginIntercepted)}function c(){try{let e=t().map(e=>({providerId:e.providerId,providerName:e.providerName,models:e.models.map(e=>({id:e.id,name:e.name}))}));localStorage.setItem(a,JSON.stringify(e))}catch{}}async function l(t){for(;t.firstChild;)t.removeChild(t.firstChild);t.className=`connect-surface`;let a=document.createElement(`h1`);a.className=`connect-surface__title`,a.textContent=`Connect providers`,t.appendChild(a);let l=document.createElement(`p`);l.className=`connect-surface__desc`,l.textContent=`Log in or add API keys for the providers your cone should use, then click Done to return to the dashboard.`,t.appendChild(l);let u=document.createElement(`div`);u.className=`connect-surface__accounts`,t.appendChild(u);function d(){for(;u.firstChild;)u.removeChild(u.firstChild);let t=n().filter(e=>e.providerId!==o);if(t.length===0){let e=document.createElement(`div`);e.className=`connect-surface__empty`,e.textContent=`No providers connected yet.`,u.appendChild(e)}else{let n=document.createElement(`div`);n.className=`connect-surface__accounts-list`;for(let i of t){let t=r(i.providerId),a=document.createElement(`div`);a.className=`connect-surface__account-row`;let o=document.createElement(`div`);o.className=`connect-surface__account-info`;let s=document.createElement(`div`);s.className=`connect-surface__account-name`,s.textContent=t.name,o.appendChild(s);let l=document.createElement(`div`);l.className=`connect-surface__account-detail`,l.textContent=i.userName?i.userName:i.accessToken?`Logged in`:i.apiKey?`API key set`:`No credentials`,o.appendChild(l),a.appendChild(o);let u=document.createElement(`button`);u.className=`connect-surface__remove-btn`,u.textContent=`Remove`,u.onclick=async()=>{await e(i.providerId),c(),d()},a.appendChild(u),n.appendChild(a)}u.appendChild(n)}let a=document.createElement(`button`);a.className=`connect-surface__add-btn`,a.textContent=t.length===0?`Add provider`:`Manage providers`,a.onclick=async()=>{await i({startInAddAccount:!0,providerFilter:s})&&(c(),d())},u.appendChild(a)}d(),c();let f=document.createElement(`div`);f.className=`connect-surface__footer`;let p=document.createElement(`button`);if(p.className=`connect-surface__done-btn`,p.textContent=`Done — return to dashboard`,p.onclick=()=>{c(),window.close()},f.appendChild(p),t.appendChild(f),!document.getElementById(`connect-surface-style`)){let e=document.createElement(`style`);e.id=`connect-surface-style`,e.textContent=`
|
|
2
2
|
.connect-surface {
|
|
3
3
|
padding: 2rem;
|
|
4
4
|
max-width: 560px;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import{t as e}from"./logger-LESFN7Hj.js";import{c as t}from"./models-CET5SEuw.js";import{t as n}from"./compat-nGhSz-U1.js";import{t as r}from"./utf16-clip-Dcxt-q1C.js";const i={enabled:!0,reserveTokens:16384,keepRecentTokens:2e4};function a(e,t,n){return n.enabled?e>t-n.reserveTokens:!1}function o(e){if(typeof e==`string`)return e.length;let t=0;for(let n of e)n.type===`text`&&n.text?t+=n.text.length:n.type===`image`&&(t+=4800);return t}function s(e){let t=0;switch(e.role){case`system`:{let n=e;if(t=o(n.content),n.sections)for(let e of Object.values(n.sections))e&&(t+=e.length);return n.toolsAdded&&(t+=JSON.stringify(n.toolsAdded).length),Math.ceil(t/4)}case`user`:return t=o(e.content),Math.ceil(t/4);case`assistant`:{let n=e;for(let e of n.content)e.type===`text`?t+=e.text.length:e.type===`thinking`?t+=e.thinking.length:e.type===`toolCall`&&(t+=e.name.length+JSON.stringify(e.arguments).length);return Math.ceil(t/4)}case`custom`:case`toolResult`:return t=o(e.content),Math.ceil(t/4);case`bashExecution`:return t=e.command.length+e.output.length,Math.ceil(t/4);case`branchSummary`:case`compactionSummary`:return t=e.summary.length,Math.ceil(t/4)}return 0}const c=e(`context-compaction`);function l(e,n){if(e===n)return n;let r=t(e);return r?[r,...n.filter(e=>e.role!==`system`)]:n}function u(e,t){return e.role===t}function d(e){let t=0;for(;t<e.length&&u(e[t],`toolResult`);){let n=e[t];c.warn(`Dropping orphaned toolResult (no preceding assistant message)`,{toolCallId:n.toolCallId}),t++}return t>0?e.slice(t):e}function f(e){let t=[];for(let n of e){let e=n;switch(e.role){case`user`:t.push(`<user>\n${m(e.content)}\n</user>`);break;case`assistant`:t.push(`<assistant>\n${m(e.content)}\n</assistant>`);break;case`toolResult`:{let n=e.toolName??`tool`;t.push(`<tool-result name="${n}">\n${m(e.content)}\n</tool-result>`);break}case`bashExecution`:t.push(`<bash>\n$ ${e.command??``}\n${e.output??``}\n</bash>`);break;case`branchSummary`:case`compactionSummary`:t.push(`<prior-summary>\n${e.summary??``}\n</prior-summary>`);break;default:t.push(`<${e.role}>\n${m(e.content)}\n</${e.role}>`)}}return t.join(`
|
|
2
|
+
|
|
3
|
+
`)}const p=/\n*The full transcript of the conversation before this compaction is saved at \S+ — read it when the summary is not enough\.?/g;function m(e){if(typeof e==`string`)return e.replace(p,``);if(!Array.isArray(e))return``;let t=[];for(let n of e){let e=n;e.type===`text`&&e.text?t.push(e.text.replace(p,``)):e.type===`thinking`&&e.thinking?t.push(`[thinking] ${e.thinking}`):e.type===`toolCall`?t.push(`[tool-call ${e.name??`?`}] ${JSON.stringify(e.arguments??{})}`):e.type===`image`&&t.push(`[image]`)}return t.join(`
|
|
4
|
+
`)}function h(e){return`You are a context compaction assistant. You are shown the prefix of a conversation between a user and an AI coding assistant, and asked to produce either a structured summary, durable memory bullets, or a short title — depending on the user's instruction.
|
|
5
|
+
|
|
6
|
+
Do NOT continue the conversation. Do NOT answer questions inside the conversation. Output ONLY what the user asks for in the format specified.
|
|
7
|
+
|
|
8
|
+
<conversation>
|
|
9
|
+
${e}
|
|
10
|
+
</conversation>`}var g=class extends Error{failure;constructor(e,t){super(t),this.failure=e,this.name=`CompactionCallError`}};function _(e){if(e instanceof g)return e.failure;let t=typeof e==`object`&&e?e:void 0,n=t?.status??t?.statusCode??t?.code,r=typeof t?.message==`string`?t.message.toLowerCase():String(e).toLowerCase();return n===429||n===`429`||/rate[ -]?limit|too many requests|throttl/.test(r)?`rate-limit`:/quota|credit|budget|billing|allowance|resource exhausted/.test(r)?`quota-exhausted`:n===401||n===`401`||/unauthori[sz]ed|authentication|invalid api.?key|invalid x-api-key|session expired/.test(r)?`authentication`:typeof n==`number`&&n>=500||typeof n==`string`&&/^5\d\d$/.test(n)||/service unavailable|provider unavailable|overloaded|outage|timed? out|timeout|network|fetch failed|connection/.test(r)?`provider-unavailable`:`unknown`}async function v(e,t,i,a,o,s,c){let l={role:`user`,content:[{type:`text`,text:r(a)}],timestamp:Date.now()},u=await n(e,{systemPrompt:r(i),messages:[l]},{maxTokens:o,apiKey:t,headers:s,signal:c});if(typeof u!=`object`||!u)throw new g(`invalid-response`,`Compaction call returned no response`);let d=u;if(typeof d.stopReason!=`string`||!Array.isArray(d.content))throw new g(`invalid-response`,`Compaction call returned an invalid response envelope`);if(d.stopReason===`error`){let e=typeof d.errorMessage==`string`?d.errorMessage:`Unknown provider error`;throw new g(_(Error(e)),`Compaction call failed: ${e}`)}let f=d.content.filter(e=>typeof e==`object`&&!!e&&e.type===`text`);if(f.some(e=>typeof e.text!=`string`))throw new g(`invalid-response`,`Compaction call returned an invalid text block`);let p=f.map(e=>e.text).join(`
|
|
11
|
+
`).trim();if(!p)throw new g(`empty-response`,`Compaction call returned no summary text`);return p}function y(e){if(typeof e==`string`)return e.length;if(!Array.isArray(e))return 0;let t=0;for(let n of e){let e=n;if(e.type===`text`&&e.text)t+=e.text.length;else if(e.type===`thinking`&&e.thinking)t+=e.thinking.length;else if(e.type===`toolCall`&&e.arguments!==void 0)try{t+=JSON.stringify(e.arguments).length}catch{}else e.type===`image`&&e.source?.data&&(t+=e.source.data.length)}return t}function b(e,t){let n=Math.max(1,Math.round(e/1024));return`[${t===`assistant`?`Assistant message elided`:`Tool result elided`}: ${n} KB, exceeds half the context window. Re-run with smaller arguments — e.g. open --view --size low.]`}function x(e){let t=e.role,n=e.content,r=y(n);if(t===`toolResult`)return{...e,content:[{type:`text`,text:b(r,t)}]};let i=(Array.isArray(n)?n.filter(e=>e.type===`toolCall`):[]).map(e=>{let t=0;if(e.arguments!==void 0)try{t=JSON.stringify(e.arguments).length}catch{}return{type:e.type,id:e.id,name:e.name,arguments:{elided:!0,originalBytes:t}}});return{...e,content:[{type:`text`,text:b(r,t)},...i]}}function S(e,t,n){let r=(t-n)/2,i=0,a=0;return{messages:e.map(e=>{if(T(e)<=r)return e;let t=e.role;if(t!==`toolResult`&&t!==`assistant`)return e;let n=e,o=y(n.content);return t===`toolResult`?(i++,a+=o,x(e)):(Array.isArray(n.content)?n.content:[]).filter(e=>e.type===`toolCall`).length===0?e:(i++,a+=o,x(e))}),elidedCount:i,elidedBytes:a}}function C(e,t,n){let r=0,i=0,a=S(e.map(e=>{let t=F(e);return t!==e&&(r++,i+=y(e.content)-y(t.content)),t}),t,n);return{messages:a.messages,elidedCount:r+a.elidedCount,elidedBytes:i+a.elidedBytes}}function w(e){if(!u(e,`assistant`))return 0;let t=e.content;if(!Array.isArray(t))return 0;let n=0;for(let e of t){let t=e;t.type===`thinking`&&typeof t.thinkingSignature==`string`&&(n+=t.thinkingSignature.length)}return n}function T(e){return s(e)+Math.ceil(w(e)/4)}function E(e){let t=0;for(let n of e)t+=T(n);return t}function D(e){for(let t=e.length-1;t>=0;t--){if(!u(e[t],`assistant`))continue;let n=e[t];if(n.stopReason===`aborted`||n.stopReason===`error`)continue;let r=n.usage;if(r&&O(r)>0)return t}return-1}function O(e){return e.totalTokens||e.input+e.output+e.cacheRead+e.cacheWrite}function k(e){let t=E(e),n=D(e);if(n===-1)return t;let r=O(e[n].usage);for(let t=n+1;t<e.length;t++)r+=T(e[t]);return Math.max(t,r)}function A(e){return k(e)}function j(e,t){return e.length!==t.length||e.some((e,n)=>e!==t[n])}function M(e,t){return t?.roundId?{trigger:e,roundId:t.roundId}:{trigger:e}}function N(e,t,n){try{e.onCompactionStateChange?.(t,n)}catch(e){c.warn(`onCompactionStateChange listener threw`,{error:e instanceof Error?e.message:String(e)})}}function P(e,t,n,r,i,o){let s=S(e,n,r),l=s.messages,u=s.elidedCount,d=s.elidedBytes,f=u>0?E(l):t,p=f>n*i;if(p){let e=C(l,n,r);l=e.messages,u+=e.elidedCount,d+=e.elidedBytes}if(!p&&u===0)return{messages:e,isHopeless:!1,earlyReturn:null};c.warn(`Compaction oversized-message elision`,{totalTokens:t,postSizeTokens:f,contextWindow:n,isHopeless:p,elidedCount:u,elidedBytes:d});let m=a(E(l),n,o)?null:L([],l,n,o);return{messages:l,isHopeless:p,earlyReturn:m}}function F(e){let t=e.content;if(!Array.isArray(t))return e;let n=!1,r=t.map(e=>{let t=e;return t.type===`image`?(n=!0,{type:`text`,text:`[image elided during compaction: ~${Math.max(1,Math.round((t.source?.data??t.data??``).length/1024))} KB. Re-attach or re-read the image if it is still needed.]`}):e});return n?{...e,content:r}:e}function I(e){for(let t=e.length-1;t>=0;t--)if(u(e[t],`user`))return t;return-1}function L(e,t,n,r){let i=I(t),o=t.map((e,t)=>i!==-1&&t>=i?e:F(e));if(a(E([...e,...o]),n,r))for(let t=0;t<o.length;t++){let i=F(o[t]);if(i!==o[t]&&(o=[...o.slice(0,t),i,...o.slice(t+1)],!a(E([...e,...o]),n,r)))break}return o}function R(e,t){let n=0,r=e.length;for(let i=e.length-1;i>=0;i--){let a=T(e[i]);if(n+a>t&&r<e.length)break;n+=a,r=i}for(;r>0&&u(e[r],`toolResult`);)r--;return r<=0||r>=e.length?(c.warn(`Cannot find valid cut point for compaction`),null):{messagesToSummarize:e.slice(0,r),messagesToKeep:d(e.slice(r))}}async function z(e,t,n,r,i){if(!(!e.onMemoryUpdates||e.shouldExtractMemories?.()===!1))try{N(e,`extracting-memory`,i);let a=await v(e.model,t,n,`From the conversation above, extract durable memories worth persisting to a global memory file shared across future sessions.
|
|
12
|
+
|
|
13
|
+
Focus on:
|
|
14
|
+
- User preferences, working style, opinions stated explicitly.
|
|
15
|
+
- Stable project facts (architecture decisions, conventions, constraints).
|
|
16
|
+
- Validated approaches the user accepted ("yes, exactly", "perfect"), not just corrections.
|
|
17
|
+
- External resources/links the user named.
|
|
18
|
+
|
|
19
|
+
DO NOT include:
|
|
20
|
+
- Ephemeral state (current task, in-progress work).
|
|
21
|
+
- Information already obvious from the codebase (file paths, function names, framework conventions).
|
|
22
|
+
- Generic restatements of what the conversation was about.
|
|
23
|
+
|
|
24
|
+
If nothing in the conversation is worth persisting, return exactly the single line:
|
|
25
|
+
NONE
|
|
26
|
+
|
|
27
|
+
Otherwise, output ONLY a markdown bullet list (one bullet per memory), no headers, no preamble, no follow-up. Each bullet is one line. Be specific. Prefer one fact per bullet over multi-clause sentences.`,2048,e.headers,r);if(a?.trim()&&a.trim()!==`NONE`)try{await e.onMemoryUpdates(a.trim()),c.info(`Memory extraction applied`,{bulletsLength:a.length})}catch(e){c.warn(`onMemoryUpdates callback threw`,{error:e instanceof Error?e.message:String(e)})}else c.info(`Memory extraction returned no durable memories`)}catch(e){c.warn(`Memory extraction call failed (compaction still applied)`,{error:e instanceof Error?e.message:String(e)})}}async function B(e,t,n,r,i,a,o,s,l,u){try{let d=S(n,a,i).messages,p=h(f(d)),m=Math.floor(.8*i);N(e,`summarizing`,l);let g=await v(e.model,t,p,`Produce a structured context checkpoint summary of the conversation above that another LLM can use to continue the work.
|
|
28
|
+
|
|
29
|
+
Use this EXACT format:
|
|
30
|
+
|
|
31
|
+
## Goal
|
|
32
|
+
[What is the user trying to accomplish? Can be multiple items if the session covers different tasks.]
|
|
33
|
+
|
|
34
|
+
## Constraints & Preferences
|
|
35
|
+
- [Any constraints, preferences, or requirements mentioned by user]
|
|
36
|
+
- [Or "(none)" if none were mentioned]
|
|
37
|
+
|
|
38
|
+
## Progress
|
|
39
|
+
### Done
|
|
40
|
+
- [x] [Completed tasks/changes]
|
|
41
|
+
|
|
42
|
+
### In Progress
|
|
43
|
+
- [ ] [Current work]
|
|
44
|
+
|
|
45
|
+
### Blocked
|
|
46
|
+
- [Issues preventing progress, if any]
|
|
47
|
+
|
|
48
|
+
## Key Decisions
|
|
49
|
+
- **[Decision]**: [Brief rationale]
|
|
50
|
+
|
|
51
|
+
## Next Steps
|
|
52
|
+
1. [Ordered list of what should happen next]
|
|
53
|
+
|
|
54
|
+
## Critical Context
|
|
55
|
+
- [Any data, examples, or references needed to continue]
|
|
56
|
+
- [Or "(none)" if not applicable]
|
|
57
|
+
|
|
58
|
+
Keep each section concise. Preserve exact file paths, function names, and error messages. Output ONLY the summary, with no preamble or follow-up.`,m,e.headers,s),_={role:`user`,content:[{type:`text`,text:H(`<context-summary>\n${g}\n</context-summary>`,l.transcriptPath)}],timestamp:Date.now()};return c.info(`LLM summarization successful`,{originalMessages:o,compactedMessages:1+r.length,summaryLength:g.length}),u?u(()=>z(e,t,p,void 0,l)):await z(e,t,p,s,l),N(e,`idle`,l),{kind:`summarized`,messages:[_,...r]}}catch(e){let t=_(e);return c.warn(`LLM summarization failed`,{failure:t,error:e instanceof Error?e.message:String(e)}),{kind:`failed`,failure:t}}}async function V(e,t,n){if(e.onBeforeCompaction)try{let r=await e.onBeforeCompaction(t,n);if(r?.transcriptPath)return c.info(`Pre-compaction transcript snapshot written`,{trigger:n,transcriptPath:r.transcriptPath}),r}catch(e){c.warn(`Pre-compaction snapshot hook failed (compaction continues without a pointer)`,{trigger:n,error:e instanceof Error?e.message:String(e)})}}function H(e,t){return t?`${e}\n\nThe full transcript of the conversation before this compaction is saved at ${t} — read it when the summary is not enough.`:e}function U(e,t,n,r,i,a){if(a===!1){let n={...i,failure:`context-too-large`};return c.info(`Idle compaction skipped destructive hopeless-context elision`,{trigger:r,failure:n.failure}),N(e,`cancelled`,n),N(e,`idle`,n),t}return N(e,`summarizing`,i),N(e,`idle`,i),n}async function W(e,t,n,r,i,a,o,s,l,u){if(u)return{kind:`failed`,failure:`context-too-large`};let d=e.getApiKey();return d?B(e,d,t,n,r,i,a,o,s,l?.deferMemoryExtraction):(c.warn(`No API key available for LLM summarization`),{kind:`failed`,failure:`authentication`})}function G(e,t,n,r,i,a,o,s,l,u){if(a?.aborted)return c.info(`Compaction aborted before the fallback drop (history untouched)`,{trigger:s}),N(e,`cancelled`,l),N(e,`idle`,l),t;if(o?.allowNaiveDrop===!1){let n={...l,failure:u};return c.warn(`Compaction summary unavailable; preserving history for a later retry`,{trigger:s,failure:u}),N(e,`cancelled`,n),N(e,`idle`,n),t}N(e,`fallback`,l),N(e,`idle`,l);let d={role:`user`,content:[{type:`text`,text:H(`[Earlier conversation messages were compacted to save context space]`,l.transcriptPath)}],timestamp:Date.now()},f=L([d],n,r,i);return c.info(`Naive compaction applied`,{originalMessages:t.length,compactedMessages:1+f.length}),[d,...f]}function K(e){let t=e.contextWindow??2e5,n=e.reserveTokens??i.reserveTokens,r=e.keepRecentTokens??i.keepRecentTokens,o=e.hopelessMultiplier??4,s={enabled:!0,reserveTokens:n,keepRecentTokens:r};return async(i,u,d)=>{if(i.length===0)return i;let f=k(i);if(!d?.force&&!a(f,t,s))return i;let p=d?.trigger??(d?.force?`overflow`:`threshold`),m=M(p,d),h=await V(e,i,p);h&&(m.transcriptPath=h.transcriptPath);let g=P(i,f,t,n,o,s);if(g.earlyReturn)return l(i,U(e,i,g.earlyReturn,p,m,d?.allowNaiveDrop));let _=g.messages,v=g.isHopeless;c.info(`Context compaction triggered`,{totalTokens:f,contextWindow:t,threshold:t-n,messageCount:_.length});let y=R(_.filter(e=>e.role!==`system`),r);if(!y)return d?.allowNaiveDrop===!1?i:_;let{messagesToSummarize:b,messagesToKeep:x}=y;c.info(`Compaction cut point`,{summarizing:b.length,keeping:x.length});let S=await W(e,b,x,n,t,i.length,u,m,d,v);if(S.kind===`summarized`){let[e,...n]=S.messages;return l(i,[e,...L([e],n,t,s)])}return l(i,G(e,i,x,t,s,u,d,p,m,S.failure))}}export{d as i,A as n,j as r,K as t};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import{t as e}from"./rolldown-runtime-Dd_uD5pT.js";import{i as t,n,r,t as i}from"./compat-BAGLwgqY.js";import"./libesm-BypnjKEL.js";import{t as a}from"./logger-DDBAeTLF.js";import{n as o}from"./utf16-clip-CGL7omVm.js";import{a as s}from"./feature-flags-DvsApnS-.js";import"./proxied-fetch-4VBgrEIu.js";import"./secret-topology-hMRoGGjt.js";import"./secrets-bridge-client-D734Xx8G.js";import"./image-markers-q8JQTtid.js";import"./tool-ui-eSQ1g2I1.js";var c={assign:0,create:0,clone:0,discard:0,update:0};function l(e){return Array.isArray(e)}function u(e){return f(e,null)}function d(e){return f(typeof e,`object`)&&!u(e)}function f(e,t){return e===t}function p(e){if(!d(e))return!1;let t=globalThis.Object.getPrototypeOf(e);return!u(t)&&f(typeof t.constructor,`function`)&&!(f(t.constructor,globalThis.Object)||f(t.constructor.name,`Object`))}function m(e){return f(e,`__proto__`)||f(e,`constructor`)||f(e,`prototype`)}function h(e,t){return m(t)?Object.prototype.hasOwnProperty.call(e,t):t in e}function g(e){return Object.getOwnPropertyNames(e)}function _(e){return Object.getOwnPropertySymbols(e)}function v(e){return globalThis.ArrayBuffer.isView(e)}function y(e){return e instanceof globalThis.RegExp}function b(e){return e instanceof globalThis.Set}function x(e){return e instanceof globalThis.Map}var S={immutableTypes:!1,maxErrors:8,maxInstantiationCount:128,useAcceleration:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1,correctiveParse:!1,unionPrioritySort:!0};function ee(){return S}function te(e){return ee().immutableTypes?Object.freeze(e):e}function ne(e){return e}function re(e){return h(e,`~kind`)||h(e,`~unsafe`)}function ie(e){let t={};for(let n of g(e)){if(m(n))continue;let r=Object.getOwnPropertyDescriptor(e,n);r.value=C(r.value),f(r.enumerable,!0)?t[n]=r.value:Object.defineProperty(t,n,r)}return t}function ae(e){let t={};for(let n of g(e))m(n)||(t[n]=C(e[n]));for(let n of _(e))t[n]=C(e[n]);return t}function oe(e){return p(e)?ne(e):re(e)?ie(e):ae(e)}function se(e){return e.map(e=>C(e))}function ce(e){return e.slice()}function le(e){return new RegExp(e.source,e.flags)}function ue(e){return new Map(C([...e.entries()]))}function de(e){return new Set(C([...e.values()]))}function C(e){return v(e)?ce(e):y(e)?le(e):x(e)?ue(e):b(e)?de(e):l(e)?se(e):d(e)?oe(e):e}function fe(e){return c.clone+=1,C(e)}function pe(e,t){for(let n of Object.keys(t))Object.defineProperty(e,n,{configurable:!0,writable:!0,enumerable:!1,value:t[n]});return e}function me(e,t){return{...e,...t}}function w(e,t,n={}){c.create+=1;let r=me(t,n);return te(ee().enumerableKind?me(r,e):pe(r,e))}function he(e,t,n){c.update+=1;let r=ee(),i=fe(e);for(let e of Object.keys(t))Object.defineProperty(i,e,{configurable:!0,writable:!0,enumerable:r.enumerableKind,value:t[e]});for(let e of Object.keys(n))Object.defineProperty(i,e,{configurable:!0,enumerable:!0,writable:!0,value:n[e]});return te(i)}function ge(e){return d(e)}function _e(e){return he(e,{"~optional":!0},{})}function ve(e,t){return he(_e(e),{},t)}function ye(e,t){return w({"~kind":`Array`},{type:`array`,items:e},t)}function be(e,t={}){return ve(e,t)}function T(e){return be(e)}function xe(e){return ge(e)&&h(e,`~optional`)}function Se(e){return g(e).filter(t=>!xe(e[t]))}function E(e,t={}){let n=Se(e);return w({"~kind":`Object`},{type:`object`,...n.length>0?{required:n}:{},properties:e},t)}var Ce;(function(e){e[e.Array=0]=`Array`,e[e.BigInt=1]=`BigInt`,e[e.Boolean=2]=`Boolean`,e[e.Date=3]=`Date`,e[e.Constructor=4]=`Constructor`,e[e.Function=5]=`Function`,e[e.Null=6]=`Null`,e[e.Number=7]=`Number`,e[e.Object=8]=`Object`,e[e.RegExp=9]=`RegExp`,e[e.String=10]=`String`,e[e.Symbol=11]=`Symbol`,e[e.TypeArray=12]=`TypeArray`,e[e.Undefined=13]=`Undefined`})(Ce||={}),Array.from({length:256}).map((e,t)=>BigInt(t));var we=new Float64Array(1);new DataView(we.buffer),new Uint8Array(we.buffer),new TextEncoder;var Te=`-?(?:0|[1-9][0-9]*)`,Ee=`-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?`;function De(e){return w({"~kind":`Number`},{type:`number`},e)}function D(e){return w({"~kind":`String`},{type:`string`},e)}var Oe=`^${Te}$`;`${Ee}`;function ke(e,t){return Array.from({length:t-e+1},(t,n)=>String.fromCharCode(e+n))}var Ae=[...ke(97,122),...ke(65,90)],je=[`0`,...ke(49,57)];[...je],[...Ae,...je],[...je],new RegExp(Oe);function Me(e,t){try{return Promise.resolve(t(Ne))}catch(e){return Promise.reject(e)}}var Ne={startSpan:Me,addEvent:()=>{},setAttributes:()=>{},setStatus:()=>{}};Object.freeze(Ne);var Pe=Object.freeze({token:Symbol(`chord.abortSignal`)}),Fe=class{get abortSignal(){return this.value(Pe)}},Ie=class extends Fe{#e;constructor(e){super(),this.#e=e}value(e){}toString(){return this.#e}};new Ie(`[Context BACKGROUND_CONTEXT]`),new Ie(`[Context TODO_CONTEXT]`);function Le(e){return Object.freeze({token:Symbol(e)})}Le(`pi.telemetryContext`);var Re={"pi.session.id":{type:`string`,required:!0,cardinality:`high`,description:`Session id`},"pi.lane.name":{type:`string`,required:!0,cardinality:`high`,description:`Lane name`},"pi.operation.id":{type:`string`,required:!0,cardinality:`high`,description:`Durable operation id`},"pi.operation.recovery":{type:`boolean`,required:!0,description:`Whether this invocation resumes durable work`}},ze={"pi.error.code":{type:`string`,cardinality:`low`,description:`Stable operation error code`},"pi.error.type":{type:`string`,cardinality:`low`,description:`Low-cardinality operation error class`}};({...Re}),{...ze},{...Re},{...ze},{...Re},{...ze};function Be(e,t){if(e.length===0)throw TypeError(`Value namespace must not be empty`);if(e.includes(`\0`))throw TypeError(`Value namespace must not contain \\u0000`);if(t.includes(`\0`))throw TypeError(`Value key must not contain \\u0000`)}function Ve(e,t=``){return Be(e,t),Object.freeze({namespace:e,key:t,kind:`value`})}Ve(`pi.session.name`);var He=Symbol.for(`yaml.alias`),Ue=Symbol.for(`yaml.document`),O=Symbol.for(`yaml.map`),We=Symbol.for(`yaml.pair`),Ge=Symbol.for(`yaml.scalar`),k=Symbol.for(`yaml.seq`),A=Symbol.for(`yaml.node.type`),j=e=>!!e&&typeof e==`object`&&e[A]===He,Ke=e=>!!e&&typeof e==`object`&&e[A]===Ue,qe=e=>!!e&&typeof e==`object`&&e[A]===O,M=e=>!!e&&typeof e==`object`&&e[A]===We,N=e=>!!e&&typeof e==`object`&&e[A]===Ge,Je=e=>!!e&&typeof e==`object`&&e[A]===k;function P(e){if(e&&typeof e==`object`)switch(e[A]){case O:case k:return!0}return!1}function F(e){if(e&&typeof e==`object`)switch(e[A]){case He:case O:case Ge:case k:return!0}return!1}var Ye=e=>(N(e)||P(e))&&!!e.anchor,I=Symbol(`break visit`),Xe=Symbol(`skip children`),L=Symbol(`remove node`);function Ze(e,t){let n=Qe(t);Ke(e)?R(null,e.contents,n,Object.freeze([e]))===L&&(e.contents=null):R(null,e,n,Object.freeze([]))}Ze.BREAK=I,Ze.SKIP=Xe,Ze.REMOVE=L;function R(e,t,n,r){let i=$e(e,t,n,r);if(F(i)||M(i))return et(e,r,i),R(e,i,n,r);if(typeof i!=`symbol`){if(P(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=R(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===I)return I;else i===L&&(t.items.splice(e,1),--e)}}else if(M(t)){r=Object.freeze(r.concat(t));let e=R(`key`,t.key,n,r);if(e===I)return I;e===L&&(t.key=null);let i=R(`value`,t.value,n,r);if(i===I)return I;i===L&&(t.value=null)}}return i}function Qe(e){return typeof e==`object`&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function $e(e,t,n,r){if(typeof n==`function`)return n(e,t,r);if(qe(t))return n.Map?.(e,t,r);if(Je(t))return n.Seq?.(e,t,r);if(M(t))return n.Pair?.(e,t,r);if(N(t))return n.Scalar?.(e,t,r);if(j(t))return n.Alias?.(e,t,r)}function et(e,t,n){let r=t[t.length-1];if(P(r))r.items[e]=n;else if(M(r))e===`key`?r.key=n:r.value=n;else if(Ke(r))r.contents=n;else{let e=j(r)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}function tt(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function z(e,t,n,r){if(r&&typeof r==`object`){if(Array.isArray(r))for(let t=0,n=r.length;t<n;++t){let n=r[t],i=z(e,r,String(t),n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}else if(r instanceof Map)for(let t of Array.from(r.keys())){let n=r.get(t),i=z(e,r,t,n);i===void 0?r.delete(t):i!==n&&r.set(t,i)}else if(r instanceof Set)for(let t of Array.from(r)){let n=z(e,r,t,t);n===void 0?r.delete(t):n!==t&&(r.delete(t),r.add(n))}else for(let[t,n]of Object.entries(r)){let i=z(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}}return e.call(t,n,r)}function B(e,t,n){if(Array.isArray(e))return e.map((e,t)=>B(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!Ye(e))return e.toJSON(t,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=e=>{r.res=e,delete n.onCreate};let i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e==`bigint`&&!n?.keep?Number(e):e}var nt=class{constructor(e){Object.defineProperty(this,A,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:r,reviver:i}={}){if(!Ke(e))throw TypeError(`A document argument is required`);let a={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n==`number`?n:100},o=B(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?z(i,{"":o},``,o):o}},rt=class extends nt{constructor(e){super(He),this.source=e,Object.defineProperty(this,"tag",{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError(`Alias resolution is disabled`);let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],Ze(e,{Node:(e,t)=>{(j(t)||Ye(t))&&n.push(t)}}),t&&(t.aliasResolveCache=n));let r;for(let e of n){if(e===this)break;e.anchor===this.source&&(r=e)}return r}toJSON(e,t){if(!t)return{source:this.source};let{anchors:n,doc:r,maxAliasCount:i}=t,a=this.resolve(r,t);if(!a){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}let o=n.get(a);if(o||=(B(a,null,t),n.get(a)),o?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(i>=0&&(o.count+=1,o.aliasCount===0&&(o.aliasCount=it(r,a,n)),o.count*o.aliasCount>i))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`);return o.res}toString(e,t,n){let r=`*${this.source}`;if(e){if(tt(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${r} `}return r}};function it(e,t,n){if(j(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(P(t)){let r=0;for(let i of t.items){let t=it(e,i,n);t>r&&(r=t)}return r}if(M(t)){let r=it(e,t.key,n),i=it(e,t.value,n);return Math.max(r,i)}return 1}var at=e=>!e||typeof e!=`function`&&typeof e!=`object`,V=class extends nt{constructor(e){super(Ge),this.value=e}toJSON(e,t){return t?.keep?this.value:B(this.value,e,t)}toString(){return String(this.value)}};V.BLOCK_FOLDED=`BLOCK_FOLDED`,V.BLOCK_LITERAL=`BLOCK_LITERAL`,V.PLAIN=`PLAIN`,V.QUOTE_DOUBLE=`QUOTE_DOUBLE`,V.QUOTE_SINGLE=`QUOTE_SINGLE`;var ot=`tag:yaml.org,2002:`;function st(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}function ct(e,t,n){if(Ke(e)&&(e=e.contents),F(e))return e;if(M(e)){let t=n.schema[O].createNode?.(n.schema,null,n);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<`u`&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:a,schema:o,sourceObjects:s}=n,c;if(r&&e&&typeof e==`object`){if(c=s.get(e),c)return c.anchor??(c.anchor=i(e)),new rt(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=ot+t.slice(2));let l=st(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new V(e);return c&&(c.node=t),t}l=e instanceof Map?o[O]:Symbol.iterator in Object(e)?o[k]:o[O]}a&&(a(l),delete n.onTagObj);let u=l?.createNode?l.createNode(n.schema,e,n):typeof l?.nodeClass?.from==`function`?l.nodeClass.from(n.schema,e,n):new V(e);return t?u.tag=t:l.default||(u.tag=l.tag),c&&(c.node=u),u}function lt(e,t,n){let r=n;for(let e=t.length-1;e>=0;--e){let n=t[e];if(typeof n==`number`&&Number.isInteger(n)&&n>=0){let e=[];e[n]=r,r=e}else r=new Map([[n,r]])}return ct(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:new Map})}var ut=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done,dt=class extends nt{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(t=>F(t)||M(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(ut(e))this.add(t);else{let[n,...r]=e,i=this.get(n,!0);if(P(i))i.addIn(r,t);else if(i===void 0&&this.schema)this.set(n,lt(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let r=this.get(t,!0);if(P(r))return r.deleteIn(n);throw Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...r]=e,i=this.get(n,!0);return r.length===0?!t&&N(i)?i.value:i:P(i)?i.getIn(r,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!M(t))return!1;let n=t.value;return n==null||e&&N(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(n.length===0)return this.has(t);let r=this.get(t,!0);return P(r)?r.hasIn(n):!1}setIn(e,t){let[n,...r]=e;if(r.length===0)this.set(n,t);else{let e=this.get(n,!0);if(P(e))e.setIn(r,t);else if(e===void 0&&this.schema)this.set(n,lt(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}},ft=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function H(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var U=(e,t,n)=>e.endsWith(`
|
|
2
|
+
`)?H(n,t):n.includes(`
|
|
3
|
+
`)?`
|
|
4
|
+
`+H(n,t):(e.endsWith(` `)?``:` `)+n,pt=`flow`,mt=`block`,ht=`quoted`;function gt(e,t,n=`flow`,{indentAtStart:r,lineWidth:i=80,minContentWidth:a=20,onFold:o,onOverflow:s}={}){if(!i||i<0)return e;i<a&&(a=0);let c=Math.max(1+a,1+i-t.length);if(e.length<=c)return e;let l=[],u={},d=i-t.length;typeof r==`number`&&(r>i-Math.max(2,a)?l.push(0):d=i-r);let f,p,m=!1,h=-1,g=-1,_=-1;n===`block`&&(h=_t(e,h,t.length),h!==-1&&(d=h+c));for(let r;r=e[h+=1];){if(n===`quoted`&&r===`\\`){switch(g=h,e[h+1]){case`x`:h+=3;break;case`u`:h+=5;break;case`U`:h+=9;break;default:h+=1}_=h}if(r===`
|
|
5
|
+
`)n===`block`&&(h=_t(e,h,t.length)),d=h+t.length+c,f=void 0;else{if(r===` `&&p&&p!==` `&&p!==`
|
|
6
|
+
`&&p!==` `){let t=e[h+1];t&&t!==` `&&t!==`
|
|
7
|
+
`&&t!==` `&&(f=h)}if(h>=d){if(f)l.push(f),d=f+c,f=void 0;else if(n===`quoted`){for(;p===` `||p===` `;)p=r,r=e[h+=1],m=!0;let t=h>_+1?h-2:g-1;if(u[t])return e;l.push(t),u[t]=!0,d=t+c,f=void 0}else m=!0}}p=r}if(m&&s&&s(),l.length===0)return e;o&&o();let v=e.slice(0,l[0]);for(let r=0;r<l.length;++r){let i=l[r],a=l[r+1]||e.length;i===0?v=`\n${t}${e.slice(0,a)}`:(n===`quoted`&&u[i]&&(v+=`${e[i]}\\`),v+=`\n${t}${e.slice(i+1,a)}`)}return v}function _t(e,t,n){let r=t,i=t+1,a=e[i];for(;a===` `||a===` `;)if(t<i+n)a=e[++t];else{do a=e[++t];while(a&&a!==`
|
|
8
|
+
`);r=t,i=t+1,a=e[i]}return r}var vt=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),yt=e=>/^(%|---|\.\.\.)/m.test(e);function bt(e,t,n){if(!t||t<0)return!1;let r=t-n,i=e.length;if(i<=r)return!1;for(let t=0,n=0;t<i;++t)if(e[t]===`
|
|
9
|
+
`){if(t-n>r)return!0;if(n=t+1,i-n<=r)return!1}return!0}function W(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=t,i=t.options.doubleQuotedMinMultiLineLength,a=t.indent||(yt(e)?` `:``),o=``,s=0;for(let e=0,t=n[e];t;t=n[++e])if(t===` `&&n[e+1]===`\\`&&n[e+2]===`n`&&(o+=n.slice(s,e)+`\\ `,e+=1,s=e,t=`\\`),t===`\\`)switch(n[e+1]){case`u`:{o+=n.slice(s,e);let t=n.substr(e+2,4);switch(t){case`0000`:o+=`\\0`;break;case`0007`:o+=`\\a`;break;case`000b`:o+=`\\v`;break;case`001b`:o+=`\\e`;break;case`0085`:o+=`\\N`;break;case`00a0`:o+=`\\_`;break;case`2028`:o+=`\\L`;break;case`2029`:o+=`\\P`;break;default:t.substr(0,2)===`00`?o+=`\\x`+t.substr(2):o+=n.substr(e,6)}e+=5,s=e+1}break;case`n`:if(r||n[e+2]===`"`||n.length<i)e+=1;else{for(o+=n.slice(s,e)+`
|
|
10
|
+
|
|
11
|
+
`;n[e+2]===`\\`&&n[e+3]===`n`&&n[e+4]!==`"`;)o+=`
|
|
12
|
+
`,e+=2;o+=a,n[e+2]===` `&&(o+=`\\`),e+=1,s=e+1}break;default:e+=1}return o=s?o+n.slice(s):n,r?o:gt(o,a,ht,vt(t,!1))}function xt(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
|
|
13
|
+
`)||/[ \t]\n|\n[ \t]/.test(e))return W(e,t);let n=t.indent||(yt(e)?` `:``),r=`'`+e.replace(/'/g,`''`).replace(/\n+/g,`$&\n${n}`)+`'`;return t.implicitKey?r:gt(r,n,pt,vt(t,!1))}function G(e,t){let{singleQuote:n}=t.options,r;if(n===!1)r=W;else{let t=e.includes(`"`),i=e.includes(`'`);r=t&&!i?xt:i&&!t?W:n?xt:W}return r(e,t)}var St;try{St=RegExp(`(^|(?<!
|
|
14
|
+
))
|
|
15
|
+
+(?!
|
|
16
|
+
|$)`,`g`)}catch{St=/\n+(?!\n|$)/g}function Ct({comment:e,type:t,value:n},r,i,a){let{blockQuote:o,commentString:s,lineWidth:c}=r.options;if(!o||/\n[\t ]+$/.test(n))return G(n,r);let l=r.indent||(r.forceBlockIndent||yt(n)?` `:``),u=o===`literal`?!0:o===`folded`||t===V.BLOCK_FOLDED?!1:t===V.BLOCK_LITERAL||!bt(n,c,l.length);if(!n)return u?`|
|
|
17
|
+
`:`>
|
|
18
|
+
`;let d,f;for(f=n.length;f>0;--f){let e=n[f-1];if(e!==`
|
|
19
|
+
`&&e!==` `&&e!==` `)break}let p=n.substring(f),m=p.indexOf(`
|
|
20
|
+
`);m===-1?d=`-`:n===p||m!==p.length-1?(d=`+`,a&&a()):d=``,p&&=(n=n.slice(0,-p.length),p[p.length-1]===`
|
|
21
|
+
`&&(p=p.slice(0,-1)),p.replace(St,`$&${l}`));let h=!1,g,_=-1;for(g=0;g<n.length;++g){let e=n[g];if(e===` `)h=!0;else if(e===`
|
|
22
|
+
`)_=g;else break}let v=n.substring(0,_<g?_+1:g);v&&=(n=n.substring(v.length),v.replace(/\n+/g,`$&${l}`));let y=(h?l?`2`:`1`:``)+d;if(e&&(y+=` `+s(e.replace(/ ?[\r\n]+/g,` `)),i&&i()),!u){let e=n.replace(/\n+/g,`
|
|
23
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\n+/g,`$&${l}`),i=!1,a=vt(r,!0);o!==`folded`&&t!==V.BLOCK_FOLDED&&(a.onOverflow=()=>{i=!0});let s=gt(`${v}${e}${p}`,l,mt,a);if(!i)return`>${y}\n${l}${s}`}return n=n.replace(/\n+/g,`$&${l}`),`|${y}\n${l}${v}${n}${p}`}function wt(e,t,n,r){let{type:i,value:a}=e,{actualString:o,implicitKey:s,indent:c,indentStep:l,inFlow:u}=t;if(s&&a.includes(`
|
|
24
|
+
`)||u&&/[[\]{},]/.test(a))return G(a,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||u||!a.includes(`
|
|
25
|
+
`)?G(a,t):Ct(e,t,n,r);if(!s&&!u&&i!==V.PLAIN&&a.includes(`
|
|
26
|
+
`))return Ct(e,t,n,r);if(yt(a)){if(c===``)return t.forceBlockIndent=!0,Ct(e,t,n,r);if(s&&c===l)return G(a,t)}let d=a.replace(/\n+/g,`$&\n${c}`);if(o){let e=e=>e.default&&e.tag!==`tag:yaml.org,2002:str`&&e.test?.test(d),{compat:n,tags:r}=t.doc.schema;if(r.some(e)||n?.some(e))return G(a,t)}return s?d:gt(d,c,pt,vt(t,!1))}function Tt(e,t,n,r){let{implicitKey:i,inFlow:a}=t,o=typeof e.value==`string`?e:Object.assign({},e,{value:String(e.value)}),{type:s}=e;s!==V.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=V.QUOTE_DOUBLE);let c=e=>{switch(e){case V.BLOCK_FOLDED:case V.BLOCK_LITERAL:return i||a?G(o.value,t):Ct(o,t,n,r);case V.QUOTE_DOUBLE:return W(o.value,t);case V.QUOTE_SINGLE:return xt(o.value,t);case V.PLAIN:return wt(o,t,n,r);default:return null}},l=c(s);if(l===null){let{defaultKeyType:e,defaultStringType:n}=t.options,r=i&&e||n;if(l=c(r),l===null)throw Error(`Unsupported default string type ${r}`)}return l}function Et(e,t){let n=Object.assign({blockQuote:!0,commentString:ft,defaultKeyType:null,defaultStringType:`PLAIN`,directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:`false`,flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:`null`,simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:`true`,verifyAliasOrder:!0},e.schema.toStringOptions,t),r;switch(n.collectionStyle){case`block`:r=!1;break;case`flow`:r=!0;break;default:r=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?` `:``,indent:``,indentStep:typeof n.indent==`number`?` `.repeat(n.indent):` `,inFlow:r,options:n}}function Dt(e,t){if(t.tag){let n=e.filter(e=>e.tag===t.tag);if(n.length>0)return n.find(e=>e.format===t.format)??n[0]}let n,r;if(N(t)){r=t.value;let i=e.filter(e=>e.identify?.(r));if(i.length>1){let e=i.filter(e=>e.test);e.length>0&&(i=e)}n=i.find(e=>e.format===t.format)??i.find(e=>!e.format)}else r=t,n=e.find(e=>e.nodeClass&&r instanceof e.nodeClass);if(!n){let e=r?.constructor?.name??(r===null?`null`:typeof r);throw Error(`Tag not resolved for ${e} value`)}return n}function Ot(e,t,{anchors:n,doc:r}){if(!r.directives)return``;let i=[],a=(N(e)||P(e))&&e.anchor;a&&tt(a)&&(n.add(a),i.push(`&${a}`));let o=e.tag??(t.default?null:t.tag);return o&&i.push(r.directives.tagString(o)),i.join(` `)}function kt(e,t,n,r){if(M(e))return e.toString(t,n,r);if(j(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw TypeError(`Cannot stringify circular structure without alias nodes`);t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let i,a=F(e)?e:t.doc.createNode(e,{onTagObj:e=>i=e});i??=Dt(t.doc.schema.tags,a);let o=Ot(a,i,t);o.length>0&&(t.indentAtStart=(t.indentAtStart??0)+o.length+1);let s=typeof i.stringify==`function`?i.stringify(a,t,n,r):N(a)?Tt(a,t,n,r):a.toString(t,n,r);return o?N(a)||s[0]===`{`||s[0]===`[`?`${o} ${s}`:`${o}\n${t.indent}${s}`:s}function At({key:e,value:t},n,r,i){let{allNullValues:a,doc:o,indent:s,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=n,f=F(e)&&e.comment||null;if(d){if(f)throw Error(`With simple keys, key nodes cannot have comments`);if(P(e)||!F(e)&&typeof e==`object`)throw Error(`With simple keys, collection cannot be used as a key value`)}let p=!d&&(!e||f&&t==null&&!n.inFlow||P(e)||(N(e)?e.type===V.BLOCK_FOLDED||e.type===V.BLOCK_LITERAL:typeof e==`object`));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(d||!a),indent:s+c});let m=!1,h=!1,g=kt(e,n,()=>m=!0,()=>h=!0);if(!p&&!n.inFlow&&g.length>1024){if(d)throw Error(`With simple keys, single line scalar must not span more than 1024 characters`);p=!0}if(n.inFlow){if(a||t==null)return m&&r&&r(),g===``?`?`:p?`? ${g}`:g}else if(a&&!d||t==null&&p)return g=`? ${g}`,f&&!m?g+=U(g,n.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=U(g,n.indent,l(f))),g=`? ${g}\n${s}:`):(g=`${g}:`,f&&(g+=U(g,n.indent,l(f))));let _,v,y;F(t)?(_=!!t.spaceBefore,v=t.commentBefore,y=t.comment):(_=!1,v=null,y=null,t&&typeof t==`object`&&(t=o.createNode(t))),n.implicitKey=!1,!p&&!f&&N(t)&&(n.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!n.inFlow&&!p&&Je(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let b=!1,x=kt(t,n,()=>b=!0,()=>h=!0),S=` `;if(f||_||v){if(S=_?`
|
|
27
|
+
`:``,v){let e=l(v);S+=`\n${H(e,n.indent)}`}x===``&&!n.inFlow?S===`
|
|
28
|
+
`&&y&&(S=`
|
|
29
|
+
|
|
30
|
+
`):S+=`\n${n.indent}`}else if(!p&&P(t)){let e=x[0],r=x.indexOf(`
|
|
31
|
+
`),i=r!==-1,a=n.inFlow??t.flow??t.items.length===0;if(i||!a){let t=!1;if(i&&(e===`&`||e===`!`)){let n=x.indexOf(` `);e===`&`&&n!==-1&&n<r&&x[n+1]===`!`&&(n=x.indexOf(` `,n+1)),(n===-1||r<n)&&(t=!0)}t||(S=`\n${n.indent}`)}}else(x===``||x[0]===`
|
|
32
|
+
`)&&(S=``);return g+=S+x,n.inFlow?b&&r&&r():y&&!b?g+=U(g,n.indent,l(y)):h&&i&&i(),g}function jt(e,t){(e===`debug`||e===`warn`)&&console.warn(t)}var Mt=`<<`,Nt={identify:e=>e===Mt||typeof e==`symbol`&&e.description===Mt,default:`key`,tag:`tag:yaml.org,2002:merge`,test:/^<<$/,resolve:()=>Object.assign(new V(Symbol(Mt)),{addToJSMap:Ft}),stringify:()=>Mt},Pt=(e,t)=>(Nt.identify(t)||N(t)&&(!t.type||t.type===V.PLAIN)&&Nt.identify(t.value))&&e?.doc.schema.tags.some(e=>e.tag===Nt.tag&&e.default);function Ft(e,t,n){let r=Lt(e,n);if(Je(r))for(let n of r.items)It(e,t,n);else if(Array.isArray(r))for(let n of r)It(e,t,n);else It(e,t,r)}function It(e,t,n){let r=Lt(e,n);if(!qe(r))throw Error(`Merge sources must be maps or map aliases`);let i=r.toJSON(null,e,Map);for(let[e,n]of i)t instanceof Map?t.has(e)||t.set(e,n):t instanceof Set?t.add(e):Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0});return t}function Lt(e,t){return e&&j(t)?t.resolve(e.doc,e):t}function Rt(e,t,{key:n,value:r}){if(F(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(Pt(e,n))Ft(e,t,r);else{let i=B(n,``,e);if(t instanceof Map)t.set(i,B(r,i,e));else if(t instanceof Set)t.add(i);else{let a=zt(n,i,e),o=B(r,a,e);a in t?Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[a]=o}}return t}function zt(e,t,n){if(t===null)return``;if(typeof t!=`object`)return String(t);if(F(e)&&n?.doc){let t=Et(n.doc,{});t.anchors=new Set;for(let e of n.anchors.keys())t.anchors.add(e.anchor);t.inFlow=!0,t.inStringifyKey=!0;let r=e.toString(t);if(!n.mapKeyWarned){let e=JSON.stringify(r);e.length>40&&(e=e.substring(0,36)+`..."`),jt(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${e}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return r}return JSON.stringify(t)}function Bt(e,t,n){return new K(ct(e,void 0,n),ct(t,void 0,n))}var K=class e{constructor(e,t=null){Object.defineProperty(this,A,{value:We}),this.key=e,this.value=t}clone(t){let{key:n,value:r}=this;return F(n)&&(n=n.clone(t)),F(r)&&(r=r.clone(t)),new e(n,r)}toJSON(e,t){return Rt(t,t?.mapAsMap?new Map:{},this)}toString(e,t,n){return e?.doc?At(this,e,t,n):JSON.stringify(this)}};function Vt(e,t,n){return(t.inFlow??e.flow?Ut:Ht)(e,t,n)}function Ht({comment:e,items:t},n,{blockItemPrefix:r,flowChars:i,itemIndent:a,onChompKeep:o,onComment:s}){let{indent:c,options:{commentString:l}}=n,u=Object.assign({},n,{indent:a,type:null}),d=!1,f=[];for(let e=0;e<t.length;++e){let i=t[e],o=null;if(F(i))!d&&i.spaceBefore&&f.push(``),Wt(n,f,i.commentBefore,d),i.comment&&(o=i.comment);else if(M(i)){let e=F(i.key)?i.key:null;e&&(!d&&e.spaceBefore&&f.push(``),Wt(n,f,e.commentBefore,d))}d=!1;let s=kt(i,u,()=>o=null,()=>d=!0);o&&(s+=U(s,a,l(o))),d&&o&&(d=!1),f.push(r+s)}let p;if(f.length===0)p=i.start+i.end;else{p=f[0];for(let e=1;e<f.length;++e){let t=f[e];p+=t?`\n${c}${t}`:`
|
|
33
|
+
`}}return e?(p+=`
|
|
34
|
+
`+H(l(e),c),s&&s()):d&&o&&o(),p}function Ut({items:e},t,{flowChars:n,itemIndent:r}){let{indent:i,indentStep:a,flowCollectionPadding:o,options:{commentString:s}}=t;r+=a;let c=Object.assign({},t,{indent:r,inFlow:!0,type:null}),l=!1,u=0,d=[];for(let n=0;n<e.length;++n){let i=e[n],a=null;if(F(i))i.spaceBefore&&d.push(``),Wt(t,d,i.commentBefore,!1),i.comment&&(a=i.comment);else if(M(i)){let e=F(i.key)?i.key:null;e&&(e.spaceBefore&&d.push(``),Wt(t,d,e.commentBefore,!1),e.comment&&(l=!0));let n=F(i.value)?i.value:null;n?(n.comment&&(a=n.comment),n.commentBefore&&(l=!0)):i.value==null&&e?.comment&&(a=e.comment)}a&&(l=!0);let o=kt(i,c,()=>a=null);l||=d.length>u||o.includes(`
|
|
35
|
+
`),n<e.length-1?o+=`,`:t.options.trailingComma&&(t.options.lineWidth>0&&(l||=d.reduce((e,t)=>e+t.length+2,2)+(o.length+2)>t.options.lineWidth),l&&(o+=`,`)),a&&(o+=U(o,r,s(a))),d.push(o),u=d.length}let{start:f,end:p}=n;if(d.length===0)return f+p;if(!l){let e=d.reduce((e,t)=>e+t.length+2,2);l=t.options.lineWidth>0&&e>t.options.lineWidth}if(l){let e=f;for(let t of d)e+=t?`\n${a}${i}${t}`:`
|
|
36
|
+
`;return`${e}\n${i}${p}`}return`${f}${o}${d.join(` `)}${o}${p}`}function Wt({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,``)),r){let i=H(t(r),e);n.push(i.trimStart())}}function q(e,t){let n=N(t)?t.value:t;for(let r of e)if(M(r)&&(r.key===t||r.key===n||N(r.key)&&r.key.value===n))return r}var J=class extends dt{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(O,e),this.items=[]}static from(e,t,n){let{keepUndefined:r,replacer:i}=n,a=new this(e),o=(e,o)=>{if(typeof i==`function`)o=i.call(t,e,o);else if(Array.isArray(i)&&!i.includes(e))return;(o!==void 0||r)&&a.items.push(Bt(e,o,n))};if(t instanceof Map)for(let[e,n]of t)o(e,n);else if(t&&typeof t==`object`)for(let e of Object.keys(t))o(e,t[e]);return typeof e.sortMapEntries==`function`&&a.items.sort(e.sortMapEntries),a}add(e,t){let n;n=M(e)?e:!e||typeof e!=`object`||!(`key`in e)?new K(e,e?.value):new K(e.key,e.value);let r=q(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);N(r.value)&&at(n.value)?r.value.value=n.value:r.value=n.value}else if(i){let e=this.items.findIndex(e=>i(n,e)<0);e===-1?this.items.push(n):this.items.splice(e,0,n)}else this.items.push(n)}delete(e){let t=q(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=q(this.items,e)?.value;return(!t&&N(n)?n.value:n)??void 0}has(e){return!!q(this.items,e)}set(e,t){this.add(new K(e,t),!0)}toJSON(e,t,n){let r=n?new n:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(r);for(let e of this.items)Rt(t,r,e);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(let e of this.items)if(!M(e))throw Error(`Map items must all be pairs; found ${JSON.stringify(e)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),Vt(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:n,onComment:t})}},Gt={collection:`map`,default:!0,nodeClass:J,tag:`tag:yaml.org,2002:map`,resolve(e,t){return qe(e)||t(`Expected a mapping for this tag`),e},createNode:(e,t,n)=>J.from(e,t,n)},Kt=class extends dt{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(k,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=qt(e);return typeof t==`number`&&this.items.splice(t,1).length>0}get(e,t){let n=qt(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&N(r)?r.value:r}has(e){let t=qt(e);return typeof t==`number`&&t<this.items.length}set(e,t){let n=qt(e);if(typeof n!=`number`)throw Error(`Expected a valid index, not ${e}.`);let r=this.items[n];N(r)&&at(t)?r.value=t:this.items[n]=t}toJSON(e,t){let n=[];t?.onCreate&&t.onCreate(n);let r=0;for(let e of this.items)n.push(B(e,String(r++),t));return n}toString(e,t,n){return e?Vt(this,e,{blockItemPrefix:`- `,flowChars:{start:`[`,end:`]`},itemIndent:(e.indent||``)+` `,onChompKeep:n,onComment:t}):JSON.stringify(this)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t)){let e=0;for(let a of t){if(typeof r==`function`){let n=t instanceof Set?a:String(e++);a=r.call(t,n,a)}i.items.push(ct(a,void 0,n))}}return i}};function qt(e){let t=N(e)?e.value:e;return t&&typeof t==`string`&&(t=Number(t)),typeof t==`number`&&Number.isInteger(t)&&t>=0?t:null}var Jt={collection:`seq`,default:!0,nodeClass:Kt,tag:`tag:yaml.org,2002:seq`,resolve(e,t){return Je(e)||t(`Expected a sequence for this tag`),e},createNode:(e,t,n)=>Kt.from(e,t,n)};function Yt(e){return typeof e==`bigint`||Number.isInteger(e)}var Xt=({value:e})=>JSON.stringify(e),Zt=[{identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify:Xt},{identify:e=>e==null,createNode:()=>new V(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^null$/,resolve:()=>null,stringify:Xt},{identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^true$|^false$/,resolve:e=>e===`true`,stringify:Xt},{identify:Yt,default:!0,tag:`tag:yaml.org,2002:int`,test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>Yt(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:Xt}];[Gt,Jt].concat(Zt,{default:!0,tag:``,test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}});function Qt(e,t,n){let{replacer:r}=n,i=new Kt(e);i.tag=`tag:yaml.org,2002:pairs`;let a=0;if(t&&Symbol.iterator in Object(t))for(let e of t){typeof r==`function`&&(e=r.call(t,String(a++),e));let o,s;if(Array.isArray(e)){if(e.length===2)o=e[0],s=e[1];else throw TypeError(`Expected [key, value] tuple: ${e}`)}else if(e&&e instanceof Object){let t=Object.keys(e);if(t.length===1)o=t[0],s=e[o];else throw TypeError(`Expected tuple with one key, not ${t.length} keys`)}else o=e;i.items.push(Bt(o,s,n))}return i}var $t=class e extends Kt{constructor(){super(),this.add=J.prototype.add.bind(this),this.delete=J.prototype.delete.bind(this),this.get=J.prototype.get.bind(this),this.has=J.prototype.has.bind(this),this.set=J.prototype.set.bind(this),this.tag=e.tag}toJSON(e,t){if(!t)return super.toJSON(e);let n=new Map;t?.onCreate&&t.onCreate(n);for(let e of this.items){let r,i;if(M(e)?(r=B(e.key,``,t),i=B(e.value,r,t)):r=B(e,``,t),n.has(r))throw Error(`Ordered maps must not include duplicate keys`);n.set(r,i)}return n}static from(e,t,n){let r=Qt(e,t,n),i=new this;return i.items=r.items,i}};$t.tag=`tag:yaml.org,2002:omap`;var en=class e extends J{constructor(t){super(t),this.tag=e.tag}add(e){let t;t=M(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new K(e.key,null):new K(e,null),q(this.items,t.key)||this.items.push(t)}get(e,t){let n=q(this.items,e);return!t&&M(n)?N(n.key)?n.key.value:n.key:n}set(e,t){if(typeof t!=`boolean`)throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let n=q(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new K(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw Error(`Set items must all have null values`)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t))for(let e of t)typeof r==`function`&&(e=r.call(t,e,e)),i.items.push(Bt(e,null,n));return i}};en.tag=`tag:yaml.org,2002:set`;var tn=Symbol(`break visit`),nn=Symbol(`skip children`),rn=Symbol(`remove item`);function Y(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),an(Object.freeze([]),e,t)}Y.BREAK=tn,Y.SKIP=nn,Y.REMOVE=rn,Y.itemAtPath=(e,t)=>{let n=e;for(let[e,r]of t){let t=n?.[e];if(t&&`items`in t)n=t.items[r];else return}return n},Y.parentCollection=(e,t)=>{let n=Y.itemAtPath(e,t.slice(0,-1)),r=t[t.length-1][0],i=n?.[r];if(i&&`items`in i)return i;throw Error(`Parent collection not found`)};function an(e,t,n){let r=n(t,e);if(typeof r==`symbol`)return r;for(let i of[`key`,`value`]){let a=t[i];if(a&&`items`in a){for(let t=0;t<a.items.length;++t){let r=an(Object.freeze(e.concat([[i,t]])),a.items[t],n);if(typeof r==`number`)t=r-1;else if(r===tn)return tn;else r===rn&&(a.items.splice(t,1),--t)}typeof r==`function`&&i===`key`&&(r=r(t,e))}}return typeof r==`function`?r(t,e):r}e(((e,t)=>{function n(e){return Array.isArray(e)?e:[e]}var r=/[.*+?()[\]{}^$|\\/]/,i=/^ +$/,a=/(?:[^\\]|^)\\$/,o=/^\\!/,s=/^\\#/,c=/\r?\n/g,l=`/`,u=`node-ignore`;typeof Symbol<`u`&&(u=Symbol.for(`node-ignore`));var d=u,f=(e,t,n)=>(Object.defineProperty(e,t,{value:n}),n),p=()=>!1,m=e=>{let{length:t}=e;return e.slice(0,t-t%2)},h={alnum:`0-9A-Za-z`,alpha:`A-Za-z`,blank:` \\t`,cntrl:`\\x00-\\x1f\\x7f`,digit:`0-9`,graph:`!-.0-~`,lower:`a-z`,print:` -.0-~`,punct:"!-.:-@\\[-`{-~",space:` \\t\\n\\r`,upper:`A-Z`,xdigit:`0-9A-Fa-f`},g=`\\]^-[`,_=e=>g.indexOf(e)<0?e:`\\`+e,v=`(?!\\/)`,y=(e,t)=>{if(e)return`[^\\/${t}]`;let n=`[${t}]`;return new RegExp(n).test(`/`)?v+n:n},b=(e,t)=>{let{length:n}=e,r=t+1,i=``,a=e[r];(a===`!`||a===`^`)&&(i=`^`,r++);let o=``,s=``;for(;;){let t=e[r];if(t===void 0)return null;if(t===`\\`){let t=e[r+1];if(t===void 0)return null;o+=_(t),s=t,r++}else if(t===`-`&&s&&r+1<n&&e[r+1]!==`]`){r++;let t=e[r];t===`\\`&&(t=e[r+=1]),s<=t&&(o+=`-${_(t)}`),s=``}else if(t===`[`&&e[r+1]===`:`){let t=r+2,i=t;for(;i<n&&e[i]!==`]`;)i++;if(i===n)return null;if(i>t&&e[i-1]===`:`){let n=h[e.slice(t,i-1)];if(n===void 0)return null;o+=n,s=``,r=i}else o+=_(`[`),s=`[`,r=t-2}else o+=_(t),s=t;if(r++,e[r]===`]`)return{end:r,source:y(i,o)}}},x=`[]`,S=`\0`,ee=RegExp(`${S}(\\d+)${S}`,`g`),te=``,ne=e=>{let t=[],n=e=>`${S}${t.push(e)-1}${S}`,{length:i}=e,a=``,o=0;for(;o<i;){let t=e[o];if(t===`\\`){let t=e[o+1];a+=t===`*`||t===`[`||t===` `||t===`\\`?e.slice(o,o+2):n(r.test(t)?`\\`+t:t),o+=2}else if(t===S)a+=n(`[${S}]`),o++;else if(t===`[`){let t=b(e,o);t===null?(a+=n(x),o=i):(a+=n(t.source),o=t.end+1)}else a+=t,o++}return{source:a,sources:t}},re=null,ie=/\/(?!$)/,ae=[[/^\uFEFF/,()=>``,``],[/[\r\n]+$/,()=>``],[/((?:\\\\)*?)(\\? +)$/,(e,t,n)=>t+(n.indexOf(`\\`)===0?` `:``)],[/(\\+?) /g,(e,t)=>{let{length:n}=t;return t.slice(0,n-n%2)+` `}],[/[\\$.|*+(){^]/g,e=>`\\${e}`],[/(?!\\)\?/g,()=>`[^/]`,`?`],[/^\//,()=>`^`,l],[/\//g,()=>`\\/`,l],[/^\^*(?:\\\*\\\*\\\/)+/,()=>`^(?:.*\\/)?`,`*`],[re,(e,t)=>!e||e[0]===`^`?e:(ie.test(t)?`^`:`(?:^|\\/)`)+e],[/\\\/\\\*\\\*(?=\\\/|$)/g,(e,t,n)=>t+6<n.length?n.slice(t+6)===`\\/`?`(?:\\/[^\\/]+)+`:`(?:\\/[^\\/]+)*`:`\\/.+`,`*`],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(e,t,n)=>t+n.replace(/\\\*/g,`[^\\/]*`),`*`],[/(^|[^\\])((?:\\\\)*)\\\*$/,(e,t,n)=>n.length/2%2==0?t+n+te:e,`*`],[/\\\\\\(?=[$.|*+(){^])/g,()=>`\\`,`\\\\`],[/\\\\/g,()=>`\\`,`\\\\`],[/\\\[([^\]/]*?)(\\*)($|\])/g,(e,t,n,r)=>`\\[${t}${m(n)}${r}`,`[`],[re,e=>{let t=e[e.length-1];return!t||t===te?e:t===l?`${e}$`:`${e}(?=$|\\/$)`}]],oe=/(^|\\\/)?\uE000$/,se=`regex`,ce=`checkRegex`,le={[se](e,t){return`${t?`${t}[^/]+`:`[^/]*`}(?=$|\\/$)`},[ce](e,t){return`${t?`${t}[^/]*`:`[^/]*`}(?=$|\\/$)`}},ue=`[^\\/]*`,de=e=>{if(e.indexOf(ue)<0)return e;let t=[],{length:n}=e,r=0;for(;r<n;){let i=e[r];if(e.startsWith(ue,r))t.push({wildcard:!0}),r+=6;else if(i===`[`){let i=r+1;for(e[i]===`^`&&i++,e[i]===`]`&&i++;i<n&&e[i]!==`]`;)i+=e[i]===`\\`?2:1;i++,t.push({single:e.slice(r,i)}),r=i}else if(i===`\\`)t.push({single:e.slice(r,r+2)}),r+=2;else if(i===`(`){let i=0,a=r;do e[a]===`\\`?a++:e[a]===`(`?i++:e[a]===`)`&&i--,a++;while(a<n&&i>0);`*+?`.indexOf(e[a])>=0&&a++,t.push({boundary:e.slice(r,a)}),r=a}else i===`^`||i===`$`?(t.push({boundary:i}),r++):(t.push({single:i}),r++)}let i=``,a=[],o=()=>{let e;a.forEach((t,n)=>{t.wildcard&&(e=n)}),a.forEach((t,n)=>{if(!t.wildcard){i+=t.single;return}i+=n===e?ue:`(?:(?!${a[n+1].single})[^\\/])*`}),a=[]};return t.forEach(e=>{if(e.boundary===void 0){a.push(e);return}o(),i+=e.boundary}),o(),i},C=e=>{let{source:t,sources:n}=ne(e),r=ae.reduce((t,[n,r,i])=>n===re?r(t,e):i!==void 0&&t.indexOf(i)<0?t:n.test(t)?t.replace(n,r.bind(e)):t,t);return n.length?r.replace(ee,(e,t)=>n[t]):r},fe=e=>{let t=e.indexOf(l);return t<0||t===e.length-1},pe=e=>{let t=e.length-1,n=e.lastIndexOf(l,e[t]===l?t-1:t);return n<0?e:e.slice(n+1)},me=e=>{if(e.charCodeAt(0)===47||e.indexOf(`//`)>=0){let t=e.split(l).filter(Boolean);return t.pop(),t.length?t.join(l)+l:``}let t=e.length-1,n=e.lastIndexOf(l,e.charCodeAt(t)===47?t-1:t);return n<0?``:e.slice(0,n+1)},w=e=>typeof e==`string`,he=e=>e&&w(e)&&!i.test(e)&&!a.test(e)&&e.indexOf(`#`)!==0,ge=e=>e.split(c).filter(Boolean),_e=class{constructor(e,t,n,r,i,a){this.pattern=e,this.mark=t,this.negative=i,f(this,`body`,n),f(this,`ignoreCase`,r),f(this,`regexPrefix`,a)}get _basenameOnly(){return f(this,`_basenameOnly`,fe(this.body))}get regex(){let e=`_regex`;return this[e]?this[e]:this._make(se,e)}get checkRegex(){let e=`_checkRegex`;return this[e]?this[e]:this._make(ce,e)}_make(e,t){let n=de(this.regexPrefix.replace(oe,le[e])),r=this.ignoreCase?new RegExp(n,`i`):new RegExp(n);return f(this,t,r)}},ve=({pattern:e,mark:t},n)=>{let r=!1,i=e;i.indexOf(`!`)===0&&(r=!0,i=i.substr(1)),i=i.replace(o,`!`).replace(s,`#`);let a=C(i);return new _e(e,t,i,n,r,a)},ye=class{constructor(e){this._ignoreCase=e,this._rules=[],this._basenameCount=0}_add(e){if(e&&e[d]){this._rules=this._rules.concat(e._rules._rules),this._basenameCount+=e._rules._basenameCount,this._added=!0;return}if(w(e)&&(e={pattern:e}),he(e.pattern)){let t=ve(e,this._ignoreCase);this._added=!0,this._rules.push(t),fe(t.body)&&this._basenameCount++}}add(e){return this._added=!1,n(w(e)?ge(e):e).forEach(this._add,this),this._added}test(e,t,n){let r=!1,i=!1,a,o=this._rules,{length:s}=o,c=this._basenameCount*2>=s,l=c?pe(e):e;for(let u=0;u<s;u++){let s=o[u],{negative:d}=s;!(i===d&&r!==i||d&&!r&&!i&&!t)&&s[n].test(c&&s._basenameOnly?l:e)&&(r=!d,i=d,a=d?void 0:s)}let u={ignored:r,unignored:i};return a&&(u.rule=a),u}},be=(e,t)=>{throw new t(e)},T=(e,t,n)=>w(e)?e?!T.isNotRelative(e)||n(`path should be a \`path.relative()\`d string, but got "${t}"`,RangeError):n(`path must not be empty`,TypeError):n(`path must be a string, but got \`${t}\``,TypeError),xe=e=>{let t=e.charCodeAt(0);if(t===47)return!0;if(t!==46)return!1;if(e.length===1)return!0;let n=e.charCodeAt(1);return n===47?!0:n===46?e.length===2||e.charCodeAt(2)===47:!1};T.isNotRelative=xe,T.convert=e=>e;var Se=class{constructor({ignorecase:e=!0,ignoreCase:t=e,allowRelativePaths:n=!1}={}){f(this,d,!0),this._rules=new ye(t),this._strictPathCheck=!n,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}add(e){return this._rules.add(e)&&this._initCache(),this}addPattern(e){return this.add(e)}_test(e,t,n){let r=e&&T.convert(e);return T(r,e,this._strictPathCheck?be:p),this._t(r,t,n)}checkIgnore(e){if(e.charCodeAt(e.length-1)!==47)return this.test(e);let t=me(e);if(t){let e=this._t(t,this._testCache,!0);if(e.ignored)return e}return this._rules.test(e,!1,ce)}_t(e,t,n){if(e in t)return t[e];let r=me(e),i=r?this._t(r,t,n):void 0;return t[e]=i&&i.ignored?i:this._rules.test(e,n,se)}ignores(e){return this._test(e,this._ignoreCache,!1).ignored}createFilter(){return e=>!this.ignores(e)}filter(e){return n(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}},E=e=>new Se(e),Ce=e=>T(e&&T.convert(e),e,p),we=()=>{T.convert=e=>/^\\\\\?\\/.test(e)||/["<>|\u0000-\u001F]+/u.test(e)?e:e.replace(/\\/g,`/`);let e=/^[a-z]:\//i;T.isNotRelative=t=>e.test(t)||xe(t)};typeof process<`u`&&process.platform===`win32`&&we(),t.exports=E,E.default=E,t.exports.isPathValid=Ce,f(t.exports,Symbol.for(`setupWindows`),we)}))(),globalThis.Buffer,new TextEncoder,new TextDecoder,E({command:D({description:`Bash command to execute`}),timeout:T(De({description:`Timeout in seconds (optional, no default timeout)`}))});var on=E({oldText:D({description:`Exact text for one targeted replacement. It must be unique in the original file and must not overlap with any other edits[].oldText in the same call.`}),newText:D({description:`Replacement text for this targeted edit.`})},{});E({path:D({description:`Path to the file to edit (relative or absolute)`}),edits:ye(on,{description:`One or more targeted replacements. Each edit is matched against the original file, not incrementally. Do not include overlapping or nested edits. If two changes touch the same block or nearby lines, merge them into one edit instead.`})},{}),E({path:D({description:`Path to the file to read (relative or absolute)`}),offset:T(De({description:`Line number to start reading from (1-indexed)`})),limit:T(De({description:`Maximum number of lines to read`}))}),E({path:D({description:`Path to the file to write (relative or absolute)`}),content:D({description:`Content to write to the file`})}),a(`context-compaction`);function sn(e){let t=[];for(let n of e){let e=n;switch(e.role){case`user`:t.push(`<user>\n${ln(e.content)}\n</user>`);break;case`assistant`:t.push(`<assistant>\n${ln(e.content)}\n</assistant>`);break;case`toolResult`:{let n=e.toolName??`tool`;t.push(`<tool-result name="${n}">\n${ln(e.content)}\n</tool-result>`);break}case`bashExecution`:t.push(`<bash>\n$ ${e.command??``}\n${e.output??``}\n</bash>`);break;case`branchSummary`:case`compactionSummary`:t.push(`<prior-summary>\n${e.summary??``}\n</prior-summary>`);break;default:t.push(`<${e.role}>\n${ln(e.content)}\n</${e.role}>`)}}return t.join(`
|
|
37
|
+
|
|
38
|
+
`)}var cn=/\n*The full transcript of the conversation before this compaction is saved at \S+ — read it when the summary is not enough\.?/g;function ln(e){if(typeof e==`string`)return e.replace(cn,``);if(!Array.isArray(e))return``;let t=[];for(let n of e){let e=n;e.type===`text`&&e.text?t.push(e.text.replace(cn,``)):e.type===`thinking`&&e.thinking?t.push(`[thinking] ${e.thinking}`):e.type===`toolCall`?t.push(`[tool-call ${e.name??`?`}] ${JSON.stringify(e.arguments??{})}`):e.type===`image`&&t.push(`[image]`)}return t.join(`
|
|
39
|
+
`)}var un=`From the conversation above, extract durable memories worth persisting to a global memory file shared across future sessions.
|
|
40
|
+
|
|
41
|
+
Focus on:
|
|
42
|
+
- User preferences, working style, opinions stated explicitly.
|
|
43
|
+
- Stable project facts (architecture decisions, conventions, constraints).
|
|
44
|
+
- Validated approaches the user accepted ("yes, exactly", "perfect"), not just corrections.
|
|
45
|
+
- External resources/links the user named.
|
|
46
|
+
|
|
47
|
+
DO NOT include:
|
|
48
|
+
- Ephemeral state (current task, in-progress work).
|
|
49
|
+
- Information already obvious from the codebase (file paths, function names, framework conventions).
|
|
50
|
+
- Generic restatements of what the conversation was about.
|
|
51
|
+
|
|
52
|
+
If nothing in the conversation is worth persisting, return exactly the single line:
|
|
53
|
+
NONE
|
|
54
|
+
|
|
55
|
+
Otherwise, output ONLY a markdown bullet list (one bullet per memory), no headers, no preamble, no follow-up. Each bullet is one line. Be specific. Prefer one fact per bullet over multi-clause sentences.`;function dn(e){return`You are a context compaction assistant. You are shown the prefix of a conversation between a user and an AI coding assistant, and asked to produce either a structured summary, durable memory bullets, or a short title — depending on the user's instruction.
|
|
56
|
+
|
|
57
|
+
Do NOT continue the conversation. Do NOT answer questions inside the conversation. Output ONLY what the user asks for in the format specified.
|
|
58
|
+
|
|
59
|
+
<conversation>
|
|
60
|
+
${e}
|
|
61
|
+
</conversation>`}var X=class extends Error{failure;constructor(e,t){super(t),this.failure=e,this.name=`CompactionCallError`}};function fn(e){if(e instanceof X)return e.failure;let t=typeof e==`object`&&e?e:void 0,n=t?.status??t?.statusCode??t?.code,r=typeof t?.message==`string`?t.message.toLowerCase():String(e).toLowerCase();return n===429||n===`429`||/rate[ -]?limit|too many requests|throttl/.test(r)?`rate-limit`:/quota|credit|budget|billing|allowance|resource exhausted/.test(r)?`quota-exhausted`:n===401||n===`401`||/unauthori[sz]ed|authentication|invalid api.?key|invalid x-api-key|session expired/.test(r)?`authentication`:typeof n==`number`&&n>=500||typeof n==`string`&&/^5\d\d$/.test(n)||/service unavailable|provider unavailable|overloaded|outage|timed? out|timeout|network|fetch failed|connection/.test(r)?`provider-unavailable`:`unknown`}async function pn(e,t,n,r,a,s,c){let l={role:`user`,content:[{type:`text`,text:o(r)}],timestamp:Date.now()},u=await i(e,{systemPrompt:o(n),messages:[l]},{maxTokens:a,apiKey:t,headers:s,signal:c});if(typeof u!=`object`||!u)throw new X(`invalid-response`,`Compaction call returned no response`);let d=u;if(typeof d.stopReason!=`string`||!Array.isArray(d.content))throw new X(`invalid-response`,`Compaction call returned an invalid response envelope`);if(d.stopReason===`error`){let e=typeof d.errorMessage==`string`?d.errorMessage:`Unknown provider error`;throw new X(fn(Error(e)),`Compaction call failed: ${e}`)}let f=d.content.filter(e=>typeof e==`object`&&!!e&&e.type===`text`);if(f.some(e=>typeof e.text!=`string`))throw new X(`invalid-response`,`Compaction call returned an invalid text block`);let p=f.map(e=>e.text).join(`
|
|
62
|
+
`).trim();if(!p)throw new X(`empty-response`,`Compaction call returned no summary text`);return p}async function mn(e){let t=dn(sn(e.messages));return pn(e.model,e.apiKey,t,e.instruction,e.maxTokens,e.headers,e.signal)}var hn=un,gn=`Generate a short title (3 to 6 words) summarizing what this conversation was about. Output ONLY the title text — no quotes, no punctuation other than what belongs in the title, no preamble.`,_n=`slicc_model_catalog`;function vn(){try{return globalThis.localStorage??null}catch{return null}}function Z(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Q(e,t){return Reflect.get(e,t)}function yn(e){let t=null;try{t=e?.getItem(`slicc_model_catalog`)??null}catch{return{raw:null,store:{}}}if(!t)return{raw:t,store:{}};try{let e=JSON.parse(t);return{raw:t,store:Z(e)?e:{}}}catch{return{raw:t,store:{}}}}function $(e){return typeof e==`number`&&Number.isFinite(e)&&e>=0}function bn(e){if(!Z(e))return null;let t=Q(e,`input`),n=Q(e,`output`),r=Q(e,`cacheRead`),i=Q(e,`cacheWrite`);return!$(t)||!$(n)||!$(r)||!$(i)?null:{input:t,output:n,cacheRead:r,cacheWrite:i}}function xn(e){return!Array.isArray(e)||e.length===0||!e.every(e=>e===`text`||e===`image`)?null:[...e]}function Sn(e){if(e===void 0)return;if(!Z(e))return null;let t=Object.entries(e);return t.every(([,e])=>e===null||typeof e==`string`)?Object.fromEntries(t):null}function Cn(e){return{apis:new Set(e.map(e=>e.api)),baseUrls:new Set(e.map(e=>e.baseUrl))}}function wn(e,t,n){if(!Z(t))return null;let r=Q(t,`id`),i=Q(t,`name`),a=Q(t,`api`),o=Q(t,`baseUrl`),s=Q(t,`reasoning`),c=Q(t,`contextWindow`),l=Q(t,`maxTokens`);if(typeof r!=`string`||r.length===0||r.length>200||typeof i!=`string`||i.length===0||typeof a!=`string`||!n.apis.has(a)||typeof o!=`string`||!n.baseUrls.has(o)||typeof s!=`boolean`||!$(c)||c===0||!$(l)||l===0)return null;let u=bn(Q(t,`cost`)),d=xn(Q(t,`input`)),f=Sn(Q(t,`thinkingLevelMap`));if(!u||!d||f===null)return null;let p=Q(t,`compat`),m={id:r,name:i,api:a,provider:e,baseUrl:o,reasoning:s,input:d,cost:u,contextWindow:c,maxTokens:l};return f&&(m.thinkingLevelMap=f),Z(p)&&(m.compat={...p}),m}function Tn(){return 1790795820024}var En,Dn=new Map;function On(e){try{return r(e)}catch{return[]}}function kn(e){if(!e||!Array.isArray(e.models)||e.models.length===0)return!1;let t=Tn();return t===null||typeof e.lastModified==`number`&&e.lastModified>t}var An=new Set([`id`,`name`,`api`,`provider`,`baseUrl`,`reasoning`,`input`,`cost`,`contextWindow`,`maxTokens`,`thinkingLevelMap`,`compat`]);function jn(e,t,n){if(t)return{...Object.fromEntries(Object.entries(t).filter(([e])=>!An.has(e))),...e};let r=n.find(t=>t.headers&&t.api===e.api&&t.baseUrl===e.baseUrl);return r?.headers?{...e,headers:{...r.headers}}:e}function Mn(e,t){let n=On(e);if(n.length===0)return n;let r=Cn(n),i=[...n],a=new Map(i.map((e,t)=>[e.id,t])),o=new Map(n.map(e=>[e.id,e]));for(let s of t.models){let t=wn(e,s,r);if(!t)continue;let c=a.get(t.id),l=jn(t,o.get(t.id),n);c===void 0?(a.set(l.id,i.length),i.push(l)):i[c]=l}return i}function Nn(e,t){if(!s(`live-model-catalog`))return On(e);let{raw:n,store:r}=yn(t),i=r[e];if(!kn(i))return On(e);n!==En&&(En=n,Dn=new Map);let a=Dn.get(e);return a||(a=Mn(e,i),Dn.set(e,a)),a}function Pn(e){return[...Nn(e,vn())]}function Fn(e,t){return Nn(e,vn()).find(e=>e.id===t)||n(e,t)}var In=t;a(`secret-scrub`),a(`image-processor`),a(`tool-adapter`);export{Pn as a,yn as c,mn as d,Fn as i,hn as l,vn as n,In as o,Q as r,Z as s,_n as t,gn as u};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{t as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./logger-LESFN7Hj.js";import"./proxied-fetch-F-dCBEfh.js";import{i as n}from"./feature-flags-QlgHaQc1.js";import{s as r,t as i}from"./api-endpoint-D8lUKmPu.js";import{$ as a,G as o,S as s,U as c,y as l}from"./build-Dnkjpm_v.js";import{i as u,n as d,r as f}from"./compat-nGhSz-U1.js";import"./context-CrZ58_Xy.js";import"./libesm-CTQYxJIv.js";import"./context-compaction-B8b3xc1C.js";import{n as p}from"./float-topology-COIC4j_U.js";import{t as m}from"./secrets-bridge-client-GOCzDscb.js";import{t as h}from"./image-markers-CwM1dvoI.js";import{o as g,s as _}from"./tool-ui-DRnUkp2g.js";import{n as v}from"./image-processor-BlI3KRoz.js";const y={"pi.session.id":{type:`string`,required:!0,cardinality:`high`,description:`Session id`},"pi.lane.name":{type:`string`,required:!0,cardinality:`high`,description:`Lane name`},"pi.operation.id":{type:`string`,required:!0,cardinality:`high`,description:`Durable operation id`},"pi.operation.recovery":{type:`boolean`,required:!0,description:`Whether this invocation resumes durable work`}},b={"pi.error.code":{type:`string`,cardinality:`low`,description:`Stable operation error code`},"pi.error.type":{type:`string`,cardinality:`low`,description:`Low-cardinality operation error class`}};({...y}),{...b},{...y},{...b},{...y},{...b};function x(e,t){if(e.length===0)throw TypeError(`Value namespace must not be empty`);if(e.includes(`\0`))throw TypeError(`Value namespace must not contain \\u0000`);if(t.includes(`\0`))throw TypeError(`Value key must not contain \\u0000`)}function S(e,t=``){return x(e,t),Object.freeze({namespace:e,key:t,kind:`value`})}S(`pi.session.name`);const C=Symbol.for(`yaml.alias`),ee=Symbol.for(`yaml.document`),w=Symbol.for(`yaml.map`),T=Symbol.for(`yaml.pair`),te=Symbol.for(`yaml.scalar`),E=Symbol.for(`yaml.seq`),D=Symbol.for(`yaml.node.type`),O=e=>!!e&&typeof e==`object`&&e[D]===C,k=e=>!!e&&typeof e==`object`&&e[D]===ee,A=e=>!!e&&typeof e==`object`&&e[D]===w,j=e=>!!e&&typeof e==`object`&&e[D]===T,M=e=>!!e&&typeof e==`object`&&e[D]===te,N=e=>!!e&&typeof e==`object`&&e[D]===E;function P(e){if(e&&typeof e==`object`)switch(e[D]){case w:case E:return!0}return!1}function F(e){if(e&&typeof e==`object`)switch(e[D]){case C:case w:case te:case E:return!0}return!1}const ne=e=>(M(e)||P(e))&&!!e.anchor,I=Symbol(`break visit`),re=Symbol(`skip children`),L=Symbol(`remove node`);function R(e,t){let n=ie(t);k(e)?z(null,e.contents,n,Object.freeze([e]))===L&&(e.contents=null):z(null,e,n,Object.freeze([]))}R.BREAK=I,R.SKIP=re,R.REMOVE=L;function z(e,t,n,r){let i=ae(e,t,n,r);if(F(i)||j(i))return oe(e,r,i),z(e,i,n,r);if(typeof i!=`symbol`){if(P(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=z(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===I)return I;else i===L&&(t.items.splice(e,1),--e)}}else if(j(t)){r=Object.freeze(r.concat(t));let e=z(`key`,t.key,n,r);if(e===I)return I;e===L&&(t.key=null);let i=z(`value`,t.value,n,r);if(i===I)return I;i===L&&(t.value=null)}}return i}function ie(e){return typeof e==`object`&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function ae(e,t,n,r){if(typeof n==`function`)return n(e,t,r);if(A(t))return n.Map?.(e,t,r);if(N(t))return n.Seq?.(e,t,r);if(j(t))return n.Pair?.(e,t,r);if(M(t))return n.Scalar?.(e,t,r);if(O(t))return n.Alias?.(e,t,r)}function oe(e,t,n){let r=t[t.length-1];if(P(r))r.items[e]=n;else if(j(r))e===`key`?r.key=n:r.value=n;else if(k(r))r.contents=n;else{let e=O(r)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}function se(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function B(e,t,n,r){if(r&&typeof r==`object`){if(Array.isArray(r))for(let t=0,n=r.length;t<n;++t){let n=r[t],i=B(e,r,String(t),n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}else if(r instanceof Map)for(let t of Array.from(r.keys())){let n=r.get(t),i=B(e,r,t,n);i===void 0?r.delete(t):i!==n&&r.set(t,i)}else if(r instanceof Set)for(let t of Array.from(r)){let n=B(e,r,t,t);n===void 0?r.delete(t):n!==t&&(r.delete(t),r.add(n))}else for(let[t,n]of Object.entries(r)){let i=B(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}}return e.call(t,n,r)}function V(e,t,n){if(Array.isArray(e))return e.map((e,t)=>V(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!ne(e))return e.toJSON(t,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=e=>{r.res=e,delete n.onCreate};let i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e==`bigint`&&!n?.keep?Number(e):e}var ce=class{constructor(e){Object.defineProperty(this,D,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:r,reviver:i}={}){if(!k(e))throw TypeError(`A document argument is required`);let a={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n==`number`?n:100},o=V(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?B(i,{"":o},``,o):o}},le=class extends ce{constructor(e){super(C),this.source=e,Object.defineProperty(this,"tag",{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError(`Alias resolution is disabled`);let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],R(e,{Node:(e,t)=>{(O(t)||ne(t))&&n.push(t)}}),t&&(t.aliasResolveCache=n));let r;for(let e of n){if(e===this)break;e.anchor===this.source&&(r=e)}return r}toJSON(e,t){if(!t)return{source:this.source};let{anchors:n,doc:r,maxAliasCount:i}=t,a=this.resolve(r,t);if(!a){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}let o=n.get(a);if(o||=(V(a,null,t),n.get(a)),o?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(i>=0&&(o.count+=1,o.aliasCount===0&&(o.aliasCount=ue(r,a,n)),o.count*o.aliasCount>i))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`);return o.res}toString(e,t,n){let r=`*${this.source}`;if(e){if(se(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${r} `}return r}};function ue(e,t,n){if(O(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(P(t)){let r=0;for(let i of t.items){let t=ue(e,i,n);t>r&&(r=t)}return r}if(j(t)){let r=ue(e,t.key,n),i=ue(e,t.value,n);return Math.max(r,i)}return 1}const de=e=>!e||typeof e!=`function`&&typeof e!=`object`;var H=class extends ce{constructor(e){super(te),this.value=e}toJSON(e,t){return t?.keep?this.value:V(this.value,e,t)}toString(){return String(this.value)}};H.BLOCK_FOLDED=`BLOCK_FOLDED`,H.BLOCK_LITERAL=`BLOCK_LITERAL`,H.PLAIN=`PLAIN`,H.QUOTE_DOUBLE=`QUOTE_DOUBLE`,H.QUOTE_SINGLE=`QUOTE_SINGLE`;function fe(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}function pe(e,t,n){if(k(e)&&(e=e.contents),F(e))return e;if(j(e)){let t=n.schema[w].createNode?.(n.schema,null,n);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<`u`&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:a,schema:o,sourceObjects:s}=n,c;if(r&&e&&typeof e==`object`){if(c=s.get(e),c)return c.anchor??(c.anchor=i(e)),new le(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=`tag:yaml.org,2002:`+t.slice(2));let l=fe(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new H(e);return c&&(c.node=t),t}l=e instanceof Map?o[w]:Symbol.iterator in Object(e)?o[E]:o[w]}a&&(a(l),delete n.onTagObj);let u=l?.createNode?l.createNode(n.schema,e,n):typeof l?.nodeClass?.from==`function`?l.nodeClass.from(n.schema,e,n):new H(e);return t?u.tag=t:l.default||(u.tag=l.tag),c&&(c.node=u),u}function me(e,t,n){let r=n;for(let e=t.length-1;e>=0;--e){let n=t[e];if(typeof n==`number`&&Number.isInteger(n)&&n>=0){let e=[];e[n]=r,r=e}else r=new Map([[n,r]])}return pe(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:new Map})}const he=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done;var ge=class extends ce{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(t=>F(t)||j(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(he(e))this.add(t);else{let[n,...r]=e,i=this.get(n,!0);if(P(i))i.addIn(r,t);else if(i===void 0&&this.schema)this.set(n,me(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let r=this.get(t,!0);if(P(r))return r.deleteIn(n);throw Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...r]=e,i=this.get(n,!0);return r.length===0?!t&&M(i)?i.value:i:P(i)?i.getIn(r,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!j(t))return!1;let n=t.value;return n==null||e&&M(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(n.length===0)return this.has(t);let r=this.get(t,!0);return P(r)?r.hasIn(n):!1}setIn(e,t){let[n,...r]=e;if(r.length===0)this.set(n,t);else{let e=this.get(n,!0);if(P(e))e.setIn(r,t);else if(e===void 0&&this.schema)this.set(n,me(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}};const _e=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function ve(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}const U=(e,t,n)=>e.endsWith(`
|
|
1
|
+
import{t as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./logger-LESFN7Hj.js";import"./proxied-fetch-F-dCBEfh.js";import{i as n}from"./feature-flags-QlgHaQc1.js";import{s as r,t as i}from"./api-endpoint-D8lUKmPu.js";import{$ as a,G as o,S as s,U as c,y as l}from"./build-Dnkjpm_v.js";import{i as u,n as d,r as f}from"./compat-nGhSz-U1.js";import"./context-CrZ58_Xy.js";import"./libesm-CTQYxJIv.js";import"./context-compaction-BCsq-2e6.js";import{n as p}from"./float-topology-COIC4j_U.js";import{t as m}from"./secrets-bridge-client-GOCzDscb.js";import{t as h}from"./image-markers-CwM1dvoI.js";import{o as g,s as _}from"./tool-ui-DRnUkp2g.js";import{n as v}from"./image-processor-BlI3KRoz.js";const y={"pi.session.id":{type:`string`,required:!0,cardinality:`high`,description:`Session id`},"pi.lane.name":{type:`string`,required:!0,cardinality:`high`,description:`Lane name`},"pi.operation.id":{type:`string`,required:!0,cardinality:`high`,description:`Durable operation id`},"pi.operation.recovery":{type:`boolean`,required:!0,description:`Whether this invocation resumes durable work`}},b={"pi.error.code":{type:`string`,cardinality:`low`,description:`Stable operation error code`},"pi.error.type":{type:`string`,cardinality:`low`,description:`Low-cardinality operation error class`}};({...y}),{...b},{...y},{...b},{...y},{...b};function x(e,t){if(e.length===0)throw TypeError(`Value namespace must not be empty`);if(e.includes(`\0`))throw TypeError(`Value namespace must not contain \\u0000`);if(t.includes(`\0`))throw TypeError(`Value key must not contain \\u0000`)}function S(e,t=``){return x(e,t),Object.freeze({namespace:e,key:t,kind:`value`})}S(`pi.session.name`);const C=Symbol.for(`yaml.alias`),ee=Symbol.for(`yaml.document`),w=Symbol.for(`yaml.map`),T=Symbol.for(`yaml.pair`),te=Symbol.for(`yaml.scalar`),E=Symbol.for(`yaml.seq`),D=Symbol.for(`yaml.node.type`),O=e=>!!e&&typeof e==`object`&&e[D]===C,k=e=>!!e&&typeof e==`object`&&e[D]===ee,A=e=>!!e&&typeof e==`object`&&e[D]===w,j=e=>!!e&&typeof e==`object`&&e[D]===T,M=e=>!!e&&typeof e==`object`&&e[D]===te,N=e=>!!e&&typeof e==`object`&&e[D]===E;function P(e){if(e&&typeof e==`object`)switch(e[D]){case w:case E:return!0}return!1}function F(e){if(e&&typeof e==`object`)switch(e[D]){case C:case w:case te:case E:return!0}return!1}const ne=e=>(M(e)||P(e))&&!!e.anchor,I=Symbol(`break visit`),re=Symbol(`skip children`),L=Symbol(`remove node`);function R(e,t){let n=ie(t);k(e)?z(null,e.contents,n,Object.freeze([e]))===L&&(e.contents=null):z(null,e,n,Object.freeze([]))}R.BREAK=I,R.SKIP=re,R.REMOVE=L;function z(e,t,n,r){let i=ae(e,t,n,r);if(F(i)||j(i))return oe(e,r,i),z(e,i,n,r);if(typeof i!=`symbol`){if(P(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=z(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===I)return I;else i===L&&(t.items.splice(e,1),--e)}}else if(j(t)){r=Object.freeze(r.concat(t));let e=z(`key`,t.key,n,r);if(e===I)return I;e===L&&(t.key=null);let i=z(`value`,t.value,n,r);if(i===I)return I;i===L&&(t.value=null)}}return i}function ie(e){return typeof e==`object`&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function ae(e,t,n,r){if(typeof n==`function`)return n(e,t,r);if(A(t))return n.Map?.(e,t,r);if(N(t))return n.Seq?.(e,t,r);if(j(t))return n.Pair?.(e,t,r);if(M(t))return n.Scalar?.(e,t,r);if(O(t))return n.Alias?.(e,t,r)}function oe(e,t,n){let r=t[t.length-1];if(P(r))r.items[e]=n;else if(j(r))e===`key`?r.key=n:r.value=n;else if(k(r))r.contents=n;else{let e=O(r)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}function se(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function B(e,t,n,r){if(r&&typeof r==`object`){if(Array.isArray(r))for(let t=0,n=r.length;t<n;++t){let n=r[t],i=B(e,r,String(t),n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}else if(r instanceof Map)for(let t of Array.from(r.keys())){let n=r.get(t),i=B(e,r,t,n);i===void 0?r.delete(t):i!==n&&r.set(t,i)}else if(r instanceof Set)for(let t of Array.from(r)){let n=B(e,r,t,t);n===void 0?r.delete(t):n!==t&&(r.delete(t),r.add(n))}else for(let[t,n]of Object.entries(r)){let i=B(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}}return e.call(t,n,r)}function V(e,t,n){if(Array.isArray(e))return e.map((e,t)=>V(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!ne(e))return e.toJSON(t,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=e=>{r.res=e,delete n.onCreate};let i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e==`bigint`&&!n?.keep?Number(e):e}var ce=class{constructor(e){Object.defineProperty(this,D,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:r,reviver:i}={}){if(!k(e))throw TypeError(`A document argument is required`);let a={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n==`number`?n:100},o=V(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?B(i,{"":o},``,o):o}},le=class extends ce{constructor(e){super(C),this.source=e,Object.defineProperty(this,"tag",{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError(`Alias resolution is disabled`);let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],R(e,{Node:(e,t)=>{(O(t)||ne(t))&&n.push(t)}}),t&&(t.aliasResolveCache=n));let r;for(let e of n){if(e===this)break;e.anchor===this.source&&(r=e)}return r}toJSON(e,t){if(!t)return{source:this.source};let{anchors:n,doc:r,maxAliasCount:i}=t,a=this.resolve(r,t);if(!a){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}let o=n.get(a);if(o||=(V(a,null,t),n.get(a)),o?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(i>=0&&(o.count+=1,o.aliasCount===0&&(o.aliasCount=ue(r,a,n)),o.count*o.aliasCount>i))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`);return o.res}toString(e,t,n){let r=`*${this.source}`;if(e){if(se(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${r} `}return r}};function ue(e,t,n){if(O(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(P(t)){let r=0;for(let i of t.items){let t=ue(e,i,n);t>r&&(r=t)}return r}if(j(t)){let r=ue(e,t.key,n),i=ue(e,t.value,n);return Math.max(r,i)}return 1}const de=e=>!e||typeof e!=`function`&&typeof e!=`object`;var H=class extends ce{constructor(e){super(te),this.value=e}toJSON(e,t){return t?.keep?this.value:V(this.value,e,t)}toString(){return String(this.value)}};H.BLOCK_FOLDED=`BLOCK_FOLDED`,H.BLOCK_LITERAL=`BLOCK_LITERAL`,H.PLAIN=`PLAIN`,H.QUOTE_DOUBLE=`QUOTE_DOUBLE`,H.QUOTE_SINGLE=`QUOTE_SINGLE`;function fe(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}function pe(e,t,n){if(k(e)&&(e=e.contents),F(e))return e;if(j(e)){let t=n.schema[w].createNode?.(n.schema,null,n);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<`u`&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:a,schema:o,sourceObjects:s}=n,c;if(r&&e&&typeof e==`object`){if(c=s.get(e),c)return c.anchor??(c.anchor=i(e)),new le(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=`tag:yaml.org,2002:`+t.slice(2));let l=fe(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new H(e);return c&&(c.node=t),t}l=e instanceof Map?o[w]:Symbol.iterator in Object(e)?o[E]:o[w]}a&&(a(l),delete n.onTagObj);let u=l?.createNode?l.createNode(n.schema,e,n):typeof l?.nodeClass?.from==`function`?l.nodeClass.from(n.schema,e,n):new H(e);return t?u.tag=t:l.default||(u.tag=l.tag),c&&(c.node=u),u}function me(e,t,n){let r=n;for(let e=t.length-1;e>=0;--e){let n=t[e];if(typeof n==`number`&&Number.isInteger(n)&&n>=0){let e=[];e[n]=r,r=e}else r=new Map([[n,r]])}return pe(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:new Map})}const he=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done;var ge=class extends ce{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(t=>F(t)||j(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(he(e))this.add(t);else{let[n,...r]=e,i=this.get(n,!0);if(P(i))i.addIn(r,t);else if(i===void 0&&this.schema)this.set(n,me(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let r=this.get(t,!0);if(P(r))return r.deleteIn(n);throw Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...r]=e,i=this.get(n,!0);return r.length===0?!t&&M(i)?i.value:i:P(i)?i.getIn(r,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!j(t))return!1;let n=t.value;return n==null||e&&M(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(n.length===0)return this.has(t);let r=this.get(t,!0);return P(r)?r.hasIn(n):!1}setIn(e,t){let[n,...r]=e;if(r.length===0)this.set(n,t);else{let e=this.get(n,!0);if(P(e))e.setIn(r,t);else if(e===void 0&&this.schema)this.set(n,me(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}};const _e=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function ve(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}const U=(e,t,n)=>e.endsWith(`
|
|
2
2
|
`)?ve(n,t):n.includes(`
|
|
3
3
|
`)?`
|
|
4
4
|
`+ve(n,t):(e.endsWith(` `)?``:` `)+n,ye=`flow`;function be(e,t,n=`flow`,{indentAtStart:r,lineWidth:i=80,minContentWidth:a=20,onFold:o,onOverflow:s}={}){if(!i||i<0)return e;i<a&&(a=0);let c=Math.max(1+a,1+i-t.length);if(e.length<=c)return e;let l=[],u={},d=i-t.length;typeof r==`number`&&(r>i-Math.max(2,a)?l.push(0):d=i-r);let f,p,m=!1,h=-1,g=-1,_=-1;n===`block`&&(h=xe(e,h,t.length),h!==-1&&(d=h+c));for(let r;r=e[h+=1];){if(n===`quoted`&&r===`\\`){switch(g=h,e[h+1]){case`x`:h+=3;break;case`u`:h+=5;break;case`U`:h+=9;break;default:h+=1}_=h}if(r===`
|