shadow-claw 1.31.0 → 1.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.well-known/mcp/server-card.json +1 -1
- package/.well-known/mcp.json +1 -1
- package/dist/lib/components/index.js +21 -21
- package/dist/lib/components/settings/shadow-claw-channel-config.js +1 -1
- package/dist/lib/components/settings/shadow-claw-control-plane.js +1 -1
- package/dist/lib/components/settings/shadow-claw-git.js +1 -1
- package/dist/lib/components/settings/shadow-claw-llm.js +1 -1
- package/dist/lib/components/settings/shadow-claw-networking.js +1 -1
- package/dist/lib/components/settings/shadow-claw-notifications.js +1 -1
- package/dist/lib/components/settings/shadow-claw-peerjs.js +1 -1
- package/dist/lib/components/settings/shadow-claw-storage.js +1 -1
- package/dist/lib/components/settings/shadow-claw-task-server.js +1 -1
- package/dist/lib/components/settings/shadow-claw-webvm.js +1 -1
- package/dist/lib/components/shadow-claw-channel-config.js +1 -1
- package/dist/lib/components/shadow-claw-channels.js +1 -1
- package/dist/lib/components/shadow-claw-chat.js +1 -1
- package/dist/lib/components/shadow-claw-control-plane.js +1 -1
- package/dist/lib/components/shadow-claw-conversations.js +1 -1
- package/dist/lib/components/shadow-claw-file-viewer.js +1 -1
- package/dist/lib/components/shadow-claw-files.js +1 -1
- package/dist/lib/components/shadow-claw-git.js +1 -1
- package/dist/lib/components/shadow-claw-llm.js +1 -1
- package/dist/lib/components/shadow-claw-networking.js +1 -1
- package/dist/lib/components/shadow-claw-notifications.js +1 -1
- package/dist/lib/components/shadow-claw-pages.js +1 -1
- package/dist/lib/components/shadow-claw-peerjs.js +1 -1
- package/dist/lib/components/shadow-claw-settings.js +1 -1
- package/dist/lib/components/shadow-claw-storage.js +1 -1
- package/dist/lib/components/shadow-claw-task-server.js +1 -1
- package/dist/lib/components/shadow-claw-tasks.js +1 -1
- package/dist/lib/components/shadow-claw-terminal.js +1 -1
- package/dist/lib/components/shadow-claw-tools.js +1 -1
- package/dist/lib/components/shadow-claw-webvm.js +1 -1
- package/dist/lib/components/shadow-claw.js +1 -1
- package/dist/lib/{configurePeerJs-u7CYSquX.js → configurePeerJs-DD3G3Pms.js} +2 -2
- package/dist/lib/{configurePeerJs-u7CYSquX.js.map → configurePeerJs-DD3G3Pms.js.map} +1 -1
- package/dist/lib/{git-DAP_EV6R.js → git-Brr7JIbs.js} +25 -8
- package/dist/lib/{git-DAP_EV6R.js.map → git-Brr7JIbs.js.map} +1 -1
- package/dist/lib/index.js +21 -21
- package/dist/lib/{initControlPlane-DCK_SHeR.js → initControlPlane-3TUdhRBM.js} +7 -7
- package/dist/lib/{initControlPlane-DCK_SHeR.js.map → initControlPlane-3TUdhRBM.js.map} +1 -1
- package/dist/lib/{orchestrator-XygttQw2.js → orchestrator-DLnCmeTZ.js} +5 -5
- package/dist/lib/{orchestrator-XygttQw2.js.map → orchestrator-DLnCmeTZ.js.map} +1 -1
- package/dist/lib/{orchestrator-DNamnY-k.js → orchestrator-DW5l2bbW.js} +22 -4
- package/dist/lib/{orchestrator-DNamnY-k.js.map → orchestrator-DW5l2bbW.js.map} +1 -1
- package/dist/lib/{peerjs-BgkPSHKa.js → peerjs-BXlMuIQn.js} +3 -3
- package/dist/lib/{peerjs-BgkPSHKa.js.map → peerjs-BXlMuIQn.js.map} +1 -1
- package/dist/lib/{push-client-C09NQEk5.js → push-client-B419nn-i.js} +2 -2
- package/dist/lib/{push-client-C09NQEk5.js.map → push-client-B419nn-i.js.map} +1 -1
- package/dist/lib/{shadow-claw-vzcggiax.js → shadow-claw-DmMO4vVG.js} +4 -4
- package/dist/lib/{shadow-claw-vzcggiax.js.map → shadow-claw-DmMO4vVG.js.map} +1 -1
- package/dist/lib/{shadow-claw-channel-config-Cl3JvxIJ.js → shadow-claw-channel-config-BhxHf6wZ.js} +3 -3
- package/dist/lib/{shadow-claw-channel-config-Cl3JvxIJ.js.map → shadow-claw-channel-config-BhxHf6wZ.js.map} +1 -1
- package/dist/lib/{shadow-claw-channels-kv21lr_O.js → shadow-claw-channels-B5vzE9Z2.js} +2 -2
- package/dist/lib/{shadow-claw-channels-kv21lr_O.js.map → shadow-claw-channels-B5vzE9Z2.js.map} +1 -1
- package/dist/lib/{shadow-claw-chat-Cj1fHQIl.js → shadow-claw-chat-BsYnJ4-G.js} +3 -3
- package/dist/lib/{shadow-claw-chat-Cj1fHQIl.js.map → shadow-claw-chat-BsYnJ4-G.js.map} +1 -1
- package/dist/lib/{shadow-claw-control-plane-DySeKB36.js → shadow-claw-control-plane-DqcgQsun.js} +6 -6
- package/dist/lib/{shadow-claw-control-plane-DySeKB36.js.map → shadow-claw-control-plane-DqcgQsun.js.map} +1 -1
- package/dist/lib/{shadow-claw-conversations-DghueOOD.js → shadow-claw-conversations-B9Pn58g3.js} +2 -2
- package/dist/lib/{shadow-claw-conversations-DghueOOD.js.map → shadow-claw-conversations-B9Pn58g3.js.map} +1 -1
- package/dist/lib/{shadow-claw-file-viewer-C_ITv8T6.js → shadow-claw-file-viewer-DL6c4oPK.js} +2 -2
- package/dist/lib/{shadow-claw-file-viewer-C_ITv8T6.js.map → shadow-claw-file-viewer-DL6c4oPK.js.map} +1 -1
- package/dist/lib/{shadow-claw-files-CWBaYt9p.js → shadow-claw-files-C_ksPb8W.js} +2 -2
- package/dist/lib/{shadow-claw-files-CWBaYt9p.js.map → shadow-claw-files-C_ksPb8W.js.map} +1 -1
- package/dist/lib/{shadow-claw-git-XfPBpfXd.js → shadow-claw-git-jwsY7L1N.js} +3 -3
- package/dist/lib/{shadow-claw-git-XfPBpfXd.js.map → shadow-claw-git-jwsY7L1N.js.map} +1 -1
- package/dist/lib/{shadow-claw-llm-Gzx4ufL_.js → shadow-claw-llm-CEPJh1Jh.js} +2 -2
- package/dist/lib/{shadow-claw-llm-Gzx4ufL_.js.map → shadow-claw-llm-CEPJh1Jh.js.map} +1 -1
- package/dist/lib/{shadow-claw-networking-CYEbc5TR.js → shadow-claw-networking-Bi4yvc73.js} +2 -2
- package/dist/lib/{shadow-claw-networking-CYEbc5TR.js.map → shadow-claw-networking-Bi4yvc73.js.map} +1 -1
- package/dist/lib/{shadow-claw-notifications-DHvkTrgv.js → shadow-claw-notifications-C-JgGqQx.js} +2 -2
- package/dist/lib/{shadow-claw-notifications-DHvkTrgv.js.map → shadow-claw-notifications-C-JgGqQx.js.map} +1 -1
- package/dist/lib/{shadow-claw-pages-Bj3w3V6Y.js → shadow-claw-pages-OEOClgA8.js} +2 -2
- package/dist/lib/{shadow-claw-pages-Bj3w3V6Y.js.map → shadow-claw-pages-OEOClgA8.js.map} +1 -1
- package/dist/lib/{shadow-claw-peerjs-B3sx2xLA.js → shadow-claw-peerjs-DmC2CV-9.js} +3 -3
- package/dist/lib/{shadow-claw-peerjs-B3sx2xLA.js.map → shadow-claw-peerjs-DmC2CV-9.js.map} +1 -1
- package/dist/lib/{shadow-claw-settings-DK-0kp3A.js → shadow-claw-settings-xAtFog0T.js} +2 -2
- package/dist/lib/{shadow-claw-settings-DK-0kp3A.js.map → shadow-claw-settings-xAtFog0T.js.map} +1 -1
- package/dist/lib/{shadow-claw-storage-p9nVMQPF.js → shadow-claw-storage-B4UHl-po.js} +2 -2
- package/dist/lib/{shadow-claw-storage-p9nVMQPF.js.map → shadow-claw-storage-B4UHl-po.js.map} +1 -1
- package/dist/lib/{shadow-claw-task-server-BNKCWG2M.js → shadow-claw-task-server-B0eWzg57.js} +2 -2
- package/dist/lib/{shadow-claw-task-server-BNKCWG2M.js.map → shadow-claw-task-server-B0eWzg57.js.map} +1 -1
- package/dist/lib/{shadow-claw-tasks-Dbq9rUku.js → shadow-claw-tasks-HHU_8Gyg.js} +2 -2
- package/dist/lib/{shadow-claw-tasks-Dbq9rUku.js.map → shadow-claw-tasks-HHU_8Gyg.js.map} +1 -1
- package/dist/lib/{shadow-claw-terminal-Wk2qRWJ9.js → shadow-claw-terminal-CdC2G6Zz.js} +2 -2
- package/dist/lib/{shadow-claw-terminal-Wk2qRWJ9.js.map → shadow-claw-terminal-CdC2G6Zz.js.map} +1 -1
- package/dist/lib/{shadow-claw-tools-C9TEf2k7.js → shadow-claw-tools-2AICxVXA.js} +3 -3
- package/dist/lib/{shadow-claw-tools-C9TEf2k7.js.map → shadow-claw-tools-2AICxVXA.js.map} +1 -1
- package/dist/lib/{shadow-claw-webvm-VoKerWW8.js → shadow-claw-webvm-Cy-Ia2vs.js} +2 -2
- package/dist/lib/{shadow-claw-webvm-VoKerWW8.js.map → shadow-claw-webvm-Cy-Ia2vs.js.map} +1 -1
- package/dist/lib/subsystems/git/git.d.ts +8 -1
- package/dist/lib/subsystems/git/types.d.ts +7 -1
- package/dist/lib/{syncWebMcpRegistration-DEs4JjI_.js → syncWebMcpRegistration-CaAPPg2V.js} +2 -2
- package/dist/lib/{syncWebMcpRegistration-DEs4JjI_.js.map → syncWebMcpRegistration-CaAPPg2V.js.map} +1 -1
- package/dist/public/.well-known/mcp/server-card.json +1 -1
- package/dist/public/.well-known/mcp.json +1 -1
- package/dist/public/agent.worker.js +2 -2
- package/dist/public/{configurePeerJs-B68egTBd.js → configurePeerJs--JGpJVti.js} +1 -1
- package/dist/public/docs/example/article/index.html +1 -1
- package/dist/public/docs/publishing/index.html +1 -1
- package/dist/public/docs/skill-creator/index.html +1 -1
- package/dist/public/{e2e-bridge-DQ4Mb_eC.js → e2e-bridge-CbYqdMp-.js} +1 -1
- package/dist/public/{file-viewer-BqNHyqzy.js → file-viewer-vHJ5Zsgk.js} +1 -1
- package/dist/public/git-8F7wvoUB.js +100 -0
- package/dist/public/git-DgFF7xTW.js +100 -0
- package/dist/public/index.html +1 -1
- package/dist/public/index.js +1 -1
- package/dist/public/{initControlPlane-DG_LcLDy.js → initControlPlane-C5v0FtJE.js} +1 -1
- package/dist/public/main/index.html +1 -1
- package/dist/public/main/memory/index.html +1 -1
- package/dist/public/{orchestrator-DAJkyJmV.js → orchestrator-BeJfwtvz.js} +3 -3
- package/dist/public/{orchestrator-BXwxW4N2.js → orchestrator-DNr2HDI2.js} +1 -1
- package/dist/public/{peerjs-BaDbzfgl.js → peerjs-mG30TAJ_.js} +1 -1
- package/dist/public/{push-client-B1CCaldJ.js → push-client-C2zMT3Sf.js} +1 -1
- package/dist/public/service-worker.js +1 -1
- package/dist/public/{shadow-claw-CpBmveOh.js → shadow-claw-Ble6l0Iw.js} +2 -2
- package/dist/public/{shadow-claw-channels-7Oew09u0.js → shadow-claw-channels-D_xfBoWp.js} +1 -1
- package/dist/public/{shadow-claw-chat-CskwjDzZ.js → shadow-claw-chat-D_Lbi5oH.js} +1 -1
- package/dist/public/{shadow-claw-control-plane-BqjEyhx7.js → shadow-claw-control-plane-CrnA5lM0.js} +2 -2
- package/dist/public/{shadow-claw-conversations-ClGgBPVY.js → shadow-claw-conversations-BN-hFmN1.js} +1 -1
- package/dist/public/{shadow-claw-file-viewer-rDepUwFJ.js → shadow-claw-file-viewer-BKEpzpbx.js} +1 -1
- package/dist/public/{shadow-claw-files-C0r05PYf.js → shadow-claw-files-DDZMk5AA.js} +1 -1
- package/dist/public/{shadow-claw-git-CXrECHKy.js → shadow-claw-git-CqOO97Re.js} +2 -2
- package/dist/public/{shadow-claw-llm-jeGVNciG.js → shadow-claw-llm-DoGxEHQL.js} +1 -1
- package/dist/public/{shadow-claw-networking--q6MgEAT.js → shadow-claw-networking-DJeCdb7e.js} +1 -1
- package/dist/public/{shadow-claw-notifications-CrFUF0fl.js → shadow-claw-notifications-hSKJeMXb.js} +1 -1
- package/dist/public/{shadow-claw-pages-_n1wVXAV.js → shadow-claw-pages-DTS98Zbi.js} +1 -1
- package/dist/public/{shadow-claw-settings-5yIfa3ie.js → shadow-claw-settings-5w0ce8SP.js} +2 -2
- package/dist/public/{shadow-claw-storage-PLX9EFGn.js → shadow-claw-storage-DqlVt27X.js} +1 -1
- package/dist/public/{shadow-claw-task-server-BMps7aSr.js → shadow-claw-task-server-ByZwKI6S.js} +1 -1
- package/dist/public/{shadow-claw-tasks-CHO1xvsu.js → shadow-claw-tasks-Dc4G4zBu.js} +1 -1
- package/dist/public/{shadow-claw-terminal-BJnSXRsb.js → shadow-claw-terminal-DvusP7wg.js} +1 -1
- package/dist/public/{shadow-claw-tools-BHfxRckC.js → shadow-claw-tools-BEsid8q-.js} +1 -1
- package/dist/public/{shadow-claw-webvm-CyI23mQT.js → shadow-claw-webvm-BWlIeK78.js} +1 -1
- package/dist/public/{syncWebMcpRegistration-R0tha3kP.js → syncWebMcpRegistration-CqVCB6m8.js} +1 -1
- package/package.json +1 -1
- package/src/storage/staticMainSite.ts +16 -2
- package/src/stores/orchestrator.test.ts +33 -0
- package/src/stores/orchestrator.ts +36 -0
- package/src/subsystems/git/git.test.ts +99 -0
- package/src/subsystems/git/git.ts +92 -12
- package/src/subsystems/git/types.ts +7 -0
- package/dist/public/git-BDaM5VT5.js +0 -100
- package/dist/public/git-D4n46G9B.js +0 -100
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as e,r as t}from"./config-Bnwx4EfS.js";import{n}from"./txPromise-EBECky1b.js";import{t as r}from"./getConfig-D89uJgo5.js";import{h as i,u as a}from"./custom-element-security-Da_6HQ6X.js";import{t as o}from"./orchestrator-
|
|
1
|
+
import{b as e,r as t}from"./config-Bnwx4EfS.js";import{n}from"./txPromise-EBECky1b.js";import{t as r}from"./getConfig-D89uJgo5.js";import{h as i,u as a}from"./custom-element-security-Da_6HQ6X.js";import{t as o}from"./orchestrator-BeJfwtvz.js";import{f as s,h as c}from"./mcp-reconnect-CBHuaYdF.js";import{a as l,r as u}from"./toast-BXgUfbyh.js";import{t as d}from"./shadow-claw-element-DIrv3P6A.js";import"./shadow-claw-card-DCxWEHgX.js";import"./shadow-claw-empty-state-Bl52dGQ0.js";const f=new CSSStyleSheet;f.replaceSync(`*,
|
|
2
2
|
*::before,
|
|
3
3
|
*::after {
|
|
4
4
|
font-family: var(--shadow-claw-font-sans);
|
|
@@ -444,4 +444,4 @@ import{b as e,r as t}from"./config-Bnwx4EfS.js";import{n}from"./txPromise-EBECky
|
|
|
444
444
|
</button>
|
|
445
445
|
<button class="cancel-btn" data-action="cancel-account-form">Cancel</button>
|
|
446
446
|
</div>
|
|
447
|
-
</div>`),p.querySelector(`[data-action="save-account"]`)?.addEventListener(`click`,()=>this.saveAccountForm()),p.querySelector(`[data-action="cancel-account-form"]`)?.addEventListener(`click`,()=>this.hideAccountForm()),p.querySelector(`[data-field="acct-auth-mode"]`)?.addEventListener(`change`,()=>this.updateAuthModeVisibility(p)),p.querySelector(`[data-action="connect-oauth"]`)?.addEventListener(`click`,()=>void this.connectOAuthFromForm(p)),this.updateAuthModeVisibility(p))}updateAuthModeVisibility(e){let t=e.querySelector(`[data-field="acct-auth-mode"]`)?.value===`oauth`,n=e.querySelector(`[data-region="oauth-fields"]`),r=e.querySelector(`[data-region="pat-fields"]`);n instanceof HTMLElement&&(n.style.display=t?`block`:`none`),r instanceof HTMLElement&&(r.style.display=t?`none`:`block`)}updateCustomProxyVisibility(){let e=this.shadowRoot;if(!e)return;let t=e.querySelector(`[data-setting="git-proxy-custom"]`),n=e.querySelector(`[data-region="git-custom-proxy-field"]`);n instanceof HTMLElement&&(n.style.display=t?.checked?`block`:`none`)}async connectOAuthFromForm(e){let t=e.querySelector(`[data-field="acct-oauth-provider"]`)?.value,n=e.querySelector(`[data-field="acct-oauth-client-id"]`)?.value.trim(),r=e.querySelector(`[data-field="acct-oauth-client-secret"]`)?.value.trim(),i=e.querySelector(`[data-field="acct-oauth-scope"]`)?.value.trim();if(!t){u(`OAuth provider is required.`,4e3);return}if(!n){u(`OAuth client ID is required.`,4e3);return}let a=e.querySelector(`[data-region="oauth-status"]`),o=e.querySelector(`[data-action="connect-oauth"]`);a&&(a.textContent=`Starting OAuth...`),o&&(o.disabled=!0);try{let e=i?i.split(/[\s,]+/).map(e=>e.trim()).filter(Boolean):void 0,o=await fetch(`/oauth/authorize`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({providerId:t,clientId:n,clientSecret:r||void 0,redirectUri:`${window.location.origin}/oauth/callback`,scope:e})}),s=await o.json();if(!o.ok||!s.state||!s.authorizeUrl)throw Error(s.error||`OAuth authorize failed`);window.open(s.authorizeUrl,`shadowclaw-oauth`,`popup=yes,width=540,height=720`);let c=s.state,u=`pending`;for(let e=0;e<60;e++){let e=await fetch(`/oauth/session/${encodeURIComponent(c)}`),t=await e.json();if(!e.ok)throw Error(t.error||`OAuth session not found`);if(u=t.status||`pending`,u===`authorized`)break;if(u===`error`)throw Error(t.error||`OAuth authorization failed`);await new Promise(e=>setTimeout(e,1e3))}if(u!==`authorized`)throw Error(`OAuth authorization timed out`);let d=await fetch(`/oauth/token`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({state:c})}),f=await d.json();if(!d.ok||!f.accessToken)throw Error(f.error||`OAuth token exchange failed`);this.pendingOauthResult={providerId:t,accessToken:f.accessToken,refreshToken:f.refreshToken,expiresAt:f.expiresIn?Date.now()+f.expiresIn*1e3:void 0,scope:f.scope,tokenType:f.tokenType},a&&(a.textContent=`OAuth connected`),l(`OAuth connected`,3e3)}catch(e){let t=e instanceof Error?e.message:String(e);a&&(a.textContent=`OAuth failed`),u(`OAuth connect failed: ${t}`,6e3)}finally{o&&(o.disabled=!1)}}async deleteAccount(e){if(this.db){this.accounts=this.accounts.filter(t=>t.id!==e),this.defaultAccountId===e&&(this.defaultAccountId=this.accounts[0]?.id||``);try{let{setConfig:e}=await import(`./setConfig-DFMYnYLE.js`).then(e=>e.n);await e(this.db,t.GIT_ACCOUNTS,this.accounts),await e(this.db,t.GIT_DEFAULT_ACCOUNT,this.defaultAccountId)}catch(e){console.warn(`Error persisting account deletion:`,e)}this.renderAccountList(),this.updateGitWarning(),l(`Account deleted`,3e3)}}async migrateLegacyAccount(){if(!this.db)return;let e=await r(this.db,t.GIT_TOKEN),n=await r(this.db,t.GIT_USERNAME);if(!e&&!n)return;let i=await r(this.db,t.GIT_PASSWORD)||``,a={id:`legacy-migrated`,label:`GitHub`,hostPattern:`github.com`,token:e||``,username:n||``,password:i,authorName:``,authorEmail:``};this.accounts=[a],this.defaultAccountId=a.id;let{setConfig:o}=await import(`./setConfig-DFMYnYLE.js`).then(e=>e.n);await o(this.db,t.GIT_ACCOUNTS,this.accounts),await o(this.db,t.GIT_DEFAULT_ACCOUNT,a.id)}async render(){let e=this.shadowRoot;if(e)try{let n=await r(this.db,t.GIT_CORS_PROXY)||`local`,i=e.querySelector(`[data-setting="git-proxy-local"]`),a=e.querySelector(`[data-setting="git-proxy-public"]`),s=e.querySelector(`[data-setting="git-proxy-custom"]`),c=e.querySelector(`[data-setting="git-proxy-url-input"]`);i&&a&&s&&(i.checked=n===`local`,a.checked=n===`public`,s.checked=n===`custom`),c&&(c.value=o.gitProxyUrl||`/git-proxy`),this.updateCustomProxyVisibility();let l=e.querySelector(`[data-setting="git-author-name-input"]`);l&&(l.value=await r(this.db,t.GIT_AUTHOR_NAME)||`ShadowClaw`);let u=e.querySelector(`[data-setting="git-author-email-input"]`);u&&(u.value=await r(this.db,t.GIT_AUTHOR_EMAIL)||`agent@example.com`);let d=await r(this.db,t.GIT_ACCOUNTS);this.accounts=Array.isArray(d)?d:[],this.defaultAccountId=await r(this.db,t.GIT_DEFAULT_ACCOUNT)||``,this.accounts.length===0&&await this.migrateLegacyAccount(),this.renderAccountList(),this.updateGitWarning()}catch(e){console.warn(`Could not load git settings:`,e)}}async saveAccountForm(){if(!this.db)return;let e=this.shadowRoot;if(!e)return;let n=e.querySelector(`[data-region="account-form-slot"]`);if(!n)return;let r=n.querySelector(`[data-field="acct-label"]`)?.value.trim(),i=n.querySelector(`[data-field="acct-host"]`)?.value.trim(),a=n.querySelector(`[data-field="acct-auth-mode"]`)?.value;if(!r||!i){u(`Label and Host Pattern are required.`,4e3);return}try{let{encryptValue:e}=await import(`./crypto-C8c5wMzN.js`).then(e=>e.t),{setConfig:o}=await import(`./setConfig-DFMYnYLE.js`).then(e=>e.n),s=n.querySelector(`[data-field="acct-token"]`)?.value.trim(),c=n.querySelector(`[data-field="acct-password"]`)?.value.trim(),d=n.querySelector(`[data-field="acct-username"]`)?.value.trim()||``,f=n.querySelector(`[data-field="acct-author-name"]`)?.value.trim()||``,p=n.querySelector(`[data-field="acct-author-email"]`)?.value.trim()||``,m=this.editingAccountId===`new`,h=m?null:this.accounts.find(e=>e.id===this.editingAccountId),g=h?.token||``,_=h?.password||``,v=h?.oauthProviderId,y=h?.oauthClientId,b=h?.oauthClientSecret,x=h?.accessTokenExpiresAt,S=h?.refreshToken,C=h?.scopes,w=h?.tokenType,T=h?.oauthRefreshFailureCount,E=h?.oauthReauthRequired,D=h?.oauthReauthRequiredAt;if(a===`oauth`){v=n.querySelector(`[data-field="acct-oauth-provider"]`)?.value,y=n.querySelector(`[data-field="acct-oauth-client-id"]`)?.value.trim();let t=n.querySelector(`[data-field="acct-oauth-client-secret"]`)?.value.trim(),r=n.querySelector(`[data-field="acct-oauth-scope"]`)?.value.trim(),i=r?r.split(/[\s,]+/).map(e=>e.trim()).filter(Boolean):void 0;if(!v){u(`OAuth provider is required for OAuth mode.`,4e3);return}if(!y){u(`OAuth client ID is required for OAuth mode.`,4e3);return}if(t){let n=await e(t);n&&(b=n)}if(this.pendingOauthResult?.accessToken){let t=await e(this.pendingOauthResult.accessToken);if(t&&(g=t),this.pendingOauthResult.refreshToken){let t=await e(this.pendingOauthResult.refreshToken);t&&(S=t)}x=this.pendingOauthResult.expiresAt,C=this.pendingOauthResult.scope?this.pendingOauthResult.scope.split(/[\s,]+/).map(e=>e.trim()).filter(Boolean):i||C,w=this.pendingOauthResult.tokenType,T=0,E=!1,D=void 0}else C=i||C;if(!g){u(`Connect OAuth first to obtain an access token for this account.`,5e3);return}_=``}else{if(s){let t=await e(s);t&&(g=t)}if(c){let t=await e(c);t&&(_=t)}v=void 0,y=void 0,b=void 0,x=void 0,S=void 0,C=void 0,w=void 0,T=void 0,E=void 0,D=void 0}if(m){let{ulid:e}=await import(`./ulid-BY7rQVLN.js`).then(e=>e.n),n={id:e(),label:r,hostPattern:i,token:g,username:a===`oauth`?``:d,password:_,authorName:f,authorEmail:p,authMode:a||`token`,oauthProviderId:v,oauthClientId:y,oauthClientSecret:b,accessTokenExpiresAt:x,refreshToken:S,scopes:C,tokenType:w,oauthRefreshFailureCount:T,oauthReauthRequired:E,oauthReauthRequiredAt:D};this.accounts.push(n),this.accounts.length===1&&(this.defaultAccountId=n.id,await o(this.db,t.GIT_DEFAULT_ACCOUNT,n.id))}else h&&(h.label=r,h.hostPattern=i,h.token=g,h.username=a===`oauth`?``:d,h.password=_,h.authorName=f,h.authorEmail=p,h.authMode=a||`token`,h.oauthProviderId=v,h.oauthClientId=y,h.oauthClientSecret=b,h.accessTokenExpiresAt=x,h.refreshToken=S,h.scopes=C,h.tokenType=w,h.oauthRefreshFailureCount=T,h.oauthReauthRequired=E,h.oauthReauthRequiredAt=D);await o(this.db,t.GIT_ACCOUNTS,this.accounts),this.hideAccountForm(),this.renderAccountList(),this.updateGitWarning(),l(m?`Account added`:`Account updated`,3e3)}catch(e){u(`Error saving account: `+(e instanceof Error?e.message:String(e)),6e3)}}async saveGitSettings(){if(!this.db)return;let e=this.shadowRoot;if(e)try{let{setConfig:n}=await import(`./setConfig-DFMYnYLE.js`).then(e=>e.n),r=e.querySelector(`[data-setting="git-proxy-public"]`),i=e.querySelector(`[data-setting="git-proxy-custom"]`),a=r?.checked?`public`:i?.checked?`custom`:`local`;if(await n(this.db,t.GIT_CORS_PROXY,a),a===`custom`){let t=e.querySelector(`[data-setting="git-proxy-url-input"]`)?.value.trim()||`/git-proxy`,{orchestratorStore:n}=await import(`./orchestrator-DAJkyJmV.js`).then(e=>e.n);await n.setGitProxyUrl(this.db,t)}let o=e.querySelector(`[data-setting="git-author-name-input"]`);o&&await n(this.db,t.GIT_AUTHOR_NAME,o.value.trim()||`ShadowClaw`);let s=e.querySelector(`[data-setting="git-author-email-input"]`);s&&await n(this.db,t.GIT_AUTHOR_EMAIL,s.value.trim()||`agent@example.com`),l(`Git settings saved`,3e3),this.updateGitWarning()}catch(e){u(`Error saving Git settings: `+(e instanceof Error?e.message:String(e)),6e3)}}async setDefaultAccount(e){if(this.db){this.defaultAccountId=e;try{let{setConfig:n}=await import(`./setConfig-DFMYnYLE.js`).then(e=>e.n);await n(this.db,t.GIT_DEFAULT_ACCOUNT,e)}catch(e){console.warn(`Error setting default account:`,e)}this.renderAccountList(),l(`Default account updated`,3e3)}}async updateGitWarning(){let e=this.shadowRoot;if(!e)return;let t=e.querySelector(`[data-setting="git-proxy-warning"]`);if(!t)return;let n=e.querySelector(`[data-setting="git-proxy-public"]`),r=this.accounts.some(e=>!!e.token);t.style.display=n?.checked&&r?`block`:`none`}};customElements.get(_)||customElements.define(_,x);export{x as ShadowClawGit};
|
|
447
|
+
</div>`),p.querySelector(`[data-action="save-account"]`)?.addEventListener(`click`,()=>this.saveAccountForm()),p.querySelector(`[data-action="cancel-account-form"]`)?.addEventListener(`click`,()=>this.hideAccountForm()),p.querySelector(`[data-field="acct-auth-mode"]`)?.addEventListener(`change`,()=>this.updateAuthModeVisibility(p)),p.querySelector(`[data-action="connect-oauth"]`)?.addEventListener(`click`,()=>void this.connectOAuthFromForm(p)),this.updateAuthModeVisibility(p))}updateAuthModeVisibility(e){let t=e.querySelector(`[data-field="acct-auth-mode"]`)?.value===`oauth`,n=e.querySelector(`[data-region="oauth-fields"]`),r=e.querySelector(`[data-region="pat-fields"]`);n instanceof HTMLElement&&(n.style.display=t?`block`:`none`),r instanceof HTMLElement&&(r.style.display=t?`none`:`block`)}updateCustomProxyVisibility(){let e=this.shadowRoot;if(!e)return;let t=e.querySelector(`[data-setting="git-proxy-custom"]`),n=e.querySelector(`[data-region="git-custom-proxy-field"]`);n instanceof HTMLElement&&(n.style.display=t?.checked?`block`:`none`)}async connectOAuthFromForm(e){let t=e.querySelector(`[data-field="acct-oauth-provider"]`)?.value,n=e.querySelector(`[data-field="acct-oauth-client-id"]`)?.value.trim(),r=e.querySelector(`[data-field="acct-oauth-client-secret"]`)?.value.trim(),i=e.querySelector(`[data-field="acct-oauth-scope"]`)?.value.trim();if(!t){u(`OAuth provider is required.`,4e3);return}if(!n){u(`OAuth client ID is required.`,4e3);return}let a=e.querySelector(`[data-region="oauth-status"]`),o=e.querySelector(`[data-action="connect-oauth"]`);a&&(a.textContent=`Starting OAuth...`),o&&(o.disabled=!0);try{let e=i?i.split(/[\s,]+/).map(e=>e.trim()).filter(Boolean):void 0,o=await fetch(`/oauth/authorize`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({providerId:t,clientId:n,clientSecret:r||void 0,redirectUri:`${window.location.origin}/oauth/callback`,scope:e})}),s=await o.json();if(!o.ok||!s.state||!s.authorizeUrl)throw Error(s.error||`OAuth authorize failed`);window.open(s.authorizeUrl,`shadowclaw-oauth`,`popup=yes,width=540,height=720`);let c=s.state,u=`pending`;for(let e=0;e<60;e++){let e=await fetch(`/oauth/session/${encodeURIComponent(c)}`),t=await e.json();if(!e.ok)throw Error(t.error||`OAuth session not found`);if(u=t.status||`pending`,u===`authorized`)break;if(u===`error`)throw Error(t.error||`OAuth authorization failed`);await new Promise(e=>setTimeout(e,1e3))}if(u!==`authorized`)throw Error(`OAuth authorization timed out`);let d=await fetch(`/oauth/token`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({state:c})}),f=await d.json();if(!d.ok||!f.accessToken)throw Error(f.error||`OAuth token exchange failed`);this.pendingOauthResult={providerId:t,accessToken:f.accessToken,refreshToken:f.refreshToken,expiresAt:f.expiresIn?Date.now()+f.expiresIn*1e3:void 0,scope:f.scope,tokenType:f.tokenType},a&&(a.textContent=`OAuth connected`),l(`OAuth connected`,3e3)}catch(e){let t=e instanceof Error?e.message:String(e);a&&(a.textContent=`OAuth failed`),u(`OAuth connect failed: ${t}`,6e3)}finally{o&&(o.disabled=!1)}}async deleteAccount(e){if(this.db){this.accounts=this.accounts.filter(t=>t.id!==e),this.defaultAccountId===e&&(this.defaultAccountId=this.accounts[0]?.id||``);try{let{setConfig:e}=await import(`./setConfig-DFMYnYLE.js`).then(e=>e.n);await e(this.db,t.GIT_ACCOUNTS,this.accounts),await e(this.db,t.GIT_DEFAULT_ACCOUNT,this.defaultAccountId)}catch(e){console.warn(`Error persisting account deletion:`,e)}this.renderAccountList(),this.updateGitWarning(),l(`Account deleted`,3e3)}}async migrateLegacyAccount(){if(!this.db)return;let e=await r(this.db,t.GIT_TOKEN),n=await r(this.db,t.GIT_USERNAME);if(!e&&!n)return;let i=await r(this.db,t.GIT_PASSWORD)||``,a={id:`legacy-migrated`,label:`GitHub`,hostPattern:`github.com`,token:e||``,username:n||``,password:i,authorName:``,authorEmail:``};this.accounts=[a],this.defaultAccountId=a.id;let{setConfig:o}=await import(`./setConfig-DFMYnYLE.js`).then(e=>e.n);await o(this.db,t.GIT_ACCOUNTS,this.accounts),await o(this.db,t.GIT_DEFAULT_ACCOUNT,a.id)}async render(){let e=this.shadowRoot;if(e)try{let n=await r(this.db,t.GIT_CORS_PROXY)||`local`,i=e.querySelector(`[data-setting="git-proxy-local"]`),a=e.querySelector(`[data-setting="git-proxy-public"]`),s=e.querySelector(`[data-setting="git-proxy-custom"]`),c=e.querySelector(`[data-setting="git-proxy-url-input"]`);i&&a&&s&&(i.checked=n===`local`,a.checked=n===`public`,s.checked=n===`custom`),c&&(c.value=o.gitProxyUrl||`/git-proxy`),this.updateCustomProxyVisibility();let l=e.querySelector(`[data-setting="git-author-name-input"]`);l&&(l.value=await r(this.db,t.GIT_AUTHOR_NAME)||`ShadowClaw`);let u=e.querySelector(`[data-setting="git-author-email-input"]`);u&&(u.value=await r(this.db,t.GIT_AUTHOR_EMAIL)||`agent@example.com`);let d=await r(this.db,t.GIT_ACCOUNTS);this.accounts=Array.isArray(d)?d:[],this.defaultAccountId=await r(this.db,t.GIT_DEFAULT_ACCOUNT)||``,this.accounts.length===0&&await this.migrateLegacyAccount(),this.renderAccountList(),this.updateGitWarning()}catch(e){console.warn(`Could not load git settings:`,e)}}async saveAccountForm(){if(!this.db)return;let e=this.shadowRoot;if(!e)return;let n=e.querySelector(`[data-region="account-form-slot"]`);if(!n)return;let r=n.querySelector(`[data-field="acct-label"]`)?.value.trim(),i=n.querySelector(`[data-field="acct-host"]`)?.value.trim(),a=n.querySelector(`[data-field="acct-auth-mode"]`)?.value;if(!r||!i){u(`Label and Host Pattern are required.`,4e3);return}try{let{encryptValue:e}=await import(`./crypto-C8c5wMzN.js`).then(e=>e.t),{setConfig:o}=await import(`./setConfig-DFMYnYLE.js`).then(e=>e.n),s=n.querySelector(`[data-field="acct-token"]`)?.value.trim(),c=n.querySelector(`[data-field="acct-password"]`)?.value.trim(),d=n.querySelector(`[data-field="acct-username"]`)?.value.trim()||``,f=n.querySelector(`[data-field="acct-author-name"]`)?.value.trim()||``,p=n.querySelector(`[data-field="acct-author-email"]`)?.value.trim()||``,m=this.editingAccountId===`new`,h=m?null:this.accounts.find(e=>e.id===this.editingAccountId),g=h?.token||``,_=h?.password||``,v=h?.oauthProviderId,y=h?.oauthClientId,b=h?.oauthClientSecret,x=h?.accessTokenExpiresAt,S=h?.refreshToken,C=h?.scopes,w=h?.tokenType,T=h?.oauthRefreshFailureCount,E=h?.oauthReauthRequired,D=h?.oauthReauthRequiredAt;if(a===`oauth`){v=n.querySelector(`[data-field="acct-oauth-provider"]`)?.value,y=n.querySelector(`[data-field="acct-oauth-client-id"]`)?.value.trim();let t=n.querySelector(`[data-field="acct-oauth-client-secret"]`)?.value.trim(),r=n.querySelector(`[data-field="acct-oauth-scope"]`)?.value.trim(),i=r?r.split(/[\s,]+/).map(e=>e.trim()).filter(Boolean):void 0;if(!v){u(`OAuth provider is required for OAuth mode.`,4e3);return}if(!y){u(`OAuth client ID is required for OAuth mode.`,4e3);return}if(t){let n=await e(t);n&&(b=n)}if(this.pendingOauthResult?.accessToken){let t=await e(this.pendingOauthResult.accessToken);if(t&&(g=t),this.pendingOauthResult.refreshToken){let t=await e(this.pendingOauthResult.refreshToken);t&&(S=t)}x=this.pendingOauthResult.expiresAt,C=this.pendingOauthResult.scope?this.pendingOauthResult.scope.split(/[\s,]+/).map(e=>e.trim()).filter(Boolean):i||C,w=this.pendingOauthResult.tokenType,T=0,E=!1,D=void 0}else C=i||C;if(!g){u(`Connect OAuth first to obtain an access token for this account.`,5e3);return}_=``}else{if(s){let t=await e(s);t&&(g=t)}if(c){let t=await e(c);t&&(_=t)}v=void 0,y=void 0,b=void 0,x=void 0,S=void 0,C=void 0,w=void 0,T=void 0,E=void 0,D=void 0}if(m){let{ulid:e}=await import(`./ulid-BY7rQVLN.js`).then(e=>e.n),n={id:e(),label:r,hostPattern:i,token:g,username:a===`oauth`?``:d,password:_,authorName:f,authorEmail:p,authMode:a||`token`,oauthProviderId:v,oauthClientId:y,oauthClientSecret:b,accessTokenExpiresAt:x,refreshToken:S,scopes:C,tokenType:w,oauthRefreshFailureCount:T,oauthReauthRequired:E,oauthReauthRequiredAt:D};this.accounts.push(n),this.accounts.length===1&&(this.defaultAccountId=n.id,await o(this.db,t.GIT_DEFAULT_ACCOUNT,n.id))}else h&&(h.label=r,h.hostPattern=i,h.token=g,h.username=a===`oauth`?``:d,h.password=_,h.authorName=f,h.authorEmail=p,h.authMode=a||`token`,h.oauthProviderId=v,h.oauthClientId=y,h.oauthClientSecret=b,h.accessTokenExpiresAt=x,h.refreshToken=S,h.scopes=C,h.tokenType=w,h.oauthRefreshFailureCount=T,h.oauthReauthRequired=E,h.oauthReauthRequiredAt=D);await o(this.db,t.GIT_ACCOUNTS,this.accounts),this.hideAccountForm(),this.renderAccountList(),this.updateGitWarning(),l(m?`Account added`:`Account updated`,3e3)}catch(e){u(`Error saving account: `+(e instanceof Error?e.message:String(e)),6e3)}}async saveGitSettings(){if(!this.db)return;let e=this.shadowRoot;if(e)try{let{setConfig:n}=await import(`./setConfig-DFMYnYLE.js`).then(e=>e.n),r=e.querySelector(`[data-setting="git-proxy-public"]`),i=e.querySelector(`[data-setting="git-proxy-custom"]`),a=r?.checked?`public`:i?.checked?`custom`:`local`;if(await n(this.db,t.GIT_CORS_PROXY,a),a===`custom`){let t=e.querySelector(`[data-setting="git-proxy-url-input"]`)?.value.trim()||`/git-proxy`,{orchestratorStore:n}=await import(`./orchestrator-BeJfwtvz.js`).then(e=>e.n);await n.setGitProxyUrl(this.db,t)}let o=e.querySelector(`[data-setting="git-author-name-input"]`);o&&await n(this.db,t.GIT_AUTHOR_NAME,o.value.trim()||`ShadowClaw`);let s=e.querySelector(`[data-setting="git-author-email-input"]`);s&&await n(this.db,t.GIT_AUTHOR_EMAIL,s.value.trim()||`agent@example.com`),l(`Git settings saved`,3e3),this.updateGitWarning()}catch(e){u(`Error saving Git settings: `+(e instanceof Error?e.message:String(e)),6e3)}}async setDefaultAccount(e){if(this.db){this.defaultAccountId=e;try{let{setConfig:n}=await import(`./setConfig-DFMYnYLE.js`).then(e=>e.n);await n(this.db,t.GIT_DEFAULT_ACCOUNT,e)}catch(e){console.warn(`Error setting default account:`,e)}this.renderAccountList(),l(`Default account updated`,3e3)}}async updateGitWarning(){let e=this.shadowRoot;if(!e)return;let t=e.querySelector(`[data-setting="git-proxy-warning"]`);if(!t)return;let n=e.querySelector(`[data-setting="git-proxy-public"]`),r=this.accounts.some(e=>!!e.token);t.style.display=n?.checked&&r?`block`:`none`}};customElements.get(_)||customElements.define(_,x);export{x as ShadowClawGit};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{P as e,R as t,c as n,r,u as i}from"./config-Bnwx4EfS.js";import{n as a}from"./txPromise-EBECky1b.js";import{t as o}from"./getConfig-D89uJgo5.js";import{u as s}from"./custom-element-security-Da_6HQ6X.js";import{$ as c,Ht as l,J as u,K as d,Nt as f,Q as p,W as m,_ as h,ct as g,d as _,et as v,f as y,g as b,h as x,it as S,lt as C,p as w,q as T,t as E,tt as D,v as O}from"./orchestrator-
|
|
1
|
+
import{P as e,R as t,c as n,r,u as i}from"./config-Bnwx4EfS.js";import{n as a}from"./txPromise-EBECky1b.js";import{t as o}from"./getConfig-D89uJgo5.js";import{u as s}from"./custom-element-security-Da_6HQ6X.js";import{$ as c,Ht as l,J as u,K as d,Nt as f,Q as p,W as m,_ as h,ct as g,d as _,et as v,f as y,g as b,h as x,it as S,lt as C,p as w,q as T,t as E,tt as D,v as O}from"./orchestrator-BeJfwtvz.js";import{t as k}from"./setConfig-DFMYnYLE.js";import{a as A,r as j,s as M}from"./toast-BXgUfbyh.js";import{t as N}from"./shadow-claw-element-DIrv3P6A.js";import{t as P}from"./effect-BJCrpFdp.js";import{n as F,r as I}from"./prompt-api-OUOP-B-R.js";import{n as L,t as R}from"./model-ranking-C60HgQ2c.js";const z=[{pattern:`gemma-3-1b-it-ONNX-GQA`,contextWindow:128e3},{pattern:`gemma-3-1b-it-ONNX`,contextWindow:128e3},{pattern:`Qwen3-0.6B-ONNX`,contextWindow:131072},{pattern:`Qwen3.5`,contextWindow:32768},{pattern:`Llama-3.2`,contextWindow:128e3},{pattern:`Phi-4`,contextWindow:128e3},{pattern:`Phi-3.5`,contextWindow:128e3},{pattern:`SmolLM`,contextWindow:8192},{pattern:`DeepSeek-R1`,contextWindow:128e3},{pattern:`LFM2`,contextWindow:32768},{pattern:`gpt-oss`,contextWindow:32768},{pattern:`gemma-4`,contextWindow:128e3},{pattern:`browser-built-in`,contextWindow:4096}];function B(e){let n=t.getModelInfo(e);if(n&&typeof n.contextWindow==`number`&&n.contextWindow>0)return n.contextWindow;for(let{pattern:t,contextWindow:n}of z)if(e.includes(t))return n;return null}function V(t,r,i){let a=r;t===`prompt_api`&&(r===`browser-built-in`||!r)&&(i?a=i:f()||(a=n));let o=e(a),s=typeof navigator>`u`?null:navigator,c=typeof s?.deviceMemory==`number`?s.deviceMemory:null,l=typeof s?.hardwareConcurrency==`number`?s.hardwareConcurrency:null;if(t===`prompt_api`||t===`transformers_js_browser`||t===`litert_lm_browser`||t===`ollama`){let e=B(a),t=o;c!==null&&(t=c>=32?Math.min(t,16384):c>=16?Math.min(t,8192):c>=8?Math.min(t,4096):Math.min(t,2048)),l!==null&&(l<=4?t=Math.min(t,2048):l>=16?t=Math.min(o,Math.max(t,8192)):l>=8&&(t=Math.min(o,Math.max(t,4096)))),/thinking|reasoning/i.test(a)&&(t=Math.min(t,4096)),t=Math.max(512,Math.min(t,o));let n=[];return e!==null&&n.push(`native context: ${e.toLocaleString()} tokens`),c!==null&&n.push(`${c} GB browser-reported memory`),l!==null&&n.push(`${l} CPU threads`),/thinking|reasoning/i.test(a)&&n.push(`reasoning model`),{recommended:t,detail:n.length>0?`Recommended for this device: ${t.toLocaleString()} tokens (${n.join(`, `)}). Model ceiling: ${o.toLocaleString()}.`:`Recommended for local inference: ${t.toLocaleString()} tokens. Model ceiling: ${o.toLocaleString()}.`}}return{recommended:o,detail:`Model-aware ceiling: ${o.toLocaleString()} tokens.`}}const H=new CSSStyleSheet;H.replaceSync(`*,
|
|
2
2
|
*::before,
|
|
3
3
|
*::after {
|
|
4
4
|
font-family: var(--shadow-claw-font-sans);
|
package/dist/public/{shadow-claw-networking--q6MgEAT.js → shadow-claw-networking-DJeCdb7e.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e}from"./txPromise-EBECky1b.js";import{m as t,t as n,x as r}from"./orchestrator-
|
|
1
|
+
import{n as e}from"./txPromise-EBECky1b.js";import{m as t,t as n,x as r}from"./orchestrator-BeJfwtvz.js";import{a as i,r as a,s as o}from"./toast-BXgUfbyh.js";import{t as s}from"./shadow-claw-element-DIrv3P6A.js";import{t as c}from"./effect-BJCrpFdp.js";const l=new CSSStyleSheet;l.replaceSync(`*,
|
|
2
2
|
*::before,
|
|
3
3
|
*::after {
|
|
4
4
|
font-family: var(--shadow-claw-font-sans);
|
package/dist/public/{shadow-claw-notifications-CrFUF0fl.js → shadow-claw-notifications-hSKJeMXb.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./config-Bnwx4EfS.js";import{n as t}from"./txPromise-EBECky1b.js";import{t as n}from"./getConfig-D89uJgo5.js";import{t as r}from"./setConfig-DFMYnYLE.js";import{a as i,i as a,n as o,r as s,t as c}from"./push-client-
|
|
1
|
+
import{r as e}from"./config-Bnwx4EfS.js";import{n as t}from"./txPromise-EBECky1b.js";import{t as n}from"./getConfig-D89uJgo5.js";import{t as r}from"./setConfig-DFMYnYLE.js";import{a as i,i as a,n as o,r as s,t as c}from"./push-client-C2zMT3Sf.js";import{a as l,r as u}from"./toast-BXgUfbyh.js";import{t as d}from"./shadow-claw-element-DIrv3P6A.js";import"./shadow-claw-empty-state-Bl52dGQ0.js";const f=new CSSStyleSheet;f.replaceSync(`*,
|
|
2
2
|
*::before,
|
|
3
3
|
*::after {
|
|
4
4
|
font-family: var(--shadow-claw-font-sans);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./config-Bnwx4EfS.js";import{c as t,d as n,n as r,o as i,r as a,s as o}from"./app-routes-BMQ4HFaM.js";import{n as s}from"./txPromise-EBECky1b.js";import{t as c}from"./getConfig-D89uJgo5.js";import{d as l,i as u,l as d,n as f,r as p,s as m,u as h}from"./custom-element-security-Da_6HQ6X.js";import{t as g}from"./dist-B9m1QM9v.js";import{a as _,c as v,dn as y,r as b,s as x,t as S}from"./orchestrator-
|
|
1
|
+
import{r as e}from"./config-Bnwx4EfS.js";import{c as t,d as n,n as r,o as i,r as a,s as o}from"./app-routes-BMQ4HFaM.js";import{n as s}from"./txPromise-EBECky1b.js";import{t as c}from"./getConfig-D89uJgo5.js";import{d as l,i as u,l as d,n as f,r as p,s as m,u as h}from"./custom-element-security-Da_6HQ6X.js";import{t as g}from"./dist-B9m1QM9v.js";import{a as _,c as v,dn as y,r as b,s as x,t as S}from"./orchestrator-BeJfwtvz.js";import{f as C,o as w,t as ee}from"./tools-Cp1gequ8.js";import{t as T}from"./buffer-9oRIc-5Z.js";import{a as E,r as D,s as te}from"./toast-BXgUfbyh.js";import{t as ne}from"./shadow-claw-element-DIrv3P6A.js";import{t as O}from"./effect-BJCrpFdp.js";import{t as re}from"./config-value-oBfKgLT4.js";import"./shadow-claw-page-header-action-button-Bmua3mAb.js";import"./shadow-claw-page-header-DA-FG08G.js";import{n as k,t as ie}from"./markdown-eFKxxpVP.js";import{t as ae}from"./file-viewer-vHJ5Zsgk.js";import{a as A,c as oe,i as se,l as ce,n as le,o as ue,r as de,s as fe,t as pe}from"./iframe-storage-proxy-BvRiccH0.js";function me(e,t,n){n&&(n.textContent=`Navigated to page: ${t||e.path}`)}function j(e,t){if(e===t||e===`main`&&t===`br:main`||e===`br:main`&&t===`main`)return!0;if(!e.includes(`:`)&&!t.includes(`:`))return!1;let n=e=>e.trim().replace(/:/g,`-`);return n(e)===n(t)}function M(e,t,a,s=typeof window<`u`?window.location.origin:``){let c=e.trim();if(!c||c.startsWith(`#`))return null;let l=c.split(/[?#]/,1)[0],u=l.replace(/^(?:\.\/)+/u,``),d=[];if(u.startsWith(`files/`)&&d.push(`/${u}`),l.startsWith(`/`)){let e=l.lastIndexOf(`/files/`);e>0&&d.push(l.slice(e)),d.push(l)}for(let e of d){let t=o(e);if(t&&j(t.groupId,a))return t.path}let f=n(c,r(i(a,t)),s||(typeof window<`u`?window.location.origin:``));if(!f||s&&f.origin!==s)return null;let p=o(f.pathname);return!p||!j(p.groupId,a)?null:p.path}function N(e,r,i,a,o=typeof window<`u`?window.location.origin:``){if(!e)return e;let s=o||(typeof window<`u`?window.location.origin:``),c=new DOMParser().parseFromString(e,`text/html`),l=(e,o)=>{let l=Array.from(c.querySelectorAll(e));for(let e of l){let c=(e.getAttribute(o)||``).trim();if(!c||c.startsWith(`#`)||c.startsWith(`javascript:`))continue;let l=n(c,i,s);!l||s&&l.origin!==s||o===`href`&&!(t(l.pathname)||M(c,r,a,s))||e.setAttribute(o,`${l.pathname}${l.search}${l.hash}`)}};return l(`a[href]`,`href`),l(`img[src]`,`src`),l(`audio[src]`,`src`),l(`video[src]`,`src`),l(`source[src]`,`src`),c.body.innerHTML}const he={ALLOWED_URI_REGEXP:/^(?:(?:https?|mailto|ftp|tel|file|blob|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,ADD_TAGS:[`iframe`,`figure`,`figcaption`],CUSTOM_ELEMENT_HANDLING:{tagNameCheck:e=>m(e),attributeNameCheck:()=>!0,allowCustomizedBuiltInElements:!1},ADD_ATTR:[`allow`,`allowfullscreen`,`frameborder`,`scrolling`,`referrerpolicy`,`loading`]};async function ge({content:e,filePath:t,searchParams:n=``,groupId:a,origin:o=typeof window<`u`?window.location?.origin:``,sanitizeOptions:s=he,resolveRelativeImagesInHtmlFn:c}){let l=r(i(a,t)),u=N(e,t,l,a,o),m=d(c?await c(u,t,a):u,s),h=crypto.randomUUID().replace(/-/g,``),g=r(`/assets/file-viewer-preview-bridge.js`),_=r(`/assets/iframe-storage-bridge.js`),v=f(),y=p(h),b=typeof document<`u`?document.getElementById(`shadow-claw-site-config`):null,x=b&&b.textContent?`<script id="shadow-claw-site-config" type="application/json">${b.textContent}<\/script>`:``,S=n?`<script nonce="${h}">(function(){try{Object.defineProperty(globalThis.location,"search",{get:function(){return ${JSON.stringify(n)};},configurable:true});}catch(e){}})();<\/script>`:``,C=v.map(({src:e,hasInit:t})=>{let n=e.startsWith(`http://`)||e.startsWith(`https://`)||e.startsWith(`//`)?e:r(e.startsWith(`/`)?e:`/${e.replace(/^pages\/main\//,``)}`),i=[`<script type="module" src="${n}" nonce="${h}"><\/script>`];return t&&i.push(`<script type="module" nonce="${h}">import("${n}").then((m) => { try { if (typeof m?.init === "function") m.init(); } catch (e) { console.error("[ShadowClaw] Error executing init for " + ${JSON.stringify(n)}, e); } }).catch(() => {});<\/script>`),i.join(`
|
|
2
2
|
`)}).join(`
|
|
3
3
|
`),w=ce();return[`<!doctype html>`,`<html class="${fe()}"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1">`,`<meta http-equiv="Content-Security-Policy" content="${y}">`,`<base href="${l}" target="_blank">`,S,x,`<script src="${_}" nonce="${h}"><\/script>`,`<script src="${g}" nonce="${h}"><\/script>`,oe(),w,C,`</head><body>`,m,`</body></html>`].join(``)}function _e(e,t){return t===0?{isPrevDisabled:!0,isNextDisabled:!0}:{isPrevDisabled:e<=0,isNextDisabled:e<0||e>=t-1}}async function P(e,t,n=e=>S.removeAllPages(e)){return!e||!await t({title:`Remove All Pages`,message:`Remove ALL saved pages from Pages? This cannot be undone!`,confirmLabel:`Remove All`,cancelLabel:`Cancel`})?!1:(await n(e),!0)}const F={setItem:A,deleteItem:le,clear:pe,getAll:se,getItem:de,putItem:A};async function I(e,t,n,r=F){switch(e){case`setItem`:await r.setItem(n,String(t.key||``),t.value);return;case`removeItem`:await r.deleteItem(n,String(t.key||``));return;case`clear`:await r.clear(n);return;case`getAllItems`:return await r.getAll(n);case`idb-get`:return await r.getItem(`${n}::idb::${t.dbName}::${t.storeName}`,String(t.key||``));case`idb-getAll`:return await r.getAll(`${n}::idb::${t.dbName}::${t.storeName}`);case`idb-put`:{let e=t.key==null?`__auto_${Date.now()}`:String(t.key);return await r.putItem(`${n}::idb::${t.dbName}::${t.storeName}`,e,t.value),e}case`idb-delete`:await r.deleteItem(`${n}::idb::${t.dbName}::${t.storeName}`,String(t.key||``));return;case`idb-clear`:await r.clear(`${n}::idb::${t.dbName}::${t.storeName}`);return;case`idb-deleteDatabase`:await r.clear(`${n}::idb::${t.dbName}::__default__`);return;case`idb-count`:{let e=await r.getAll(`${n}::idb::${t.dbName}::${t.storeName}`);return Object.keys(e).length}default:throw Error(`Unknown storage proxy method: ${e}`)}}async function ve(e,t,n,r,i,a=F){if(t)try{let o=await I(n,r,i,a);e.postMessage({type:`shadow-claw-storage-proxy-result`,requestId:t,result:o??null},`*`)}catch(n){e.postMessage({type:`shadow-claw-storage-proxy-result`,requestId:t,error:n instanceof Error?n.message:String(n)},`*`)}}function ye({root:e,rendered:t,selectedPath:n,onIframeLoad:r}){let i=e.querySelector(`[data-pages-iframe]`);if(i instanceof HTMLIFrameElement)return i;let a=document.createElement(`iframe`);return a.className=`pages__iframe`,a.setAttribute(`data-pages-iframe`,``),a.setAttribute(`title`,n?`Preview: ${n}`:`Page preview`),a.setAttribute(`sandbox`,u()),a.setAttribute(`allow`,`fullscreen`),a.hidden=!0,r&&a.addEventListener(`load`,()=>{r(a.contentWindow)}),t.before(a),a}function L(e){if(typeof e==`string`||typeof e==`number`){let t=parseInt(String(e),10);if(!isNaN(t)&&t>=0)return Math.min(t,86400)}return 0}async function be(t,n=c){if(!t)return 0;try{return L(await n(t,e.PAGES_AUTO_REFRESH_INTERVAL))}catch{return 0}}function R(e){if(!e)return``;let t=e.groupId;return t===`main`&&(t=`br:main`),`${t}\u0000${e.path}`}function z(e,t=[]){if(!e)return-1;let n=R(e);return t.findIndex(e=>R(e)===n)}function xe(e=[]){let t=new Map;return e.forEach(e=>{let n=t.get(e.groupId)||[];n.push(e),t.set(e.groupId,n)}),t}function Se(e,t){if(!t||t.hidden)return!1;let n=e.replace(/^#/,``),r=t.querySelector(`[id="${n}"]`)||t.querySelector(`a[name="${n}"]`);return r?(r.scrollIntoView({behavior:`smooth`,block:`start`}),!0):!1}function Ce(e){let t=e.detail;return t&&t.interval!==void 0?L(t.interval):null}function we(e,t){return!e||!t||!e.groupId||!e.path||e.path!==t.path?!1:e.groupId===t.groupId||j(e.groupId,t.groupId)}function Te(e,t){let n=e.detail;return we(n,t)}function B(e,t){let n=[`data-no-nav`,`data-no-swipe`,`data-no-page-nav`,`data-prevent-nav`,`data-prevent-page-nav`,`data-isolate-input`,`data-isolate-navigation`,`data-game-controls`],r=e=>{if(!e||!(e instanceof HTMLElement))return!1;let t=e.tagName.toLowerCase();return!!(t===`input`||t===`textarea`||t===`select`||t===`option`||t===`iframe`||e.classList.contains(`pages__preview-frame`)||e.isContentEditable||e.contentEditable===`true`||e.getAttribute(`contenteditable`)===`true`||e.hasAttribute(`contenteditable`)||e.closest(`[data-pages-list]`)||e.closest(`[data-pages-dropdown]`)||e.closest(`.pages__sidebar`)||e.closest(`.pages__preview-frame`)||e.closest(`iframe`)||n.some(t=>e.closest(`[${t}]`)))};if(t&&r(t))return!0;if(e){let t=typeof e.composedPath==`function`?e.composedPath():[];for(let e of t)if(e instanceof HTMLElement){let t=e.tagName.toLowerCase();if(n.some(t=>e.hasAttribute(t))||t===`input`||t===`textarea`||t===`select`||t===`option`||t===`iframe`||e.classList.contains(`pages__preview-frame`)||e.isContentEditable||e.contentEditable===`true`||e.getAttribute(`contenteditable`)===`true`||e.hasAttribute(`contenteditable`))return!0}if(e.target&&r(e.target))return!0}return!1}function Ee(e,t){return t||e.key!==`ArrowLeft`&&e.key!==`ArrowRight`||e.ctrlKey||e.altKey||e.metaKey?null:e.key===`ArrowLeft`?`previous`:`next`}function De(e,t,n,r){if(!t)return;let i=n?.activeElement||document.activeElement,a=Ee(e,B(e,e.target||null)||B(void 0,i));a&&(e.preventDefault(),r(a))}function Oe(e,t,n=Date.now()){return e.button!==0||t?{mouseStartX:0,mouseStartY:0,mouseStartTime:0,isMouseDown:!1}:{mouseStartX:e.clientX,mouseStartY:e.clientY,mouseStartTime:n,isMouseDown:!0}}function V(e,t,n,r,i,a=Date.now(),o=50,s=600){let c=n-e,l=r-t,u=a-i;return Math.abs(c)>=o&&Math.abs(c)>Math.abs(l)&&u<=s?c<0?`next`:`previous`:null}function ke(e,t,n,r,i=Date.now()){return!t.isMouseDown||n||r?null:V(t.mouseStartX,t.mouseStartY,e.clientX,e.clientY,t.mouseStartTime,i)}function Ae(e,t,n){if(t===n||t<0||t>=e.length||n<0||n>=e.length)return e;let r=[...e],[i]=r.splice(t,1);return r.splice(n,0,i),r}async function je({db:e,currentPages:t,fromIndex:n,toIndex:r,reorderStoreFn:i=(e,t)=>S.reorderPages(e,t)}){if(!e||n===r)return{reordered:!1,reorderedPages:t,movedToFirst:null};let a=Ae(t,n,r);if(a===t)return{reordered:!1,reorderedPages:t,movedToFirst:null};await i(e,a);let o=a[r]||null;return{reordered:!0,reorderedPages:a,movedToFirst:r===0?o:null}}function Me(e,t,n,r=Date.now()){if(!t.touchStartTime||n)return null;if(e.changedTouches&&e.changedTouches.length===1){let n=e.changedTouches[0].clientX,i=e.changedTouches[0].clientY;return V(t.touchStartX,t.touchStartY,n,i,t.touchStartTime,r)}return null}function Ne(e,t,n=Date.now()){return t?{touchStartX:0,touchStartY:0,touchStartTime:0}:e.touches&&e.touches.length===1?{touchStartX:e.touches[0].clientX,touchStartY:e.touches[0].clientY,touchStartTime:n}:null}function Pe(e,t,n){return!e&&t?`render-and-timer`:e&&n?`clear-timer`:`noop`}function Fe(e,t){return!e&&t}function Ie(e){return/\.(html?|xhtml)$/iu.test(e)}function Le(e){return/\.(md|markdown)$/iu.test(e)}function Re(e){if(!e||typeof e!=`object`)return null;let t=e;return t.type===`shadow-claw-broadcast-result`&&typeof t.channel==`string`?{kind:`broadcast-result`,channel:t.channel,payload:t.payload}:t.type===`shadow-claw-storage-proxy`?{kind:`storage-proxy`,requestId:String(t.requestId||``),method:String(t.method||``),args:t.args&&typeof t.args==`object`?t.args:{}}:t.type===`shadow-claw-swipe`&&typeof t.direction==`string`?{kind:`swipe`,direction:t.direction}:t.type===`shadow-claw-iframe-resize`&&typeof t.height==`number`?{kind:`iframe-resize`,height:t.height}:t.type===`shadow-claw-file-viewer-link`&&typeof t.href==`string`?{kind:`file-viewer-link`,href:t.href}:null}var H=T();function U(e){return{apng:`image/apng`,avif:`image/avif`,gif:`image/gif`,jpg:`image/jpeg`,jpeg:`image/jpeg`,png:`image/png`,svg:`image/svg+xml`,webp:`image/webp`}[e]??`image/jpeg`}async function ze({db:e,groupId:t,workspacePath:n,readGroupFileBytesFn:i=y,writeGroupFileFn:a=w,fetchFn:o=typeof fetch<`u`?fetch:void 0}){if(e)try{let r=await i(e,t,n),a=U(n.split(`.`).pop()?.toLowerCase()||``),o=new Uint8Array(r.byteLength);return o.set(new Uint8Array(r)),`data:${a};base64,${H.Buffer.from(o).toString(`base64`)}`}catch{}if(!o)return null;try{let i=n.replace(/^\/+/,``),s=[r(`/files/main/${i}`),r(`/static-main/${i}`),r(`/pages/main/${i}`)];for(let r of s)try{let i=await o(typeof window<`u`&&window.location?.origin?new URL(r,window.location.origin).toString():r);if(i.ok){let r=await i.blob();if(e)try{let i=await r.arrayBuffer();await a(e,t,n,new Uint8Array(i))}catch{}if(typeof FileReader<`u`)return await new Promise((e,t)=>{let n=new FileReader;n.onload=()=>e(n.result),n.onerror=t,n.readAsDataURL(r)});let o=await r.arrayBuffer(),s=H.Buffer.from(o).toString(`base64`);return`data:${r.type||U(n.split(`.`).pop()||``)};base64,${s}`}}catch{}}catch{}return null}function W(e){let t=e.querySelector(`[data-pages-iframe]`);t instanceof HTMLIFrameElement&&(t.removeAttribute(`srcdoc`),t.remove())}async function G(e,t=typeof document<`u`?document.querySelector(`shadow-claw`):null,n=te){return t&&typeof t.requestDialog==`function`?await t.requestDialog({mode:`confirm`,...e}):(n(e.message,4500),!1)}async function Be(e,t,n=c){if(!e||typeof e.transaction!=`function`)return!0;try{return re(await n(e,t),!0)}catch{return!0}}function Ve(e,t,n=[]){if(e===t||j(e,t))return t;let r=n.find(t=>t.groupId===e);if(r)return r.groupId;let i=n.find(t=>j(e,t.groupId));return i?i.groupId:e||null}function He(e,t,n,r=[],i=typeof window<`u`?window.location.origin:``){let a=e.trim();if(!a||a.startsWith(`#`))return null;let s=[],c=a.split(/[?#]/,1)[0];if(/^[a-zA-Z][a-zA-Z\d+.-]*:/u.test(c)||c.startsWith(`//`)){let e;try{e=new URL(c,i||(typeof window<`u`?window.location.origin:``))}catch{return null}if(i&&e.origin!==i)return null;c=e.pathname}let l=c.replace(/^(?:\.\/)+/u,``);if(l.startsWith(`files/`)&&s.push(`/${l}`),c.startsWith(`/`)){let e=c.lastIndexOf(`/files/`);e>0&&s.push(c.slice(e)),s.push(c)}for(let e of s){let t=o(e);if(!t)continue;let i=Ve(t.groupId,n,r);if(i)return{groupId:i,path:t.path}}let u=M(a,t,n,i);return u?{groupId:n,path:u}:null}async function Ue({container:e,groupId:t,filePath:n,groups:r,readImageAsDataUrlFn:i}){let a=Array.from(e.querySelectorAll(`img[src]`));a.length!==0&&await Promise.all(a.map(async e=>{let a=e.getAttribute(`src`)||``;if(!a||/^(?:blob:|data:|#)/u.test(a))return;let o=He(a,n,t,r);if(!o)return;let s=await i(o.groupId,o.path);s&&e.setAttribute(`src`,s)}))}function K(e,t,n){return e>0&&!t&&n}function q(e){if(!e)return;let t=typeof document<`u`&&document.documentElement.classList.contains(`dark-mode`),n={};if(typeof document<`u`&&typeof getComputedStyle<`u`){let e=getComputedStyle(document.documentElement);for(let t=0;t<e.length;t++){let r=e[t];r.startsWith(`--`)&&(n[r]=e.getPropertyValue(r))}}e.postMessage({type:`shadow-claw-theme-update`,theme:t?`dark`:`light`,customProperties:n},`*`)}function We({root:e,currentOpen:t,force:n}){if(!e)return t;let r=e.querySelector(`[data-pages-dropdown]`),i=r instanceof HTMLDetailsElement&&r.open,a;a=n===void 0?!(i||t):n;let o=e.querySelector(`.pages__sidebar`),s=e.querySelector(`.pages__content`);return o&&o.classList.toggle(`collapsed`,!a),s&&s.classList.toggle(`pages__content--sidebar-collapsed`,!a),r instanceof HTMLDetailsElement&&(a?r.setAttribute(`open`,``):r.removeAttribute(`open`)),a}const J=new CSSStyleSheet;J.replaceSync(`* {
|
|
4
4
|
box-sizing: border-box;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./config-Bnwx4EfS.js";import{n as t}from"./txPromise-EBECky1b.js";import{g as n}from"./custom-element-security-Da_6HQ6X.js";import{Z as r,a as i,c as a,t as o}from"./orchestrator-
|
|
1
|
+
import{r as e}from"./config-Bnwx4EfS.js";import{n as t}from"./txPromise-EBECky1b.js";import{g as n}from"./custom-element-security-Da_6HQ6X.js";import{Z as r,a as i,c as a,t as o}from"./orchestrator-BeJfwtvz.js";import{s}from"./tools-Cp1gequ8.js";import{n as c,r as l}from"./crypto-C8c5wMzN.js";import{a as u,i as d,r as f}from"./toast-BXgUfbyh.js";import{t as p}from"./shadow-claw-element-DIrv3P6A.js";import{t as m}from"./config-value-oBfKgLT4.js";import"./shadow-claw-page-header-DA-FG08G.js";import"./shadow-claw-dialog-BrOwAOdk.js";function h(e){try{return JSON.parse(JSON.stringify(e))}catch{return null}}async function g(t,n){let r=[],i=[];for(let a of t){let t=a.key;if(t===e.STORAGE_HANDLE)continue;if(t===e.GIT_PASSWORD||t===e.API_KEY||t.startsWith(`api_key:`)||t===e.IMESSAGE_API_KEY||t===e.TELEGRAM_BOT_TOKEN){if(n&&typeof a.value==`string`){let e=await c(a.value);e&&i.push({key:t,path:[],value:e})}continue}let o=h(a.value);if(t===e.GIT_ACCOUNTS&&Array.isArray(o))for(let e=0;e<o.length;e+=1){let r=o[e];if(!r||typeof r!=`object`)continue;let a=r.password;if(typeof a==`string`&&a){if(n){let n=await c(a);n&&i.push({key:t,path:[e,`password`],value:n})}delete r.password}}if(t===e.INTEGRATION_CONNECTIONS&&Array.isArray(o))for(let e=0;e<o.length;e+=1){let r=o[e]?.credentialRef,a=r?.encryptedSecret;if(typeof a==`string`&&a){if(n){let n=await c(a);n&&i.push({key:t,path:[e,`credentialRef`,`encryptedSecret`],value:n})}delete r.encryptedSecret}}if(t===e.REMOTE_MCP_CONNECTIONS&&Array.isArray(o))for(let e=0;e<o.length;e+=1){let r=o[e]?.credentialRef,a=r?.encryptedValue;if(typeof a==`string`&&a){if(n){let n=await c(a);n&&i.push({key:t,path:[e,`credentialRef`,`encryptedValue`],value:n})}delete r.encryptedValue}}r.push({key:t,value:o})}return{configEntries:r,plaintextPasswords:i}}function _(e,t,n){if(t.length===0)return n;let r=e;for(let n=0;n<t.length-1;n+=1){let i=t[n];if(typeof i==`number`){if(!Array.isArray(r)||!r[i])return e;r=r[i]}else{if(!r||typeof r!=`object`)return e;let t=r[i];if(!t||typeof t!=`object`)return e;r=t}}let i=t[t.length-1];if(typeof i==`number`){if(!Array.isArray(r))return e;r[i]=n}else{if(!r||typeof r!=`object`)return e;r[i]=n}return e}async function v(e,t){let n=await g(e,t);return{kind:`shadowclaw-settings-backup`,version:1,exportedAt:Date.now(),includePlaintextPasswords:t,configEntries:n.configEntries,plaintextPasswords:t?n.plaintextPasswords:void 0}}async function y(e,t){let n=await v(e,t);return new Blob([JSON.stringify(n,null,2)],{type:`application/json`})}async function b(e,t,n){let r=await v(t,n);await s(e,JSON.stringify(r,null,2))}async function x(e,t){if(!t.length)return e;let n=e.map(e=>({key:e.key,value:h(e.value)}));for(let e of t){let t=await l(e.value);if(!t)continue;let r=n.find(t=>t.key===e.key);r?r.value=_(r.value,e.path,t):e.path.length===0&&n.push({key:e.key,value:t})}return n}function S(e){let t=JSON.parse(e);if(t?.kind!==`shadowclaw-settings-backup`||t.version!==1||!Array.isArray(t.configEntries))throw Error(`Invalid settings backup file`);let n=Array.isArray(t.plaintextPasswords)?t.plaintextPasswords.filter(e=>e&&typeof e.key==`string`&&Array.isArray(e.path)&&typeof e.value==`string`):[];return{kind:`shadowclaw-settings-backup`,version:1,exportedAt:typeof t.exportedAt==`number`?t.exportedAt:Date.now(),includePlaintextPasswords:!!t.includePlaintextPasswords,configEntries:t.configEntries.filter(e=>e&&typeof e.key==`string`).map(e=>({key:e.key,value:e.value})),plaintextPasswords:n}}const C=new CSSStyleSheet;C.replaceSync(`*,
|
|
2
2
|
*::before,
|
|
3
3
|
*::after {
|
|
4
4
|
font-family: var(--shadow-claw-font-sans);
|
|
@@ -885,7 +885,7 @@ import{r as e}from"./config-Bnwx4EfS.js";import{n as t}from"./txPromise-EBECky1b
|
|
|
885
885
|
</div>
|
|
886
886
|
</div>
|
|
887
887
|
</template>
|
|
888
|
-
`,`text/html`),T=w.querySelector(`template`);let E=[];E=T?Array.from(T.content.children):Array.from(w.head.children).concat(Array.from(w.body.children));var D=E;const O={ai:[()=>import(`./shadow-claw-llm-jeGVNciG.js`)],environment:[()=>import(`./shadow-claw-networking--q6MgEAT.js`),()=>import(`./shadow-claw-webvm-CyI23mQT.js`),()=>import(`./shadow-claw-storage-PLX9EFGn.js`)],integrations:[()=>import(`./shadow-claw-git-CXrECHKy.js`),()=>import(`./shadow-claw-accounts-D1y-zbMs.js`),()=>import(`./shadow-claw-mcp-remote-DyGnK4S_.js`),()=>import(`./shadow-claw-control-plane-BqjEyhx7.js`),()=>import(`./shadow-claw-integrations-CRGL78Fy.js`),()=>import(`./shadow-claw-task-server-BMps7aSr.js`),()=>import(`./shadow-claw-notifications-CrFUF0fl.js`)]},k=new Set;async function A(e){if(k.has(e))return;let t=O[e];t&&(k.add(e),await Promise.all(t.map(e=>e())))}const j=`shadow-claw-settings`;var M=class extends p{static styles=C;static template=D;activeTab=`ai`;db=null;orchestrator=null;pendingRestoreFile=null;constructor(){super()}async connectedCallback(){if(!this.shadowRoot)throw Error(`shadowRoot not found`);this.db=await t(),this.orchestrator=o.orchestrator,await this.render()}activateTab(e){!e||this.activeTab===e||(this.activeTab=e,this.applyTabState())}applyTabState(){A(this.activeTab).catch(console.error);let e=this.shadowRoot;e&&(e.querySelectorAll(`[data-tab-target]`).forEach(e=>{let t=e.dataset.tabTarget===this.activeTab;e.classList.toggle(`active`,t),e.setAttribute(`aria-selected`,String(t)),e.tabIndex=t?0:-1}),e.querySelectorAll(`[data-tab-panel]`).forEach(e=>{e.hidden=e.dataset.tabPanel!==this.activeTab}))}bindSettingsActions(){let e=this.shadowRoot;if(!e)return;e.querySelector(`[data-action="backup-settings"]`)?.addEventListener(`click`,()=>this.openBackupDialog());let t=e.querySelector(`.settings__restore-input`);e.querySelector(`[data-action="restore-settings"]`)?.addEventListener(`click`,()=>{t instanceof HTMLInputElement&&(t.value=``,t.click())}),t?.addEventListener(`change`,e=>{let t=e.target;if(!(t instanceof HTMLInputElement))return;let n=t.files?.[0]||null;n&&(this.pendingRestoreFile=n,this.openRestoreDialog(n.name))}),e.querySelector(`[data-action="clear-settings"]`)?.addEventListener(`click`,()=>this.openClearDialog()),e.querySelector(`[data-action="cancel-backup-settings"]`)?.addEventListener(`click`,()=>this.closeDialog(`.settings__backup-dialog`)),e.querySelector(`[data-action="confirm-backup-settings"]`)?.addEventListener(`click`,()=>{this.confirmBackup()}),e.querySelector(`[data-action="cancel-restore-settings"]`)?.addEventListener(`click`,()=>{this.pendingRestoreFile=null,this.closeDialog(`.settings__restore-dialog`)}),e.querySelector(`[data-action="confirm-restore-settings"]`)?.addEventListener(`click`,()=>{this.confirmRestore()}),e.querySelector(`[data-action="cancel-clear-settings"]`)?.addEventListener(`click`,()=>this.closeDialog(`.settings__clear-dialog`)),e.querySelector(`[data-action="confirm-clear-settings"]`)?.addEventListener(`click`,()=>{this.confirmClear()}),e.querySelector(`[data-action="save-assistant-name"]`)?.addEventListener(`click`,()=>this.saveAssistantName()),e.querySelector(`[data-setting="activity-log-disk-logging-toggle"]`)?.addEventListener(`change`,e=>{let t=e.target;t&&this.onActivityLogDiskLoggingToggle(t.checked)}),e.querySelector(`[data-setting="sidebar-hide-pages-toggle"]`)?.addEventListener(`change`,e=>{let t=e.target;t&&this.onSidebarHidePagesToggle(t.checked)}),e.querySelector(`[data-setting="sidebar-hide-chat-toggle"]`)?.addEventListener(`change`,e=>{let t=e.target;t&&this.onSidebarHideChatToggle(t.checked)}),e.querySelector(`[data-setting="sidebar-hide-tasks-toggle"]`)?.addEventListener(`change`,e=>{let t=e.target;t&&this.onSidebarHideTasksToggle(t.checked)}),e.querySelector(`[data-setting="sidebar-hide-files-toggle"]`)?.addEventListener(`change`,e=>{let t=e.target;t&&this.onSidebarHideFilesToggle(t.checked)}),e.querySelector(`[data-setting="chat-split-view-toggle"]`)?.addEventListener(`change`,e=>{let t=e.target;t&&this.onChatSplitViewToggle(t.checked)}),e.querySelector(`[data-setting="pages-auto-refresh-input"]`)?.addEventListener(`change`,e=>{let t=e.target;if(t){let e=parseInt(t.value,10);this.onPagesAutoRefreshInputChange(isNaN(e)?0:e)}}),e.querySelector(`[data-setting="override-prerender-skeleton-toggle"]`)?.addEventListener(`change`,e=>{let t=e.target;t&&this.onOverridePrerenderSkeletonToggle(t.checked)}),e.querySelector(`[data-action="save-dom-allowed-iframe-hosts"]`)?.addEventListener(`click`,()=>{this.saveDomAllowedIframeHosts()})}closeDialog(e){this.getDialog(e)?.close()}getDialog(e){let t=this.shadowRoot;if(!t)return null;let n=t.querySelector(e);return n instanceof HTMLDialogElement?n:null}handleTabKeydown(e,t){let n=this.shadowRoot;if(!n)return;let r=Array.from(n.querySelectorAll(`[data-tab-target]`)),i=r.indexOf(t);if(i<0)return;let a=-1;switch(e.key){case`ArrowRight`:case`ArrowDown`:a=(i+1)%r.length;break;case`ArrowLeft`:case`ArrowUp`:a=(i-1+r.length)%r.length;break;case`Home`:a=0;break;case`End`:a=r.length-1;break;default:return}e.preventDefault();let o=r[a];o.focus(),this.activateTab(o.dataset.tabTarget)}openBackupDialog(){let e=this.shadowRoot?.querySelector(`[data-setting="include-plaintext-passwords"]`);e instanceof HTMLInputElement&&(e.checked=!1),this.showDialog(`.settings__backup-dialog`)}openClearDialog(){this.showDialog(`.settings__clear-dialog`)}openRestoreDialog(e){let t=this.shadowRoot?.querySelector(`[data-info="restore-filename"]`);t instanceof HTMLElement&&(t.textContent=`Selected file: ${e}`),this.showDialog(`.settings__restore-dialog`)}showDialog(e){let t=this.getDialog(e);if(t){if(typeof t.showModal==`function`){t.showModal();return}t.setAttribute(`open`,``)}}async confirmBackup(){if(!this.db){f(`Settings database is unavailable`,5e3);return}let e=this.shadowRoot?.querySelector(`[data-setting="include-plaintext-passwords"]`),t=e instanceof HTMLInputElement&&e.checked;try{if(t){let e=await this.promptForPlaintextBackupHandle();if(!e)return;await b(e,await this.getAllConfigEntries(),t),this.closeDialog(`.settings__backup-dialog`),u(`Settings backup saved`,3e3);return}let e=await y(await this.getAllConfigEntries(),t),n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=`shadowclaw-settings-backup-${Date.now()}.json`,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(n),this.closeDialog(`.settings__backup-dialog`),u(`Settings backup downloaded`,3e3)}catch(e){f(`Failed to backup settings: ${e instanceof Error?e.message:String(e)}`,6e3)}}async confirmClear(){if(!this.db){f(`Settings database is unavailable`,5e3);return}try{await this.replaceConfigEntries([]),this.closeDialog(`.settings__clear-dialog`),d(`Settings cleared. Reloading app...`,3200),setTimeout(()=>{window.location.reload()},250)}catch(e){f(`Failed to clear settings: ${e instanceof Error?e.message:String(e)}`,6e3)}}async confirmRestore(){if(!this.db){f(`Settings database is unavailable`,5e3);return}let e=this.pendingRestoreFile;if(!e){f(`No backup file selected`,4e3);return}try{let t=S(await e.text()),n=await x(t.configEntries,t.plaintextPasswords||[]);await this.replaceConfigEntries(n),this.pendingRestoreFile=null,this.closeDialog(`.settings__restore-dialog`),u(`Settings restored. Reloading app...`,3200),setTimeout(()=>{window.location.reload()},250)}catch(e){f(`Failed to restore settings: ${e instanceof Error?e.message:String(e)}`,6e3)}}async getAllConfigEntries(){if(!this.db)throw Error(`Database is unavailable`);return await new Promise((e,t)=>{try{let n=this.db?.transaction(`config`,`readonly`);if(!n){t(Error(`Failed to open read transaction`));return}let r=n.objectStore(`config`).getAll();r.onsuccess=()=>{e((Array.isArray(r.result)?r.result:[]).filter(e=>e&&typeof e.key==`string`).map(e=>({key:e.key,value:e.value})))},r.onerror=()=>{t(r.error||Error(`Failed to read settings config`))}}catch(e){t(e)}})}async onActivityLogDiskLoggingToggle(t){if(this.db)try{let{setConfig:n}=await import(`./setConfig-DFMYnYLE.js`).then(e=>e.n);await n(this.db,e.ACTIVITY_LOG_DISK_LOGGING_ENABLED,t?`true`:`false`),u(t?`Activity log disk logging enabled`:`Activity log disk logging disabled`,2500)}catch(e){f(`Error saving activity log disk logging setting: `+(e instanceof Error?e.message:String(e)),6e3)}}async onChatSplitViewToggle(t){if(this.db)try{let{setConfig:n}=await import(`./setConfig-DFMYnYLE.js`).then(e=>e.n);await n(this.db,e.CHAT_SPLIT_VIEW_ENABLED,t?`true`:`false`),this.dispatchEvent(new CustomEvent(`chat-split-view-change`,{detail:{enabled:t},bubbles:!0,composed:!0})),u(t?`Horizontal Chat split view enabled`:`Horizontal Chat split view disabled`,2500)}catch(e){f(`Error saving Chat split view setting: `+(e instanceof Error?e.message:String(e)),6e3)}}async onOverridePrerenderSkeletonToggle(t){try{a(`shadow-claw-override-prerender-skeleton`,t?`true`:`false`)}catch(e){console.warn(`Unable to save setting to localStorage:`,e)}if(this.db)try{let{setConfig:n}=await import(`./setConfig-DFMYnYLE.js`).then(e=>e.n);await n(this.db,e.OVERRIDE_PRERENDER_SKELETON,t?`true`:`false`),u(t?`Pre-rendered content override enabled`:`Pre-rendered content override disabled`,2500)}catch(e){f(`Error saving pre-rendered content override setting: `+(e instanceof Error?e.message:String(e)),6e3)}}async onPagesAutoRefreshInputChange(t){if(!this.db)return;let n=Math.max(0,Math.min(t,86400));try{let{setConfig:t}=await import(`./setConfig-DFMYnYLE.js`).then(e=>e.n);await t(this.db,e.PAGES_AUTO_REFRESH_INTERVAL,String(n)),window.dispatchEvent(new CustomEvent(`shadow-claw-pages-auto-refresh-change`,{detail:{interval:n}})),u(n>0?`Pages auto refresh set to ${n}s`:`Pages auto refresh disabled`,2500)}catch(e){f(`Error saving Pages auto refresh interval: `+(e instanceof Error?e.message:String(e)),6e3)}}async onSidebarHideChatToggle(t){if(this.db)try{let{setConfig:n}=await import(`./setConfig-DFMYnYLE.js`).then(e=>e.n);await n(this.db,e.SIDEBAR_CHAT_HIDDEN,t?`true`:`false`),this.dispatchEvent(new CustomEvent(`sidebar-chat-visibility-change`,{detail:{hidden:t},bubbles:!0,composed:!0})),u(t?`Chat hidden in sidebar`:`Chat shown in sidebar`,2500)}catch(e){f(`Error saving sidebar Chat visibility: `+(e instanceof Error?e.message:String(e)),6e3)}}async onSidebarHideFilesToggle(t){if(this.db)try{let{setConfig:n}=await import(`./setConfig-DFMYnYLE.js`).then(e=>e.n);await n(this.db,e.SIDEBAR_FILES_HIDDEN,t?`true`:`false`),this.dispatchEvent(new CustomEvent(`sidebar-files-visibility-change`,{detail:{hidden:t},bubbles:!0,composed:!0})),u(t?`Files hidden in sidebar`:`Files shown in sidebar`,2500)}catch(e){f(`Error saving sidebar Files visibility: `+(e instanceof Error?e.message:String(e)),6e3)}}async onSidebarHidePagesToggle(t){if(this.db)try{let{setConfig:n}=await import(`./setConfig-DFMYnYLE.js`).then(e=>e.n);await n(this.db,e.SIDEBAR_PAGES_HIDDEN,t?`true`:`false`),this.dispatchEvent(new CustomEvent(`sidebar-pages-visibility-change`,{detail:{hidden:t},bubbles:!0,composed:!0})),u(t?`Pages hidden in sidebar`:`Pages shown in sidebar`,2500)}catch(e){f(`Error saving sidebar Pages visibility: `+(e instanceof Error?e.message:String(e)),6e3)}}async onSidebarHideTasksToggle(t){if(this.db)try{let{setConfig:n}=await import(`./setConfig-DFMYnYLE.js`).then(e=>e.n);await n(this.db,e.SIDEBAR_TASKS_HIDDEN,t?`true`:`false`),this.dispatchEvent(new CustomEvent(`sidebar-tasks-visibility-change`,{detail:{hidden:t},bubbles:!0,composed:!0})),u(t?`Tasks hidden in sidebar`:`Tasks shown in sidebar`,2500)}catch(e){f(`Error saving sidebar Tasks visibility: `+(e instanceof Error?e.message:String(e)),6e3)}}async populateAssistantSettings(){let t=this.shadowRoot;if(!t||!this.db)return;let n=t.querySelector(`[data-setting="assistant-name-input"]`);if(n){let{getConfig:t}=await import(`./getConfig-D89uJgo5.js`).then(e=>e.n),r=await t(this.db,e.ASSISTANT_NAME),i=this.orchestrator?.assistantName||o.orchestrator?.assistantName;n.value=typeof r==`string`&&r||i||`ShadowClaw`}let{getConfig:r}=await import(`./getConfig-D89uJgo5.js`).then(e=>e.n),s=await r(this.db,e.ACTIVITY_LOG_DISK_LOGGING_ENABLED),c=s===!0||s===`true`||s===1||s===`1`,l=t.querySelector(`[data-setting="activity-log-disk-logging-toggle"]`);l&&(l.checked=c);let u=await r(this.db,e.SIDEBAR_PAGES_HIDDEN),d=u===!0||u===`true`||u===1||u===`1`,f=t.querySelector(`[data-setting="sidebar-hide-pages-toggle"]`);f&&(f.checked=d);let p=await r(this.db,e.SIDEBAR_CHAT_HIDDEN),h=p===!0||p===`true`||p===1||p===`1`,g=t.querySelector(`[data-setting="sidebar-hide-chat-toggle"]`);g&&(g.checked=h);let _=await r(this.db,e.SIDEBAR_TASKS_HIDDEN),v=_===!0||_===`true`||_===1||_===`1`,y=t.querySelector(`[data-setting="sidebar-hide-tasks-toggle"]`);y&&(y.checked=v);let b=await r(this.db,e.SIDEBAR_FILES_HIDDEN),x=b===!0||b===`true`||b===1||b===`1`,S=t.querySelector(`[data-setting="sidebar-hide-files-toggle"]`);S&&(S.checked=x);let C=m(await r(this.db,e.CHAT_SPLIT_VIEW_ENABLED),!1),w=t.querySelector(`[data-setting="chat-split-view-toggle"]`);w&&(w.checked=C);let T=t.querySelector(`[data-setting="pages-auto-refresh-input"]`);if(T){let t=await r(this.db,e.PAGES_AUTO_REFRESH_INTERVAL);if(typeof t==`string`||typeof t==`number`){let e=parseInt(String(t),10);T.value=!isNaN(e)&&e>=0?String(e):`0`}else T.value=`0`}let E=await r(this.db,e.OVERRIDE_PRERENDER_SKELETON),D=null;try{D=i(`shadow-claw-override-prerender-skeleton`)}catch{}let O=!0;if(E==null?D!==null&&(O=D===`true`):O=m(E),O)try{a(`shadow-claw-override-prerender-skeleton`,`true`)}catch{}let k=t.querySelector(`[data-setting="override-prerender-skeleton-toggle"]`);k&&(k.checked=O);let A=t.querySelector(`[data-setting="dom-allowed-iframe-hosts"]`);if(A){let t=await r(this.db,e.ALLOWED_IFRAME_HOST_PATTERNS);if(typeof t==`string`&&t.trim().length>0){A.value=t;let{setAllowedIframeHostPatterns:e}=await import(`./iframe-sanitizer-viROQkRn.js`).then(e=>e.r);e(t)}else{let{DEFAULT_ALLOWED_IFRAME_HOST_PATTERNS:e}=await import(`./iframe-sanitizer-viROQkRn.js`).then(e=>e.r);A.value=e.join(`
|
|
888
|
+
`,`text/html`),T=w.querySelector(`template`);let E=[];E=T?Array.from(T.content.children):Array.from(w.head.children).concat(Array.from(w.body.children));var D=E;const O={ai:[()=>import(`./shadow-claw-llm-DoGxEHQL.js`)],environment:[()=>import(`./shadow-claw-networking-DJeCdb7e.js`),()=>import(`./shadow-claw-webvm-BWlIeK78.js`),()=>import(`./shadow-claw-storage-DqlVt27X.js`)],integrations:[()=>import(`./shadow-claw-git-CqOO97Re.js`),()=>import(`./shadow-claw-accounts-D1y-zbMs.js`),()=>import(`./shadow-claw-mcp-remote-DyGnK4S_.js`),()=>import(`./shadow-claw-control-plane-CrnA5lM0.js`),()=>import(`./shadow-claw-integrations-CRGL78Fy.js`),()=>import(`./shadow-claw-task-server-ByZwKI6S.js`),()=>import(`./shadow-claw-notifications-hSKJeMXb.js`)]},k=new Set;async function A(e){if(k.has(e))return;let t=O[e];t&&(k.add(e),await Promise.all(t.map(e=>e())))}const j=`shadow-claw-settings`;var M=class extends p{static styles=C;static template=D;activeTab=`ai`;db=null;orchestrator=null;pendingRestoreFile=null;constructor(){super()}async connectedCallback(){if(!this.shadowRoot)throw Error(`shadowRoot not found`);this.db=await t(),this.orchestrator=o.orchestrator,await this.render()}activateTab(e){!e||this.activeTab===e||(this.activeTab=e,this.applyTabState())}applyTabState(){A(this.activeTab).catch(console.error);let e=this.shadowRoot;e&&(e.querySelectorAll(`[data-tab-target]`).forEach(e=>{let t=e.dataset.tabTarget===this.activeTab;e.classList.toggle(`active`,t),e.setAttribute(`aria-selected`,String(t)),e.tabIndex=t?0:-1}),e.querySelectorAll(`[data-tab-panel]`).forEach(e=>{e.hidden=e.dataset.tabPanel!==this.activeTab}))}bindSettingsActions(){let e=this.shadowRoot;if(!e)return;e.querySelector(`[data-action="backup-settings"]`)?.addEventListener(`click`,()=>this.openBackupDialog());let t=e.querySelector(`.settings__restore-input`);e.querySelector(`[data-action="restore-settings"]`)?.addEventListener(`click`,()=>{t instanceof HTMLInputElement&&(t.value=``,t.click())}),t?.addEventListener(`change`,e=>{let t=e.target;if(!(t instanceof HTMLInputElement))return;let n=t.files?.[0]||null;n&&(this.pendingRestoreFile=n,this.openRestoreDialog(n.name))}),e.querySelector(`[data-action="clear-settings"]`)?.addEventListener(`click`,()=>this.openClearDialog()),e.querySelector(`[data-action="cancel-backup-settings"]`)?.addEventListener(`click`,()=>this.closeDialog(`.settings__backup-dialog`)),e.querySelector(`[data-action="confirm-backup-settings"]`)?.addEventListener(`click`,()=>{this.confirmBackup()}),e.querySelector(`[data-action="cancel-restore-settings"]`)?.addEventListener(`click`,()=>{this.pendingRestoreFile=null,this.closeDialog(`.settings__restore-dialog`)}),e.querySelector(`[data-action="confirm-restore-settings"]`)?.addEventListener(`click`,()=>{this.confirmRestore()}),e.querySelector(`[data-action="cancel-clear-settings"]`)?.addEventListener(`click`,()=>this.closeDialog(`.settings__clear-dialog`)),e.querySelector(`[data-action="confirm-clear-settings"]`)?.addEventListener(`click`,()=>{this.confirmClear()}),e.querySelector(`[data-action="save-assistant-name"]`)?.addEventListener(`click`,()=>this.saveAssistantName()),e.querySelector(`[data-setting="activity-log-disk-logging-toggle"]`)?.addEventListener(`change`,e=>{let t=e.target;t&&this.onActivityLogDiskLoggingToggle(t.checked)}),e.querySelector(`[data-setting="sidebar-hide-pages-toggle"]`)?.addEventListener(`change`,e=>{let t=e.target;t&&this.onSidebarHidePagesToggle(t.checked)}),e.querySelector(`[data-setting="sidebar-hide-chat-toggle"]`)?.addEventListener(`change`,e=>{let t=e.target;t&&this.onSidebarHideChatToggle(t.checked)}),e.querySelector(`[data-setting="sidebar-hide-tasks-toggle"]`)?.addEventListener(`change`,e=>{let t=e.target;t&&this.onSidebarHideTasksToggle(t.checked)}),e.querySelector(`[data-setting="sidebar-hide-files-toggle"]`)?.addEventListener(`change`,e=>{let t=e.target;t&&this.onSidebarHideFilesToggle(t.checked)}),e.querySelector(`[data-setting="chat-split-view-toggle"]`)?.addEventListener(`change`,e=>{let t=e.target;t&&this.onChatSplitViewToggle(t.checked)}),e.querySelector(`[data-setting="pages-auto-refresh-input"]`)?.addEventListener(`change`,e=>{let t=e.target;if(t){let e=parseInt(t.value,10);this.onPagesAutoRefreshInputChange(isNaN(e)?0:e)}}),e.querySelector(`[data-setting="override-prerender-skeleton-toggle"]`)?.addEventListener(`change`,e=>{let t=e.target;t&&this.onOverridePrerenderSkeletonToggle(t.checked)}),e.querySelector(`[data-action="save-dom-allowed-iframe-hosts"]`)?.addEventListener(`click`,()=>{this.saveDomAllowedIframeHosts()})}closeDialog(e){this.getDialog(e)?.close()}getDialog(e){let t=this.shadowRoot;if(!t)return null;let n=t.querySelector(e);return n instanceof HTMLDialogElement?n:null}handleTabKeydown(e,t){let n=this.shadowRoot;if(!n)return;let r=Array.from(n.querySelectorAll(`[data-tab-target]`)),i=r.indexOf(t);if(i<0)return;let a=-1;switch(e.key){case`ArrowRight`:case`ArrowDown`:a=(i+1)%r.length;break;case`ArrowLeft`:case`ArrowUp`:a=(i-1+r.length)%r.length;break;case`Home`:a=0;break;case`End`:a=r.length-1;break;default:return}e.preventDefault();let o=r[a];o.focus(),this.activateTab(o.dataset.tabTarget)}openBackupDialog(){let e=this.shadowRoot?.querySelector(`[data-setting="include-plaintext-passwords"]`);e instanceof HTMLInputElement&&(e.checked=!1),this.showDialog(`.settings__backup-dialog`)}openClearDialog(){this.showDialog(`.settings__clear-dialog`)}openRestoreDialog(e){let t=this.shadowRoot?.querySelector(`[data-info="restore-filename"]`);t instanceof HTMLElement&&(t.textContent=`Selected file: ${e}`),this.showDialog(`.settings__restore-dialog`)}showDialog(e){let t=this.getDialog(e);if(t){if(typeof t.showModal==`function`){t.showModal();return}t.setAttribute(`open`,``)}}async confirmBackup(){if(!this.db){f(`Settings database is unavailable`,5e3);return}let e=this.shadowRoot?.querySelector(`[data-setting="include-plaintext-passwords"]`),t=e instanceof HTMLInputElement&&e.checked;try{if(t){let e=await this.promptForPlaintextBackupHandle();if(!e)return;await b(e,await this.getAllConfigEntries(),t),this.closeDialog(`.settings__backup-dialog`),u(`Settings backup saved`,3e3);return}let e=await y(await this.getAllConfigEntries(),t),n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=`shadowclaw-settings-backup-${Date.now()}.json`,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(n),this.closeDialog(`.settings__backup-dialog`),u(`Settings backup downloaded`,3e3)}catch(e){f(`Failed to backup settings: ${e instanceof Error?e.message:String(e)}`,6e3)}}async confirmClear(){if(!this.db){f(`Settings database is unavailable`,5e3);return}try{await this.replaceConfigEntries([]),this.closeDialog(`.settings__clear-dialog`),d(`Settings cleared. Reloading app...`,3200),setTimeout(()=>{window.location.reload()},250)}catch(e){f(`Failed to clear settings: ${e instanceof Error?e.message:String(e)}`,6e3)}}async confirmRestore(){if(!this.db){f(`Settings database is unavailable`,5e3);return}let e=this.pendingRestoreFile;if(!e){f(`No backup file selected`,4e3);return}try{let t=S(await e.text()),n=await x(t.configEntries,t.plaintextPasswords||[]);await this.replaceConfigEntries(n),this.pendingRestoreFile=null,this.closeDialog(`.settings__restore-dialog`),u(`Settings restored. Reloading app...`,3200),setTimeout(()=>{window.location.reload()},250)}catch(e){f(`Failed to restore settings: ${e instanceof Error?e.message:String(e)}`,6e3)}}async getAllConfigEntries(){if(!this.db)throw Error(`Database is unavailable`);return await new Promise((e,t)=>{try{let n=this.db?.transaction(`config`,`readonly`);if(!n){t(Error(`Failed to open read transaction`));return}let r=n.objectStore(`config`).getAll();r.onsuccess=()=>{e((Array.isArray(r.result)?r.result:[]).filter(e=>e&&typeof e.key==`string`).map(e=>({key:e.key,value:e.value})))},r.onerror=()=>{t(r.error||Error(`Failed to read settings config`))}}catch(e){t(e)}})}async onActivityLogDiskLoggingToggle(t){if(this.db)try{let{setConfig:n}=await import(`./setConfig-DFMYnYLE.js`).then(e=>e.n);await n(this.db,e.ACTIVITY_LOG_DISK_LOGGING_ENABLED,t?`true`:`false`),u(t?`Activity log disk logging enabled`:`Activity log disk logging disabled`,2500)}catch(e){f(`Error saving activity log disk logging setting: `+(e instanceof Error?e.message:String(e)),6e3)}}async onChatSplitViewToggle(t){if(this.db)try{let{setConfig:n}=await import(`./setConfig-DFMYnYLE.js`).then(e=>e.n);await n(this.db,e.CHAT_SPLIT_VIEW_ENABLED,t?`true`:`false`),this.dispatchEvent(new CustomEvent(`chat-split-view-change`,{detail:{enabled:t},bubbles:!0,composed:!0})),u(t?`Horizontal Chat split view enabled`:`Horizontal Chat split view disabled`,2500)}catch(e){f(`Error saving Chat split view setting: `+(e instanceof Error?e.message:String(e)),6e3)}}async onOverridePrerenderSkeletonToggle(t){try{a(`shadow-claw-override-prerender-skeleton`,t?`true`:`false`)}catch(e){console.warn(`Unable to save setting to localStorage:`,e)}if(this.db)try{let{setConfig:n}=await import(`./setConfig-DFMYnYLE.js`).then(e=>e.n);await n(this.db,e.OVERRIDE_PRERENDER_SKELETON,t?`true`:`false`),u(t?`Pre-rendered content override enabled`:`Pre-rendered content override disabled`,2500)}catch(e){f(`Error saving pre-rendered content override setting: `+(e instanceof Error?e.message:String(e)),6e3)}}async onPagesAutoRefreshInputChange(t){if(!this.db)return;let n=Math.max(0,Math.min(t,86400));try{let{setConfig:t}=await import(`./setConfig-DFMYnYLE.js`).then(e=>e.n);await t(this.db,e.PAGES_AUTO_REFRESH_INTERVAL,String(n)),window.dispatchEvent(new CustomEvent(`shadow-claw-pages-auto-refresh-change`,{detail:{interval:n}})),u(n>0?`Pages auto refresh set to ${n}s`:`Pages auto refresh disabled`,2500)}catch(e){f(`Error saving Pages auto refresh interval: `+(e instanceof Error?e.message:String(e)),6e3)}}async onSidebarHideChatToggle(t){if(this.db)try{let{setConfig:n}=await import(`./setConfig-DFMYnYLE.js`).then(e=>e.n);await n(this.db,e.SIDEBAR_CHAT_HIDDEN,t?`true`:`false`),this.dispatchEvent(new CustomEvent(`sidebar-chat-visibility-change`,{detail:{hidden:t},bubbles:!0,composed:!0})),u(t?`Chat hidden in sidebar`:`Chat shown in sidebar`,2500)}catch(e){f(`Error saving sidebar Chat visibility: `+(e instanceof Error?e.message:String(e)),6e3)}}async onSidebarHideFilesToggle(t){if(this.db)try{let{setConfig:n}=await import(`./setConfig-DFMYnYLE.js`).then(e=>e.n);await n(this.db,e.SIDEBAR_FILES_HIDDEN,t?`true`:`false`),this.dispatchEvent(new CustomEvent(`sidebar-files-visibility-change`,{detail:{hidden:t},bubbles:!0,composed:!0})),u(t?`Files hidden in sidebar`:`Files shown in sidebar`,2500)}catch(e){f(`Error saving sidebar Files visibility: `+(e instanceof Error?e.message:String(e)),6e3)}}async onSidebarHidePagesToggle(t){if(this.db)try{let{setConfig:n}=await import(`./setConfig-DFMYnYLE.js`).then(e=>e.n);await n(this.db,e.SIDEBAR_PAGES_HIDDEN,t?`true`:`false`),this.dispatchEvent(new CustomEvent(`sidebar-pages-visibility-change`,{detail:{hidden:t},bubbles:!0,composed:!0})),u(t?`Pages hidden in sidebar`:`Pages shown in sidebar`,2500)}catch(e){f(`Error saving sidebar Pages visibility: `+(e instanceof Error?e.message:String(e)),6e3)}}async onSidebarHideTasksToggle(t){if(this.db)try{let{setConfig:n}=await import(`./setConfig-DFMYnYLE.js`).then(e=>e.n);await n(this.db,e.SIDEBAR_TASKS_HIDDEN,t?`true`:`false`),this.dispatchEvent(new CustomEvent(`sidebar-tasks-visibility-change`,{detail:{hidden:t},bubbles:!0,composed:!0})),u(t?`Tasks hidden in sidebar`:`Tasks shown in sidebar`,2500)}catch(e){f(`Error saving sidebar Tasks visibility: `+(e instanceof Error?e.message:String(e)),6e3)}}async populateAssistantSettings(){let t=this.shadowRoot;if(!t||!this.db)return;let n=t.querySelector(`[data-setting="assistant-name-input"]`);if(n){let{getConfig:t}=await import(`./getConfig-D89uJgo5.js`).then(e=>e.n),r=await t(this.db,e.ASSISTANT_NAME),i=this.orchestrator?.assistantName||o.orchestrator?.assistantName;n.value=typeof r==`string`&&r||i||`ShadowClaw`}let{getConfig:r}=await import(`./getConfig-D89uJgo5.js`).then(e=>e.n),s=await r(this.db,e.ACTIVITY_LOG_DISK_LOGGING_ENABLED),c=s===!0||s===`true`||s===1||s===`1`,l=t.querySelector(`[data-setting="activity-log-disk-logging-toggle"]`);l&&(l.checked=c);let u=await r(this.db,e.SIDEBAR_PAGES_HIDDEN),d=u===!0||u===`true`||u===1||u===`1`,f=t.querySelector(`[data-setting="sidebar-hide-pages-toggle"]`);f&&(f.checked=d);let p=await r(this.db,e.SIDEBAR_CHAT_HIDDEN),h=p===!0||p===`true`||p===1||p===`1`,g=t.querySelector(`[data-setting="sidebar-hide-chat-toggle"]`);g&&(g.checked=h);let _=await r(this.db,e.SIDEBAR_TASKS_HIDDEN),v=_===!0||_===`true`||_===1||_===`1`,y=t.querySelector(`[data-setting="sidebar-hide-tasks-toggle"]`);y&&(y.checked=v);let b=await r(this.db,e.SIDEBAR_FILES_HIDDEN),x=b===!0||b===`true`||b===1||b===`1`,S=t.querySelector(`[data-setting="sidebar-hide-files-toggle"]`);S&&(S.checked=x);let C=m(await r(this.db,e.CHAT_SPLIT_VIEW_ENABLED),!1),w=t.querySelector(`[data-setting="chat-split-view-toggle"]`);w&&(w.checked=C);let T=t.querySelector(`[data-setting="pages-auto-refresh-input"]`);if(T){let t=await r(this.db,e.PAGES_AUTO_REFRESH_INTERVAL);if(typeof t==`string`||typeof t==`number`){let e=parseInt(String(t),10);T.value=!isNaN(e)&&e>=0?String(e):`0`}else T.value=`0`}let E=await r(this.db,e.OVERRIDE_PRERENDER_SKELETON),D=null;try{D=i(`shadow-claw-override-prerender-skeleton`)}catch{}let O=!0;if(E==null?D!==null&&(O=D===`true`):O=m(E),O)try{a(`shadow-claw-override-prerender-skeleton`,`true`)}catch{}let k=t.querySelector(`[data-setting="override-prerender-skeleton-toggle"]`);k&&(k.checked=O);let A=t.querySelector(`[data-setting="dom-allowed-iframe-hosts"]`);if(A){let t=await r(this.db,e.ALLOWED_IFRAME_HOST_PATTERNS);if(typeof t==`string`&&t.trim().length>0){A.value=t;let{setAllowedIframeHostPatterns:e}=await import(`./iframe-sanitizer-viROQkRn.js`).then(e=>e.r);e(t)}else{let{DEFAULT_ALLOWED_IFRAME_HOST_PATTERNS:e}=await import(`./iframe-sanitizer-viROQkRn.js`).then(e=>e.r);A.value=e.join(`
|
|
889
889
|
`)}}let j=t.querySelector(`[data-setting="markdown-frontmatter-pages-toggle"]`);j&&(j.checked=m(await r(this.db,e.MARKDOWN_FRONTMATTER_PAGES),!0));let M=t.querySelector(`[data-setting="markdown-frontmatter-file-viewer-toggle"]`);M&&(M.checked=m(await r(this.db,e.MARKDOWN_FRONTMATTER_FILE_VIEWER),!0));let N=t.querySelector(`[data-setting="markdown-frontmatter-chat-toggle"]`);N&&(N.checked=m(await r(this.db,e.MARKDOWN_FRONTMATTER_CHAT),!0));let P=t.querySelector(`[data-setting="markdown-frontmatter-tasks-toggle"]`);P&&(P.checked=m(await r(this.db,e.MARKDOWN_FRONTMATTER_TASKS),!0))}async promptForPlaintextBackupHandle(){let e=Reflect.get(globalThis,`showSaveFilePicker`),t=typeof e==`function`?e.bind(globalThis):null;if(!t)throw Error(`Plaintext settings backup requires the File System Access API.`);try{return await t({id:`shadowclaw-settings-backup`,suggestedName:`shadowclaw-settings-backup-${n()}.json`,types:[{description:`JSON Files`,accept:{"application/json":[`.json`]}}]})}catch(e){if(e instanceof Error&&e.name===`AbortError`)return null;throw e}}async render(){let e=this.shadowRoot;if(!e)return;e.querySelector(`[data-action="show-channels-config"]`)?.addEventListener(`click`,()=>{this.dispatchEvent(new CustomEvent(`navigate`,{detail:{page:`channels`},bubbles:!0,composed:!0}))}),e.querySelector(`[data-action="show-tools-config"]`)?.addEventListener(`click`,()=>{this.dispatchEvent(new CustomEvent(`navigate`,{detail:{page:`tools`},bubbles:!0,composed:!0}))}),e.querySelectorAll(`[data-tab-target]`).forEach(e=>{e.addEventListener(`click`,()=>{this.activateTab(e.dataset.tabTarget)}),e.addEventListener(`keydown`,t=>{this.handleTabKeydown(t,e)})}),this.applyTabState(),this.bindSettingsActions();let t=e.querySelector(`[data-info="deployed-revision"]`);t&&(t.textContent=`Deployed revision: ${document.querySelector(`meta[name="revision"]`)?.getAttribute(`content`)?.trim()||`unknown`}`),await this.populateAssistantSettings()}async replaceConfigEntries(e){if(!this.db)throw Error(`Database is unavailable`);await new Promise((t,n)=>{try{let r=this.db?.transaction(`config`,`readwrite`);if(!r){n(Error(`Failed to open write transaction`));return}let i=r.objectStore(`config`);i.clear();for(let t of e)i.put({key:t.key,value:t.value});r.oncomplete=()=>t(),r.onerror=()=>n(r.error||Error(`Failed to update config`)),r.onabort=()=>n(r.error||Error(`Config update aborted`))}catch(e){n(e)}})}async saveAssistantName(){if(!this.db)return;let t=this.shadowRoot;if(!t)return;let n=t.querySelector(`[data-setting="assistant-name-input"]`);if(!n)return;let i=n.value.trim();if(!i){let{showWarning:e}=await import(`./toast-BXgUfbyh.js`).then(e=>e.c);e(`Please enter a name`,3e3);return}a(`assistantName`,i);try{let t=this.orchestrator||o.orchestrator;if(t)this.orchestrator=t,await r(t,this.db,i);else{let{setConfig:t}=await import(`./setConfig-DFMYnYLE.js`).then(e=>e.n);await t(this.db,e.ASSISTANT_NAME,i)}}catch(e){console.warn(`Could not update orchestrator:`,e)}u(`Assistant name saved`,3e3)}async saveDomAllowedIframeHosts(){let t=this.shadowRoot;if(!t||!this.db)return;let n=t.querySelector(`[data-setting="dom-allowed-iframe-hosts"]`);if(!n)return;let r=n.value.split(`
|
|
890
890
|
`).map(e=>e.trim()).filter(e=>e.length>0),i=t.querySelector(`[data-setting="markdown-frontmatter-pages-toggle"]`),a=t.querySelector(`[data-setting="markdown-frontmatter-file-viewer-toggle"]`),o=t.querySelector(`[data-setting="markdown-frontmatter-chat-toggle"]`),s=t.querySelector(`[data-setting="markdown-frontmatter-tasks-toggle"]`);try{let{setConfig:t}=await import(`./setConfig-DFMYnYLE.js`).then(e=>e.n),n=r.join(`
|
|
891
891
|
`);await t(this.db,e.ALLOWED_IFRAME_HOST_PATTERNS,n),await t(this.db,e.MARKDOWN_FRONTMATTER_PAGES,String(i?.checked??!0)),await t(this.db,e.MARKDOWN_FRONTMATTER_FILE_VIEWER,String(a?.checked??!0)),await t(this.db,e.MARKDOWN_FRONTMATTER_CHAT,String(o?.checked??!0)),await t(this.db,e.MARKDOWN_FRONTMATTER_TASKS,String(s?.checked??!0));let{setAllowedIframeHostPatterns:c}=await import(`./iframe-sanitizer-viROQkRn.js`).then(e=>e.r);c(r),u(`DOM iframe embed settings saved`,2500)}catch(e){f(`Error saving DOM iframe embed settings: `+(e instanceof Error?e.message:String(e)),6e3)}}};customElements.get(j)||customElements.define(j,M);export{M as ShadowClawSettings};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./config-Bnwx4EfS.js";import{n as t}from"./txPromise-EBECky1b.js";import{t as n}from"./getConfig-D89uJgo5.js";import{u as r}from"./custom-element-security-Da_6HQ6X.js";import{$t as i,en as a,t as o}from"./orchestrator-
|
|
1
|
+
import{r as e}from"./config-Bnwx4EfS.js";import{n as t}from"./txPromise-EBECky1b.js";import{t as n}from"./getConfig-D89uJgo5.js";import{u as r}from"./custom-element-security-Da_6HQ6X.js";import{$t as i,en as a,t as o}from"./orchestrator-BeJfwtvz.js";import{c as s}from"./getGroupDir-BwprrdrQ.js";import{t as c}from"./setConfig-DFMYnYLE.js";import{a as l,r as u,s as d}from"./toast-BXgUfbyh.js";import{t as f}from"./shadow-claw-element-DIrv3P6A.js";import{t as p}from"./effect-BJCrpFdp.js";import{t as m}from"./config-value-oBfKgLT4.js";async function h(){try{if(typeof navigator<`u`&&navigator.storage&&navigator.storage.estimate){let e=await navigator.storage.estimate();return{usage:e.usage||0,quota:e.quota||0}}}catch(e){console.warn(`Failed to get storage estimate:`,e)}return{usage:0,quota:0}}async function g(){try{if(typeof navigator<`u`&&navigator.storage&&navigator.storage.persisted)return await navigator.storage.persisted()}catch(e){console.warn(`Failed to check persistent storage:`,e)}return!1}async function _(){try{if(typeof navigator<`u`&&navigator.storage&&navigator.storage.persist)return await navigator.storage.persist()}catch(e){console.warn(`Failed to request persistent storage:`,e)}return!1}async function v(t){let n=Reflect.get(globalThis,`showDirectoryPicker`),r=typeof n==`function`?n.bind(globalThis):null;if(!r)throw Error(`Local folder picker is unavailable in this browser/context.`);try{let n=await r({mode:`readwrite`,id:`shadowclaw-storage`});return await c(t,e.STORAGE_HANDLE,n),await a(t),await i(t),!0}catch(e){if(e instanceof Error&&e.name===`AbortError`)return!1;throw e}}const y=new CSSStyleSheet;y.replaceSync(`*,
|
|
2
2
|
*::before,
|
|
3
3
|
*::after {
|
|
4
4
|
font-family: var(--shadow-claw-font-sans);
|
package/dist/public/{shadow-claw-task-server-BMps7aSr.js → shadow-claw-task-server-ByZwKI6S.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e}from"./txPromise-EBECky1b.js";import{b as t,t as n,y as r}from"./orchestrator-
|
|
1
|
+
import{n as e}from"./txPromise-EBECky1b.js";import{b as t,t as n,y as r}from"./orchestrator-BeJfwtvz.js";import{a as i,r as a}from"./toast-BXgUfbyh.js";import{t as o}from"./shadow-claw-element-DIrv3P6A.js";import{t as s}from"./effect-BJCrpFdp.js";const c=new CSSStyleSheet;c.replaceSync(`*,
|
|
2
2
|
*::before,
|
|
3
3
|
*::after {
|
|
4
4
|
font-family: var(--shadow-claw-font-sans);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./config-Bnwx4EfS.js";import{i as t}from"./app-routes-BMQ4HFaM.js";import{n}from"./txPromise-EBECky1b.js";import{t as r}from"./getConfig-D89uJgo5.js";import{h as i,u as a}from"./custom-element-security-Da_6HQ6X.js";import{t as o}from"./orchestrator-
|
|
1
|
+
import{r as e}from"./config-Bnwx4EfS.js";import{i as t}from"./app-routes-BMQ4HFaM.js";import{n}from"./txPromise-EBECky1b.js";import{t as r}from"./getConfig-D89uJgo5.js";import{h as i,u as a}from"./custom-element-security-Da_6HQ6X.js";import{t as o}from"./orchestrator-BeJfwtvz.js";import{a as s,i as c,r as l}from"./toast-BXgUfbyh.js";import{t as u}from"./shadow-claw-element-DIrv3P6A.js";import"./shadow-claw-empty-state-Bl52dGQ0.js";import{t as d}from"./effect-BJCrpFdp.js";import{t as f}from"./config-value-oBfKgLT4.js";import"./shadow-claw-page-header-action-button-Bmua3mAb.js";import"./shadow-claw-page-header-DA-FG08G.js";import{t as p}from"./markdown-eFKxxpVP.js";import{t as m}from"./file-viewer-vHJ5Zsgk.js";import"./shadow-claw-dialog-BrOwAOdk.js";const h=new CSSStyleSheet;h.replaceSync(`*,
|
|
2
2
|
*::before,
|
|
3
3
|
*::after {
|
|
4
4
|
font-family: var(--shadow-claw-font-sans);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{D as e,E as t,T as n,t as r}from"./orchestrator-
|
|
1
|
+
import{D as e,E as t,T as n,t as r}from"./orchestrator-BeJfwtvz.js";import{t as i}from"./shadow-claw-element-DIrv3P6A.js";function a(e){if(!e)return``;let t=e.split(`
|
|
2
2
|
`);for(let e=t.length-1;e>=0;--e){let n=t[e]||``;if(/[#$](?:\s|$)/.test(n))return n}return``}function o(e){return e.scrollHeight-(e.scrollTop+e.clientHeight)<=12}function s(e,t){let n=e[t+1];if(n===void 0)return{action:`ignore`,nextIndex:t+1,incomplete:!0};if(n===`[`){let n=t+2;for(;n<e.length;){let t=e.charCodeAt(n);if(t>=64&&t<=126){let t=e[n];return t===`J`?{action:`clear-screen`,nextIndex:n+1}:t===`K`?{action:`clear-line`,nextIndex:n+1}:{action:`ignore`,nextIndex:n+1}}n+=1}return{action:`ignore`,nextIndex:e.length,incomplete:!0}}if(n===`]`){let n=t+2;for(;n<e.length;){let t=e[n];if(t===`\x07`)return{action:`ignore`,nextIndex:n+1};if(t===`\x1B`&&e[n+1]===`\\`)return{action:`ignore`,nextIndex:n+2};n+=1}return{action:`ignore`,nextIndex:e.length,incomplete:!0}}return{action:`ignore`,nextIndex:Math.min(t+2,e.length)}}function c(e){return e.replace(/(?:^|\n)[^\n]*mkdir -p \/home\/user 2>&1; echo "?__BCDONE_\d+__\$\?"?[^\n]*(?:\n|$)/g,`
|
|
3
3
|
`).replace(/(?:^|\n)\s*__BCDONE_\d+__(?:\d+|\$\?)?\s*(?:\n|$)/g,`
|
|
4
4
|
`).replace(/^\n+(?=\S)/,``)}function l(e,t,n=``,r){let i=r?.respectEraseSequences??!0,a=n+t,o=e;for(let e=0;e<a.length;e++){let t=a[e];if(t===`\x1B`){let t=s(a,e);if(t.incomplete)return{text:o,pending:a.slice(e)};if(t.action===`clear-screen`&&i&&(o=``),t.action===`clear-line`&&i){let e=o.lastIndexOf(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{A as e,F as t}from"./config-Bnwx4EfS.js";import{n}from"./txPromise-EBECky1b.js";import{t as r}from"./orchestrator-
|
|
1
|
+
import{A as e,F as t}from"./config-Bnwx4EfS.js";import{n}from"./txPromise-EBECky1b.js";import{t as r}from"./orchestrator-BeJfwtvz.js";import{t as i}from"./tools-Cp1gequ8.js";import{t as a}from"./ulid-BY7rQVLN.js";import{t as o}from"./tools-CcgG5XuA.js";import{n as s,t as c}from"./syncWebMcpRegistration-CqVCB6m8.js";import"./tools-B-PzsLc2.js";import{a as l,i as u,r as d}from"./toast-BXgUfbyh.js";import{t as f}from"./shadow-claw-element-DIrv3P6A.js";import{t as p}from"./effect-BJCrpFdp.js";import"./shadow-claw-page-header-action-button-Bmua3mAb.js";import"./shadow-claw-page-header-DA-FG08G.js";import"./shadow-claw-dialog-BrOwAOdk.js";import{t as m}from"./webmcp-DBONjQWd.js";const h=new CSSStyleSheet;h.replaceSync(`*,
|
|
2
2
|
*::before,
|
|
3
3
|
*::after {
|
|
4
4
|
font-family: var(--shadow-claw-font-sans);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{f as e,n as t,r as n}from"./config-Bnwx4EfS.js";import{n as r}from"./txPromise-EBECky1b.js";import{t as i}from"./getConfig-D89uJgo5.js";import{A as a,O as o,S as s,k as c,t as l}from"./orchestrator-
|
|
1
|
+
import{f as e,n as t,r as n}from"./config-Bnwx4EfS.js";import{n as r}from"./txPromise-EBECky1b.js";import{t as i}from"./getConfig-D89uJgo5.js";import{A as a,O as o,S as s,k as c,t as l}from"./orchestrator-BeJfwtvz.js";import{a as u,r as d,s as f}from"./toast-BXgUfbyh.js";import{t as p}from"./shadow-claw-element-DIrv3P6A.js";import{t as m}from"./effect-BJCrpFdp.js";const h=new CSSStyleSheet;h.replaceSync(`*,
|
|
2
2
|
*::before,
|
|
3
3
|
*::after {
|
|
4
4
|
font-family: var(--shadow-claw-font-sans);
|
package/dist/public/{syncWebMcpRegistration-R0tha3kP.js → syncWebMcpRegistration-CqVCB6m8.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./config-Bnwx4EfS.js";import{Lt as t,M as n,t as r}from"./orchestrator-
|
|
1
|
+
import{r as e}from"./config-Bnwx4EfS.js";import{Lt as t,M as n,t as r}from"./orchestrator-BeJfwtvz.js";import{t as i}from"./tools-Cp1gequ8.js";import{t as a}from"./setConfig-DFMYnYLE.js";import{t as o}from"./effect-BJCrpFdp.js";import{i as s,n as c,r as l}from"./webmcp-DBONjQWd.js";const u={name:`activate_skill`,description:`Load the full instructions for a workspace skill when its description matches the current task.`,input_schema:{type:`object`,properties:{name:{type:`string`,description:`The exact skill name from the available skills catalog.`}},required:[`name`]}};function d(e,a){if(typeof e.webMcpEffectCleanup==`function`&&(e.webMcpEffectCleanup(),e.webMcpEffectCleanup=null),!e.webMcpToolsEnabled){s();return}e.webMcpEffectCleanup=o(()=>{let o=r.activeGroupId,l=i.allTools,d=i.enabledTools;i.declarativeTools,i.declarativeToolNamesEnabled;let f=r.groups.find(e=>e.groupId===o);e.webMcpRegistrationLock=e.webMcpRegistrationLock.then(async()=>{s(),await new Promise(e=>setTimeout(e,0));let r=[];try{r=await i.refreshDeclarativeTools(a,o)}catch{}let p=r.filter(e=>i.isDeclarativeToolEnabled(e.name)),m=[...l,...r],h=f?.toolTags&&f.toolTags.length>0?m.filter(e=>f.toolTags.includes(e.name)):[...d,...p],g={skills:[]};try{g=await t(a,o)}catch{}g.skills.length>0&&!h.some(e=>e.name===u.name)&&(h=[...h,u]),await c(e.agentWorker,async t=>{await n(e,a,t)},o,h)}).catch(e=>{console.error(`WebMCP registration failed:`,e)})})}async function f(t,n,r,i){s(),l(r),await a(n,e.WEBMCP_MODE,r),d(i.orchestrator,n)}async function p(t,n,r,i){t.webMcpToolsEnabled=!!r,await a(n,e.WEBMCP_TOOLS_ENABLED,t.webMcpToolsEnabled?`true`:`false`),d(i.orchestrator,n)}export{u as i,p as n,d as r,f as t};
|
package/package.json
CHANGED
|
@@ -425,7 +425,21 @@ export async function seedStaticMainSite(
|
|
|
425
425
|
try {
|
|
426
426
|
await deleteGroupDirectory(db, groupId, ".agents/skills/main");
|
|
427
427
|
} catch (error) {
|
|
428
|
-
|
|
428
|
+
if (
|
|
429
|
+
!(
|
|
430
|
+
error &&
|
|
431
|
+
typeof error === "object" &&
|
|
432
|
+
"name" in error &&
|
|
433
|
+
error.name === "NotFoundError"
|
|
434
|
+
)
|
|
435
|
+
) {
|
|
436
|
+
throw error;
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
try {
|
|
440
|
+
await deleteGroupDirectory(db, groupId, ".agents/tools/main");
|
|
441
|
+
} catch (error) {
|
|
442
|
+
// A fresh workspace has no bundled-tool directory to remove yet.
|
|
429
443
|
if (
|
|
430
444
|
!(
|
|
431
445
|
error &&
|
|
@@ -543,7 +557,7 @@ export async function seedStaticMainSite(
|
|
|
543
557
|
for (const tool of manifest.tools || []) {
|
|
544
558
|
const toolPath = `.agents/tools/main/${tool.displayPath}`;
|
|
545
559
|
try {
|
|
546
|
-
if (!(await groupFileExists(db, groupId, toolPath))) {
|
|
560
|
+
if (didPurgeSkills || !(await groupFileExists(db, groupId, toolPath))) {
|
|
547
561
|
await writeGroupFile(db, groupId, toolPath, tool.content);
|
|
548
562
|
}
|
|
549
563
|
} catch (error) {
|
|
@@ -2853,6 +2853,39 @@ describe("OrchestratorStore", () => {
|
|
|
2853
2853
|
}
|
|
2854
2854
|
});
|
|
2855
2855
|
|
|
2856
|
+
it("applies internetAccess from site-config to vmBashFullInternetAccess", async () => {
|
|
2857
|
+
const store = new OrchestratorStore();
|
|
2858
|
+
const events = createEvents();
|
|
2859
|
+
const orch: any = {
|
|
2860
|
+
events,
|
|
2861
|
+
getUseProxy: () => false,
|
|
2862
|
+
getProxyUrl: () => "",
|
|
2863
|
+
getGitProxyUrl: () => "",
|
|
2864
|
+
getVMBashFullInternetAccess: () => false,
|
|
2865
|
+
getTaskServerUrl: () => "/schedule",
|
|
2866
|
+
taskServerEnabled: true,
|
|
2867
|
+
vmBashFullInternetAccess: false,
|
|
2868
|
+
};
|
|
2869
|
+
|
|
2870
|
+
const configElement = document.createElement("script");
|
|
2871
|
+
configElement.id = "shadow-claw-site-config";
|
|
2872
|
+
configElement.type = "application/json";
|
|
2873
|
+
configElement.textContent = JSON.stringify({
|
|
2874
|
+
settings: {
|
|
2875
|
+
internetAccess: true,
|
|
2876
|
+
},
|
|
2877
|
+
});
|
|
2878
|
+
document.head.appendChild(configElement);
|
|
2879
|
+
|
|
2880
|
+
try {
|
|
2881
|
+
await store.init({} as any, orch);
|
|
2882
|
+
expect(orch.vmBashFullInternetAccess).toBe(true);
|
|
2883
|
+
expect(store._vmBashFullInternetAccess.get()).toBe(true);
|
|
2884
|
+
} finally {
|
|
2885
|
+
configElement.remove();
|
|
2886
|
+
}
|
|
2887
|
+
});
|
|
2888
|
+
|
|
2856
2889
|
it("clears legacy group-level toolTags on DEFAULT_GROUP_ID if present", async () => {
|
|
2857
2890
|
const store = new OrchestratorStore();
|
|
2858
2891
|
const events = createEvents();
|
|
@@ -2558,6 +2558,26 @@ export class OrchestratorStore {
|
|
|
2558
2558
|
await updateGroupToolTags(db, DEFAULT_GROUP_ID, undefined);
|
|
2559
2559
|
}
|
|
2560
2560
|
|
|
2561
|
+
// If site configuration declares internet access, ensure it is honored
|
|
2562
|
+
const declaredInternetAccess =
|
|
2563
|
+
config.settings?.internetAccess ??
|
|
2564
|
+
config.settings?.vm_bash_full_internet_access ??
|
|
2565
|
+
config.settings?.fullInternetAccess ??
|
|
2566
|
+
config.internetAccess;
|
|
2567
|
+
if (declaredInternetAccess === true) {
|
|
2568
|
+
const currentInternet = await getConfig(
|
|
2569
|
+
db,
|
|
2570
|
+
CONFIG_KEYS.VM_BASH_FULL_INTERNET_ACCESS,
|
|
2571
|
+
);
|
|
2572
|
+
if (currentInternet !== "true") {
|
|
2573
|
+
await setConfig(db, CONFIG_KEYS.VM_BASH_FULL_INTERNET_ACCESS, "true");
|
|
2574
|
+
if (this.orchestrator) {
|
|
2575
|
+
this.orchestrator.vmBashFullInternetAccess = true;
|
|
2576
|
+
}
|
|
2577
|
+
this._vmBashFullInternetAccess.set(true);
|
|
2578
|
+
}
|
|
2579
|
+
}
|
|
2580
|
+
|
|
2561
2581
|
const isSeeded = await getConfig(db, CONFIG_KEYS.SITE_CONFIG_SEEDED);
|
|
2562
2582
|
if (isSeeded) {
|
|
2563
2583
|
return;
|
|
@@ -2635,6 +2655,22 @@ export class OrchestratorStore {
|
|
|
2635
2655
|
if (assistantName && typeof assistantName === "string") {
|
|
2636
2656
|
await setConfig(db, CONFIG_KEYS.ASSISTANT_NAME, assistantName);
|
|
2637
2657
|
}
|
|
2658
|
+
const allowInternet =
|
|
2659
|
+
config.settings.internetAccess ??
|
|
2660
|
+
config.settings.vm_bash_full_internet_access ??
|
|
2661
|
+
config.settings.fullInternetAccess ??
|
|
2662
|
+
config.internetAccess;
|
|
2663
|
+
if (typeof allowInternet === "boolean") {
|
|
2664
|
+
await setConfig(
|
|
2665
|
+
db,
|
|
2666
|
+
CONFIG_KEYS.VM_BASH_FULL_INTERNET_ACCESS,
|
|
2667
|
+
String(allowInternet),
|
|
2668
|
+
);
|
|
2669
|
+
if (this.orchestrator) {
|
|
2670
|
+
this.orchestrator.vmBashFullInternetAccess = allowInternet;
|
|
2671
|
+
}
|
|
2672
|
+
this._vmBashFullInternetAccess.set(allowInternet);
|
|
2673
|
+
}
|
|
2638
2674
|
}
|
|
2639
2675
|
|
|
2640
2676
|
const defaultToolsProfile =
|
|
@@ -83,6 +83,7 @@ jest.unstable_mockModule("@zip.js/zip.js", () => ({}) as any);
|
|
|
83
83
|
describe("git", () => {
|
|
84
84
|
let buildAuthCallbacks: Function;
|
|
85
85
|
let ensureDir: Function;
|
|
86
|
+
let getGitTargetAddressSpace: Function;
|
|
86
87
|
let getProxyUrl: Function;
|
|
87
88
|
let gitAdd: Function;
|
|
88
89
|
let gitBranch: Function;
|
|
@@ -124,6 +125,7 @@ describe("git", () => {
|
|
|
124
125
|
|
|
125
126
|
buildAuthCallbacks = mod.buildAuthCallbacks;
|
|
126
127
|
ensureDir = mod.ensureDir;
|
|
128
|
+
getGitTargetAddressSpace = mod.getGitTargetAddressSpace;
|
|
127
129
|
getProxyUrl = mod.getProxyUrl;
|
|
128
130
|
gitAdd = mod.gitAdd;
|
|
129
131
|
gitBranch = mod.gitBranch;
|
|
@@ -744,6 +746,103 @@ describe("git", () => {
|
|
|
744
746
|
|
|
745
747
|
expect(url).toContain("git-proxy");
|
|
746
748
|
});
|
|
749
|
+
|
|
750
|
+
it("uses https when running under https on localhost:8888", () => {
|
|
751
|
+
expect(
|
|
752
|
+
getProxyUrl("local", undefined, {
|
|
753
|
+
protocol: "https:",
|
|
754
|
+
host: "localhost:8888",
|
|
755
|
+
hostname: "localhost",
|
|
756
|
+
}),
|
|
757
|
+
).toBe("https://localhost:8888/git-proxy");
|
|
758
|
+
});
|
|
759
|
+
|
|
760
|
+
it("uses https when running under https on a remote host", () => {
|
|
761
|
+
expect(
|
|
762
|
+
getProxyUrl("local", undefined, {
|
|
763
|
+
protocol: "https:",
|
|
764
|
+
host: "xt-ml.github.io",
|
|
765
|
+
hostname: "xt-ml.github.io",
|
|
766
|
+
}),
|
|
767
|
+
).toBe("https://localhost:8888/git-proxy");
|
|
768
|
+
});
|
|
769
|
+
|
|
770
|
+
it("uses https when running under https with empty or loopback hostname", () => {
|
|
771
|
+
expect(
|
|
772
|
+
getProxyUrl("local", undefined, {
|
|
773
|
+
protocol: "https:",
|
|
774
|
+
host: "localhost:8888",
|
|
775
|
+
hostname: "",
|
|
776
|
+
}),
|
|
777
|
+
).toBe("https://localhost:8888/git-proxy");
|
|
778
|
+
|
|
779
|
+
expect(
|
|
780
|
+
getProxyUrl("local", undefined, {
|
|
781
|
+
protocol: "https:",
|
|
782
|
+
host: "[::1]:8888",
|
|
783
|
+
hostname: "[::1]",
|
|
784
|
+
}),
|
|
785
|
+
).toBe("https://[::1]:8888/git-proxy");
|
|
786
|
+
});
|
|
787
|
+
|
|
788
|
+
it("preserves http when running under http", () => {
|
|
789
|
+
expect(
|
|
790
|
+
getProxyUrl("local", undefined, {
|
|
791
|
+
protocol: "http:",
|
|
792
|
+
host: "localhost:8888",
|
|
793
|
+
hostname: "localhost",
|
|
794
|
+
}),
|
|
795
|
+
).toBe("http://localhost:8888/git-proxy");
|
|
796
|
+
|
|
797
|
+
expect(
|
|
798
|
+
getProxyUrl("local", undefined, {
|
|
799
|
+
protocol: "http:",
|
|
800
|
+
host: "xt-ml.github.io",
|
|
801
|
+
hostname: "xt-ml.github.io",
|
|
802
|
+
}),
|
|
803
|
+
).toBe("http://localhost:8888/git-proxy");
|
|
804
|
+
});
|
|
805
|
+
|
|
806
|
+
it("uses custom URL when provided", () => {
|
|
807
|
+
expect(getProxyUrl("custom", "https://proxy.example.com/git")).toBe(
|
|
808
|
+
"https://proxy.example.com/git",
|
|
809
|
+
);
|
|
810
|
+
});
|
|
811
|
+
});
|
|
812
|
+
|
|
813
|
+
describe("getGitTargetAddressSpace", () => {
|
|
814
|
+
it("returns loopback for localhost and 127.0.0.1 and [::1]", () => {
|
|
815
|
+
expect(
|
|
816
|
+
getGitTargetAddressSpace("http://localhost:8888/git-proxy/test"),
|
|
817
|
+
).toBe("loopback");
|
|
818
|
+
expect(
|
|
819
|
+
getGitTargetAddressSpace("https://127.0.0.1:8888/git-proxy/test"),
|
|
820
|
+
).toBe("loopback");
|
|
821
|
+
expect(
|
|
822
|
+
getGitTargetAddressSpace("https://[::1]:8888/git-proxy/test"),
|
|
823
|
+
).toBe("loopback");
|
|
824
|
+
});
|
|
825
|
+
|
|
826
|
+
it("returns private for private networks and local domains", () => {
|
|
827
|
+
expect(
|
|
828
|
+
getGitTargetAddressSpace("https://192.168.1.10:8888/git-proxy/test"),
|
|
829
|
+
).toBe("private");
|
|
830
|
+
expect(
|
|
831
|
+
getGitTargetAddressSpace("https://10.0.0.5:8888/git-proxy/test"),
|
|
832
|
+
).toBe("private");
|
|
833
|
+
expect(getGitTargetAddressSpace("https://tv:8888/git-proxy/test")).toBe(
|
|
834
|
+
"private",
|
|
835
|
+
);
|
|
836
|
+
expect(
|
|
837
|
+
getGitTargetAddressSpace("https://my-nas.local:8888/git-proxy/test"),
|
|
838
|
+
).toBe("private");
|
|
839
|
+
});
|
|
840
|
+
|
|
841
|
+
it("returns undefined for public domains", () => {
|
|
842
|
+
expect(
|
|
843
|
+
getGitTargetAddressSpace("https://github.com/user/repo.git"),
|
|
844
|
+
).toBeUndefined();
|
|
845
|
+
});
|
|
747
846
|
});
|
|
748
847
|
|
|
749
848
|
describe("repoDir", () => {
|