shadow-claw 1.39.0 → 1.39.2
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/cli/cli.js +3 -3
- package/dist/public/.well-known/mcp/server-card.json +1 -1
- package/dist/public/.well-known/mcp.json +1 -1
- package/dist/public/docs/example/article/index.html +2 -2
- package/dist/public/docs/publishing/index.html +2 -2
- package/dist/public/docs/skill-creator/index.html +2 -2
- package/dist/public/docs/subsystems/cli.md +5 -4
- package/dist/public/index.html +2 -2
- package/dist/public/main/index.html +2 -2
- package/dist/public/main/memory/index.html +2 -2
- package/dist/public/service-worker/fetch-proxy.js +1 -1
- package/dist/public/service-worker/init.js +1 -1
- package/dist/public/service-worker.js +1 -1
- package/package.json +1 -1
- package/src/cli/cli.test.ts +22 -0
- package/src/cli/cli.ts +35 -3
- package/src/service-worker/fetch-proxy.test.ts +23 -5
- package/src/service-worker/fetch-proxy.ts +38 -0
- package/src/service-worker/init.test.ts +49 -0
- package/src/service-worker/init.ts +43 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://modelcontextprotocol.io/schemas/server-card/v1.json",
|
|
3
3
|
"name": "shadow-claw",
|
|
4
|
-
"version": "1.39.
|
|
4
|
+
"version": "1.39.2",
|
|
5
5
|
"description": "Browser-native personal AI assistant with local and remote LLM orchestration, Web Workers, OPFS storage, and agentic tool execution.",
|
|
6
6
|
"title": "ShadowClaw MCP Server",
|
|
7
7
|
"websiteUrl": "https://xt-ml.github.io/shadow-claw/",
|
package/.well-known/mcp.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://modelcontextprotocol.io/schemas/server-card/v1.json",
|
|
3
3
|
"name": "shadow-claw",
|
|
4
|
-
"version": "1.39.
|
|
4
|
+
"version": "1.39.2",
|
|
5
5
|
"description": "Browser-native personal AI assistant with local and remote LLM orchestration, Web Workers, OPFS storage, and agentic tool execution.",
|
|
6
6
|
"title": "ShadowClaw MCP Server",
|
|
7
7
|
"websiteUrl": "https://xt-ml.github.io/shadow-claw/",
|
package/dist/cli/cli.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import{t as e}from"./chunk-uAI_Zi6n.js";import{n as t}from"./chunk-CzjkPhc1.js";import{t as n}from"./chunk-CFhvwUeL.js";import{c as r,i,o as a,s as o}from"./chunk-DHi40kQk.js";import{t as s}from"./chunk-DFh_pp_7.js";import{n as c}from"./chunk-D5mJX3Mr.js";import{r as l}from"./chunk-C-5VcG3a.js";import{a as u}from"./chunk-CS2NqF-O.js";import d from"node:fs";import f from"node:path";import{fileURLToPath as p}from"node:url";import m from"node:process";import{exec as h}from"node:child_process";import{mkdir as g,readFile as _,stat as v,writeFile as y}from"node:fs/promises";import{Command as b}from"commander";import x from"process";import S from"node:http";import C from"node:readline";async function w(e={}){let t=new s(e);try{let e=await t.listClients();if(!e||e.length===0){console.log(`No clients currently registered or connected.`);return}console.log(`Connected / registered clients (${e.length}):\n`),e.forEach((e,t)=>{let n=Math.max(0,Math.floor((Date.now()-e.lastSeen)/1e3)),r=n<60?`${n}s ago`:`${Math.floor(n/60)}m ago`;console.log(` ${t+1}. ${e.deviceLabel} (id: ${e.clientId})`),e.peerId&&console.log(` Peer ID: ${e.peerId}`),console.log(` Capabilities: ${e.capabilities.join(`, `)||`none`}`),console.log(` Version: ${e.version}`),console.log(` Last seen: ${r}\n`)})}catch(e){console.error(`Error fetching clients: ${e.message}`),x.exitCode=1}}async function T(e,t={}){if(!e||typeof e!=`string`||!e.trim()){console.error(`Error: Message cannot be empty.`),x.exitCode=1;return}let n=new s(t);try{let r=t.client;if(!r){let e=await n.listClients();if(!e||e.length===0){console.error(`Error: No clients are connected.`),x.exitCode=1;return}r=e[0].clientId,console.log(`Targeting client: ${e[0].deviceLabel||r} (${r})`)}let i=r||``,a=t.timeout?Number(t.timeout)*1e3:12e4,o;if(t.file?(console.log(`Sending message with file "${t.file}" to ${i}...`),o=await n.sendFile(i,t.file,{prompt:e.trim(),groupId:t.group,timeoutMs:a})):(console.log(`Sending message to ${i}...`),o=await n.sendCommand(i,`send-message`,{text:e.trim(),groupId:t.group},a)),o.success)if(console.log(`Message successfully dispatched.`),o.data?.reply||o.data?.text){let e=o.data.reply||o.data.text;console.log(``),console.log(`Response from ${i}:`),console.log(`----------------------------------------`),console.log(e),console.log(`----------------------------------------`)}else o.data&&(t.json,console.log(JSON.stringify(o.data,null,2)));else console.error(`Error from client: ${o.error||`Unknown error`}`),x.exitCode=1}catch(e){console.error(`Error sending message: ${e.message}`),x.exitCode=1}}async function E(e,t={}){if(!e||typeof e!=`string`||!e.trim()){console.error(`Error: File path cannot be empty.`),x.exitCode=1;return}let n=f.resolve(e.trim());if(!d.existsSync(n)){console.error(`Error: File not found: ${e}`),x.exitCode=1;return}let r=d.statSync(n);if(r.isDirectory()){console.error(`Error: Cannot send directory: ${e}`),x.exitCode=1;return}let i=new s(t);try{let e=t.client;if(!e){let t=await i.listClients();if(!t||t.length===0){console.error(`Error: No clients are connected.`),x.exitCode=1;return}e=t[0].clientId,console.log(`Targeting client: ${t[0].deviceLabel||e} (${e})`)}let a=e||``,o=t.name||f.basename(n);console.log(`Sending "${o}" (${r.size} bytes) to ${a}...`);let s=t.timeout?Number(t.timeout)*1e3:12e4,c=await i.sendFile(a,n,{prompt:t.prompt,name:t.name,groupId:t.group,timeoutMs:s});if(c.success)if(console.log(`File "${o}" successfully transferred to ${a}.`),c.data?.path&&console.log(`Remote location: ${c.data.path}`),c.data?.reply||c.data?.text){let e=c.data.reply||c.data.text;console.log(``),console.log(`Response from ${a}:`),console.log(`----------------------------------------`),console.log(e),console.log(`----------------------------------------`)}else t.json&&c.data&&console.log(JSON.stringify(c.data,null,2));else console.error(`Error from client: ${c.error||`Unknown error`}`),x.exitCode=1}catch(e){console.error(`Error sending file: ${e.message}`),x.exitCode=1}}async function D(e=`trigger`,t={}){let n=new s(t);try{if(e===`list`){let e=await n.listBackups(t.client);if(!e||e.length===0){console.log(`No backups found.`);return}console.log(`Available backups (${e.length}):\n`),e.forEach((e,t)=>{let n=new Date(e.timestamp).toISOString(),r=(e.totalBytes/(1024*1024)).toFixed(2);console.log(` ${t+1}. [${e.id}] Client: ${e.clientId}`),console.log(` Date: ${n}`),console.log(` Files: ${e.fileCount} (${r} MB)\n`)});return}if(e===`delete`){if(!t.backupId){console.error(`Error: --backup-id is required for delete action.`),x.exitCode=1;return}await n.deleteBackup(t.backupId,t.client),console.log(`Backup ${t.backupId} deleted.`);return}let r=t.client;if(!r){let e=await n.listClients();if(!e||e.length===0){console.error(`Error: No clients are connected to back up.`),x.exitCode=1;return}r=e[0].clientId}let i=r||``;console.log(`Requesting backup from client ${i}...`);let a=await n.sendCommand(i,`trigger-backup`,{groupId:t.group,token:n.token});a.success?(console.log(`Backup completed successfully.`),console.log(JSON.stringify(a.data,null,2))):(console.error(`Backup failed: ${a.error}`),x.exitCode=1)}catch(e){console.error(`Error executing backup command: ${e.message}`),x.exitCode=1}}async function O(e={}){let t=new s(e);try{let n=e.client;if(!n){let e=await t.listClients();if(!e||e.length===0){console.error(`Error: No clients connected.`),x.exitCode=1;return}n=e[0].clientId}let r=n||``;console.log(`Fetching tasks from client ${r}${e.group?` (group: ${e.group})`:``}...`);let i=await t.sendCommand(r,`list-tasks`,{groupId:e.group});if(i.success){let t=i.data?.tasks||[];if(t.length===0){console.log(e.group?`No tasks configured on client for group "${e.group}".`:`No tasks configured on client.`);return}console.log(`Tasks on ${n}${e.group?` (group: ${e.group})`:``} (${t.length}):\n`),t.forEach((e,t)=>{let n=e.enabled?`[enabled]`:`[disabled]`,r=e.name||e.prompt?.slice(0,30)||`Untitled task`;console.log(` ${t+1}. ${n} ${r} (${e.schedule||`manual`})`)})}else console.error(`Failed to list tasks: ${i.error}`),x.exitCode=1}catch(e){console.error(`Error executing tasks command: ${e.message}`),x.exitCode=1}}async function k(e=`get`,t={}){let n=t.cacheDir,s=i(n),c=!!(t.renew||e===`renew`||e===`generate`||e===`new`),l=t.set||(e===`set`&&t.id?t.id:null),u=``,d=!1;if(l)u=r(l,n),d=!0;else if(c)u=r(void 0,n),d=!0;else{let e=o(n);e?(u=e,d=!1):(u=a(void 0,n),d=!0)}return t.quiet?(console.log(u),{peerId:u,filePath:s,isRenewed:d}):t.json?(console.log(JSON.stringify({peerId:u,filePath:s,renewed:d},null,2)),{peerId:u,filePath:s,isRenewed:d}):(console.log(l?`WebRTC CLI Peer ID set to: ${u}`:d?`WebRTC CLI Peer ID created/renewed: ${u}`:`WebRTC CLI Peer ID: ${u}`),console.log(`Stored in: ${s}`),{peerId:u,filePath:s,isRenewed:d})}function A(e,t){return typeof e==`string`?t===`raw`?e.startsWith(`shadowclaw_client_`)?e.slice(18):e:e.startsWith(`shadowclaw_client_`)?e:`shadowclaw_client_${e}`:e}function j(e){return A(e,`raw`)}function M(e){return A(e,`exposed`)}const N=[{name:`shadowclaw_server_list_clients`,description:`List connected browser and Electron clients, including device type, ID, and active capabilities.`,inputSchema:{type:`object`,properties:{}}},{name:`shadowclaw_server_send_message`,description:`Send a message or prompt to a connected ShadowClaw client's active AI orchestrator queue.`,inputSchema:{type:`object`,properties:{text:{type:`string`,description:`The prompt or message text to dispatch.`},clientId:{type:`string`,description:`Target client ID. If omitted, targets the first available connected client.`},groupId:{type:`string`,description:`Target conversation group ID (e.g. 'br:main'). If omitted, targets the active group.`}},required:[`text`]}},{name:`shadowclaw_server_read_state`,description:`Read the current orchestrator state (idle, responding, etc.), active group ID, and capabilities from a connected client.`,inputSchema:{type:`object`,properties:{clientId:{type:`string`,description:`Target client ID (defaults to first available connected client).`}}}},{name:`shadowclaw_server_list_tasks`,description:`List scheduled background tasks configured on a connected client (optionally filtered by conversation group).`,inputSchema:{type:`object`,properties:{clientId:{type:`string`,description:`Target client ID (defaults to first available connected client).`},groupId:{type:`string`,description:`Optional conversation group ID filter.`}}}},{name:`shadowclaw_server_set_active_client`,description:`Set the active default connected client used when no clientId is explicitly provided in tool calls.`,inputSchema:{type:`object`,properties:{clientId:{type:`string`,description:`Target client ID (or index '0', '1', prefix, or device label) to make active.`}},required:[`clientId`]}},{name:`shadowclaw_server_manage_backup`,description:`Trigger or manage OPFS workspace file backups for a connected client (trigger, list, or delete).`,inputSchema:{type:`object`,properties:{action:{type:`string`,enum:[`trigger`,`list`,`delete`],description:`Backup action to perform (default: 'trigger').`,default:`trigger`},clientId:{type:`string`,description:`Target client ID.`},backupId:{type:`string`,description:`Backup snapshot ID (required for 'delete').`},groupId:{type:`string`,description:`Optional workspace conversation group ID.`}}}},{name:`shadowclaw_server_status`,description:`Query ShadowClaw Node server status, version, and active client count.`,inputSchema:{type:`object`,properties:{}}},{name:`shadowclaw_server_send_notification`,description:`Broadcast an OS-level push notification to subscribed devices via Web Push (VAPID), or send to a specific registered client. Works even when the client browser tab is closed, asleep, or running in the background.`,inputSchema:{type:`object`,properties:{title:{type:`string`,description:`Notification title (default: 'ShadowClaw').`},body:{type:`string`,description:`The notification body message text.`},clientId:{type:`string`,description:`Target client ID, prefix, or device label of a specific client that has registered in the past. If omitted, broadcasts to all subscribed devices.`}},required:[`body`]}}];function P(e,t){try{let n=typeof e.getConnectedClients==`function`?e.getConnectedClients():typeof e.listClients==`function`?e.listClients():[];if(Array.isArray(n)&&n.length>0){if(typeof t==`string`&&t.trim()){let e=t.trim(),r=n.find(t=>(t.clientId||t.id)===e);if(r)return r.clientId||r.id||``;let i=parseInt(e,10);if(!isNaN(i)&&i>=0&&i<n.length)return n[i].clientId||n[i].id||``;let a=n.find(t=>(t.clientId||t.id||``).startsWith(e)||(t.clientId||t.id||``).replace(/^client-/,``).startsWith(e));if(a)return a.clientId||a.id||``;let o=n.find(t=>t.deviceLabel?.toLowerCase().includes(e.toLowerCase()));return o?o.clientId||o.id||``:e}if(typeof e.getActiveClientId==`function`){let t=e.getActiveClientId();if(t)return t}return n[0].clientId||n[0].id||``}}catch{}return typeof t==`string`?t.trim():``}const F=f.dirname(p(import.meta.url));function I(){try{let e=f.resolve(F,`../../../package.json`);if(d.existsSync(e)){let t=JSON.parse(d.readFileSync(e,`utf8`));if(t.version)return t.version}}catch{}return`1.27.1`}const L=N;function R(e={}){let t=e.client||new s(e),n=e.relayClientTools!==!1,r=e.targetClientId||e.clientTarget,i=r||``,a={name:`shadow-claw`,version:e.version||I()},o={tools:{listChanged:!0},extensions:{"io.modelcontextprotocol/tasks":{}}};async function c(e){let n=e||i||r;try{let e=await t.listClients();return P({getConnectedClients:()=>e},n)}catch{}return P(t,n)}let l=new Map,u=new Map;async function d(){if(!n)return[];let e=[];try{e=await t.listClients()}catch{}if(!Array.isArray(e)||e.length===0)return l.clear(),u.clear(),[];l.clear(),u.clear();for(let n of e){let e=n.clientId||n.id;if(e)try{let r=await t.sendCommand(e,`list-tools`,{});if(r&&r.success&&r.data?.tools&&Array.isArray(r.data.tools))for(let e of r.data.tools){let t=j(e.name);t===`send_notification`||t.startsWith(`shadowclaw_`)&&!t.startsWith(`shadowclaw_client_`)||(u.has(t)||(u.set(t,e),l.set(t,[])),l.get(t).push(n))}}catch{}}let r=await c(),i=[];for(let[t,n]of u.entries()){let a=l.get(t)||[],o=a.map(e=>e.clientId||e.id).filter(Boolean),s=a.find(e=>(e.clientId||e.id)===r)||a[0],c=s?.clientId||s?.id||``,u=s?.deviceLabel||`Client`,d=n.inputSchema&&typeof n.inputSchema==`object`?n.inputSchema:{type:`object`,properties:{}},f={...d.properties||{},clientId:{type:`string`,description:`Target ShadowClaw client ID (optional; defaults to ${c} [${u}]). Available on: ${a.map(e=>`${e.clientId||e.id} (${e.deviceLabel||`Client`})`).join(`, `)}`,enum:o}},p=e.length>1?a.length>1?` [Default: ${u} (${c.slice(0,14)}...)]`:` [Client: ${u} (${c.slice(0,14)}...)]`:``,m=M(t);i.push({name:m,description:(n.description||`Relayed tool '${t}' from connected client.`)+p,inputSchema:{...d,type:`object`,properties:f},annotations:n.annotations})}return i}async function f(e,n={}){let r=e.id===void 0||e.id===null,s=e.id??null;if(n[`mcp-method`]&&n[`mcp-method`]!==e.method)return{jsonrpc:`2.0`,id:s,error:{code:-32020,message:`Mcp-Method header '${n[`mcp-method`]}' does not match '${e.method}'`}};switch(e.method){case`server/discover`:return{jsonrpc:`2.0`,id:s,result:{protocolVersion:`2026-07-28`,supportedProtocolVersions:[`2026-07-28`,`2025-11-25`,`2024-11-05`],capabilities:o,serverInfo:a,_meta:{"io.modelcontextprotocol/serverInfo":a}}};case`initialize`:return{jsonrpc:`2.0`,id:s,result:{protocolVersion:e.params?.protocolVersion||`2024-11-05`,capabilities:o,serverInfo:a}};case`notifications/initialized`:return null;case`tools/list`:{let e=[];try{if(typeof t.listPushClients==`function`)e=await t.listPushClients();else if(typeof t.listPushSubscriptions==`function`){let n=await t.listPushSubscriptions();if(Array.isArray(n)){let t=new Map;for(let e of n){let n=(e.client_id||``).trim()||(e.id?String(e.id):``);n&&!t.has(n)&&t.set(n,{clientId:n,deviceLabel:e.device_label||void 0})}e=Array.from(t.values())}}}catch{}let n=Array.isArray(e)?[...e].sort((e,t)=>(e.clientId||``).localeCompare(t.clientId||``)):[],r=n.map(e=>e.clientId).filter(Boolean),i=await d(),o=new Map;for(let e of L)o.set(e.name,e);for(let e of i)o.has(e.name)||o.set(e.name,e);if(r.length>0)for(let e of[`shadowclaw_server_send_notification`,`shadowclaw_send_notification`]){let t=o.get(e);t&&o.set(e,{...t,inputSchema:{...t.inputSchema,type:`object`,properties:{...t.inputSchema?.properties||{},clientId:{type:`string`,description:`Target client ID, prefix, or device label of a specific client registered for push notifications (optional; if omitted, broadcasts to all subscribed devices). Available on: ${n.map(e=>`${e.clientId} (${e.deviceLabel||`Client`})`).join(`, `)}`,enum:r}}}})}return{jsonrpc:`2.0`,id:s,result:{resultType:`complete`,ttlMs:5e3,cacheScope:`private`,tools:Array.from(o.values()).sort((e,t)=>e.name.localeCompare(t.name)),_meta:{"io.modelcontextprotocol/serverInfo":a}}}}case`tools/call`:{let n=e.params?.name,r=e.params?.arguments||{},o=e.params?.inputResponses;if(!n)return{jsonrpc:`2.0`,id:s,error:{code:-32602,message:`Missing required parameter 'name'`}};if(n===`shadowclaw_server_list_clients`||n===`shadowclaw_list_clients`)try{let e=await t.listClients();return{jsonrpc:`2.0`,id:s,result:{resultType:`complete`,content:[{type:`text`,text:JSON.stringify({clients:e},null,2)}],_meta:{"io.modelcontextprotocol/serverInfo":a}}}}catch(e){return{jsonrpc:`2.0`,id:s,result:{resultType:`complete`,isError:!0,content:[{type:`text`,text:`Error listing clients: ${e.message}`}],_meta:{"io.modelcontextprotocol/serverInfo":a}}}}if(n===`shadowclaw_server_set_active_client`||n===`shadowclaw_set_active_client`){let e=await c(r.clientId);return e?(i=e,console.error(`[ShadowClaw MCP] Active default client set to: ${i}`),{jsonrpc:`2.0`,id:s,result:{resultType:`complete`,content:[{type:`text`,text:`Active default client set to: ${i}`}],_meta:{activeClientId:i,"io.modelcontextprotocol/serverInfo":a}}}):{jsonrpc:`2.0`,id:s,result:{resultType:`complete`,isError:!0,content:[{type:`text`,text:`Error: Client '${r.clientId}' not found among connected clients.`}],_meta:{"io.modelcontextprotocol/serverInfo":a}}}}if(n===`shadowclaw_server_send_message`||n===`shadowclaw_send_message`){let e=await c(r.clientId);if(!e)return{jsonrpc:`2.0`,id:s,result:{resultType:`complete`,isError:!0,content:[{type:`text`,text:`Error: No connected client available.`}],_meta:{"io.modelcontextprotocol/serverInfo":a}}};try{let n=await t.sendCommand(e,`send-message`,{text:r.text,groupId:r.groupId});return{jsonrpc:`2.0`,id:s,result:{resultType:`complete`,isError:!n.success,content:[{type:`text`,text:JSON.stringify(n.data||n,null,2)}],_meta:{"io.modelcontextprotocol/serverInfo":a}}}}catch(e){return{jsonrpc:`2.0`,id:s,result:{resultType:`complete`,isError:!0,content:[{type:`text`,text:`Error sending message: ${e.message}`}],_meta:{"io.modelcontextprotocol/serverInfo":a}}}}}if(n===`shadowclaw_server_read_state`||n===`shadowclaw_read_state`){let e=await c(r.clientId);try{let n=await t.sendCommand(e,`read-state`,{});return{jsonrpc:`2.0`,id:s,result:{resultType:`complete`,isError:!n.success,content:[{type:`text`,text:JSON.stringify(n.data||n,null,2)}],_meta:{"io.modelcontextprotocol/serverInfo":a}}}}catch(e){return{jsonrpc:`2.0`,id:s,result:{resultType:`complete`,isError:!0,content:[{type:`text`,text:`Error reading state: ${e.message}`}],_meta:{"io.modelcontextprotocol/serverInfo":a}}}}}if(n===`shadowclaw_server_list_tasks`||n===`shadowclaw_list_tasks`){let e=await c(r.clientId);try{let n=await t.sendCommand(e,`list-tasks`,{groupId:r.groupId});return{jsonrpc:`2.0`,id:s,result:{resultType:`complete`,isError:!n.success,content:[{type:`text`,text:JSON.stringify(n.data||n,null,2)}],_meta:{"io.modelcontextprotocol/serverInfo":a}}}}catch(e){return{jsonrpc:`2.0`,id:s,result:{resultType:`complete`,isError:!0,content:[{type:`text`,text:`Error listing tasks: ${e.message}`}],_meta:{"io.modelcontextprotocol/serverInfo":a}}}}}if(n===`shadowclaw_server_manage_backup`||n===`shadowclaw_manage_backup`){let e=r.action||`trigger`,n=await c(r.clientId);try{if(e===`list`){let e=await t.listBackups(n);return{jsonrpc:`2.0`,id:s,result:{resultType:`complete`,content:[{type:`text`,text:JSON.stringify({backups:e},null,2)}],_meta:{"io.modelcontextprotocol/serverInfo":a}}}}if(e===`delete`){let e=await t.deleteBackup(r.backupId,n);return{jsonrpc:`2.0`,id:s,result:{resultType:`complete`,content:[{type:`text`,text:JSON.stringify(e,null,2)}],_meta:{"io.modelcontextprotocol/serverInfo":a}}}}let i=await t.sendCommand(n,`trigger-backup`,{groupId:r.groupId});return{jsonrpc:`2.0`,id:s,result:{resultType:`complete`,isError:!i.success,content:[{type:`text`,text:JSON.stringify(i.data||i,null,2)}],_meta:{"io.modelcontextprotocol/serverInfo":a}}}}catch(e){return{jsonrpc:`2.0`,id:s,result:{resultType:`complete`,isError:!0,content:[{type:`text`,text:`Error managing backup: ${e.message}`}],_meta:{"io.modelcontextprotocol/serverInfo":a}}}}}if(n===`shadowclaw_server_status`||n===`shadowclaw_status`)try{let e=await t.listClients();return{jsonrpc:`2.0`,id:s,result:{resultType:`complete`,content:[{type:`text`,text:JSON.stringify({server:`ShadowClaw`,version:a.version,connectedClients:e.length,status:`healthy`},null,2)}],_meta:{"io.modelcontextprotocol/serverInfo":a}}}}catch(e){return{jsonrpc:`2.0`,id:s,result:{resultType:`complete`,isError:!0,content:[{type:`text`,text:`Error querying server status: ${e.message}`}],_meta:{"io.modelcontextprotocol/serverInfo":a}}}}if(n===`shadowclaw_server_send_notification`||n===`shadowclaw_send_notification`||n===`send_notification`){let e=String(r.body||``).trim();if(!e)return{jsonrpc:`2.0`,id:s,result:{resultType:`complete`,isError:!0,content:[{type:`text`,text:`Error: Notification 'body' parameter cannot be empty.`}],_meta:{"io.modelcontextprotocol/serverInfo":a}}};let n=String(r.title||`ShadowClaw`).trim(),i=typeof r.clientId==`string`&&r.clientId.trim()?r.clientId.trim():void 0;try{let r=await t.broadcastNotification({title:n,body:e,...i?{clientId:i}:{}}),o=r?.sent??0,c=r?.failed??0,l;return l=r?.notFound?`Warning: No push subscriptions found for client '${i}'. Ensure push notifications were registered by this client in ShadowClaw Settings.`:r?.noSubscribers?`Warning: Push notification broadcast completed, but no devices are currently subscribed to push notifications. Ensure push notifications are enabled in ShadowClaw Settings on the client first.`:i?`Push notification sent to client '${i}': ${o} recipient(s) delivered, ${c} failed.`:`Push notification broadcast sent: ${o} recipient(s) delivered, ${c} failed.`,{jsonrpc:`2.0`,id:s,result:{resultType:`complete`,isError:!1,content:[{type:`text`,text:l}],_meta:{...r,...i?{targetClientId:i}:{},"io.modelcontextprotocol/serverInfo":a}}}}catch(e){return{jsonrpc:`2.0`,id:s,result:{resultType:`complete`,isError:!0,content:[{type:`text`,text:`Failed to send push notification: ${e.message}`}],_meta:{"io.modelcontextprotocol/serverInfo":a}}}}}let f=j(n);if((f===`ask_user`||n===`ask_user`)&&o&&o.response)return{jsonrpc:`2.0`,id:s,result:{resultType:`complete`,content:[{type:`text`,text:String(o.response)}],_meta:{"io.modelcontextprotocol/serverInfo":a}}};u.size===0&&await d();let p=(l.get(f)||l.get(n)||[]).map(e=>e.clientId||e.id).filter(Boolean),m=``;if(r.clientId)m=await c(r.clientId);else{let e=await c();m=p.includes(e)?e:p.length>0?p[0]:e}if(!m)return{jsonrpc:`2.0`,id:s,result:{resultType:`complete`,isError:!0,content:[{type:`text`,text:`Error: No connected client available.`}],_meta:{"io.modelcontextprotocol/serverInfo":a}}};if(p.length>0&&!p.includes(m))return{jsonrpc:`2.0`,id:s,result:{resultType:`complete`,isError:!0,content:[{type:`text`,text:`Error: Tool '${n}' is not enabled or available on client '${m}'. (Available on: ${p.join(`, `)})`}],_meta:{clientId:m,"io.modelcontextprotocol/serverInfo":a}}};try{console.error(`[ShadowClaw MCP] Executing '${f}' on client: ${m}`);let e={...r};delete e.clientId;let n=f===`ask_user`?await t.sendCommand(m,`invoke-tool`,{toolName:f,input:e},3e5):await t.sendCommand(m,`invoke-tool`,{toolName:f,input:e}),i=n.data?.result===void 0?n.data:n.data.result,o=typeof i==`string`?i:JSON.stringify(i,null,2),c=n.error||n.data&&n.data.error||`Unknown tool execution error`;return{jsonrpc:`2.0`,id:s,result:{resultType:`complete`,isError:!n.success,content:[{type:`text`,text:n.success?o||``:o&&o!==`null`&&o!==`{}`?`${o}\n${c}`:`Tool execution error: ${c}`}],_meta:{clientId:m,"io.modelcontextprotocol/serverInfo":a}}}}catch(e){return{jsonrpc:`2.0`,id:s,result:{resultType:`complete`,isError:!0,content:[{type:`text`,text:`Tool error: ${e.message}`}],_meta:{clientId:m,"io.modelcontextprotocol/serverInfo":a}}}}}case`tasks/get`:return{jsonrpc:`2.0`,id:s,result:{resultType:`complete`,task:{taskId:e.params?.taskId||`task-1`,status:`completed`},_meta:{"io.modelcontextprotocol/serverInfo":a}}};default:return r?null:{jsonrpc:`2.0`,id:s,error:{code:-32601,message:`Method not found: '${e.method}'`}}}}return{handleMessage:f,getActiveClientId:()=>i,setActiveClientId:e=>{i=e}}}async function z(e={}){if((e.mcpTransport||(e.http?`http`:`stdio`))===`http`){let t=parseInt(String(e.port||x.env.MCP_PORT||`8888`),10),n=e.host||`127.0.0.1`,r=R(e);S.createServer(async(e,t)=>{if(e.method!==`POST`||e.url?.split(`?`)[0]!==`/mcp`){t.writeHead(404,{"Content-Type":`application/json`}),t.end(JSON.stringify({error:`Not found`}));return}let n=``;e.on(`data`,e=>n+=e),e.on(`end`,async()=>{let i;try{i=JSON.parse(n)}catch{t.writeHead(400,{"Content-Type":`application/json`}),t.end(JSON.stringify({jsonrpc:`2.0`,id:null,error:{code:-32700,message:`Parse error`}}));return}try{let n={"mcp-protocol-version":e.headers[`mcp-protocol-version`],"mcp-method":e.headers[`mcp-method`],"mcp-name":e.headers[`mcp-name`]},a=await r.handleMessage(i,n);if(a===null){t.writeHead(202),t.end();return}t.writeHead(200,{"Content-Type":`application/json`,"MCP-Protocol-Version":`2026-07-28`}),t.end(JSON.stringify(a))}catch(e){t.writeHead(500,{"Content-Type":`application/json`}),t.end(JSON.stringify({jsonrpc:`2.0`,id:i?.id??null,error:{code:-32603,message:e?.message||`Internal error`}}))}})}).listen(t,n,()=>{console.error(`[ShadowClaw MCP] HTTP MCP server listening at http://${n}:${t}/mcp (2026-07-28)`)});return}console.log=(...e)=>console.error(...e),console.info=(...e)=>console.error(...e);let t=R(e);C.createInterface({input:x.stdin,output:x.stdout,terminal:!1}).on(`line`,async e=>{let n=e.trim();if(!n)return;let r;try{r=JSON.parse(n)}catch{x.stdout.write(JSON.stringify({jsonrpc:`2.0`,id:null,error:{code:-32700,message:`Parse error`}})+`
|
|
2
2
|
`);return}try{let e=await t.handleMessage(r);e!==null&&x.stdout.write(JSON.stringify(e)+`
|
|
3
3
|
`)}catch(e){let t={jsonrpc:`2.0`,id:r?.id??null,error:{code:-32603,message:e?.message||`Internal error`}};x.stdout.write(JSON.stringify(t)+`
|
|
4
|
-
`)}}),console.error(`[ShadowClaw MCP] STDIO MCP server active (2026-07-28)`)}const B=e(import.meta.url),V=new Set;function H(e){return typeof e==`function`?(V.add(e),()=>V.delete(e)):()=>!1}let U=!1;const W=(e,t)=>{U&&m.exit(t),U=!0;for(let t of V)try{t(e)}catch{}m.stderr.write(`\nProcess interrupted (${e}).\n`),m.exit(t)};m.on(`SIGINT`,()=>W(`SIGINT`,130)),m.on(`SIGTERM`,()=>W(`SIGTERM`,143)),m.on(`exit`,()=>{for(let e of V)try{e(`exit`)}catch{}});async function G(){try{let e=await _(f.join(B,`package.json`),`utf8`);return JSON.parse(e).version||`1.0.0`}catch{return`1.0.0`}}async function K(e){try{return await v(e),!0}catch{return!1}}function q(e){let t=m.platform===`darwin`?`open`:m.platform===`win32`?`start`:`xdg-open`;try{h(`${t} ${e}`)}catch{}}const J=await G(),Y=new b;Y.name(`shadow-claw`).description(`Browser-native personal AI assistant and static site publisher`).version(J,`-v, --version`,`Output the current version`),Y.commandsGroup(`Development:`),Y.command(`build`).description(`Build the static site bundle for production or staging`).optionsGroup(`Build Mode Options:`).option(`--prod, --production`,`Build in production mode with minification and optimizations`,!1).option(`--prerender-pages <mode>`,`Prerender page mode (all, auto, none)`,`auto`).option(`--copy-all-assets`,`Copy entire assets/ directory into output`,!1).optionsGroup(`Path & Routing Options:`).option(`--origin <url>`,`Canonical origin URL (e.g. https://user.github.io/repo/)`).option(`--base-path <path>`,`URL base path prefix (e.g. /repo/)`).option(`--out-dir <dir>`,`Output directory relative to content root`,`dist/public`).option(`--content-root <dir>`,`Content root directory`,m.cwd()).action(async e=>{try{let t=f.resolve(e.contentRoot||m.cwd()),r=!!(e.prod||e.production||m.env.NODE_ENV===`production`);console.log(`Building ShadowClaw site from ${t}...`),await n({contentRoot:t,toolchainRoot:B,outDir:e.outDir||`dist/public`,isProduction:r,pagesOrigin:e.origin||m.env.PAGES_ORIGIN,basePath:e.basePath||m.env.PAGES_BASE_PATH,prerenderPages:e.prerenderPages,copyAllAssets:e.copyAllAssets})}catch(e){console.error(`Build failed:`,e),m.exit(1)}});async function X(e,t){try{let r=f.resolve(t.contentRoot||m.cwd()),i=parseInt(e||t.port||m.env.PORT||`8888`,10),a=t.host||t.ip||m.env.SHADOWCLAW_DEV_IP||`127.0.0.1`,o=t.outDir||`dist/public`,s=f.resolve(r,o),c=await u({contentRoot:r,cacheDir:t.cacheDir,databaseDir:t.databaseDir,tmp:t.tmp||t.temp,yes:t.yes}),l=c.cacheDir,d=c.databaseDir;console.log(`Preparing ShadowClaw dev build for ${r}...`),await n({contentRoot:r,toolchainRoot:B,outDir:o,isProduction:!1,pagesOrigin:t.origin||m.env.PAGES_ORIGIN,basePath:t.basePath||m.env.PAGES_BASE_PATH,prerenderPages:t.prerenderPages||`auto`,copyAllAssets:t.copyAllAssets});let p=await K(f.join(B,`dist/server.js`))?f.join(B,`dist/server.js`):f.join(B,`src/server/server.ts`);m.env.SHADOWCLAW_ROOT_PATH=s,m.env.SHADOWCLAW_CACHE_DIR=l,m.env.SHADOWCLAW_DATABASE_DIR=d,m.env.SHADOWCLAW_DEV_IP=a;let{startServer:h}=await import(p),g=new Set((t.corsAllowOrigin||m.env.SHADOWCLAW_CORS_ALLOWED_ORIGINS||`https://xt-ml.github.io`).split(`,`).map(e=>e.trim()).filter(Boolean)),_=!!(t.https||[`1`,`true`,`yes`].includes((m.env.SHADOWCLAW_HTTPS||``).toLowerCase().trim())),v=t.cert||(m.env.SHADOWCLAW_TLS_CERT||m.env.SHADOWCLAW_CERT||``).trim()||void 0,y=t.key||(m.env.SHADOWCLAW_TLS_KEY||m.env.SHADOWCLAW_KEY||``).trim()||void 0,b=f.resolve(r,t.sslDir||m.env.SHADOWCLAW_SSL_DIR||m.env.SHADOWCLAW_TLS_DIR||f.join(l,`tls`));await h({port:i,bindHost:a,corsMode:t.corsMode||`localhost`,allowedOrigins:g,verbose:!!t.verbose,peerjs:!!t.peerjs,rootPath:s,cacheDir:l,databaseDir:d,allowPrivateProxy:!!t.allowPrivateProxy,https:_,certPath:v,keyPath:y,sslDir:b});let x=`${_?`https`:`http`}://${a}:${i}`;t.open&&q(x)}catch(e){console.error(`Dev server error:`,e),m.exit(1)}}Y.command(`dev [port]`).description(`Build and launch the development server`).optionsGroup(`Server & Network Options:`).option(`-p, --port <port>`,`Port to listen on (default: 8888)`).option(`--host <host>`,`Bind host/IP`,`127.0.0.1`).option(`--ip <host>`,`Bind host/IP (alias)`).option(`--open`,`Automatically open default browser`,!1).option(`-v, --verbose`,`Enable verbose request/proxy logging`,!1).optionsGroup(`Site & Build Options:`).option(`--content-root <dir>`,`Content root directory`,m.cwd()).option(`--out-dir <dir>`,`Output directory relative to content root`,`dist/public`).optionsGroup(`Security & Proxy Options:`).option(`--cors-mode <mode>`,`CORS policy: localhost | private | all`,`localhost`).option(`--allow-private-proxy`,`Allow proxy to reach private/loopback addresses`,!1).option(`--peerjs`,`Enable built-in PeerJS signaling server`,!1).optionsGroup(`TLS / HTTPS Options:`).option(`--https`,`Enable HTTPS dev server`,!1).option(`--cert <path>`,`Path to existing TLS certificate file`).option(`--key <path>`,`Path to existing TLS private key file`).option(`--ssl-dir <path>`,`Directory for TLS certificate generation/storage`).optionsGroup(`Storage & Database Options:`).option(`--database-dir <dir>`,`Directory where SQLite databases are stored`).option(`--cache-dir <dir>`,`Custom cache directory for databases, tokens, and logs`).option(`--tmp, --temp`,`Store cache and databases in system temporary directory`,!1).option(`-y, --yes`,`Skip interactive cache directory prompt and use default .cache`,!1).action(X),Y.command(`run [port]`).description(`Alias for dev: build and launch the development server`).optionsGroup(`Server & Network Options:`).option(`-p, --port <port>`,`Port to listen on (default: 8888)`).option(`--host <host>`,`Bind host/IP`,`127.0.0.1`).option(`--ip <host>`,`Bind host/IP (alias)`).option(`--open`,`Automatically open default browser`,!1).option(`-v, --verbose`,`Enable verbose request/proxy logging`,!1).optionsGroup(`Site & Build Options:`).option(`--content-root <dir>`,`Content root directory`,m.cwd()).option(`--out-dir <dir>`,`Output directory relative to content root`,`dist/public`).optionsGroup(`Security & Proxy Options:`).option(`--cors-mode <mode>`,`CORS policy: localhost | private | all`,`localhost`).option(`--allow-private-proxy`,`Allow proxy to reach private/loopback addresses`,!1).option(`--peerjs`,`Enable built-in PeerJS signaling server`,!1).optionsGroup(`TLS / HTTPS Options:`).option(`--https`,`Enable HTTPS dev server`,!1).option(`--cert <path>`,`Path to existing TLS certificate file`).option(`--key <path>`,`Path to existing TLS private key file`).option(`--ssl-dir <path>`,`Directory for TLS certificate generation/storage`).optionsGroup(`Storage & Database Options:`).option(`--database-dir <dir>`,`Directory where SQLite databases are stored`).option(`--cache-dir <dir>`,`Custom cache directory for databases, tokens, and logs`).option(`--tmp, --temp`,`Store cache and databases in system temporary directory`,!1).option(`-y, --yes`,`Skip interactive cache directory prompt and use default .cache`,!1).action(X),Y.commandsGroup(`Server:`),Y.command(`serve [port]`).description(`Serve an existing static site build and start the backend proxy`).optionsGroup(`Server & Network Options:`).option(`-p, --port <port>`,`Port to listen on (default: 8888)`).option(`--host <host>`,`Bind host/IP`,`127.0.0.1`).option(`--no-static`,`Disable static file and UI serving (services-only mode)`).option(`--open`,`Automatically open default browser`,!1).option(`-v, --verbose`,`Enable verbose request/proxy logging`,!1).optionsGroup(`Site Options:`).option(`--content-root <dir>`,`Content root directory`,m.cwd()).option(`--out-dir <dir>`,`Output directory relative to content root`,`dist/public`).optionsGroup(`Security & Proxy Options:`).option(`--cors-mode <mode>`,`CORS policy: localhost | private | all`,`localhost`).option(`--allow-private-proxy`,`Allow proxy to reach private/loopback addresses`,!1).option(`--peerjs`,`Enable built-in PeerJS signaling server`,!1).optionsGroup(`TLS / HTTPS Options:`).option(`--https`,`Enable HTTPS dev server`,!1).option(`--cert <path>`,`Path to existing TLS certificate file`).option(`--key <path>`,`Path to existing TLS private key file`).option(`--ssl-dir <path>`,`Directory for TLS certificate generation/storage`).optionsGroup(`Storage & Database Options:`).option(`--database-dir <dir>`,`Directory where SQLite databases are stored`).option(`--cache-dir <dir>`,`Custom cache directory for databases, tokens, and logs`).option(`--tmp, --temp`,`Store cache and databases in system temporary directory`,!1).option(`-y, --yes`,`Skip interactive cache directory prompt and use default .cache`,!1).action(async(e,t)=>{try{let n=f.resolve(t.contentRoot||m.cwd()),r=parseInt(e||t.port||m.env.PORT||`8888`,10),i=t.host||t.ip||m.env.SHADOWCLAW_DEV_IP||`127.0.0.1`,a=t.outDir||`dist/public`,o=f.resolve(n,a),s=await u({contentRoot:n,cacheDir:t.cacheDir,databaseDir:t.databaseDir,tmp:t.tmp||t.temp,yes:t.yes}),c=s.cacheDir,l=s.databaseDir,d=t.static!==!1;d&&!await K(f.join(o,`index.html`))&&(console.error(`Error: No index.html found in ${o}. Run "shadow-claw build" first.`),m.exit(1));let p=await K(f.join(B,`dist/server.js`))?f.join(B,`dist/server.js`):f.join(B,`src/server/server.ts`);m.env.SHADOWCLAW_ROOT_PATH=o,m.env.SHADOWCLAW_CACHE_DIR=c,m.env.SHADOWCLAW_DATABASE_DIR=l,m.env.SHADOWCLAW_DEV_IP=i;let{startServer:h}=await import(p),g=new Set((t.corsAllowOrigin||m.env.SHADOWCLAW_CORS_ALLOWED_ORIGINS||`https://xt-ml.github.io`).split(`,`).map(e=>e.trim()).filter(Boolean)),_=!!(t.https||[`1`,`true`,`yes`].includes((m.env.SHADOWCLAW_HTTPS||``).toLowerCase().trim())),v=t.cert||(m.env.SHADOWCLAW_TLS_CERT||m.env.SHADOWCLAW_CERT||``).trim()||void 0,y=t.key||(m.env.SHADOWCLAW_TLS_KEY||m.env.SHADOWCLAW_KEY||``).trim()||void 0,b=f.resolve(n,t.sslDir||m.env.SHADOWCLAW_SSL_DIR||m.env.SHADOWCLAW_TLS_DIR||f.join(c,`tls`));await h({port:r,bindHost:i,corsMode:t.corsMode||`localhost`,allowedOrigins:g,verbose:!!t.verbose,peerjs:!!t.peerjs,rootPath:o,cacheDir:c,databaseDir:l,allowPrivateProxy:!!t.allowPrivateProxy,https:_,certPath:v,keyPath:y,sslDir:b,serveStatic:d});let x=`${_?`https`:`http`}://${i}:${r}`;d&&t.open&&q(x)}catch(e){console.error(`Serve error:`,e),m.exit(1)}});async function Z(e,t){try{let n=f.resolve(t.contentRoot||m.cwd()),r=parseInt(e||t.port||m.env.PORT||`8888`,10),i=t.host||t.ip||m.env.SHADOWCLAW_DEV_IP||`127.0.0.1`,a=await u({contentRoot:n,cacheDir:t.cacheDir,databaseDir:t.databaseDir,tmp:t.tmp||t.temp,yes:t.yes}),o=a.cacheDir,s=a.databaseDir,c=await K(f.join(B,`dist/server.js`))?f.join(B,`dist/server.js`):f.join(B,`src/server/server.ts`);m.env.SHADOWCLAW_CACHE_DIR=o,m.env.SHADOWCLAW_DATABASE_DIR=s,m.env.SHADOWCLAW_DEV_IP=i,m.env.SHADOWCLAW_SERVE_STATIC=`false`;let{startServer:l}=await import(c),d=new Set((t.corsAllowOrigin||m.env.SHADOWCLAW_CORS_ALLOWED_ORIGINS||`https://xt-ml.github.io`).split(`,`).map(e=>e.trim()).filter(Boolean)),p=!!(t.https||[`1`,`true`,`yes`].includes((m.env.SHADOWCLAW_HTTPS||``).toLowerCase().trim())),h=t.cert||(m.env.SHADOWCLAW_TLS_CERT||m.env.SHADOWCLAW_CERT||``).trim()||void 0,g=t.key||(m.env.SHADOWCLAW_TLS_KEY||m.env.SHADOWCLAW_KEY||``).trim()||void 0,_=f.resolve(n,t.sslDir||m.env.SHADOWCLAW_SSL_DIR||m.env.SHADOWCLAW_TLS_DIR||f.join(o,`tls`));await l({port:r,bindHost:i,corsMode:t.corsMode||`localhost`,allowedOrigins:d,verbose:!!t.verbose,peerjs:!!t.peerjs,rootPath:``,cacheDir:o,databaseDir:s,controlToken:t.controlToken||m.env.SHADOWCLAW_CONTROL_TOKEN||void 0,allowPrivateProxy:!!t.allowPrivateProxy,https:p,certPath:h,keyPath:g,sslDir:_,serveStatic:!1})}catch(e){console.error(`Server error:`,e),m.exit(1)}}Y.command(`server [port]`).aliases([`services`,`api`]).description(`Start backend services (Express, MCP, control plane) without building or serving the UI (aliases: services, api)`).optionsGroup(`Server & Network Options:`).option(`-p, --port <port>`,`Port to listen on (default: 8888)`).option(`--host <host>`,`Bind host/IP`,`127.0.0.1`).option(`--ip <host>`,`Bind host/IP (alias)`).option(`-v, --verbose`,`Enable verbose request/proxy logging`,!1).optionsGroup(`Security & Proxy Options:`).option(`--cors-mode <mode>`,`CORS policy: localhost | private | all`,`localhost`).option(`--cors-allow-origin <origin>`,`Explicit allowed origins (comma-separated)`).option(`--control-token <token>`,`Secret token for control-plane authentication`).option(`--peerjs`,`Enable built-in PeerJS signaling server`,!1).option(`--allow-private-proxy`,`Allow proxy to reach private/loopback addresses`,!1).optionsGroup(`TLS / HTTPS Options:`).option(`--https`,`Enable HTTPS server`,!1).option(`--cert <path>`,`Path to existing TLS certificate file`).option(`--key <path>`,`Path to existing TLS private key file`).option(`--ssl-dir <path>`,`Directory for TLS certificate generation/storage`).optionsGroup(`Storage & Database Options:`).option(`--content-root <dir>`,`Content root directory`,m.cwd()).option(`--database-dir <dir>`,`Directory where SQLite databases are stored`).option(`--cache-dir <dir>`,`Custom cache directory for databases, tokens, and logs`).option(`--tmp, --temp`,`Store cache and databases in system temporary directory`,!1).option(`-y, --yes`,`Skip interactive cache directory prompt and use default .cache`,!1).action(Z),Y.command(`mcp`).description(`Run the official Stateless Model Context Protocol (MCP 2026-07-28) server`).optionsGroup(`MCP Protocol Options:`).option(`--mcp-transport <transport>`,`MCP transport: stdio | http`,`stdio`).option(`--relay-client-tools`,`Discover and relay tools from connected browser clients`,!0).option(`--no-relay-client-tools`,`Disable relaying browser client tools`).optionsGroup(`Target Client Options:`).option(`--client <id>`,`Target client ID (defaults to first active client)`).optionsGroup(`Control Plane Connection Options:`).option(`--host <host>`,`Control plane host`).option(`--port <port>`,`Control plane port or HTTP MCP port`).option(`--token <token>`,`Control token`).option(`--https`,`Connect to server via HTTPS`,!1).option(`-k, --insecure`,`Allow self-signed TLS certificates`,!0).optionsGroup(`Transport & Peer Options:`).option(`--transport <transport>`,`Control plane client transport: http | webrtc`,`http`).option(`--peer-id <id>`,`Custom WebRTC CLI peer ID`).option(`--cache-dir <dir>`,`Custom cache directory for control token and databases`).action(async e=>{await z(e)}),Y.commandsGroup(`Control Plane & Client Bridge:`),Y.command(`clients`).description(`List connected / registered browser and Electron clients`).optionsGroup(`Control Plane Connection Options:`).option(`--host <host>`,`Control plane host`).option(`--port <port>`,`Control plane port`).option(`--token <token>`,`Control token`).option(`--https`,`Connect to server via HTTPS`,!1).option(`-k, --insecure`,`Allow self-signed TLS certificates`,!0).optionsGroup(`Transport & Peer Options:`).option(`--transport <transport>`,`Transport to use: http | webrtc`,`http`).option(`--peer-id <id>`,`Custom WebRTC CLI peer ID`).option(`--renew-peer-id`,`Renew WebRTC CLI peer ID before connecting`,!1).option(`--cache-dir <dir>`,`Custom cache directory`).action(async e=>{await w(e)}),Y.command(`send <message>`).description(`Send a message/prompt to a connected client or peer agent`).optionsGroup(`Target Options:`).option(`--client <id>`,`Target client ID (defaults to first available)`).option(`--group <groupId>`,`Target conversation group ID`).option(`-f, --file <path>`,`Attach a local file to send with the message`).optionsGroup(`Control Plane Connection Options:`).option(`--host <host>`,`Control plane host`).option(`--port <port>`,`Control plane port`).option(`--token <token>`,`Control token`).option(`--https`,`Connect to server via HTTPS`,!1).option(`-k, --insecure`,`Allow self-signed TLS certificates`,!0).optionsGroup(`Transport & Peer Options:`).option(`--transport <transport>`,`Transport to use: http | webrtc`,`http`).option(`--peer-id <id>`,`Custom WebRTC CLI peer ID`).option(`--renew-peer-id`,`Renew WebRTC CLI peer ID before sending`,!1).option(`--cache-dir <dir>`,`Custom cache directory`).option(`--timeout <seconds>`,`Timeout in seconds to wait for response`,`120`).option(`--json`,`Output response payload as JSON`,!1).action(async(e,t)=>{await T(e,t)}),Y.command(`send-file <file>`).description(`Transfer a file to a connected peer or client over WebRTC or HTTP`).optionsGroup(`Target Options:`).option(`--client <id>`,`Target client ID (defaults to first available)`).option(`--prompt <prompt>`,`Accompanying prompt or instructions for the receiving agent`).option(`--name <fileName>`,`Override remote file name`).option(`--group <groupId>`,`Target conversation group ID`).optionsGroup(`Control Plane Connection Options:`).option(`--host <host>`,`Control plane host`).option(`--port <port>`,`Control plane port`).option(`--token <token>`,`Control token`).option(`--https`,`Connect to server via HTTPS`,!1).option(`-k, --insecure`,`Allow self-signed TLS certificates`,!0).optionsGroup(`Transport & Peer Options:`).option(`--transport <transport>`,`Transport to use: http | webrtc`,`webrtc`).option(`--peer-id <id>`,`Custom WebRTC CLI peer ID`).option(`--renew-peer-id`,`Renew WebRTC CLI peer ID before sending`,!1).option(`--cache-dir <dir>`,`Custom cache directory`).option(`--timeout <seconds>`,`Transfer and execution timeout in seconds`,`120`).option(`--json`,`Output response payload as JSON`,!1).action(async(e,t)=>{await E(e,t)}),Y.command(`tasks`).description(`List scheduled tasks on a connected client`).optionsGroup(`Target Options:`).option(`--client <id>`,`Target client ID`).option(`--group <groupId>`,`Filter tasks by conversation group ID`).optionsGroup(`Control Plane Connection Options:`).option(`--host <host>`,`Control plane host`).option(`--port <port>`,`Control plane port`).option(`--token <token>`,`Control token`).option(`--https`,`Connect to server via HTTPS`,!1).option(`-k, --insecure`,`Allow self-signed TLS certificates`,!0).optionsGroup(`Transport & Peer Options:`).option(`--transport <transport>`,`Transport to use: http | webrtc`,`http`).option(`--peer-id <id>`,`Custom WebRTC CLI peer ID`).option(`--renew-peer-id`,`Renew WebRTC CLI peer ID before connecting`,!1).option(`--cache-dir <dir>`,`Custom cache directory`).action(async e=>{await O(e)}),Y.command(`backup [action]`).description(`Trigger or manage client workspace backups (trigger | list | delete)`).optionsGroup(`Target Options:`).option(`--client <id>`,`Client ID`).option(`--backup-id <id>`,`Backup ID (for delete)`).option(`--group <groupId>`,`Specific workspace group ID`).optionsGroup(`Control Plane Connection Options:`).option(`--host <host>`,`Control plane host`).option(`--port <port>`,`Control plane port`).option(`--token <token>`,`Control token`).option(`--https`,`Connect to server via HTTPS`,!1).option(`-k, --insecure`,`Allow self-signed TLS certificates`,!0).optionsGroup(`Transport & Peer Options:`).option(`--transport <transport>`,`Transport to use: http | webrtc`,`http`).option(`--peer-id <id>`,`Custom WebRTC CLI peer ID`).option(`--renew-peer-id`,`Renew WebRTC CLI peer ID before connecting`,!1).option(`--cache-dir <dir>`,`Custom cache directory`).action(async(e,t)=>{await D(e||`trigger`,t)}),Y.commandsGroup(`WebRTC:`),Y.command(`webrtc [action] [customId]`).summary(`Manage WebRTC CLI configuration and peer identity (.cache/cli-peer-id)`).description(`Manage WebRTC CLI configuration and peer identity (.cache/cli-peer-id)
|
|
4
|
+
`)}}),console.error(`[ShadowClaw MCP] STDIO MCP server active (2026-07-28)`)}const B=e(import.meta.url),V=new Set;function H(e){return typeof e==`function`?(V.add(e),()=>V.delete(e)):()=>!1}let U=!1;const W=(e,t)=>{U&&m.exit(t),U=!0;for(let t of V)try{t(e)}catch{}m.stderr.write(`\nProcess interrupted (${e}).\n`),m.exit(t)};m.on(`SIGINT`,()=>W(`SIGINT`,130)),m.on(`SIGTERM`,()=>W(`SIGTERM`,143)),m.on(`exit`,()=>{for(let e of V)try{e(`exit`)}catch{}});async function G(){try{let e=await _(f.join(B,`package.json`),`utf8`);return JSON.parse(e).version||`1.0.0`}catch{return`1.0.0`}}async function K(e){try{return await v(e),!0}catch{return!1}}function q(e){return!!(e.a2a||[`1`,`true`,`yes`].includes((m.env.SHADOWCLAW_A2A||``).toLowerCase().trim()))}function J(e){let t=m.platform===`darwin`?`open`:m.platform===`win32`?`start`:`xdg-open`;try{h(`${t} ${e}`)}catch{}}const Y=await G(),X=new b;X.name(`shadow-claw`).description(`Browser-native personal AI assistant and static site publisher`).version(Y,`-v, --version`,`Output the current version`),X.commandsGroup(`Development:`),X.command(`build`).description(`Build the static site bundle for production or staging`).optionsGroup(`Build Mode Options:`).option(`--prod, --production`,`Build in production mode with minification and optimizations`,!1).option(`--prerender-pages <mode>`,`Prerender page mode (all, auto, none)`,`auto`).option(`--copy-all-assets`,`Copy entire assets/ directory into output`,!1).optionsGroup(`Path & Routing Options:`).option(`--origin <url>`,`Canonical origin URL (e.g. https://user.github.io/repo/)`).option(`--base-path <path>`,`URL base path prefix (e.g. /repo/)`).option(`--out-dir <dir>`,`Output directory relative to content root`,`dist/public`).option(`--content-root <dir>`,`Content root directory`,m.cwd()).action(async e=>{try{let t=f.resolve(e.contentRoot||m.cwd()),r=!!(e.prod||e.production||m.env.NODE_ENV===`production`);console.log(`Building ShadowClaw site from ${t}...`),await n({contentRoot:t,toolchainRoot:B,outDir:e.outDir||`dist/public`,isProduction:r,pagesOrigin:e.origin||m.env.PAGES_ORIGIN,basePath:e.basePath||m.env.PAGES_BASE_PATH,prerenderPages:e.prerenderPages,copyAllAssets:e.copyAllAssets})}catch(e){console.error(`Build failed:`,e),m.exit(1)}});async function Z(e,t){try{let r=f.resolve(t.contentRoot||m.cwd()),i=parseInt(e||t.port||m.env.PORT||`8888`,10),a=t.host||t.ip||m.env.SHADOWCLAW_DEV_IP||`127.0.0.1`,o=t.outDir||`dist/public`,s=f.resolve(r,o),c=await u({contentRoot:r,cacheDir:t.cacheDir,databaseDir:t.databaseDir,tmp:t.tmp||t.temp,yes:t.yes}),l=c.cacheDir,d=c.databaseDir;console.log(`Preparing ShadowClaw dev build for ${r}...`),await n({contentRoot:r,toolchainRoot:B,outDir:o,isProduction:!1,pagesOrigin:t.origin||m.env.PAGES_ORIGIN,basePath:t.basePath||m.env.PAGES_BASE_PATH,prerenderPages:t.prerenderPages||`auto`,copyAllAssets:t.copyAllAssets});let p=await K(f.join(B,`dist/server.js`))?f.join(B,`dist/server.js`):f.join(B,`src/server/server.ts`);m.env.SHADOWCLAW_ROOT_PATH=s,m.env.SHADOWCLAW_CACHE_DIR=l,m.env.SHADOWCLAW_DATABASE_DIR=d,m.env.SHADOWCLAW_DEV_IP=a;let{startServer:h}=await import(p),g=new Set((t.corsAllowOrigin||m.env.SHADOWCLAW_CORS_ALLOWED_ORIGINS||`https://xt-ml.github.io`).split(`,`).map(e=>e.trim()).filter(Boolean)),_=!!(t.https||[`1`,`true`,`yes`].includes((m.env.SHADOWCLAW_HTTPS||``).toLowerCase().trim())),v=t.cert||(m.env.SHADOWCLAW_TLS_CERT||m.env.SHADOWCLAW_CERT||``).trim()||void 0,y=t.key||(m.env.SHADOWCLAW_TLS_KEY||m.env.SHADOWCLAW_KEY||``).trim()||void 0,b=f.resolve(r,t.sslDir||m.env.SHADOWCLAW_SSL_DIR||m.env.SHADOWCLAW_TLS_DIR||f.join(l,`tls`));await h({port:i,bindHost:a,corsMode:t.corsMode||`localhost`,allowedOrigins:g,verbose:!!t.verbose,peerjs:!!t.peerjs,a2aEnabled:q(t),rootPath:s,cacheDir:l,databaseDir:d,allowPrivateProxy:!!t.allowPrivateProxy,https:_,certPath:v,keyPath:y,sslDir:b});let x=`${_?`https`:`http`}://${a}:${i}`;t.open&&J(x)}catch(e){console.error(`Dev server error:`,e),m.exit(1)}}X.command(`dev [port]`).description(`Build and launch the development server`).optionsGroup(`Server & Network Options:`).option(`-p, --port <port>`,`Port to listen on (default: 8888)`).option(`--host <host>`,`Bind host/IP`,`127.0.0.1`).option(`--ip <host>`,`Bind host/IP (alias)`).option(`--open`,`Automatically open default browser`,!1).option(`-v, --verbose`,`Enable verbose request/proxy logging`,!1).optionsGroup(`Site & Build Options:`).option(`--content-root <dir>`,`Content root directory`,m.cwd()).option(`--out-dir <dir>`,`Output directory relative to content root`,`dist/public`).optionsGroup(`Security & Proxy Options:`).option(`--cors-mode <mode>`,`CORS policy: localhost | private | all`,`localhost`).option(`--allow-private-proxy`,`Allow proxy to reach private/loopback addresses`,!1).option(`--peerjs`,`Enable built-in PeerJS signaling server`,!1).option(`--a2a`,`Enable A2A v1.0 agent card, JSON-RPC, and SSE endpoints`,!1).optionsGroup(`TLS / HTTPS Options:`).option(`--https`,`Enable HTTPS dev server`,!1).option(`--cert <path>`,`Path to existing TLS certificate file`).option(`--key <path>`,`Path to existing TLS private key file`).option(`--ssl-dir <path>`,`Directory for TLS certificate generation/storage`).optionsGroup(`Storage & Database Options:`).option(`--database-dir <dir>`,`Directory where SQLite databases are stored`).option(`--cache-dir <dir>`,`Custom cache directory for databases, tokens, and logs`).option(`--tmp, --temp`,`Store cache and databases in system temporary directory`,!1).option(`-y, --yes`,`Skip interactive cache directory prompt and use default .cache`,!1).action(Z),X.command(`run [port]`).description(`Alias for dev: build and launch the development server`).optionsGroup(`Server & Network Options:`).option(`-p, --port <port>`,`Port to listen on (default: 8888)`).option(`--host <host>`,`Bind host/IP`,`127.0.0.1`).option(`--ip <host>`,`Bind host/IP (alias)`).option(`--open`,`Automatically open default browser`,!1).option(`-v, --verbose`,`Enable verbose request/proxy logging`,!1).optionsGroup(`Site & Build Options:`).option(`--content-root <dir>`,`Content root directory`,m.cwd()).option(`--out-dir <dir>`,`Output directory relative to content root`,`dist/public`).optionsGroup(`Security & Proxy Options:`).option(`--cors-mode <mode>`,`CORS policy: localhost | private | all`,`localhost`).option(`--allow-private-proxy`,`Allow proxy to reach private/loopback addresses`,!1).option(`--peerjs`,`Enable built-in PeerJS signaling server`,!1).option(`--a2a`,`Enable A2A v1.0 agent card, JSON-RPC, and SSE endpoints`,!1).optionsGroup(`TLS / HTTPS Options:`).option(`--https`,`Enable HTTPS dev server`,!1).option(`--cert <path>`,`Path to existing TLS certificate file`).option(`--key <path>`,`Path to existing TLS private key file`).option(`--ssl-dir <path>`,`Directory for TLS certificate generation/storage`).optionsGroup(`Storage & Database Options:`).option(`--database-dir <dir>`,`Directory where SQLite databases are stored`).option(`--cache-dir <dir>`,`Custom cache directory for databases, tokens, and logs`).option(`--tmp, --temp`,`Store cache and databases in system temporary directory`,!1).option(`-y, --yes`,`Skip interactive cache directory prompt and use default .cache`,!1).action(Z),X.commandsGroup(`Server:`),X.command(`serve [port]`).description(`Serve static files and start backend services (optional: --peerjs, --a2a)`).optionsGroup(`Server & Network Options:`).option(`-p, --port <port>`,`Port to listen on (default: 8888)`).option(`--host <host>`,`Bind host/IP`,`127.0.0.1`).option(`--no-static`,`Disable static file and UI serving (services-only mode)`).option(`--open`,`Automatically open default browser`,!1).option(`-v, --verbose`,`Enable verbose request/proxy logging`,!1).optionsGroup(`Site Options:`).option(`--content-root <dir>`,`Content root directory`,m.cwd()).option(`--out-dir <dir>`,`Output directory relative to content root`,`dist/public`).optionsGroup(`Security & Proxy Options:`).option(`--cors-mode <mode>`,`CORS policy: localhost | private | all`,`localhost`).option(`--allow-private-proxy`,`Allow proxy to reach private/loopback addresses`,!1).option(`--peerjs`,`Enable built-in PeerJS signaling server`,!1).option(`--a2a`,`Enable A2A v1.0 agent card, JSON-RPC, and SSE endpoints`,!1).optionsGroup(`TLS / HTTPS Options:`).option(`--https`,`Enable HTTPS dev server`,!1).option(`--cert <path>`,`Path to existing TLS certificate file`).option(`--key <path>`,`Path to existing TLS private key file`).option(`--ssl-dir <path>`,`Directory for TLS certificate generation/storage`).optionsGroup(`Storage & Database Options:`).option(`--database-dir <dir>`,`Directory where SQLite databases are stored`).option(`--cache-dir <dir>`,`Custom cache directory for databases, tokens, and logs`).option(`--tmp, --temp`,`Store cache and databases in system temporary directory`,!1).option(`-y, --yes`,`Skip interactive cache directory prompt and use default .cache`,!1).action(async(e,t)=>{try{let n=f.resolve(t.contentRoot||m.cwd()),r=parseInt(e||t.port||m.env.PORT||`8888`,10),i=t.host||t.ip||m.env.SHADOWCLAW_DEV_IP||`127.0.0.1`,a=t.outDir||`dist/public`,o=f.resolve(n,a),s=await u({contentRoot:n,cacheDir:t.cacheDir,databaseDir:t.databaseDir,tmp:t.tmp||t.temp,yes:t.yes}),c=s.cacheDir,l=s.databaseDir,d=t.static!==!1;d&&!await K(f.join(o,`index.html`))&&(console.error(`Error: No index.html found in ${o}. Run "shadow-claw build" first.`),m.exit(1));let p=await K(f.join(B,`dist/server.js`))?f.join(B,`dist/server.js`):f.join(B,`src/server/server.ts`);m.env.SHADOWCLAW_ROOT_PATH=o,m.env.SHADOWCLAW_CACHE_DIR=c,m.env.SHADOWCLAW_DATABASE_DIR=l,m.env.SHADOWCLAW_DEV_IP=i;let{startServer:h}=await import(p),g=new Set((t.corsAllowOrigin||m.env.SHADOWCLAW_CORS_ALLOWED_ORIGINS||`https://xt-ml.github.io`).split(`,`).map(e=>e.trim()).filter(Boolean)),_=!!(t.https||[`1`,`true`,`yes`].includes((m.env.SHADOWCLAW_HTTPS||``).toLowerCase().trim())),v=t.cert||(m.env.SHADOWCLAW_TLS_CERT||m.env.SHADOWCLAW_CERT||``).trim()||void 0,y=t.key||(m.env.SHADOWCLAW_TLS_KEY||m.env.SHADOWCLAW_KEY||``).trim()||void 0,b=f.resolve(n,t.sslDir||m.env.SHADOWCLAW_SSL_DIR||m.env.SHADOWCLAW_TLS_DIR||f.join(c,`tls`));await h({port:r,bindHost:i,corsMode:t.corsMode||`localhost`,allowedOrigins:g,verbose:!!t.verbose,peerjs:!!t.peerjs,a2aEnabled:q(t),rootPath:o,cacheDir:c,databaseDir:l,allowPrivateProxy:!!t.allowPrivateProxy,https:_,certPath:v,keyPath:y,sslDir:b,serveStatic:d});let x=`${_?`https`:`http`}://${i}:${r}`;d&&t.open&&J(x)}catch(e){console.error(`Serve error:`,e),m.exit(1)}});async function Q(e,t){try{let n=f.resolve(t.contentRoot||m.cwd()),r=parseInt(e||t.port||m.env.PORT||`8888`,10),i=t.host||t.ip||m.env.SHADOWCLAW_DEV_IP||`127.0.0.1`,a=await u({contentRoot:n,cacheDir:t.cacheDir,databaseDir:t.databaseDir,tmp:t.tmp||t.temp,yes:t.yes}),o=a.cacheDir,s=a.databaseDir,c=await K(f.join(B,`dist/server.js`))?f.join(B,`dist/server.js`):f.join(B,`src/server/server.ts`);m.env.SHADOWCLAW_CACHE_DIR=o,m.env.SHADOWCLAW_DATABASE_DIR=s,m.env.SHADOWCLAW_DEV_IP=i,m.env.SHADOWCLAW_SERVE_STATIC=`false`;let{startServer:l}=await import(c),d=new Set((t.corsAllowOrigin||m.env.SHADOWCLAW_CORS_ALLOWED_ORIGINS||`https://xt-ml.github.io`).split(`,`).map(e=>e.trim()).filter(Boolean)),p=!!(t.https||[`1`,`true`,`yes`].includes((m.env.SHADOWCLAW_HTTPS||``).toLowerCase().trim())),h=t.cert||(m.env.SHADOWCLAW_TLS_CERT||m.env.SHADOWCLAW_CERT||``).trim()||void 0,g=t.key||(m.env.SHADOWCLAW_TLS_KEY||m.env.SHADOWCLAW_KEY||``).trim()||void 0,_=f.resolve(n,t.sslDir||m.env.SHADOWCLAW_SSL_DIR||m.env.SHADOWCLAW_TLS_DIR||f.join(o,`tls`));await l({port:r,bindHost:i,corsMode:t.corsMode||`localhost`,allowedOrigins:d,verbose:!!t.verbose,peerjs:!!t.peerjs,a2aEnabled:q(t),rootPath:``,cacheDir:o,databaseDir:s,controlToken:t.controlToken||m.env.SHADOWCLAW_CONTROL_TOKEN||void 0,allowPrivateProxy:!!t.allowPrivateProxy,https:p,certPath:h,keyPath:g,sslDir:_,serveStatic:!1})}catch(e){console.error(`Server error:`,e),m.exit(1)}}X.command(`server [port]`).aliases([`services`,`api`]).description(`Start backend services (HTTP MCP, control plane, scheduler, and proxy) without serving static files (optional: --peerjs, --a2a; aliases: services, api)`).optionsGroup(`Server & Network Options:`).option(`-p, --port <port>`,`Port to listen on (default: 8888)`).option(`--host <host>`,`Bind host/IP`,`127.0.0.1`).option(`--ip <host>`,`Bind host/IP (alias)`).option(`-v, --verbose`,`Enable verbose request/proxy logging`,!1).optionsGroup(`Security & Proxy Options:`).option(`--cors-mode <mode>`,`CORS policy: localhost | private | all`,`localhost`).option(`--cors-allow-origin <origin>`,`Explicit allowed origins (comma-separated)`).option(`--control-token <token>`,`Secret token for control-plane authentication`).option(`--peerjs`,`Enable built-in PeerJS signaling server`,!1).option(`--a2a`,`Enable A2A v1.0 agent card, JSON-RPC, and SSE endpoints`,!1).option(`--allow-private-proxy`,`Allow proxy to reach private/loopback addresses`,!1).optionsGroup(`TLS / HTTPS Options:`).option(`--https`,`Enable HTTPS server`,!1).option(`--cert <path>`,`Path to existing TLS certificate file`).option(`--key <path>`,`Path to existing TLS private key file`).option(`--ssl-dir <path>`,`Directory for TLS certificate generation/storage`).optionsGroup(`Storage & Database Options:`).option(`--content-root <dir>`,`Content root directory`,m.cwd()).option(`--database-dir <dir>`,`Directory where SQLite databases are stored`).option(`--cache-dir <dir>`,`Custom cache directory for databases, tokens, and logs`).option(`--tmp, --temp`,`Store cache and databases in system temporary directory`,!1).option(`-y, --yes`,`Skip interactive cache directory prompt and use default .cache`,!1).action(Q),X.command(`mcp`).description(`Start the standalone MCP server only (does not start backend services, PeerJS, or A2A)`).optionsGroup(`MCP Protocol Options:`).option(`--mcp-transport <transport>`,`MCP transport: stdio | http`,`stdio`).option(`--relay-client-tools`,`Discover and relay tools from connected browser clients`,!0).option(`--no-relay-client-tools`,`Disable relaying browser client tools`).optionsGroup(`Target Client Options:`).option(`--client <id>`,`Target client ID (defaults to first active client)`).optionsGroup(`Control Plane Connection Options:`).option(`--host <host>`,`Control plane host`).option(`--port <port>`,`Control plane port or HTTP MCP port`).option(`--token <token>`,`Control token`).option(`--https`,`Connect to server via HTTPS`,!1).option(`-k, --insecure`,`Allow self-signed TLS certificates`,!0).optionsGroup(`Transport & Peer Options:`).option(`--transport <transport>`,`Control plane client transport: http | webrtc`,`http`).option(`--peer-id <id>`,`Custom WebRTC CLI peer ID`).option(`--cache-dir <dir>`,`Custom cache directory for control token and databases`).action(async e=>{await z(e)}),X.commandsGroup(`Control Plane & Client Bridge:`),X.command(`clients`).description(`List connected / registered browser and Electron clients`).optionsGroup(`Control Plane Connection Options:`).option(`--host <host>`,`Control plane host`).option(`--port <port>`,`Control plane port`).option(`--token <token>`,`Control token`).option(`--https`,`Connect to server via HTTPS`,!1).option(`-k, --insecure`,`Allow self-signed TLS certificates`,!0).optionsGroup(`Transport & Peer Options:`).option(`--transport <transport>`,`Transport to use: http | webrtc`,`http`).option(`--peer-id <id>`,`Custom WebRTC CLI peer ID`).option(`--renew-peer-id`,`Renew WebRTC CLI peer ID before connecting`,!1).option(`--cache-dir <dir>`,`Custom cache directory`).action(async e=>{await w(e)}),X.command(`send <message>`).description(`Send a message/prompt to a connected client or peer agent`).optionsGroup(`Target Options:`).option(`--client <id>`,`Target client ID (defaults to first available)`).option(`--group <groupId>`,`Target conversation group ID`).option(`-f, --file <path>`,`Attach a local file to send with the message`).optionsGroup(`Control Plane Connection Options:`).option(`--host <host>`,`Control plane host`).option(`--port <port>`,`Control plane port`).option(`--token <token>`,`Control token`).option(`--https`,`Connect to server via HTTPS`,!1).option(`-k, --insecure`,`Allow self-signed TLS certificates`,!0).optionsGroup(`Transport & Peer Options:`).option(`--transport <transport>`,`Transport to use: http | webrtc`,`http`).option(`--peer-id <id>`,`Custom WebRTC CLI peer ID`).option(`--renew-peer-id`,`Renew WebRTC CLI peer ID before sending`,!1).option(`--cache-dir <dir>`,`Custom cache directory`).option(`--timeout <seconds>`,`Timeout in seconds to wait for response`,`120`).option(`--json`,`Output response payload as JSON`,!1).action(async(e,t)=>{await T(e,t)}),X.command(`send-file <file>`).description(`Transfer a file to a connected peer or client over WebRTC or HTTP`).optionsGroup(`Target Options:`).option(`--client <id>`,`Target client ID (defaults to first available)`).option(`--prompt <prompt>`,`Accompanying prompt or instructions for the receiving agent`).option(`--name <fileName>`,`Override remote file name`).option(`--group <groupId>`,`Target conversation group ID`).optionsGroup(`Control Plane Connection Options:`).option(`--host <host>`,`Control plane host`).option(`--port <port>`,`Control plane port`).option(`--token <token>`,`Control token`).option(`--https`,`Connect to server via HTTPS`,!1).option(`-k, --insecure`,`Allow self-signed TLS certificates`,!0).optionsGroup(`Transport & Peer Options:`).option(`--transport <transport>`,`Transport to use: http | webrtc`,`webrtc`).option(`--peer-id <id>`,`Custom WebRTC CLI peer ID`).option(`--renew-peer-id`,`Renew WebRTC CLI peer ID before sending`,!1).option(`--cache-dir <dir>`,`Custom cache directory`).option(`--timeout <seconds>`,`Transfer and execution timeout in seconds`,`120`).option(`--json`,`Output response payload as JSON`,!1).action(async(e,t)=>{await E(e,t)}),X.command(`tasks`).description(`List scheduled tasks on a connected client`).optionsGroup(`Target Options:`).option(`--client <id>`,`Target client ID`).option(`--group <groupId>`,`Filter tasks by conversation group ID`).optionsGroup(`Control Plane Connection Options:`).option(`--host <host>`,`Control plane host`).option(`--port <port>`,`Control plane port`).option(`--token <token>`,`Control token`).option(`--https`,`Connect to server via HTTPS`,!1).option(`-k, --insecure`,`Allow self-signed TLS certificates`,!0).optionsGroup(`Transport & Peer Options:`).option(`--transport <transport>`,`Transport to use: http | webrtc`,`http`).option(`--peer-id <id>`,`Custom WebRTC CLI peer ID`).option(`--renew-peer-id`,`Renew WebRTC CLI peer ID before connecting`,!1).option(`--cache-dir <dir>`,`Custom cache directory`).action(async e=>{await O(e)}),X.command(`backup [action]`).description(`Trigger or manage client workspace backups (trigger | list | delete)`).optionsGroup(`Target Options:`).option(`--client <id>`,`Client ID`).option(`--backup-id <id>`,`Backup ID (for delete)`).option(`--group <groupId>`,`Specific workspace group ID`).optionsGroup(`Control Plane Connection Options:`).option(`--host <host>`,`Control plane host`).option(`--port <port>`,`Control plane port`).option(`--token <token>`,`Control token`).option(`--https`,`Connect to server via HTTPS`,!1).option(`-k, --insecure`,`Allow self-signed TLS certificates`,!0).optionsGroup(`Transport & Peer Options:`).option(`--transport <transport>`,`Transport to use: http | webrtc`,`http`).option(`--peer-id <id>`,`Custom WebRTC CLI peer ID`).option(`--renew-peer-id`,`Renew WebRTC CLI peer ID before connecting`,!1).option(`--cache-dir <dir>`,`Custom cache directory`).action(async(e,t)=>{await D(e||`trigger`,t)}),X.commandsGroup(`WebRTC:`),X.command(`webrtc [action] [customId]`).summary(`Manage WebRTC CLI configuration and peer identity (.cache/cli-peer-id)`).description(`Manage WebRTC CLI configuration and peer identity (.cache/cli-peer-id)
|
|
5
5
|
|
|
6
6
|
Actions:
|
|
7
7
|
(default) Show or generate the CLI peer ID
|
|
8
8
|
listen Register as a live PeerJS peer — browser tabs can then
|
|
9
|
-
connect directly without a control-plane connection`).optionsGroup(`Identity Options:`).option(`-r, --renew`,`Force renewal / generation of a new WebRTC CLI peer ID`).option(`--set <id>`,`Set a specific custom WebRTC CLI peer ID`).option(`--cache-dir <dir>`,`Custom cache directory (defaults to .cache)`).option(`-q, --quiet`,`Output only the peer ID string`).option(`--json`,`Output peer ID and file path as JSON`).optionsGroup(`Signaling & Listener Options (for listen action):`).option(`--host <host>`,`PeerJS signaling server host (for listen)`).option(`--port <port>`,`PeerJS signaling server port (for listen)`,`8888`).option(`--path <path>`,`PeerJS signaling server path (for listen)`,`/`).option(`--secure`,`Use TLS (wss://) for the signaling server (for listen)`,!1).option(`--https`,`Alias for --secure: use TLS (wss://) for the signaling server`,!1).option(`--trusted-peer <id>`,`Accept connections only from this peer ID (repeatable, for listen)`,(e,t)=>t?[...t,e]:[e],[]).option(`--verbose`,`Verbose connection logging (for listen)`,!1).option(`--renew-peer-id`,`Renew CLI peer ID before listening`,!1).option(`-k, --insecure`,`Allow self-signed TLS certificates for the signaling server (wss://)`,!0).optionsGroup(`Agent & Orchestration Options (for listen action):`).option(`--agent`,`Enable agent orchestration loop for incoming prompts (default: true)`,!0).option(`--no-agent`,`Disable agent orchestration loop for incoming prompts`).option(`--model <model>`,`Model name for the listening agent`).option(`--provider <provider>`,`LLM provider ID for the listening agent`).option(`--api-key <key>`,`API key for the listening agent`).option(`--system-prompt <text>`,`Override system prompt for the listening agent`).option(`--system-prompt-file <file>`,`Load system prompt from file for the listening agent`).option(`--tools <tools>`,`Comma-separated list of tools to enable for the listening agent`).option(`--workspace <dir>`,`Workspace directory for the listening agent`).option(`--transfers-dir <dir>`,`Directory to store received files`).option(`--allow-internet`,`Allow internet access for bash and javascript tools`).action(async(e,t,n)=>{if(e===`listen`){await c(n);return}let r={...n};t&&!r.set&&(r.set=t),await k(e,r)}),
|
|
9
|
+
connect directly without a control-plane connection`).optionsGroup(`Identity Options:`).option(`-r, --renew`,`Force renewal / generation of a new WebRTC CLI peer ID`).option(`--set <id>`,`Set a specific custom WebRTC CLI peer ID`).option(`--cache-dir <dir>`,`Custom cache directory (defaults to .cache)`).option(`-q, --quiet`,`Output only the peer ID string`).option(`--json`,`Output peer ID and file path as JSON`).optionsGroup(`Signaling & Listener Options (for listen action):`).option(`--host <host>`,`PeerJS signaling server host (for listen)`).option(`--port <port>`,`PeerJS signaling server port (for listen)`,`8888`).option(`--path <path>`,`PeerJS signaling server path (for listen)`,`/`).option(`--secure`,`Use TLS (wss://) for the signaling server (for listen)`,!1).option(`--https`,`Alias for --secure: use TLS (wss://) for the signaling server`,!1).option(`--trusted-peer <id>`,`Accept connections only from this peer ID (repeatable, for listen)`,(e,t)=>t?[...t,e]:[e],[]).option(`--verbose`,`Verbose connection logging (for listen)`,!1).option(`--renew-peer-id`,`Renew CLI peer ID before listening`,!1).option(`-k, --insecure`,`Allow self-signed TLS certificates for the signaling server (wss://)`,!0).optionsGroup(`Agent & Orchestration Options (for listen action):`).option(`--agent`,`Enable agent orchestration loop for incoming prompts (default: true)`,!0).option(`--no-agent`,`Disable agent orchestration loop for incoming prompts`).option(`--model <model>`,`Model name for the listening agent`).option(`--provider <provider>`,`LLM provider ID for the listening agent`).option(`--api-key <key>`,`API key for the listening agent`).option(`--system-prompt <text>`,`Override system prompt for the listening agent`).option(`--system-prompt-file <file>`,`Load system prompt from file for the listening agent`).option(`--tools <tools>`,`Comma-separated list of tools to enable for the listening agent`).option(`--workspace <dir>`,`Workspace directory for the listening agent`).option(`--transfers-dir <dir>`,`Directory to store received files`).option(`--allow-internet`,`Allow internet access for bash and javascript tools`).action(async(e,t,n)=>{if(e===`listen`){await c(n);return}let r={...n};t&&!r.set&&(r.set=t),await k(e,r)}),X.command(`peer-id [action] [customId]`).alias(`webrtc-peer-id`).description(`Get, generate, or renew the WebRTC CLI peer ID stored in .cache/cli-peer-id`).optionsGroup(`Identity Options:`).option(`-r, --renew`,`Force renewal / generation of a new WebRTC CLI peer ID`).option(`--set <id>`,`Set a specific custom WebRTC CLI peer ID`).option(`--cache-dir <dir>`,`Custom cache directory (defaults to .cache)`).option(`-q, --quiet`,`Output only the peer ID string`).option(`--json`,`Output peer ID and file path as JSON`).action(async(e,t,n)=>{let r={...n};t&&!r.set&&(r.set=t),await k(e,r)}),X.commandsGroup(`Project:`),X.command(`init [dir]`).description(`Initialize a new ShadowClaw content template in the specified directory`).action(async e=>{try{let t=f.resolve(e||m.cwd());await g(f.join(t,`pages/main`),{recursive:!0});let n=f.join(t,`shadow-claw-config.json`),r=f.join(t,`shadow-claw.config.json`),i=f.join(t,`site-config.json`);!await K(n)&&!await K(r)&&!await K(i)&&(await y(n,JSON.stringify({$schema:`https://json-schema.org/draft/2020-12/schema`,site:{title:`My ShadowClaw Site`,description:`Personal AI assistant and knowledge hub powered by ShadowClaw.`},branding:{titleText:`My ShadowClaw Site`},pages:{sortOrder:`asc`,defaultPinnedPage:`/pages/main/index.html`}},null,2)+`
|
|
10
10
|
`,`utf8`),console.log(`Created ${n}`));let a=f.join(t,`pages/main/index.html`);await K(a)||(await y(a,`---
|
|
11
11
|
title: "Welcome to ShadowClaw"
|
|
12
12
|
created: "${new Date().toISOString()}"
|
|
@@ -22,4 +22,4 @@ slug: "home"
|
|
|
22
22
|
.cache/
|
|
23
23
|
node_modules/
|
|
24
24
|
`,`utf8`),console.log(`Created ${o}`)),console.log(`\nShadowClaw template successfully initialized in ${t}`),console.log(`To start developing, run:`),console.log(` npx shadow-claw dev
|
|
25
|
-
`)}catch(e){console.error(`Init failed:`,e),m.exit(1)}}),
|
|
25
|
+
`)}catch(e){console.error(`Init failed:`,e),m.exit(1)}}),X.command(`skills:index [dir]`).alias(`agent-skills`).description(`Generate or update .well-known/agent-skills/index.json per the Agent Skills Discovery RFC`).optionsGroup(`Output & Path Options:`).option(`--out-dir <dir>`,`Output directory relative to content root (default: .well-known/agent-skills)`).option(`--out-file <file>`,`Explicit destination path for index.json`).option(`--metadata-root <dir>`,`Directory to read site metadata from (default: content root)`).option(`--config <file>`,`Explicit path to shadow-claw.config.json or site-config.json`).optionsGroup(`Generation Options:`).option(`--bundled`,`Include and materialize bundled ShadowClaw skills in index and .agents/skills`,!1).option(`--no-bundled`,`Exclude bundled ShadowClaw skills from index`).option(`--stdout`,`Print generated index.json to stdout`,!1).option(`--no-write`,`Skip writing file to disk`).action(async(e,t)=>{try{await l(e,t)}catch(e){console.error(`Failed to generate skills index:`,e),m.exit(1)}}),X.commandsGroup(`Headless Agent:`),X.command(`agent [action] [args...]`).description(`Run the headless CLI agent (init | model | skills | tools | tool | skill | import | run | listen)`).optionsGroup(`Agent Options:`).option(`--workspace <dir>`,`Workspace directory (default: .cache)`).option(`--database-dir <dir>`,`Directory where SQLite databases are stored`).option(`--cache-dir <dir>`,`Custom cache directory for databases and logs`).option(`--tmp, --temp`,`Store cache, token, and databases in OS temporary directory`).option(`-y, --yes`,`Skip interactive cache directory prompt and accept defaults`).option(`--group <groupId>`,`Conversation group ID`,`server:main`).option(`--provider <provider>`,`LLM provider ID`).option(`--model <model>`,`Model name`).option(`--download`,`Prewarm and download the model during agent init or execution`,!1).option(`--api-key <key>`,`API key`).option(`-v, --verbose`,`Enable verbose execution logging`,!1).option(`--allow-internet, --internet-access`,`Allow full internet access for Bash and JavaScript tools (sets vm_bash_full_internet_access)`).option(`-o, --output <file>`,`Write command output to a file instead of stdout`).option(`--stream`,`Stream response tokens to stdout as they arrive (default: true)`,!0).option(`--no-stream`,`Disable streaming response tokens to stdout`).option(`--progress`,`Show progress bar during model downloads (default: true)`,!0).option(`--no-progress`,`Disable download progress bar`).option(`--system-prompt <text>`,`Override system prompt with inline text`).option(`--system-prompt-file <file>`,`Load system prompt from a text or markdown file`).option(`--tools <tools>`,`Comma-separated list of tools to enable or import (e.g. bash,read_file)`).option(`--skills <skills>`,`Comma-separated list of skills to filter or import`).option(`--scripts <scripts>`,`Comma-separated list of scripts to import`).option(`--all`,`Import all tools, skills, and scripts from discovery manifest`,!1).option(`--overwrite`,`Overwrite existing skills, tools, or scripts during import`,!1).option(`--auto-enable`,`Automatically enable imported declarative tools (default: true)`,!0).option(`--no-auto-enable`,`Do not automatically enable imported declarative tools`).option(`--tools-profile <name>`,`Tools profile to activate (e.g. __builtin_default)`).option(`-r, --remote`,`List or search available models from Hugging Face onnx-community repository`,!1).option(`--huggingface, --hf`,`Alias for --remote to query Hugging Face`,!1).option(`--query <query>`,`Filter models by search query`).option(`-q, --quiet`,`Suppress all non-error output`,!1).action(async(e,n,r)=>{await t(e,n,r)}),X.commandsGroup(`Help & Utility:`),X.helpCommand(`help [command]`,`display help for command`);async function $(e=m.argv){await X.parseAsync(e)}export{$ as main,X as program,H as registerTerminationCleanup};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://modelcontextprotocol.io/schemas/server-card/v1.json",
|
|
3
3
|
"name": "shadow-claw",
|
|
4
|
-
"version": "1.39.
|
|
4
|
+
"version": "1.39.2",
|
|
5
5
|
"description": "Browser-native personal AI assistant with local and remote LLM orchestration, Web Workers, OPFS storage, and agentic tool execution.",
|
|
6
6
|
"title": "ShadowClaw MCP Server",
|
|
7
7
|
"websiteUrl": "https://xt-ml.github.io/shadow-claw/",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://modelcontextprotocol.io/schemas/server-card/v1.json",
|
|
3
3
|
"name": "shadow-claw",
|
|
4
|
-
"version": "1.39.
|
|
4
|
+
"version": "1.39.2",
|
|
5
5
|
"description": "Browser-native personal AI assistant with local and remote LLM orchestration, Web Workers, OPFS storage, and agentic tool execution.",
|
|
6
6
|
"title": "ShadowClaw MCP Server",
|
|
7
7
|
"websiteUrl": "https://xt-ml.github.io/shadow-claw/",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<!doctype html><html lang="en"><head><title>ShadowClaw</title><meta charset="utf-8"><meta name="revision" content="
|
|
1
|
+
<!doctype html><html lang="en"><head><title>ShadowClaw</title><meta charset="utf-8"><meta name="revision" content="337adfbfa6c9e2ef3b393b3071769156976e8177" /><meta name="version" content="1.39.2" /><meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover"><meta name="description" content="ShadowClaw - multi-runtime AI assistant." /><link rel="canonical" href="https://xt-ml.github.io/shadow-claw/"><meta property="og:title" content="ShadowClaw"><meta property="og:description" content="Browser-native personal AI assistant with local and remote LLM orchestration, Web Workers, OPFS storage, and agentic tool execution."><meta property="og:type" content="website"><meta property="og:url" content="https://xt-ml.github.io/shadow-claw/"><meta property="og:image" content="https://xt-ml.github.io/shadow-claw/assets/icons/512.png"><meta name="twitter:card" content="summary"><meta name="twitter:title" content="ShadowClaw"><meta name="twitter:description" content="Browser-native personal AI assistant with local and remote LLM orchestration, Web Workers, OPFS storage, and agentic tool execution."><meta name="twitter:image" content="https://xt-ml.github.io/shadow-claw/assets/icons/512.png"><script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"SoftwareApplication","@id":"https://xt-ml.github.io/shadow-claw/#software","name":"ShadowClaw","description":"Browser-native personal AI assistant with local and remote LLM orchestration, Web Workers, OPFS storage, and agentic tool execution.","url":"https://xt-ml.github.io/shadow-claw/","applicationCategory":"DeveloperApplication","operatingSystem":"Web, Browser, Desktop","offers":{"@type":"Offer","price":"0","priceCurrency":"USD"},"author":{"@type":"Organization","name":"xt-ml","url":"https://github.com/xt-ml"},"codeRepository":"https://github.com/xt-ml/shadow-claw","license":"https://github.com/xt-ml/shadow-claw/blob/main/LICENSE"},{"@type":"WebSite","@id":"https://xt-ml.github.io/shadow-claw/#website","url":"https://xt-ml.github.io/shadow-claw/","name":"ShadowClaw","description":"Official website and live deployment of ShadowClaw browser-native AI assistant.","publisher":{"@type":"Organization","name":"xt-ml","url":"https://github.com/xt-ml"}},{"@type":"Organization","@id":"https://xt-ml.github.io/shadow-claw/#organization","name":"xt-ml","url":"https://github.com/xt-ml","sameAs":["https://github.com/xt-ml"]}]}</script><meta name="theme-color" content="#fff" /><meta http-equiv="origin-trial" content="A88uTgESYWcVgREKVReKB6jom41uP8TzW6ei3jNdidf+Xl6ONqKRjKNBphsxhrZmdkakLK3oXDgkGq53rtZYSAMAAAB2eyJvcmlnaW4iOiJodHRwczovL3h0LW1sLmdpdGh1Yi5pbzo0NDMiLCJmZWF0dXJlIjoiV2ViTUNQIiwiZXhwaXJ5IjoxNzk0ODczNjAwLCJpc1N1YmRvbWFpbiI6dHJ1ZSwiaXNUaGlyZFBhcnR5Ijp0cnVlfQ=="><base href="/shadow-claw/" /><script id="shadow-claw-site-config" type="application/json">{"$schema":"https:\u002f\u002fjson-schema.org\u002fdraft\u002f2020-12\u002fschema","site":{"title":"ShadowClaw","description":"ShadowClaw - multi-runtime AI assistant.","themeColor":"#fff"},"branding":{"faviconPath":"assets\u002ficons\u002ffavicon.ico","appleTouchIconPath":"assets\u002ficons\u002f180.png","notFoundPath":"404.html"},"pwa":{"manifestPath":"manifest.json","themeColor":"#000000"},"sitemapPath":"sitemap.xml","assets":["assets"],"sidebar":{"pagesHidden":false,"chatHidden":false,"tasksHidden":false,"filesHidden":false,"defaultPage":"pages"},"settings":{"defaultToolsProfile":"__builtin_default"},"agent":{"defaultProvider":"transformers_js_local","defaultModel":"onnx-community\u002fgemma-3-1b-it-ONNX-GQA"},"customElements":{"allowedElements":["block-garden","block-garden-option","block-garden-select"],"allowedDomains":["kherrick.github.io","cdn.jsdelivr.net"]},"security":{"connectSrc":["'self'","blob:","data:","https:\u002f\u002fkherrick.github.io","https:\u002f\u002fcdn.jsdelivr.net"]}}</script>
|
|
2
2
|
<script>var ShadowClawThemeInit=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports);function n(){if(globalThis.trustedTypes)return;let e=new Map;globalThis.trustedTypes={createPolicy:(t,n)=>{if(e.has(t))throw TypeError(`Policy with name "${t}" already exists.`);let r={createHTML:n.createHTML?e=>n.createHTML(e):void 0,createScriptURL:n.createScriptURL?e=>n.createScriptURL(e):void 0,createScript:n.createScript?e=>n.createScript(e):void 0};return e.set(t,r),r},getPolicy:t=>e.get(t)??null,isHTML:e=>typeof e==`string`||e instanceof Object&&`toString`in e,isScriptURL:e=>typeof e==`string`||e instanceof Object&&`toString`in e,isScript:e=>typeof e==`string`||e instanceof Object&&`toString`in e}}let r=`__shadowClawDefaultTrustedTypesPolicyState`,i=`default`,a=`shadowclaw-sandbox`;function o(){let e=globalThis;return e[r]||(e[r]={initialized:!1,policy:null}),e[r]}function s(){let e=o();if(e.initialized)return;let t=Reflect.get(globalThis,`trustedTypes`);if(!(!t||typeof t.createPolicy!=`function`)){e.initialized=!0;try{if(typeof t.getPolicy==`function`){let n=t.getPolicy(i);if(n){e.policy=n;return}}let n=!1;if(typeof t.getPolicyNames==`function`){let e=t.getPolicyNames();Array.isArray(e)&&e.includes(i)&&(n=!0)}if(n){if(typeof t.getPolicy==`function`){let n=t.getPolicy(a);if(n){e.policy=n;return}}e.policy=t.createPolicy(a,{createHTML:e=>e,createScriptURL:e=>e});return}e.policy=t.createPolicy(i,{createHTML:e=>e,createScriptURL:e=>e})}catch{typeof t.getPolicy==`function`&&(e.policy=t.getPolicy(i)??t.getPolicy(a)??null)}}}new class{loading=!1;models=new Map;getModelInfo(e){if(!e||typeof e!=`string`)return null;let t=e.toLowerCase().trim(),n=this.models.get(t);if(n)return n;if(t.includes(`/`)){let e=t.split(`/`).pop();if(e&&this.models.has(e))return this.models.get(e)}else for(let[e,n]of this.models.entries())if(e.endsWith(`/${t}`))return n;if(t.includes(`:`)){let e=t.split(`:`)[0],n=this.getModelInfo(e);if(n)return n}return null}registerModelInfo(e,t){this.models.set(e.toLowerCase(),t)}clear(){this.models.clear()}async fetchModelInfo(e,t,n){if(e.modelsUrl){this.loading=!0;try{let r=new Headers;if(r.set(`Content-Type`,`application/json`),e.headers)for(let[t,n]of Object.entries(e.headers))r.set(t,n);if(n)for(let[e,t]of Object.entries(n))r.set(e,t);if(t&&e.apiKeyHeader){let n=e.apiKeyHeaderFormat;r.set(e.apiKeyHeader,n?n.replace(`{key}`,t):t)}let i=await fetch(e.modelsUrl,{headers:r});if(!i.ok)throw Error(`HTTP ${i.status} ${i.statusText}`);let a=await i.json(),o=Array.isArray(a.data)?a.data:Array.isArray(a.models)?a.models:[];for(let e of o){if(!e.id)continue;let t=e.context_length??e.context_window??0,n=e.max_completion_tokens||e.per_request_limits?.completion_tokens||e.top_provider?.max_completion_tokens||null,r=typeof e.supports_tools==`boolean`?e.supports_tools:typeof e.supportsTools==`boolean`?e.supportsTools:void 0,i=this.extractModalities(e,`input`),a=this.extractModalities(e,`output`),o=this.modalitiesInclude(i,`image`,`vision`),s=this.modalitiesInclude(i,`audio`,`voice`,`hearing`),c=this.modalitiesInclude(i,`video`),l=e.id===`openrouter/free`||this.supportedParametersInclude(e,`image`,`vision`,`audio`,`tool`,`structured`),u=this.extractReasoning(e),d=typeof e.supports_prompt_caching==`boolean`?e.supports_prompt_caching:typeof e.supportsPromptCaching==`boolean`?e.supportsPromptCaching:this.supportedParametersInclude(e,`cache_control`,`prompt_caching`)?!0:void 0;!t&&Array.isArray(e.providers)&&e.providers.length>0&&(t=e.providers[0]?.context_length||0),this.registerModelInfo(e.id,{contextWindow:t,maxOutput:n,...r!==void 0&&{supportsTools:r},...i.length>0&&{inputModalities:i},...a.length>0&&{outputModalities:a},...o!==void 0&&{supportsImageInput:o},...s!==void 0&&{supportsAudioInput:s},...c!==void 0&&{supportsVideoInput:c},...u&&{reasoning:u},...l&&{routesByRequestFeatures:l},...d!==void 0&&{supportsPromptCaching:d}})}o.length>0&&console.log(`[ModelRegistry] Registered ${o.length} models for provider "${e.id}"`)}catch(t){console.error(`[ModelRegistry] Error fetching models for ${e.id}:`,t)}finally{this.loading=!1}}}extractModalities(e,t){let n=t===`input`?e.input_modalities||e.inputModalities:e.output_modalities||e.outputModalities,r=e.architecture||{},i=t===`input`?r.input_modalities||r.inputModalities:r.output_modalities||r.outputModalities,a=typeof r.modality==`string`?r.modality:``,o=this.parseArchitectureModality(a,t),s=[...this.normalizeStringArray(n),...this.normalizeStringArray(i),...o];return Array.from(new Set(s))}extractReasoning(e){let t=e?.reasoning;if(!t||typeof t!=`object`)return;let n=this.normalizeStringArray(t.supported_efforts),r=typeof t.default_effort==`string`?t.default_effort.toLowerCase():void 0,i=typeof t.default_enabled==`boolean`?t.default_enabled:void 0,a=typeof t.supports_max_tokens==`boolean`?t.supports_max_tokens:void 0,o=typeof t.mandatory==`boolean`?t.mandatory:void 0;if(!(n.length===0&&r===void 0&&i===void 0&&a===void 0&&o===void 0))return{...n.length>0&&{supportedEfforts:n},...r!==void 0&&{defaultEffort:r},...i!==void 0&&{defaultEnabled:i},...a!==void 0&&{supportsMaxTokens:a},...o!==void 0&&{mandatory:o}}}modalitiesInclude(e,...t){if(e.length!==0)return t.some(t=>e.some(e=>e.includes(t)))}normalizeStringArray(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`).map(e=>e.toLowerCase()):[]}parseArchitectureModality(e,t){if(!e)return[];let[n=``,r=``]=e.toLowerCase().split(`->`).map(e=>e.trim());return(t===`input`?n:r).split(/[+,/\s]+/).map(e=>e.trim()).filter(Boolean)}supportedParametersInclude(e,...t){let n=this.normalizeStringArray(e.supported_parameters||e.supportedParameters);return t.some(e=>n.some(t=>t.includes(e)))}};function c(e){return e.replace(/^\/+|\/+$/g,``)}function l(e){let t=c(e);return t.endsWith(`/index.html`)?t=t.slice(0,-11):t.endsWith(`index.html`)&&(t=t.slice(0,-10)),c(t)}function u(e){let t=c(e),n=t.split(`/`).filter(Boolean);if(n.length===0)return null;let r=n[0].toLowerCase();if(r===`pages`){if(n.length>=3){let e=n[1];return{page:`pages`,groupId:e===`main`?`br:main`:e.startsWith(`br-`)?`br:${e.slice(3)}`:e,path:n.slice(2).join(`/`)}}return{page:`pages`,groupId:`br:main`,path:n.slice(1).join(`/`)}}if(r===`files`){let e=n[1]||`main`;return{page:`files`,groupId:e===`main`?`br:main`:e.startsWith(`br-`)?`br:${e.slice(3)}`:e,path:n.slice(2).join(`/`)||void 0}}if(r===`chat`){let e=n[1]||`main`;return{page:`chat`,groupId:e===`main`?`br:main`:e.startsWith(`br-`)?`br:${e.slice(3)}`:e}}if(r===`tasks`){let e=n[1]||`main`;return{page:`tasks`,groupId:e===`main`?`br:main`:e.startsWith(`br-`)?`br:${e.slice(3)}`:e}}return r===`main`?{page:`pages`,groupId:`br:main`,path:n.slice(1).join(`/`)}:{page:`pages`,groupId:`br:main`,path:t}}function d(){if(typeof document<`u`){let e=document.getElementById(`shadow-claw-static-routing`);if(e&&e.textContent)try{let t=JSON.parse(e.textContent);if(t&&typeof t==`object`&&t.routes)return t}catch(e){console.warn(`Failed to parse embedded static routing manifest:`,e)}}return null}function f(e,t){let n=t||d();if(!n||!n.routes)return null;let r=l(e);if(!r)return null;for(let[e,t]of Object.entries(n.routes))if(!(!t||!t.prettyPath)&&l(t.prettyPath)===r)return u(e);return null}let p=null,ee=new Set([`chat`,`files`,`tasks`,`pages`,`settings`,`tools`,`channels`]);function m(){p=null}typeof globalThis<`u`&&(globalThis.__applyBasePathCacheReset=m);function h(){let e=typeof window<`u`?window:typeof self<`u`?self:globalThis;if(e&&e.__SHADOWCLAW_DEPLOY_ID__){let t=String(e.__SHADOWCLAW_DEPLOY_ID__).trim();if(t)return t.replace(/[^a-zA-Z0-9_-]/g,`-`)}let t=globalThis.process;if(t&&t.env&&t.env.SHADOWCLAW_DEPLOY_ID){let e=String(t.env.SHADOWCLAW_DEPLOY_ID).trim();if(e)return e.replace(/[^a-zA-Z0-9_-]/g,`-`)}let n=te();return!n||n===`/`?``:n.replace(/^\/+|\/+$/g,``).replace(/[^a-zA-Z0-9_-]/g,`-`)}function te(){if(p!==null)return p;if((typeof window>`u`||globalThis.WorkerGlobalScope!==void 0&&typeof self<`u`&&self instanceof globalThis.WorkerGlobalScope)&&typeof self<`u`&&self.location){let e=(self.location.pathname||`/`).split(`/`).filter(Boolean);if(e.length<=1)return p=`/`,p;let t=e[0].toLowerCase(),n=t===`service-worker.js`||t===`sw.js`||t===`manifest.json`||t===`sitemap.xml`||t===`favicon.ico`||t===`index.html`||t===`service-worker`||t===`assets`||t===`dist`||t===`public`;if(n&&e.length===2)return p=`/`,p;if(!n)return p=`/`+e[0]+`/`,p}let e=typeof window<`u`&&window.location?window.location:typeof self<`u`&&self.location?self.location:null;if(!e)return`/`;if(typeof document<`u`&&typeof document.querySelector==`function`){let t=document.querySelector(`base[href]`);if(t){let n=t.getAttribute(`href`);if(n)try{let t=new URL(n,e.origin).pathname;return t.endsWith(`/`)||(t+=`/`),p=t,p}catch{}}}let t=e.pathname||`/`;if(t===`/`)return p=`/`,p;let n=t.split(`/`).filter(Boolean),r=n.findIndex(e=>ee.has(e.toLowerCase()));return r>=0?r===0?(p=`/`,p):(p=`/`+n.slice(0,r).join(`/`)+`/`,p):f(t)?(p=`/`,p):n.length===1&&!t.includes(`.`)?(p=`/`+n[0]+`/`,p):(p=`/`,p)}function ne(e){let t=e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);return RegExp(`(^|\\s)@${t}\\b`,`i`)}ne(`ShadowClaw`);function g(){let e=h();return e?`shadowclaw-${e}`:`shadowclaw`}g();let _={github:{providerId:`github`,name:`GitHub`,aliases:[`github`,`api.github.com`],modes:[`oauth`,`token`],defaultMode:`oauth`,serviceTypes:[`http_api`,`git_remote`],authTypes:[`token`,`oauth`],tokenAuth:{token:{headerName:`Authorization`,headerPrefix:`token `},oauth:{headerName:`Authorization`,headerPrefix:`Bearer `}},oauth:{authorizeUrl:`https://github.com/login/oauth/authorize`,tokenUrl:`https://github.com/login/oauth/access_token`,defaultScopes:[`repo`,`read:user`],usePkce:!0,clientAuthMethod:`request_body`,scopeSeparator:`space`}},gitlab:{providerId:`gitlab`,name:`GitLab`,aliases:[`gitlab`,`gitlab.com`],modes:[`oauth`,`token`],defaultMode:`oauth`,serviceTypes:[`http_api`,`git_remote`],authTypes:[`token`,`oauth`],tokenAuth:{token:{headerName:`PRIVATE-TOKEN`,headerPrefix:``},oauth:{headerName:`Authorization`,headerPrefix:`Bearer `}},tokenAuthByServiceType:{git_remote:{token:{headerName:`Authorization`,headerPrefix:`Bearer `},oauth:{headerName:`Authorization`,headerPrefix:`Bearer `}}},oauth:{authorizeUrl:`https://gitlab.com/oauth/authorize`,tokenUrl:`https://gitlab.com/oauth/token`,defaultScopes:[`read_api`,`read_user`],usePkce:!0,clientAuthMethod:`request_body`,scopeSeparator:`space`}},figma:{providerId:`figma`,name:`Figma`,aliases:[`figma`,`api.figma.com`],modes:[`oauth`,`token`],defaultMode:`oauth`,serviceTypes:[`http_api`],authTypes:[`token`,`oauth`],tokenAuth:{token:{headerName:`X-Figma-Token`,headerPrefix:``},oauth:{headerName:`Authorization`,headerPrefix:`Bearer `}},oauth:{authorizeUrl:`https://www.figma.com/oauth`,tokenUrl:`https://api.figma.com/v1/oauth/token`,refreshUrl:`https://api.figma.com/v1/oauth/refresh`,defaultScopes:[],usePkce:!0,clientAuthMethod:`basic_header`,scopeSeparator:`space`}},notion:{providerId:`notion`,name:`Notion`,aliases:[`notion`,`api.notion.com`,`notion.so`],modes:[`oauth`,`token`],defaultMode:`oauth`,serviceTypes:[`http_api`],authTypes:[`token`,`oauth`],tokenAuth:{token:{headerName:`Authorization`,headerPrefix:`Bearer `},oauth:{headerName:`Authorization`,headerPrefix:`Bearer `}},oauth:{authorizeUrl:`https://api.notion.com/v1/oauth/authorize`,tokenUrl:`https://api.notion.com/v1/oauth/token`,defaultScopes:[],usePkce:!0,clientAuthMethod:`basic_header`,scopeSeparator:`space`}},microsoft_graph:{providerId:`microsoft_graph`,name:`Microsoft Graph`,aliases:[`microsoft`,`graph.microsoft.com`,`microsoft_graph`],modes:[`oauth`,`token`],defaultMode:`oauth`,serviceTypes:[`http_api`],authTypes:[`token`,`oauth`],tokenAuth:{token:{headerName:`Authorization`,headerPrefix:`Bearer `},oauth:{headerName:`Authorization`,headerPrefix:`Bearer `}},oauth:{authorizeUrl:`https://login.microsoftonline.com/common/oauth2/v2.0/authorize`,tokenUrl:`https://login.microsoftonline.com/common/oauth2/v2.0/token`,defaultScopes:[`openid`,`profile`,`offline_access`,`User.Read`],usePkce:!0,clientAuthMethod:`request_body`,scopeSeparator:`space`}},yahoo_mail:{providerId:`yahoo_mail`,name:`Yahoo Mail`,aliases:[`yahoo`,`yahoo_mail`,`mail.yahoo.com`],modes:[`oauth`,`token`],defaultMode:`oauth`,serviceTypes:[`http_api`],authTypes:[`token`,`oauth`],tokenAuth:{token:{headerName:`Authorization`,headerPrefix:`Bearer `},oauth:{headerName:`Authorization`,headerPrefix:`Bearer `}},oauth:{authorizeUrl:`https://api.login.yahoo.com/oauth2/request_auth`,tokenUrl:`https://api.login.yahoo.com/oauth2/get_token`,defaultScopes:[`mail-r`,`mail-w`],usePkce:!0,clientAuthMethod:`request_body`,scopeSeparator:`space`}},google:{providerId:`google`,name:`Google`,aliases:[`google`,`googleapis.com`],modes:[`oauth`,`token`],defaultMode:`oauth`,serviceTypes:[`http_api`],authTypes:[`token`,`oauth`],tokenAuth:{token:{headerName:`Authorization`,headerPrefix:`Bearer `},oauth:{headerName:`Authorization`,headerPrefix:`Bearer `}},oauth:{authorizeUrl:`https://accounts.google.com/o/oauth2/v2/auth`,tokenUrl:`https://oauth2.googleapis.com/token`,defaultScopes:[`openid`,`profile`,`email`],usePkce:!0,clientAuthMethod:`request_body`,scopeSeparator:`space`}},atlassian:{providerId:`atlassian`,name:`Atlassian`,aliases:[`atlassian`,`api.atlassian.com`],modes:[`oauth`,`token`,`basic`],defaultMode:`basic`,serviceTypes:[`http_api`,`git_remote`],authTypes:[`token`,`oauth`,`basic_userpass`],tokenAuth:{token:{headerName:`Authorization`,headerPrefix:`Bearer `},oauth:{headerName:`Authorization`,headerPrefix:`Bearer `},basic:{headerName:`Authorization`,headerPrefix:`Basic `}},oauth:{authorizeUrl:`https://auth.atlassian.com/authorize`,tokenUrl:`https://auth.atlassian.com/oauth/token`,defaultScopes:[],usePkce:!0,clientAuthMethod:`request_body`,scopeSeparator:`space`}},slack:{providerId:`slack`,name:`Slack`,aliases:[`slack`,`slack.com`],modes:[`oauth`,`token`],defaultMode:`oauth`,serviceTypes:[`http_api`],authTypes:[`token`,`oauth`],tokenAuth:{token:{headerName:`Authorization`,headerPrefix:`Bearer `},oauth:{headerName:`Authorization`,headerPrefix:`Bearer `}},oauth:{authorizeUrl:`https://slack.com/oauth/v2/authorize`,tokenUrl:`https://slack.com/api/oauth.v2.access`,defaultScopes:[],usePkce:!1,clientAuthMethod:`request_body`,scopeSeparator:`comma`}},linear:{providerId:`linear`,name:`Linear`,aliases:[`linear`,`api.linear.app`,`linear.app`],modes:[`oauth`,`token`],defaultMode:`oauth`,serviceTypes:[`http_api`],authTypes:[`token`,`oauth`],tokenAuth:{token:{headerName:`Authorization`,headerPrefix:`Bearer `},oauth:{headerName:`Authorization`,headerPrefix:`Bearer `}},oauth:{authorizeUrl:`https://linear.app/oauth/authorize`,tokenUrl:`https://api.linear.app/oauth/token`,defaultScopes:[],usePkce:!0,clientAuthMethod:`request_body`,scopeSeparator:`space`}},azure_devops:{providerId:`azure_devops`,name:`Azure DevOps`,aliases:[`azure_devops`,`dev.azure.com`],modes:[`oauth`,`token`],defaultMode:`oauth`,serviceTypes:[`http_api`,`git_remote`],authTypes:[`token`,`oauth`,`basic_userpass`,`ssh_key`],tokenAuth:{token:{headerName:`Authorization`,headerPrefix:`Bearer `},oauth:{headerName:`Authorization`,headerPrefix:`Bearer `}},tokenAuthByServiceType:{git_remote:{token:{headerName:`Authorization`,headerPrefix:`Basic `},oauth:{headerName:`Authorization`,headerPrefix:`Basic `}}},oauth:{authorizeUrl:`https://app.vssps.visualstudio.com/oauth2/authorize`,tokenUrl:`https://app.vssps.visualstudio.com/oauth2/token`,defaultScopes:[`vso.code`,`vso.profile`,`offline_access`],usePkce:!1,clientAuthMethod:`request_body`,scopeSeparator:`space`}},custom_mcp:{providerId:`custom_mcp`,name:`Custom MCP`,aliases:[`custom_mcp`],modes:[`oauth`,`token`],defaultMode:`oauth`,serviceTypes:[`mcp_remote`,`webmcp_local`],authTypes:[`none`,`token`,`oauth`,`custom_header`,`ssh_key`],tokenAuth:{token:{headerName:`Authorization`,headerPrefix:`Bearer `},oauth:{headerName:`Authorization`,headerPrefix:`Bearer `}},oauth:{authorizeUrl:`https://example.com/oauth/authorize`,tokenUrl:`https://example.com/oauth/token`,defaultScopes:[],usePkce:!0,clientAuthMethod:`request_body`,scopeSeparator:`space`}}};Object.fromEntries(Object.values(_).filter(e=>!!e.oauth).map(e=>{let t=e.oauth;return[e.providerId,{id:e.providerId,name:e.name,authorizeUrl:t.authorizeUrl,tokenUrl:t.tokenUrl,redirectUri:t.redirectUri,defaultScopes:t.defaultScopes,usePkce:t.usePkce,clientAuthMethod:t.clientAuthMethod,scopeSeparator:t.scopeSeparator}]})),Object.fromEntries(Object.values(_).map(e=>[e.providerId,{providerId:e.providerId,modes:e.modes,defaultMode:e.defaultMode}])),new Promise(e=>{});
|
|
3
3
|
/*! @license DOMPurify 3.4.13 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.13/LICENSE */
|
|
4
4
|
function v(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function y(e){if(Array.isArray(e))return e}function b(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function re(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
@@ -14,4 +14,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
14
14
|
}</code></pre></details></section><article><h2>Big Buck Bunny</h2><video controls style="border-radius: 0.5rem; width: 100%"><source src="https://xt-ml.github.io/assets/media/BigBuckBunny/BigBuckBunny_320x180.mp4" type="video/mp4" /></video><section><h2>Licensing</h2><ul><li><code>Big Buck Bunny</code> is licensed under the <a href="https://blender.org" >Creative Commons Attribution 3.0 License</a >. <ul><li> Attribution: Blender Foundation / <a href="https://www.blender.org/">www.blender.org</a></li><li> Copyright: (c) copyright 2008, Blender Foundation / <a href="https://www.bigbuckbunny.org/">www.bigbuckbunny.org</a></li></ul></li></ul></section></article></div></div></article><button type="button" class="pages__nav-btn pages__nav-btn--next" data-pages-next aria-label="Next page" hidden disabled><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" viewBox="0 0 24 24"><path d="m9 18 6-6-6-6"/></svg></button></div></section></template></shadow-claw-pages></div><div class="page" data-page-id="settings"></div><div class="page" data-page-id="tools"></div><div class="page" data-page-id="channels"></div><div class="chat-split-resize-handle" title="Drag to resize chat panel" hidden></div><shadow-claw-toast></shadow-claw-toast></main></div><shadow-claw-dialog dialog-class="app-dialog" dialog-aria-labelledby="appDialogTitle"><template><form method="dialog" class="app-confirm-dialog__form"><h2 id="appDialogTitle" class="app-dialog__title">Confirm</h2><p class="app-dialog__message"></p><ul class="app-dialog__details" hidden></ul><div class="app-dialog__links" hidden></div><p class="app-dialog__countdown" hidden role="status" aria-live="polite" aria-atomic="true"></p><div class="app-confirm-dialog__actions"><button type="submit" value="cancel" class="app-dialog__btn app-dialog__btn--cancel"> Cancel </button><button type="submit" value="confirm" class="app-dialog__btn app-dialog__btn--confirm"> Confirm </button></div></form></template></shadow-claw-dialog><shadow-claw-dialog dialog-class="app-dialog app-prompt-dialog" dialog-aria-labelledby="appPromptTitle"><template><form method="dialog" class="app-prompt-dialog__form"><h2 id="appPromptTitle" class="app-prompt-dialog__title"> Agent Question </h2><p class="app-prompt-dialog__message"></p><div class="app-prompt-dialog__input-area"></div><div class="app-prompt-dialog__actions"><button type="submit" value="submit" class="app-dialog__btn app-dialog__btn--confirm app-prompt-dialog__submit"> Submit </button></div></form></template></shadow-claw-dialog></div></template>
|
|
15
15
|
<a aria-label="ShadowClaw" class="header-title-link" href="https://xt-ml.github.io/shadow-claw/" slot="header-title-link"> <svg xmlns="http://www.w3.org/2000/svg" class="header-title-logo" viewBox="0 0 128 128"><rect width="128" height="128" fill="var(--shadow-claw-icon-bg)" rx="16"/><ellipse cx="64" cy="108" fill="var(--shadow-claw-icon-body)" rx="18" ry="12"/><ellipse cx="52" cy="112" fill="var(--shadow-claw-icon-accent-dark)" rx="8" ry="10"/><ellipse cx="76" cy="112" fill="var(--shadow-claw-icon-accent-dark)" rx="8" ry="10"/><ellipse cx="64" cy="92" fill="var(--shadow-claw-icon-body-segment)" rx="14" ry="8"/><ellipse cx="64" cy="82" fill="var(--shadow-claw-icon-body)" rx="12" ry="7"/><ellipse cx="64" cy="74" fill="var(--shadow-claw-icon-body-segment)" rx="10" ry="6"/><ellipse cx="64" cy="58" fill="var(--shadow-claw-icon-body)" rx="20" ry="18"/><ellipse cx="64" cy="50" fill="var(--shadow-claw-icon-body-segment)" rx="16" ry="10"/><rect width="18" height="8" x="28" y="45" fill="var(--shadow-claw-icon-body)" rx="4" transform="rotate(-20 37 49)"/><ellipse cx="20" cy="38" fill="var(--shadow-claw-icon-claw-main)" rx="14" ry="10"/><ellipse cx="16" cy="36" fill="var(--shadow-claw-icon-claw-inner)" rx="10" ry="7"/><ellipse cx="12" cy="34" fill="var(--shadow-claw-icon-accent-dark)" rx="5" ry="4"/><rect width="18" height="8" x="82" y="45" fill="var(--shadow-claw-icon-body)" rx="4" transform="rotate(20 91 49)"/><ellipse cx="108" cy="38" fill="var(--shadow-claw-icon-claw-main)" rx="14" ry="10"/><ellipse cx="112" cy="36" fill="var(--shadow-claw-icon-claw-inner)" rx="10" ry="7"/><ellipse cx="116" cy="34" fill="var(--shadow-claw-icon-accent-dark)" rx="5" ry="4"/><rect width="12" height="4" x="38" y="62" fill="var(--shadow-claw-icon-accent-dark)" rx="2" transform="rotate(-30 44 64)"/><rect width="14" height="4" x="36" y="68" fill="var(--shadow-claw-icon-accent-dark)" rx="2" transform="rotate(-25 43 70)"/><rect width="12" height="4" x="38" y="74" fill="var(--shadow-claw-icon-accent-dark)" rx="2" transform="rotate(-20 44 76)"/><rect width="12" height="4" x="78" y="62" fill="var(--shadow-claw-icon-accent-dark)" rx="2" transform="rotate(30 84 64)"/><rect width="14" height="4" x="78" y="68" fill="var(--shadow-claw-icon-accent-dark)" rx="2" transform="rotate(25 85 70)"/><rect width="12" height="4" x="78" y="74" fill="var(--shadow-claw-icon-accent-dark)" rx="2" transform="rotate(20 84 76)"/><ellipse cx="64" cy="38" fill="var(--shadow-claw-icon-body)" rx="14" ry="12"/><circle cx="56" cy="34" r="5" fill="var(--shadow-claw-icon-eye)"/><circle cx="72" cy="34" r="5" fill="var(--shadow-claw-icon-eye)"/><circle cx="56" cy="33" r="2" fill="var(--shadow-claw-icon-eye-shine)"/><circle cx="72" cy="33" r="2" fill="var(--shadow-claw-icon-eye-shine)"/><path fill="none" stroke="var(--shadow-claw-icon-accent-dark)" stroke-linecap="round" stroke-width="2" d="M60 42q4 4 8 0"/><path fill="none" stroke="var(--shadow-claw-icon-accent-dark)" stroke-linecap="round" stroke-width="3" d="M58 26Q50 14 42 8m28 18q8-12 16-18"/><path fill="none" stroke="var(--shadow-claw-icon-body)" stroke-linecap="round" stroke-width="2" d="M60 24q-6-8-10-14m18 14q6-8 10-14"/><ellipse cx="60" cy="55" fill="var(--shadow-claw-icon-body-shine)" opacity=".4" rx="6" ry="8"/></svg> <h1 class="header-title">ShadowClaw</h1> </a> <a aria-label="Shadow Claw Project on GitHub" class="header-actions-logo-link" href="https://github.com/xt-ml/shadow-claw" slot="header-actions-logo"> <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" viewBox="0 0 496 512"><path fill="var(--shadow-claw-bg-primary-reverse, currentColor)" d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6m-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3m44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9M244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8"/></svg> </a> <noscript> <div style="line-height:1.6;margin:0 auto;max-width:50rem;padding:2rem"> <h2>Browser-Native Personal AI Assistant</h2> <p> ShadowClaw is an open-source, browser-native AI assistant designed for autonomous orchestration, client-side tool execution, and private local storage via Origin Private File System (OPFS) and IndexedDB. </p> <h3>Agent & Developer Resources</h3> <ul> <li><a href="llms.txt">llms.txt (Agent Context & Guidance)</a></li> <li> <a href=".well-known/mcp.json">MCP Server Card (SEP-2127)</a> </li> <li> <a href=".well-known/ai-catalog.json">AI Catalog Discovery</a> </li> <li> <a href=".well-known/mcp/servers.json">MCP Servers Manifest</a> </li> <li><a href="sitemap.xml">XML Sitemap</a></li> <li> <a href="https://github.com/xt-ml/shadow-claw">GitHub Repository</a> </li> </ul> </div> </noscript>
|
|
16
16
|
</shadow-claw> <script type="module" src="index.js"></script> <script type="module">try{self[`workbox:window:7.4.0`]&&_()}catch{}function e(e,t){return new Promise((function(n){var r=new MessageChannel;r.port1.onmessage=function(e){n(e.data)},e.postMessage(t,[r.port2])}))}function t(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function n(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function r(e,n){var r=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,n){if(e){if(typeof e==`string`)return t(e,n);var r={}.toString.call(e).slice(8,-1);return r===`Object`&&e.constructor&&(r=e.constructor.name),r===`Map`||r===`Set`?Array.from(e):r===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?t(e,n):void 0}}(e))||n){r&&(e=r);var i=0;return function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
17
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function i(e,t){return i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},i(e,t)}function a(e){var t=function(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return String(e)}(e,`string`);return typeof t==`symbol`?t:t+``}try{self[`workbox:core:7.4.0`]&&_()}catch{}var o=function(){var e=this;this.promise=new Promise((function(t,n){e.resolve=t,e.reject=n}))};function s(e,t){var n=location.href;return new URL(e,n).href===new URL(t,n).href}var c=function(e,t){this.type=e,Object.assign(this,t)};function l(e,t,n){return e&&e.then||(e=Promise.resolve(e)),t?e.then(t):e}function u(){}var d={type:`SKIP_WAITING`};function f(e,t){return e&&e.then?e.then(u):Promise.resolve()}var p=function(t){function r(e,n){var r,i;return n===void 0&&(n={}),(r=t.call(this)||this).nn={},r.tn=0,r.rn=new o,r.en=new o,r.on=new o,r.un=0,r.an=new Set,r.cn=function(){var e=r.fn,t=e.installing;r.tn>0||!s(t.scriptURL,r.sn.toString())||performance.now()>r.un+6e4?(r.vn=t,e.removeEventListener(`updatefound`,r.cn)):(r.hn=t,r.an.add(t),r.rn.resolve(t)),++r.tn,t.addEventListener(`statechange`,r.ln)},r.ln=function(e){var t=r.fn,n=e.target,i=n.state,a=n===r.vn,o={sw:n,isExternal:a,originalEvent:e};!a&&r.mn&&(o.isUpdate=!0),r.dispatchEvent(new c(i,o)),i===`installed`?r.wn=self.setTimeout((function(){i===`installed`&&t.waiting===n&&r.dispatchEvent(new c(`waiting`,o))}),200):i===`activating`&&(clearTimeout(r.wn),a||r.en.resolve(n))},r.yn=function(e){var t=r.hn,n=t!==navigator.serviceWorker.controller;r.dispatchEvent(new c(`controlling`,{isExternal:n,originalEvent:e,sw:t,isUpdate:r.mn})),n||r.on.resolve(t)},r.gn=(i=function(e){var t=e.data,n=e.ports,i=e.source;return l(r.getSW(),(function(){r.an.has(i)&&r.dispatchEvent(new c(`message`,{data:t,originalEvent:e,ports:n,sw:i}))}))},function(){var e=[...arguments];try{return Promise.resolve(i.apply(this,e))}catch(e){return Promise.reject(e)}}),r.sn=e,r.nn=n,navigator.serviceWorker.addEventListener(`message`,r.gn),r}var a,u=t;(a=r).prototype=Object.create(u.prototype),a.prototype.constructor=a,i(a,u);var p=r.prototype;return p.register=function(e){var t=(e===void 0?{}:e).immediate,n=t!==void 0&&t;try{var r=this;return l(function(e,t){var n=e();return n&&n.then?n.then(t):t(n)}((function(){if(!n&&document.readyState!==`complete`)return f(new Promise((function(e){return window.addEventListener(`load`,e)})))}),(function(){return r.mn=!!navigator.serviceWorker.controller,r.dn=r.pn(),l(r.bn(),(function(e){r.fn=e,r.dn&&(r.hn=r.dn,r.en.resolve(r.dn),r.on.resolve(r.dn),r.dn.addEventListener(`statechange`,r.ln,{once:!0}));var t=r.fn.waiting;return t&&s(t.scriptURL,r.sn.toString())&&(r.hn=t,Promise.resolve().then((function(){r.dispatchEvent(new c(`waiting`,{sw:t,wasWaitingBeforeRegister:!0}))})).then((function(){}))),r.hn&&(r.rn.resolve(r.hn),r.an.add(r.hn)),r.fn.addEventListener(`updatefound`,r.cn),navigator.serviceWorker.addEventListener(`controllerchange`,r.yn),r.fn}))})))}catch(e){return Promise.reject(e)}},p.update=function(){try{return this.fn?l(f(this.fn.update())):l()}catch(e){return Promise.reject(e)}},p.getSW=function(){return this.hn===void 0?this.rn.promise:Promise.resolve(this.hn)},p.messageSW=function(t){try{return l(this.getSW(),(function(n){return e(n,t)}))}catch(e){return Promise.reject(e)}},p.messageSkipWaiting=function(){this.fn&&this.fn.waiting&&e(this.fn.waiting,d)},p.pn=function(){var e=navigator.serviceWorker.controller;return e&&s(e.scriptURL,this.sn.toString())?e:void 0},p.bn=function(){try{var e=this;return l(function(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}((function(){return l(navigator.serviceWorker.register(e.sn,e.nn),(function(t){return e.un=performance.now(),t}))}),(function(e){throw e})))}catch(e){return Promise.reject(e)}},n(r,[{key:`active`,get:function(){return this.en.promise}},{key:`controlling`,get:function(){return this.on.promise}}])}(function(){function e(){this.Pn=new Map}var t=e.prototype;return t.addEventListener=function(e,t){this.jn(e).add(t)},t.removeEventListener=function(e,t){this.jn(e).delete(t)},t.dispatchEvent=function(e){e.target=this;for(var t,n=r(this.jn(e.type));!(t=n()).done;)(0,t.value)(e)},t.jn=function(e){return this.Pn.has(e)||this.Pn.set(e,new Set),this.Pn.get(e)},e}());const m=`__shadowClawDefaultTrustedTypesPolicyState`,h=`default`,g=`shadowclaw-sandbox`;function v(){let e=globalThis;return e[m]||(e[m]={initialized:!1,policy:null}),e[m]}function y(){let e=v();if(e.initialized)return;let t=Reflect.get(globalThis,`trustedTypes`);if(!(!t||typeof t.createPolicy!=`function`)){e.initialized=!0;try{if(typeof t.getPolicy==`function`){let n=t.getPolicy(h);if(n){e.policy=n;return}}let n=!1;if(typeof t.getPolicyNames==`function`){let e=t.getPolicyNames();Array.isArray(e)&&e.includes(h)&&(n=!0)}if(n){if(typeof t.getPolicy==`function`){let n=t.getPolicy(g);if(n){e.policy=n;return}}e.policy=t.createPolicy(g,{createHTML:e=>e,createScriptURL:e=>e});return}e.policy=t.createPolicy(h,{createHTML:e=>e,createScriptURL:e=>e})}catch{typeof t.getPolicy==`function`&&(e.policy=t.getPolicy(h)??t.getPolicy(g)??null)}}}function b(e){y();let t=v().policy;return!t||typeof t.createScriptURL!=`function`?e:t.createScriptURL(e)}const x=`shadowclaw-sw-update-intent`,
|
|
17
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function i(e,t){return i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},i(e,t)}function a(e){var t=function(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return String(e)}(e,`string`);return typeof t==`symbol`?t:t+``}try{self[`workbox:core:7.4.0`]&&_()}catch{}var o=function(){var e=this;this.promise=new Promise((function(t,n){e.resolve=t,e.reject=n}))};function s(e,t){var n=location.href;return new URL(e,n).href===new URL(t,n).href}var c=function(e,t){this.type=e,Object.assign(this,t)};function l(e,t,n){return e&&e.then||(e=Promise.resolve(e)),t?e.then(t):e}function u(){}var d={type:`SKIP_WAITING`};function f(e,t){return e&&e.then?e.then(u):Promise.resolve()}var p=function(t){function r(e,n){var r,i;return n===void 0&&(n={}),(r=t.call(this)||this).nn={},r.tn=0,r.rn=new o,r.en=new o,r.on=new o,r.un=0,r.an=new Set,r.cn=function(){var e=r.fn,t=e.installing;r.tn>0||!s(t.scriptURL,r.sn.toString())||performance.now()>r.un+6e4?(r.vn=t,e.removeEventListener(`updatefound`,r.cn)):(r.hn=t,r.an.add(t),r.rn.resolve(t)),++r.tn,t.addEventListener(`statechange`,r.ln)},r.ln=function(e){var t=r.fn,n=e.target,i=n.state,a=n===r.vn,o={sw:n,isExternal:a,originalEvent:e};!a&&r.mn&&(o.isUpdate=!0),r.dispatchEvent(new c(i,o)),i===`installed`?r.wn=self.setTimeout((function(){i===`installed`&&t.waiting===n&&r.dispatchEvent(new c(`waiting`,o))}),200):i===`activating`&&(clearTimeout(r.wn),a||r.en.resolve(n))},r.yn=function(e){var t=r.hn,n=t!==navigator.serviceWorker.controller;r.dispatchEvent(new c(`controlling`,{isExternal:n,originalEvent:e,sw:t,isUpdate:r.mn})),n||r.on.resolve(t)},r.gn=(i=function(e){var t=e.data,n=e.ports,i=e.source;return l(r.getSW(),(function(){r.an.has(i)&&r.dispatchEvent(new c(`message`,{data:t,originalEvent:e,ports:n,sw:i}))}))},function(){var e=[...arguments];try{return Promise.resolve(i.apply(this,e))}catch(e){return Promise.reject(e)}}),r.sn=e,r.nn=n,navigator.serviceWorker.addEventListener(`message`,r.gn),r}var a,u=t;(a=r).prototype=Object.create(u.prototype),a.prototype.constructor=a,i(a,u);var p=r.prototype;return p.register=function(e){var t=(e===void 0?{}:e).immediate,n=t!==void 0&&t;try{var r=this;return l(function(e,t){var n=e();return n&&n.then?n.then(t):t(n)}((function(){if(!n&&document.readyState!==`complete`)return f(new Promise((function(e){return window.addEventListener(`load`,e)})))}),(function(){return r.mn=!!navigator.serviceWorker.controller,r.dn=r.pn(),l(r.bn(),(function(e){r.fn=e,r.dn&&(r.hn=r.dn,r.en.resolve(r.dn),r.on.resolve(r.dn),r.dn.addEventListener(`statechange`,r.ln,{once:!0}));var t=r.fn.waiting;return t&&s(t.scriptURL,r.sn.toString())&&(r.hn=t,Promise.resolve().then((function(){r.dispatchEvent(new c(`waiting`,{sw:t,wasWaitingBeforeRegister:!0}))})).then((function(){}))),r.hn&&(r.rn.resolve(r.hn),r.an.add(r.hn)),r.fn.addEventListener(`updatefound`,r.cn),navigator.serviceWorker.addEventListener(`controllerchange`,r.yn),r.fn}))})))}catch(e){return Promise.reject(e)}},p.update=function(){try{return this.fn?l(f(this.fn.update())):l()}catch(e){return Promise.reject(e)}},p.getSW=function(){return this.hn===void 0?this.rn.promise:Promise.resolve(this.hn)},p.messageSW=function(t){try{return l(this.getSW(),(function(n){return e(n,t)}))}catch(e){return Promise.reject(e)}},p.messageSkipWaiting=function(){this.fn&&this.fn.waiting&&e(this.fn.waiting,d)},p.pn=function(){var e=navigator.serviceWorker.controller;return e&&s(e.scriptURL,this.sn.toString())?e:void 0},p.bn=function(){try{var e=this;return l(function(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}((function(){return l(navigator.serviceWorker.register(e.sn,e.nn),(function(t){return e.un=performance.now(),t}))}),(function(e){throw e})))}catch(e){return Promise.reject(e)}},n(r,[{key:`active`,get:function(){return this.en.promise}},{key:`controlling`,get:function(){return this.on.promise}}])}(function(){function e(){this.Pn=new Map}var t=e.prototype;return t.addEventListener=function(e,t){this.jn(e).add(t)},t.removeEventListener=function(e,t){this.jn(e).delete(t)},t.dispatchEvent=function(e){e.target=this;for(var t,n=r(this.jn(e.type));!(t=n()).done;)(0,t.value)(e)},t.jn=function(e){return this.Pn.has(e)||this.Pn.set(e,new Set),this.Pn.get(e)},e}());const m=`__shadowClawDefaultTrustedTypesPolicyState`,h=`default`,g=`shadowclaw-sandbox`;function v(){let e=globalThis;return e[m]||(e[m]={initialized:!1,policy:null}),e[m]}function y(){let e=v();if(e.initialized)return;let t=Reflect.get(globalThis,`trustedTypes`);if(!(!t||typeof t.createPolicy!=`function`)){e.initialized=!0;try{if(typeof t.getPolicy==`function`){let n=t.getPolicy(h);if(n){e.policy=n;return}}let n=!1;if(typeof t.getPolicyNames==`function`){let e=t.getPolicyNames();Array.isArray(e)&&e.includes(h)&&(n=!0)}if(n){if(typeof t.getPolicy==`function`){let n=t.getPolicy(g);if(n){e.policy=n;return}}e.policy=t.createPolicy(g,{createHTML:e=>e,createScriptURL:e=>e});return}e.policy=t.createPolicy(h,{createHTML:e=>e,createScriptURL:e=>e})}catch{typeof t.getPolicy==`function`&&(e.policy=t.getPolicy(h)??t.getPolicy(g)??null)}}}function b(e){y();let t=v().policy;return!t||typeof t.createScriptURL!=`function`?e:t.createScriptURL(e)}const x=`shadowclaw-oac-reload-attempted`,S=`shadowclaw-sw-update-intent`,C=3e4,w=`shadowclaw-sw-update-failure`;let T=!1,E=null;async function D(e=5e3){let t=Date.now();for(;Date.now()-t<e;){let e=document.querySelector(`shadow-claw`);if(e&&typeof e.requestDialog==`function`)return e;await new Promise(e=>{globalThis.setTimeout(e,50)})}return null}async function O(){let e=await D();return e?.requestDialog?await e.requestDialog({title:`Update Available`,message:`A new version of ShadowClaw is ready. Reload now to apply the update?`,confirmLabel:`Reload now`,cancelLabel:`Later`}):!1}async function k(){let e=await D();e?.requestDialog&&await e.requestDialog({title:`Update Failed`,message:`The app update failed to install automatically. Please try restarting your browser to complete the update.`,confirmLabel:`OK`}),console.warn(`[ShadowClaw] Service worker update failed. Please restart your browser to complete the update.`)}function A(){try{let e=globalThis.sessionStorage?.getItem(S);if(!e)return null;let t=JSON.parse(e);return typeof t.startedAt!=`number`||typeof t.fallbackReloadAttempts!=`number`?null:{startedAt:t.startedAt,fallbackReloadAttempts:t.fallbackReloadAttempts}}catch{return null}}function j(e){try{globalThis.sessionStorage?.setItem(S,JSON.stringify(e))}catch{}}function M(){try{globalThis.sessionStorage?.removeItem(S)}catch{}}function N(){let e=A();return e?Date.now()-e.startedAt<=C?!0:(M(),!1):!1}function P(){L(),j({startedAt:Date.now(),fallbackReloadAttempts:0})}function F(){try{let e=globalThis.sessionStorage?.getItem(w);if(!e)return null;let t=JSON.parse(e);return typeof t.failedAt==`number`?{failedAt:t.failedAt}:null}catch{return null}}function I(e){try{globalThis.sessionStorage?.setItem(w,JSON.stringify(e))}catch{}}function L(){try{globalThis.sessionStorage?.removeItem(w)}catch{}}function R(){let e=F();return e?Date.now()-e.failedAt<=3e5?!0:(L(),!1):!1}function z(){M(),I({failedAt:Date.now()})}function B(){if(T)return;T=!0,E!==null&&(globalThis.clearTimeout(E),E=null);let e=globalThis.location;typeof e?.reload==`function`&&e.reload()}async function V(){if(T||E!==null)return;let e=A();if(e){if(Date.now()-e.startedAt>C){M();return}if(e.fallbackReloadAttempts>=2){z(),await k();return}j({...e,fallbackReloadAttempts:e.fallbackReloadAttempts+1}),E=globalThis.setTimeout(()=>{B()},3e3)}}async function H(e){e.messageSkipWaiting(),await V()}function U(){return N()}function W(){if(globalThis.originAgentCluster!==!1)return!1;let e=globalThis.location?.protocol;if(e!==`http:`&&e!==`https:`)return!1;try{return!globalThis.sessionStorage?.getItem(x)}catch{return!1}}function G(){try{globalThis.sessionStorage?.setItem(x,`1`)}catch{return}B()}function K(){let e=U();if(M(),L(),e){B();return}W()&&G()}try{if(typeof navigator<`u`&&`serviceWorker`in navigator&&navigator.serviceWorker){y();let e=new p(b(`service-worker.js`));e.addEventListener(`waiting`,async()=>{if(!R()){if(N()){await H(e);return}await O()&&(P(),await H(e))}}),e.addEventListener(`controlling`,()=>{K()}),navigator.serviceWorker.addEventListener(`controllerchange`,()=>{K()});let t=()=>{globalThis.setTimeout(()=>{e.register()},1e4)};document.readyState===`complete`?t():globalThis.addEventListener(`load`,t)}}catch{}export{B as reloadCurrentPage,U as shouldReloadAfterControllerChange,W as shouldReloadForOriginAgentCluster};</script> </body></html>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<!doctype html><html lang="en"><head><title>ShadowClaw</title><meta charset="utf-8"><meta name="revision" content="
|
|
1
|
+
<!doctype html><html lang="en"><head><title>ShadowClaw</title><meta charset="utf-8"><meta name="revision" content="337adfbfa6c9e2ef3b393b3071769156976e8177" /><meta name="version" content="1.39.2" /><meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover"><meta name="description" content="ShadowClaw - multi-runtime AI assistant." /><link rel="canonical" href="https://xt-ml.github.io/shadow-claw/"><meta property="og:title" content="ShadowClaw"><meta property="og:description" content="Browser-native personal AI assistant with local and remote LLM orchestration, Web Workers, OPFS storage, and agentic tool execution."><meta property="og:type" content="website"><meta property="og:url" content="https://xt-ml.github.io/shadow-claw/"><meta property="og:image" content="https://xt-ml.github.io/shadow-claw/assets/icons/512.png"><meta name="twitter:card" content="summary"><meta name="twitter:title" content="ShadowClaw"><meta name="twitter:description" content="Browser-native personal AI assistant with local and remote LLM orchestration, Web Workers, OPFS storage, and agentic tool execution."><meta name="twitter:image" content="https://xt-ml.github.io/shadow-claw/assets/icons/512.png"><script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"SoftwareApplication","@id":"https://xt-ml.github.io/shadow-claw/#software","name":"ShadowClaw","description":"Browser-native personal AI assistant with local and remote LLM orchestration, Web Workers, OPFS storage, and agentic tool execution.","url":"https://xt-ml.github.io/shadow-claw/","applicationCategory":"DeveloperApplication","operatingSystem":"Web, Browser, Desktop","offers":{"@type":"Offer","price":"0","priceCurrency":"USD"},"author":{"@type":"Organization","name":"xt-ml","url":"https://github.com/xt-ml"},"codeRepository":"https://github.com/xt-ml/shadow-claw","license":"https://github.com/xt-ml/shadow-claw/blob/main/LICENSE"},{"@type":"WebSite","@id":"https://xt-ml.github.io/shadow-claw/#website","url":"https://xt-ml.github.io/shadow-claw/","name":"ShadowClaw","description":"Official website and live deployment of ShadowClaw browser-native AI assistant.","publisher":{"@type":"Organization","name":"xt-ml","url":"https://github.com/xt-ml"}},{"@type":"Organization","@id":"https://xt-ml.github.io/shadow-claw/#organization","name":"xt-ml","url":"https://github.com/xt-ml","sameAs":["https://github.com/xt-ml"]}]}</script><meta name="theme-color" content="#fff" /><meta http-equiv="origin-trial" content="A88uTgESYWcVgREKVReKB6jom41uP8TzW6ei3jNdidf+Xl6ONqKRjKNBphsxhrZmdkakLK3oXDgkGq53rtZYSAMAAAB2eyJvcmlnaW4iOiJodHRwczovL3h0LW1sLmdpdGh1Yi5pbzo0NDMiLCJmZWF0dXJlIjoiV2ViTUNQIiwiZXhwaXJ5IjoxNzk0ODczNjAwLCJpc1N1YmRvbWFpbiI6dHJ1ZSwiaXNUaGlyZFBhcnR5Ijp0cnVlfQ=="><base href="/shadow-claw/" /><script id="shadow-claw-site-config" type="application/json">{"$schema":"https:\u002f\u002fjson-schema.org\u002fdraft\u002f2020-12\u002fschema","site":{"title":"ShadowClaw","description":"ShadowClaw - multi-runtime AI assistant.","themeColor":"#fff"},"branding":{"faviconPath":"assets\u002ficons\u002ffavicon.ico","appleTouchIconPath":"assets\u002ficons\u002f180.png","notFoundPath":"404.html"},"pwa":{"manifestPath":"manifest.json","themeColor":"#000000"},"sitemapPath":"sitemap.xml","assets":["assets"],"sidebar":{"pagesHidden":false,"chatHidden":false,"tasksHidden":false,"filesHidden":false,"defaultPage":"pages"},"settings":{"defaultToolsProfile":"__builtin_default"},"agent":{"defaultProvider":"transformers_js_local","defaultModel":"onnx-community\u002fgemma-3-1b-it-ONNX-GQA"},"customElements":{"allowedElements":["block-garden","block-garden-option","block-garden-select"],"allowedDomains":["kherrick.github.io","cdn.jsdelivr.net"]},"security":{"connectSrc":["'self'","blob:","data:","https:\u002f\u002fkherrick.github.io","https:\u002f\u002fcdn.jsdelivr.net"]}}</script>
|
|
2
2
|
<script>var ShadowClawThemeInit=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports);function n(){if(globalThis.trustedTypes)return;let e=new Map;globalThis.trustedTypes={createPolicy:(t,n)=>{if(e.has(t))throw TypeError(`Policy with name "${t}" already exists.`);let r={createHTML:n.createHTML?e=>n.createHTML(e):void 0,createScriptURL:n.createScriptURL?e=>n.createScriptURL(e):void 0,createScript:n.createScript?e=>n.createScript(e):void 0};return e.set(t,r),r},getPolicy:t=>e.get(t)??null,isHTML:e=>typeof e==`string`||e instanceof Object&&`toString`in e,isScriptURL:e=>typeof e==`string`||e instanceof Object&&`toString`in e,isScript:e=>typeof e==`string`||e instanceof Object&&`toString`in e}}let r=`__shadowClawDefaultTrustedTypesPolicyState`,i=`default`,a=`shadowclaw-sandbox`;function o(){let e=globalThis;return e[r]||(e[r]={initialized:!1,policy:null}),e[r]}function s(){let e=o();if(e.initialized)return;let t=Reflect.get(globalThis,`trustedTypes`);if(!(!t||typeof t.createPolicy!=`function`)){e.initialized=!0;try{if(typeof t.getPolicy==`function`){let n=t.getPolicy(i);if(n){e.policy=n;return}}let n=!1;if(typeof t.getPolicyNames==`function`){let e=t.getPolicyNames();Array.isArray(e)&&e.includes(i)&&(n=!0)}if(n){if(typeof t.getPolicy==`function`){let n=t.getPolicy(a);if(n){e.policy=n;return}}e.policy=t.createPolicy(a,{createHTML:e=>e,createScriptURL:e=>e});return}e.policy=t.createPolicy(i,{createHTML:e=>e,createScriptURL:e=>e})}catch{typeof t.getPolicy==`function`&&(e.policy=t.getPolicy(i)??t.getPolicy(a)??null)}}}new class{loading=!1;models=new Map;getModelInfo(e){if(!e||typeof e!=`string`)return null;let t=e.toLowerCase().trim(),n=this.models.get(t);if(n)return n;if(t.includes(`/`)){let e=t.split(`/`).pop();if(e&&this.models.has(e))return this.models.get(e)}else for(let[e,n]of this.models.entries())if(e.endsWith(`/${t}`))return n;if(t.includes(`:`)){let e=t.split(`:`)[0],n=this.getModelInfo(e);if(n)return n}return null}registerModelInfo(e,t){this.models.set(e.toLowerCase(),t)}clear(){this.models.clear()}async fetchModelInfo(e,t,n){if(e.modelsUrl){this.loading=!0;try{let r=new Headers;if(r.set(`Content-Type`,`application/json`),e.headers)for(let[t,n]of Object.entries(e.headers))r.set(t,n);if(n)for(let[e,t]of Object.entries(n))r.set(e,t);if(t&&e.apiKeyHeader){let n=e.apiKeyHeaderFormat;r.set(e.apiKeyHeader,n?n.replace(`{key}`,t):t)}let i=await fetch(e.modelsUrl,{headers:r});if(!i.ok)throw Error(`HTTP ${i.status} ${i.statusText}`);let a=await i.json(),o=Array.isArray(a.data)?a.data:Array.isArray(a.models)?a.models:[];for(let e of o){if(!e.id)continue;let t=e.context_length??e.context_window??0,n=e.max_completion_tokens||e.per_request_limits?.completion_tokens||e.top_provider?.max_completion_tokens||null,r=typeof e.supports_tools==`boolean`?e.supports_tools:typeof e.supportsTools==`boolean`?e.supportsTools:void 0,i=this.extractModalities(e,`input`),a=this.extractModalities(e,`output`),o=this.modalitiesInclude(i,`image`,`vision`),s=this.modalitiesInclude(i,`audio`,`voice`,`hearing`),c=this.modalitiesInclude(i,`video`),l=e.id===`openrouter/free`||this.supportedParametersInclude(e,`image`,`vision`,`audio`,`tool`,`structured`),u=this.extractReasoning(e),d=typeof e.supports_prompt_caching==`boolean`?e.supports_prompt_caching:typeof e.supportsPromptCaching==`boolean`?e.supportsPromptCaching:this.supportedParametersInclude(e,`cache_control`,`prompt_caching`)?!0:void 0;!t&&Array.isArray(e.providers)&&e.providers.length>0&&(t=e.providers[0]?.context_length||0),this.registerModelInfo(e.id,{contextWindow:t,maxOutput:n,...r!==void 0&&{supportsTools:r},...i.length>0&&{inputModalities:i},...a.length>0&&{outputModalities:a},...o!==void 0&&{supportsImageInput:o},...s!==void 0&&{supportsAudioInput:s},...c!==void 0&&{supportsVideoInput:c},...u&&{reasoning:u},...l&&{routesByRequestFeatures:l},...d!==void 0&&{supportsPromptCaching:d}})}o.length>0&&console.log(`[ModelRegistry] Registered ${o.length} models for provider "${e.id}"`)}catch(t){console.error(`[ModelRegistry] Error fetching models for ${e.id}:`,t)}finally{this.loading=!1}}}extractModalities(e,t){let n=t===`input`?e.input_modalities||e.inputModalities:e.output_modalities||e.outputModalities,r=e.architecture||{},i=t===`input`?r.input_modalities||r.inputModalities:r.output_modalities||r.outputModalities,a=typeof r.modality==`string`?r.modality:``,o=this.parseArchitectureModality(a,t),s=[...this.normalizeStringArray(n),...this.normalizeStringArray(i),...o];return Array.from(new Set(s))}extractReasoning(e){let t=e?.reasoning;if(!t||typeof t!=`object`)return;let n=this.normalizeStringArray(t.supported_efforts),r=typeof t.default_effort==`string`?t.default_effort.toLowerCase():void 0,i=typeof t.default_enabled==`boolean`?t.default_enabled:void 0,a=typeof t.supports_max_tokens==`boolean`?t.supports_max_tokens:void 0,o=typeof t.mandatory==`boolean`?t.mandatory:void 0;if(!(n.length===0&&r===void 0&&i===void 0&&a===void 0&&o===void 0))return{...n.length>0&&{supportedEfforts:n},...r!==void 0&&{defaultEffort:r},...i!==void 0&&{defaultEnabled:i},...a!==void 0&&{supportsMaxTokens:a},...o!==void 0&&{mandatory:o}}}modalitiesInclude(e,...t){if(e.length!==0)return t.some(t=>e.some(e=>e.includes(t)))}normalizeStringArray(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`).map(e=>e.toLowerCase()):[]}parseArchitectureModality(e,t){if(!e)return[];let[n=``,r=``]=e.toLowerCase().split(`->`).map(e=>e.trim());return(t===`input`?n:r).split(/[+,/\s]+/).map(e=>e.trim()).filter(Boolean)}supportedParametersInclude(e,...t){let n=this.normalizeStringArray(e.supported_parameters||e.supportedParameters);return t.some(e=>n.some(t=>t.includes(e)))}};function c(e){return e.replace(/^\/+|\/+$/g,``)}function l(e){let t=c(e);return t.endsWith(`/index.html`)?t=t.slice(0,-11):t.endsWith(`index.html`)&&(t=t.slice(0,-10)),c(t)}function u(e){let t=c(e),n=t.split(`/`).filter(Boolean);if(n.length===0)return null;let r=n[0].toLowerCase();if(r===`pages`){if(n.length>=3){let e=n[1];return{page:`pages`,groupId:e===`main`?`br:main`:e.startsWith(`br-`)?`br:${e.slice(3)}`:e,path:n.slice(2).join(`/`)}}return{page:`pages`,groupId:`br:main`,path:n.slice(1).join(`/`)}}if(r===`files`){let e=n[1]||`main`;return{page:`files`,groupId:e===`main`?`br:main`:e.startsWith(`br-`)?`br:${e.slice(3)}`:e,path:n.slice(2).join(`/`)||void 0}}if(r===`chat`){let e=n[1]||`main`;return{page:`chat`,groupId:e===`main`?`br:main`:e.startsWith(`br-`)?`br:${e.slice(3)}`:e}}if(r===`tasks`){let e=n[1]||`main`;return{page:`tasks`,groupId:e===`main`?`br:main`:e.startsWith(`br-`)?`br:${e.slice(3)}`:e}}return r===`main`?{page:`pages`,groupId:`br:main`,path:n.slice(1).join(`/`)}:{page:`pages`,groupId:`br:main`,path:t}}function d(){if(typeof document<`u`){let e=document.getElementById(`shadow-claw-static-routing`);if(e&&e.textContent)try{let t=JSON.parse(e.textContent);if(t&&typeof t==`object`&&t.routes)return t}catch(e){console.warn(`Failed to parse embedded static routing manifest:`,e)}}return null}function f(e,t){let n=t||d();if(!n||!n.routes)return null;let r=l(e);if(!r)return null;for(let[e,t]of Object.entries(n.routes))if(!(!t||!t.prettyPath)&&l(t.prettyPath)===r)return u(e);return null}let p=null,ee=new Set([`chat`,`files`,`tasks`,`pages`,`settings`,`tools`,`channels`]);function m(){p=null}typeof globalThis<`u`&&(globalThis.__applyBasePathCacheReset=m);function h(){let e=typeof window<`u`?window:typeof self<`u`?self:globalThis;if(e&&e.__SHADOWCLAW_DEPLOY_ID__){let t=String(e.__SHADOWCLAW_DEPLOY_ID__).trim();if(t)return t.replace(/[^a-zA-Z0-9_-]/g,`-`)}let t=globalThis.process;if(t&&t.env&&t.env.SHADOWCLAW_DEPLOY_ID){let e=String(t.env.SHADOWCLAW_DEPLOY_ID).trim();if(e)return e.replace(/[^a-zA-Z0-9_-]/g,`-`)}let n=te();return!n||n===`/`?``:n.replace(/^\/+|\/+$/g,``).replace(/[^a-zA-Z0-9_-]/g,`-`)}function te(){if(p!==null)return p;if((typeof window>`u`||globalThis.WorkerGlobalScope!==void 0&&typeof self<`u`&&self instanceof globalThis.WorkerGlobalScope)&&typeof self<`u`&&self.location){let e=(self.location.pathname||`/`).split(`/`).filter(Boolean);if(e.length<=1)return p=`/`,p;let t=e[0].toLowerCase(),n=t===`service-worker.js`||t===`sw.js`||t===`manifest.json`||t===`sitemap.xml`||t===`favicon.ico`||t===`index.html`||t===`service-worker`||t===`assets`||t===`dist`||t===`public`;if(n&&e.length===2)return p=`/`,p;if(!n)return p=`/`+e[0]+`/`,p}let e=typeof window<`u`&&window.location?window.location:typeof self<`u`&&self.location?self.location:null;if(!e)return`/`;if(typeof document<`u`&&typeof document.querySelector==`function`){let t=document.querySelector(`base[href]`);if(t){let n=t.getAttribute(`href`);if(n)try{let t=new URL(n,e.origin).pathname;return t.endsWith(`/`)||(t+=`/`),p=t,p}catch{}}}let t=e.pathname||`/`;if(t===`/`)return p=`/`,p;let n=t.split(`/`).filter(Boolean),r=n.findIndex(e=>ee.has(e.toLowerCase()));return r>=0?r===0?(p=`/`,p):(p=`/`+n.slice(0,r).join(`/`)+`/`,p):f(t)?(p=`/`,p):n.length===1&&!t.includes(`.`)?(p=`/`+n[0]+`/`,p):(p=`/`,p)}function ne(e){let t=e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);return RegExp(`(^|\\s)@${t}\\b`,`i`)}ne(`ShadowClaw`);function g(){let e=h();return e?`shadowclaw-${e}`:`shadowclaw`}g();let _={github:{providerId:`github`,name:`GitHub`,aliases:[`github`,`api.github.com`],modes:[`oauth`,`token`],defaultMode:`oauth`,serviceTypes:[`http_api`,`git_remote`],authTypes:[`token`,`oauth`],tokenAuth:{token:{headerName:`Authorization`,headerPrefix:`token `},oauth:{headerName:`Authorization`,headerPrefix:`Bearer `}},oauth:{authorizeUrl:`https://github.com/login/oauth/authorize`,tokenUrl:`https://github.com/login/oauth/access_token`,defaultScopes:[`repo`,`read:user`],usePkce:!0,clientAuthMethod:`request_body`,scopeSeparator:`space`}},gitlab:{providerId:`gitlab`,name:`GitLab`,aliases:[`gitlab`,`gitlab.com`],modes:[`oauth`,`token`],defaultMode:`oauth`,serviceTypes:[`http_api`,`git_remote`],authTypes:[`token`,`oauth`],tokenAuth:{token:{headerName:`PRIVATE-TOKEN`,headerPrefix:``},oauth:{headerName:`Authorization`,headerPrefix:`Bearer `}},tokenAuthByServiceType:{git_remote:{token:{headerName:`Authorization`,headerPrefix:`Bearer `},oauth:{headerName:`Authorization`,headerPrefix:`Bearer `}}},oauth:{authorizeUrl:`https://gitlab.com/oauth/authorize`,tokenUrl:`https://gitlab.com/oauth/token`,defaultScopes:[`read_api`,`read_user`],usePkce:!0,clientAuthMethod:`request_body`,scopeSeparator:`space`}},figma:{providerId:`figma`,name:`Figma`,aliases:[`figma`,`api.figma.com`],modes:[`oauth`,`token`],defaultMode:`oauth`,serviceTypes:[`http_api`],authTypes:[`token`,`oauth`],tokenAuth:{token:{headerName:`X-Figma-Token`,headerPrefix:``},oauth:{headerName:`Authorization`,headerPrefix:`Bearer `}},oauth:{authorizeUrl:`https://www.figma.com/oauth`,tokenUrl:`https://api.figma.com/v1/oauth/token`,refreshUrl:`https://api.figma.com/v1/oauth/refresh`,defaultScopes:[],usePkce:!0,clientAuthMethod:`basic_header`,scopeSeparator:`space`}},notion:{providerId:`notion`,name:`Notion`,aliases:[`notion`,`api.notion.com`,`notion.so`],modes:[`oauth`,`token`],defaultMode:`oauth`,serviceTypes:[`http_api`],authTypes:[`token`,`oauth`],tokenAuth:{token:{headerName:`Authorization`,headerPrefix:`Bearer `},oauth:{headerName:`Authorization`,headerPrefix:`Bearer `}},oauth:{authorizeUrl:`https://api.notion.com/v1/oauth/authorize`,tokenUrl:`https://api.notion.com/v1/oauth/token`,defaultScopes:[],usePkce:!0,clientAuthMethod:`basic_header`,scopeSeparator:`space`}},microsoft_graph:{providerId:`microsoft_graph`,name:`Microsoft Graph`,aliases:[`microsoft`,`graph.microsoft.com`,`microsoft_graph`],modes:[`oauth`,`token`],defaultMode:`oauth`,serviceTypes:[`http_api`],authTypes:[`token`,`oauth`],tokenAuth:{token:{headerName:`Authorization`,headerPrefix:`Bearer `},oauth:{headerName:`Authorization`,headerPrefix:`Bearer `}},oauth:{authorizeUrl:`https://login.microsoftonline.com/common/oauth2/v2.0/authorize`,tokenUrl:`https://login.microsoftonline.com/common/oauth2/v2.0/token`,defaultScopes:[`openid`,`profile`,`offline_access`,`User.Read`],usePkce:!0,clientAuthMethod:`request_body`,scopeSeparator:`space`}},yahoo_mail:{providerId:`yahoo_mail`,name:`Yahoo Mail`,aliases:[`yahoo`,`yahoo_mail`,`mail.yahoo.com`],modes:[`oauth`,`token`],defaultMode:`oauth`,serviceTypes:[`http_api`],authTypes:[`token`,`oauth`],tokenAuth:{token:{headerName:`Authorization`,headerPrefix:`Bearer `},oauth:{headerName:`Authorization`,headerPrefix:`Bearer `}},oauth:{authorizeUrl:`https://api.login.yahoo.com/oauth2/request_auth`,tokenUrl:`https://api.login.yahoo.com/oauth2/get_token`,defaultScopes:[`mail-r`,`mail-w`],usePkce:!0,clientAuthMethod:`request_body`,scopeSeparator:`space`}},google:{providerId:`google`,name:`Google`,aliases:[`google`,`googleapis.com`],modes:[`oauth`,`token`],defaultMode:`oauth`,serviceTypes:[`http_api`],authTypes:[`token`,`oauth`],tokenAuth:{token:{headerName:`Authorization`,headerPrefix:`Bearer `},oauth:{headerName:`Authorization`,headerPrefix:`Bearer `}},oauth:{authorizeUrl:`https://accounts.google.com/o/oauth2/v2/auth`,tokenUrl:`https://oauth2.googleapis.com/token`,defaultScopes:[`openid`,`profile`,`email`],usePkce:!0,clientAuthMethod:`request_body`,scopeSeparator:`space`}},atlassian:{providerId:`atlassian`,name:`Atlassian`,aliases:[`atlassian`,`api.atlassian.com`],modes:[`oauth`,`token`,`basic`],defaultMode:`basic`,serviceTypes:[`http_api`,`git_remote`],authTypes:[`token`,`oauth`,`basic_userpass`],tokenAuth:{token:{headerName:`Authorization`,headerPrefix:`Bearer `},oauth:{headerName:`Authorization`,headerPrefix:`Bearer `},basic:{headerName:`Authorization`,headerPrefix:`Basic `}},oauth:{authorizeUrl:`https://auth.atlassian.com/authorize`,tokenUrl:`https://auth.atlassian.com/oauth/token`,defaultScopes:[],usePkce:!0,clientAuthMethod:`request_body`,scopeSeparator:`space`}},slack:{providerId:`slack`,name:`Slack`,aliases:[`slack`,`slack.com`],modes:[`oauth`,`token`],defaultMode:`oauth`,serviceTypes:[`http_api`],authTypes:[`token`,`oauth`],tokenAuth:{token:{headerName:`Authorization`,headerPrefix:`Bearer `},oauth:{headerName:`Authorization`,headerPrefix:`Bearer `}},oauth:{authorizeUrl:`https://slack.com/oauth/v2/authorize`,tokenUrl:`https://slack.com/api/oauth.v2.access`,defaultScopes:[],usePkce:!1,clientAuthMethod:`request_body`,scopeSeparator:`comma`}},linear:{providerId:`linear`,name:`Linear`,aliases:[`linear`,`api.linear.app`,`linear.app`],modes:[`oauth`,`token`],defaultMode:`oauth`,serviceTypes:[`http_api`],authTypes:[`token`,`oauth`],tokenAuth:{token:{headerName:`Authorization`,headerPrefix:`Bearer `},oauth:{headerName:`Authorization`,headerPrefix:`Bearer `}},oauth:{authorizeUrl:`https://linear.app/oauth/authorize`,tokenUrl:`https://api.linear.app/oauth/token`,defaultScopes:[],usePkce:!0,clientAuthMethod:`request_body`,scopeSeparator:`space`}},azure_devops:{providerId:`azure_devops`,name:`Azure DevOps`,aliases:[`azure_devops`,`dev.azure.com`],modes:[`oauth`,`token`],defaultMode:`oauth`,serviceTypes:[`http_api`,`git_remote`],authTypes:[`token`,`oauth`,`basic_userpass`,`ssh_key`],tokenAuth:{token:{headerName:`Authorization`,headerPrefix:`Bearer `},oauth:{headerName:`Authorization`,headerPrefix:`Bearer `}},tokenAuthByServiceType:{git_remote:{token:{headerName:`Authorization`,headerPrefix:`Basic `},oauth:{headerName:`Authorization`,headerPrefix:`Basic `}}},oauth:{authorizeUrl:`https://app.vssps.visualstudio.com/oauth2/authorize`,tokenUrl:`https://app.vssps.visualstudio.com/oauth2/token`,defaultScopes:[`vso.code`,`vso.profile`,`offline_access`],usePkce:!1,clientAuthMethod:`request_body`,scopeSeparator:`space`}},custom_mcp:{providerId:`custom_mcp`,name:`Custom MCP`,aliases:[`custom_mcp`],modes:[`oauth`,`token`],defaultMode:`oauth`,serviceTypes:[`mcp_remote`,`webmcp_local`],authTypes:[`none`,`token`,`oauth`,`custom_header`,`ssh_key`],tokenAuth:{token:{headerName:`Authorization`,headerPrefix:`Bearer `},oauth:{headerName:`Authorization`,headerPrefix:`Bearer `}},oauth:{authorizeUrl:`https://example.com/oauth/authorize`,tokenUrl:`https://example.com/oauth/token`,defaultScopes:[],usePkce:!0,clientAuthMethod:`request_body`,scopeSeparator:`space`}}};Object.fromEntries(Object.values(_).filter(e=>!!e.oauth).map(e=>{let t=e.oauth;return[e.providerId,{id:e.providerId,name:e.name,authorizeUrl:t.authorizeUrl,tokenUrl:t.tokenUrl,redirectUri:t.redirectUri,defaultScopes:t.defaultScopes,usePkce:t.usePkce,clientAuthMethod:t.clientAuthMethod,scopeSeparator:t.scopeSeparator}]})),Object.fromEntries(Object.values(_).map(e=>[e.providerId,{providerId:e.providerId,modes:e.modes,defaultMode:e.defaultMode}])),new Promise(e=>{});
|
|
3
3
|
/*! @license DOMPurify 3.4.13 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.13/LICENSE */
|
|
4
4
|
function v(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function y(e){if(Array.isArray(e))return e}function b(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function re(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
@@ -215,4 +215,4 @@ jobs:
|
|
|
215
215
|
</code></pre> <blockquote><p><strong>Tip:</strong> Wrap this in a scheduled task (Tasks sidebar → New Task → type <code>tools</code>, set a cron interval) to run the pipeline automatically, e.g. every 24 hours. No LLM calls are made at execution time.</p></blockquote><hr><h2>Template repository</h2><p>A ready-to-fork starter template is available in the <a href="https://github.com/xt-ml/shadow-claw-template"><code>shadow-claw-template</code></a> repository. It contains the workflow, sample <code>pages/main/index.html</code>, <code>pages/main/~/content/about.md</code>, root-level <code>shadow-claw.config.json</code>, and <code>pages/routes.json</code>.</p></div></div></article><button type="button" class="pages__nav-btn pages__nav-btn--next" data-pages-next aria-label="Next page" hidden disabled><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" viewBox="0 0 24 24"><path d="m9 18 6-6-6-6"/></svg></button></div></section></template></shadow-claw-pages></div><div class="page" data-page-id="settings"></div><div class="page" data-page-id="tools"></div><div class="page" data-page-id="channels"></div><div class="chat-split-resize-handle" title="Drag to resize chat panel" hidden></div><shadow-claw-toast></shadow-claw-toast></main></div><shadow-claw-dialog dialog-class="app-dialog" dialog-aria-labelledby="appDialogTitle"><template><form method="dialog" class="app-confirm-dialog__form"><h2 id="appDialogTitle" class="app-dialog__title">Confirm</h2><p class="app-dialog__message"></p><ul class="app-dialog__details" hidden></ul><div class="app-dialog__links" hidden></div><p class="app-dialog__countdown" hidden role="status" aria-live="polite" aria-atomic="true"></p><div class="app-confirm-dialog__actions"><button type="submit" value="cancel" class="app-dialog__btn app-dialog__btn--cancel"> Cancel </button><button type="submit" value="confirm" class="app-dialog__btn app-dialog__btn--confirm"> Confirm </button></div></form></template></shadow-claw-dialog><shadow-claw-dialog dialog-class="app-dialog app-prompt-dialog" dialog-aria-labelledby="appPromptTitle"><template><form method="dialog" class="app-prompt-dialog__form"><h2 id="appPromptTitle" class="app-prompt-dialog__title"> Agent Question </h2><p class="app-prompt-dialog__message"></p><div class="app-prompt-dialog__input-area"></div><div class="app-prompt-dialog__actions"><button type="submit" value="submit" class="app-dialog__btn app-dialog__btn--confirm app-prompt-dialog__submit"> Submit </button></div></form></template></shadow-claw-dialog></div></template>
|
|
216
216
|
<a aria-label="ShadowClaw" class="header-title-link" href="https://xt-ml.github.io/shadow-claw/" slot="header-title-link"> <svg xmlns="http://www.w3.org/2000/svg" class="header-title-logo" viewBox="0 0 128 128"><rect width="128" height="128" fill="var(--shadow-claw-icon-bg)" rx="16"/><ellipse cx="64" cy="108" fill="var(--shadow-claw-icon-body)" rx="18" ry="12"/><ellipse cx="52" cy="112" fill="var(--shadow-claw-icon-accent-dark)" rx="8" ry="10"/><ellipse cx="76" cy="112" fill="var(--shadow-claw-icon-accent-dark)" rx="8" ry="10"/><ellipse cx="64" cy="92" fill="var(--shadow-claw-icon-body-segment)" rx="14" ry="8"/><ellipse cx="64" cy="82" fill="var(--shadow-claw-icon-body)" rx="12" ry="7"/><ellipse cx="64" cy="74" fill="var(--shadow-claw-icon-body-segment)" rx="10" ry="6"/><ellipse cx="64" cy="58" fill="var(--shadow-claw-icon-body)" rx="20" ry="18"/><ellipse cx="64" cy="50" fill="var(--shadow-claw-icon-body-segment)" rx="16" ry="10"/><rect width="18" height="8" x="28" y="45" fill="var(--shadow-claw-icon-body)" rx="4" transform="rotate(-20 37 49)"/><ellipse cx="20" cy="38" fill="var(--shadow-claw-icon-claw-main)" rx="14" ry="10"/><ellipse cx="16" cy="36" fill="var(--shadow-claw-icon-claw-inner)" rx="10" ry="7"/><ellipse cx="12" cy="34" fill="var(--shadow-claw-icon-accent-dark)" rx="5" ry="4"/><rect width="18" height="8" x="82" y="45" fill="var(--shadow-claw-icon-body)" rx="4" transform="rotate(20 91 49)"/><ellipse cx="108" cy="38" fill="var(--shadow-claw-icon-claw-main)" rx="14" ry="10"/><ellipse cx="112" cy="36" fill="var(--shadow-claw-icon-claw-inner)" rx="10" ry="7"/><ellipse cx="116" cy="34" fill="var(--shadow-claw-icon-accent-dark)" rx="5" ry="4"/><rect width="12" height="4" x="38" y="62" fill="var(--shadow-claw-icon-accent-dark)" rx="2" transform="rotate(-30 44 64)"/><rect width="14" height="4" x="36" y="68" fill="var(--shadow-claw-icon-accent-dark)" rx="2" transform="rotate(-25 43 70)"/><rect width="12" height="4" x="38" y="74" fill="var(--shadow-claw-icon-accent-dark)" rx="2" transform="rotate(-20 44 76)"/><rect width="12" height="4" x="78" y="62" fill="var(--shadow-claw-icon-accent-dark)" rx="2" transform="rotate(30 84 64)"/><rect width="14" height="4" x="78" y="68" fill="var(--shadow-claw-icon-accent-dark)" rx="2" transform="rotate(25 85 70)"/><rect width="12" height="4" x="78" y="74" fill="var(--shadow-claw-icon-accent-dark)" rx="2" transform="rotate(20 84 76)"/><ellipse cx="64" cy="38" fill="var(--shadow-claw-icon-body)" rx="14" ry="12"/><circle cx="56" cy="34" r="5" fill="var(--shadow-claw-icon-eye)"/><circle cx="72" cy="34" r="5" fill="var(--shadow-claw-icon-eye)"/><circle cx="56" cy="33" r="2" fill="var(--shadow-claw-icon-eye-shine)"/><circle cx="72" cy="33" r="2" fill="var(--shadow-claw-icon-eye-shine)"/><path fill="none" stroke="var(--shadow-claw-icon-accent-dark)" stroke-linecap="round" stroke-width="2" d="M60 42q4 4 8 0"/><path fill="none" stroke="var(--shadow-claw-icon-accent-dark)" stroke-linecap="round" stroke-width="3" d="M58 26Q50 14 42 8m28 18q8-12 16-18"/><path fill="none" stroke="var(--shadow-claw-icon-body)" stroke-linecap="round" stroke-width="2" d="M60 24q-6-8-10-14m18 14q6-8 10-14"/><ellipse cx="60" cy="55" fill="var(--shadow-claw-icon-body-shine)" opacity=".4" rx="6" ry="8"/></svg> <h1 class="header-title">ShadowClaw</h1> </a> <a aria-label="Shadow Claw Project on GitHub" class="header-actions-logo-link" href="https://github.com/xt-ml/shadow-claw" slot="header-actions-logo"> <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" viewBox="0 0 496 512"><path fill="var(--shadow-claw-bg-primary-reverse, currentColor)" d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6m-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3m44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9M244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8"/></svg> </a> <noscript> <div style="line-height:1.6;margin:0 auto;max-width:50rem;padding:2rem"> <h2>Browser-Native Personal AI Assistant</h2> <p> ShadowClaw is an open-source, browser-native AI assistant designed for autonomous orchestration, client-side tool execution, and private local storage via Origin Private File System (OPFS) and IndexedDB. </p> <h3>Agent & Developer Resources</h3> <ul> <li><a href="llms.txt">llms.txt (Agent Context & Guidance)</a></li> <li> <a href=".well-known/mcp.json">MCP Server Card (SEP-2127)</a> </li> <li> <a href=".well-known/ai-catalog.json">AI Catalog Discovery</a> </li> <li> <a href=".well-known/mcp/servers.json">MCP Servers Manifest</a> </li> <li><a href="sitemap.xml">XML Sitemap</a></li> <li> <a href="https://github.com/xt-ml/shadow-claw">GitHub Repository</a> </li> </ul> </div> </noscript>
|
|
217
217
|
</shadow-claw> <script type="module" src="index.js"></script> <script type="module">try{self[`workbox:window:7.4.0`]&&_()}catch{}function e(e,t){return new Promise((function(n){var r=new MessageChannel;r.port1.onmessage=function(e){n(e.data)},e.postMessage(t,[r.port2])}))}function t(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function n(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,a(r.key),r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function r(e,n){var r=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,n){if(e){if(typeof e==`string`)return t(e,n);var r={}.toString.call(e).slice(8,-1);return r===`Object`&&e.constructor&&(r=e.constructor.name),r===`Map`||r===`Set`?Array.from(e):r===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?t(e,n):void 0}}(e))||n){r&&(e=r);var i=0;return function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
218
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function i(e,t){return i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},i(e,t)}function a(e){var t=function(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return String(e)}(e,`string`);return typeof t==`symbol`?t:t+``}try{self[`workbox:core:7.4.0`]&&_()}catch{}var o=function(){var e=this;this.promise=new Promise((function(t,n){e.resolve=t,e.reject=n}))};function s(e,t){var n=location.href;return new URL(e,n).href===new URL(t,n).href}var c=function(e,t){this.type=e,Object.assign(this,t)};function l(e,t,n){return e&&e.then||(e=Promise.resolve(e)),t?e.then(t):e}function u(){}var d={type:`SKIP_WAITING`};function f(e,t){return e&&e.then?e.then(u):Promise.resolve()}var p=function(t){function r(e,n){var r,i;return n===void 0&&(n={}),(r=t.call(this)||this).nn={},r.tn=0,r.rn=new o,r.en=new o,r.on=new o,r.un=0,r.an=new Set,r.cn=function(){var e=r.fn,t=e.installing;r.tn>0||!s(t.scriptURL,r.sn.toString())||performance.now()>r.un+6e4?(r.vn=t,e.removeEventListener(`updatefound`,r.cn)):(r.hn=t,r.an.add(t),r.rn.resolve(t)),++r.tn,t.addEventListener(`statechange`,r.ln)},r.ln=function(e){var t=r.fn,n=e.target,i=n.state,a=n===r.vn,o={sw:n,isExternal:a,originalEvent:e};!a&&r.mn&&(o.isUpdate=!0),r.dispatchEvent(new c(i,o)),i===`installed`?r.wn=self.setTimeout((function(){i===`installed`&&t.waiting===n&&r.dispatchEvent(new c(`waiting`,o))}),200):i===`activating`&&(clearTimeout(r.wn),a||r.en.resolve(n))},r.yn=function(e){var t=r.hn,n=t!==navigator.serviceWorker.controller;r.dispatchEvent(new c(`controlling`,{isExternal:n,originalEvent:e,sw:t,isUpdate:r.mn})),n||r.on.resolve(t)},r.gn=(i=function(e){var t=e.data,n=e.ports,i=e.source;return l(r.getSW(),(function(){r.an.has(i)&&r.dispatchEvent(new c(`message`,{data:t,originalEvent:e,ports:n,sw:i}))}))},function(){var e=[...arguments];try{return Promise.resolve(i.apply(this,e))}catch(e){return Promise.reject(e)}}),r.sn=e,r.nn=n,navigator.serviceWorker.addEventListener(`message`,r.gn),r}var a,u=t;(a=r).prototype=Object.create(u.prototype),a.prototype.constructor=a,i(a,u);var p=r.prototype;return p.register=function(e){var t=(e===void 0?{}:e).immediate,n=t!==void 0&&t;try{var r=this;return l(function(e,t){var n=e();return n&&n.then?n.then(t):t(n)}((function(){if(!n&&document.readyState!==`complete`)return f(new Promise((function(e){return window.addEventListener(`load`,e)})))}),(function(){return r.mn=!!navigator.serviceWorker.controller,r.dn=r.pn(),l(r.bn(),(function(e){r.fn=e,r.dn&&(r.hn=r.dn,r.en.resolve(r.dn),r.on.resolve(r.dn),r.dn.addEventListener(`statechange`,r.ln,{once:!0}));var t=r.fn.waiting;return t&&s(t.scriptURL,r.sn.toString())&&(r.hn=t,Promise.resolve().then((function(){r.dispatchEvent(new c(`waiting`,{sw:t,wasWaitingBeforeRegister:!0}))})).then((function(){}))),r.hn&&(r.rn.resolve(r.hn),r.an.add(r.hn)),r.fn.addEventListener(`updatefound`,r.cn),navigator.serviceWorker.addEventListener(`controllerchange`,r.yn),r.fn}))})))}catch(e){return Promise.reject(e)}},p.update=function(){try{return this.fn?l(f(this.fn.update())):l()}catch(e){return Promise.reject(e)}},p.getSW=function(){return this.hn===void 0?this.rn.promise:Promise.resolve(this.hn)},p.messageSW=function(t){try{return l(this.getSW(),(function(n){return e(n,t)}))}catch(e){return Promise.reject(e)}},p.messageSkipWaiting=function(){this.fn&&this.fn.waiting&&e(this.fn.waiting,d)},p.pn=function(){var e=navigator.serviceWorker.controller;return e&&s(e.scriptURL,this.sn.toString())?e:void 0},p.bn=function(){try{var e=this;return l(function(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}((function(){return l(navigator.serviceWorker.register(e.sn,e.nn),(function(t){return e.un=performance.now(),t}))}),(function(e){throw e})))}catch(e){return Promise.reject(e)}},n(r,[{key:`active`,get:function(){return this.en.promise}},{key:`controlling`,get:function(){return this.on.promise}}])}(function(){function e(){this.Pn=new Map}var t=e.prototype;return t.addEventListener=function(e,t){this.jn(e).add(t)},t.removeEventListener=function(e,t){this.jn(e).delete(t)},t.dispatchEvent=function(e){e.target=this;for(var t,n=r(this.jn(e.type));!(t=n()).done;)(0,t.value)(e)},t.jn=function(e){return this.Pn.has(e)||this.Pn.set(e,new Set),this.Pn.get(e)},e}());const m=`__shadowClawDefaultTrustedTypesPolicyState`,h=`default`,g=`shadowclaw-sandbox`;function v(){let e=globalThis;return e[m]||(e[m]={initialized:!1,policy:null}),e[m]}function y(){let e=v();if(e.initialized)return;let t=Reflect.get(globalThis,`trustedTypes`);if(!(!t||typeof t.createPolicy!=`function`)){e.initialized=!0;try{if(typeof t.getPolicy==`function`){let n=t.getPolicy(h);if(n){e.policy=n;return}}let n=!1;if(typeof t.getPolicyNames==`function`){let e=t.getPolicyNames();Array.isArray(e)&&e.includes(h)&&(n=!0)}if(n){if(typeof t.getPolicy==`function`){let n=t.getPolicy(g);if(n){e.policy=n;return}}e.policy=t.createPolicy(g,{createHTML:e=>e,createScriptURL:e=>e});return}e.policy=t.createPolicy(h,{createHTML:e=>e,createScriptURL:e=>e})}catch{typeof t.getPolicy==`function`&&(e.policy=t.getPolicy(h)??t.getPolicy(g)??null)}}}function b(e){y();let t=v().policy;return!t||typeof t.createScriptURL!=`function`?e:t.createScriptURL(e)}const x=`shadowclaw-sw-update-intent`,
|
|
218
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function i(e,t){return i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},i(e,t)}function a(e){var t=function(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return String(e)}(e,`string`);return typeof t==`symbol`?t:t+``}try{self[`workbox:core:7.4.0`]&&_()}catch{}var o=function(){var e=this;this.promise=new Promise((function(t,n){e.resolve=t,e.reject=n}))};function s(e,t){var n=location.href;return new URL(e,n).href===new URL(t,n).href}var c=function(e,t){this.type=e,Object.assign(this,t)};function l(e,t,n){return e&&e.then||(e=Promise.resolve(e)),t?e.then(t):e}function u(){}var d={type:`SKIP_WAITING`};function f(e,t){return e&&e.then?e.then(u):Promise.resolve()}var p=function(t){function r(e,n){var r,i;return n===void 0&&(n={}),(r=t.call(this)||this).nn={},r.tn=0,r.rn=new o,r.en=new o,r.on=new o,r.un=0,r.an=new Set,r.cn=function(){var e=r.fn,t=e.installing;r.tn>0||!s(t.scriptURL,r.sn.toString())||performance.now()>r.un+6e4?(r.vn=t,e.removeEventListener(`updatefound`,r.cn)):(r.hn=t,r.an.add(t),r.rn.resolve(t)),++r.tn,t.addEventListener(`statechange`,r.ln)},r.ln=function(e){var t=r.fn,n=e.target,i=n.state,a=n===r.vn,o={sw:n,isExternal:a,originalEvent:e};!a&&r.mn&&(o.isUpdate=!0),r.dispatchEvent(new c(i,o)),i===`installed`?r.wn=self.setTimeout((function(){i===`installed`&&t.waiting===n&&r.dispatchEvent(new c(`waiting`,o))}),200):i===`activating`&&(clearTimeout(r.wn),a||r.en.resolve(n))},r.yn=function(e){var t=r.hn,n=t!==navigator.serviceWorker.controller;r.dispatchEvent(new c(`controlling`,{isExternal:n,originalEvent:e,sw:t,isUpdate:r.mn})),n||r.on.resolve(t)},r.gn=(i=function(e){var t=e.data,n=e.ports,i=e.source;return l(r.getSW(),(function(){r.an.has(i)&&r.dispatchEvent(new c(`message`,{data:t,originalEvent:e,ports:n,sw:i}))}))},function(){var e=[...arguments];try{return Promise.resolve(i.apply(this,e))}catch(e){return Promise.reject(e)}}),r.sn=e,r.nn=n,navigator.serviceWorker.addEventListener(`message`,r.gn),r}var a,u=t;(a=r).prototype=Object.create(u.prototype),a.prototype.constructor=a,i(a,u);var p=r.prototype;return p.register=function(e){var t=(e===void 0?{}:e).immediate,n=t!==void 0&&t;try{var r=this;return l(function(e,t){var n=e();return n&&n.then?n.then(t):t(n)}((function(){if(!n&&document.readyState!==`complete`)return f(new Promise((function(e){return window.addEventListener(`load`,e)})))}),(function(){return r.mn=!!navigator.serviceWorker.controller,r.dn=r.pn(),l(r.bn(),(function(e){r.fn=e,r.dn&&(r.hn=r.dn,r.en.resolve(r.dn),r.on.resolve(r.dn),r.dn.addEventListener(`statechange`,r.ln,{once:!0}));var t=r.fn.waiting;return t&&s(t.scriptURL,r.sn.toString())&&(r.hn=t,Promise.resolve().then((function(){r.dispatchEvent(new c(`waiting`,{sw:t,wasWaitingBeforeRegister:!0}))})).then((function(){}))),r.hn&&(r.rn.resolve(r.hn),r.an.add(r.hn)),r.fn.addEventListener(`updatefound`,r.cn),navigator.serviceWorker.addEventListener(`controllerchange`,r.yn),r.fn}))})))}catch(e){return Promise.reject(e)}},p.update=function(){try{return this.fn?l(f(this.fn.update())):l()}catch(e){return Promise.reject(e)}},p.getSW=function(){return this.hn===void 0?this.rn.promise:Promise.resolve(this.hn)},p.messageSW=function(t){try{return l(this.getSW(),(function(n){return e(n,t)}))}catch(e){return Promise.reject(e)}},p.messageSkipWaiting=function(){this.fn&&this.fn.waiting&&e(this.fn.waiting,d)},p.pn=function(){var e=navigator.serviceWorker.controller;return e&&s(e.scriptURL,this.sn.toString())?e:void 0},p.bn=function(){try{var e=this;return l(function(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}((function(){return l(navigator.serviceWorker.register(e.sn,e.nn),(function(t){return e.un=performance.now(),t}))}),(function(e){throw e})))}catch(e){return Promise.reject(e)}},n(r,[{key:`active`,get:function(){return this.en.promise}},{key:`controlling`,get:function(){return this.on.promise}}])}(function(){function e(){this.Pn=new Map}var t=e.prototype;return t.addEventListener=function(e,t){this.jn(e).add(t)},t.removeEventListener=function(e,t){this.jn(e).delete(t)},t.dispatchEvent=function(e){e.target=this;for(var t,n=r(this.jn(e.type));!(t=n()).done;)(0,t.value)(e)},t.jn=function(e){return this.Pn.has(e)||this.Pn.set(e,new Set),this.Pn.get(e)},e}());const m=`__shadowClawDefaultTrustedTypesPolicyState`,h=`default`,g=`shadowclaw-sandbox`;function v(){let e=globalThis;return e[m]||(e[m]={initialized:!1,policy:null}),e[m]}function y(){let e=v();if(e.initialized)return;let t=Reflect.get(globalThis,`trustedTypes`);if(!(!t||typeof t.createPolicy!=`function`)){e.initialized=!0;try{if(typeof t.getPolicy==`function`){let n=t.getPolicy(h);if(n){e.policy=n;return}}let n=!1;if(typeof t.getPolicyNames==`function`){let e=t.getPolicyNames();Array.isArray(e)&&e.includes(h)&&(n=!0)}if(n){if(typeof t.getPolicy==`function`){let n=t.getPolicy(g);if(n){e.policy=n;return}}e.policy=t.createPolicy(g,{createHTML:e=>e,createScriptURL:e=>e});return}e.policy=t.createPolicy(h,{createHTML:e=>e,createScriptURL:e=>e})}catch{typeof t.getPolicy==`function`&&(e.policy=t.getPolicy(h)??t.getPolicy(g)??null)}}}function b(e){y();let t=v().policy;return!t||typeof t.createScriptURL!=`function`?e:t.createScriptURL(e)}const x=`shadowclaw-oac-reload-attempted`,S=`shadowclaw-sw-update-intent`,C=3e4,w=`shadowclaw-sw-update-failure`;let T=!1,E=null;async function D(e=5e3){let t=Date.now();for(;Date.now()-t<e;){let e=document.querySelector(`shadow-claw`);if(e&&typeof e.requestDialog==`function`)return e;await new Promise(e=>{globalThis.setTimeout(e,50)})}return null}async function O(){let e=await D();return e?.requestDialog?await e.requestDialog({title:`Update Available`,message:`A new version of ShadowClaw is ready. Reload now to apply the update?`,confirmLabel:`Reload now`,cancelLabel:`Later`}):!1}async function k(){let e=await D();e?.requestDialog&&await e.requestDialog({title:`Update Failed`,message:`The app update failed to install automatically. Please try restarting your browser to complete the update.`,confirmLabel:`OK`}),console.warn(`[ShadowClaw] Service worker update failed. Please restart your browser to complete the update.`)}function A(){try{let e=globalThis.sessionStorage?.getItem(S);if(!e)return null;let t=JSON.parse(e);return typeof t.startedAt!=`number`||typeof t.fallbackReloadAttempts!=`number`?null:{startedAt:t.startedAt,fallbackReloadAttempts:t.fallbackReloadAttempts}}catch{return null}}function j(e){try{globalThis.sessionStorage?.setItem(S,JSON.stringify(e))}catch{}}function M(){try{globalThis.sessionStorage?.removeItem(S)}catch{}}function N(){let e=A();return e?Date.now()-e.startedAt<=C?!0:(M(),!1):!1}function P(){L(),j({startedAt:Date.now(),fallbackReloadAttempts:0})}function F(){try{let e=globalThis.sessionStorage?.getItem(w);if(!e)return null;let t=JSON.parse(e);return typeof t.failedAt==`number`?{failedAt:t.failedAt}:null}catch{return null}}function I(e){try{globalThis.sessionStorage?.setItem(w,JSON.stringify(e))}catch{}}function L(){try{globalThis.sessionStorage?.removeItem(w)}catch{}}function R(){let e=F();return e?Date.now()-e.failedAt<=3e5?!0:(L(),!1):!1}function z(){M(),I({failedAt:Date.now()})}function B(){if(T)return;T=!0,E!==null&&(globalThis.clearTimeout(E),E=null);let e=globalThis.location;typeof e?.reload==`function`&&e.reload()}async function V(){if(T||E!==null)return;let e=A();if(e){if(Date.now()-e.startedAt>C){M();return}if(e.fallbackReloadAttempts>=2){z(),await k();return}j({...e,fallbackReloadAttempts:e.fallbackReloadAttempts+1}),E=globalThis.setTimeout(()=>{B()},3e3)}}async function H(e){e.messageSkipWaiting(),await V()}function U(){return N()}function W(){if(globalThis.originAgentCluster!==!1)return!1;let e=globalThis.location?.protocol;if(e!==`http:`&&e!==`https:`)return!1;try{return!globalThis.sessionStorage?.getItem(x)}catch{return!1}}function G(){try{globalThis.sessionStorage?.setItem(x,`1`)}catch{return}B()}function K(){let e=U();if(M(),L(),e){B();return}W()&&G()}try{if(typeof navigator<`u`&&`serviceWorker`in navigator&&navigator.serviceWorker){y();let e=new p(b(`service-worker.js`));e.addEventListener(`waiting`,async()=>{if(!R()){if(N()){await H(e);return}await O()&&(P(),await H(e))}}),e.addEventListener(`controlling`,()=>{K()}),navigator.serviceWorker.addEventListener(`controllerchange`,()=>{K()});let t=()=>{globalThis.setTimeout(()=>{e.register()},1e4)};document.readyState===`complete`?t():globalThis.addEventListener(`load`,t)}}catch{}export{B as reloadCurrentPage,U as shouldReloadAfterControllerChange,W as shouldReloadForOriginAgentCluster};</script> </body></html>
|