pi-web-ui 0.62.0 → 0.63.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +504 -497
  3. package/README.zh-CN.md +427 -422
  4. package/bin/pi-web-ui.mjs +1809 -1881
  5. package/deploy/com.xingshuyin.pi-web-ui.plist +48 -48
  6. package/deploy/nginx-subpath.conf +88 -88
  7. package/deploy/pi-web-ui-task.xml +54 -54
  8. package/deploy/pi-web-ui.service +31 -31
  9. package/dist/server/agent-service.js +318 -88
  10. package/dist/server/attachments.js +37 -28
  11. package/dist/server/bg-servers.js +6 -1
  12. package/dist/server/client-state.js +15 -7
  13. package/dist/server/control-socket.js +1 -5
  14. package/dist/server/dsh/dsh-agent-service.js +454 -118
  15. package/dist/server/dsh/dsh-client.js +1 -3
  16. package/dist/server/dsh/dsh-sessions.js +4 -14
  17. package/dist/server/dsh/runtime/cordis.yml +1 -1
  18. package/dist/server/dsh/runtime/goal-rpc.mjs +645 -662
  19. package/dist/server/dsh/runtime/launcher.mjs +8 -18
  20. package/dist/server/dsh/runtime/override.patch.yml +9 -9
  21. package/dist/server/dsh/runtime/runtime-root.mjs +7 -11
  22. package/dist/server/ensure-bash.js +2 -5
  23. package/dist/server/files-service.js +42 -36
  24. package/dist/server/goal-service.js +59 -30
  25. package/dist/server/index.js +17 -10
  26. package/dist/server/mcp-bridge.js +11 -5
  27. package/dist/server/model-admin.js +78 -72
  28. package/dist/server/plugin-facilities.js +2 -4
  29. package/dist/server/plugin-updater.js +1 -1
  30. package/dist/server/plugins.js +26 -8
  31. package/dist/server/process-utils.js +4 -4
  32. package/dist/server/protocol-version.js +1 -1
  33. package/dist/server/scm.js +27 -21
  34. package/dist/server/serialize.js +1 -3
  35. package/dist/server/settings-service.js +63 -21
  36. package/dist/server/slash-commands.js +29 -3
  37. package/dist/server/subagent-templates.js +249 -0
  38. package/dist/server/subagents.js +150 -0
  39. package/dist/server/terminals.js +101 -40
  40. package/dist/server/text-sniff.js +4 -24
  41. package/dist/server/update-check.js +2 -4
  42. package/dist/server/uploads.js +1 -3
  43. package/dist/server/vision-bridge.js +2 -7
  44. package/dist/server/wait-subscription-scan.js +102 -21
  45. package/dist/server/webui-context.js +1 -1
  46. package/extensions/webui.ts +190 -192
  47. package/package.json +109 -103
  48. package/web/dist/assets/TerminalPanel-B9vcI7-_.js +2 -0
  49. package/web/dist/assets/index-B8Wv29p5.css +10 -0
  50. package/web/dist/assets/index-CWUWD0rq.js +323 -0
  51. package/web/dist/favicon.svg +8 -8
  52. package/web/dist/index.html +15 -15
  53. package/web/public/favicon.svg +8 -8
  54. package/web/dist/assets/TerminalPanel-BkCWDsIG.js +0 -2
  55. package/web/dist/assets/index-BRVKed7W.js +0 -321
  56. package/web/dist/assets/index-ORTpR6ZQ.css +0 -10
@@ -1,8 +1,8 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
2
- <!-- pi symbol favicon: violet rounded square + white π (drawn as paths,
3
- no font dependency) -->
4
- <rect width="64" height="64" rx="14" fill="#8b5cf6"/>
5
- <rect x="14" y="17" width="36" height="6.5" rx="3.25" fill="#ffffff"/>
6
- <rect x="17.5" y="23.5" width="6.5" height="25" rx="3.25" fill="#ffffff"/>
7
- <rect x="40" y="23.5" width="6.5" height="25" rx="3.25" fill="#ffffff"/>
8
- </svg>
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
2
+ <!-- pi symbol favicon: violet rounded square + white π (drawn as paths,
3
+ no font dependency) -->
4
+ <rect width="64" height="64" rx="14" fill="#8b5cf6"/>
5
+ <rect x="14" y="17" width="36" height="6.5" rx="3.25" fill="#ffffff"/>
6
+ <rect x="17.5" y="23.5" width="6.5" height="25" rx="3.25" fill="#ffffff"/>
7
+ <rect x="40" y="23.5" width="6.5" height="25" rx="3.25" fill="#ffffff"/>
8
+ </svg>
@@ -1,17 +1,17 @@
1
- <!doctype html>
2
- <html lang="zh-CN">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <meta name="color-scheme" content="dark" />
7
- <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
8
- <title>pi-web-ui — pi 编码智能体</title>
9
- <script type="module" crossorigin src="/assets/index-BRVKed7W.js"></script>
1
+ <!doctype html>
2
+ <html lang="zh-CN">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <meta name="color-scheme" content="dark" />
7
+ <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
8
+ <title>pi-web-ui — pi 编码智能体</title>
9
+ <script type="module" crossorigin src="/assets/index-CWUWD0rq.js"></script>
10
10
  <link rel="modulepreload" crossorigin href="/assets/markdown-DRBrS2Nf.js">
