@jetcrab/pi-desk 1.1.5 → 1.1.8-dev
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/README.md +4 -4
- package/README.zh-CN.md +4 -4
- package/docs/README.md +8 -0
- package/docs/doc_asset/client-overview.webp +0 -0
- package/docs/doc_asset/multi-window.webp +0 -0
- package/docs/{pi-desk/plugins.md → plugins.md} +108 -1
- package/package.json +2 -2
- package/src/client/l2_biz/project-preview/l2-project-preview-dialog.tsx +3 -0
- package/src/client/l2_biz/workbench/file-workspace/l2-file-workspace-view.tsx +8 -0
- package/src/client/l2_biz/workbench/hooks/l2-workbench-chat-viewport.ts +81 -7
- package/src/client/l2_biz/workbench/l2-workbench-chat-view.tsx +2 -1
- package/src/client/l3_modules/project-files/l3-project-document-git.ts +82 -0
- package/src/client/l3_modules/project-files/l3-project-document-view.tsx +102 -5
- package/src/client/l3_modules/project-files/l3-project-file-browser.tsx +2 -6
- package/src/client/l3_modules/project-files/l3-project-file-runtime.ts +83 -1
- package/src/client/l3_modules/project-files/l3-project-file-tabs.tsx +24 -2
- package/src/client/l3_modules/project-files/l3-project-git-model.ts +32 -0
- package/src/client/l4_foundation/ui/code/l4-code-diff.tsx +25 -5
- package/src/client/l4_foundation/ui/code/l4-code-line-changes.ts +49 -0
- package/src/client/l4_foundation/ui/code/l4-code-line-changes.worker.ts +10 -0
- package/src/client/l4_foundation/ui/code/l4-code-line-markers.module.css +60 -0
- package/src/client/l4_foundation/ui/code/l4-code-line-markers.ts +156 -0
- package/src/client/l4_foundation/ui/code/l4-code-preview.tsx +61 -5
- package/src/client/l4_foundation/ui/code/l4-monaco-lines-diff.d.ts +21 -0
- package/src/client/l4_foundation/ui/shadcn/hover-card.tsx +28 -2
- package/src/common/l3_modules/project-files/l3-project-files-locale-messages.ts +16 -0
- package/src/server/l4_foundation/pidesk/l4-pidesk-runtime.ts +1 -1
- package/temp/build/pi-desk/release/.next/BUILD_ID +1 -1
- package/temp/build/pi-desk/release/.next/build-manifest.json +3 -3
- package/temp/build/pi-desk/release/.next/prerender-manifest.json +3 -3
- package/temp/build/pi-desk/release/.next/react-loadable-manifest.json +5 -4
- package/temp/build/pi-desk/release/.next/required-server-files.js +3 -3
- package/temp/build/pi-desk/release/.next/required-server-files.json +3 -3
- package/temp/build/pi-desk/release/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/temp/build/pi-desk/release/.next/server/app/_global-error.html +1 -1
- package/temp/build/pi-desk/release/.next/server/app/_global-error.rsc +1 -1
- package/temp/build/pi-desk/release/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/temp/build/pi-desk/release/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/temp/build/pi-desk/release/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/temp/build/pi-desk/release/.next/server/app/_not-found/page.js +1 -1
- package/temp/build/pi-desk/release/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/temp/build/pi-desk/release/.next/server/app/api/health/route.js +1 -1
- package/temp/build/pi-desk/release/.next/server/app/login/page.js +1 -1
- package/temp/build/pi-desk/release/.next/server/app/login/page_client-reference-manifest.js +1 -1
- package/temp/build/pi-desk/release/.next/server/app/page.js +6 -6
- package/temp/build/pi-desk/release/.next/server/app/page_client-reference-manifest.js +1 -1
- package/temp/build/pi-desk/release/.next/server/chunks/20842.js +1 -0
- package/temp/build/pi-desk/release/.next/server/chunks/25406.js +1 -1
- package/temp/build/pi-desk/release/.next/server/chunks/{9248.js → 354.js} +1 -1
- package/temp/build/pi-desk/release/.next/server/chunks/35985.js +6 -6
- package/temp/build/pi-desk/release/.next/server/chunks/45671.js +1 -0
- package/temp/build/pi-desk/release/.next/server/chunks/47757.js +1 -1
- package/temp/build/pi-desk/release/.next/server/chunks/56284.js +62 -0
- package/temp/build/pi-desk/release/.next/server/chunks/73691.js +1 -0
- package/temp/build/pi-desk/release/.next/server/chunks/82499.js +2 -2
- package/temp/build/pi-desk/release/.next/server/chunks/94296.js +2 -2
- package/temp/build/pi-desk/release/.next/server/chunks/pi-desk-line-changes.js +1 -0
- package/temp/build/pi-desk/release/.next/server/middleware-build-manifest.js +1 -1
- package/temp/build/pi-desk/release/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/temp/build/pi-desk/release/.next/server/pages/500.html +1 -1
- package/temp/build/pi-desk/release/.next/server/server-reference-manifest.json +1 -1
- package/temp/build/pi-desk/release/.next/server/webpack-runtime.js +1 -1
- package/temp/build/pi-desk/release/.next/static/chunks/28739.540a4f24a8eaa3fd.js +1 -0
- package/temp/build/pi-desk/release/.next/static/chunks/31087-333cae396a52f232.js +1 -0
- package/temp/build/pi-desk/release/.next/static/chunks/3814-35cfab0ce3aa7c41.js +1 -0
- package/temp/build/pi-desk/release/.next/static/chunks/38459.9a9b6f4f3ec3ff50.js +1 -0
- package/temp/build/pi-desk/release/.next/static/chunks/45992-a39a014497ec4dd1.js +13 -0
- package/temp/build/pi-desk/release/.next/static/chunks/53291.ab6ef49016107124.js +1 -0
- package/temp/build/pi-desk/release/.next/static/chunks/{54206.82a63ab971911eda.js → 54206.ffb8c581c6661ae2.js} +2 -2
- package/temp/build/pi-desk/release/.next/static/chunks/5598.f34dce2a9de0d0e3.js +1 -0
- package/temp/build/pi-desk/release/.next/static/chunks/70669.8b4231a8675499e0.js +1 -0
- package/temp/build/pi-desk/release/.next/static/chunks/95287.34b860abf26f64a5.js +1 -0
- package/temp/build/pi-desk/release/.next/static/chunks/app/layout-586f6f88483051a7.js +3 -0
- package/temp/build/pi-desk/release/.next/static/chunks/app/{page-c6c68b33156be10a.js → page-0f2cf68a4666420b.js} +4 -4
- package/temp/build/pi-desk/release/.next/static/chunks/pi-desk-line-changes.49f8d59c256621d6.js +1 -0
- package/temp/build/pi-desk/release/.next/static/chunks/webpack-26261285e181235a.js +1 -0
- package/temp/build/pi-desk/release/.next/static/css/{f6a76a493aae9ae3.css → adb1d4e48dd43c0a.css} +1 -1
- package/temp/build/pi-desk/release/.next/trace-build +1 -1
- package/docs/pi-desk/README.md +0 -47
- package/temp/build/pi-desk/release/.next/server/chunks/6656.js +0 -1
- package/temp/build/pi-desk/release/.next/server/chunks/89236.js +0 -62
- package/temp/build/pi-desk/release/.next/static/chunks/19991.02fcb7c8ca3b1fe4.js +0 -1
- package/temp/build/pi-desk/release/.next/static/chunks/26285.54b8bcbf7a198c84.js +0 -1
- package/temp/build/pi-desk/release/.next/static/chunks/52354-6461358c522130be.js +0 -1
- package/temp/build/pi-desk/release/.next/static/chunks/74132-876f256c7a6101af.js +0 -13
- package/temp/build/pi-desk/release/.next/static/chunks/79615.7d68b269d93fcb93.js +0 -1
- package/temp/build/pi-desk/release/.next/static/chunks/app/layout-4faf3a52d219296d.js +0 -3
- package/temp/build/pi-desk/release/.next/static/chunks/webpack-7bfbf627379fb4c1.js +0 -1
- /package/docs/{pi-desk/commands.md → commands.md} +0 -0
- /package/docs/{pi-desk/examples → examples}/local-application/browser/application.js +0 -0
- /package/docs/{pi-desk/examples → examples}/local-application/browser/entry.js +0 -0
- /package/docs/{pi-desk/examples → examples}/local-application/package.json +0 -0
- /package/docs/{pi-desk/examples → examples}/local-application/pi-desk.ts +0 -0
- /package/temp/build/pi-desk/release/.next/static/{1LdtGYUckBhYZy0R-6yG0 → -pemk30NXpiExEU5tjb1t}/_buildManifest.js +0 -0
- /package/temp/build/pi-desk/release/.next/static/{1LdtGYUckBhYZy0R-6yG0 → -pemk30NXpiExEU5tjb1t}/_ssgManifest.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";exports.id=45671,exports.ids=[45671],exports.modules={39482:(a,b,c)=>{c.d(b,{L:()=>e});var d=c(66036);class e{static fromTo(a,b){return new e(a,b)}static addRange(a,b){let c=0;for(;c<b.length&&b[c].endExclusive<a.start;)c++;let d=c;for(;d<b.length&&b[d].start<=a.endExclusive;)d++;if(c===d)b.splice(c,0,a);else{let f=Math.min(a.start,b[c].start),g=Math.max(a.endExclusive,b[d-1].endExclusive);b.splice(c,d-c,new e(f,g))}}static tryCreate(a,b){if(!(a>b))return new e(a,b)}static ofLength(a){return new e(0,a)}static ofStartAndLength(a,b){return new e(a,a+b)}static emptyAt(a){return new e(a,a)}constructor(a,b){if(this.start=a,this.endExclusive=b,a>b)throw new d.D7(`Invalid range: ${this.toString()}`)}get isEmpty(){return this.start===this.endExclusive}delta(a){return new e(this.start+a,this.endExclusive+a)}deltaStart(a){return new e(this.start+a,this.endExclusive)}deltaEnd(a){return new e(this.start,this.endExclusive+a)}get length(){return this.endExclusive-this.start}toString(){return`[${this.start}, ${this.endExclusive})`}equals(a){return this.start===a.start&&this.endExclusive===a.endExclusive}containsRange(a){return this.start<=a.start&&a.endExclusive<=this.endExclusive}contains(a){return this.start<=a&&a<this.endExclusive}join(a){return new e(Math.min(this.start,a.start),Math.max(this.endExclusive,a.endExclusive))}intersect(a){let b=Math.max(this.start,a.start),c=Math.min(this.endExclusive,a.endExclusive);if(b<=c)return new e(b,c)}intersectionLength(a){let b=Math.max(this.start,a.start);return Math.max(0,Math.min(this.endExclusive,a.endExclusive)-b)}intersects(a){return Math.max(this.start,a.start)<Math.min(this.endExclusive,a.endExclusive)}intersectsOrTouches(a){return Math.max(this.start,a.start)<=Math.min(this.endExclusive,a.endExclusive)}isBefore(a){return this.endExclusive<=a.start}isAfter(a){return this.start>=a.endExclusive}slice(a){return a.slice(this.start,this.endExclusive)}substring(a){return a.substring(this.start,this.endExclusive)}clip(a){if(this.isEmpty)throw new d.D7(`Invalid clipping range: ${this.toString()}`);return Math.max(this.start,Math.min(this.endExclusive-1,a))}clipCyclic(a){if(this.isEmpty)throw new d.D7(`Invalid clipping range: ${this.toString()}`);return a<this.start?this.endExclusive-(this.start-a)%this.length:a>=this.endExclusive?this.start+(a-this.start)%this.length:a}forEach(a){for(let b=this.start;b<this.endExclusive;b++)a(b)}joinRightTouching(a){if(this.endExclusive!==a.start)throw new d.D7(`Invalid join: ${this.toString()} and ${a.toString()}`);return new e(this.start,a.endExclusive)}withMargin(a,b){return void 0===b&&(b=a),new e(this.start-a,this.endExclusive+b)}}},50527:(a,b,c)=>{c.d(b,{_q:()=>f,ew:()=>d,xC:()=>e});class d{constructor(a,b){this.width=a,this.height=b,this.array=[],this.array=Array(a*b)}get(a,b){return this.array[a+b*this.width]}set(a,b,c){this.array[a+b*this.width]=c}}function e(a){return 32===a||9===a}class f{static{this.chrKeys=new Map}static getKey(a){let b=this.chrKeys.get(a);return void 0===b&&(b=this.chrKeys.size,this.chrKeys.set(a,b)),b}constructor(a,b,c){this.range=a,this.lines=b,this.source=c,this.histogram=[];let d=0;for(let c=a.startLineNumber-1;c<a.endLineNumberExclusive-1;c++){const a=b[c];for(let b=0;b<a.length;b++){d++;const c=a[b],e=f.getKey(c);this.histogram[e]=(this.histogram[e]||0)+1}d++;const e=f.getKey("\n");this.histogram[e]=(this.histogram[e]||0)+1}this.totalCount=d}computeSimilarity(a){let b=0,c=Math.max(this.histogram.length,a.histogram.length);for(let d=0;d<c;d++)b+=Math.abs((this.histogram[d]??0)-(a.histogram[d]??0));return 1-b/(this.totalCount+a.totalCount)}}},57773:(a,b,c)=>{function d(a){return a}c.d(b,{o5:()=>e});class e{constructor(a,b){this.lastCache=void 0,this.lastArgKey=void 0,"function"==typeof a?(this._fn=a,this._computeKey=d):(this._fn=b,this._computeKey=a.getCacheKey)}get(a){let b=this._computeKey(a);return this.lastArgKey!==b&&(this.lastArgKey=b,this.lastCache=this._fn(a)),this.lastCache}}},67992:(a,b,c)=>{c.d(b,{W:()=>g});var d=c(1401),e=c(6812),f=c(61822);class g{static{this.zero=new g(0,0)}static betweenPositions(a,b){return a.lineNumber===b.lineNumber?new g(0,b.column-a.column):new g(b.lineNumber-a.lineNumber,b.column-1)}static fromPosition(a){return new g(a.lineNumber-1,a.column-1)}static ofRange(a){return g.betweenPositions(a.getStartPosition(),a.getEndPosition())}static ofText(a){let b=0,c=0;for(let d of a)"\n"===d?(b++,c=0):c++;return new g(b,c)}constructor(a,b){this.lineCount=a,this.columnCount=b}isGreaterThanOrEqualTo(a){return this.lineCount!==a.lineCount?this.lineCount>a.lineCount:this.columnCount>=a.columnCount}add(a){return 0===a.lineCount?new g(this.lineCount,this.columnCount+a.columnCount):new g(this.lineCount+a.lineCount,a.columnCount)}createRange(a){return 0===this.lineCount?new f.Q(a.lineNumber,a.column,a.lineNumber,a.column+this.columnCount):new f.Q(a.lineNumber,a.column,a.lineNumber+this.lineCount,this.columnCount+1)}toRange(){return new f.Q(1,1,this.lineCount+1,this.columnCount+1)}toLineRange(){return d.M.ofLength(1,this.lineCount+1)}addToPosition(a){return 0===this.lineCount?new e.y(a.lineNumber,a.column+this.columnCount):new e.y(a.lineNumber+this.lineCount,this.columnCount+1)}toString(){return`${this.lineCount},${this.columnCount}`}}},81309:(a,b,c)=>{var d,e;function f(a,b,c=(a,b)=>a===b){if(a===b)return!0;if(!a||!b||a.length!==b.length)return!1;for(let d=0,e=a.length;d<e;d++)if(!c(a[d],b[d]))return!1;return!0}function*g(a,b){let c,d;for(let e of a)void 0!==d&&b(d,e)?c.push(e):(c&&(yield c),c=[e]),d=e;c&&(yield c)}function h(a,b){for(let c=0;c<=a.length;c++)b(0===c?void 0:a[c-1],c===a.length?void 0:a[c])}function i(a,b){for(let c=0;c<a.length;c++)b(0===c?void 0:a[c-1],a[c],c+1===a.length?void 0:a[c+1])}function j(a,b){for(let c of b)a.push(c)}function k(a,b){return(c,d)=>b(a(c),a(d))}c.d(b,{E4:()=>j,Hw:()=>m,U9:()=>l,VE:()=>k,aI:()=>f,kj:()=>i,n:()=>g,pN:()=>h}),(e=d||(d={})).isLessThan=function(a){return a<0},e.isLessThanOrEqual=function(a){return a<=0},e.isGreaterThan=function(a){return a>0},e.isNeitherLessOrGreaterThan=function(a){return 0===a},e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0;let l=(a,b)=>a-b;function m(a){return(b,c)=>-a(b,c)}class n{static{this.empty=new n(a=>{})}constructor(a){this.iterate=a}toArray(){let a=[];return this.iterate(b=>(a.push(b),!0)),a}filter(a){return new n(b=>this.iterate(c=>!a(c)||b(c)))}map(a){return new n(b=>this.iterate(c=>b(a(c))))}findLast(a){let b;return this.iterate(c=>(a(c)&&(b=c),!0)),b}findLastMaxBy(a){let b,c=!0;return this.iterate(e=>((c||d.isGreaterThan(a(e,b)))&&(c=!1,b=e),!0)),b}}},83065:(a,b,c)=>{c.d(b,{$8:()=>h,SL:()=>g,_3:()=>i,aY:()=>k,uY:()=>j});var d=c(81309),e=c(66036),f=c(39482);class g{static trivial(a,b){return new g([new h(f.L.ofLength(a.length),f.L.ofLength(b.length))],!1)}static trivialTimedOut(a,b){return new g([new h(f.L.ofLength(a.length),f.L.ofLength(b.length))],!0)}constructor(a,b){this.diffs=a,this.hitTimeout=b}}class h{static invert(a,b){let c=[];return(0,d.pN)(a,(a,d)=>{c.push(h.fromOffsetPairs(a?a.getEndExclusives():i.zero,d?d.getStarts():new i(b,(a?a.seq2Range.endExclusive-a.seq1Range.endExclusive:0)+b)))}),c}static fromOffsetPairs(a,b){return new h(new f.L(a.offset1,b.offset1),new f.L(a.offset2,b.offset2))}static assertSorted(a){let b;for(let c of a){if(b&&!(b.seq1Range.endExclusive<=c.seq1Range.start&&b.seq2Range.endExclusive<=c.seq2Range.start))throw new e.D7("Sequence diffs must be sorted");b=c}}constructor(a,b){this.seq1Range=a,this.seq2Range=b}swap(){return new h(this.seq2Range,this.seq1Range)}toString(){return`${this.seq1Range} <-> ${this.seq2Range}`}join(a){return new h(this.seq1Range.join(a.seq1Range),this.seq2Range.join(a.seq2Range))}delta(a){return 0===a?this:new h(this.seq1Range.delta(a),this.seq2Range.delta(a))}deltaStart(a){return 0===a?this:new h(this.seq1Range.deltaStart(a),this.seq2Range.deltaStart(a))}deltaEnd(a){return 0===a?this:new h(this.seq1Range.deltaEnd(a),this.seq2Range.deltaEnd(a))}intersect(a){let b=this.seq1Range.intersect(a.seq1Range),c=this.seq2Range.intersect(a.seq2Range);if(b&&c)return new h(b,c)}getStarts(){return new i(this.seq1Range.start,this.seq2Range.start)}getEndExclusives(){return new i(this.seq1Range.endExclusive,this.seq2Range.endExclusive)}}class i{static{this.zero=new i(0,0)}static{this.max=new i(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER)}constructor(a,b){this.offset1=a,this.offset2=b}toString(){return`${this.offset1} <-> ${this.offset2}`}delta(a){return 0===a?this:new i(this.offset1+a,this.offset2+a)}equals(a){return this.offset1===a.offset1&&this.offset2===a.offset2}}class j{static{this.instance=new j}isValid(){return!0}}class k{constructor(a){if(this.timeout=a,this.startTime=Date.now(),this.valid=!0,a<=0)throw new e.D7("timeout must be positive")}isValid(){return!(Date.now()-this.startTime<this.timeout)&&this.valid&&(this.valid=!1),this.valid}}},88042:(a,b,c)=>{function d(a,b){let c=e(a,b);return -1===c?void 0:a[c]}function e(a,b,c=0,d=a.length){let f=c,g=d;for(;f<g;){let c=Math.floor((f+g)/2);b(a[c])?f=c+1:g=c}return f-1}function f(a,b){let c=g(a,b);return c===a.length?void 0:a[c]}function g(a,b,c=0,d=a.length){let e=c,f=d;for(;e<f;){let c=Math.floor((e+f)/2);b(a[c])?f=c:e=c+1}return e}c.d(b,{XP:()=>f,hw:()=>g,iM:()=>e,lx:()=>d,vJ:()=>h});class h{static{this.assertInvariants=!1}constructor(a){this._array=a,this._findLastMonotonousLastIdx=0}findLastMonotonous(a){if(h.assertInvariants){if(this._prevFindLastPredicate){for(let b of this._array)if(this._prevFindLastPredicate(b)&&!a(b))throw Error("MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.")}this._prevFindLastPredicate=a}let b=e(this._array,a,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=b+1,-1===b?void 0:this._array[b]}}}};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";exports.id=47757,exports.ids=[47757],exports.modules={16056:(a,b,c)=>{c.d(b,{P:()=>e});let d=process.argv.includes("--safe-mode")||"1"===process.env.PI_DESK_SAFE_MODE;function e(){return d}},17691:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{M:()=>j});var e=c(77598),f=c(73024),g=c(76760),h=c(75430),i=a([h]);function j(){let a=(0,h.getAgentDir)(),b=(0,g.join)(a,"pi-desk"),c=(0,g.join)(a,"pi-super");if((0,f.existsSync)(b)||!(0,f.existsSync)(c))return b;let d=(0,g.join)(a,`.pi-desk-migration-${(0,e.randomUUID)()}`);try{(0,f.cpSync)(c,d,{recursive:!0,errorOnExist:!0,force:!1}),(0,f.renameSync)(d,b),console.info("[Pi Desk] 已复制旧版应用数据到新目录")}finally{(0,f.rmSync)(d,{recursive:!0,force:!0})}return b}h=(i.then?(await i)():i)[0],d()}catch(a){d(a)}})},47757:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{appendL4PiDeskSystemPrompt:()=>q,createL4PiDeskTool:()=>s,disposeL4PiDeskCommands:()=>p,executeL4PiDeskCommand:()=>r,initializeL4PiDeskCommands:()=>o});var e=c(51455),f=c(76760),g=c(75430),h=c(60815),i=c(17691),j=c(16056),k=c(55574),l=c(77167),m=a([g,h,i]);function n(a){return a.replaceAll("\\","/")}async function o(a,b=!1){let c=(0,g.getAgentDir)(),d=process.cwd(),h=JSON.parse(await (0,e.readFile)((0,f.join)(d,"package.json"),"utf8"));if(!h||"object"!=typeof h||!("version"in h)||"string"!=typeof h.version)throw Error("Pi Desk package.json 缺少版本号");let{createRequire:j}=process.getBuiltinModule("module"),k=(0,f.dirname)((0,f.dirname)(j((0,f.join)(d,"package.json")).resolve("@jetcrab/pi-desk-sdk"))),m=(0,f.join)(d,"docs"
|
|
1
|
+
"use strict";exports.id=47757,exports.ids=[47757],exports.modules={16056:(a,b,c)=>{c.d(b,{P:()=>e});let d=process.argv.includes("--safe-mode")||"1"===process.env.PI_DESK_SAFE_MODE;function e(){return d}},17691:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{M:()=>j});var e=c(77598),f=c(73024),g=c(76760),h=c(75430),i=a([h]);function j(){let a=(0,h.getAgentDir)(),b=(0,g.join)(a,"pi-desk"),c=(0,g.join)(a,"pi-super");if((0,f.existsSync)(b)||!(0,f.existsSync)(c))return b;let d=(0,g.join)(a,`.pi-desk-migration-${(0,e.randomUUID)()}`);try{(0,f.cpSync)(c,d,{recursive:!0,errorOnExist:!0,force:!1}),(0,f.renameSync)(d,b),console.info("[Pi Desk] 已复制旧版应用数据到新目录")}finally{(0,f.rmSync)(d,{recursive:!0,force:!0})}return b}h=(i.then?(await i)():i)[0],d()}catch(a){d(a)}})},47757:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{appendL4PiDeskSystemPrompt:()=>q,createL4PiDeskTool:()=>s,disposeL4PiDeskCommands:()=>p,executeL4PiDeskCommand:()=>r,initializeL4PiDeskCommands:()=>o});var e=c(51455),f=c(76760),g=c(75430),h=c(60815),i=c(17691),j=c(16056),k=c(55574),l=c(77167),m=a([g,h,i]);function n(a){return a.replaceAll("\\","/")}async function o(a,b=!1){let c=(0,g.getAgentDir)(),d=process.cwd(),h=JSON.parse(await (0,e.readFile)((0,f.join)(d,"package.json"),"utf8"));if(!h||"object"!=typeof h||!("version"in h)||"string"!=typeof h.version)throw Error("Pi Desk package.json 缺少版本号");let{createRequire:j}=process.getBuiltinModule("module"),k=(0,f.dirname)((0,f.dirname)(j((0,f.join)(d,"package.json")).resolve("@jetcrab/pi-desk-sdk"))),m=(0,f.join)(d,"docs");await Promise.all(["README.md","commands.md","plugins.md"].map(a=>(0,e.access)((0,f.join)(m,a)))),await (0,e.rm)((0,f.join)((0,i.M)(),b?"dev-skills":"skills","pi-desk"),{recursive:!0,force:!0});let p={handler:a,docsDirectory:m,systemPrompt:(0,l.O)({docsDirectory:n(m),sdkRoot:n(k)}),version:h.version,development:b,agentDir:c};globalThis.__piDeskCommandRuntime=p,console.info("[Pi Desk][Commands] 命令入口与系统资料导航已准备完成",{docsDirectory:m})}function p(){globalThis.__piDeskCommandRuntime=void 0}function q(a=[]){let b=globalThis.__piDeskCommandRuntime?.systemPrompt;return b?[...a,b]:[...a]}async function r(a,b){let c=globalThis.__piDeskCommandRuntime;if(!c)throw Error("Pi Desk 命令入口尚未准备完成");b.signal.throwIfAborted();let d=(0,k.h)(a);if("help"===d.kind)return{mode:"sync",message:d.message};if("version"===d.kind)return{mode:"sync",message:c.version};if("info"===d.kind)return{mode:"sync",message:JSON.stringify({version:c.version,environment:c.development?"development":"production",mode:(0,j.P)()?"basic":"normal",cwd:b.cwd,agentDir:c.agentDir,docsDirectory:c.docsDirectory})};if("session"===d.kind)return b.reload();if("plugins"!==d.kind)throw Error("Pi Desk 命令无效");return c.handler(d,b)}[g,h,i]=m.then?(await m)():m;let t=h.Type.Object({args:h.Type.Array(h.Type.String({minLength:1,maxLength:2048}),{maxItems:32})},{additionalProperties:!1});function s(a){return globalThis.__piDeskCommandRuntime?(0,g.defineTool)({name:"pidesk",exposure:"model-only",label:"Pi Desk",description:"Pi Desk 命令入口。",parameters:t,async execute(b,c){let d=await a(c.args,b),e=(0,g.truncateHead)(d.message),f={mode:d.mode,message:e.truncated?`${e.content}
|
|
2
2
|
…结果过长,已截断。`:d.message};return{content:[{type:"text",text:JSON.stringify(f)}],details:f}}}):null}d()}catch(a){d(a)}})},55574:(a,b,c)=>{c.d(b,{h:()=>g});let d=[{path:["--version"],description:"查看 Pi Desk 版本"},{path:["info"],description:"查看当前宿主环境与目录"},{path:["session","reload"],description:"等待当前会话空闲后重载 Pi 配置与已安装插件;完成后通知并唤醒本会话"},{path:["plugins","list"],description:"查看全局插件及维护状态;可按跟随渠道筛选并检查更新,不改变渠道",scope:"optional",tag:!0,checkUpdates:!0},{path:["plugins","show"],description:"查看插件详情",name:"single",scope:"required"},{path:["plugins","install"],description:"安装、更新或重新安装一个或多个插件;版本可省略,完成后向本会话汇总结果",name:"multiple",scope:"required",version:!0,tag:!0},{path:["plugins","reload"],description:"重新加载一个或多个已安装插件;不下载、不重启宿主,不重载已有 Pi 会话;完成后向本会话汇总结果",name:"multiple",scope:"required"},{path:["plugins","remove"],description:"卸载一个或多个包来源;完成后向本会话汇总结果",name:"multiple",scope:"required"}];function e(a){return["pidesk",...a.path,...a.name?["multiple"===a.name?"<name...>":"<name>"]:[],..."required"===a.scope?["--scope global"]:a.scope?["[--scope global]"]:[],...a.checkUpdates?["[--check-updates]"]:[],...a.version?["[--tag <tag> | --version <exact>]"]:a.tag?["[--tag <tag>]"]:[]].join(" ")}function f(a){let b=d.filter(b=>a.every((a,c)=>b.path[c]===a));if(0===b.length)throw Error("未知命令,请使用 pidesk --help");return[...b.map(a=>`${e(a)}
|
|
3
3
|
${a.description}`),"各级命令均支持 --help。当前插件管理只支持 global 范围。",..."plugins"===a[0]&&(1===a.length||"install"===a[1])?["install = install + update + reinstall。版本和渠道均可省略:新 npm 插件默认 latest,已有插件沿保存的渠道;--tag 选择跟随渠道,--version 固定完整版本号,两者互斥。","多个插件可共用同一渠道或具体版本;同版本仍重新安装。","本地扩展使用 Pi 全局 extensions 目录中的名字,加载当前代码;不接受版本、渠道或自定义路径。","异步接纳不代表生效;结果会插入本会话并唤醒模型,无需持续查询。"]:[]].join("\n\n")}function g(a){let b,c,g,h;if(a.length>32)throw Error("命令参数最多 32 项");if(0===a.length)return{kind:"help",message:f([])};let i=d.find(b=>b.path.every((b,c)=>a[c]===b));if(a.includes("--help")||a.includes("-h")||1===a.length&&["plugins","session"].includes(a[0])){let b=["plugins","session"].includes(a[0])?a[0]:null,c=i?.path??(b?[b]:[]);if(!i&&!b&&!["--help","-h"].includes(a[0]))throw Error("未知命令,请使用 pidesk --help");if(!i&&b&&a[1]&&!["--help","-h"].includes(a[1]))throw Error(`未知子命令,请使用 pidesk ${b} --help`);return{kind:"help",message:f(c)}}if(!i)throw Error("未知命令,请使用 pidesk --help");let j=[];for(let d=i.path.length;d<a.length;d+=1){let f=a[d];if("--scope"===f&&i.scope){if(void 0!==b)throw Error("--scope 不允许重复");if(!(b=a[++d])||b.startsWith("--"))throw Error("--scope 缺少范围")}else if("--version"===f&&i.version){if(void 0!==c)throw Error("--version 不允许重复");if(!(c=a[++d])||c.startsWith("--"))throw Error("--version 缺少版本号")}else if("--tag"===f&&i.tag){if(void 0!==g)throw Error("--tag 不允许重复");if(!(g=a[++d])||g.startsWith("--"))throw Error("--tag 缺少渠道标签")}else if("--check-updates"===f&&i.checkUpdates){if(void 0!==h)throw Error("--check-updates 不允许重复");h=!0}else if(i.name&&("multiple"===i.name||0===j.length)&&!f.startsWith("-"))j.push(f);else throw Error(`不支持的参数:${f}
|
|
4
4
|
${e(i)}`)}if("required"===i.scope&&void 0===b)throw Error(`必须指定 --scope global
|