@hermenics/deepseek-code 0.4.13 → 0.4.14

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/dist/cli.mjs +2 -2
  2. package/package.json +4 -2
package/dist/cli.mjs CHANGED
@@ -1119,7 +1119,7 @@ ${d}`,O++}else D40(B,U,h)?A=B.slice(B.charCodeAt(U+6)===RH?U+7:U+6,I)||void 0:R(
1119
1119
  `,U),S=-1;if(I!==-1&&h!==-1?S=I<h?I:h:I!==-1?I===B.length-1?S=-1:S=I:h!==-1&&(S=h),S===-1)break;R(B,U,S),U=S+1,B.charCodeAt(U-1)===qE6&&B.charCodeAt(U)===Y40&&U++}return B.slice(U)}function R(B,U,I){if(U===I){k();return}let h=B.charCodeAt(U);if(z40(B,U,h)){let L8=B.charCodeAt(U+5)===RH?U+6:U+5,p=B.slice(L8,I);G=O===0?p:`${G}
1120
1120
  ${p}`,O++;return}if(D40(B,U,h)){A=B.slice(B.charCodeAt(U+6)===RH?U+7:U+6,I)||void 0;return}if(h===105&&B.charCodeAt(U+1)===100&&B.charCodeAt(U+2)===58){let L8=B.slice(B.charCodeAt(U+3)===RH?U+4:U+3,I);Z=L8.includes("\x00")?void 0:L8;return}if(h===58){if(z){let L8=B.slice(U,I);z(L8.slice(B.charCodeAt(U+1)===RH?2:1))}return}let S=B.slice(U,I),d=S.indexOf(":");if(d===-1){E(S,"",S);return}let y=S.slice(0,d),C=S.charCodeAt(d+1)===RH?2:1,Z8=S.slice(d+C);E(y,Z8,S)}function E(B,U,I){switch(B){case"event":A=U||void 0;break;case"data":G=O===0?U:`${G}
1121
1121
  ${U}`,O++;break;case"id":Z=U.includes("\x00")?void 0:U;break;case"retry":/^\d+$/.test(U)?Y(parseInt(U,10)):q(new MS(`Invalid \`retry\` value: "${U}"`,{type:"invalid-retry",value:U,line:I}));break;default:q(new MS(`Unknown field "${B.length>20?`${B.slice(0,20)}\u2026`:B}"`,{type:"unknown-field",field:B,value:U,line:I}));break}}function k(){O>0&&K({id:Z,event:A,data:G}),Z=void 0,G="",O=0,A=void 0}function v(B={}){if(B.consume&&J.length>0){let U=J.join("");R(U,0,U.length)}W=!0,Z=void 0,G="",O=0,A=void 0,J.length=0,X=0,_=!1}return{feed:T,reset:v}}function z40($,K,q){return q===100&&$.charCodeAt(K+1)===97&&$.charCodeAt(K+2)===116&&$.charCodeAt(K+3)===97&&$.charCodeAt(K+4)===58}function D40($,K,q){return q===101&&$.charCodeAt(K+1)===118&&$.charCodeAt(K+2)===101&&$.charCodeAt(K+3)===110&&$.charCodeAt(K+4)===116&&$.charCodeAt(K+5)===58}var MS,Y40=10,qE6=13,RH=32;var X40=F(()=>{MS=class MS extends Error{constructor($,K){super($),this.name="ParseError",this.type=K.type,this.field=K.field,this.value=K.value,this.line=K.line}}});var G78;var H40=F(()=>{X40();G78=class G78 extends TransformStream{constructor({onError:$,onRetry:K,onComment:q,maxBufferSize:Y}={}){let z;super({start(D){z=J40({onEvent:(J)=>{D.enqueue(J)},onError(J){typeof $=="function"&&$(J),($==="terminate"||J.type==="max-buffer-size-exceeded")&&D.error(J)},onRetry:K,onComment:q,maxBufferSize:Y})},transform(D){z.feed(D)}})}}});class M78{constructor($,K){this._hasCompletedAuthFlow=!1,this._url=$,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=K?.requestInit,this._authProvider=K?.authProvider,this._fetch=K?.fetch,this._fetchWithInit=u10(K?.fetch,K?.requestInit),this._sessionId=K?.sessionId,this._reconnectionOptions=K?.reconnectionOptions??YE6}async _authThenStart(){if(!this._authProvider)throw new GD("No auth provider");let $;try{$=await FL(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(K){throw this.onerror?.(K),K}if($!=="AUTHORIZED")throw new GD;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){let $={};if(this._authProvider){let q=await this._authProvider.tokens();if(q)$.Authorization=`Bearer ${q.access_token}`}if(this._sessionId)$["mcp-session-id"]=this._sessionId;if(this._protocolVersion)$["mcp-protocol-version"]=this._protocolVersion;let K=$S(this._requestInit?.headers);return new Headers({...$,...K})}async _startOrAuthSse($){let{resumptionToken:K}=$;try{let q=await this._commonHeaders();if(q.set("Accept","text/event-stream"),K)q.set("last-event-id",K);let Y=await(this._fetch??fetch)(this._url,{method:"GET",headers:q,signal:this._abortController?.signal});if(!Y.ok){if(await Y.body?.cancel(),Y.status===401&&this._authProvider)return await this._authThenStart();if(Y.status===405)return;throw new FH(Y.status,`Failed to open SSE stream: ${Y.statusText}`)}this._handleSseStream(Y.body,$,!0)}catch(q){throw this.onerror?.(q),q}}_getNextReconnectionDelay($){if(this._serverRetryMs!==void 0)return this._serverRetryMs;let K=this._reconnectionOptions.initialReconnectionDelay,q=this._reconnectionOptions.reconnectionDelayGrowFactor,Y=this._reconnectionOptions.maxReconnectionDelay;return Math.min(K*Math.pow(q,$),Y)}_scheduleReconnection($,K=0){let q=this._reconnectionOptions.maxRetries;if(K>=q){this.onerror?.(Error(`Maximum reconnection attempts (${q}) exceeded.`));return}let Y=this._getNextReconnectionDelay(K);this._reconnectionTimeout=setTimeout(()=>{this._startOrAuthSse($).catch((z)=>{this.onerror?.(Error(`Failed to reconnect SSE stream: ${z instanceof Error?z.message:String(z)}`)),this._scheduleReconnection($,K+1)})},Y)}_handleSseStream($,K,q){if(!$)return;let{onresumptiontoken:Y,replayMessageId:z}=K,D,J=!1,X=!1;(async()=>{try{let Z=$.pipeThrough(new TextDecoderStream).pipeThrough(new G78({onRetry:(A)=>{this._serverRetryMs=A}})).getReader();while(!0){let{value:A,done:_}=await Z.read();if(_)break;if(A.id)D=A.id,J=!0,Y?.(A.id);if(!A.data)continue;if(!A.event||A.event==="message")try{let T=dG.parse(JSON.parse(A.data));if(NH(T)){if(X=!0,z!==void 0)T.id=z}this.onmessage?.(T)}catch(T){this.onerror?.(T)}}if((q||J)&&!X&&this._abortController&&!this._abortController.signal.aborted)this._scheduleReconnection({resumptionToken:D,onresumptiontoken:Y,replayMessageId:z},0)}catch(Z){if(this.onerror?.(Error(`SSE stream disconnected: ${Z}`)),(q||J)&&!X&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:D,onresumptiontoken:Y,replayMessageId:z},0)}catch(A){this.onerror?.(Error(`Failed to reconnect: ${A instanceof Error?A.message:String(A)}`))}}})()}async start(){if(this._abortController)throw Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth($){if(!this._authProvider)throw new GD("No auth provider");if(await FL(this._authProvider,{serverUrl:this._url,authorizationCode:$,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new GD("Failed to authorize")}async close(){if(this._reconnectionTimeout)clearTimeout(this._reconnectionTimeout),this._reconnectionTimeout=void 0;this._abortController?.abort(),this.onclose?.()}async send($,K){try{let{resumptionToken:q,onresumptiontoken:Y}=K||{};if(q){this._startOrAuthSse({resumptionToken:q,replayMessageId:AL($)?$.id:void 0}).catch((A)=>this.onerror?.(A));return}let z=await this._commonHeaders();z.set("content-type","application/json"),z.set("accept","application/json, text/event-stream");let D={...this._requestInit,method:"POST",headers:z,body:JSON.stringify($),signal:this._abortController?.signal},J=await(this._fetch??fetch)(this._url,D),X=J.headers.get("mcp-session-id");if(X)this._sessionId=X;if(!J.ok){let A=await J.text().catch(()=>null);if(J.status===401&&this._authProvider){if(this._hasCompletedAuthFlow)throw new FH(401,"Server returned 401 after successful authentication");let{resourceMetadataUrl:_,scope:T}=w78(J);if(this._resourceMetadataUrl=_,this._scope=T,await FL(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new GD;return this._hasCompletedAuthFlow=!0,this.send($)}if(J.status===403&&this._authProvider){let{resourceMetadataUrl:_,scope:T,error:N}=w78(J);if(N==="insufficient_scope"){let j=J.headers.get("WWW-Authenticate");if(this._lastUpscopingHeader===j)throw new FH(403,"Server returned 403 after trying upscoping");if(T)this._scope=T;if(_)this._resourceMetadataUrl=_;if(this._lastUpscopingHeader=j??void 0,await FL(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new GD;return this.send($)}}throw new FH(J.status,`Error POSTing to endpoint: ${A}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,J.status===202){if(await J.body?.cancel(),p60($))this._startOrAuthSse({resumptionToken:void 0}).catch((A)=>this.onerror?.(A));return}let Z=(Array.isArray($)?$:[$]).filter((A)=>("method"in A)&&("id"in A)&&A.id!==void 0).length>0,G=J.headers.get("content-type"),O=y10(G);if(Z)if(O==="text/event-stream")this._handleSseStream(J.body,{onresumptiontoken:Y},!1);else if(O==="application/json"){let A=await J.json(),_=Array.isArray(A)?A.map((T)=>dG.parse(T)):[dG.parse(A)];for(let T of _)this.onmessage?.(T)}else throw await J.body?.cancel(),new FH(-1,`Unexpected content type: ${G}`);else await J.body?.cancel()}catch(q){throw this.onerror?.(q),q}}get sessionId(){return this._sessionId}async terminateSession(){if(!this._sessionId)return;try{let $=await this._commonHeaders(),K={...this._requestInit,method:"DELETE",headers:$,signal:this._abortController?.signal},q=await(this._fetch??fetch)(this._url,K);if(await q.body?.cancel(),!q.ok&&q.status!==405)throw new FH(q.status,`Failed to terminate session: ${q.statusText}`);this._sessionId=void 0}catch($){throw this.onerror?.($),$}}setProtocolVersion($){this._protocolVersion=$}get protocolVersion(){return this._protocolVersion}async resumeStream($,K){await this._startOrAuthSse({resumptionToken:$,onresumptiontoken:K?.onresumptiontoken})}}var YE6,FH;var w40=F(()=>{x10();jH();q40();H40();YE6={initialReconnectionDelay:1000,maxReconnectionDelay:30000,reconnectionDelayGrowFactor:1.5,maxRetries:2};FH=class FH extends Error{constructor($,K){super(`Streamable HTTP error: ${K}`);this.code=$}}});import{join as G40}from"path";import{homedir as zE6}from"os";import{mkdir as DE6,appendFile as JE6,chmod as XE6}from"fs/promises";import{randomBytes as HE6}from"crypto";async function WE6(){if(Z40)return;await DE6(M40,{recursive:!0}),Z40=!0}async function E7($){try{await WE6();let K=JSON.stringify(sK({ts:new Date().toISOString(),...$}))+`
1122
- `;await JE6(W40,K,{encoding:"utf8",mode:384}),await XE6(W40,384)}catch{}}var M40,wE6,W40,Z40=!1;var O78=F(()=>{SW();M40=G40(zE6(),".deepseek","logs"),wE6=`${Date.now()}-${HE6(3).toString("hex")}`,W40=G40(M40,`session-${wE6}.jsonl`)});var $$;var sG=F(()=>{$$={name:"@hermenics/deepseek-code",version:"0.4.13",description:"An AI-powered coding assistant that lives in your terminal",keywords:["ai","cli","deepseek","coding-assistant","terminal","tui"],license:"Apache-2.0",type:"module",bin:{deepseek:"dist/deepseek"},files:["dist/","README.md","LICENSE"],repository:{type:"git",url:"git+https://github.com/Hermenics/deepseek-code.git"},bugs:{url:"https://github.com/Hermenics/deepseek-code/issues"},homepage:"https://github.com/Hermenics/deepseek-code#readme",publishConfig:{access:"public"},engines:{bun:">=1.1"},scripts:{start:"NODE_ENV=development bun src/index.tsx",dev:"NODE_ENV=development bun --watch src/index.tsx",build:"bun run build.ts",typecheck:"bunx tsc --noEmit",test:"bun test"},dependencies:{"@alcalzone/ansi-tokenize":"^0.3.0","@aws-crypto/sha256-js":"^5.2.0","@aws-sdk/client-bedrock":"^3.1048.0","@aws-sdk/credential-providers":"^3.1048.0","@modelcontextprotocol/sdk":"^1.29.0","@smithy/protocol-http":"^5.3.14","@smithy/signature-v4":"^5.3.14","@types/semver":"^7.7.1",ajv:"^8.20.0","auto-bind":"^5.0.1","bidi-js":"^1.0.3",chalk:"^5.6.2","cli-boxes":"^4.0.1","code-excerpt":"^4.0.0","emoji-regex":"^10.6.0",execa:"^9.6.1","fast-glob":"^3.3.3","fuse.js":"^7.0.0","get-east-asian-width":"^1.6.0","google-auth-library":"^10.6.2","indent-string":"^5.0.0","lodash-es":"^4.18.1",openai:"^6.34.0",qrcode:"^1.5.4",react:"^19.2.0","react-reconciler":"^0.33.0",semver:"^7.8.1","signal-exit":"^4.1.0","stack-utils":"^2.0.6","strip-ansi":"^7.2.0","supports-hyperlinks":"^4.4.0","type-fest":"^5.6.0","usehooks-ts":"^3.1.1","wrap-ansi":"^10.0.0"},overrides:{"node-fetch":"npm:undici@^7.0.0"},devDependencies:{"@types/bun":"^1.3.12","@types/qrcode":"^1.5.6","@types/react":"^19.2.0","@types/stack-utils":"^2.0.3","react-devtools-core":"^7.0.1",typescript:"^5.9.3",vitest:"^4.1.6"}}});import{join as GE6}from"path";function PE6($=process.env){return{PATH:$.PATH||"/usr/local/bin:/usr/bin:/bin",TMPDIR:$.TMPDIR||"/tmp",...$.LANG?{LANG:$.LANG}:{}}}function _E6($,K){let q={...$};for(let[Y,z]of Object.entries(K)){if(ME6.has(Y))continue;q[Y]=z}return q}function TE6($){if($.trim()==="")throw Error("MCP command cannot be empty");if(AE6.test($))throw Error(`MCP command contains path traversal: ${$}`);if(OE6.test($))throw Error(`MCP command contains shell injection characters: ${$}`)}function NE6($,K){return{type:"mcp_server_load",serverName:$,transport:K}}async function LE6($){let K=GE6($,".deepseek","mcp.json");try{return await R9(K)}catch{return null}}async function O40($=process.cwd(),K={}){if(!K.enabled)return{tools:[],errors:[]};let q=await LE6($);if(!q?.servers)return{tools:[],errors:[]};let Y=[],z=[];for(let[D,J]of Object.entries(q.servers))try{if(J.transport==="stdio")TE6(J.command);let X=new t48({name:"deepseek-code",version:$$.version}),W=J.transport==="stdio"?new $78({command:J.command,args:J.args??[],env:_E6(PE6(K.environment),J.env??{})}):new M78(new URL(J.url));await X.connect(W),await E7(NE6(D,J.transport));let{tools:Z}=await X.listTools();for(let G of Z)Y.push({name:`${D}__${G.name}`,description:`[MCP:${D}] ${G.description??""}`,parameters:G.inputSchema,async execute(O){return(await Promise.race([X.callTool({name:G.name,arguments:O}),new Promise((N,j)=>setTimeout(()=>j(Error(`MCP tool '${G.name}' timed out after 30s`)),30000))])).content.filter((N)=>N.type==="text"&&N.text).map((N)=>N.text).join(`
1122
+ `;await JE6(W40,K,{encoding:"utf8",mode:384}),await XE6(W40,384)}catch{}}var M40,wE6,W40,Z40=!1;var O78=F(()=>{SW();M40=G40(zE6(),".deepseek","logs"),wE6=`${Date.now()}-${HE6(3).toString("hex")}`,W40=G40(M40,`session-${wE6}.jsonl`)});var $$;var sG=F(()=>{$$={name:"@hermenics/deepseek-code",version:"0.4.14",description:"An AI-powered coding assistant that lives in your terminal",keywords:["ai","cli","deepseek","coding-assistant","terminal","tui"],license:"Apache-2.0",type:"module",bin:{deepseek:"dist/deepseek"},files:["dist/","README.md","LICENSE"],repository:{type:"git",url:"git+https://github.com/Hermenics/deepseek-code.git"},bugs:{url:"https://github.com/Hermenics/deepseek-code/issues"},homepage:"https://github.com/Hermenics/deepseek-code#readme",publishConfig:{access:"public"},engines:{bun:">=1.1"},scripts:{start:"NODE_ENV=development bun src/index.tsx",dev:"NODE_ENV=development bun --watch src/index.tsx",build:"bun run build.ts",typecheck:"bunx tsc --noEmit",test:"bun test","test:ink":"bun test tests/ink","test:plugins":"bun test tests/plugins"},dependencies:{"@alcalzone/ansi-tokenize":"^0.3.0","@aws-crypto/sha256-js":"^5.2.0","@aws-sdk/client-bedrock":"^3.1048.0","@aws-sdk/credential-providers":"^3.1048.0","@modelcontextprotocol/sdk":"^1.29.0","@smithy/protocol-http":"^5.3.14","@smithy/signature-v4":"^5.3.14","@types/semver":"^7.7.1",ajv:"^8.20.0","auto-bind":"^5.0.1","bidi-js":"^1.0.3",chalk:"^5.6.2","cli-boxes":"^4.0.1","code-excerpt":"^4.0.0","emoji-regex":"^10.6.0",execa:"^9.6.1","fast-glob":"^3.3.3","fuse.js":"^7.0.0","get-east-asian-width":"^1.6.0","google-auth-library":"^10.6.2","indent-string":"^5.0.0","lodash-es":"^4.18.1",openai:"^6.34.0",qrcode:"^1.5.4",react:"^19.2.0","react-reconciler":"^0.33.0",semver:"^7.8.1","signal-exit":"^4.1.0","stack-utils":"^2.0.6","strip-ansi":"^7.2.0","supports-hyperlinks":"^4.4.0","type-fest":"^5.6.0","usehooks-ts":"^3.1.1","wrap-ansi":"^10.0.0"},overrides:{"node-fetch":"npm:undici@^7.0.0"},devDependencies:{"@types/bun":"^1.3.12","@types/qrcode":"^1.5.6","@types/react":"^19.2.0","@types/stack-utils":"^2.0.3","react-devtools-core":"^7.0.1",typescript:"^5.9.3",vitest:"^4.1.6"}}});import{join as GE6}from"path";function PE6($=process.env){return{PATH:$.PATH||"/usr/local/bin:/usr/bin:/bin",TMPDIR:$.TMPDIR||"/tmp",...$.LANG?{LANG:$.LANG}:{}}}function _E6($,K){let q={...$};for(let[Y,z]of Object.entries(K)){if(ME6.has(Y))continue;q[Y]=z}return q}function TE6($){if($.trim()==="")throw Error("MCP command cannot be empty");if(AE6.test($))throw Error(`MCP command contains path traversal: ${$}`);if(OE6.test($))throw Error(`MCP command contains shell injection characters: ${$}`)}function NE6($,K){return{type:"mcp_server_load",serverName:$,transport:K}}async function LE6($){let K=GE6($,".deepseek","mcp.json");try{return await R9(K)}catch{return null}}async function O40($=process.cwd(),K={}){if(!K.enabled)return{tools:[],errors:[]};let q=await LE6($);if(!q?.servers)return{tools:[],errors:[]};let Y=[],z=[];for(let[D,J]of Object.entries(q.servers))try{if(J.transport==="stdio")TE6(J.command);let X=new t48({name:"deepseek-code",version:$$.version}),W=J.transport==="stdio"?new $78({command:J.command,args:J.args??[],env:_E6(PE6(K.environment),J.env??{})}):new M78(new URL(J.url));await X.connect(W),await E7(NE6(D,J.transport));let{tools:Z}=await X.listTools();for(let G of Z)Y.push({name:`${D}__${G.name}`,description:`[MCP:${D}] ${G.description??""}`,parameters:G.inputSchema,async execute(O){return(await Promise.race([X.callTool({name:G.name,arguments:O}),new Promise((N,j)=>setTimeout(()=>j(Error(`MCP tool '${G.name}' timed out after 30s`)),30000))])).content.filter((N)=>N.type==="text"&&N.text).map((N)=>N.text).join(`
1123
1123
  `)}})}catch(X){let W=`MCP server '${D}': ${X.message}`;z.push(W)}return{tools:Y,errors:z}}var ME6,OE6,AE6;var A40=F(()=>{B10();C10();w40();jq();O78();sG();ME6=new Set(["PATH","LD_PRELOAD","LD_LIBRARY_PATH","DYLD_INSERT_LIBRARIES","DYLD_LIBRARY_PATH","HOME","USER","SHELL","PYTHONPATH","NODE_OPTIONS","NODE_PATH","BUN_INSTALL"]),OE6=/[;|`<>]|&&|\|\||\$\(|>>|<</,AE6=/\.\.[/\\]/});import{readFile as VE6,realpath as P40}from"fs/promises";import{isAbsolute as _40,relative as jE6,resolve as RE6,sep as FE6}from"path";async function L40($,K=process.cwd()){if(!$.length)return"";let q=RE6(K);for(let X of $)if(!X||_40(X)||X.split(/[\\/]+/).includes(".."))throw Error(`Agent file pattern '${X}' must stay inside the project workspace`);let Y=await N40.default($,{cwd:q,ignore:["**/node_modules/**","**/.git/**","**/.deepseek/**"],dot:!0,absolute:!0,onlyFiles:!0,followSymbolicLinks:!1}),z=[],D=T40,J=await P40(q);for(let X of Y){let W=await S3(X,{sessionId:"agent-config",workspacePath:q,projectRoot:q,permissionProfile:"researcher-readonly"}),Z=await P40(W),G=jE6(J,Z);if(G.startsWith(`..${FE6}`)||_40(G))throw Error(`Agent file '${X}' escapes the project workspace`);if(D<=0)break;let O=await VE6(Z,"utf-8"),A=O.slice(0,D);D-=A.length,z.push(`// File: ${G}
1124
1124
  ${A}${A.length<O.length?`
1125
1125
 
@@ -1291,7 +1291,7 @@ Minimum version required to store current data is: `+D+`.
1291
1291
  `)}var a98;var MK0=F(()=>{a98=[{id:"github",kind:"MCP",name:"GitHub",source:"github/github-mcp-server",description:"Repository, issue and pull-request context."},{id:"playwright",kind:"MCP",name:"Playwright",source:"microsoft/playwright-mcp",description:"Browser automation and UI verification."},{id:"context7",kind:"MCP",name:"Context7",source:"upstash/context7",description:"Current library documentation for implementation work."},{id:"openai-docs",kind:"Skill",name:"OpenAI docs",source:"openai/openai-docs",description:"Official OpenAI product and API research workflow."}]});function JV($){return/^[a-z0-9]+(-[a-z0-9]+)*$/.test($)}function t98($){if(!$||!$.trim())return{error:"Empty file: no frontmatter found"};if(!$.startsWith("---"))return{error:"No frontmatter found: file must start with ---"};let K=$.split(`
1292
1292
  `),q=-1;for(let J=1;J<K.length;J++)if(K[J].trim()==="---"){q=J;break}if(q===-1)return{error:"No frontmatter found: missing closing ---"};let Y=K.slice(1,q).join(`
1293
1293
  `).trim();if(!Y)return{error:"Empty frontmatter"};let z=aS6(Y);if(!z.name)return{error:"SKILL.md missing required 'name' field"};if(!z.description||z.description==="''"||z.description==='""')return{error:"SKILL.md missing required 'description' field"};if(!JV(z.name))return{error:`Invalid skill name '${z.name}': must be kebab-case (lowercase letters, numbers, hyphens)`};let D={name:z.name,description:z.description};if(z.metadata)D.metadata=z.metadata;return D}function OK0($){return $!=="__proto__"&&$!=="prototype"&&$!=="constructor"}function aS6($){let K={},q=$.split(`
1294
- `),Y=null,z={};for(let D of q){if(!D.trim())continue;if(Y&&(D.startsWith(" ")||D.startsWith("\t"))){let Z=D.trim(),G=Z.indexOf(":");if(G>0){let O=Z.slice(0,G).trim(),A=Z.slice(G+1).trim();if(OK0(O))z[O]=AK0(A)}continue}if(Y)K[Y]={...z},Y=null,z={};let J=D.indexOf(":");if(J===-1)continue;let X=D.slice(0,J).trim(),W=D.slice(J+1).trim();if(!OK0(X))continue;if(!W)Y=X,z={};else K[X]=AK0(W)}if(Y)K[Y]={...z};return K}function AK0($){if($.startsWith("'")&&$.endsWith("'")||$.startsWith('"')&&$.endsWith('"'))return $.slice(1,-1);return $}var _K0={};c6(_K0,{writeRegistry:()=>s98,removeFromRegistry:()=>e98,readRegistry:()=>BD,addToRegistry:()=>Gb});import{readFileSync as tS6,writeFileSync as sS6,mkdirSync as eS6}from"fs";import{join as $b6}from"path";function PK0($){return $b6($,Kb6)}function BD($){try{let K=tS6(PK0($),"utf-8"),q=JSON.parse(K);if(q&&typeof q==="object"&&!Array.isArray(q)&&q.version===1&&q.skills&&typeof q.skills==="object"&&!Array.isArray(q.skills))return q;throw Error("Registry file has unexpected format")}catch(K){if(K.code==="ENOENT")return{version:1,skills:{}};throw K}}function s98($,K){eS6($,{recursive:!0}),sS6(PK0($),JSON.stringify(K,null,2))}function Gb($,K){let q=BD($);q.skills[K.name]=K,s98($,q)}function e98($,K){let q=BD($);if(!(K in q.skills))return;delete q.skills[K],s98($,q)}var Kb6=".registry.json";var $38=()=>{};var XV={};c6(XV,{updateSkill:()=>Hb6,removeSkill:()=>Xb6,listSkills:()=>wb6,installSkill:()=>Jb6});import{rm as I4,mkdir as qb6}from"fs/promises";import{readFileSync as NK0}from"fs";import{join as bq,resolve as TK0,relative as Yb6,isAbsolute as zb6}from"path";import{tmpdir as K38}from"os";import{randomBytes as q38}from"crypto";function Y38($,K){let q=TK0($),Y=TK0(q,K),z=Yb6(q,Y);return z.length>0&&!z.startsWith("..")&&!zb6(z)}async function Db6($){return await Bun.spawn(["test","-d",$],{stdout:"pipe",stderr:"pipe"}).exited===0}async function Jb6($,K){let q=`https://github.com/${$}.git`,Y=bq(K38(),`dsk-skill-${q38(6).toString("hex")}`);try{let z=Bun.spawn(["git","clone","--depth","1",q,Y],{stdout:"pipe",stderr:"pipe"}),D=await z.exited;if(D!==0){let j=await new Response(z.stderr).text();return await I4(Y,{recursive:!0,force:!0}).catch(()=>{}),{ok:!1,name:"",error:`git clone failed: ${j.trim()||"exit code "+D}`}}let J=bq(Y,"SKILL.md"),X;try{X=NK0(J,"utf-8")}catch{return await I4(Y,{recursive:!0,force:!0}),{ok:!1,name:"",error:"Not a valid skill: missing SKILL.md"}}let W=t98(X);if("error"in W)return await I4(Y,{recursive:!0,force:!0}),{ok:!1,name:"",error:W.error};let{name:Z}=W;if(!JV(Z)||!Y38(K,Z))return await I4(Y,{recursive:!0,force:!0}),{ok:!1,name:"",error:`Invalid skill name: '${Z}'`};let G=BD(K),O=bq(K,Z);if(G.skills[Z])return await I4(Y,{recursive:!0,force:!0}),{ok:!1,name:Z,error:`Skill '${Z}' already installed. Use /skill update ${Z}`};if(await Db6(O))return await I4(Y,{recursive:!0,force:!0}),{ok:!1,name:Z,error:`Skill '${Z}' directory already exists. Remove it first or use /skill update ${Z}`};let A=Bun.spawn(["git","rev-parse","HEAD"],{cwd:Y,stdout:"pipe"});await A.exited;let _=(await new Response(A.stdout).text()).trim();await I4(bq(Y,".git"),{recursive:!0,force:!0}),await qb6(K,{recursive:!0});let T=Bun.spawn(["mv",Y,O],{stdout:"pipe",stderr:"pipe"}),N=await T.exited;if(N!==0){let j=await new Response(T.stderr).text();return await I4(Y,{recursive:!0,force:!0}).catch(()=>{}),{ok:!1,name:Z,error:`Failed to move skill: ${j.trim()||"exit code "+N}`}}try{Gb(K,{name:Z,repo:$,installedAt:new Date().toISOString(),updatedAt:new Date().toISOString(),commitHash:_,description:W.description})}catch(j){return await I4(O,{recursive:!0,force:!0}).catch(()=>{}),{ok:!1,name:Z,error:`Installed but failed to register: ${j.message}`}}return{ok:!0,name:Z}}catch(z){return await I4(Y,{recursive:!0,force:!0}).catch(()=>{}),{ok:!1,name:"",error:z.message||String(z)}}}async function Xb6($,K){if(!JV($)||!Y38(K,$))return{ok:!1,name:$,error:`Invalid skill name: '${$}'`};if(!BD(K).skills[$])return{ok:!1,name:$,error:`Skill '${$}' not found`};let Y=bq(K,$);return e98(K,$),await I4(Y,{recursive:!0,force:!0}),{ok:!0,name:$}}async function Hb6($,K){if(!JV($)||!Y38(K,$))return{ok:!1,name:$,error:`Invalid skill name: '${$}'`};let Y=BD(K).skills[$];if(!Y)return{ok:!1,name:$,error:`Skill '${$}' not installed. Use /skill install`};let{repo:z}=Y,D=`https://github.com/${z}.git`,J=bq(K38(),`dsk-skill-${q38(6).toString("hex")}`),X=bq(K,$),W=bq(K38(),`dsk-skill-backup-${q38(6).toString("hex")}`),Z=!1;try{let G=Bun.spawn(["git","clone","--depth","1",D,J],{stdout:"pipe",stderr:"pipe"}),O=await G.exited;if(O!==0){let B=await new Response(G.stderr).text();return await I4(J,{recursive:!0,force:!0}).catch(()=>{}),{ok:!1,name:$,error:`git clone failed: ${B.trim()||"exit code "+O}`}}let A=bq(J,"SKILL.md"),_;try{_=NK0(A,"utf-8")}catch{return await I4(J,{recursive:!0,force:!0}),{ok:!1,name:$,error:"Update failed: SKILL.md missing in new version"}}let T=t98(_);if("error"in T)return await I4(J,{recursive:!0,force:!0}),{ok:!1,name:$,error:T.error};if(T.name!==$)return await I4(J,{recursive:!0,force:!0}),{ok:!1,name:$,error:`Skill name mismatch: expected '${$}', got '${T.name}'`};let N=Bun.spawn(["git","rev-parse","HEAD"],{cwd:J,stdout:"pipe"});await N.exited;let j=(await new Response(N.stdout).text()).trim();await I4(bq(J,".git"),{recursive:!0,force:!0});let R=Bun.spawn(["mv",X,W],{stdout:"pipe",stderr:"pipe"}),E=await R.exited;if(E!==0){let B=await new Response(R.stderr).text();return await I4(J,{recursive:!0,force:!0}).catch(()=>{}),{ok:!1,name:$,error:`Failed to backup existing skill: ${B.trim()||"exit code "+E}`}}if(Z=!0,await Bun.spawn(["mv",J,X],{stdout:"pipe",stderr:"pipe"}).exited!==0){let U=await Bun.spawn(["mv",W,X],{stdout:"pipe",stderr:"pipe"}).exited;return await I4(J,{recursive:!0,force:!0}).catch(()=>{}),{ok:!1,name:$,error:`Failed to move updated skill into place${U===0?" (original restored)":" (WARNING: restore also failed)"}`}}try{Gb(K,{name:$,repo:z,installedAt:Y.installedAt,updatedAt:new Date().toISOString(),commitHash:j,description:T.description})}catch(B){return await I4(X,{recursive:!0,force:!0}).catch(()=>{}),await Bun.spawn(["mv",W,X],{stdout:"pipe",stderr:"pipe"}).exited,{ok:!1,name:$,error:`Update moved but registry failed: ${B.message}`}}return await I4(W,{recursive:!0,force:!0}).catch(()=>{}),{ok:!0,name:$}}catch(G){if(await I4(J,{recursive:!0,force:!0}).catch(()=>{}),Z)await Bun.spawn(["mv",W,X],{stdout:"pipe",stderr:"pipe"}).exited.catch(()=>{});return{ok:!1,name:$,error:G.message||String(G)}}}async function wb6($){let K=BD($);return Object.values(K.skills)}var HV=F(()=>{$38()});import{readFileSync as Wb6,writeFileSync as Zb6,mkdirSync as Gb6,renameSync as Mb6}from"fs";import{join as Mb}from"path";import{homedir as Ob6}from"os";import{randomBytes as Ab6}from"crypto";function TK(){return process.env.DEEPSEEK_PLUGINS_DIR||Mb(Ob6(),".deepseek-code","plugins")}function vq($){let K=Mb($??TK(),"registry.json");try{let q=Wb6(K,"utf-8"),Y=JSON.parse(q);if(Y&&typeof Y==="object"&&!Array.isArray(Y)&&Y.version===1&&Y.plugins&&typeof Y.plugins==="object"&&!Array.isArray(Y.plugins))return Y;throw Error("Plugin registry has unexpected format")}catch(q){if(q.code==="ENOENT")return{version:1,plugins:{}};throw q}}function z38($,K){let q=K??TK();Gb6(q,{recursive:!0});let Y=Mb(q,`.registry-${Ab6(6).toString("hex")}.json`);Zb6(Y,JSON.stringify($,null,2)),Mb6(Y,Mb(q,"registry.json"))}function Ob($,K){let q=vq(K);q.plugins[$.name]=$,z38(q,K)}function D38($,K){let q=vq(K);if(!($ in q.plugins))return;delete q.plugins[$],z38(q,K)}function Pb6($,K){return vq(K).plugins[$]}var Ab=()=>{};function _b6($,K){return $.replaceAll("${PLUGIN_ROOT}",K)}import{readdirSync as J38,readFileSync as Tb6,existsSync as LM}from"fs";import{join as w5}from"path";function X38($,K){let q=[],Y=[],z=[],D=!1;function J(O,A){if(!O)return w5($,A);let _=Array.isArray(O)?O[0]:O;if(_&&!_.includes("/"))return w5($,_);return w5($,_??A)}let X=K?.commands?J(K.commands,"commands"):w5($,"commands");if(LM(X)){for(let O of J38(X))if(O.endsWith(".md"))q.push(O.replace(/\.md$/,""))}let W=K?.agents?J(K.agents,"agents"):w5($,"agents");if(LM(W)){for(let O of J38(W))if(O.endsWith(".md"))Y.push(O.replace(/\.md$/,""))}let Z=K?.skills?J(K.skills,"skills"):w5($,"skills");if(LM(Z)){for(let O of J38(Z,{withFileTypes:!0}))if(O.isDirectory()&&LM(w5(Z,O.name,"SKILL.md")))z.push(O.name)}let G=K?.hooks?w5($,K.hooks):w5($,"hooks","hooks.json");if(LM(G))D=!0;return{commands:q,agents:Y,skills:z,hasHooks:D}}function Pb($){let K=[w5($,"plugin.json"),w5($,".claude-plugin","plugin.json")];for(let q of K)try{let Y=Tb6(q,"utf-8"),z=JSON.parse(Y);if(!z||typeof z.name!=="string")continue;return z}catch{continue}return null}function LK0($){let K=vq($),q=$??TK(),Y=[];for(let z of Object.values(K.plugins)){let D=w5(q,z.name);if(!LM(D)){console.warn(`[plugins] skipping '${z.name}': directory not found at ${D}`);continue}let J=Pb(D);if(!J){console.warn(`[plugins] skipping '${z.name}': could not read plugin.json in ${D}`);continue}Y.push({entry:z,path:D,manifest:J})}return Y}var H38=F(()=>{Ab()});import{rm as u1,mkdir as Nb6}from"fs/promises";import{existsSync as wV,readdirSync as Lb6}from"fs";import{join as H3,resolve as VK0,relative as Vb6,isAbsolute as jb6}from"path";import{tmpdir as w38}from"os";import{randomBytes as W38}from"crypto";function Z38($){let K=VK0(TK()),q=VK0(K,$),Y=Vb6(K,q);return Y.length>0&&!Y.startsWith("..")&&!jb6(Y)}function G38($){return cL.test($)}function Rb6($){return wV($)}function RK0($){if(wV(H3($,"plugin.json")))return $;let K=H3($,"plugins");if(wV(K))try{for(let q of Lb6(K,{withFileTypes:!0})){if(!q.isDirectory())continue;let Y=H3(K,q.name);if(wV(H3(Y,"plugin.json")))return Y;if(wV(H3(Y,".claude-plugin","plugin.json")))return Y}}catch{}return null}async function FK0($,K){let q=Bun.spawn(["git","clone","--depth","1",$,K],{stdout:"pipe",stderr:"pipe"}),Y=!1,z=setTimeout(()=>{Y=!0,q.kill()},jK0),D=await q.exited;clearTimeout(z);let J=Y?`timed out after ${jK0/1000}s`:(await new Response(q.stderr).text()).trim();return{exitCode:Y?-1:D,stderr:J}}async function EK0($){let K=Bun.spawn(["git","rev-parse","HEAD"],{cwd:$,stdout:"pipe",stderr:"pipe"});if(await K.exited!==0)return null;return(await new Response(K.stdout).text()).trim()||null}async function VM($,K){return Bun.spawn(["mv",$,K],{stdout:"pipe",stderr:"pipe"}).exited}async function fK0($){if(!iS.test($))return{ok:!1,name:"",error:`Invalid repo format: "${$}". Expected: owner/repo`};let K=`https://github.com/${$}.git`,q=H3(w38(),`dsk-plugin-${W38(6).toString("hex")}`);try{let{exitCode:Y,stderr:z}=await FK0(K,q);if(Y!==0)return await u1(q,{recursive:!0,force:!0}).catch(()=>{}),{ok:!1,name:"",error:`git clone failed: ${z||"exit code "+Y}`};let D=RK0(q);if(!D)return await u1(q,{recursive:!0,force:!0}),{ok:!1,name:"",error:"Not a valid plugin: no plugin.json found"};let J=Pb(D);if(!J)return await u1(q,{recursive:!0,force:!0}),{ok:!1,name:"",error:'Invalid plugin.json: missing or invalid "name" field'};let{name:X}=J;if(!G38(X)||!Z38(X))return await u1(q,{recursive:!0,force:!0}),{ok:!1,name:"",error:`Invalid plugin name: '${X}'. Must be kebab-case.`};let W=vq(),Z=H3(TK(),X);if(W.plugins[X])return await u1(q,{recursive:!0,force:!0}),{ok:!1,name:X,error:`Plugin '${X}' already installed. Use /plugin update ${X}`};if(Rb6(Z))return await u1(q,{recursive:!0,force:!0}),{ok:!1,name:X,error:`Plugin '${X}' directory already exists. Remove it first.`};let G=await EK0(q);if(!G)return await u1(q,{recursive:!0,force:!0}).catch(()=>{}),{ok:!1,name:X,error:"Failed to read commit hash from cloned repo"};if(await u1(H3(q,".git"),{recursive:!0,force:!0}),await Nb6(TK(),{recursive:!0}),await VM(D,Z)!==0)return await u1(q,{recursive:!0,force:!0}).catch(()=>{}),{ok:!1,name:X,error:"Failed to move plugin into place"};if(D!==q)await u1(q,{recursive:!0,force:!0}).catch(()=>{});let A;try{A=X38(Z,J)}catch(T){return await u1(Z,{recursive:!0,force:!0}).catch(()=>{}),{ok:!1,name:X,error:`Failed to discover components: ${T.message}`}}let _={name:X,repo:$,version:J.version||"0.0.0",installedAt:new Date().toISOString(),updatedAt:new Date().toISOString(),commitHash:G,description:J.description||"",components:A};try{Ob(_)}catch(T){return await u1(Z,{recursive:!0,force:!0}).catch(()=>{}),{ok:!1,name:X,error:`Installed but failed to register: ${T.message}`}}return{ok:!0,name:X}}catch(Y){return await u1(q,{recursive:!0,force:!0}).catch(()=>{}),{ok:!1,name:"",error:Y.message||String(Y)}}}async function BK0($){if(!G38($)||!Z38($))return{ok:!1,name:$,error:`Invalid plugin name: '${$}'`};if(!vq().plugins[$])return{ok:!1,name:$,error:`Plugin '${$}' not found`};let q=H3(TK(),$);try{await u1(q,{recursive:!0,force:!0})}catch(Y){return{ok:!1,name:$,error:`Failed to remove plugin directory: ${Y.message}`}}return D38($),{ok:!0,name:$}}async function kK0($){if(!G38($)||!Z38($))return{ok:!1,name:$,error:`Invalid plugin name: '${$}'`};let q=vq().plugins[$];if(!q)return{ok:!1,name:$,error:`Plugin '${$}' not installed. Use /plugin install`};let{repo:Y}=q,z=`https://github.com/${Y}.git`,D=H3(w38(),`dsk-plugin-${W38(6).toString("hex")}`),J=H3(TK(),$),X=H3(w38(),`dsk-plugin-backup-${W38(6).toString("hex")}`),W=!1;try{let{exitCode:Z,stderr:G}=await FK0(z,D);if(Z!==0)return await u1(D,{recursive:!0,force:!0}).catch(()=>{}),{ok:!1,name:$,error:`git clone failed: ${G||"exit code "+Z}`};let O=RK0(D);if(!O)return await u1(D,{recursive:!0,force:!0}),{ok:!1,name:$,error:"Update failed: no plugin.json in new version"};let A=Pb(O);if(!A)return await u1(D,{recursive:!0,force:!0}),{ok:!1,name:$,error:"Update failed: invalid plugin.json in new version"};if(A.name!==$)return await u1(D,{recursive:!0,force:!0}),{ok:!1,name:$,error:`Plugin name mismatch: expected '${$}', got '${A.name}'`};let _=await EK0(D);if(!_)return await u1(D,{recursive:!0,force:!0}).catch(()=>{}),{ok:!1,name:$,error:"Failed to read commit hash from cloned repo"};if(await u1(H3(D,".git"),{recursive:!0,force:!0}),await VM(J,X)!==0)return await u1(D,{recursive:!0,force:!0}).catch(()=>{}),{ok:!1,name:$,error:"Failed to backup existing plugin"};if(W=!0,await VM(O,J)!==0){let R=await VM(X,J);await u1(D,{recursive:!0,force:!0}).catch(()=>{});let E=R===0?" (original restored)":" (restore also failed \u2014 backup at "+X+")";return{ok:!1,name:$,error:`Failed to move updated plugin into place${E}`}}if(O!==D)await u1(D,{recursive:!0,force:!0}).catch(()=>{});let j=X38(J,A);try{Ob({name:$,repo:Y,version:A.version||"0.0.0",installedAt:q.installedAt,updatedAt:new Date().toISOString(),commitHash:_,description:A.description||"",components:j})}catch(R){await u1(J,{recursive:!0,force:!0}).catch(()=>{});let k=await VM(X,J)===0?" (original restored)":" (restore failed \u2014 backup at "+X+")";return{ok:!1,name:$,error:`Update moved but registry failed: ${R.message}${k}`}}return await u1(X,{recursive:!0,force:!0}).catch(()=>{}),{ok:!0,name:$}}catch(Z){if(await u1(D,{recursive:!0,force:!0}).catch(()=>{}),W){let O=await VM(X,J)===0?" (original restored)":" (restore failed \u2014 backup at "+X+")";return{ok:!1,name:$,error:(Z.message||String(Z))+O}}return{ok:!1,name:$,error:Z.message||String(Z)}}}var jK0=60000;var UK0=F(()=>{Ab();H38();k$8()});var WV={};c6(WV,{writePluginRegistry:()=>z38,updatePlugin:()=>kK0,resolvePluginVariables:()=>_b6,removePluginFromRegistry:()=>D38,removePlugin:()=>BK0,readPluginRegistry:()=>vq,loadInstalledPlugins:()=>LK0,installPlugin:()=>fK0,getPluginsDir:()=>TK,getPluginEntry:()=>Pb6,addPluginToRegistry:()=>Ob});var ZV=F(()=>{H38();UK0();Ab()});function kb6(){return S6.jsxDEV(r,{flexDirection:"column",children:[S6.jsxDEV(x,{color:"cyan",children:" \u2584\u2584\u2588\u2588\u2588\u2584\u2584"},void 0,!1,void 0,this),S6.jsxDEV(x,{color:"cyan",children:" \u2584\u2588 \u25C9 \u2588\u2588\u2584"},void 0,!1,void 0,this),S6.jsxDEV(x,{color:"cyan",children:"\u2588 ~~\u2588"},void 0,!1,void 0,this),S6.jsxDEV(x,{color:"cyan",children:" \u2580\u2584\u2584\u2588\u2584\u2584\u2584\u2584\u2588\u2580"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Ub6(){if((process.stdout.columns??80)<100)return S6.jsxDEV(r,{flexDirection:"column",marginBottom:1,marginTop:1,children:S6.jsxDEV(r,{flexDirection:"row",gap:2,children:[S6.jsxDEV(kb6,{},void 0,!1,void 0,this),S6.jsxDEV(r,{flexDirection:"column",children:[S6.jsxDEV(r,{flexDirection:"row",gap:1,children:[S6.jsxDEV(x,{color:"cyan",children:"\u25C6 DeepSeek Code"},void 0,!1,void 0,this),S6.jsxDEV(x,{color:"#888888",children:"v"+$$.version},void 0,!1,void 0,this)]},void 0,!0,void 0,this),S6.jsxDEV(x,{color:"#5599ff",children:"Deep reasoning,"},void 0,!1,void 0,this),S6.jsxDEV(x,{color:"#888888",children:"Elite code."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this);return S6.jsxDEV(r,{flexDirection:"column",children:[S6.jsxDEV(r,{flexDirection:"row",gap:1,children:[S6.jsxDEV(x,{color:"cyan",children:"Welcome to DeepSeek Code"},void 0,!1,void 0,this),S6.jsxDEV(x,{color:"#888888",children:"v"+$$.version},void 0,!1,void 0,this)]},void 0,!0,void 0,this),S6.jsxDEV(r,{marginTop:1,flexDirection:"column",children:[S6.jsxDEV(x,{color:"#888888",children:" * . * . * .* . "},void 0,!1,void 0,this),S6.jsxDEV(x,{color:"#888888",children:" . * . * . *"},void 0,!1,void 0,this),S6.jsxDEV(x,{color:"#888888",children:" . * . * . * . "},void 0,!1,void 0,this),S6.jsxDEV(x,{color:"#888888",children:" . * . * . "},void 0,!1,void 0,this),S6.jsxDEV(x,{color:"#888888",children:" * . * . * . "},void 0,!1,void 0,this),S6.jsxDEV(r,{flexDirection:"row",children:[S6.jsxDEV(x,{color:"cyan",children:" \u2584\u2584\u2588\u2588\u2588\u2584\u2584"},void 0,!1,void 0,this),S6.jsxDEV(x,{color:"#888888",children:" . * . * . * . * . "},void 0,!1,void 0,this)]},void 0,!0,void 0,this),S6.jsxDEV(r,{flexDirection:"row",children:[S6.jsxDEV(x,{color:"cyan",children:" \u2584\u2588 \u25C9 \u2588\u2588\u2584"},void 0,!1,void 0,this),S6.jsxDEV(x,{color:"#888888",children:" * . * . * . * . "},void 0,!1,void 0,this)]},void 0,!0,void 0,this),S6.jsxDEV(r,{flexDirection:"row",children:[S6.jsxDEV(x,{color:"cyan",children:" \u2588 ~~\u2588"},void 0,!1,void 0,this),S6.jsxDEV(x,{color:"#888888",children:" * . * . * . * . "},void 0,!1,void 0,this)]},void 0,!0,void 0,this),S6.jsxDEV(x,{color:"#888888",children:"~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~"},void 0,!1,void 0,this),S6.jsxDEV(x,{color:"#888888",children:"~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ "},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function vK0({children:$}){let[K,q]=_b.useState(!1);return _b.useEffect(()=>{let Y=setTimeout(()=>q(!0),50);return()=>clearTimeout(Y)},[]),S6.jsxDEV(r,{flexDirection:"column",children:[S6.jsxDEV(Ub6,{},void 0,!1,void 0,this),K&&$]},void 0,!0,void 0,this)}var _b,S6;var hK0=F(()=>{sG();C6();p6();_b=n(G6(),1),S6=n(Y0(),1)});import{execSync as Qb6}from"child_process";import{homedir as Cb6}from"os";import{join as Ib6}from"path";import{mkdir as Sb6}from"fs/promises";async function bb6($){let K=Ib6(Cb6(),".deepseek");await Sb6(K,{recursive:!0});let q=await wM().catch(()=>({}));await WM({...q,...$})}async function Tb(){try{let[$,K]=await Promise.all([wM(),E$()]),q=K.provider?.name??$.PROVIDER??"deepseek",Y={provider:q};if(q==="deepseek"&&$.DEEPSEEK_API_KEY)Y.apiKey=$.DEEPSEEK_API_KEY,Y.baseURL=K.provider?.endpoint??$.DEEPSEEK_BASE_URL;if(q==="bedrock")Y.awsRegion=K.provider?.region??$.AWS_REGION,Y.awsProfile=K.provider?.profile??$.AWS_PROFILE;if(q==="vertex")Y.gcpProject=K.provider?.projectId??$.GCP_PROJECT,Y.gcpLocation=K.provider?.location??$.GCP_LOCATION,Y.gcpCredentials=$.GCP_CREDENTIALS;if(q==="local")Y.localBaseUrl=K.provider?.endpoint??$.LOCAL_BASE_URL,Y.localModel=$.LOCAL_MODEL;return{providerConfig:q==="deepseek"&&!!Y.apiKey||q==="bedrock"&&!!Y.awsRegion||q==="vertex"&&!!Y.gcpProject&&!!Y.gcpCredentials||q==="local"&&!!Y.localBaseUrl?Y:null,theme:K.interface?.theme??$.THEME??"dark",language:K.interface?.language??$.LANGUAGE??null,enchant:K.promptRefiner?.enabled??$.ENCHANT!=="false"}}catch{return{providerConfig:null,theme:"dark",language:null,enchant:!0}}}function yK0({onDone:$}){let[K,q]=NK.useState("theme"),[Y,z]=NK.useState(0),[D,J]=NK.useState(0),[X,W]=NK.useState(0),[Z,G]=NK.useState({}),[O,A]=NK.useState(""),[_,T]=NK.useState(""),[N,j]=NK.useState(null),R=RM[Y].value,E=jM[D].value,k=vb6[E],v=k[X];if(NK.useEffect(()=>{if(N){let U=setTimeout(()=>$(N.theme,N.config),50);return()=>clearTimeout(U)}},[N,$]),W1((U,I)=>{if(I.ctrl&&U==="c")process.exit(0);if(K==="theme"){if(I.upArrow){z((h)=>(h-1+RM.length)%RM.length);return}if(I.downArrow){z((h)=>(h+1)%RM.length);return}if(I.return){q("provider");return}if(I.escape)process.exit(0);return}if(K==="provider"){if(I.upArrow){J((h)=>(h-1+jM.length)%jM.length);return}if(I.downArrow){J((h)=>(h+1)%jM.length);return}if(I.return){W(0),A(""),q("fields");return}if(I.escape){q("theme");return}return}if(K==="fields"){if(I.return){let h=O.trim();if(!h&&!v.optional){T(`${v.label} cannot be empty.`);return}let S={...Z,[v.key]:h};if(G(S),T(""),X<k.length-1)W((d)=>d+1),A("");else Promise.all([bb6(Object.fromEntries(Object.entries(S).filter(([d])=>d==="DEEPSEEK_API_KEY"||d==="GCP_CREDENTIALS"))),E78({provider:{name:E,endpoint:S.DEEPSEEK_BASE_URL||S.LOCAL_BASE_URL||void 0,region:S.AWS_REGION||void 0,profile:S.AWS_PROFILE||void 0,projectId:S.GCP_PROJECT||void 0,location:S.GCP_LOCATION||void 0},interface:{theme:R}})]).then(()=>{for(let[y,C]of Object.entries(S))if(C)process.env[y]=C;let d={provider:E,apiKey:S.DEEPSEEK_API_KEY,baseURL:S.DEEPSEEK_BASE_URL||void 0,awsRegion:S.AWS_REGION,awsProfile:S.AWS_PROFILE,gcpProject:S.GCP_PROJECT,gcpLocation:S.GCP_LOCATION,gcpCredentials:S.GCP_CREDENTIALS,localBaseUrl:S.LOCAL_BASE_URL,localModel:S.LOCAL_MODEL};q("done"),j({theme:R,config:d})}).catch((d)=>T(`Failed to save: ${d.message}`));return}if(I.backspace){A((h)=>h.slice(0,-1)),T("");return}if(I.escape){if(X>0)W((h)=>h-1),A(Z[k[X-1].key]??""),T("");else q("provider"),A(""),T("");return}if(I.ctrl&&I.shift&&U==="v"){try{let h=Qb6("xclip -selection clipboard -o 2>/dev/null || xsel --clipboard --output 2>/dev/null || wl-paste 2>/dev/null",{encoding:"utf-8",timeout:2000}).trim();if(h)A((S)=>S+h),T("")}catch{}return}if(!I.ctrl&&!I.meta&&U&&U.length>=1)A((h)=>h+U),T("")}}),K==="done")return u6.jsxDEV(r,{marginTop:1,children:u6.jsxDEV(x,{color:"green",children:"\u2713 Saved! Starting DeepSeek Code\u2026"},void 0,!1,void 0,this)},void 0,!1,void 0,this);let B=null;if(K==="theme"){let U=I6(R);B=u6.jsxDEV(r,{flexDirection:"column",marginTop:1,children:[u6.jsxDEV(x,{children:"Choose the text style that looks best with your terminal:"},void 0,!1,void 0,this),u6.jsxDEV(r,{flexDirection:"row",marginTop:1,gap:3,children:[u6.jsxDEV(r,{flexDirection:"column",children:RM.map((I,h)=>u6.jsxDEV(r,{children:u6.jsxDEV(x,{color:h===Y?"cyan":void 0,children:[h===Y?"\u276F ":" ",I.label]},void 0,!0,void 0,this)},I.value,!1,void 0,this))},void 0,!1,void 0,this),u6.jsxDEV(r,{flexDirection:"column",children:Array.from({length:RM.length}).map((I,h)=>u6.jsxDEV(x,{color:"#444444",children:"\u2502"},h,!1,void 0,this))},void 0,!1,void 0,this),u6.jsxDEV(r,{flexDirection:"column",children:[u6.jsxDEV(x,{color:"#888888",italic:!0,children:"Preview \u2014 demo.js"},void 0,!1,void 0,this),u6.jsxDEV(x,{color:U.textDim,children:" function greet() {"},void 0,!1,void 0,this),u6.jsxDEV(x,{backgroundColor:U.diffRemoved,color:U.diffRemovedWord,children:'- console.log("Hello, World!");'},void 0,!1,void 0,this),u6.jsxDEV(x,{backgroundColor:U.diffAdded,color:U.diffAddedWord,children:'+ console.log("Hello, DeepSeek!");'},void 0,!1,void 0,this),u6.jsxDEV(x,{color:U.textDim,children:" }"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),u6.jsxDEV(x,{color:"#888888",children:"\u2191\u2193 navigate \xB7 Enter select \xB7 Esc exit"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}else if(K==="provider")B=u6.jsxDEV(r,{flexDirection:"column",marginTop:1,children:[u6.jsxDEV(x,{children:"Choose your AI provider:"},void 0,!1,void 0,this),u6.jsxDEV(r,{flexDirection:"column",marginTop:1,children:jM.map((U,I)=>u6.jsxDEV(r,{flexDirection:"row",gap:2,children:[u6.jsxDEV(x,{color:I===D?"cyan":void 0,children:[I===D?"\u276F ":" ",U.label]},void 0,!0,void 0,this),u6.jsxDEV(x,{color:"#888888",children:U.hint},void 0,!1,void 0,this)]},U.value,!0,void 0,this))},void 0,!1,void 0,this),u6.jsxDEV(x,{color:"#888888",children:"\u2191\u2193 navigate \xB7 Enter select \xB7 Esc back"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);else if(K==="fields"){let U=`(${X+1}/${k.length})`;B=u6.jsxDEV(r,{flexDirection:"column",marginTop:1,children:[u6.jsxDEV(x,{children:jM[D].label+" setup "+U},void 0,!1,void 0,this),u6.jsxDEV(x,{children:v.label},void 0,!1,void 0,this),v.hint?u6.jsxDEV(x,{color:"#888888",children:v.hint},void 0,!1,void 0,this):null,u6.jsxDEV(r,{marginTop:1,children:[u6.jsxDEV(x,{color:"cyan",children:"> "},void 0,!1,void 0,this),u6.jsxDEV(x,{children:v.secret?"\u2022".repeat(O.length)||"\u2026":O||"\u2026"},void 0,!1,void 0,this),u6.jsxDEV(x,{color:"cyan",children:"\u2588"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),_?u6.jsxDEV(x,{color:"red",children:_},void 0,!1,void 0,this):u6.jsxDEV(x,{color:"#888888",children:"Enter to confirm \xB7 Esc back"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}return u6.jsxDEV(r,{flexDirection:"column",paddingLeft:2,paddingRight:2,paddingTop:1,paddingBottom:1,children:u6.jsxDEV(vK0,{children:B},void 0,!1,void 0,this)},void 0,!1,void 0,this)}var NK,u6,jM,RM,vb6;var O38=F(()=>{g$();ZM();jS();hK0();X7();C6();p6();NK=n(G6(),1),u6=n(Y0(),1),jM=[{value:"deepseek",label:"DeepSeek API",hint:"platform.deepseek.com/api_keys"},{value:"bedrock",label:"Amazon Bedrock",hint:"AWS profile from ~/.aws/credentials"},{value:"vertex",label:"Google Vertex AI",hint:"GCP project + service account JSON"},{value:"local",label:"Local model (Ollama / LM Studio)",hint:"Any OpenAI-compatible endpoint"}],RM=[{label:"Dark mode",value:"dark"},{label:"Light mode",value:"light"},{label:"Dark mode (colorblind-friendly)",value:"dark-daltonized"},{label:"Light mode (colorblind-friendly)",value:"light-daltonized"},{label:"Dark mode (ANSI colors only)",value:"dark-ansi"},{label:"Light mode (ANSI colors only)",value:"light-ansi"}];vb6={deepseek:[{key:"DEEPSEEK_API_KEY",label:"DeepSeek API Key",hint:"platform.deepseek.com/api_keys",secret:!0},{key:"DEEPSEEK_BASE_URL",label:"Base URL (optional)",hint:"Leave empty to use api.deepseek.com",optional:!0}],bedrock:[{key:"AWS_REGION",label:"AWS Region",hint:"e.g. us-east-1"},{key:"AWS_PROFILE",label:"AWS Profile Name",hint:"from ~/.aws/credentials (default: default)"}],vertex:[{key:"GCP_PROJECT",label:"GCP Project ID",hint:"your-project-id"},{key:"GCP_LOCATION",label:"GCP Location",hint:"e.g. us-central1"},{key:"GCP_CREDENTIALS",label:"Service Account JSON path",hint:"/path/to/sa.json"}],local:[{key:"LOCAL_BASE_URL",label:"Base URL",hint:"e.g. http://localhost:11434/v1"},{key:"LOCAL_MODEL",label:"Model name",hint:"e.g. deepseek-r1:8b, llama3, mistral"}]}});var pK0={};c6(pK0,{parsePipeArgs:()=>mK0,default:()=>cK0});function mK0($=process.argv.slice(2)){return{json:$.includes("--json"),promptArgs:$.filter((K)=>K!=="--pipe"&&K!=="--json")}}async function xb6(){let $=[];for await(let K of process.stdin)$.push(K);return Buffer.concat($).toString("utf-8").trim()}async function Lb($,K){if($.write(K))return;await new Promise((q)=>$.once("drain",q))}async function cK0(){let $=mK0();zj8(async()=>!1),await iL();let{providerConfig:K,language:q,enchant:Y}=await Tb();if(!K){if(!process.env.DEEPSEEK_API_KEY){if($.json)await Lb(process.stdout,JSON.stringify({ok:!1,error:"DEEPSEEK_API_KEY not set and no saved config found"})+`
1294
+ `),Y=null,z={};for(let D of q){if(!D.trim())continue;if(Y&&(D.startsWith(" ")||D.startsWith("\t"))){let Z=D.trim(),G=Z.indexOf(":");if(G>0){let O=Z.slice(0,G).trim(),A=Z.slice(G+1).trim();if(OK0(O))z[O]=AK0(A)}continue}if(Y)K[Y]={...z},Y=null,z={};let J=D.indexOf(":");if(J===-1)continue;let X=D.slice(0,J).trim(),W=D.slice(J+1).trim();if(!OK0(X))continue;if(!W)Y=X,z={};else K[X]=AK0(W)}if(Y)K[Y]={...z};return K}function AK0($){if($.startsWith("'")&&$.endsWith("'")||$.startsWith('"')&&$.endsWith('"'))return $.slice(1,-1);return $}var _K0={};c6(_K0,{writeRegistry:()=>s98,removeFromRegistry:()=>e98,readRegistry:()=>BD,addToRegistry:()=>Gb});import{readFileSync as tS6,writeFileSync as sS6,mkdirSync as eS6}from"fs";import{join as $b6}from"path";function PK0($){return $b6($,Kb6)}function BD($){try{let K=tS6(PK0($),"utf-8"),q=JSON.parse(K);if(q&&typeof q==="object"&&!Array.isArray(q)&&q.version===1&&q.skills&&typeof q.skills==="object"&&!Array.isArray(q.skills))return q;throw Error("Registry file has unexpected format")}catch(K){if(K.code==="ENOENT")return{version:1,skills:{}};throw K}}function s98($,K){eS6($,{recursive:!0}),sS6(PK0($),JSON.stringify(K,null,2))}function Gb($,K){let q=BD($);q.skills[K.name]=K,s98($,q)}function e98($,K){let q=BD($);if(!(K in q.skills))return;delete q.skills[K],s98($,q)}var Kb6=".registry.json";var $38=()=>{};var XV={};c6(XV,{updateSkill:()=>Hb6,removeSkill:()=>Xb6,listSkills:()=>wb6,installSkill:()=>Jb6});import{rm as I4,mkdir as qb6}from"fs/promises";import{readFileSync as NK0}from"fs";import{join as bq,resolve as TK0,relative as Yb6,isAbsolute as zb6}from"path";import{tmpdir as K38}from"os";import{randomBytes as q38}from"crypto";function Y38($,K){let q=TK0($),Y=TK0(q,K),z=Yb6(q,Y);return z.length>0&&!z.startsWith("..")&&!zb6(z)}async function Db6($){return await Bun.spawn(["test","-d",$],{stdout:"pipe",stderr:"pipe"}).exited===0}async function Jb6($,K){let q=`https://github.com/${$}.git`,Y=bq(K38(),`dsk-skill-${q38(6).toString("hex")}`);try{let z=Bun.spawn(["git","clone","--depth","1",q,Y],{stdout:"pipe",stderr:"pipe"}),D=await z.exited;if(D!==0){let j=await new Response(z.stderr).text();return await I4(Y,{recursive:!0,force:!0}).catch(()=>{}),{ok:!1,name:"",error:`git clone failed: ${j.trim()||"exit code "+D}`}}let J=bq(Y,"SKILL.md"),X;try{X=NK0(J,"utf-8")}catch{return await I4(Y,{recursive:!0,force:!0}),{ok:!1,name:"",error:"Not a valid skill: missing SKILL.md"}}let W=t98(X);if("error"in W)return await I4(Y,{recursive:!0,force:!0}),{ok:!1,name:"",error:W.error};let{name:Z}=W;if(!JV(Z)||!Y38(K,Z))return await I4(Y,{recursive:!0,force:!0}),{ok:!1,name:"",error:`Invalid skill name: '${Z}'`};let G=BD(K),O=bq(K,Z);if(G.skills[Z])return await I4(Y,{recursive:!0,force:!0}),{ok:!1,name:Z,error:`Skill '${Z}' already installed. Use /skill update ${Z}`};if(await Db6(O))return await I4(Y,{recursive:!0,force:!0}),{ok:!1,name:Z,error:`Skill '${Z}' directory already exists. Remove it first or use /skill update ${Z}`};let A=Bun.spawn(["git","rev-parse","HEAD"],{cwd:Y,stdout:"pipe"});await A.exited;let _=(await new Response(A.stdout).text()).trim();await I4(bq(Y,".git"),{recursive:!0,force:!0}),await qb6(K,{recursive:!0});let T=Bun.spawn(["mv",Y,O],{stdout:"pipe",stderr:"pipe"}),N=await T.exited;if(N!==0){let j=await new Response(T.stderr).text();return await I4(Y,{recursive:!0,force:!0}).catch(()=>{}),{ok:!1,name:Z,error:`Failed to move skill: ${j.trim()||"exit code "+N}`}}try{Gb(K,{name:Z,repo:$,installedAt:new Date().toISOString(),updatedAt:new Date().toISOString(),commitHash:_,description:W.description})}catch(j){return await I4(O,{recursive:!0,force:!0}).catch(()=>{}),{ok:!1,name:Z,error:`Installed but failed to register: ${j.message}`}}return{ok:!0,name:Z}}catch(z){return await I4(Y,{recursive:!0,force:!0}).catch(()=>{}),{ok:!1,name:"",error:z.message||String(z)}}}async function Xb6($,K){if(!JV($)||!Y38(K,$))return{ok:!1,name:$,error:`Invalid skill name: '${$}'`};if(!BD(K).skills[$])return{ok:!1,name:$,error:`Skill '${$}' not found`};let Y=bq(K,$);return e98(K,$),await I4(Y,{recursive:!0,force:!0}),{ok:!0,name:$}}async function Hb6($,K){if(!JV($)||!Y38(K,$))return{ok:!1,name:$,error:`Invalid skill name: '${$}'`};let Y=BD(K).skills[$];if(!Y)return{ok:!1,name:$,error:`Skill '${$}' not installed. Use /skill install`};let{repo:z}=Y,D=`https://github.com/${z}.git`,J=bq(K38(),`dsk-skill-${q38(6).toString("hex")}`),X=bq(K,$),W=bq(K38(),`dsk-skill-backup-${q38(6).toString("hex")}`),Z=!1;try{let G=Bun.spawn(["git","clone","--depth","1",D,J],{stdout:"pipe",stderr:"pipe"}),O=await G.exited;if(O!==0){let B=await new Response(G.stderr).text();return await I4(J,{recursive:!0,force:!0}).catch(()=>{}),{ok:!1,name:$,error:`git clone failed: ${B.trim()||"exit code "+O}`}}let A=bq(J,"SKILL.md"),_;try{_=NK0(A,"utf-8")}catch{return await I4(J,{recursive:!0,force:!0}),{ok:!1,name:$,error:"Update failed: SKILL.md missing in new version"}}let T=t98(_);if("error"in T)return await I4(J,{recursive:!0,force:!0}),{ok:!1,name:$,error:T.error};if(T.name!==$)return await I4(J,{recursive:!0,force:!0}),{ok:!1,name:$,error:`Skill name mismatch: expected '${$}', got '${T.name}'`};let N=Bun.spawn(["git","rev-parse","HEAD"],{cwd:J,stdout:"pipe"});await N.exited;let j=(await new Response(N.stdout).text()).trim();await I4(bq(J,".git"),{recursive:!0,force:!0});let R=Bun.spawn(["mv",X,W],{stdout:"pipe",stderr:"pipe"}),E=await R.exited;if(E!==0){let B=await new Response(R.stderr).text();return await I4(J,{recursive:!0,force:!0}).catch(()=>{}),{ok:!1,name:$,error:`Failed to backup existing skill: ${B.trim()||"exit code "+E}`}}if(Z=!0,await Bun.spawn(["mv",J,X],{stdout:"pipe",stderr:"pipe"}).exited!==0){let U=await Bun.spawn(["mv",W,X],{stdout:"pipe",stderr:"pipe"}).exited;return await I4(J,{recursive:!0,force:!0}).catch(()=>{}),{ok:!1,name:$,error:`Failed to move updated skill into place${U===0?" (original restored)":" (WARNING: restore also failed)"}`}}try{Gb(K,{name:$,repo:z,installedAt:Y.installedAt,updatedAt:new Date().toISOString(),commitHash:j,description:T.description})}catch(B){return await I4(X,{recursive:!0,force:!0}).catch(()=>{}),await Bun.spawn(["mv",W,X],{stdout:"pipe",stderr:"pipe"}).exited,{ok:!1,name:$,error:`Update moved but registry failed: ${B.message}`}}return await I4(W,{recursive:!0,force:!0}).catch(()=>{}),{ok:!0,name:$}}catch(G){if(await I4(J,{recursive:!0,force:!0}).catch(()=>{}),Z)await Bun.spawn(["mv",W,X],{stdout:"pipe",stderr:"pipe"}).exited.catch(()=>{});return{ok:!1,name:$,error:G.message||String(G)}}}async function wb6($){let K=BD($);return Object.values(K.skills)}var HV=F(()=>{$38()});import{readFileSync as Wb6,writeFileSync as Zb6,mkdirSync as Gb6,renameSync as Mb6}from"fs";import{join as Mb}from"path";import{homedir as Ob6}from"os";import{randomBytes as Ab6}from"crypto";function TK(){return process.env.DEEPSEEK_PLUGINS_DIR||Mb(Ob6(),".deepseek-code","plugins")}function vq($){let K=Mb($??TK(),"registry.json");try{let q=Wb6(K,"utf-8"),Y=JSON.parse(q);if(Y&&typeof Y==="object"&&!Array.isArray(Y)&&Y.version===1&&Y.plugins&&typeof Y.plugins==="object"&&!Array.isArray(Y.plugins))return Y;throw Error("Plugin registry has unexpected format")}catch(q){if(q.code==="ENOENT")return{version:1,plugins:{}};throw q}}function z38($,K){let q=K??TK();Gb6(q,{recursive:!0});let Y=Mb(q,`.registry-${Ab6(6).toString("hex")}.json`);Zb6(Y,JSON.stringify($,null,2)),Mb6(Y,Mb(q,"registry.json"))}function Ob($,K){let q=vq(K);q.plugins[$.name]=$,z38(q,K)}function D38($,K){let q=vq(K);if(!($ in q.plugins))return;delete q.plugins[$],z38(q,K)}function Pb6($,K){return vq(K).plugins[$]}var Ab=()=>{};function _b6($,K){return $.replaceAll("${PLUGIN_ROOT}",K)}import{readdirSync as J38,readFileSync as Tb6,existsSync as LM}from"fs";import{join as w5}from"path";function X38($,K){let q=[],Y=[],z=[],D=!1;function J(O,A){if(!O)return w5($,A);let _=Array.isArray(O)?O[0]:O;if(_&&!_.includes("/"))return w5($,_);return w5($,_??A)}let X=K?.commands?J(K.commands,"commands"):w5($,"commands");if(LM(X)){for(let O of J38(X))if(O.endsWith(".md"))q.push(O.replace(/\.md$/,""))}let W=K?.agents?J(K.agents,"agents"):w5($,"agents");if(LM(W)){for(let O of J38(W))if(O.endsWith(".md"))Y.push(O.replace(/\.md$/,""))}let Z=K?.skills?J(K.skills,"skills"):w5($,"skills");if(LM(Z)){for(let O of J38(Z,{withFileTypes:!0}))if(O.isDirectory()&&LM(w5(Z,O.name,"SKILL.md")))z.push(O.name)}let G=K?.hooks?w5($,K.hooks):w5($,"hooks","hooks.json");if(LM(G))D=!0;return{commands:q,agents:Y,skills:z,hasHooks:D}}function Pb($){let K=[w5($,"plugin.json"),w5($,".claude-plugin","plugin.json")];for(let q of K)try{let Y=Tb6(q,"utf-8"),z=JSON.parse(Y);if(!z||typeof z.name!=="string")continue;return z}catch{continue}return null}function LK0($){let K=vq($),q=$??TK(),Y=[];for(let z of Object.values(K.plugins)){let D=w5(q,z.name);if(!LM(D)){console.warn(`[plugins] skipping '${z.name}': directory not found at ${D}`);continue}let J=Pb(D);if(!J){console.warn(`[plugins] skipping '${z.name}': could not read plugin.json in ${D}`);continue}Y.push({entry:z,path:D,manifest:J})}return Y}var H38=F(()=>{Ab()});import{rm as u1,mkdir as Nb6}from"fs/promises";import{existsSync as wV,readdirSync as Lb6}from"fs";import{join as H3,resolve as VK0,relative as Vb6,isAbsolute as jb6}from"path";import{tmpdir as w38}from"os";import{randomBytes as W38}from"crypto";function Z38($){let K=VK0(TK()),q=VK0(K,$),Y=Vb6(K,q);return Y.length>0&&!Y.startsWith("..")&&!jb6(Y)}function G38($){return cL.test($)}function Rb6($){return wV($)}function RK0($){if(wV(H3($,"plugin.json")))return $;let K=H3($,"plugins");if(wV(K))try{for(let q of Lb6(K,{withFileTypes:!0})){if(!q.isDirectory())continue;let Y=H3(K,q.name);if(wV(H3(Y,"plugin.json")))return Y;if(wV(H3(Y,".claude-plugin","plugin.json")))return Y}}catch{}return null}async function FK0($,K){let q=Bun.spawn(["git","clone","--depth","1",$,K],{env:process.env,stdout:"pipe",stderr:"pipe"}),Y=!1,z=setTimeout(()=>{Y=!0,q.kill()},jK0),D=await q.exited;clearTimeout(z);let J=Y?`timed out after ${jK0/1000}s`:(await new Response(q.stderr).text()).trim();return{exitCode:Y?-1:D,stderr:J}}async function EK0($){let K=Bun.spawn(["git","rev-parse","HEAD"],{cwd:$,env:process.env,stdout:"pipe",stderr:"pipe"});if(await K.exited!==0)return null;return(await new Response(K.stdout).text()).trim()||null}async function VM($,K){return Bun.spawn(["mv",$,K],{env:process.env,stdout:"pipe",stderr:"pipe"}).exited}async function fK0($){if(!iS.test($))return{ok:!1,name:"",error:`Invalid repo format: "${$}". Expected: owner/repo`};let K=`https://github.com/${$}.git`,q=H3(w38(),`dsk-plugin-${W38(6).toString("hex")}`);try{let{exitCode:Y,stderr:z}=await FK0(K,q);if(Y!==0)return await u1(q,{recursive:!0,force:!0}).catch(()=>{}),{ok:!1,name:"",error:`git clone failed: ${z||"exit code "+Y}`};let D=RK0(q);if(!D)return await u1(q,{recursive:!0,force:!0}),{ok:!1,name:"",error:"Not a valid plugin: no plugin.json found"};let J=Pb(D);if(!J)return await u1(q,{recursive:!0,force:!0}),{ok:!1,name:"",error:'Invalid plugin.json: missing or invalid "name" field'};let{name:X}=J;if(!G38(X)||!Z38(X))return await u1(q,{recursive:!0,force:!0}),{ok:!1,name:"",error:`Invalid plugin name: '${X}'. Must be kebab-case.`};let W=vq(),Z=H3(TK(),X);if(W.plugins[X])return await u1(q,{recursive:!0,force:!0}),{ok:!1,name:X,error:`Plugin '${X}' already installed. Use /plugin update ${X}`};if(Rb6(Z))return await u1(q,{recursive:!0,force:!0}),{ok:!1,name:X,error:`Plugin '${X}' directory already exists. Remove it first.`};let G=await EK0(q);if(!G)return await u1(q,{recursive:!0,force:!0}).catch(()=>{}),{ok:!1,name:X,error:"Failed to read commit hash from cloned repo"};if(await u1(H3(q,".git"),{recursive:!0,force:!0}),await Nb6(TK(),{recursive:!0}),await VM(D,Z)!==0)return await u1(q,{recursive:!0,force:!0}).catch(()=>{}),{ok:!1,name:X,error:"Failed to move plugin into place"};if(D!==q)await u1(q,{recursive:!0,force:!0}).catch(()=>{});let A;try{A=X38(Z,J)}catch(T){return await u1(Z,{recursive:!0,force:!0}).catch(()=>{}),{ok:!1,name:X,error:`Failed to discover components: ${T.message}`}}let _={name:X,repo:$,version:J.version||"0.0.0",installedAt:new Date().toISOString(),updatedAt:new Date().toISOString(),commitHash:G,description:J.description||"",components:A};try{Ob(_)}catch(T){return await u1(Z,{recursive:!0,force:!0}).catch(()=>{}),{ok:!1,name:X,error:`Installed but failed to register: ${T.message}`}}return{ok:!0,name:X}}catch(Y){return await u1(q,{recursive:!0,force:!0}).catch(()=>{}),{ok:!1,name:"",error:Y.message||String(Y)}}}async function BK0($){if(!G38($)||!Z38($))return{ok:!1,name:$,error:`Invalid plugin name: '${$}'`};if(!vq().plugins[$])return{ok:!1,name:$,error:`Plugin '${$}' not found`};let q=H3(TK(),$);try{await u1(q,{recursive:!0,force:!0})}catch(Y){return{ok:!1,name:$,error:`Failed to remove plugin directory: ${Y.message}`}}return D38($),{ok:!0,name:$}}async function kK0($){if(!G38($)||!Z38($))return{ok:!1,name:$,error:`Invalid plugin name: '${$}'`};let q=vq().plugins[$];if(!q)return{ok:!1,name:$,error:`Plugin '${$}' not installed. Use /plugin install`};let{repo:Y}=q,z=`https://github.com/${Y}.git`,D=H3(w38(),`dsk-plugin-${W38(6).toString("hex")}`),J=H3(TK(),$),X=H3(w38(),`dsk-plugin-backup-${W38(6).toString("hex")}`),W=!1;try{let{exitCode:Z,stderr:G}=await FK0(z,D);if(Z!==0)return await u1(D,{recursive:!0,force:!0}).catch(()=>{}),{ok:!1,name:$,error:`git clone failed: ${G||"exit code "+Z}`};let O=RK0(D);if(!O)return await u1(D,{recursive:!0,force:!0}),{ok:!1,name:$,error:"Update failed: no plugin.json in new version"};let A=Pb(O);if(!A)return await u1(D,{recursive:!0,force:!0}),{ok:!1,name:$,error:"Update failed: invalid plugin.json in new version"};if(A.name!==$)return await u1(D,{recursive:!0,force:!0}),{ok:!1,name:$,error:`Plugin name mismatch: expected '${$}', got '${A.name}'`};let _=await EK0(D);if(!_)return await u1(D,{recursive:!0,force:!0}).catch(()=>{}),{ok:!1,name:$,error:"Failed to read commit hash from cloned repo"};if(await u1(H3(D,".git"),{recursive:!0,force:!0}),await VM(J,X)!==0)return await u1(D,{recursive:!0,force:!0}).catch(()=>{}),{ok:!1,name:$,error:"Failed to backup existing plugin"};if(W=!0,await VM(O,J)!==0){let R=await VM(X,J);await u1(D,{recursive:!0,force:!0}).catch(()=>{});let E=R===0?" (original restored)":" (restore also failed \u2014 backup at "+X+")";return{ok:!1,name:$,error:`Failed to move updated plugin into place${E}`}}if(O!==D)await u1(D,{recursive:!0,force:!0}).catch(()=>{});let j=X38(J,A);try{Ob({name:$,repo:Y,version:A.version||"0.0.0",installedAt:q.installedAt,updatedAt:new Date().toISOString(),commitHash:_,description:A.description||"",components:j})}catch(R){await u1(J,{recursive:!0,force:!0}).catch(()=>{});let k=await VM(X,J)===0?" (original restored)":" (restore failed \u2014 backup at "+X+")";return{ok:!1,name:$,error:`Update moved but registry failed: ${R.message}${k}`}}return await u1(X,{recursive:!0,force:!0}).catch(()=>{}),{ok:!0,name:$}}catch(Z){if(await u1(D,{recursive:!0,force:!0}).catch(()=>{}),W){let O=await VM(X,J)===0?" (original restored)":" (restore failed \u2014 backup at "+X+")";return{ok:!1,name:$,error:(Z.message||String(Z))+O}}return{ok:!1,name:$,error:Z.message||String(Z)}}}var jK0=60000;var UK0=F(()=>{Ab();H38();k$8()});var WV={};c6(WV,{writePluginRegistry:()=>z38,updatePlugin:()=>kK0,resolvePluginVariables:()=>_b6,removePluginFromRegistry:()=>D38,removePlugin:()=>BK0,readPluginRegistry:()=>vq,loadInstalledPlugins:()=>LK0,installPlugin:()=>fK0,getPluginsDir:()=>TK,getPluginEntry:()=>Pb6,addPluginToRegistry:()=>Ob});var ZV=F(()=>{H38();UK0();Ab()});function kb6(){return S6.jsxDEV(r,{flexDirection:"column",children:[S6.jsxDEV(x,{color:"cyan",children:" \u2584\u2584\u2588\u2588\u2588\u2584\u2584"},void 0,!1,void 0,this),S6.jsxDEV(x,{color:"cyan",children:" \u2584\u2588 \u25C9 \u2588\u2588\u2584"},void 0,!1,void 0,this),S6.jsxDEV(x,{color:"cyan",children:"\u2588 ~~\u2588"},void 0,!1,void 0,this),S6.jsxDEV(x,{color:"cyan",children:" \u2580\u2584\u2584\u2588\u2584\u2584\u2584\u2584\u2588\u2580"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Ub6(){if((process.stdout.columns??80)<100)return S6.jsxDEV(r,{flexDirection:"column",marginBottom:1,marginTop:1,children:S6.jsxDEV(r,{flexDirection:"row",gap:2,children:[S6.jsxDEV(kb6,{},void 0,!1,void 0,this),S6.jsxDEV(r,{flexDirection:"column",children:[S6.jsxDEV(r,{flexDirection:"row",gap:1,children:[S6.jsxDEV(x,{color:"cyan",children:"\u25C6 DeepSeek Code"},void 0,!1,void 0,this),S6.jsxDEV(x,{color:"#888888",children:"v"+$$.version},void 0,!1,void 0,this)]},void 0,!0,void 0,this),S6.jsxDEV(x,{color:"#5599ff",children:"Deep reasoning,"},void 0,!1,void 0,this),S6.jsxDEV(x,{color:"#888888",children:"Elite code."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this);return S6.jsxDEV(r,{flexDirection:"column",children:[S6.jsxDEV(r,{flexDirection:"row",gap:1,children:[S6.jsxDEV(x,{color:"cyan",children:"Welcome to DeepSeek Code"},void 0,!1,void 0,this),S6.jsxDEV(x,{color:"#888888",children:"v"+$$.version},void 0,!1,void 0,this)]},void 0,!0,void 0,this),S6.jsxDEV(r,{marginTop:1,flexDirection:"column",children:[S6.jsxDEV(x,{color:"#888888",children:" * . * . * .* . "},void 0,!1,void 0,this),S6.jsxDEV(x,{color:"#888888",children:" . * . * . *"},void 0,!1,void 0,this),S6.jsxDEV(x,{color:"#888888",children:" . * . * . * . "},void 0,!1,void 0,this),S6.jsxDEV(x,{color:"#888888",children:" . * . * . "},void 0,!1,void 0,this),S6.jsxDEV(x,{color:"#888888",children:" * . * . * . "},void 0,!1,void 0,this),S6.jsxDEV(r,{flexDirection:"row",children:[S6.jsxDEV(x,{color:"cyan",children:" \u2584\u2584\u2588\u2588\u2588\u2584\u2584"},void 0,!1,void 0,this),S6.jsxDEV(x,{color:"#888888",children:" . * . * . * . * . "},void 0,!1,void 0,this)]},void 0,!0,void 0,this),S6.jsxDEV(r,{flexDirection:"row",children:[S6.jsxDEV(x,{color:"cyan",children:" \u2584\u2588 \u25C9 \u2588\u2588\u2584"},void 0,!1,void 0,this),S6.jsxDEV(x,{color:"#888888",children:" * . * . * . * . "},void 0,!1,void 0,this)]},void 0,!0,void 0,this),S6.jsxDEV(r,{flexDirection:"row",children:[S6.jsxDEV(x,{color:"cyan",children:" \u2588 ~~\u2588"},void 0,!1,void 0,this),S6.jsxDEV(x,{color:"#888888",children:" * . * . * . * . "},void 0,!1,void 0,this)]},void 0,!0,void 0,this),S6.jsxDEV(x,{color:"#888888",children:"~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~"},void 0,!1,void 0,this),S6.jsxDEV(x,{color:"#888888",children:"~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ "},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function vK0({children:$}){let[K,q]=_b.useState(!1);return _b.useEffect(()=>{let Y=setTimeout(()=>q(!0),50);return()=>clearTimeout(Y)},[]),S6.jsxDEV(r,{flexDirection:"column",children:[S6.jsxDEV(Ub6,{},void 0,!1,void 0,this),K&&$]},void 0,!0,void 0,this)}var _b,S6;var hK0=F(()=>{sG();C6();p6();_b=n(G6(),1),S6=n(Y0(),1)});import{execSync as Qb6}from"child_process";import{homedir as Cb6}from"os";import{join as Ib6}from"path";import{mkdir as Sb6}from"fs/promises";async function bb6($){let K=Ib6(Cb6(),".deepseek");await Sb6(K,{recursive:!0});let q=await wM().catch(()=>({}));await WM({...q,...$})}async function Tb(){try{let[$,K]=await Promise.all([wM(),E$()]),q=K.provider?.name??$.PROVIDER??"deepseek",Y={provider:q};if(q==="deepseek"&&$.DEEPSEEK_API_KEY)Y.apiKey=$.DEEPSEEK_API_KEY,Y.baseURL=K.provider?.endpoint??$.DEEPSEEK_BASE_URL;if(q==="bedrock")Y.awsRegion=K.provider?.region??$.AWS_REGION,Y.awsProfile=K.provider?.profile??$.AWS_PROFILE;if(q==="vertex")Y.gcpProject=K.provider?.projectId??$.GCP_PROJECT,Y.gcpLocation=K.provider?.location??$.GCP_LOCATION,Y.gcpCredentials=$.GCP_CREDENTIALS;if(q==="local")Y.localBaseUrl=K.provider?.endpoint??$.LOCAL_BASE_URL,Y.localModel=$.LOCAL_MODEL;return{providerConfig:q==="deepseek"&&!!Y.apiKey||q==="bedrock"&&!!Y.awsRegion||q==="vertex"&&!!Y.gcpProject&&!!Y.gcpCredentials||q==="local"&&!!Y.localBaseUrl?Y:null,theme:K.interface?.theme??$.THEME??"dark",language:K.interface?.language??$.LANGUAGE??null,enchant:K.promptRefiner?.enabled??$.ENCHANT!=="false"}}catch{return{providerConfig:null,theme:"dark",language:null,enchant:!0}}}function yK0({onDone:$}){let[K,q]=NK.useState("theme"),[Y,z]=NK.useState(0),[D,J]=NK.useState(0),[X,W]=NK.useState(0),[Z,G]=NK.useState({}),[O,A]=NK.useState(""),[_,T]=NK.useState(""),[N,j]=NK.useState(null),R=RM[Y].value,E=jM[D].value,k=vb6[E],v=k[X];if(NK.useEffect(()=>{if(N){let U=setTimeout(()=>$(N.theme,N.config),50);return()=>clearTimeout(U)}},[N,$]),W1((U,I)=>{if(I.ctrl&&U==="c")process.exit(0);if(K==="theme"){if(I.upArrow){z((h)=>(h-1+RM.length)%RM.length);return}if(I.downArrow){z((h)=>(h+1)%RM.length);return}if(I.return){q("provider");return}if(I.escape)process.exit(0);return}if(K==="provider"){if(I.upArrow){J((h)=>(h-1+jM.length)%jM.length);return}if(I.downArrow){J((h)=>(h+1)%jM.length);return}if(I.return){W(0),A(""),q("fields");return}if(I.escape){q("theme");return}return}if(K==="fields"){if(I.return){let h=O.trim();if(!h&&!v.optional){T(`${v.label} cannot be empty.`);return}let S={...Z,[v.key]:h};if(G(S),T(""),X<k.length-1)W((d)=>d+1),A("");else Promise.all([bb6(Object.fromEntries(Object.entries(S).filter(([d])=>d==="DEEPSEEK_API_KEY"||d==="GCP_CREDENTIALS"))),E78({provider:{name:E,endpoint:S.DEEPSEEK_BASE_URL||S.LOCAL_BASE_URL||void 0,region:S.AWS_REGION||void 0,profile:S.AWS_PROFILE||void 0,projectId:S.GCP_PROJECT||void 0,location:S.GCP_LOCATION||void 0},interface:{theme:R}})]).then(()=>{for(let[y,C]of Object.entries(S))if(C)process.env[y]=C;let d={provider:E,apiKey:S.DEEPSEEK_API_KEY,baseURL:S.DEEPSEEK_BASE_URL||void 0,awsRegion:S.AWS_REGION,awsProfile:S.AWS_PROFILE,gcpProject:S.GCP_PROJECT,gcpLocation:S.GCP_LOCATION,gcpCredentials:S.GCP_CREDENTIALS,localBaseUrl:S.LOCAL_BASE_URL,localModel:S.LOCAL_MODEL};q("done"),j({theme:R,config:d})}).catch((d)=>T(`Failed to save: ${d.message}`));return}if(I.backspace){A((h)=>h.slice(0,-1)),T("");return}if(I.escape){if(X>0)W((h)=>h-1),A(Z[k[X-1].key]??""),T("");else q("provider"),A(""),T("");return}if(I.ctrl&&I.shift&&U==="v"){try{let h=Qb6("xclip -selection clipboard -o 2>/dev/null || xsel --clipboard --output 2>/dev/null || wl-paste 2>/dev/null",{encoding:"utf-8",timeout:2000}).trim();if(h)A((S)=>S+h),T("")}catch{}return}if(!I.ctrl&&!I.meta&&U&&U.length>=1)A((h)=>h+U),T("")}}),K==="done")return u6.jsxDEV(r,{marginTop:1,children:u6.jsxDEV(x,{color:"green",children:"\u2713 Saved! Starting DeepSeek Code\u2026"},void 0,!1,void 0,this)},void 0,!1,void 0,this);let B=null;if(K==="theme"){let U=I6(R);B=u6.jsxDEV(r,{flexDirection:"column",marginTop:1,children:[u6.jsxDEV(x,{children:"Choose the text style that looks best with your terminal:"},void 0,!1,void 0,this),u6.jsxDEV(r,{flexDirection:"row",marginTop:1,gap:3,children:[u6.jsxDEV(r,{flexDirection:"column",children:RM.map((I,h)=>u6.jsxDEV(r,{children:u6.jsxDEV(x,{color:h===Y?"cyan":void 0,children:[h===Y?"\u276F ":" ",I.label]},void 0,!0,void 0,this)},I.value,!1,void 0,this))},void 0,!1,void 0,this),u6.jsxDEV(r,{flexDirection:"column",children:Array.from({length:RM.length}).map((I,h)=>u6.jsxDEV(x,{color:"#444444",children:"\u2502"},h,!1,void 0,this))},void 0,!1,void 0,this),u6.jsxDEV(r,{flexDirection:"column",children:[u6.jsxDEV(x,{color:"#888888",italic:!0,children:"Preview \u2014 demo.js"},void 0,!1,void 0,this),u6.jsxDEV(x,{color:U.textDim,children:" function greet() {"},void 0,!1,void 0,this),u6.jsxDEV(x,{backgroundColor:U.diffRemoved,color:U.diffRemovedWord,children:'- console.log("Hello, World!");'},void 0,!1,void 0,this),u6.jsxDEV(x,{backgroundColor:U.diffAdded,color:U.diffAddedWord,children:'+ console.log("Hello, DeepSeek!");'},void 0,!1,void 0,this),u6.jsxDEV(x,{color:U.textDim,children:" }"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),u6.jsxDEV(x,{color:"#888888",children:"\u2191\u2193 navigate \xB7 Enter select \xB7 Esc exit"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}else if(K==="provider")B=u6.jsxDEV(r,{flexDirection:"column",marginTop:1,children:[u6.jsxDEV(x,{children:"Choose your AI provider:"},void 0,!1,void 0,this),u6.jsxDEV(r,{flexDirection:"column",marginTop:1,children:jM.map((U,I)=>u6.jsxDEV(r,{flexDirection:"row",gap:2,children:[u6.jsxDEV(x,{color:I===D?"cyan":void 0,children:[I===D?"\u276F ":" ",U.label]},void 0,!0,void 0,this),u6.jsxDEV(x,{color:"#888888",children:U.hint},void 0,!1,void 0,this)]},U.value,!0,void 0,this))},void 0,!1,void 0,this),u6.jsxDEV(x,{color:"#888888",children:"\u2191\u2193 navigate \xB7 Enter select \xB7 Esc back"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);else if(K==="fields"){let U=`(${X+1}/${k.length})`;B=u6.jsxDEV(r,{flexDirection:"column",marginTop:1,children:[u6.jsxDEV(x,{children:jM[D].label+" setup "+U},void 0,!1,void 0,this),u6.jsxDEV(x,{children:v.label},void 0,!1,void 0,this),v.hint?u6.jsxDEV(x,{color:"#888888",children:v.hint},void 0,!1,void 0,this):null,u6.jsxDEV(r,{marginTop:1,children:[u6.jsxDEV(x,{color:"cyan",children:"> "},void 0,!1,void 0,this),u6.jsxDEV(x,{children:v.secret?"\u2022".repeat(O.length)||"\u2026":O||"\u2026"},void 0,!1,void 0,this),u6.jsxDEV(x,{color:"cyan",children:"\u2588"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),_?u6.jsxDEV(x,{color:"red",children:_},void 0,!1,void 0,this):u6.jsxDEV(x,{color:"#888888",children:"Enter to confirm \xB7 Esc back"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}return u6.jsxDEV(r,{flexDirection:"column",paddingLeft:2,paddingRight:2,paddingTop:1,paddingBottom:1,children:u6.jsxDEV(vK0,{children:B},void 0,!1,void 0,this)},void 0,!1,void 0,this)}var NK,u6,jM,RM,vb6;var O38=F(()=>{g$();ZM();jS();hK0();X7();C6();p6();NK=n(G6(),1),u6=n(Y0(),1),jM=[{value:"deepseek",label:"DeepSeek API",hint:"platform.deepseek.com/api_keys"},{value:"bedrock",label:"Amazon Bedrock",hint:"AWS profile from ~/.aws/credentials"},{value:"vertex",label:"Google Vertex AI",hint:"GCP project + service account JSON"},{value:"local",label:"Local model (Ollama / LM Studio)",hint:"Any OpenAI-compatible endpoint"}],RM=[{label:"Dark mode",value:"dark"},{label:"Light mode",value:"light"},{label:"Dark mode (colorblind-friendly)",value:"dark-daltonized"},{label:"Light mode (colorblind-friendly)",value:"light-daltonized"},{label:"Dark mode (ANSI colors only)",value:"dark-ansi"},{label:"Light mode (ANSI colors only)",value:"light-ansi"}];vb6={deepseek:[{key:"DEEPSEEK_API_KEY",label:"DeepSeek API Key",hint:"platform.deepseek.com/api_keys",secret:!0},{key:"DEEPSEEK_BASE_URL",label:"Base URL (optional)",hint:"Leave empty to use api.deepseek.com",optional:!0}],bedrock:[{key:"AWS_REGION",label:"AWS Region",hint:"e.g. us-east-1"},{key:"AWS_PROFILE",label:"AWS Profile Name",hint:"from ~/.aws/credentials (default: default)"}],vertex:[{key:"GCP_PROJECT",label:"GCP Project ID",hint:"your-project-id"},{key:"GCP_LOCATION",label:"GCP Location",hint:"e.g. us-central1"},{key:"GCP_CREDENTIALS",label:"Service Account JSON path",hint:"/path/to/sa.json"}],local:[{key:"LOCAL_BASE_URL",label:"Base URL",hint:"e.g. http://localhost:11434/v1"},{key:"LOCAL_MODEL",label:"Model name",hint:"e.g. deepseek-r1:8b, llama3, mistral"}]}});var pK0={};c6(pK0,{parsePipeArgs:()=>mK0,default:()=>cK0});function mK0($=process.argv.slice(2)){return{json:$.includes("--json"),promptArgs:$.filter((K)=>K!=="--pipe"&&K!=="--json")}}async function xb6(){let $=[];for await(let K of process.stdin)$.push(K);return Buffer.concat($).toString("utf-8").trim()}async function Lb($,K){if($.write(K))return;await new Promise((q)=>$.once("drain",q))}async function cK0(){let $=mK0();zj8(async()=>!1),await iL();let{providerConfig:K,language:q,enchant:Y}=await Tb();if(!K){if(!process.env.DEEPSEEK_API_KEY){if($.json)await Lb(process.stdout,JSON.stringify({ok:!1,error:"DEEPSEEK_API_KEY not set and no saved config found"})+`
1295
1295
  `);else await Lb(process.stderr,`Error: DEEPSEEK_API_KEY not set and no saved config found
1296
1296
  `);process.exitCode=1;return}}let z=$.promptArgs.join(" "),D=await xb6(),J;if(z&&D)J=`${z}
1297
1297
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hermenics/deepseek-code",
3
- "version": "0.4.13",
3
+ "version": "0.4.14",
4
4
  "description": "An AI-powered coding assistant that lives in your terminal",
5
5
  "keywords": [
6
6
  "ai",
@@ -39,7 +39,9 @@
39
39
  "dev": "NODE_ENV=development bun --watch src/index.tsx",
40
40
  "build": "bun run build.ts",
41
41
  "typecheck": "bunx tsc --noEmit",
42
- "test": "bun test"
42
+ "test": "bun test",
43
+ "test:ink": "bun test tests/ink",
44
+ "test:plugins": "bun test tests/plugins"
43
45
  },
44
46
  "dependencies": {
45
47
  "@alcalzone/ansi-tokenize": "^0.3.0",