herm-tui 1.9.0 → 1.9.1-dev.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.
Files changed (2) hide show
  1. package/index.js +1 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -4182,7 +4182,7 @@ Usage:
4182
4182
  herm --no-splash skip the launch splash
4183
4183
  herm -v, --version print version
4184
4184
  herm -h, --help show this help
4185
- `;var TIERS=["block","slick","tiny"],pickFont=(innerW)=>TIERS.find((f)=>measureText({text:"HERM",font:f}).width<=innerW)??"tiny",clip=(s,w2)=>[...s].length<=w2?s:[...s].slice(0,Math.max(1,w2-1)).join("")+"\u2026";function Splash(p){let theme=useTheme().theme,ref=import_react111.useRef(null),[box2,setBox]=import_react111.useState({w:0,h:0}),renderer=useRenderer();import_react111.useEffect(()=>{let cb=async()=>{let r=ref.current;if(!r)return;setBox((b2)=>b2.w===r.width&&b2.h===r.height?b2:{w:r.width,h:r.height})};return renderer.setFrameCallback(cb),()=>renderer.removeFrameCallback(cb)},[renderer]);let{lines:lines3,inner}=import_react111.useMemo(()=>frame(box2.w,box2.h),[box2.w,box2.h]),font=import_react111.useMemo(()=>pickFont(inner.w),[inner.w]),[tip2,setTip]=import_react111.useState(()=>randomTip()),behind=p.info?.behind,sub2=[`v${VERSION}`,p.info?`hermes ${p.info.agentVersion??"?"}`:"\u2026",behind==null?null:behind===0?"up to date":`${behind} behind`,p.info?.model].filter(Boolean).join(" \xB7 "),prompt=p.last&&!p.composing,title=p.last?.title?.trim()||p.last?.id;return $jsxs("box",{ref,position:"absolute",left:0,top:0,right:0,bottom:0,zIndex:50,backgroundColor:theme.background,children:[lines3.map((l,i)=>$jsx("box",{position:"absolute",top:i,left:0,height:1,children:$jsx("text",{fg:theme.accent,children:l})},i)),lines3.length>0&&$jsxs("box",{position:"absolute",left:inner.x,top:inner.y,width:inner.w,height:inner.h,flexDirection:"column",alignItems:"center",justifyContent:"center",children:[$jsx("box",{children:$jsx("ascii-font",{text:"HERM",font,color:[theme.accent,theme.textMuted],selectable:!1})}),$jsx("box",{height:1,children:$jsx("text",{fg:theme.textMuted,children:clip(sub2,inner.w)})}),p.news?$jsx("box",{height:1,children:$jsx("text",{fg:theme.textMuted,children:clip(`\u203A ${p.news}`,inner.w)})}):null,$jsx("box",{height:2}),p.loading?$jsx("text",{fg:theme.textMuted,children:$jsx("span",{fg:theme.accent,children:"Loading\u2026"})}):prompt?$jsxs($Fragment,{children:[$jsxs("text",{fg:theme.textMuted,children:["continue ",$jsxs("span",{fg:theme.text,children:['"',clip(title??"",Math.max(8,inner.w-14)),'"']})," ?"]}),$jsxs("text",{fg:theme.textMuted,children:[$jsx("span",{fg:theme.accent,children:"[enter]"})," yes \xB7 type to start fresh"]})]}):$jsxs("text",{fg:theme.textMuted,children:[$jsx("span",{fg:theme.accent,children:"[enter]"})," to send"]}),inner.h>=14?$jsx("box",{position:"absolute",bottom:0,left:0,right:0,flexDirection:"column",alignItems:"center",onMouseDown:()=>setTip((t2)=>randomTip(t2)),children:$jsx("text",{wrapMode:"word",children:splitTip(clip(tip2,inner.w*2)).map((s,i)=>$jsx("span",{fg:s.hl?theme.accent:theme.textMuted,children:s.t},i))})}):null]})]})}init_sessions_db();function openMessage(dialog,m2,ops){let text4=m2.parts.filter((p)=>p.type==="text").map((p)=>p.content).join("");dialog.replace($jsx(DialogSelect,{title:"Message Actions",options:[{title:"Copy",value:"copy",description:"message text to clipboard"},{title:"Rewind here",value:"rewind",description:"undo back to this turn (destructive)"},{title:"Fork here",value:"fork",description:"branch a new session at this point"}],onSelect:(o)=>{if(dialog.clear(),o.value==="copy")return void copyText(text4,ops.toast);if(o.value==="rewind")return ops.rewind(m2);if(o.value==="fork")return ops.fork(m2)}}))}var LOCAL_NAMES=new Set(["clear","new","theme","help","keys","logs","title","rollback","save","history","status","usage","profile","steer","reload","reload-mcp","reload-skills","chafa","splash","skin","resume","branch","compress","undo","redo","retry","model","yolo","quit","copy","paste","image","background","voice","mouse","redraw","queue","stash","compact","setup","browser"]),LOCAL_COMMANDS=[{name:"clear",description:"Clear chat messages",category:"Client",aliases:[],argsHint:"",subcommands:[],source:"local",target:"local"},{name:"new",description:"Start a new session",category:"Client",aliases:["reset"],argsHint:"",subcommands:[],source:"local",target:"local"},{name:"theme",description:"Switch color theme or mode",category:"Client",aliases:[],argsHint:"[light|dark]",subcommands:[],source:"local",target:"local"},{name:"help",description:"Show keyboard shortcuts",category:"Client",aliases:[],argsHint:"",subcommands:[],source:"local",target:"local"},{name:"keys",description:"Rebind keyboard shortcuts",category:"Client",aliases:[],argsHint:"",subcommands:[],source:"local",target:"local"},{name:"logs",description:"Show gateway stderr log",category:"Client",aliases:[],argsHint:"",subcommands:[],source:"local",target:"local"},{name:"title",description:"Set session title",category:"Client",aliases:[],argsHint:"[text]",subcommands:[],source:"local",target:"local"},{name:"rollback",description:"Browse & restore checkpoints",category:"Client",aliases:[],argsHint:"",subcommands:[],source:"local",target:"local"},{name:"history",description:"Server-side transcript viewer",category:"Info",aliases:[],argsHint:"",subcommands:[],source:"local",target:"local"},{name:"status",description:"Version, model, paths",category:"Info",aliases:[],argsHint:"",subcommands:[],source:"local",target:"local"},{name:"usage",description:"Credits, account status, tokens, context fill, cost",category:"Info",aliases:[],argsHint:"",subcommands:[],source:"local",target:"local"},{name:"profile",description:"Active profile details",category:"Info",aliases:[],argsHint:"",subcommands:[],source:"local",target:"local"},{name:"steer",description:"Inject a note mid-turn (no interrupt)",category:"Session",aliases:[],argsHint:"[text]",subcommands:[],source:"local",target:"local"},{name:"reload-mcp",description:"Restart MCP servers & rediscover tools",category:"Session",aliases:[],argsHint:"[now|always]",subcommands:["now","always"],source:"local",target:"local"},{name:"reload",description:"Hot-reload ~/.hermes/.env (API keys)",category:"Session",aliases:[],argsHint:"",subcommands:[],source:"local",target:"local"},{name:"reload-skills",description:"Re-scan ~/.hermes/skills/ for added/removed skills",category:"Session",aliases:["reload_skills"],argsHint:"",subcommands:[],source:"local",target:"local"},{name:"chafa",description:"Render image via chafa (demo)",category:"Client",aliases:[],argsHint:"<path>",subcommands:[],source:"local",target:"local"},{name:"splash",description:"Show the launch splash",category:"Client",aliases:[],argsHint:"",subcommands:[],source:"local",target:"local"},{name:"goal",description:"Set/control the session goal",category:"Session",aliases:[],argsHint:"[text|done|pause|resume|clear|status]",subcommands:["done","pause","resume","clear","status"],source:"command",target:"gateway"},{name:"skin",description:"Switch Hermes skin (+ theme + eikon)",category:"Client",aliases:[],argsHint:"[name]",subcommands:[...SKINS],source:"local",target:"local"},{name:"voice",description:"Toggle voice recording",category:"Client",aliases:[],argsHint:"[on|off|status|tts]",subcommands:["on","off","status","tts"],source:"local",target:"local"},{name:"queue",description:"Queue a prompt for the next idle turn",category:"Session",aliases:["q"],argsHint:"[text]",subcommands:[],source:"local",target:"local"},{name:"yolo",description:"Toggle approval bypass",category:"Session",aliases:[],argsHint:"",subcommands:[],source:"local",target:"local"},{name:"quit",description:"Exit herm",category:"Exit",aliases:["exit"],argsHint:"",subcommands:[],source:"local",target:"local"},{name:"stash",description:"Park the prompt (pop/list to restore)",category:"Client",aliases:[],argsHint:"[pop|list]",subcommands:["pop","list"],source:"local",target:"local"},{name:"redo",description:"Re-send the last undone message",category:"Session",aliases:[],argsHint:"",subcommands:[],source:"local",target:"local"},{name:"branch",description:"Fork current conversation",category:"Session",aliases:["fork"],argsHint:"[name]",subcommands:[],source:"local",target:"local"},{name:"browser",description:"Connect/disconnect a CDP browser",category:"Session",aliases:[],argsHint:"[connect|disconnect|status] [url]",subcommands:["connect","disconnect","status"],source:"local",target:"local"}];function resolve10(list3,name){let q5=name.toLowerCase();for(let c of list3)if(c.name.toLowerCase()===q5||c.aliases.some((a)=>a.toLowerCase()===q5))return{hit:c};let hits=new Set;for(let c of list3)for(let n of[c.name,...c.aliases])if(n.toLowerCase().startsWith(q5)){hits.add(c);break}if(hits.size===1)return{hit:[...hits][0]};if(hits.size===0)return{miss:!0};return{ambiguous:[...hits].map((c)=>`/${c.name}`).sort()}}function matchSub(list3,input){let m2=input.match(/^\/(\w+)\s+(\S*)$/);if(!m2)return null;let name=m2[1],sub2=m2[2],cmd=list3.find((c)=>c.name===name||c.aliases.includes(name));if(!cmd||cmd.subcommands.length===0)return null;let q5=sub2.toLowerCase(),matches=cmd.subcommands.filter((s)=>s.toLowerCase().startsWith(q5));if(matches.length===0)return null;return matches.map((s)=>({...cmd,name:`${cmd.name} ${s}`,description:`${cmd.name} \u2192 ${s}`,argsHint:"",subcommands:[]}))}var CATEGORY_ORDER=["Client","Session","Configuration","Config","Tools & Skills","Skills","Plugins","MCP","Info","Exit"];function sort(list3){let idx=(c)=>{let i=CATEGORY_ORDER.indexOf(c);return i<0?999:i};return[...list3].sort((a,b2)=>{let ca=idx(a.category)-idx(b2.category);return ca!==0?ca:a.name.localeCompare(b2.name)})}var import_react113=__toESM(require_react_production(),1);var bare=(s)=>s[0]==="/"?s.slice(1):s;function useSlashCommands(){let gw=useGateway(),ready=useGatewayReady(),[cmds,setCmds]=import_react113.useState(LOCAL_COMMANDS),fetch2=import_react113.useCallback(async()=>{let res=await gw.request("commands.catalog").catch(()=>null);if(!res){setCmds(LOCAL_COMMANDS);return}let cat=new Map;for(let g of res.categories??[])for(let[n]of g.pairs??[])cat.set(bare(n),g.name);let alias=new Map,addAlias=(name,value)=>{let k2=bare(name),v2=bare(value);if(k2===v2)return;let list3=alias.get(k2)??[];if(!list3.includes(v2))alias.set(k2,[...list3,v2])};for(let l of LOCAL_COMMANDS)for(let a of l.aliases)addAlias(l.name,a);for(let[a,c]of Object.entries(res.canon??{}))addAlias(c,a);let sub2=new Map(Object.entries(res.sub??{}).map(([k2,v2])=>[bare(k2),v2])),local=new Map(LOCAL_COMMANDS.map((c)=>[c.name,c])),remote2=(res.pairs??[]).map(([raw2,desc])=>{let name=bare(raw2),l=local.get(name),description=name==="quit"?desc.replace(/\s*\(usage:[^)]*\)\s*$/,""):desc;return{name,description,category:cat.get(name)??(name.includes(":")?"Skills":"Command"),aliases:alias.get(name)??[],argsHint:l?.argsHint??"",subcommands:sub2.get(name)??l?.subcommands??[],source:"command",target:LOCAL_NAMES.has(name)?"local":"gateway"}}),seen=new Set(remote2.map((c)=>c.name)),locals=LOCAL_COMMANDS.filter((c)=>!seen.has(c.name));setCmds(sort([...locals,...remote2]))},[gw]);return import_react113.useEffect(()=>{if(ready)fetch2()},[ready,fetch2]),{cmds,refresh:fetch2}}var import_react127=__toESM(require_react_production(),1);var import_react114=__toESM(require_react_production(),1);var GROUPS2=[{title:"Global",scope:"global"},{title:"Composer",scope:"composer"},{title:"Lists",scope:"list"},{title:"Dialogs",scope:"dialog"},{title:"Sessions",scope:"sessions"},{title:"Agents",scope:"agents"},{title:"Config",scope:"config"},{title:"Eikon",scope:"eikon"}],COLS3=2,HelpDialog=()=>{let theme=useTheme().theme,keys=useKeys(),sections2=import_react114.useMemo(()=>GROUPS2.map((g)=>({title:g.title,rows:keys.all(g.scope).filter((e)=>e.id!=="leader"&&e.chord.length>0).map((e)=>[keys.print(e.id),e.desc])})).filter((s)=>s.rows.length>0),[keys]),total=sections2.reduce((n,s)=>n+s.rows.length+2,0),split=Math.ceil(total/COLS3),cols2=[[],[]],acc2=0;for(let s of sections2){let h2=s.rows.length+2,i=acc2+h2<=split||cols2[0].length===0?0:1;if(cols2[i].push(s),i===0)acc2+=h2}return $jsxs("box",{flexDirection:"column",width:104,children:[$jsxs("box",{height:1,flexDirection:"row",children:[$jsx("box",{flexGrow:1,children:$jsx("text",{fg:theme.text,children:$jsx("strong",{children:"Keyboard Shortcuts"})})}),$jsx("text",{fg:theme.textMuted,children:`leader = ${keys.print("leader")}`})]}),$jsx("box",{height:1}),$jsx("box",{flexDirection:"row",gap:3,children:cols2.map((col,ci)=>$jsx("box",{flexDirection:"column",flexGrow:1,flexBasis:0,children:col.map((s)=>$jsxs("box",{flexDirection:"column",marginBottom:1,children:[$jsx("text",{fg:theme.primary,children:$jsx("strong",{children:s.title})}),s.rows.map(([chord,desc])=>$jsxs("box",{flexDirection:"row",height:1,paddingLeft:1,children:[$jsx("box",{width:14,children:$jsx("text",{fg:theme.accent,children:chord})}),$jsx("box",{flexGrow:1,minWidth:0,height:1,overflow:"hidden",children:$jsx("text",{fg:theme.textMuted,children:desc})})]},chord+desc))]},s.title))},ci))}),$jsx("text",{fg:theme.textMuted,children:"esc to close"})]})};var import_react115=__toESM(require_react_production(),1);import{existsSync as existsSync25,readFileSync as readFileSync19}from"fs";import{homedir as homedir7}from"os";import{join as join22}from"path";var OC_TO_HERM=[["leader","leader"],["app_exit","app.exit"],["terminal_suspend","app.suspend"],["sidebar_toggle","app.sidebar"],["command_list","palette.open"],["editor_open","editor.open"],["theme_list","theme.pick"],["model_list","model.pick"],["status_view","status.open"],["session_new","session.new"],["session_compact","session.compress"],["session_timeline","session.timeline"],["session_interrupt","session.interrupt"],["session_rename","sessions.rename"],["messages_copy","reply.copy"],["messages_redo","session.redo"],["input_clear","input.clear"],["input_submit","input.submit"],["input_newline","input.newline"],["input_paste","clipboard.attach"]],TABLE=new Map(OC_TO_HERM),ocPaths=(cwd=process.cwd())=>[join22(homedir7(),".config","opencode","tui.json"),join22(cwd,"tui.json"),join22(cwd,".opencode","tui.json"),join22(cwd,"opencode.json")],read2=(p)=>{if(!existsSync25(p))return{};return JSON.parse(readFileSync19(p,"utf8")).keybinds??{}},loadOcKeybinds=(cwd)=>{let merged={},sources=[];for(let p of ocPaths(cwd)){let kb=read2(p);if(Object.keys(kb).length===0)continue;Object.assign(merged,kb),sources.push(p)}let overrides={},skipped=[];for(let[oc,chord]of Object.entries(merged)){let herm=TABLE.get(oc);if(herm)overrides[herm]=chord;else skipped.push(oc)}return{overrides,skipped,sources}};var GROUPS3=[{title:"Global",scope:"global"},{title:"Composer",scope:"composer"},{title:"Lists",scope:"list"},{title:"Dialogs",scope:"dialog"},{title:"Sessions",scope:"sessions"},{title:"Agents",scope:"agents"},{title:"Config",scope:"config"}],KeysDialog=(props)=>{let theme=useTheme().theme,keys=useKeys(),toast=useToast(),overrides=exports_preferences.get("keys")??{},rows3=import_react115.useMemo(()=>GROUPS3.flatMap((g)=>{let entries2=keys.all(g.scope).filter((e)=>e.id!=="leader");if(entries2.length===0)return[];return[{type:"header",title:g.title},...entries2.map((e)=>({type:"action",id:e.id,desc:e.desc,chord:e.chord,override:overrides[e.id]!==void 0}))]}),[keys,overrides]),actionRows=rows3.map((r,i)=>({r,i})).filter((x2)=>x2.r.type==="action"),[sel,setSel]=import_react115.useState(0),cur=actionRows[sel]?.r,curConflicts=cur?conflictsWith(keys.table,cur.id):[],write=(id,value)=>{let next2={...exports_preferences.get("keys")??{}};if(value===void 0)delete next2[id];else next2[id]=value;exports_preferences.set("keys",next2)},rebind=(id)=>{let now2=overrides[id]??DEFAULTS2[id].chord;openTextPrompt(props.dialog,{title:`Rebind ${id}`,label:"Chord (e.g. ctrl+k, <leader>m, shift+return; empty = unbind)",initial:now2}).then((v2)=>{if(openKeys(props.dialog),v2===null)return;let parsed=parse2(v2);write(id,parsed.length===0?"none":v2)})},importOc=()=>{let r=loadOcKeybinds();if(r.sources.length===0)return toast.show({variant:"info",message:"No opencode tui.json found"});let n=Object.keys(r.overrides).length;openConfirm(props.dialog,{title:`Import ${n} keybind${n===1?"":"s"} from opencode?`,body:`${r.sources.map((s)=>`\xB7 ${s}`).join(`
4185
+ `;var TIERS=["block","slick","tiny"],pickFont=(innerW)=>TIERS.find((f)=>measureText({text:"HERM",font:f}).width<=innerW)??"tiny",clip=(s,w2)=>[...s].length<=w2?s:[...s].slice(0,Math.max(1,w2-1)).join("")+"\u2026";function Splash(p){let theme=useTheme().theme,ref=import_react111.useRef(null),[box2,setBox]=import_react111.useState({w:0,h:0}),renderer=useRenderer();import_react111.useEffect(()=>{let cb=async()=>{let r=ref.current;if(!r)return;setBox((b2)=>b2.w===r.width&&b2.h===r.height?b2:{w:r.width,h:r.height})};return renderer.setFrameCallback(cb),()=>renderer.removeFrameCallback(cb)},[renderer]);let{lines:lines3,inner}=import_react111.useMemo(()=>frame(box2.w,box2.h),[box2.w,box2.h]),font=import_react111.useMemo(()=>pickFont(inner.w),[inner.w]),[tip2,setTip]=import_react111.useState(()=>randomTip()),behind=p.info?.behind,count3=behind==null||behind<0?null:behind===0?"up to date":`${behind} behind`,sub2=[`v${VERSION}`,p.info?`hermes ${p.info.agentVersion??"?"}`:"\u2026",count3,p.info?.model].filter(Boolean).join(" \xB7 "),prompt=p.last&&!p.composing,title=p.last?.title?.trim()||p.last?.id;return $jsxs("box",{ref,position:"absolute",left:0,top:0,right:0,bottom:0,zIndex:50,backgroundColor:theme.background,children:[lines3.map((l,i)=>$jsx("box",{position:"absolute",top:i,left:0,height:1,children:$jsx("text",{fg:theme.accent,children:l})},i)),lines3.length>0&&$jsxs("box",{position:"absolute",left:inner.x,top:inner.y,width:inner.w,height:inner.h,flexDirection:"column",alignItems:"center",justifyContent:"center",children:[$jsx("box",{children:$jsx("ascii-font",{text:"HERM",font,color:[theme.accent,theme.textMuted],selectable:!1})}),$jsx("box",{height:1,children:$jsx("text",{fg:theme.textMuted,children:clip(sub2,inner.w)})}),p.news?$jsx("box",{height:1,children:$jsx("text",{fg:theme.textMuted,children:clip(`\u203A ${p.news}`,inner.w)})}):null,$jsx("box",{height:2}),p.loading?$jsx("text",{fg:theme.textMuted,children:$jsx("span",{fg:theme.accent,children:"Loading\u2026"})}):prompt?$jsxs($Fragment,{children:[$jsxs("text",{fg:theme.textMuted,children:["continue ",$jsxs("span",{fg:theme.text,children:['"',clip(title??"",Math.max(8,inner.w-14)),'"']})," ?"]}),$jsxs("text",{fg:theme.textMuted,children:[$jsx("span",{fg:theme.accent,children:"[enter]"})," yes \xB7 type to start fresh"]})]}):$jsxs("text",{fg:theme.textMuted,children:[$jsx("span",{fg:theme.accent,children:"[enter]"})," to send"]}),inner.h>=14?$jsx("box",{position:"absolute",bottom:0,left:0,right:0,flexDirection:"column",alignItems:"center",onMouseDown:()=>setTip((t2)=>randomTip(t2)),children:$jsx("text",{wrapMode:"word",children:splitTip(clip(tip2,inner.w*2)).map((s,i)=>$jsx("span",{fg:s.hl?theme.accent:theme.textMuted,children:s.t},i))})}):null]})]})}init_sessions_db();function openMessage(dialog,m2,ops){let text4=m2.parts.filter((p)=>p.type==="text").map((p)=>p.content).join("");dialog.replace($jsx(DialogSelect,{title:"Message Actions",options:[{title:"Copy",value:"copy",description:"message text to clipboard"},{title:"Rewind here",value:"rewind",description:"undo back to this turn (destructive)"},{title:"Fork here",value:"fork",description:"branch a new session at this point"}],onSelect:(o)=>{if(dialog.clear(),o.value==="copy")return void copyText(text4,ops.toast);if(o.value==="rewind")return ops.rewind(m2);if(o.value==="fork")return ops.fork(m2)}}))}var LOCAL_NAMES=new Set(["clear","new","theme","help","keys","logs","title","rollback","save","history","status","usage","profile","steer","reload","reload-mcp","reload-skills","chafa","splash","skin","resume","branch","compress","undo","redo","retry","model","yolo","quit","copy","paste","image","background","voice","mouse","redraw","queue","stash","compact","setup","browser"]),LOCAL_COMMANDS=[{name:"clear",description:"Clear chat messages",category:"Client",aliases:[],argsHint:"",subcommands:[],source:"local",target:"local"},{name:"new",description:"Start a new session",category:"Client",aliases:["reset"],argsHint:"",subcommands:[],source:"local",target:"local"},{name:"theme",description:"Switch color theme or mode",category:"Client",aliases:[],argsHint:"[light|dark]",subcommands:[],source:"local",target:"local"},{name:"help",description:"Show keyboard shortcuts",category:"Client",aliases:[],argsHint:"",subcommands:[],source:"local",target:"local"},{name:"keys",description:"Rebind keyboard shortcuts",category:"Client",aliases:[],argsHint:"",subcommands:[],source:"local",target:"local"},{name:"logs",description:"Show gateway stderr log",category:"Client",aliases:[],argsHint:"",subcommands:[],source:"local",target:"local"},{name:"title",description:"Set session title",category:"Client",aliases:[],argsHint:"[text]",subcommands:[],source:"local",target:"local"},{name:"rollback",description:"Browse & restore checkpoints",category:"Client",aliases:[],argsHint:"",subcommands:[],source:"local",target:"local"},{name:"history",description:"Server-side transcript viewer",category:"Info",aliases:[],argsHint:"",subcommands:[],source:"local",target:"local"},{name:"status",description:"Version, model, paths",category:"Info",aliases:[],argsHint:"",subcommands:[],source:"local",target:"local"},{name:"usage",description:"Credits, account status, tokens, context fill, cost",category:"Info",aliases:[],argsHint:"",subcommands:[],source:"local",target:"local"},{name:"profile",description:"Active profile details",category:"Info",aliases:[],argsHint:"",subcommands:[],source:"local",target:"local"},{name:"steer",description:"Inject a note mid-turn (no interrupt)",category:"Session",aliases:[],argsHint:"[text]",subcommands:[],source:"local",target:"local"},{name:"reload-mcp",description:"Restart MCP servers & rediscover tools",category:"Session",aliases:[],argsHint:"[now|always]",subcommands:["now","always"],source:"local",target:"local"},{name:"reload",description:"Hot-reload ~/.hermes/.env (API keys)",category:"Session",aliases:[],argsHint:"",subcommands:[],source:"local",target:"local"},{name:"reload-skills",description:"Re-scan ~/.hermes/skills/ for added/removed skills",category:"Session",aliases:["reload_skills"],argsHint:"",subcommands:[],source:"local",target:"local"},{name:"chafa",description:"Render image via chafa (demo)",category:"Client",aliases:[],argsHint:"<path>",subcommands:[],source:"local",target:"local"},{name:"splash",description:"Show the launch splash",category:"Client",aliases:[],argsHint:"",subcommands:[],source:"local",target:"local"},{name:"goal",description:"Set/control the session goal",category:"Session",aliases:[],argsHint:"[text|done|pause|resume|clear|status]",subcommands:["done","pause","resume","clear","status"],source:"command",target:"gateway"},{name:"skin",description:"Switch Hermes skin (+ theme + eikon)",category:"Client",aliases:[],argsHint:"[name]",subcommands:[...SKINS],source:"local",target:"local"},{name:"voice",description:"Toggle voice recording",category:"Client",aliases:[],argsHint:"[on|off|status|tts]",subcommands:["on","off","status","tts"],source:"local",target:"local"},{name:"queue",description:"Queue a prompt for the next idle turn",category:"Session",aliases:["q"],argsHint:"[text]",subcommands:[],source:"local",target:"local"},{name:"yolo",description:"Toggle approval bypass",category:"Session",aliases:[],argsHint:"",subcommands:[],source:"local",target:"local"},{name:"quit",description:"Exit herm",category:"Exit",aliases:["exit"],argsHint:"",subcommands:[],source:"local",target:"local"},{name:"stash",description:"Park the prompt (pop/list to restore)",category:"Client",aliases:[],argsHint:"[pop|list]",subcommands:["pop","list"],source:"local",target:"local"},{name:"redo",description:"Re-send the last undone message",category:"Session",aliases:[],argsHint:"",subcommands:[],source:"local",target:"local"},{name:"branch",description:"Fork current conversation",category:"Session",aliases:["fork"],argsHint:"[name]",subcommands:[],source:"local",target:"local"},{name:"browser",description:"Connect/disconnect a CDP browser",category:"Session",aliases:[],argsHint:"[connect|disconnect|status] [url]",subcommands:["connect","disconnect","status"],source:"local",target:"local"}];function resolve10(list3,name){let q5=name.toLowerCase();for(let c of list3)if(c.name.toLowerCase()===q5||c.aliases.some((a)=>a.toLowerCase()===q5))return{hit:c};let hits=new Set;for(let c of list3)for(let n of[c.name,...c.aliases])if(n.toLowerCase().startsWith(q5)){hits.add(c);break}if(hits.size===1)return{hit:[...hits][0]};if(hits.size===0)return{miss:!0};return{ambiguous:[...hits].map((c)=>`/${c.name}`).sort()}}function matchSub(list3,input){let m2=input.match(/^\/(\w+)\s+(\S*)$/);if(!m2)return null;let name=m2[1],sub2=m2[2],cmd=list3.find((c)=>c.name===name||c.aliases.includes(name));if(!cmd||cmd.subcommands.length===0)return null;let q5=sub2.toLowerCase(),matches=cmd.subcommands.filter((s)=>s.toLowerCase().startsWith(q5));if(matches.length===0)return null;return matches.map((s)=>({...cmd,name:`${cmd.name} ${s}`,description:`${cmd.name} \u2192 ${s}`,argsHint:"",subcommands:[]}))}var CATEGORY_ORDER=["Client","Session","Configuration","Config","Tools & Skills","Skills","Plugins","MCP","Info","Exit"];function sort(list3){let idx=(c)=>{let i=CATEGORY_ORDER.indexOf(c);return i<0?999:i};return[...list3].sort((a,b2)=>{let ca=idx(a.category)-idx(b2.category);return ca!==0?ca:a.name.localeCompare(b2.name)})}var import_react113=__toESM(require_react_production(),1);var bare=(s)=>s[0]==="/"?s.slice(1):s;function useSlashCommands(){let gw=useGateway(),ready=useGatewayReady(),[cmds,setCmds]=import_react113.useState(LOCAL_COMMANDS),fetch2=import_react113.useCallback(async()=>{let res=await gw.request("commands.catalog").catch(()=>null);if(!res){setCmds(LOCAL_COMMANDS);return}let cat=new Map;for(let g of res.categories??[])for(let[n]of g.pairs??[])cat.set(bare(n),g.name);let alias=new Map,addAlias=(name,value)=>{let k2=bare(name),v2=bare(value);if(k2===v2)return;let list3=alias.get(k2)??[];if(!list3.includes(v2))alias.set(k2,[...list3,v2])};for(let l of LOCAL_COMMANDS)for(let a of l.aliases)addAlias(l.name,a);for(let[a,c]of Object.entries(res.canon??{}))addAlias(c,a);let sub2=new Map(Object.entries(res.sub??{}).map(([k2,v2])=>[bare(k2),v2])),local=new Map(LOCAL_COMMANDS.map((c)=>[c.name,c])),remote2=(res.pairs??[]).map(([raw2,desc])=>{let name=bare(raw2),l=local.get(name),description=name==="quit"?desc.replace(/\s*\(usage:[^)]*\)\s*$/,""):desc;return{name,description,category:cat.get(name)??(name.includes(":")?"Skills":"Command"),aliases:alias.get(name)??[],argsHint:l?.argsHint??"",subcommands:sub2.get(name)??l?.subcommands??[],source:"command",target:LOCAL_NAMES.has(name)?"local":"gateway"}}),seen=new Set(remote2.map((c)=>c.name)),locals=LOCAL_COMMANDS.filter((c)=>!seen.has(c.name));setCmds(sort([...locals,...remote2]))},[gw]);return import_react113.useEffect(()=>{if(ready)fetch2()},[ready,fetch2]),{cmds,refresh:fetch2}}var import_react127=__toESM(require_react_production(),1);var import_react114=__toESM(require_react_production(),1);var GROUPS2=[{title:"Global",scope:"global"},{title:"Composer",scope:"composer"},{title:"Lists",scope:"list"},{title:"Dialogs",scope:"dialog"},{title:"Sessions",scope:"sessions"},{title:"Agents",scope:"agents"},{title:"Config",scope:"config"},{title:"Eikon",scope:"eikon"}],COLS3=2,HelpDialog=()=>{let theme=useTheme().theme,keys=useKeys(),sections2=import_react114.useMemo(()=>GROUPS2.map((g)=>({title:g.title,rows:keys.all(g.scope).filter((e)=>e.id!=="leader"&&e.chord.length>0).map((e)=>[keys.print(e.id),e.desc])})).filter((s)=>s.rows.length>0),[keys]),total=sections2.reduce((n,s)=>n+s.rows.length+2,0),split=Math.ceil(total/COLS3),cols2=[[],[]],acc2=0;for(let s of sections2){let h2=s.rows.length+2,i=acc2+h2<=split||cols2[0].length===0?0:1;if(cols2[i].push(s),i===0)acc2+=h2}return $jsxs("box",{flexDirection:"column",width:104,children:[$jsxs("box",{height:1,flexDirection:"row",children:[$jsx("box",{flexGrow:1,children:$jsx("text",{fg:theme.text,children:$jsx("strong",{children:"Keyboard Shortcuts"})})}),$jsx("text",{fg:theme.textMuted,children:`leader = ${keys.print("leader")}`})]}),$jsx("box",{height:1}),$jsx("box",{flexDirection:"row",gap:3,children:cols2.map((col,ci)=>$jsx("box",{flexDirection:"column",flexGrow:1,flexBasis:0,children:col.map((s)=>$jsxs("box",{flexDirection:"column",marginBottom:1,children:[$jsx("text",{fg:theme.primary,children:$jsx("strong",{children:s.title})}),s.rows.map(([chord,desc])=>$jsxs("box",{flexDirection:"row",height:1,paddingLeft:1,children:[$jsx("box",{width:14,children:$jsx("text",{fg:theme.accent,children:chord})}),$jsx("box",{flexGrow:1,minWidth:0,height:1,overflow:"hidden",children:$jsx("text",{fg:theme.textMuted,children:desc})})]},chord+desc))]},s.title))},ci))}),$jsx("text",{fg:theme.textMuted,children:"esc to close"})]})};var import_react115=__toESM(require_react_production(),1);import{existsSync as existsSync25,readFileSync as readFileSync19}from"fs";import{homedir as homedir7}from"os";import{join as join22}from"path";var OC_TO_HERM=[["leader","leader"],["app_exit","app.exit"],["terminal_suspend","app.suspend"],["sidebar_toggle","app.sidebar"],["command_list","palette.open"],["editor_open","editor.open"],["theme_list","theme.pick"],["model_list","model.pick"],["status_view","status.open"],["session_new","session.new"],["session_compact","session.compress"],["session_timeline","session.timeline"],["session_interrupt","session.interrupt"],["session_rename","sessions.rename"],["messages_copy","reply.copy"],["messages_redo","session.redo"],["input_clear","input.clear"],["input_submit","input.submit"],["input_newline","input.newline"],["input_paste","clipboard.attach"]],TABLE=new Map(OC_TO_HERM),ocPaths=(cwd=process.cwd())=>[join22(homedir7(),".config","opencode","tui.json"),join22(cwd,"tui.json"),join22(cwd,".opencode","tui.json"),join22(cwd,"opencode.json")],read2=(p)=>{if(!existsSync25(p))return{};return JSON.parse(readFileSync19(p,"utf8")).keybinds??{}},loadOcKeybinds=(cwd)=>{let merged={},sources=[];for(let p of ocPaths(cwd)){let kb=read2(p);if(Object.keys(kb).length===0)continue;Object.assign(merged,kb),sources.push(p)}let overrides={},skipped=[];for(let[oc,chord]of Object.entries(merged)){let herm=TABLE.get(oc);if(herm)overrides[herm]=chord;else skipped.push(oc)}return{overrides,skipped,sources}};var GROUPS3=[{title:"Global",scope:"global"},{title:"Composer",scope:"composer"},{title:"Lists",scope:"list"},{title:"Dialogs",scope:"dialog"},{title:"Sessions",scope:"sessions"},{title:"Agents",scope:"agents"},{title:"Config",scope:"config"}],KeysDialog=(props)=>{let theme=useTheme().theme,keys=useKeys(),toast=useToast(),overrides=exports_preferences.get("keys")??{},rows3=import_react115.useMemo(()=>GROUPS3.flatMap((g)=>{let entries2=keys.all(g.scope).filter((e)=>e.id!=="leader");if(entries2.length===0)return[];return[{type:"header",title:g.title},...entries2.map((e)=>({type:"action",id:e.id,desc:e.desc,chord:e.chord,override:overrides[e.id]!==void 0}))]}),[keys,overrides]),actionRows=rows3.map((r,i)=>({r,i})).filter((x2)=>x2.r.type==="action"),[sel,setSel]=import_react115.useState(0),cur=actionRows[sel]?.r,curConflicts=cur?conflictsWith(keys.table,cur.id):[],write=(id,value)=>{let next2={...exports_preferences.get("keys")??{}};if(value===void 0)delete next2[id];else next2[id]=value;exports_preferences.set("keys",next2)},rebind=(id)=>{let now2=overrides[id]??DEFAULTS2[id].chord;openTextPrompt(props.dialog,{title:`Rebind ${id}`,label:"Chord (e.g. ctrl+k, <leader>m, shift+return; empty = unbind)",initial:now2}).then((v2)=>{if(openKeys(props.dialog),v2===null)return;let parsed=parse2(v2);write(id,parsed.length===0?"none":v2)})},importOc=()=>{let r=loadOcKeybinds();if(r.sources.length===0)return toast.show({variant:"info",message:"No opencode tui.json found"});let n=Object.keys(r.overrides).length;openConfirm(props.dialog,{title:`Import ${n} keybind${n===1?"":"s"} from opencode?`,body:`${r.sources.map((s)=>`\xB7 ${s}`).join(`
4186
4186
  `)}
4187
4187
 
4188
4188
  ${n} mapped \xB7 ${r.skipped.length} skipped (no herm equivalent)${r.skipped.length?`:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "herm-tui",
3
- "version": "1.9.0",
3
+ "version": "1.9.1-dev.1",
4
4
  "description": "A modern TUI for Hermes Agent",
5
5
  "license": "MIT",
6
6
  "repository": {