pi-web-ui 0.61.0 → 0.62.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.
- package/LICENSE +21 -21
- package/README.md +497 -497
- package/README.zh-CN.md +422 -422
- package/bin/pi-web-ui.mjs +1881 -1881
- package/deploy/com.xingshuyin.pi-web-ui.plist +48 -48
- package/deploy/nginx-subpath.conf +88 -88
- package/deploy/pi-web-ui-task.xml +54 -54
- package/deploy/pi-web-ui.service +31 -31
- package/dist/server/agent-service.js +65 -8
- package/dist/server/attachments.js +3 -3
- package/dist/server/dsh/dsh-agent-service.js +14 -0
- package/dist/server/dsh/runtime/goal-rpc.mjs +662 -662
- package/dist/server/index.js +4 -1
- package/dist/server/terminals.js +4 -4
- package/extensions/webui.ts +192 -192
- package/package.json +103 -103
- package/web/dist/assets/TerminalPanel-CrduzEDu.js +2 -0
- package/web/dist/assets/index-ORTpR6ZQ.css +10 -0
- package/web/dist/assets/index-eRkSgiu6.js +321 -0
- package/web/dist/favicon.svg +8 -8
- package/web/dist/index.html +15 -15
- package/web/public/favicon.svg +8 -8
- package/web/dist/assets/TerminalPanel-CYq-pKeS.js +0 -2
- package/web/dist/assets/index-BVuOleif.js +0 -321
- package/web/dist/assets/index-CxB1f4vG.css +0 -10
package/web/dist/favicon.svg
CHANGED
|
@@ -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>
|
package/web/dist/index.html
CHANGED
|
@@ -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-
|
|
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-eRkSgiu6.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-
|
|
13
|
-
</head>
|
|
14
|
-
<body>
|
|
15
|
-
<div id="root"></div>
|
|
16
|
-
</body>
|
|
17
|
-
</html>
|
|
12
|
+
<link rel="stylesheet" crossorigin href="/assets/index-ORTpR6ZQ.css">
|
|
13
|
+
</head>
|
|
14
|
+
<body>
|
|
15
|
+
<div id="root"></div>
|
|
16
|
+
</body>
|
|
17
|
+
</html>
|
package/web/public/favicon.svg
CHANGED
|
@@ -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-BVuOleif.js";import{D as ee,o as se}from"./xterm-D1D2FVe3.js";import"./react-C9ovnpIm.js";function ne({conversationId:n,terminalId:o,command:x,cwd:t,active:f,send:m,register:b}){const j=c.useRef(null),w=c.useRef(null),g=x?JSON.stringify(x):"";return c.useEffect(()=>{const p=j.current;if(!p)return;const a=new ee({theme:R(),fontFamily:'"SF Mono", "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace',fontSize:13,cursorBlink:!0,scrollback:8e3}),r=new se;a.loadAddon(r),a.open(p),w.current={term:a,fit:r},f&&a.focus();const y=()=>{a.options.theme=R()};window.addEventListener(I,y),a.attachCustomKeyEventHandler(d=>{var E;if(d.type!=="keydown")return!0;const v=(E=d.key)==null?void 0:E.toLowerCase();if((d.ctrlKey||d.metaKey)&&v==="v")return!1;if(d.ctrlKey&&!d.shiftKey&&!d.altKey&&v==="c"&&a.hasSelection()){const F=a.textarea;return F&&(F.value=a.getSelection(),F.select()),!1}return!0});const C=b(n,o,{write:d=>a.write(d),dispose:()=>a.dispose()}),T=()=>{try{r.fit(),m({type:"terminal_resize",terminalId:o,conversationId:n,cols:a.cols,rows:a.rows})}catch{}},h=requestAnimationFrame(()=>{try{r.fit()}catch{}m(x?{type:"run_command",terminalId:o,conversationId:n,command:x,cols:a.cols,rows:a.rows}:{type:"terminal_create",terminalId:o,conversationId:n,cwd:t,cols:a.cols,rows:a.rows})}),k=a.onData(d=>{m({type:"terminal_input",terminalId:o,conversationId:n,data:d})});let N=null;return typeof ResizeObserver<"u"&&(N=new ResizeObserver(()=>{p.offsetWidth>0&&p.offsetHeight>0&&T()}),N.observe(p)),()=>{cancelAnimationFrame(h),k.dispose(),window.removeEventListener(I,y),N==null||N.disconnect(),C(),a.dispose(),w.current=null}},[n,o,g,m,b]),c.useEffect(()=>{if(!f)return;const p=requestAnimationFrame(()=>{const a=w.current;if(a){try{a.fit.fit(),m({type:"terminal_resize",terminalId:o,conversationId:n,cols:a.term.cols,rows:a.term.rows})}catch{}a.term.focus()}});return()=>cancelAnimationFrame(p)},[f]),s.jsx("div",{ref:j,className:`term-xterm ${f?"":"hidden"}`})}const B={name:"",command:"",cwd:"${pwd}"};function re({chat:n,send:o,terminal:x}){const t=L(),[f,m]=c.useState(null),[b,j]=c.useState(!1),[w,g]=c.useState(!1),[p,a]=c.useState(null),[r,y]=c.useState(B),[C,T]=c.useState(null),h=c.useRef(null),[k,N]=c.useState(!0);c.useEffect(()=>{n.terminals.length===0?m(null):n.terminals.some(e=>e.id===f)||m(n.terminals[n.terminals.length-1].id)},[n.terminals,f]),c.useEffect(()=>{n.terminalActiveId&&(m(n.terminalActiveId),j(!1))},[n.terminalActiveId]),c.useEffect(()=>()=>{h.current&&clearTimeout(h.current)},[]);const d=n.terminals.filter(e=>!e.agentBash),v=n.terminals.filter(e=>e.agentBash),E=e=>{var u;if(!n.ready)return;const i=Z(),l=n.activeConversationId||((u=n.state)==null?void 0:u.conversationId)||"";x.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:t("terminalTitle",{n:d.length+1}),cwd:((e=n.state)==null?void 0:e.cwd)??""})},$=e=>{var u;const i=e.name||e.command,l=n.terminals.find(_=>_.title===i);if(l){x.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:((u=n.state)==null?void 0:u.cwd)??"",command:e})},O=e=>{const i=n.terminals.find(l=>l.id===e);if(i&&o({type:"terminal_kill",terminalId:e,conversationId:i.conversationId}),x.close(e),f===e){const l=n.terminals.filter(u=>u.id!==e);m(l.length>0?l[l.length-1].id:null)}},D=e=>s.jsxs("div",{className:`term-tab ${e.id===f?"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:t("exited",{code:e.exitCode===null?"":` ${e.exitCode}`})})]})]}),s.jsx("button",{type:"button",className:"term-tab-close",title:t("closeTerminal"),onClick:()=>O(e.id),children:s.jsx(Y,{})})]},e.id),M=()=>{g(!0),a(null),y(B)},z=e=>{const i=n.commands[e];i&&(g(!1),a(e),y({name:i.name,command:i.command,cwd:i.cwd??""}))},A=()=>{g(!1),a(null)},S=()=>{const e=r.name.trim(),i=r.command.trim();if(!e||!i)return;const l=r.cwd.trim(),u={name:e,command:i,cwd:l||void 0},_=w?[...n.commands,u]:p!==null?n.commands.map((q,G)=>G===p?u:q):n.commands;o({type:"save_commands",commands:_}),A()},H=e=>{if(C===e){const i=n.commands.filter((l,u)=>u!==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=w||p!==null;return s.jsxs("div",{className:"terminal-view",children:[s.jsxs("aside",{className:`term-side term-commands ${b?"open":""}`,children:[s.jsxs("div",{className:"panel-header",children:[s.jsx("span",{className:"panel-title",children:t("commands")}),s.jsxs("div",{className:"panel-header-actions",children:[s.jsx("button",{type:"button",className:"panel-refresh",title:t("rerun"),onClick:()=>o({type:"list_commands"}),children:s.jsx(J,{})}),s.jsx("button",{type:"button",className:"panel-new",title:t("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:t("name")}),s.jsx("input",{id:"cmd-name",className:"cmd-input",value:r.name,placeholder:t("exampleName"),autoFocus:!0,onChange:e=>y({...r,name:e.target.value})}),s.jsx("label",{htmlFor:"cmd-command",children:t("command")}),s.jsx("input",{id:"cmd-command",className:"cmd-input",value:r.command,placeholder:t("exampleCommand"),onChange:e=>y({...r,command:e.target.value}),onKeyDown:e=>{e.key==="Enter"&&!e.nativeEvent.isComposing&&S()}}),s.jsxs("label",{htmlFor:"cmd-cwd",children:[t("directory")," ",s.jsx("span",{className:"cmd-hint",children:t("cwdHint")})]}),s.jsx("input",{id:"cmd-cwd",className:"cmd-input",value:r.cwd,placeholder:"${pwd}",onChange:e=>y({...r,cwd:e.target.value}),onKeyDown:e=>{e.key==="Enter"&&!e.nativeEvent.isComposing&&S()}}),s.jsxs("div",{className:"cmd-form-actions",children:[s.jsx("button",{type:"button",className:"btn",onClick:A,children:t("cancel")}),s.jsx("button",{type:"button",className:"btn primary",disabled:!r.name.trim()||!r.command.trim(),onClick:S,children:t("save")})]})]}):s.jsxs(s.Fragment,{children:[n.commands.length===0&&s.jsx("div",{className:"panel-empty",children:t("noCommands")}),n.commands.map((e,i)=>s.jsxs("div",{className:"cmd-item",children:[s.jsx("button",{type:"button",className:"cmd-run",title:t("clickToRun"),onClick:()=>$(e),children:s.jsx(X,{})}),s.jsxs("button",{type:"button",className:"cmd-main",title:t("clickToRun"),onClick:()=>$(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:t("edit"),onClick:()=>z(i),children:s.jsx(Q,{})}),s.jsx("button",{type:"button",className:`cmd-act del ${C===i?"confirm":""}`,title:t("delete"),onClick:()=>H(i),children:C===i?t("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:t("terminal")}),s.jsx("button",{type:"button",className:"panel-new",title:t("newTerminal"),onClick:F,children:s.jsx(K,{})})]}),s.jsxs("div",{className:"panel-body",children:[n.terminals.length===0&&s.jsx("div",{className:"panel-empty",children:t("noTerminal")}),d.map(D),v.length>0&&s.jsxs("div",{className:"term-folder",children:[s.jsxs("button",{type:"button",className:`term-folder-header ${k?"open":""}`,title:t("aiBashGroup"),onClick:()=>N(e=>!e),children:[s.jsx("span",{className:"term-folder-caret",children:k?"▾":"▸"}),s.jsx("span",{className:"term-folder-title",children:t("aiBashGroup")}),s.jsx("span",{className:"term-folder-count",children:v.length})]}),k&&s.jsx("div",{className:"term-folder-body",children:v.map(D)})]})]})]})]}),s.jsxs("div",{className:"term-main",children:[b&&s.jsx("div",{className:"drawer-backdrop",onClick:()=>j(!1)}),s.jsx("button",{type:"button",className:"term-side-toggle",title:t("commands"),onClick:()=>j(e=>!e),children:s.jsx(V,{})}),n.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:t("builtinTerminal")}),s.jsx("div",{className:"term-empty-sub",children:t("termEmptySub")})]}):n.terminals.map(e=>s.jsx(ne,{conversationId:e.conversationId,terminalId:e.id,command:e.command,cwd:e.cwd,active:e.id===f,send:o,register:x.register},`${e.conversationId}:${e.id}`))]})]})}export{re as TerminalPanel};
|