@jetcrab/pi-desk-subagent 1.0.1 → 1.0.2-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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{useEffect as L,useRef as J,useState as d}from"react";import{createRoot as R}from"react-dom/client";import{PluginAlert as H,PluginButton as V,PluginCheckbox as z,PluginConfirmDialog as G,PluginErrorBoundary as M,PluginLoadingState as T,PluginPanelHeader as q,
|
|
1
|
+
import{useEffect as L,useRef as J,useState as d}from"react";import{createRoot as R}from"react-dom/client";import{PluginAlert as H,PluginButton as V,PluginCheckbox as z,PluginConfirmDialog as G,PluginErrorBoundary as M,PluginLoadingState as T,PluginPanelHeader as q,PluginSelect as C,PluginSurface as X}from"@jetcrab/pi-desk-sdk/react/base";import{Fragment as W,jsx as t,jsxs as o}from"react/jsx-runtime";var j=[{value:"",label:"\u89D2\u8272\u9ED8\u8BA4"},{value:"off",label:"\u5173\u95ED"},{value:"minimal",label:"\u6781\u4F4E"},{value:"low",label:"\u4F4E"},{value:"medium",label:"\u4E2D"},{value:"high",label:"\u9AD8"},{value:"xhigh",label:"\u6781\u9AD8"},{value:"max",label:"\u6700\u5927"}],F=`
|
|
2
2
|
.subagent-settings {
|
|
3
3
|
min-height: 100%;
|
|
4
4
|
container-name: subagent-settings;
|
|
@@ -73,4 +73,4 @@ import{useEffect as L,useRef as J,useState as d}from"react";import{createRoot as
|
|
|
73
73
|
border: 0;
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
|
-
`;function K({host:u,target:g,signal:s}){let[i,m]=d(null),[c,v]=d([]),[D,k]=d(!0),[a,w]=d(!1),[h,b]=d(null),[E,y]=d(!1),r=J(null),f=i!==null&&JSON.stringify(c)!==JSON.stringify(i.agents);L(()=>(g.setBeforeLeave(()=>a?!1:f?new Promise(e=>{r.current?.(!1),r.current=e,y(!0)}):!0),()=>{g.setBeforeLeave(null),r.current?.(!1),r.current=null}),[g,f,a]);async function P(){return await u.piDesk.invokeGlobal("settings-get",{})}function N(e){s.aborted||(m(e),v(e.agents))}function x(e){s.aborted||b(e instanceof Error?e.message:String(e))}function B(){s.aborted||k(!1)}async function O(){await P().then(N).catch(x).finally(B)}async function $(){k(!0),b(null),await O()}L(()=>{P().then(N).catch(x).finally(B)},[]);function S(e,l){v(n=>n.map(p=>p.name===e?{...p,...l}:p))}async function A(){if(!(!i||!f||a)){w(!0),b(null);try{let e=c.filter((n,p)=>JSON.stringify(n)!==JSON.stringify(i.agents[p])),l=await u.piDesk.invokeGlobal("settings-save",{agents:e});if(s.aborted)return;m({...i,agents:l.agents}),v(l.agents),u.notify({level:"success",title:"\u5B50\u4EE3\u7406\u8BBE\u7F6E\u5DF2\u4FDD\u5B58"})}catch(e){s.aborted||b(e instanceof Error?e.message:String(e))}finally{s.aborted||w(!1)}}}let I=[{value:"",label:"\u89D2\u8272\u9ED8\u8BA4\u6A21\u578B"},...(i?.models??[]).map(e=>({value:`${e.provider}/${e.modelId}`,label:`${e.provider} / ${e.name||e.modelId}`,textValue:`${e.provider} ${e.modelId}`}))];return o(
|
|
76
|
+
`;function K({host:u,target:g,signal:s}){let[i,m]=d(null),[c,v]=d([]),[D,k]=d(!0),[a,w]=d(!1),[h,b]=d(null),[E,y]=d(!1),r=J(null),f=i!==null&&JSON.stringify(c)!==JSON.stringify(i.agents);L(()=>(g.setBeforeLeave(()=>a?!1:f?new Promise(e=>{r.current?.(!1),r.current=e,y(!0)}):!0),()=>{g.setBeforeLeave(null),r.current?.(!1),r.current=null}),[g,f,a]);async function P(){return await u.piDesk.invokeGlobal("settings-get",{})}function N(e){s.aborted||(m(e),v(e.agents))}function x(e){s.aborted||b(e instanceof Error?e.message:String(e))}function B(){s.aborted||k(!1)}async function O(){await P().then(N).catch(x).finally(B)}async function $(){k(!0),b(null),await O()}L(()=>{P().then(N).catch(x).finally(B)},[]);function S(e,l){v(n=>n.map(p=>p.name===e?{...p,...l}:p))}async function A(){if(!(!i||!f||a)){w(!0),b(null);try{let e=c.filter((n,p)=>JSON.stringify(n)!==JSON.stringify(i.agents[p])),l=await u.piDesk.invokeGlobal("settings-save",{agents:e});if(s.aborted)return;m({...i,agents:l.agents}),v(l.agents),u.notify({level:"success",title:"\u5B50\u4EE3\u7406\u8BBE\u7F6E\u5DF2\u4FDD\u5B58"})}catch(e){s.aborted||b(e instanceof Error?e.message:String(e))}finally{s.aborted||w(!1)}}}let I=[{value:"",label:"\u89D2\u8272\u9ED8\u8BA4\u6A21\u578B"},...(i?.models??[]).map(e=>({value:`${e.provider}/${e.modelId}`,label:`${e.provider} / ${e.name||e.modelId}`,textValue:`${e.provider} ${e.modelId}`}))];return o(X,{className:"subagent-settings",children:[t("style",{children:F}),t(q,{className:"subagent-settings-header",title:"\u5B50\u4EE3\u7406",description:"\u5168\u5C40\u9ED8\u8BA4\u914D\u7F6E\uFF0C\u9879\u76EE\u8BBE\u7F6E\u4F18\u5148\u3002",actions:t(V,{disabled:!f||a,onClick:()=>void A(),children:a?"\u4FDD\u5B58\u4E2D\u2026":"\u4FDD\u5B58\u8BBE\u7F6E"})}),t("div",{className:"subagent-settings-content",children:t(T,{loading:D&&!i,error:i?null:h,onRetry:()=>void $(),children:i?o(W,{children:[o("div",{className:"subagent-settings-list",children:[o("div",{className:"subagent-settings-columns","aria-hidden":"true",children:[t("span",{children:"\u5B50\u4EE3\u7406"}),t("span",{children:"\u6A21\u578B"}),t("span",{children:"\u601D\u8003\u7B49\u7EA7"})]}),c.map(e=>{let l=[...I];return e.model&&!l.some(n=>n.value===e.model)&&l.push({value:e.model,label:`${e.model}\uFF08\u5F53\u524D\u4E0D\u53EF\u7528\uFF09`}),o("div",{className:"subagent-settings-agent",role:"group","aria-label":e.name,children:[o("label",{className:"subagent-settings-toggle",children:[t(z,{"aria-label":`\u542F\u7528 ${e.name}`,checked:!e.disabled,disabled:a,onChange:n=>S(e.name,{disabled:!n.target.checked})}),t("span",{children:e.name})]}),o("div",{className:"subagent-settings-fields",children:[t(C,{className:"subagent-settings-field",label:"\u6A21\u578B",value:e.model,options:l,disabled:a||e.disabled,onValueChange:n=>S(e.name,{model:n??"",thinking:n?e.thinking:null})}),t(C,{className:"subagent-settings-field",label:"\u601D\u8003\u7B49\u7EA7",value:e.thinking??"",options:j,disabled:a||e.disabled||!e.model,onValueChange:n=>S(e.name,{thinking:n||null})})]})]},e.name)})]}),h?t(H,{tone:"error",density:"compact",children:h}):null,t("p",{className:"subagent-settings-note",children:"\u4FDD\u5B58\u540E\u4E0B\u6B21\u542F\u52A8\u6216\u6062\u590D\u5B50\u4EE3\u7406\u65F6\u751F\u6548\uFF0C\u8FD0\u884C\u4E2D\u7684\u4EFB\u52A1\u4E0D\u53D7\u5F71\u54CD\u3002"})]}):null})}),t(G,{open:E,title:"\u653E\u5F03\u672A\u4FDD\u5B58\u7684\u8BBE\u7F6E\uFF1F",confirmLabel:"\u653E\u5F03\u4FEE\u6539",onConfirm:()=>{r.current?.(!0),r.current=null,y(!1)},onOpenChange:e=>{e||(r.current?.(!1),r.current=null,y(!1))}})]})}var Q=0,U={mount({container:u,host:g,target:s,signal:i}){let m=R(u,{identifierPrefix:`subagent-settings-${++Q}-`});return m.render(t(M,{onError:c=>g.notify({level:"error",title:"\u5B50\u4EE3\u7406\u8BBE\u7F6E\u663E\u793A\u5931\u8D25",description:c.message}),children:t(K,{host:g,target:s,signal:i})})),()=>m.unmount()}},ee=U;export{ee as default};
|
package/dist/browser/entry.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function n(t){if(typeof t!="function")throw new Error("Browser Entry factory must be a function");return t}var r=()=>import("./chunks/browser-ZO5HSBS2.js"),a=n(t=>{t.registerContribution("settings-page","subagent",{label:"\u5B50\u4EE3\u7406",icon:{type:"builtin",name:"bot"},load:()=>import("./chunks/browser-settings-
|
|
1
|
+
function n(t){if(typeof t!="function")throw new Error("Browser Entry factory must be a function");return t}var r=()=>import("./chunks/browser-ZO5HSBS2.js"),a=n(t=>{t.registerContribution("settings-page","subagent",{label:"\u5B50\u4EE3\u7406",icon:{type:"builtin",name:"bot"},load:()=>import("./chunks/browser-settings-CXYU7ZHB.js").then(e=>e.default)}),t.registerContribution("message-view","start",{viewKey:"subagent/start",priority:100,load:()=>r().then(e=>e.startMessageView)}),t.registerContribution("message-view","list",{viewKey:"subagent/list",priority:100,load:()=>r().then(e=>e.listMessageView)}),t.registerContribution("message-view","control",{viewKey:"subagent/control",priority:100,load:()=>r().then(e=>e.controlMessageView)}),t.registerContribution("message-view","return",{viewKey:"subagent/return",priority:100,load:()=>r().then(e=>e.returnMessageView)})});export{a as default};
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"url": "git+https://github.com/JetCrab/pi-desk.git",
|
|
6
6
|
"directory": "plugins/pi-desk-subagent"
|
|
7
7
|
},
|
|
8
|
-
"version": "1.0.1",
|
|
8
|
+
"version": "1.0.2-dev.1",
|
|
9
9
|
"license": "Apache-2.0",
|
|
10
10
|
"publishConfig": {
|
|
11
11
|
"registry": "https://registry.npmjs.org",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"README.md"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@jetcrab/pi-desk-sdk": "^1.0.
|
|
25
|
+
"@jetcrab/pi-desk-sdk": "^1.0.1-dev.9002"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"@earendil-works/pi-agent-core": "*",
|
|
@@ -31,7 +31,8 @@
|
|
|
31
31
|
"typebox": "*"
|
|
32
32
|
},
|
|
33
33
|
"keywords": [
|
|
34
|
-
"pi-package"
|
|
34
|
+
"pi-package",
|
|
35
|
+
"pi-desk-plugin"
|
|
35
36
|
],
|
|
36
37
|
"pi": {
|
|
37
38
|
"extensions": [
|
|
@@ -39,7 +40,12 @@
|
|
|
39
40
|
]
|
|
40
41
|
},
|
|
41
42
|
"piDesk": {
|
|
42
|
-
"entry": "./dist/pi-desk.js"
|
|
43
|
+
"entry": "./dist/pi-desk.js",
|
|
44
|
+
"i18n": {
|
|
45
|
+
"zh-CN": {
|
|
46
|
+
"description": "将任务交给独立子代理执行,并在 Pi Desk 中查看子任务进度与结果。"
|
|
47
|
+
}
|
|
48
|
+
}
|
|
43
49
|
},
|
|
44
50
|
"devDependencies": {
|
|
45
51
|
"@base-ui/react": "^1.7.0",
|