11
11
  <link rel="modulepreload" crossorigin href="/assets/react-C9ovnpIm.js">
12
- <link rel="stylesheet" crossorigin href="/assets/index-ORTpR6ZQ.css">
13
- </head>
14
- <body>
15
- <div id="root"></div>
16
- </body>
17
- </html>
12
+ <link rel="stylesheet" crossorigin href="/assets/index-B8Wv29p5.css">
13
+ </head>
14
+ <body>
15
+ <div id="root"></div>
16
+ </body>
17
+ </html>
@@ -1,8 +1,8 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
2
- <!-- pi symbol favicon: violet rounded square + white π (drawn as paths,
3
- no font dependency) -->
4
- <rect width="64" height="64" rx="14" fill="#8b5cf6"/>
5
- <rect x="14" y="17" width="36" height="6.5" rx="3.25" fill="#ffffff"/>
6
- <rect x="17.5" y="23.5" width="6.5" height="25" rx="3.25" fill="#ffffff"/>
7
- <rect x="40" y="23.5" width="6.5" height="25" rx="3.25" fill="#ffffff"/>
8
- </svg>
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
2
+ <!-- pi symbol favicon: violet rounded square + white π (drawn as paths,
3
+ no font dependency) -->
4
+ <rect width="64" height="64" rx="14" fill="#8b5cf6"/>
5
+ <rect x="14" y="17" width="36" height="6.5" rx="3.25" fill="#ffffff"/>
6
+ <rect x="17.5" y="23.5" width="6.5" height="25" rx="3.25" fill="#ffffff"/>
7
+ <rect x="40" y="23.5" width="6.5" height="25" rx="3.25" fill="#ffffff"/>
8
+ </svg>
@@ -1,2 +0,0 @@
1
- import{a as c,j as s}from"./markdown-DRBrS2Nf.js";import{b as R,T as I,u as L,F as J,a as K,c as X,d as Q,e as U,f as V,g as W,h as Y,r as Z}from"./index-BRVKed7W.js";import{D as ee,o as se}from"./xterm-D1D2FVe3.js";import"./react-C9ovnpIm.js";function ne({conversationId:t,terminalId:o,command:f,cwd:a,title:N,active:m,send:x,register:j}){const g=c.useRef(null),w=c.useRef(null),C=f?JSON.stringify(f):"";return c.useEffect(()=>{const u=g.current;if(!u)return;const n=new ee({theme:R(),fontFamily:'"SF Mono", "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace',fontSize:13,cursorBlink:!0,scrollback:8e3}),p=new se;n.loadAddon(p),n.open(u),w.current={term:n,fit:p},m&&n.focus();const v=()=>{n.options.theme=R()};window.addEventListener(I,v),n.attachCustomKeyEventHandler(r=>{var F;if(r.type!=="keydown")return!0;const E=(F=r.key)==null?void 0:F.toLowerCase();if((r.ctrlKey||r.metaKey)&&E==="v")return!1;if(r.ctrlKey&&!r.shiftKey&&!r.altKey&&E==="c"&&n.hasSelection()){const b=n.textarea;return b&&(b.value=n.getSelection(),b.select()),!1}return!0});const T=j(t,o,{write:r=>n.write(r),dispose:()=>n.dispose()}),h=()=>{try{p.fit(),x({type:"terminal_resize",terminalId:o,conversationId:t,cols:n.cols,rows:n.rows})}catch{}},k=requestAnimationFrame(()=>{try{p.fit()}catch{}x(f?{type:"run_command",terminalId:o,conversationId:t,command:f,cols:n.cols,rows:n.rows}:{type:"terminal_create",terminalId:o,title:N,conversationId:t,cwd:a,cols:n.cols,rows:n.rows})}),S=n.onData(r=>{x({type:"terminal_input",terminalId:o,conversationId:t,data:r})});let y=null;return typeof ResizeObserver<"u"&&(y=new ResizeObserver(()=>{u.offsetWidth>0&&u.offsetHeight>0&&h()}),y.observe(u)),()=>{cancelAnimationFrame(k),S.dispose(),window.removeEventListener(I,v),y==null||y.disconnect(),T(),n.dispose(),w.current=null}},[t,o,C,x,j]),c.useEffect(()=>{if(!m)return;const u=requestAnimationFrame(()=>{const n=w.current;if(n){try{n.fit.fit(),x({type:"terminal_resize",terminalId:o,conversationId:t,cols:n.term.cols,rows:n.term.rows})}catch{}n.term.focus()}});return()=>cancelAnimationFrame(u)},[m]),s.jsx("div",{ref:g,className:`term-xterm ${m?"":"hidden"}`})}const B={name:"",command:"",cwd:"${pwd}"};function re({chat:t,send:o,terminal:f}){const a=L(),[N,m]=c.useState(null),[x,j]=c.useState(!1),[g,w]=c.useState(!1),[C,u]=c.useState(null),[n,p]=c.useState(B),[v,T]=c.useState(null),h=c.useRef(null),[k,S]=c.useState(!0);c.useEffect(()=>{t.terminals.length===0?m(null):t.terminals.some(e=>e.id===N)||m(t.terminals[t.terminals.length-1].id)},[t.terminals,N]),c.useEffect(()=>{t.terminalActiveId&&(m(t.terminalActiveId),j(!1))},[t.terminalActiveId]),c.useEffect(()=>()=>{h.current&&clearTimeout(h.current)},[]);const y=t.terminals.filter(e=>!e.agentBash),r=t.terminals.filter(e=>e.agentBash),E=e=>{var d;if(!t.ready)return;const i=Z(),l=t.activeConversationId||((d=t.state)==null?void 0:d.conversationId)||"";f.create({...e,id:i,conversationId:l,cols:e.cols??80,rows:e.rows??24,running:!0,exitCode:null}),m(i),j(!1)},F=()=>{var e;return E({title:a("terminalTitle",{n:y.length+1}),cwd:((e=t.state)==null?void 0:e.cwd)??""})},b=e=>{var d;const i=e.name||e.command,l=t.terminals.find($=>$.title===i);if(l){f.restart(l.id),m(l.id),o({type:"run_command",terminalId:l.id,conversationId:l.conversationId,command:e,cols:80,rows:24});return}E({title:i,cwd:((d=t.state)==null?void 0:d.cwd)??"",command:e})},O=e=>{const i=t.terminals.find(l=>l.id===e);if(i&&o({type:"terminal_kill",terminalId:e,conversationId:i.conversationId}),f.close(e),N===e){const l=t.terminals.filter(d=>d.id!==e);m(l.length>0?l[l.length-1].id:null)}},D=e=>s.jsxs("div",{className:`term-tab ${e.id===N?"active":""}`,children:[s.jsxs("button",{type:"button",className:"term-tab-main",title:`${e.cwd}${e.command?`
2
- > ${e.command.command}`:""}`,onClick:()=>{m(e.id),j(!1)},children:[s.jsx("span",{className:`term-tab-dot ${e.running?"run":"exit"}`}),s.jsxs("span",{className:"term-tab-title",children:[e.title,!e.running&&s.jsx("span",{className:"term-tab-exit",children:a("exited",{code:e.exitCode===null?"":` ${e.exitCode}`})})]})]}),s.jsx("button",{type:"button",className:"term-tab-close",title:a("closeTerminal"),onClick:()=>O(e.id),children:s.jsx(Y,{})})]},e.id),M=()=>{w(!0),u(null),p(B)},z=e=>{const i=t.commands[e];i&&(w(!1),u(e),p({name:i.name,command:i.command,cwd:i.cwd??""}))},A=()=>{w(!1),u(null)},_=()=>{const e=n.name.trim(),i=n.command.trim();if(!e||!i)return;const l=n.cwd.trim(),d={name:e,command:i,cwd:l||void 0},$=g?[...t.commands,d]:C!==null?t.commands.map((q,G)=>G===C?d:q):t.commands;o({type:"save_commands",commands:$}),A()},H=e=>{if(v===e){const i=t.commands.filter((l,d)=>d!==e);o({type:"save_commands",commands:i}),T(null),h.current&&clearTimeout(h.current)}else T(e),h.current&&clearTimeout(h.current),h.current=setTimeout(()=>T(null),2500)},P=g||C!==null;return s.jsxs("div",{className:"terminal-view",children:[s.jsxs("aside",{className:`term-side term-commands ${x?"open":""}`,children:[s.jsxs("div",{className:"panel-header",children:[s.jsx("span",{className:"panel-title",children:a("commands")}),s.jsxs("div",{className:"panel-header-actions",children:[s.jsx("button",{type:"button",className:"panel-refresh",title:a("rerun"),onClick:()=>o({type:"list_commands"}),children:s.jsx(J,{})}),s.jsx("button",{type:"button",className:"panel-new",title:a("newCommand"),onClick:M,children:s.jsx(K,{})})]})]}),s.jsx("div",{className:"panel-body",children:P?s.jsxs("div",{className:"cmd-form",children:[s.jsx("label",{htmlFor:"cmd-name",children:a("name")}),s.jsx("input",{id:"cmd-name",className:"cmd-input",value:n.name,placeholder:a("exampleName"),autoFocus:!0,onChange:e=>p({...n,name:e.target.value})}),s.jsx("label",{htmlFor:"cmd-command",children:a("command")}),s.jsx("input",{id:"cmd-command",className:"cmd-input",value:n.command,placeholder:a("exampleCommand"),onChange:e=>p({...n,command:e.target.value}),onKeyDown:e=>{e.key==="Enter"&&!e.nativeEvent.isComposing&&_()}}),s.jsxs("label",{htmlFor:"cmd-cwd",children:[a("directory")," ",s.jsx("span",{className:"cmd-hint",children:a("cwdHint")})]}),s.jsx("input",{id:"cmd-cwd",className:"cmd-input",value:n.cwd,placeholder:"${pwd}",onChange:e=>p({...n,cwd:e.target.value}),onKeyDown:e=>{e.key==="Enter"&&!e.nativeEvent.isComposing&&_()}}),s.jsxs("div",{className:"cmd-form-actions",children:[s.jsx("button",{type:"button",className:"btn",onClick:A,children:a("cancel")}),s.jsx("button",{type:"button",className:"btn primary",disabled:!n.name.trim()||!n.command.trim(),onClick:_,children:a("save")})]})]}):s.jsxs(s.Fragment,{children:[t.commands.length===0&&s.jsx("div",{className:"panel-empty",children:a("noCommands")}),t.commands.map((e,i)=>s.jsxs("div",{className:"cmd-item",children:[s.jsx("button",{type:"button",className:"cmd-run",title:a("clickToRun"),onClick:()=>b(e),children:s.jsx(X,{})}),s.jsxs("button",{type:"button",className:"cmd-main",title:a("clickToRun"),onClick:()=>b(e),children:[s.jsx("span",{className:"cmd-name",children:e.name}),s.jsx("span",{className:"cmd-command",children:e.command}),e.cwd&&s.jsx("span",{className:"cmd-cwd",children:e.cwd})]}),s.jsx("button",{type:"button",className:"cmd-act",title:a("edit"),onClick:()=>z(i),children:s.jsx(Q,{})}),s.jsx("button",{type:"button",className:`cmd-act del ${v===i?"confirm":""}`,title:a("delete"),onClick:()=>H(i),children:v===i?a("confirmQ"):s.jsx(U,{})})]},i))]})}),s.jsxs("div",{className:"term-tabs-block",children:[s.jsxs("div",{className:"panel-header",children:[s.jsx("span",{className:"panel-title",children:a("terminal")}),s.jsx("button",{type:"button",className:"panel-new",title:a("newTerminal"),onClick:F,children:s.jsx(K,{})})]}),s.jsxs("div",{className:"panel-body",children:[t.terminals.length===0&&s.jsx("div",{className:"panel-empty",children:a("noTerminal")}),y.map(D),r.length>0&&s.jsxs("div",{className:"term-folder",children:[s.jsxs("button",{type:"button",className:`term-folder-header ${k?"open":""}`,title:a("aiBashGroup"),onClick:()=>S(e=>!e),children:[s.jsx("span",{className:"term-folder-caret",children:k?"▾":"▸"}),s.jsx("span",{className:"term-folder-title",children:a("aiBashGroup")}),s.jsx("span",{className:"term-folder-count",children:r.length})]}),k&&s.jsx("div",{className:"term-folder-body",children:r.map(D)})]})]})]})]}),s.jsxs("div",{className:"term-main",children:[x&&s.jsx("div",{className:"drawer-backdrop",onClick:()=>j(!1)}),s.jsx("button",{type:"button",className:"term-side-toggle",title:a("commands"),onClick:()=>j(e=>!e),children:s.jsx(V,{})}),t.terminals.length===0?s.jsxs("div",{className:"term-empty",children:[s.jsx(W,{className:"term-empty-icon"}),s.jsx("div",{className:"term-empty-title",children:a("builtinTerminal")}),s.jsx("div",{className:"term-empty-sub",children:a("termEmptySub")})]}):t.terminals.map(e=>s.jsx(ne,{conversationId:e.conversationId,terminalId:e.id,command:e.command,cwd:e.cwd,title:e.title,active:e.id===N,send:o,register:f.register},`${e.conversationId}:${e.id}`))]})]})}export{re as TerminalPanel};