tmux-weblink 3.1.1 → 3.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import{execFileSync as v}from"node:child_process";import{mkdirSync as m,readFileSync as w,rmSync as x,writeFileSync as I}from"node:fs";import p from"node:path";import k from"node:os";import{getBotStore as A}from"./store.js";import{materialize as B}from"./materialize.js";import{PiRpc as M}from"./rpc.js";import{buildCatalog as O,ORCHESTRATION_TOOLS as j,READONLY_TOOLS as D}from"./catalog.js";import{TERMINAL_STATUSES as d}from"./types.js";const f=4,_=8,P=["starting","running","waiting_input","waiting_approval"];class b{store=A();token;apiBase;runtimes=new Map;sockets=new Map;listeners=new Set;approvals=new Map;recent=new Map;streaming=new Set;constructor(t){this.token=this.store.token,this.apiBase=`http://127.0.0.1:${t}/api/bots`;for(const e of this.store.listInstances()){let s=!1;!d.includes(e.status)&&e.status!=="queued"&&(e.status="stale",s=!0);const n=g(e.runtimeMode);n!==e.runtimeMode&&(e.runtimeMode=n,s=!0),s&&this.store.saveInstance(e)}}listTemplates(){return this.store.listTemplates()}getTemplate(t){return this.store.getTemplate(t)}saveTemplate(t){return this.store.saveTemplate(t)}deleteTemplate(t){return this.store.deleteTemplate(t)}catalog(){return O()}listBots(t={}){return this.store.listInstances().filter(s=>!(t.project&&s.projectPath!==t.project||t.parentBotId&&s.parentBotId!==t.parentBotId||t.status&&s.status!==t.status))}getBot(t){return this.store.getInstance(t)}children(t){return this.store.listInstances().filter(e=>e.parentBotId===t)}createInstance(t){const e=this.getTemplate(t.templateId);if(!e)throw new Error(`unknown template: ${t.templateId}`);let s=null;if(t.parentBotId){if(s=this.getBot(t.parentBotId),!s)throw new Error("parent bot not found");if(s.depth+1>f)throw new Error(`nesting depth limit is ${f}`)}let n=t.projectPath||s?.projectPath||process.env.HOME||"/";n==="~"?n=k.homedir():n.startsWith("~/")&&(n=p.join(k.homedir(),n.slice(2)));const r=p.resolve(n),o=this.store.newId(),i=t.isolation||"shared";let u=r;if(i==="worktree"){const h=p.join(this.store.root,"worktrees",o);try{m(p.dirname(h),{recursive:!0,mode:448}),v("git",["-C",r,"worktree","add","-b",`tw-bot/${o.slice(0,8)}`,h],{timeout:2e4,stdio:"ignore"}),u=h}catch{u=r}}const a=new Date().toISOString(),c={id:o,templateId:e.id,title:t.title||e.manifest.name,projectPath:r,workspacePath:u,isolation:i,parentBotId:s?.id,depth:s?s.depth+1:0,runtimeMode:g(t.runtimeMode||e.manifest.permissions?.runtimeMode),projectResources:e.manifest.projectResources||"ignore",status:"queued",sessionFile:p.join(this.store.sessionsDir(o),`${o}.jsonl`),createdAt:a,updatedAt:a,model:e.manifest.model};return m(this.store.sessionsDir(o),{recursive:!0,mode:448}),this.store.saveInstance(c),this.emit(c.id,{type:"status",status:"queued",at:a}),this.pump(),c}activeInProject(t){return this.store.listInstances().filter(e=>e.projectPath===t&&!d.includes(e.status)&&e.status!=="queued").length}pump(){for(const t of this.store.listInstances())t.status==="queued"&&(this.activeInProject(t.projectPath)>=_||this.start(t))}start(t){const e=this.getTemplate(t.templateId);if(!e){this.setStatus(t.id,"failed","template disappeared");return}const s=B(e,t,{apiBase:this.apiBase,token:this.token}),n=e.manifest.binaryPath||"pi",r=new M({command:n,args:s.args,cwd:t.workspacePath,env:s.env,onEvent:o=>this.handleEvent(t.id,o),onStderr:o=>{/error|failed/i.test(o)&&this.emit(t.id,{type:"notice",level:"warn",text:o.slice(0,500),at:new Date().toISOString()})},onExit:()=>{this.runtimes.delete(t.id),this.streaming.delete(t.id);const o=this.store.getInstance(t.id);o&&!d.includes(o.status)&&this.setStatus(t.id,"failed","pi exited unexpectedly"),this.pump()}});this.runtimes.set(t.id,r),t.status="starting",t.pid=void 0,this.store.saveInstance(t),this.emit(t.id,{type:"status",status:"starting",at:new Date().toISOString()}),r.start()}handleEvent(t,e){const s=String(e.type||""),n=new Date().toISOString();switch(s){case"agent_start":this.streaming.add(t),this.setStatus(t,"running");break;case"agent_end":break;case"agent_settled":this.streaming.delete(t),this.setStatus(t,e.aborted===!0?"cancelled":"completed");break;case"message_start":case"message_end":{const r=e.message;if(r){if(s==="message_end"&&r.role==="assistant"){const o=this.store.getInstance(t),i=N(r);o&&i&&(o.lastText=i,this.store.saveInstance(o))}this.emit(t,{type:"message",message:r,at:n})}break}case"message_update":{const r=e.assistantMessageEvent;if(!r)break;const o=r.type==="text_delta"?"text":r.type==="thinking_delta"?"thinking":r.type==="toolcall_delta"?"tool-args":null;if(!o)break;const i=e.message;this.emit(t,{type:"delta",kind:o,delta:String(r.delta||""),contentIndex:typeof r.contentIndex=="number"?r.contentIndex:void 0,messageId:typeof i?.id=="string"?i.id:void 0,at:n});break}case"tool_execution_start":this.emit(t,{type:"tool",phase:"start",callId:String(e.toolCallId||""),name:String(e.toolName||"tool"),args:e.args,at:n});break;case"tool_execution_update":this.emit(t,{type:"tool",phase:"update",callId:String(e.toolCallId||""),name:String(e.toolName||"tool"),output:E(e.partialResult),at:n});break;case"tool_execution_end":this.emit(t,{type:"tool",phase:"end",callId:String(e.toolCallId||""),name:String(e.toolName||"tool"),output:E(e.result),isError:e.isError===!0,durationMs:typeof e.durationMs=="number"?e.durationMs:void 0,at:n});break;case"extension_ui_request":this.handleUiRequest(t,e);break;default:break}}handleUiRequest(t,e){const s=String(e.method||""),n=new Date().toISOString(),r=this.store.getInstance(t);if(s==="notify"){this.emit(t,{type:"notice",level:e.notifyType==="error"?"error":e.notifyType==="warning"?"warn":"info",text:String(e.message||""),at:n});return}if(!["confirm","select","input","editor"].includes(s))return;const o=String(e.id||""),i=o?this.approvals.get(t)?.get(o):void 0;if(i&&i.state==="pending")return;const u=String(e.title||"Approval required"),a=/^Allow (.+?)\?$/.exec(u),c={id:String(e.id||""),botId:t,botTitle:r?.title||t,kind:s==="confirm"?"tool":"question",method:s,title:u,toolName:a?a[1]:void 0,message:typeof e.message=="string"?e.message:void 0,options:Array.isArray(e.options)?e.options.map(String):void 0,state:"pending",createdAt:n};if(this.approvals.has(t)||this.approvals.set(t,new Map),this.approvals.get(t).set(c.id,c),r&&r.runtimeMode==="parent-supervised"&&r.parentBotId){const h=this.store.getInstance(r.parentBotId);if(h){c.escalatedTo=h.id;const S=c.message?c.message.slice(0,500):"",T=[`Child bot "${r.title}" (${r.id}) needs approval: ${c.title}`,S?`Arguments: ${S}`:"",`Decide with bot_approve({ botId: "${r.id}", requestId: "${c.id}", allow: true|false, reason: "..." }).`,"If you do nothing the user will answer it."].filter(Boolean).join(`
2
- `);this.input(h.id,T,"steer").catch(()=>{this.emit(t,{type:"notice",level:"warn",text:"Could not reach the supervising bot; waiting for the user.",at:n})})}}this.setStatus(t,"waiting_approval"),this.emit(t,{type:"approval",approval:c,at:n})}allowTool(t,e){if(!this.store.getInstance(t))throw new Error("bot not found");const n=p.join(this.store.agentDir(t),".allowed-tools");let r=[];try{r=JSON.parse(w(n,"utf8")),Array.isArray(r)||(r=[])}catch{r=[]}return r.includes(e)||r.push(e),m(p.dirname(n),{recursive:!0,mode:448}),I(n,`${JSON.stringify(r)}
3
- `,{mode:384}),r}allowedTools(t){try{const e=JSON.parse(w(p.join(this.store.agentDir(t),".allowed-tools"),"utf8"));return Array.isArray(e)?e.map(String):[]}catch{return[]}}setRuntimeMode(t,e){const s=this.store.getInstance(t);if(!s)throw new Error("bot not found");s.runtimeMode=g(e),this.store.saveInstance(s);const n=p.join(this.store.agentDir(t),".runtime-mode");m(p.dirname(n),{recursive:!0,mode:448}),I(n,`${s.runtimeMode}
4
- `,{mode:384}),this.emit(t,{type:"notice",level:"info",text:`Approval mode: ${e}`,at:new Date().toISOString()})}respondApproval(t,e,s,n,r="human",o=!1){const i=this.approvals.get(t)?.get(e);if(!i)throw new Error("approval not found");const u=this.runtimes.get(t);if(!u)throw new Error("bot is not running");const a={type:"extension_ui_response",id:e};i.method==="confirm"?a.confirmed=s:i.method==="select"?a.value=s?i.options?.[0]:i.options?.[1]||i.options?.[0]:s?a.value=n||"":a.cancelled=!0,u.send(a),s&&o&&i.toolName&&this.allowTool(t,i.toolName),i.state=s?"allowed":"denied",i.decidedBy=r,i.reason=n,i.decidedAt=new Date().toISOString();try{this.store.appendEvent(t,{type:"approval",approval:i,at:i.decidedAt})}catch{}return this.broadcast(t,{type:"approval",approval:i,at:i.decidedAt}),this.setStatus(t,"running"),i}listApprovals(){const t=[];for(const[,e]of this.approvals)for(const s of e.values())s.state==="pending"&&t.push(s);return t.sort((e,s)=>e.createdAt.localeCompare(s.createdAt))}async input(t,e,s){const n=this.store.getInstance(t);if(!n)throw new Error("bot not found");if(!this.runtimes.has(t)){this.resume(t);const a=Date.now()+1e4;for(;!this.runtimes.has(t)&&Date.now()<a;)await new Promise(c=>setTimeout(c,150))}const r=this.runtimes.get(t);if(!r){const a=this.store.getInstance(t)?.status;throw new Error(a==="queued"?"bot is queued behind other bots in this project; send again once it starts":"bot is still starting; send again in a moment")}const o=new Date().toISOString();this.emit(t,{type:"user",text:e,at:o});const i={type:"prompt",message:e},u=this.streaming.has(t)||P.includes(n.status);s==="follow_up"?i.streamingBehavior="followUp":(s==="steer"||u)&&(i.streamingBehavior="steer");try{await r.request(i,3e4)}catch(a){const c=a instanceof Error?a.message:String(a);if(!i.streamingBehavior&&/stream/i.test(c)){await r.request({...i,streamingBehavior:"steer"},3e4);return}throw a}}stop(t,e=!0){const s=this.store.getInstance(t);if(!s)throw new Error("bot not found");if(e)for(const n of this.children(t))this.stop(n.id,!0);try{this.runtimes.get(t)?.kill()}catch{}this.runtimes.delete(t),this.streaming.delete(t),d.includes(s.status)||this.setStatus(t,"cancelled"),this.pump()}resume(t){const e=this.store.getInstance(t);if(!e)throw new Error("bot not found");this.runtimes.has(t)||(e.status="queued",this.store.saveInstance(e),this.emit(t,{type:"status",status:"queued",at:new Date().toISOString()}),this.pump())}deleteBot(t,e=!0){const s=this.store.getInstance(t);if(!s)throw new Error("bot not found");if(e)for(const n of this.children(t))this.deleteBot(n.id,!0);try{this.runtimes.get(t)?.kill()}catch{}if(this.runtimes.delete(t),this.streaming.delete(t),this.store.deleteInstance(t),this.approvals.delete(t),this.recent.delete(t),s.isolation==="worktree"){try{v("git",["-C",s.projectPath,"worktree","remove","--force",s.workspacePath],{timeout:2e4,stdio:"ignore"})}catch{}x(s.workspacePath,{recursive:!0,force:!0})}this.pump()}status(t){const e=this.store.getInstance(t);if(!e)throw new Error("bot not found");const s=[...this.approvals.get(t)?.values()||[]].filter(n=>n.state==="pending");return{...e,pendingApprovals:s.length,lastText:e.lastText?.slice(0,4e3)}}result(t){const e=this.store.getInstance(t);if(!e)throw new Error("bot not found");return{botId:t,status:e.status,text:e.lastText||"",title:e.title}}async waitFor(t,e=45e3){const s=Date.now()+Math.min(e,45e3),n=new Set(t);for(;Date.now()<s;){const r=[...n].filter(o=>{const i=this.store.getInstance(o);return!i||d.includes(i.status)});if(r.length)return{bots:r.map(o=>this.result(o))};await new Promise(o=>setTimeout(o,250))}return{timeout:!0,bots:t.map(r=>{const o=this.store.getInstance(r);return{botId:r,status:o?.status||"missing",title:o?.title}})}}attachSocket(t,e){this.sockets.has(t)||this.sockets.set(t,new Set),this.sockets.get(t).add(e);const s=this.store.getInstance(t);e.send(JSON.stringify({type:"snapshot",bot:s,approvals:this.listApprovals().filter(n=>n.botId===t)}));for(const n of this.store.readEvents(t,400))e.send(JSON.stringify(n));e.on("close",()=>this.sockets.get(t)?.delete(e))}broadcast(t,e){const s=JSON.stringify(e);for(const n of this.sockets.get(t)||[])if(n.readyState===1)try{n.send(s)}catch{}}emit(t,e){this.store.appendEvent(t,e);const s=this.recent.get(t)||[];s.push(e),s.length>800&&s.splice(0,s.length-800),this.recent.set(t,s),this.broadcast(t,e);for(const n of this.listeners)try{n(e)}catch{}}onEvent(t){return this.listeners.add(t),()=>this.listeners.delete(t)}setStatus(t,e,s){const n=this.store.getInstance(t);n&&(n.status=e,s&&(n.lastError=s),this.store.saveInstance(n),this.emit(t,{type:"status",status:e,at:new Date().toISOString(),error:s}),d.includes(e)&&this.pump())}}function g(l){return l==="full-access"?"full-access":l==="parent-supervised"?"parent-supervised":"supervised"}function N(l){const t=l.content;return Array.isArray(t)?t.map(e=>e&&typeof e=="object"&&e.type==="text"?String(e.text||""):"").join("").trim():""}function E(l){if(l==null)return"";if(typeof l=="string")return l;try{return JSON.stringify(l).slice(0,4e3)}catch{return String(l)}}let y=null;function z(){if(!y){const l=Number(process.env.PORT)||21e3;y=new b(l)}return y}export{b as BotManager,_ as MAX_CONCURRENT_PER_PROJECT,f as MAX_DEPTH,j as ORCHESTRATION_TOOLS,D as READONLY_TOOLS,z as getBotManager};
1
+ import{execFileSync as v}from"node:child_process";import{mkdirSync as m,readFileSync as I,rmSync as A,writeFileSync as _}from"node:fs";import h from"node:path";import k from"node:os";import{getBotStore as B}from"./store.js";import{materialize as j}from"./materialize.js";import{PiRpc as M}from"./rpc.js";import{buildCatalog as O,ORCHESTRATION_TOOLS as b,READONLY_TOOLS as q}from"./catalog.js";import{TERMINAL_STATUSES as d}from"./types.js";const g=4,T=8,D=["starting","running","waiting_input","waiting_approval"];function f(c){return Array.isArray(c)?c.map(t=>{if(typeof t=="string")return t;if(!t||typeof t!="object")return"";const e=t;if(typeof e.text=="string")return e.text;const s=e.content;return Array.isArray(s)?s.map(n=>n&&typeof n=="object"&&typeof n.text=="string"?String(n.text):"").join(""):""}).map(t=>t.replace(/\s+/g," ").trim()).filter(Boolean):[]}class P{store=B();token;apiBase;runtimes=new Map;sockets=new Map;listeners=new Set;approvals=new Map;recent=new Map;streaming=new Set;constructor(t){this.token=this.store.token,this.apiBase=`http://127.0.0.1:${t}/api/bots`;for(const e of this.store.listInstances()){let s=!1;!d.includes(e.status)&&e.status!=="queued"&&(e.status="stale",s=!0);const n=y(e.runtimeMode);n!==e.runtimeMode&&(e.runtimeMode=n,s=!0),s&&this.store.saveInstance(e)}}listTemplates(){return this.store.listTemplates()}getTemplate(t){return this.store.getTemplate(t)}saveTemplate(t){return this.store.saveTemplate(t)}deleteTemplate(t){return this.store.deleteTemplate(t)}catalog(){return O()}listBots(t={}){return this.store.listInstances().filter(s=>!(t.project&&s.projectPath!==t.project||t.parentBotId&&s.parentBotId!==t.parentBotId||t.status&&s.status!==t.status))}getBot(t){return this.store.getInstance(t)}children(t){return this.store.listInstances().filter(e=>e.parentBotId===t)}createInstance(t){const e=this.getTemplate(t.templateId);if(!e)throw new Error(`unknown template: ${t.templateId}`);let s=null;if(t.parentBotId){if(s=this.getBot(t.parentBotId),!s)throw new Error("parent bot not found");if(s.depth+1>g)throw new Error(`nesting depth limit is ${g}`)}let n=t.projectPath||s?.projectPath||process.env.HOME||"/";n==="~"?n=k.homedir():n.startsWith("~/")&&(n=h.join(k.homedir(),n.slice(2)));const r=h.resolve(n),i=this.store.newId(),o=t.isolation||"shared";let l=r;if(o==="worktree"){const p=h.join(this.store.root,"worktrees",i);try{m(h.dirname(p),{recursive:!0,mode:448}),v("git",["-C",r,"worktree","add","-b",`tw-bot/${i.slice(0,8)}`,p],{timeout:2e4,stdio:"ignore"}),l=p}catch{l=r}}const u=new Date().toISOString(),a={id:i,templateId:e.id,title:t.title||e.manifest.name,projectPath:r,workspacePath:l,isolation:o,parentBotId:s?.id,depth:s?s.depth+1:0,runtimeMode:y(t.runtimeMode||e.manifest.permissions?.runtimeMode),projectResources:e.manifest.projectResources||"ignore",status:"queued",sessionFile:h.join(this.store.sessionsDir(i),`${i}.jsonl`),createdAt:u,updatedAt:u,model:e.manifest.model};return m(this.store.sessionsDir(i),{recursive:!0,mode:448}),this.store.saveInstance(a),this.emit(a.id,{type:"status",status:"queued",at:u}),this.pump(),a}activeInProject(t){return this.store.listInstances().filter(e=>e.projectPath===t&&!d.includes(e.status)&&e.status!=="queued").length}pump(){for(const t of this.store.listInstances())t.status==="queued"&&(this.activeInProject(t.projectPath)>=T||this.start(t))}start(t){const e=this.getTemplate(t.templateId);if(!e){this.setStatus(t.id,"failed","template disappeared");return}const s=j(e,t,{apiBase:this.apiBase,token:this.token}),n=e.manifest.binaryPath||"pi",r=new M({command:n,args:s.args,cwd:t.workspacePath,env:s.env,onEvent:i=>this.handleEvent(t.id,i),onStderr:i=>{/error|failed/i.test(i)&&this.emit(t.id,{type:"notice",level:"warn",text:i.slice(0,500),at:new Date().toISOString()})},onExit:()=>{this.runtimes.delete(t.id),this.streaming.delete(t.id);const i=this.store.getInstance(t.id);i&&!d.includes(i.status)&&this.setStatus(t.id,"failed","pi exited unexpectedly"),this.pump()}});this.runtimes.set(t.id,r),t.status="starting",t.pid=void 0,this.store.saveInstance(t),this.emit(t.id,{type:"status",status:"starting",at:new Date().toISOString()}),r.start()}handleEvent(t,e){const s=String(e.type||""),n=new Date().toISOString();switch(s){case"agent_start":this.streaming.add(t),this.setStatus(t,"running");break;case"agent_end":break;case"agent_settled":this.streaming.delete(t),this.setStatus(t,e.aborted===!0?"cancelled":"completed");break;case"message_start":case"message_end":{const r=e.message;if(r){if(s==="message_end"&&r.role==="assistant"){const i=this.store.getInstance(t),o=N(r);i&&o&&(i.lastText=o,this.store.saveInstance(i))}this.emit(t,{type:"message",message:r,at:n})}break}case"message_update":{const r=e.assistantMessageEvent;if(!r)break;const i=r.type==="text_delta"?"text":r.type==="thinking_delta"?"thinking":r.type==="toolcall_delta"?"tool-args":null;if(!i)break;const o=e.message;this.emit(t,{type:"delta",kind:i,delta:String(r.delta||""),contentIndex:typeof r.contentIndex=="number"?r.contentIndex:void 0,messageId:typeof o?.id=="string"?o.id:void 0,at:n});break}case"tool_execution_start":this.emit(t,{type:"tool",phase:"start",callId:String(e.toolCallId||""),name:String(e.toolName||"tool"),args:e.args,at:n});break;case"tool_execution_update":this.emit(t,{type:"tool",phase:"update",callId:String(e.toolCallId||""),name:String(e.toolName||"tool"),output:E(e.partialResult),at:n});break;case"tool_execution_end":this.emit(t,{type:"tool",phase:"end",callId:String(e.toolCallId||""),name:String(e.toolName||"tool"),output:E(e.result),isError:e.isError===!0,durationMs:typeof e.durationMs=="number"?e.durationMs:void 0,at:n});break;case"queue_update":this.emit(t,{type:"queue",steering:f(e.steering),followUp:f(e.followUp),at:n});break;case"extension_ui_request":this.handleUiRequest(t,e);break;default:break}}handleUiRequest(t,e){const s=String(e.method||""),n=new Date().toISOString(),r=this.store.getInstance(t);if(s==="notify"){this.emit(t,{type:"notice",level:e.notifyType==="error"?"error":e.notifyType==="warning"?"warn":"info",text:String(e.message||""),at:n});return}if(!["confirm","select","input","editor"].includes(s))return;const i=String(e.id||""),o=i?this.approvals.get(t)?.get(i):void 0;if(o&&o.state==="pending")return;const l=String(e.title||"Approval required"),u=/^Allow (.+?)\?$/.exec(l),a={id:String(e.id||""),botId:t,botTitle:r?.title||t,kind:s==="confirm"?"tool":"question",method:s,title:l,toolName:u?u[1]:void 0,message:typeof e.message=="string"?e.message:void 0,options:Array.isArray(e.options)?e.options.map(String):void 0,state:"pending",createdAt:n};if(this.approvals.has(t)||this.approvals.set(t,new Map),this.approvals.get(t).set(a.id,a),r&&r.runtimeMode==="parent-supervised"&&r.parentBotId){const p=this.store.getInstance(r.parentBotId);if(p){a.escalatedTo=p.id;const w=a.message?a.message.slice(0,500):"",x=[`Child bot "${r.title}" (${r.id}) needs approval: ${a.title}`,w?`Arguments: ${w}`:"",`Decide with bot_approve({ botId: "${r.id}", requestId: "${a.id}", allow: true|false, reason: "..." }).`,"If you do nothing the user will answer it."].filter(Boolean).join(`
2
+ `);this.input(p.id,x,"steer").catch(()=>{this.emit(t,{type:"notice",level:"warn",text:"Could not reach the supervising bot; waiting for the user.",at:n})})}}this.setStatus(t,"waiting_approval"),this.emit(t,{type:"approval",approval:a,at:n})}allowTool(t,e){if(!this.store.getInstance(t))throw new Error("bot not found");const n=h.join(this.store.agentDir(t),".allowed-tools");let r=[];try{r=JSON.parse(I(n,"utf8")),Array.isArray(r)||(r=[])}catch{r=[]}return r.includes(e)||r.push(e),m(h.dirname(n),{recursive:!0,mode:448}),_(n,`${JSON.stringify(r)}
3
+ `,{mode:384}),r}allowedTools(t){try{const e=JSON.parse(I(h.join(this.store.agentDir(t),".allowed-tools"),"utf8"));return Array.isArray(e)?e.map(String):[]}catch{return[]}}setRuntimeMode(t,e){const s=this.store.getInstance(t);if(!s)throw new Error("bot not found");s.runtimeMode=y(e),this.store.saveInstance(s);const n=h.join(this.store.agentDir(t),".runtime-mode");m(h.dirname(n),{recursive:!0,mode:448}),_(n,`${s.runtimeMode}
4
+ `,{mode:384}),this.emit(t,{type:"notice",level:"info",text:`Approval mode: ${e}`,at:new Date().toISOString()})}respondApproval(t,e,s,n,r="human",i=!1){const o=this.approvals.get(t)?.get(e);if(!o)throw new Error("approval not found");const l=this.runtimes.get(t);if(!l)throw new Error("bot is not running");const u={type:"extension_ui_response",id:e};o.method==="confirm"?u.confirmed=s:o.method==="select"?u.value=s?o.options?.[0]:o.options?.[1]||o.options?.[0]:s?u.value=n||"":u.cancelled=!0,l.send(u),s&&i&&o.toolName&&this.allowTool(t,o.toolName),o.state=s?"allowed":"denied",o.decidedBy=r,o.reason=n,o.decidedAt=new Date().toISOString();try{this.store.appendEvent(t,{type:"approval",approval:o,at:o.decidedAt})}catch{}return this.broadcast(t,{type:"approval",approval:o,at:o.decidedAt}),this.setStatus(t,"running"),o}listApprovals(){const t=[];for(const[,e]of this.approvals)for(const s of e.values())s.state==="pending"&&t.push(s);return t.sort((e,s)=>e.createdAt.localeCompare(s.createdAt))}async input(t,e,s,n){const r=this.store.getInstance(t);if(!r)throw new Error("bot not found");if(!this.runtimes.has(t)){this.resume(t);const a=Date.now()+1e4;for(;!this.runtimes.has(t)&&Date.now()<a;)await new Promise(p=>setTimeout(p,150))}const i=this.runtimes.get(t);if(!i){const a=this.store.getInstance(t)?.status;throw new Error(a==="queued"?"bot is queued behind other bots in this project; send again once it starts":"bot is still starting; send again in a moment")}const o=new Date().toISOString();this.emit(t,{type:"user",text:e,at:o});const l={type:"prompt",message:e};n?.length&&(l.images=n.map(a=>({type:"image",data:a.data,mimeType:a.mimeType})));const u=this.streaming.has(t)||D.includes(r.status);s==="follow_up"?l.streamingBehavior="followUp":(s==="steer"||u)&&(l.streamingBehavior="steer");try{await i.request(l,3e4)}catch(a){const p=a instanceof Error?a.message:String(a);if(!l.streamingBehavior&&/stream/i.test(p)){await i.request({...l,streamingBehavior:"steer"},3e4);return}throw a}}async clearQueue(t){const e=this.runtimes.get(t);if(!e)throw new Error("bot is not running");const n=(await e.request({type:"clear_queue"},1e4)).data??{};return[...f(n.steering),...f(n.followUp)]}stop(t,e=!0){const s=this.store.getInstance(t);if(!s)throw new Error("bot not found");if(e)for(const n of this.children(t))this.stop(n.id,!0);try{this.runtimes.get(t)?.kill()}catch{}this.runtimes.delete(t),this.streaming.delete(t),d.includes(s.status)||this.setStatus(t,"cancelled"),this.pump()}resume(t){const e=this.store.getInstance(t);if(!e)throw new Error("bot not found");this.runtimes.has(t)||(e.status="queued",this.store.saveInstance(e),this.emit(t,{type:"status",status:"queued",at:new Date().toISOString()}),this.pump())}deleteBot(t,e=!0){const s=this.store.getInstance(t);if(!s)throw new Error("bot not found");if(e)for(const n of this.children(t))this.deleteBot(n.id,!0);try{this.runtimes.get(t)?.kill()}catch{}if(this.runtimes.delete(t),this.streaming.delete(t),this.store.deleteInstance(t),this.approvals.delete(t),this.recent.delete(t),s.isolation==="worktree"){try{v("git",["-C",s.projectPath,"worktree","remove","--force",s.workspacePath],{timeout:2e4,stdio:"ignore"})}catch{}A(s.workspacePath,{recursive:!0,force:!0})}this.pump()}status(t){const e=this.store.getInstance(t);if(!e)throw new Error("bot not found");const s=[...this.approvals.get(t)?.values()||[]].filter(n=>n.state==="pending");return{...e,pendingApprovals:s.length,lastText:e.lastText?.slice(0,4e3)}}result(t){const e=this.store.getInstance(t);if(!e)throw new Error("bot not found");return{botId:t,status:e.status,text:e.lastText||"",title:e.title}}async waitFor(t,e=45e3){const s=Date.now()+Math.min(e,45e3),n=new Set(t);for(;Date.now()<s;){const r=[...n].filter(i=>{const o=this.store.getInstance(i);return!o||d.includes(o.status)});if(r.length)return{bots:r.map(i=>this.result(i))};await new Promise(i=>setTimeout(i,250))}return{timeout:!0,bots:t.map(r=>{const i=this.store.getInstance(r);return{botId:r,status:i?.status||"missing",title:i?.title}})}}attachSocket(t,e){this.sockets.has(t)||this.sockets.set(t,new Set),this.sockets.get(t).add(e);const s=this.store.getInstance(t);e.send(JSON.stringify({type:"snapshot",bot:s,approvals:this.listApprovals().filter(n=>n.botId===t)}));for(const n of this.store.readEvents(t,400))e.send(JSON.stringify(n));e.on("close",()=>this.sockets.get(t)?.delete(e))}broadcast(t,e){const s=JSON.stringify(e);for(const n of this.sockets.get(t)||[])if(n.readyState===1)try{n.send(s)}catch{}}emit(t,e){this.store.appendEvent(t,e);const s=this.recent.get(t)||[];s.push(e),s.length>800&&s.splice(0,s.length-800),this.recent.set(t,s),this.broadcast(t,e);for(const n of this.listeners)try{n(e)}catch{}}onEvent(t){return this.listeners.add(t),()=>this.listeners.delete(t)}setStatus(t,e,s){const n=this.store.getInstance(t);n&&(n.status=e,s&&(n.lastError=s),this.store.saveInstance(n),this.emit(t,{type:"status",status:e,at:new Date().toISOString(),error:s}),d.includes(e)&&this.pump())}}function y(c){return c==="full-access"?"full-access":c==="parent-supervised"?"parent-supervised":"supervised"}function N(c){const t=c.content;return Array.isArray(t)?t.map(e=>e&&typeof e=="object"&&e.type==="text"?String(e.text||""):"").join("").trim():""}function E(c){if(c==null)return"";if(typeof c=="string")return c;try{return JSON.stringify(c).slice(0,4e3)}catch{return String(c)}}let S=null;function X(){if(!S){const c=Number(process.env.PORT)||21e3;S=new P(c)}return S}export{P as BotManager,T as MAX_CONCURRENT_PER_PROJECT,g as MAX_DEPTH,b as ORCHESTRATION_TOOLS,q as READONLY_TOOLS,X as getBotManager};
@@ -1 +1 @@
1
- import{exportBots as m,importBots as j}from"./transfer.js";function f(s,l){const{manager:o,userAuth:u}=l,a=async(r,t)=>{const e=r.req.header("x-bots-token");return e&&e===o.token?t():u()(r,t)},c=()=>a,n=()=>u();s.get("/api/bots/catalog",n(),async r=>r.json(await o.catalog())),s.get("/api/bots/templates",n(),r=>r.json(o.listTemplates())),s.post("/api/bots/templates",n(),async r=>{const t=await r.req.json().catch(()=>null);if(!t||!t.manifest||typeof t.manifest.name!="string")return r.json({error:"manifest.name is required"},400);try{const e=o.saveTemplate({id:typeof t.id=="string"?t.id:void 0,manifest:t.manifest});return r.json(e,200)}catch(e){return r.json({error:e instanceof Error?e.message:String(e)},400)}}),s.get("/api/bots/export",n(),r=>{const t=m(o.store);return r.json(t,200,{"content-disposition":`attachment; filename="tmux-weblink-bots-${t.exportedAt.slice(0,10)}.json"`})}),s.post("/api/bots/import",n(),async r=>{const t=await r.req.json().catch(()=>null);if(!t)return r.json({error:"invalid bundle"},400);try{return r.json(j(o.store,t,{overwriteLibrary:t.overwriteLibrary===!0}))}catch(e){return r.json({error:e instanceof Error?e.message:String(e)},400)}}),s.delete("/api/bots/templates/:id",n(),r=>o.deleteTemplate(r.req.param("id"))?r.json({ok:!0}):r.json({error:"not found"},404)),s.get("/api/bots",a,r=>{const t=r.req.query("project")||void 0,e=r.req.query("parent")||void 0,i=r.req.query("status")||void 0;return r.json(o.listBots({project:t,parentBotId:e,parentOnly:!!e,status:i}))});const p=async r=>{const t=await r.req.json().catch(()=>null);if(!t||typeof t.templateId!="string")return r.json({error:"templateId is required"},400);try{const e=o.createInstance({templateId:t.templateId,title:typeof t.title=="string"?t.title:void 0,projectPath:typeof t.projectPath=="string"?t.projectPath:void 0,isolation:t.isolation==="worktree"?"worktree":"shared",parentBotId:typeof t.parentBotId=="string"?t.parentBotId:void 0,runtimeMode:t.runtimeMode});return r.json(e,201)}catch(e){return r.json({error:e instanceof Error?e.message:String(e)},400)}};s.post("/api/bots",n(),p),s.post("/api/bots/create",c(),p),s.post("/api/bots/list_templates",a,r=>r.json(o.listTemplates().map(t=>({id:t.id,name:t.manifest.name,description:t.manifest.description,orchestrator:!!t.manifest.orchestrator})))),s.post("/api/bots/list",a,async r=>{const t=await r.req.json().catch(()=>({})),e=t.parentBotId,i=o.listBots({parentBotId:t.parentOnly&&e?e:void 0,status:t.status});return r.json(i.map(d=>({id:d.id,title:d.title,status:d.status,projectPath:d.projectPath,parentBotId:d.parentBotId,depth:d.depth,lastText:d.lastText?.slice(0,400),updatedAt:d.updatedAt})))}),s.post("/api/bots/status",a,async r=>{const t=await r.req.json().catch(()=>({}));if(!t.botId)return r.json({error:"botId is required"},400);try{return r.json(o.status(t.botId))}catch(e){return r.json({error:e instanceof Error?e.message:String(e)},404)}}),s.post("/api/bots/message",a,async r=>{const t=await r.req.json().catch(()=>({}));if(!t.botId||typeof t.text!="string")return r.json({error:"botId and text are required"},400);try{return await o.input(t.botId,t.text,t.mode==="follow_up"?"follow_up":t.mode==="steer"?"steer":void 0),r.json({ok:!0})}catch(e){return r.json({error:e instanceof Error?e.message:String(e)},400)}}),s.post("/api/bots/wait",a,async r=>{const t=await r.req.json().catch(()=>({}));return!Array.isArray(t.botIds)||t.botIds.length===0?r.json({error:"botIds is required"},400):r.json(await o.waitFor(t.botIds,typeof t.timeoutMs=="number"?t.timeoutMs:void 0))}),s.post("/api/bots/result",a,async r=>{const t=await r.req.json().catch(()=>({}));if(!t.botId)return r.json({error:"botId is required"},400);try{return r.json(o.result(t.botId))}catch(e){return r.json({error:e instanceof Error?e.message:String(e)},404)}}),s.post("/api/bots/stop",a,async r=>{const t=await r.req.json().catch(()=>({}));if(!t.botId)return r.json({error:"botId is required"},400);try{return o.stop(t.botId,t.cascade!==!1),r.json({ok:!0})}catch(e){return r.json({error:e instanceof Error?e.message:String(e)},400)}}),s.post("/api/bots/approvals",a,r=>r.json(o.listApprovals())),s.post("/api/bots/approve",a,async r=>{const t=await r.req.json().catch(()=>({}));if(!t.botId||!t.requestId)return r.json({error:"botId and requestId are required"},400);const e=r.req.header("x-bots-token")===o.token?"parent-bot":"human";if(e==="parent-bot"&&!t.reason)return r.json({error:"a reason is required when a bot approves"},400);try{return r.json(o.respondApproval(t.botId,t.requestId,t.allow===!0,t.reason,e,t.always===!0))}catch(i){return r.json({error:i instanceof Error?i.message:String(i)},400)}}),s.get("/api/bots/approvals",n(),r=>r.json(o.listApprovals())),s.get("/api/bots/:id",n(),r=>{const t=o.getBot(r.req.param("id"));return t?r.json(t):r.json({error:"not found"},404)}),s.get("/api/bots/:id/events",n(),r=>{const t=Number(r.req.query("limit"))||400;return r.json(o.store.readEvents(r.req.param("id"),t))}),s.post("/api/bots/:id/input",n(),async r=>{const t=await r.req.json().catch(()=>({}));if(typeof t.text!="string"||!t.text.trim())return r.json({error:"text is required"},400);try{return await o.input(r.req.param("id"),t.text,t.mode==="follow_up"?"follow_up":t.mode==="steer"?"steer":void 0),r.json({ok:!0})}catch(e){return r.json({error:e instanceof Error?e.message:String(e)},400)}}),s.post("/api/bots/:id/stop",n(),r=>{try{return o.stop(r.req.param("id"),!0),r.json({ok:!0})}catch(t){return r.json({error:t instanceof Error?t.message:String(t)},400)}}),s.post("/api/bots/:id/resume",n(),r=>{try{return o.resume(r.req.param("id")),r.json({ok:!0})}catch(t){return r.json({error:t instanceof Error?t.message:String(t)},400)}}),s.post("/api/bots/:id/approve",n(),async r=>{const t=await r.req.json().catch(()=>({}));if(!t.requestId)return r.json({error:"requestId is required"},400);try{return r.json(o.respondApproval(r.req.param("id"),t.requestId,t.allow===!0,t.reason,"human",t.always===!0))}catch(e){return r.json({error:e instanceof Error?e.message:String(e)},400)}}),s.post("/api/bots/:id/mode",n(),async r=>{const e=(await r.req.json().catch(()=>({}))).mode;if(e!=="supervised"&&e!=="parent-supervised"&&e!=="full-access")return r.json({error:"mode must be supervised, parent-supervised or full-access"},400);try{return o.setRuntimeMode(r.req.param("id"),e),r.json({ok:!0,mode:e})}catch(i){return r.json({error:i instanceof Error?i.message:String(i)},400)}}),s.post("/api/bots/:id/allowed-tools",n(),async r=>{const t=await r.req.json().catch(()=>({}));if(!t.tool)return r.json({error:"tool is required"},400);try{return r.json({tools:o.allowTool(r.req.param("id"),t.tool)})}catch(e){return r.json({error:e instanceof Error?e.message:String(e)},400)}}),s.delete("/api/bots/:id",n(),r=>{try{return o.deleteBot(r.req.param("id"),!0),r.json({ok:!0})}catch(t){return r.json({error:t instanceof Error?t.message:String(t)},400)}})}export{f as registerBotRoutes};
1
+ import{exportBots as f,importBots as y}from"./transfer.js";const c=4,j=4*1024*1024;function b(o){if(o===void 0)return;if(!Array.isArray(o))throw new Error("images must be an array");if(o.length>c)throw new Error(`at most ${c} images per message`);const m=[];for(const s of o){const d=s??{};if(typeof d.data!="string"||typeof d.mimeType!="string")throw new Error("each image needs data and mimeType");if(!/^image\//.test(d.mimeType))throw new Error("only image/* attachments are supported");if(d.data.length*.75>j)throw new Error("image is larger than 4 MB");m.push({data:d.data,mimeType:d.mimeType})}return m.length?m:void 0}function h(o,m){const{manager:s,userAuth:d}=m,i=async(r,e)=>{const t=r.req.header("x-bots-token");return t&&t===s.token?e():d()(r,e)},l=()=>i,a=()=>d();o.get("/api/bots/catalog",a(),async r=>r.json(await s.catalog())),o.get("/api/bots/templates",a(),r=>r.json(s.listTemplates())),o.post("/api/bots/templates",a(),async r=>{const e=await r.req.json().catch(()=>null);if(!e||!e.manifest||typeof e.manifest.name!="string")return r.json({error:"manifest.name is required"},400);try{const t=s.saveTemplate({id:typeof e.id=="string"?e.id:void 0,manifest:e.manifest});return r.json(t,200)}catch(t){return r.json({error:t instanceof Error?t.message:String(t)},400)}}),o.get("/api/bots/export",a(),r=>{const e=f(s.store);return r.json(e,200,{"content-disposition":`attachment; filename="tmux-weblink-bots-${e.exportedAt.slice(0,10)}.json"`})}),o.post("/api/bots/import",a(),async r=>{const e=await r.req.json().catch(()=>null);if(!e)return r.json({error:"invalid bundle"},400);try{return r.json(y(s.store,e,{overwriteLibrary:e.overwriteLibrary===!0}))}catch(t){return r.json({error:t instanceof Error?t.message:String(t)},400)}}),o.delete("/api/bots/templates/:id",a(),r=>s.deleteTemplate(r.req.param("id"))?r.json({ok:!0}):r.json({error:"not found"},404)),o.get("/api/bots",i,r=>{const e=r.req.query("project")||void 0,t=r.req.query("parent")||void 0,n=r.req.query("status")||void 0;return r.json(s.listBots({project:e,parentBotId:t,parentOnly:!!t,status:n}))});const p=async r=>{const e=await r.req.json().catch(()=>null);if(!e||typeof e.templateId!="string")return r.json({error:"templateId is required"},400);try{const t=s.createInstance({templateId:e.templateId,title:typeof e.title=="string"?e.title:void 0,projectPath:typeof e.projectPath=="string"?e.projectPath:void 0,isolation:e.isolation==="worktree"?"worktree":"shared",parentBotId:typeof e.parentBotId=="string"?e.parentBotId:void 0,runtimeMode:e.runtimeMode});return r.json(t,201)}catch(t){return r.json({error:t instanceof Error?t.message:String(t)},400)}};o.post("/api/bots",a(),p),o.post("/api/bots/create",l(),p),o.post("/api/bots/list_templates",i,r=>r.json(s.listTemplates().map(e=>({id:e.id,name:e.manifest.name,description:e.manifest.description,orchestrator:!!e.manifest.orchestrator})))),o.post("/api/bots/list",i,async r=>{const e=await r.req.json().catch(()=>({})),t=e.parentBotId,n=s.listBots({parentBotId:e.parentOnly&&t?t:void 0,status:e.status});return r.json(n.map(u=>({id:u.id,title:u.title,status:u.status,projectPath:u.projectPath,parentBotId:u.parentBotId,depth:u.depth,lastText:u.lastText?.slice(0,400),updatedAt:u.updatedAt})))}),o.post("/api/bots/status",i,async r=>{const e=await r.req.json().catch(()=>({}));if(!e.botId)return r.json({error:"botId is required"},400);try{return r.json(s.status(e.botId))}catch(t){return r.json({error:t instanceof Error?t.message:String(t)},404)}}),o.post("/api/bots/message",i,async r=>{const e=await r.req.json().catch(()=>({}));if(!e.botId||typeof e.text!="string")return r.json({error:"botId and text are required"},400);try{return await s.input(e.botId,e.text,e.mode==="follow_up"?"follow_up":e.mode==="steer"?"steer":void 0),r.json({ok:!0})}catch(t){return r.json({error:t instanceof Error?t.message:String(t)},400)}}),o.post("/api/bots/wait",i,async r=>{const e=await r.req.json().catch(()=>({}));return!Array.isArray(e.botIds)||e.botIds.length===0?r.json({error:"botIds is required"},400):r.json(await s.waitFor(e.botIds,typeof e.timeoutMs=="number"?e.timeoutMs:void 0))}),o.post("/api/bots/result",i,async r=>{const e=await r.req.json().catch(()=>({}));if(!e.botId)return r.json({error:"botId is required"},400);try{return r.json(s.result(e.botId))}catch(t){return r.json({error:t instanceof Error?t.message:String(t)},404)}}),o.post("/api/bots/stop",i,async r=>{const e=await r.req.json().catch(()=>({}));if(!e.botId)return r.json({error:"botId is required"},400);try{return s.stop(e.botId,e.cascade!==!1),r.json({ok:!0})}catch(t){return r.json({error:t instanceof Error?t.message:String(t)},400)}}),o.post("/api/bots/approvals",i,r=>r.json(s.listApprovals())),o.post("/api/bots/approve",i,async r=>{const e=await r.req.json().catch(()=>({}));if(!e.botId||!e.requestId)return r.json({error:"botId and requestId are required"},400);const t=r.req.header("x-bots-token")===s.token?"parent-bot":"human";if(t==="parent-bot"&&!e.reason)return r.json({error:"a reason is required when a bot approves"},400);try{return r.json(s.respondApproval(e.botId,e.requestId,e.allow===!0,e.reason,t,e.always===!0))}catch(n){return r.json({error:n instanceof Error?n.message:String(n)},400)}}),o.get("/api/bots/approvals",a(),r=>r.json(s.listApprovals())),o.get("/api/bots/:id",a(),r=>{const e=s.getBot(r.req.param("id"));return e?r.json(e):r.json({error:"not found"},404)}),o.get("/api/bots/:id/events",a(),r=>{const e=Number(r.req.query("limit"))||400;return r.json(s.store.readEvents(r.req.param("id"),e))}),o.post("/api/bots/:id/input",a(),async r=>{const e=await r.req.json().catch(()=>({}));if(typeof e.text!="string"||!e.text.trim())return r.json({error:"text is required"},400);let t;try{t=b(e.images)}catch(n){return r.json({error:n instanceof Error?n.message:String(n)},400)}try{return await s.input(r.req.param("id"),e.text,e.mode==="follow_up"?"follow_up":e.mode==="steer"?"steer":void 0,t),r.json({ok:!0})}catch(n){return r.json({error:n instanceof Error?n.message:String(n)},400)}}),o.post("/api/bots/:id/queue/clear",a(),async r=>{try{return r.json({cleared:await s.clearQueue(r.req.param("id"))})}catch(e){return r.json({error:e instanceof Error?e.message:String(e)},400)}}),o.post("/api/bots/:id/stop",a(),r=>{try{return s.stop(r.req.param("id"),!0),r.json({ok:!0})}catch(e){return r.json({error:e instanceof Error?e.message:String(e)},400)}}),o.post("/api/bots/:id/resume",a(),r=>{try{return s.resume(r.req.param("id")),r.json({ok:!0})}catch(e){return r.json({error:e instanceof Error?e.message:String(e)},400)}}),o.post("/api/bots/:id/approve",a(),async r=>{const e=await r.req.json().catch(()=>({}));if(!e.requestId)return r.json({error:"requestId is required"},400);try{return r.json(s.respondApproval(r.req.param("id"),e.requestId,e.allow===!0,e.reason,"human",e.always===!0))}catch(t){return r.json({error:t instanceof Error?t.message:String(t)},400)}}),o.post("/api/bots/:id/mode",a(),async r=>{const t=(await r.req.json().catch(()=>({}))).mode;if(t!=="supervised"&&t!=="parent-supervised"&&t!=="full-access")return r.json({error:"mode must be supervised, parent-supervised or full-access"},400);try{return s.setRuntimeMode(r.req.param("id"),t),r.json({ok:!0,mode:t})}catch(n){return r.json({error:n instanceof Error?n.message:String(n)},400)}}),o.post("/api/bots/:id/allowed-tools",a(),async r=>{const e=await r.req.json().catch(()=>({}));if(!e.tool)return r.json({error:"tool is required"},400);try{return r.json({tools:s.allowTool(r.req.param("id"),e.tool)})}catch(t){return r.json({error:t instanceof Error?t.message:String(t)},400)}}),o.delete("/api/bots/:id",a(),r=>{try{return s.deleteBot(r.req.param("id"),!0),r.json({ok:!0})}catch(e){return r.json({error:e instanceof Error?e.message:String(e)},400)}})}export{h as registerBotRoutes};
package/dist/lib/icons.js CHANGED
@@ -1 +1 @@
1
- const a={menu:"M3 6h18v2H3V6zm0 5h18v2H3v-2zm0 5h18v2H3v-2z",close:"M18.3 5.71a1 1 0 0 0-1.41 0L12 10.59 7.11 5.7a1 1 0 1 0-1.41 1.41L10.59 12l-4.89 4.89a1 1 0 1 0 1.41 1.41L12 13.41l4.89 4.89a1 1 0 1 0 1.41-1.41L13.41 12l4.89-4.89a1 1 0 0 0 0-1.4z",search:"M15.5 14h-.79l-.28-.27A6.47 6.47 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z",refresh:"M17.65 6.35A7.96 7.96 0 0 0 12 4a8 8 0 1 0 8 8h-2a6 6 0 1 1-6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z",add:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z",edit:"M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM5.92 19H5v-.92l9.06-9.06.92.92L5.92 19zm13.66-12.83a1 1 0 0 0 0-1.41l-1.34-1.34a1 1 0 0 0-1.41 0l-1.05 1.05 2.75 2.75 1.05-1.05z",delete:"M15 4V3H9v1H4v2h1.5l.81 13.05A2 2 0 0 0 8.3 21h7.4a2 2 0 0 0 1.99-1.95L18.5 6H20V4h-5zm-5.5 2h5l-.75 12h-3.5L9.5 6z",check:"M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z",sessions:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h16v2H4v-2z",notes:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8l-6-6zm-1 2 5 5h-5V4zM6 20V4h5v7h7v9H6z",schedule:"M19 4h-1V2h-2v2H8V2H6v2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2zm0 16H5V10h14v10zM9 14H7v-2h2v2zm4 0h-2v-2h2v2zm4 0h-2v-2h2v2zm-8 4H7v-2h2v2zm4 0h-2v-2h2v2zm4 0h-2v-2h2v2z",agents:"M12 2a5 5 0 1 0 0 10 5 5 0 0 0 0-10zm0 8a3 3 0 1 1 0-6 3 3 0 0 1 0 6zm-7 13v-2a5 5 0 0 1 5-5h4a5 5 0 0 1 5 5v2h2v-2a7 7 0 0 0-7-7H10a7 7 0 0 0-7 7v2h2z",history:"M13 3a9 9 0 0 0-9 9H1l4 4 4-4H6a7 7 0 1 1 7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42A8.96 8.96 0 0 0 13 21a9 9 0 0 0 0-18zm-1 5v5l4.25 2.55.75-1.23-3.5-2.08V8H12z","quick-commands":"M13 3 4 14h7l-1 7 9-11h-7l1-7z",windows:"M4 6h16v2H4V6zm0 5h10v2H4v-2zm0 5h16v2H4v-2z",terminal:"M4 17.6 6.4 20l8-8-8-8L4 6.4 11.6 12 4 17.6zM20 18h-8v2h8v-2z",microphone:"M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3zm5-3c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z",keyboard:"M20 5H4c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm-9 3h2v2h-2V8zm0 3h2v2h-2v-2zM8 8h2v2H8V8zm0 3h2v2H8v-2zm-1 2H5v-2h2v2zm0-3H5V8h2v2zm9 7H8v-2h8v2zm0-4h-2v-2h2v2zm0-3h-2V8h2v2zm3 3h-2v-2h2v2zm0-3h-2V8h2v2z",bot:"M11 2h2v3h2a3 3 0 0 1 3 3v1h1a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2h-1v1a3 3 0 0 1-3 3H9a3 3 0 0 1-3-3v-1H5a2 2 0 0 1-2-2v-6a2 2 0 0 1 2-2h1V8a3 3 0 0 1 3-3h2V2zm-2 6v1h6V8H9zm-2 5a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3zm10 0a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3z",layers:"M12 2 2 7l10 5 10-5-10-5zm0 7.5L4.5 5.8 12 2l7.5 3.8L12 9.5zM2 12l10 5 10-5-1.9-.95L12 14.9l-8.1-3.85L2 12zm0 4.5 10 5 10-5-1.9-.95L12 19.4l-8.1-3.85-1.9.95z",inbox:"M19 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2zm0 16H5v-3h3.6a3.5 3.5 0 0 0 6.8 0H19v3zm0-5h-4.7a3.5 3.5 0 0 1-6.6 0H5V5h14v9z","chevron-down":"M7.4 8.6 12 13.2l4.6-4.6L18 10l-6 6-6-6 1.4-1.4z",settings:"M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58a.49.49 0 0 0 .12-.61l-1.92-3.32a.488.488 0 0 0-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54a.484.484 0 0 0-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58a.49.49 0 0 0-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6a3.6 3.6 0 1 1 0-7.2 3.6 3.6 0 0 1 0 7.2z",pin:"M16 12V4h1V2H7v2h1v8l-4 4v2h5.2v6h1.6v-6H20v-2l-4-4z","pin-outline":"M16 12V4h1V2H7v2h1v8l-4 4v2h5.2v6h1.6v-6H20v-2l-4-4zm-4.8 7.2V11l2-2V4h1.6v5l2 2v5.2H11.2z",folder:"M10 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z",file:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8l-6-6zm-1 2 5 5h-5V4zM6 20V4h5v7h7v9H6z",worktree:"M6 3a3 3 0 0 0-1 5.83v6.34a3 3 0 1 0 2 0V8.83A3 3 0 0 0 6 3zm0 2a1 1 0 1 1 0 2 1 1 0 0 1 0-2zm0 12a1 1 0 1 1 0 2 1 1 0 0 1 0-2zM18 3a3 3 0 0 0-1 5.83V9a4 4 0 0 1-4 4h-2a3 3 0 1 0 0 2h2a6 6 0 0 0 6-6v-.17A3 3 0 0 0 18 3zm0 2a1 1 0 1 1 0 2 1 1 0 0 1 0-2zM9 13a1 1 0 1 1 0 2 1 1 0 0 1 0-2z",copy:"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z",export:"M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z",chevronRight:"M9.29 6.71a1 1 0 0 0 0 1.41L13.17 12l-3.88 3.88a1 1 0 1 0 1.41 1.41l4.59-4.59a1 1 0 0 0 0-1.41L10.7 6.7a1 1 0 0 0-1.41.01z",lightning:"M11 21h-1l1-7H7.5c-.58 0-.57-.32-.38-.66.19-.33.51-.89.73-1.27L13 3h1l-1 7h3.5c.49 0 .56.33.47.51l-.07.15c-.22.46-.58 1.18-.78 1.58L11 21z","git-branch":"M13.5 7a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0zm0 10a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0zM11 9.5v5.1a4.03 4.03 0 0 0-3-.1V9.4a4.03 4.03 0 0 0 3 .1z",external:"M14 3h7v7h-2V6l-9.29 9.29-1.41-1.41L17.59 4.5H14V3zm4 16H5V5h7V3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7h-2v7z",play:"M8 5v14l11-7L8 5z",stop:"M6 6h12v12H6V6z",warning:"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z",info:"M11 7h2v2h-2V7zm0 4h2v6h-2v-6zm1-9C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2z",shield:"M12 2 4 5v6c0 5.55 3.84 10.74 8 12 4.16-1.26 8-6.45 8-12V5l-8-3zm0 2.18 6 2.25V11c0 4.52-3.05 8.86-6 10-2.95-1.14-6-5.48-6-10V6.43l6-2.25z","shield-up":"M12 2 4 5v6c0 5.55 3.84 10.74 8 12 4.16-1.26 8-6.45 8-12V5l-8-3zm0 2.18 6 2.25V11c0 4.52-3.05 8.86-6 10-2.95-1.14-6-5.48-6-10V6.43l6-2.25zM13 8.6v4.6h2l-3 3.6-3-3.6h2V8.6h2z","shield-alert":"M12 2 4 5v6c0 5.55 3.84 10.74 8 12 4.16-1.26 8-6.45 8-12V5l-8-3zm0 2.18 6 2.25V11c0 4.52-3.05 8.86-6 10-2.95-1.14-6-5.48-6-10V6.43l6-2.25zM11 7.5h2v5h-2v-5zm0 6.5h2v2h-2v-2z",spinner:"M12 4V1L8 5l4 4V6c3.31 0 6 2.69 6 6 0 1.01-.25 1.97-.7 2.8l1.46 1.46A7.93 7.93 0 0 0 20 12c0-4.42-3.58-8-8-8z",dots:"M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"};function l(h){return a[h]??a.menu}function c(h,v=""){return`<svg viewBox="0 0 24 24" fill="currentColor"${v?" "+v:""}><path d="${l(h)}"/></svg>`}function m(h){return`<path d="${l(h)}"/>`}const V={};function H(h,v){const z=V[h];return z?c(z):v?.trim().startsWith("<svg")?v:`<span style="font-size:18px;line-height:1">${v??""}</span>`}export{H as extIcon,c as icon,l as iconPath,m as iconPathString};
1
+ const a={menu:"M3 6h18v2H3V6zm0 5h18v2H3v-2zm0 5h18v2H3v-2z",close:"M18.3 5.71a1 1 0 0 0-1.41 0L12 10.59 7.11 5.7a1 1 0 1 0-1.41 1.41L10.59 12l-4.89 4.89a1 1 0 1 0 1.41 1.41L12 13.41l4.89 4.89a1 1 0 1 0 1.41-1.41L13.41 12l4.89-4.89a1 1 0 0 0 0-1.4z",search:"M15.5 14h-.79l-.28-.27A6.47 6.47 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z",refresh:"M17.65 6.35A7.96 7.96 0 0 0 12 4a8 8 0 1 0 8 8h-2a6 6 0 1 1-6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z",add:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z",edit:"M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM5.92 19H5v-.92l9.06-9.06.92.92L5.92 19zm13.66-12.83a1 1 0 0 0 0-1.41l-1.34-1.34a1 1 0 0 0-1.41 0l-1.05 1.05 2.75 2.75 1.05-1.05z",delete:"M15 4V3H9v1H4v2h1.5l.81 13.05A2 2 0 0 0 8.3 21h7.4a2 2 0 0 0 1.99-1.95L18.5 6H20V4h-5zm-5.5 2h5l-.75 12h-3.5L9.5 6z",check:"M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z",sessions:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h16v2H4v-2z",notes:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8l-6-6zm-1 2 5 5h-5V4zM6 20V4h5v7h7v9H6z",schedule:"M19 4h-1V2h-2v2H8V2H6v2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2zm0 16H5V10h14v10zM9 14H7v-2h2v2zm4 0h-2v-2h2v2zm4 0h-2v-2h2v2zm-8 4H7v-2h2v2zm4 0h-2v-2h2v2zm4 0h-2v-2h2v2z",agents:"M12 2a5 5 0 1 0 0 10 5 5 0 0 0 0-10zm0 8a3 3 0 1 1 0-6 3 3 0 0 1 0 6zm-7 13v-2a5 5 0 0 1 5-5h4a5 5 0 0 1 5 5v2h2v-2a7 7 0 0 0-7-7H10a7 7 0 0 0-7 7v2h2z",history:"M13 3a9 9 0 0 0-9 9H1l4 4 4-4H6a7 7 0 1 1 7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42A8.96 8.96 0 0 0 13 21a9 9 0 0 0 0-18zm-1 5v5l4.25 2.55.75-1.23-3.5-2.08V8H12z","quick-commands":"M13 3 4 14h7l-1 7 9-11h-7l1-7z",windows:"M4 6h16v2H4V6zm0 5h10v2H4v-2zm0 5h16v2H4v-2z",terminal:"M4 17.6 6.4 20l8-8-8-8L4 6.4 11.6 12 4 17.6zM20 18h-8v2h8v-2z",microphone:"M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3zm5-3c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z",keyboard:"M20 5H4c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm-9 3h2v2h-2V8zm0 3h2v2h-2v-2zM8 8h2v2H8V8zm0 3h2v2H8v-2zm-1 2H5v-2h2v2zm0-3H5V8h2v2zm9 7H8v-2h8v2zm0-4h-2v-2h2v2zm0-3h-2V8h2v2zm3 3h-2v-2h2v2zm0-3h-2V8h2v2z",bot:"M11 2h2v3h2a3 3 0 0 1 3 3v1h1a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2h-1v1a3 3 0 0 1-3 3H9a3 3 0 0 1-3-3v-1H5a2 2 0 0 1-2-2v-6a2 2 0 0 1 2-2h1V8a3 3 0 0 1 3-3h2V2zm-2 6v1h6V8H9zm-2 5a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3zm10 0a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3z",layers:"M12 2 2 7l10 5 10-5-10-5zm0 7.5L4.5 5.8 12 2l7.5 3.8L12 9.5zM2 12l10 5 10-5-1.9-.95L12 14.9l-8.1-3.85L2 12zm0 4.5 10 5 10-5-1.9-.95L12 19.4l-8.1-3.85-1.9.95z",inbox:"M19 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2zm0 16H5v-3h3.6a3.5 3.5 0 0 0 6.8 0H19v3zm0-5h-4.7a3.5 3.5 0 0 1-6.6 0H5V5h14v9z","chevron-down":"M7.4 8.6 12 13.2l4.6-4.6L18 10l-6 6-6-6 1.4-1.4z",settings:"M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58a.49.49 0 0 0 .12-.61l-1.92-3.32a.488.488 0 0 0-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54a.484.484 0 0 0-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58a.49.49 0 0 0-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6a3.6 3.6 0 1 1 0-7.2 3.6 3.6 0 0 1 0 7.2z",pin:"M16 12V4h1V2H7v2h1v8l-4 4v2h5.2v6h1.6v-6H20v-2l-4-4z","pin-outline":"M16 12V4h1V2H7v2h1v8l-4 4v2h5.2v6h1.6v-6H20v-2l-4-4zm-4.8 7.2V11l2-2V4h1.6v5l2 2v5.2H11.2z",folder:"M10 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z",file:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8l-6-6zm-1 2 5 5h-5V4zM6 20V4h5v7h7v9H6z",worktree:"M6 3a3 3 0 0 0-1 5.83v6.34a3 3 0 1 0 2 0V8.83A3 3 0 0 0 6 3zm0 2a1 1 0 1 1 0 2 1 1 0 0 1 0-2zm0 12a1 1 0 1 1 0 2 1 1 0 0 1 0-2zM18 3a3 3 0 0 0-1 5.83V9a4 4 0 0 1-4 4h-2a3 3 0 1 0 0 2h2a6 6 0 0 0 6-6v-.17A3 3 0 0 0 18 3zm0 2a1 1 0 1 1 0 2 1 1 0 0 1 0-2zM9 13a1 1 0 1 1 0 2 1 1 0 0 1 0-2z",copy:"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z",export:"M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z",chevronRight:"M9.29 6.71a1 1 0 0 0 0 1.41L13.17 12l-3.88 3.88a1 1 0 1 0 1.41 1.41l4.59-4.59a1 1 0 0 0 0-1.41L10.7 6.7a1 1 0 0 0-1.41.01z",lightning:"M11 21h-1l1-7H7.5c-.58 0-.57-.32-.38-.66.19-.33.51-.89.73-1.27L13 3h1l-1 7h3.5c.49 0 .56.33.47.51l-.07.15c-.22.46-.58 1.18-.78 1.58L11 21z","git-branch":"M13.5 7a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0zm0 10a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0zM11 9.5v5.1a4.03 4.03 0 0 0-3-.1V9.4a4.03 4.03 0 0 0 3 .1z",external:"M14 3h7v7h-2V6l-9.29 9.29-1.41-1.41L17.59 4.5H14V3zm4 16H5V5h7V3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7h-2v7z",play:"M8 5v14l11-7L8 5z",stop:"M6 6h12v12H6V6z",warning:"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z",attach:"M16.5 6v11.5c0 2.5-2 4.5-4.5 4.5s-4.5-2-4.5-4.5V5c0-1.4 1.1-2.5 2.5-2.5S12.5 3.6 12.5 5v10.5c0 .6-.4 1-1 1s-1-.4-1-1V6H9v9.5c0 1.4 1.1 2.5 2.5 2.5s2.5-1.1 2.5-2.5V5C14 2.8 12.2 1 10 1S6 2.8 6 5v12.5c0 3.6 2.9 6.5 6.5 6.5s6.5-2.9 6.5-6.5V6h-2.5z",info:"M11 7h2v2h-2V7zm0 4h2v6h-2v-6zm1-9C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2z",shield:"M12 2 4 5v6c0 5.55 3.84 10.74 8 12 4.16-1.26 8-6.45 8-12V5l-8-3zm0 2.18 6 2.25V11c0 4.52-3.05 8.86-6 10-2.95-1.14-6-5.48-6-10V6.43l6-2.25z","shield-up":"M12 2 4 5v6c0 5.55 3.84 10.74 8 12 4.16-1.26 8-6.45 8-12V5l-8-3zm0 2.18 6 2.25V11c0 4.52-3.05 8.86-6 10-2.95-1.14-6-5.48-6-10V6.43l6-2.25zM13 8.6v4.6h2l-3 3.6-3-3.6h2V8.6h2z","shield-alert":"M12 2 4 5v6c0 5.55 3.84 10.74 8 12 4.16-1.26 8-6.45 8-12V5l-8-3zm0 2.18 6 2.25V11c0 4.52-3.05 8.86-6 10-2.95-1.14-6-5.48-6-10V6.43l6-2.25zM11 7.5h2v5h-2v-5zm0 6.5h2v2h-2v-2z",spinner:"M12 4V1L8 5l4 4V6c3.31 0 6 2.69 6 6 0 1.01-.25 1.97-.7 2.8l1.46 1.46A7.93 7.93 0 0 0 20 12c0-4.42-3.58-8-8-8z",dots:"M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"};function l(h){return a[h]??a.menu}function c(h,v=""){return`<svg viewBox="0 0 24 24" fill="currentColor"${v?" "+v:""}><path d="${l(h)}"/></svg>`}function m(h){return`<path d="${l(h)}"/>`}const V={};function H(h,v){const z=V[h];return z?c(z):v?.trim().startsWith("<svg")?v:`<span style="font-size:18px;line-height:1">${v??""}</span>`}export{H as extIcon,c as icon,l as iconPath,m as iconPathString};
@@ -1,4 +1,4 @@
1
- import{cssVarsStyle as c}from"../theme.js";import{newSessionModalCSS as b,newSessionModalHTML as x,newSessionModalScript as g,reducedMotion as f}from"../shared-layout.js";import{icon as o}from"../icons.js";function m(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function n(e="var(--panel-accent)"){return`box-shadow: 0 0 0 2px ${e}; outline: none;`}function y(e){const{theme:t,fsRoots:r,terminalCfg:i,scrollback:p,wsBase:s}=e,a=e.version?m(e.version):"",l=`
1
+ import{cssVarsStyle as c}from"../theme.js";import{newSessionModalCSS as b,newSessionModalHTML as x,newSessionModalScript as g,reducedMotion as f}from"../shared-layout.js";import{icon as o}from"../icons.js";function m(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function a(e="var(--panel-accent)"){return`box-shadow: 0 0 0 2px ${e}; outline: none;`}function y(e){const{theme:t,fsRoots:r,terminalCfg:i,scrollback:p,wsBase:s}=e,n=e.version?m(e.version):"",l=`
2
2
  *, *::before, *::after { box-sizing: border-box; }
3
3
  html, body {
4
4
  background: var(--page-bg); color: var(--page-fg);
@@ -30,7 +30,7 @@ import{cssVarsStyle as c}from"../theme.js";import{newSessionModalCSS as b,newSes
30
30
  user-select: none;
31
31
  }
32
32
  .fixed-header .brand:active { background: color-mix(in srgb, var(--panel-accent) 10%, transparent); }
33
- .fixed-header .brand:focus-visible { ${n()} }
33
+ .fixed-header .brand:focus-visible { ${a()} }
34
34
  .fixed-header .brand span { color: var(--panel-accent); font-weight: 500; }
35
35
  .fixed-header .brand a { color: inherit; text-decoration: none; }
36
36
  #header-git {
@@ -98,7 +98,7 @@ import{cssVarsStyle as c}from"../theme.js";import{newSessionModalCSS as b,newSes
98
98
  }
99
99
  .sidebar-footer .mode-btn:hover { color: var(--panel-accent); background: color-mix(in srgb, var(--panel-accent) 8%, transparent); }
100
100
  .sidebar-footer .mode-btn.active { color: var(--panel-accent); background: color-mix(in srgb, var(--panel-accent) 10%, transparent); }
101
- .sidebar-footer .mode-btn:focus-visible { ${n()} }
101
+ .sidebar-footer .mode-btn:focus-visible { ${a()} }
102
102
 
103
103
  /* \u2500\u2500 Sidebar session mode \u2500\u2500 */
104
104
  .session-item {
@@ -126,7 +126,7 @@ import{cssVarsStyle as c}from"../theme.js";import{newSessionModalCSS as b,newSes
126
126
  .session-edit-btn { display: flex; align-items: center; opacity: 0.7; }
127
127
  .session-item.active .session-edit-btn { opacity: 1; color: var(--panel-accent); }
128
128
  }
129
- .session-edit-btn:focus-visible { ${n()} }
129
+ .session-edit-btn:focus-visible { ${a()} }
130
130
 
131
131
  .sidebar-section-label {
132
132
  font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.05em;
@@ -171,7 +171,7 @@ import{cssVarsStyle as c}from"../theme.js";import{newSessionModalCSS as b,newSes
171
171
  color: var(--panel-accent); border-color: var(--panel-accent);
172
172
  background: color-mix(in srgb, var(--panel-accent) 6%, transparent);
173
173
  }
174
- .new-session-sidebar-btn:focus-visible { ${n()} }
174
+ .new-session-sidebar-btn:focus-visible { ${a()} }
175
175
  .new-session-sidebar-btn svg { width: 16px; height: 16px; fill: currentColor; }
176
176
 
177
177
  /* \u2500\u2500 Sidebar files mode \u2500\u2500 */
@@ -190,15 +190,13 @@ import{cssVarsStyle as c}from"../theme.js";import{newSessionModalCSS as b,newSes
190
190
  .file-tree-info { font-size: var(--text-xs); color: var(--panel-muted); padding: 12px; line-height: 1.5; }
191
191
  .file-tree-info code { background: color-mix(in srgb, var(--panel-accent) 8%, transparent); padding: 2px 6px; border-radius: 4px; }
192
192
 
193
- .file-tree-item .file-tree-bot-btn,
194
- .session-group-header .sg-add-bot {
193
+ .file-tree-item .file-tree-bot-btn {
195
194
  margin-left: auto; flex: 0 0 auto;
196
195
  display: inline-flex; align-items: center; justify-content: center;
197
196
  width: 20px; height: 20px; line-height: 1;
198
197
  border: 1px solid var(--panel-border); border-radius: 6px;
199
198
  background: transparent; color: var(--panel-muted);
200
199
  font-size: 13px; cursor: pointer; opacity: 0.55;
201
- display: inline-flex; align-items: center; justify-content: center;
202
200
  }
203
201
  .file-tree-item:hover .file-tree-bot-btn { opacity: 1; color: var(--panel-accent); border-color: var(--panel-accent); }
204
202
  @media (hover: none) { .file-tree-item .file-tree-bot-btn { opacity: 0.8; } }
@@ -211,20 +209,52 @@ import{cssVarsStyle as c}from"../theme.js";import{newSessionModalCSS as b,newSes
211
209
  .file-tree-bot-plus svg { width: 11px; height: 11px; }
212
210
 
213
211
  /* Bots merged into session groups */
214
- .session-item.bot-item .bot-icon { width: 15px; height: 15px; flex-shrink: 0; fill: var(--panel-accent); opacity: 0.85; }
215
- .session-item.bot-item { border-left: 2px solid color-mix(in srgb, var(--panel-accent) 45%, transparent); }
216
- .session-item.bot-item .bot-status-dot { margin-left: auto; width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
212
+ .session-item.bot-item { border-left: 2px solid color-mix(in srgb, var(--bot-status, var(--panel-accent)) 45%, transparent); }
213
+ /* The bot glyph carries the run state (colour set per row in shell-client). */
214
+ .session-item.bot-item .bot-icon {
215
+ width: 17px; height: 17px; flex-shrink: 0;
216
+ fill: var(--bot-status, var(--panel-accent));
217
+ transition: fill 0.2s;
218
+ }
219
+ /* A live or blocked bot also tints its row, so the state reads at a glance
220
+ rather than from a 17px glyph alone. */
221
+ .session-item.bot-item[data-status="running"],
222
+ .session-item.bot-item[data-status="waiting_approval"],
223
+ .session-item.bot-item[data-status="waiting_input"],
224
+ .session-item.bot-item[data-status="failed"] {
225
+ background: color-mix(in srgb, var(--bot-status) 9%, transparent);
226
+ }
227
+ .session-item.bot-item[data-status="running"]:hover,
228
+ .session-item.bot-item[data-status="waiting_approval"]:hover,
229
+ .session-item.bot-item[data-status="waiting_input"]:hover,
230
+ .session-item.bot-item[data-status="failed"]:hover {
231
+ background: color-mix(in srgb, var(--bot-status) 15%, transparent);
232
+ }
233
+ /* Waiting on you: breathe, so a running conversation is noticed without a badge. */
234
+ @media (prefers-reduced-motion: no-preference) {
235
+ .session-item.bot-item[data-status="waiting_approval"] .bot-icon,
236
+ .session-item.bot-item[data-status="waiting_input"] .bot-icon {
237
+ animation: bot-wait 1.8s ease-in-out infinite;
238
+ }
239
+ }
240
+ @keyframes bot-wait { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
217
241
  .settings-item { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; background: none; border: none; color: inherit; font: inherit; cursor: pointer; }
218
242
  .settings-item-icon { display: inline-flex; color: var(--panel-muted); flex: 0 0 auto; }
219
243
  .settings-item #bots-inbox-badge { margin-left: auto; }
220
- .session-group-header .sg-add-bot {
221
- margin-left: auto; width: 18px; height: 18px; line-height: 1;
222
- border: 1px solid var(--panel-border); border-radius: 5px;
223
- background: transparent; color: var(--panel-muted); font-size: 12px; cursor: pointer;
224
- opacity: 0.5;
225
- }
226
- .session-group-header:hover .sg-add-bot { opacity: 1; color: var(--panel-accent); border-color: var(--panel-accent); }
227
- @media (hover: none) { .session-group-header .sg-add-bot { opacity: 0.85; } }
244
+ /* "Add to this folder" \u2014 one entry point for a session or a bot. */
245
+ .session-group-header .sg-add-btn {
246
+ margin-left: auto; flex: 0 0 auto;
247
+ display: inline-flex; align-items: center; justify-content: center;
248
+ width: 28px; height: 28px; padding: 0;
249
+ border: 1px solid transparent; border-radius: 7px;
250
+ background: transparent; color: var(--panel-muted);
251
+ cursor: pointer; opacity: 0.6; touch-action: manipulation;
252
+ transition: color 0.15s, border-color 0.15s, opacity 0.15s;
253
+ }
254
+ .session-group-header:hover .sg-add-btn { opacity: 1; color: var(--panel-accent); border-color: var(--panel-accent); }
255
+ .session-group-header .sg-add-btn:focus-visible { ${a()} }
256
+ @media (hover: none) { .session-group-header .sg-add-btn { opacity: 0.9; } }
257
+ @media (pointer: coarse) { .session-group-header .sg-add-btn { width: 44px; height: 44px; opacity: 1; } }
228
258
  .bv-mode { display: inline-flex; }
229
259
  .bv-mode-btn, .bv-icon-btn {
230
260
  display: inline-flex; align-items: center; justify-content: center;
@@ -243,15 +273,19 @@ import{cssVarsStyle as c}from"../theme.js";import{newSessionModalCSS as b,newSes
243
273
  exclamation = everyone runs unattended. */
244
274
  .bv-mode-btn[data-mode="parent-supervised"] { color: var(--panel-accent); }
245
275
  .bv-mode-btn[data-mode="full-access"] { color: #e0a23c; border-color: color-mix(in srgb, #e0a23c 45%, var(--panel-border)); }
246
- /* One menu component for the mode picker and the overflow actions. */
276
+ /* One menu component for every "pick an action" surface: the bots mode picker,
277
+ the bots overflow sheet and the sidebar's add button (see browser/menu.ts).
278
+ z-index 170 keeps a sheet above the sidebar drawer (150) on a phone. */
247
279
  .bv-menu {
248
- position: absolute; right: 12px; top: 46px; z-index: 20;
280
+ position: absolute; right: 12px; top: 46px; z-index: 170;
249
281
  width: min(320px, calc(100vw - 24px));
250
282
  background: var(--panel-bg); border: 1px solid var(--panel-border);
251
283
  border-radius: 10px; padding: 4px; display: flex; flex-direction: column; gap: 2px;
252
284
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
253
285
  }
254
286
  .bv-menu[hidden] { display: none; }
287
+ /* Anchored to its button instead of the bots header's fixed slot. */
288
+ .bv-menu.anchored { position: fixed; top: auto; right: auto; width: min(264px, calc(100vw - 24px)); }
255
289
  .bv-menu-item {
256
290
  display: grid; grid-template-columns: 18px minmax(0, 1fr) 14px;
257
291
  align-items: start; gap: 8px; text-align: left;
@@ -538,7 +572,7 @@ import{cssVarsStyle as c}from"../theme.js";import{newSessionModalCSS as b,newSes
538
572
  color: var(--page-fg); transition: opacity 0.15s; text-decoration: none;
539
573
  }
540
574
  .btn:hover { opacity: 0.85; }
541
- .btn:focus-visible { ${n()} }
575
+ .btn:focus-visible { ${a()} }
542
576
  .btn.primary { background: var(--panel-accent); border-color: var(--panel-accent); color: var(--panel-accent-on); font-weight: 500; }
543
577
  .btn.primary:hover { opacity: 0.9; }
544
578
  .btn.danger { color: #b91c1c; border-color: color-mix(in srgb, #b91c1c 30%, transparent); }
@@ -811,6 +845,14 @@ import{cssVarsStyle as c}from"../theme.js";import{newSessionModalCSS as b,newSes
811
845
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.28);
812
846
  }
813
847
  .bv-jump[hidden] { display: none; }
848
+ .bv-earlier {
849
+ align-self: center; margin: 4px 0 10px;
850
+ padding: 6px 14px; min-height: 36px;
851
+ border: 1px solid var(--panel-border); border-radius: 999px;
852
+ background: var(--panel-bg); color: var(--panel-muted);
853
+ font: inherit; font-size: 11.5px; cursor: pointer; touch-action: manipulation;
854
+ }
855
+ .bv-earlier:hover { color: var(--panel-accent); border-color: var(--panel-accent); }
814
856
  .bv-jump:hover { border-color: var(--panel-accent); color: var(--panel-accent); }
815
857
  .bv-msg { max-width: min(860px, 100%); font-size: 13px; line-height: 1.55; }
816
858
  .bv-user { align-self: flex-end; background: color-mix(in srgb, var(--panel-accent) 16%, transparent); border: 1px solid color-mix(in srgb, var(--panel-accent) 30%, transparent); padding: 8px 12px; border-radius: 10px; }
@@ -865,6 +907,15 @@ import{cssVarsStyle as c}from"../theme.js";import{newSessionModalCSS as b,newSes
865
907
  }
866
908
  .bv-code-copy:hover { color: var(--panel-accent); background: color-mix(in srgb, var(--panel-accent) 10%, transparent); }
867
909
  .bv-code pre { margin: 0; padding: 8px 10px; overflow-x: auto; }
910
+ /* Syntax tokens: muted enough to stay readable in the quiet palette. */
911
+ .bv-code .tok-kw { color: #c792ea; }
912
+ .bv-code .tok-str { color: #a5d6a7; }
913
+ .bv-code .tok-num { color: #ffb86c; }
914
+ .bv-code .tok-com { color: var(--panel-muted); font-style: italic; }
915
+ .bv-code .tok-key { color: #82aaff; }
916
+ .bv-code .tok-add { color: #4ade80; }
917
+ .bv-code .tok-del { color: #f87171; }
918
+ .bv-code .tok-meta { color: var(--panel-accent); }
868
919
  .bv-code code {
869
920
  font-family: var(--font-mono); font-size: 11.5px; line-height: 1.5;
870
921
  background: none; border: none; padding: 0; white-space: pre;
@@ -905,7 +956,59 @@ import{cssVarsStyle as c}from"../theme.js";import{newSessionModalCSS as b,newSes
905
956
  .bv-notice-error { color: var(--panel-danger, #e5534b); }
906
957
 
907
958
  /* Same look and metrics as the terminal's mobile input row (.mk-input). */
908
- .bots-composer-wrap { flex-shrink: 0; border-top: 1px solid var(--panel-border); background: var(--panel-bg); }
959
+ .bots-composer-wrap { position: relative; flex-shrink: 0; border-top: 1px solid var(--panel-border); background: var(--panel-bg); }
960
+ .bots-composer-wrap.drop-target { outline: 2px dashed var(--panel-accent); outline-offset: -2px; }
961
+ /* Pi's pending queue (steering / follow-up) sits above the field. */
962
+ .bv-queue {
963
+ display: flex; align-items: center; justify-content: space-between; gap: 8px;
964
+ padding: 6px 12px; font-size: 11.5px; color: #e0a23c;
965
+ background: color-mix(in srgb, #e0a23c 10%, transparent);
966
+ border-bottom: 1px solid color-mix(in srgb, #e0a23c 30%, transparent);
967
+ }
968
+ .bv-queue[hidden] { display: none; }
969
+ .bv-queue-clear {
970
+ background: none; border: 1px solid color-mix(in srgb, #e0a23c 45%, transparent);
971
+ color: inherit; border-radius: 6px; font: inherit; font-size: 11px;
972
+ padding: 2px 8px; min-height: 28px; cursor: pointer; touch-action: manipulation;
973
+ }
974
+ .bv-attach-strip { display: flex; gap: 6px; padding: 8px 10px 0; overflow-x: auto; }
975
+ .bv-attach-strip[hidden] { display: none; }
976
+ .bv-attach-chip { position: relative; flex: 0 0 auto; }
977
+ .bv-attach-chip img {
978
+ width: 56px; height: 56px; object-fit: cover; display: block;
979
+ border-radius: 8px; border: 1px solid var(--panel-border);
980
+ }
981
+ .bv-attach-remove {
982
+ position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%;
983
+ border: 1px solid var(--panel-border); background: var(--panel-bg); color: var(--page-fg);
984
+ font-size: 12px; line-height: 1; cursor: pointer;
985
+ display: flex; align-items: center; justify-content: center;
986
+ }
987
+ .bv-attach-btn {
988
+ flex: 0 0 auto; width: 38px; min-height: 38px; border-radius: 8px;
989
+ border: 1px solid var(--panel-border); background: var(--page-bg); color: var(--panel-muted);
990
+ display: inline-flex; align-items: center; justify-content: center;
991
+ cursor: pointer; touch-action: manipulation;
992
+ }
993
+ .bv-attach-btn:hover { color: var(--panel-accent); border-color: var(--panel-accent); }
994
+ /* Slash-command and file completion above the field. */
995
+ .bv-suggest {
996
+ position: absolute; left: 8px; right: 8px; bottom: calc(100% - 4px); z-index: 8;
997
+ max-height: 46vh; overflow-y: auto;
998
+ background: var(--panel-bg); border: 1px solid var(--panel-border);
999
+ border-radius: 10px; padding: 4px; display: flex; flex-direction: column; gap: 2px;
1000
+ box-shadow: 0 8px 24px rgba(0,0,0,0.35);
1001
+ }
1002
+ .bv-suggest[hidden] { display: none; }
1003
+ .bv-suggest-item {
1004
+ display: grid; grid-template-columns: 16px auto minmax(0, 1fr); align-items: center; gap: 8px;
1005
+ text-align: left; background: none; border: none; border-radius: 7px; padding: 8px 9px;
1006
+ color: var(--page-fg); font: inherit; cursor: pointer; touch-action: manipulation;
1007
+ }
1008
+ .bv-suggest-item.active { background: color-mix(in srgb, var(--panel-accent) 14%, transparent); }
1009
+ .bv-suggest-kind { font-family: var(--font-mono); color: var(--panel-accent); }
1010
+ .bv-suggest-label { font-family: var(--font-mono); font-size: 12.5px; white-space: nowrap; }
1011
+ .bv-suggest-detail { font-size: 11px; color: var(--panel-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
909
1012
  .bv-composer-error {
910
1013
  padding: 6px 10px; font-size: 11.5px; line-height: 1.45; word-break: break-word;
911
1014
  color: var(--panel-danger, #e5534b);
@@ -964,6 +1067,34 @@ import{cssVarsStyle as c}from"../theme.js";import{newSessionModalCSS as b,newSes
964
1067
  .file-roots-list li:hover { border-color: var(--panel-accent); }
965
1068
  .file-roots-list li svg { width: 20px; height: 20px; flex-shrink: 0; fill: var(--panel-accent); }
966
1069
 
1070
+ /* \u2500\u2500 Sidebar drawer (phones and narrow tablets) \u2500\u2500
1071
+ The list slides over the terminal/chat instead of stacking above it, so the
1072
+ main area keeps the full width and height. Matches T3's mobile sheet, whose
1073
+ breakpoint is 767px; the composer's compact mode stays at 640. */
1074
+ .sidebar-backdrop {
1075
+ display: none; position: fixed; z-index: 149;
1076
+ top: calc(48px + env(safe-area-inset-top, 0px)); right: 0; bottom: 0; left: 0;
1077
+ background: rgba(0, 0, 0, 0.45);
1078
+ opacity: 0; pointer-events: none;
1079
+ transition: opacity 0.18s ease;
1080
+ }
1081
+ .sidebar-backdrop.open { opacity: 1; pointer-events: auto; }
1082
+ @media (max-width: 767px) {
1083
+ .app-layout { flex-direction: column; }
1084
+ .sidebar {
1085
+ position: fixed; z-index: 150;
1086
+ top: calc(48px + env(safe-area-inset-top, 0px)); bottom: 0; left: 0;
1087
+ width: min(320px, 88vw);
1088
+ border-right: 1px solid var(--panel-border); border-bottom: none;
1089
+ background: var(--page-bg);
1090
+ transform: translateX(-100%);
1091
+ transition: transform 0.2s ease;
1092
+ box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
1093
+ }
1094
+ .sidebar.open { transform: none; }
1095
+ .sidebar-backdrop { display: block; }
1096
+ }
1097
+
967
1098
  ${f()}
968
1099
  ${b()}
969
1100
  @media (max-width: 640px) {
@@ -1003,13 +1134,20 @@ import{cssVarsStyle as c}from"../theme.js";import{newSessionModalCSS as b,newSes
1003
1134
  .bv-approval-actions .btn { min-height: 44px; }
1004
1135
  /* Keep the field clear of the home-indicator gesture bar. */
1005
1136
  .bots-composer { padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px)) 10px; gap: 6px; }
1006
- .sidebar { flex: 0 0 auto; border-right: none; border-bottom: 1px solid var(--panel-border); transition: max-height 0.2s; }
1007
- /* An expanded list must leave room for the terminal/chat below it; without a
1008
- cap a long session list pushed the main area off-screen. */
1009
- .sidebar:not(.collapsed) { max-height: 62dvh; }
1010
- .sidebar.collapsed .sidebar-content { display: none; }
1011
- .sidebar.collapsed .sidebar-footer { display: none; }
1012
- .sidebar.collapsed { max-height: 48px; overflow: hidden; }
1137
+ .bv-attach-btn { width: 44px; min-height: 44px; }
1138
+ .bv-attach-chip img { width: 64px; height: 64px; }
1139
+ .bv-suggest-item { padding: 12px 10px; }
1140
+ .bv-earlier { min-height: 44px; }
1141
+ .bv-queue { padding: 8px 10px; }
1142
+ .bv-queue-clear { min-height: 36px; }
1143
+ /* Dialogs are bottom sheets on a phone: reachable with a thumb, and the
1144
+ keyboard cannot push them off-screen. */
1145
+ .bots-modal { align-items: flex-end; }
1146
+ .bots-modal-card {
1147
+ width: 100%; max-height: 88vh;
1148
+ border-radius: 16px 16px 0 0;
1149
+ padding-bottom: env(safe-area-inset-bottom, 0px);
1150
+ }
1013
1151
  .mobile-keys { display: flex; }
1014
1152
  .mobile-keys .mk-buttons { display: none; }
1015
1153
  /* Expanded state is explicit (remembered per browser) rather than tied to
@@ -1036,11 +1174,18 @@ import{cssVarsStyle as c}from"../theme.js";import{newSessionModalCSS as b,newSes
1036
1174
  /* Forced narrow layout (settings toggle): same rules as the 640px
1037
1175
  breakpoint, applied unconditionally when the html has .force-narrow. */
1038
1176
  html.force-narrow .app-layout { flex-direction: column; }
1039
- html.force-narrow .sidebar { flex: 0 0 auto; border-right: none; border-bottom: 1px solid var(--panel-border); transition: max-height 0.2s; }
1040
- html.force-narrow .sidebar:not(.collapsed) { max-height: 62dvh; }
1041
- html.force-narrow .sidebar.collapsed .sidebar-content { display: none; }
1042
- html.force-narrow .sidebar.collapsed .sidebar-footer { display: none; }
1043
- html.force-narrow .sidebar.collapsed { max-height: 48px; overflow: hidden; }
1177
+ html.force-narrow .sidebar {
1178
+ position: fixed; z-index: 150;
1179
+ top: calc(48px + env(safe-area-inset-top, 0px)); bottom: 0; left: 0;
1180
+ width: min(320px, 88vw);
1181
+ border-right: 1px solid var(--panel-border); border-bottom: none;
1182
+ background: var(--page-bg);
1183
+ transform: translateX(-100%);
1184
+ transition: transform 0.2s ease;
1185
+ box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
1186
+ }
1187
+ html.force-narrow .sidebar.open { transform: none; }
1188
+ html.force-narrow .sidebar-backdrop { display: block; }
1044
1189
  html.force-narrow .mobile-keys { display: flex; }
1045
1190
  html.force-narrow .mobile-keys .mk-buttons { display: none; }
1046
1191
  html.force-narrow .mobile-keys.mk-open .mk-buttons {
@@ -1052,7 +1197,7 @@ import{cssVarsStyle as c}from"../theme.js";import{newSessionModalCSS as b,newSes
1052
1197
  <head>
1053
1198
  <meta charset="UTF-8" />
1054
1199
  <meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
1055
- <meta name="tw-build" content="${a}" />
1200
+ <meta name="tw-build" content="${n}" />
1056
1201
  <meta name="apple-mobile-web-app-capable" content="yes" />
1057
1202
  <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
1058
1203
  <meta name="apple-mobile-web-app-title" content="tmux-web" />
@@ -1092,6 +1237,8 @@ import{cssVarsStyle as c}from"../theme.js";import{newSessionModalCSS as b,newSes
1092
1237
  <span id="header-ram"></span>
1093
1238
  </header>
1094
1239
 
1240
+ <div class="sidebar-backdrop" id="sidebar-backdrop"></div>
1241
+
1095
1242
  <div class="app-layout">
1096
1243
  <aside class="sidebar">
1097
1244
  <div class="sidebar-content" id="sidebar-content"></div>
@@ -1159,7 +1306,7 @@ import{cssVarsStyle as c}from"../theme.js";import{newSessionModalCSS as b,newSes
1159
1306
  <!-- Settings popover -->
1160
1307
  <div class="popover-backdrop" id="settings-backdrop"></div>
1161
1308
  <div class="settings-popover" id="settings-popover">
1162
- <div style="padding:1px 2px 6px;font-size:10px;color:var(--panel-muted);opacity:.8;font-family:var(--font-mono)">tmux-weblink v${a}</div>
1309
+ <div style="padding:1px 2px 6px;font-size:10px;color:var(--panel-muted);opacity:.8;font-family:var(--font-mono)">tmux-weblink v${n}</div>
1163
1310
  <div style="padding:4px 0">
1164
1311
  <button class="theme-option" data-theme="vscode" title="VS Code"><span class="theme-dot" style="background:#007acc"></span>VS Code${t.template==="vscode"?'<span class="theme-check">\u2713</span>':""}</button>
1165
1312
  <button class="theme-option" data-theme="ghostty" title="Ghostty"><span class="theme-dot" style="background:#ff5f00"></span>Ghostty${t.template==="ghostty"?'<span class="theme-check">\u2713</span>':""}</button>
@@ -1273,8 +1420,10 @@ ${g("__onSessionCreated")}
1273
1420
  var brand = document.getElementById('brand-toggle');
1274
1421
  var sbar = document.querySelector('.sidebar');
1275
1422
  if (brand && sbar) {
1423
+ var backdrop = document.getElementById('sidebar-backdrop');
1276
1424
  var setExpanded = function(expanded) {
1277
- sbar.classList.toggle('collapsed', !expanded);
1425
+ sbar.classList.toggle('open', expanded);
1426
+ if (backdrop) backdrop.classList.toggle('open', expanded);
1278
1427
  brand.setAttribute('aria-expanded', expanded ? 'true' : 'false');
1279
1428
  /* Unpin/repin the bot chat before the next paint, so the list is never
1280
1429
  drawn underneath the pinned chat view. */
@@ -1286,13 +1435,13 @@ ${g("__onSessionCreated")}
1286
1435
  var now = Date.now();
1287
1436
  if (now - lastToggle < 350) return;
1288
1437
  lastToggle = now;
1289
- setExpanded(sbar.classList.contains('collapsed'));
1438
+ setExpanded(!sbar.classList.contains('open'));
1290
1439
  };
1291
1440
  brand.addEventListener('pointerdown', toggle);
1292
1441
  brand.addEventListener('keydown', function(e) {
1293
1442
  if (e.key === 'Enter' || e.key === ' ') toggle(e);
1294
1443
  });
1295
- brand.setAttribute('aria-expanded', sbar.classList.contains('collapsed') ? 'false' : 'true');
1444
+ brand.setAttribute('aria-expanded', sbar.classList.contains('open') ? 'true' : 'false');
1296
1445
  }
1297
1446
 
1298
1447
  /* Mobile keys: collapsible strip, expanded by tapping the space under the