@hermenics/deepseek-code 0.10.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -1
- package/dist/browser-egress-worker.mjs +25 -0
- package/dist/cli.mjs +1462 -638
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
- **Full TUI** — alternate-screen interface with streamed thinking, rich markdown, and vim mode
|
|
33
33
|
- **Session command center** — press Left on an empty prompt to search, switch, rename or delete saved sessions across projects
|
|
34
34
|
- **Unified agents** — scoped primary agents and sub-agents with editable base prompts
|
|
35
|
+
- **DeepSeek Pods** — persistent agents that keep scheduled and queued work running under a host supervisor
|
|
35
36
|
- **Settings center** — fullscreen, searchable User/Project/Local configuration with visible origins
|
|
36
37
|
- **MCP support** — connect to any Model Context Protocol server for extended tooling
|
|
37
38
|
- **Project guidance** — loads a root `AGENTS.md` alongside `DEEPSEEK.md`
|
|
@@ -54,6 +55,18 @@ echo "explain this project" | deepseek --pipe
|
|
|
54
55
|
cat src/index.tsx | deepseek --pipe --json "summarize"
|
|
55
56
|
```
|
|
56
57
|
|
|
58
|
+
### DeepSeek Pods on your own server
|
|
59
|
+
|
|
60
|
+
Pods can keep running after your desktop disconnects by installing the supervisor on a Linux server you control. Create a Debian 12+ or Ubuntu 24.04+ VM with your cloud provider, make sure SSH access works, then run:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
deepseek pods host install ubuntu@YOUR_SERVER_IP
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
The installer uses your SSH connection, prepares Node.js, Bun and Chromium when needed, installs the published DeepSeek Code package, and starts a user-level service. It sends the active DeepSeek API profile through SSH and stores it in a private configuration directory on that host. The panel listens only on loopback; the installer prints an SSH tunnel command and the panel token. It does not create a cloud VM, open a public firewall port, or copy your existing local Pods database.
|
|
67
|
+
|
|
68
|
+
The host account must have passwordless `sudo` for one-time OS package installation and enabling the persistent user service. Your cloud provider may require billing details for a free-tier account, and its free quota and availability rules still apply. See [the Pods deployment guide](docs/persistent-agents.md#install-on-a-server-you-control).
|
|
69
|
+
|
|
57
70
|
### Requirements
|
|
58
71
|
|
|
59
72
|
- [Bun](https://bun.sh) 1.1+
|
|
@@ -113,7 +126,7 @@ Skills are listed by origin and loaded on demand through the read-only `skill` t
|
|
|
113
126
|
|
|
114
127
|
### Experimental browser
|
|
115
128
|
|
|
116
|
-
The agent browser is off by default. Enable it with `/features browser on`; this exposes both `browser` and `dev_server` in Build and Auto modes. The browser runs an installed Chrome, Chromium, Edge or Brave over a debugging pipe, with a temporary profile and a clean environment. It uses accessibility snapshots and native browser input for navigation, inspection, interaction, screenshots, downloads and test export.
|
|
129
|
+
The agent browser is off by default. Enable it with `/features browser on`; this exposes both `browser` and `dev_server` in Build and Auto modes. The browser runs an installed Chrome, Chromium, Edge or Brave over a debugging pipe, with a temporary profile and a clean environment. It uses accessibility snapshots and native browser input for navigation, inspection, interaction, screenshots, downloads and test export. Browser automation currently supports Linux and macOS; Windows needs a handle-based DevTools pipe implementation.
|
|
117
130
|
|
|
118
131
|
Each new origin needs approval. Public-page interaction has a separate approval, and typing or uploading on a public page asks every time. Private-network and metadata addresses are blocked, as are sensitive password, payment and one-time-code fields. Downloads stay in a private temporary directory and are removed when the browser closes. Use `/browser status`, `/browser show`, `/browser hide` or `/browser close` to inspect and control its window; on Linux, a visible window needs `DISPLAY` or `WAYLAND_DISPLAY`.
|
|
119
132
|
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import{createSecureContext as ww}from"node:tls";import{createServer as E,request as d}from"node:http";import{request as c}from"node:https";import{TLSSocket as l}from"node:tls";import{connect as a,createServer as o,isIP as b}from"node:net";import{randomBytes as B,timingSafeEqual as T}from"node:crypto";import{mkdtempSync as t,rmSync as r}from"node:fs";import{tmpdir as s}from"node:os";import{join as D}from"node:path";import{lookup as k}from"dns/promises";import{isIP as H}from"node:net";import{BlockList as g,isIP as m}from"node:net";var q=20000,Qw=q*4;var i=[["0.0.0.0",8],["10.0.0.0",8],["100.64.0.0",10],["127.0.0.0",8],["169.254.0.0",16],["172.16.0.0",12],["192.0.0.0",24],["192.0.2.0",24],["192.31.196.0",24],["192.52.193.0",24],["192.88.99.0",24],["192.168.0.0",16],["192.175.48.0",24],["198.18.0.0",15],["198.51.100.0",24],["203.0.113.0",24],["224.0.0.0",4],["240.0.0.0",4]],h=[["::",96],["::1",128],["::ffff:0:0",96],["64:ff9b::",96],["64:ff9b:1::",48],["100::",64],["2001::",23],["2001:db8::",32],["2002::",16],["3fff::",20],["fc00::",7],["fe80::",10],["ff00::",8]];function M(z,w){let Q=new g;for(let[$,J]of z)Q.addSubnet($,J,w);return Q}var p=M(i,"ipv4"),n=M(h,"ipv6");function j(z){let w=m(z);if(w===4)return p.check(z,"ipv4");if(w===6&&/^::ffff:[0-9a-f]{1,4}:[0-9a-f]{1,4}$/i.test(z))return!0;if(w===6)return n.check(z,"ipv6");return!0}var u=2000,I=2048,Y=async(z)=>{let w;try{return(await Promise.race([k(z,{all:!0}),new Promise(($,J)=>{w=setTimeout(()=>J(Error("DNS timeout")),u)})])).map(($)=>$.address)}finally{clearTimeout(w)}};function R(z){return z.replace(/^\[|\]$/g,"").replace(/\.$/,"").toLowerCase()}function A(z){let w=R(z);if(w==="localhost"||w.endsWith(".localhost"))return!0;if(H(w)===4)return w.startsWith("127.");return w==="::1"}async function f(z,w=Y){if(z==="about:blank")return{kind:"loopback",origin:"about:blank"};if(z.length>I)return{kind:"blocked",reason:`URL longer than ${I} characters`};let Q;try{Q=new URL(z)}catch{return{kind:"blocked",reason:"not a valid URL"}}if(Q.protocol!=="http:"&&Q.protocol!=="https:")return{kind:"blocked",reason:`${Q.protocol} URLs are not allowed; use http or https`};if(Q.username||Q.password)return{kind:"blocked",reason:"URLs with embedded credentials are not allowed"};let $=Q.origin,J=R(Q.hostname);if(A(J))return{kind:"loopback",origin:$};if(J==="metadata.google.internal")return{kind:"blocked",origin:$,reason:"cloud metadata endpoints are blocked"};if(H(J))return j(J)?{kind:"blocked",origin:$,reason:`${J} is not a public address`}:{kind:"public",origin:$};let G;try{G=await w(J)}catch{return{kind:"blocked",origin:$,reason:`could not resolve ${J}`}}if(G.length===0)return{kind:"blocked",origin:$,reason:`could not resolve ${J}`};let Z=G.find((K)=>j(K));return Z?{kind:"blocked",origin:$,reason:`${J} resolves to non-public address ${Z}`}:{kind:"public",origin:$}}var e=["connection","proxy-connection","proxy-authorization","proxy-authenticate","keep-alive","te","trailer","transfer-encoding","upgrade"];function O(z){let w={...z},Q=String(z.connection??"").split(",").map(($)=>$.trim().toLowerCase());for(let $ of[...e,...Q])delete w[$];return w}function L(z){return z.replace(/^\[|\]$/g,"").replace(/\.$/,"")}class P{certificate;authorize;resolve;certificateAuthority;username="codimium";password=B(32).toString("hex");realm=B(16).toString("hex");authorization=Buffer.from(`Basic ${Buffer.from(`${this.username}:${this.password}`).toString("base64")}`);sockets=new Set;tunnel=new WeakMap;authenticated=new WeakSet;server=E();inner=E();innerTls=o((z)=>this.acceptTls(z));privateDirectory=t(D(s(),"deepseek-egress-tls-"));stopped=!1;_url="";constructor(z,w,Q,$){this.certificate=z;this.authorize=w;this.resolve=Q;this.certificateAuthority=$;this.inner.setTimeout(30000);for(let J of[this.server,this.inner])J.maxHeadersCount=100,J.headersTimeout=15000,J.requestTimeout=30000,J.on("request",(G,Z)=>{this.forward(G,Z).catch(()=>{if(!Z.headersSent)Z.writeHead(502);Z.end()})}),J.on("upgrade",(G,Z,K)=>{this.upgrade(G,Z,K).catch(()=>Z.destroy())}),J.on("connection",(G)=>this.track(G)),J.on("clientError",(G,Z)=>Z.destroy());this.server.on("connect",(J,G,Z)=>{this.connect(J,G,Z).catch(()=>G.destroy())})}static async start(z,w,Q=Y,$){let J=new P(z,w,Q,$);try{await new Promise((Z,K)=>{J.innerTls.once("error",K),J.innerTls.listen(D(J.privateDirectory,"tls"),()=>{J.innerTls.off("error",K),Z()})}),await new Promise((Z,K)=>{J.server.once("error",K),J.server.listen(0,"127.0.0.1",()=>{J.server.off("error",K),Z()})});let G=J.server.address();if(!G||typeof G==="string")throw J.stop(),Error("Codimium network protection did not bind");return J._url=`http://127.0.0.1:${G.port}`,J}catch(G){throw J.stop(),G}}get url(){return this._url}get cleanupDirectory(){return this.privateDirectory}launchOptions(){return{proxyServer:this.url,proxyBypassList:"<-loopback>",certificateSPKI:this.certificate.spki}}stop(){if(this.stopped)return;this.stopped=!0,this.server.close(),this.innerTls.close();for(let z of this.sockets)z.destroy();this.sockets.clear(),r(this.privateDirectory,{recursive:!0,force:!0})}track(z){this.sockets.add(z),z.once("close",()=>this.sockets.delete(z)),z.on("error",()=>z.destroy())}hasAuth(z){if(this.authenticated.has(z.socket))return!0;let w=Buffer.from(String(z.headers["proxy-authorization"]??""));return w.length===this.authorization.length&&T(w,this.authorization)}challenge(z){z.end(`HTTP/1.1 407 Proxy Authentication Required\r
|
|
2
|
+
Proxy-Authenticate: Basic realm="${this.realm}"\r
|
|
3
|
+
Connection: close\r
|
|
4
|
+
Content-Length: 0\r
|
|
5
|
+
\r
|
|
6
|
+
`)}destination(z){let w=this.tunnel.get(z.socket),Q=w?new URL(z.url??"/",w):new URL(z.url??"");if(!["http:","https:","ws:","wss:"].includes(Q.protocol)||Q.username||Q.password)throw Error("Unsupported proxy URL");if(w&&(Q.host!==w.host||Q.protocol!==w.protocol))throw Error("Tunnel authority changed");if(w&&new URL(`${w.protocol}//${z.headers.host??""}`).host!==w.host)throw Error("Tunnel Host changed");return Q}async endpoint(z){let w=new URL(z);w.protocol=z.protocol==="ws:"?"http:":z.protocol==="wss:"?"https:":z.protocol;let Q=[];if((await f(w.href,async(K)=>{return Q=await this.resolve(K),Q})).kind==="blocked")throw Error("Blocked egress address");let J=L(z.hostname);if(b(J))Q=[J];else if(A(J))Q=["127.0.0.1"];if(!Q.length)throw Error("No verified egress address");let G=Q[0],Z=b(G);if(!Z||G==="127.0.0.1"&&Number(z.port)===Number(new URL(this.url).port))throw Error("Invalid or recursive egress address");return{address:G,family:Z}}async connect(z,w,Q){if(this.stopped){w.destroy();return}if(!this.hasAuth(z)){this.challenge(w);return}let $=new URL(`https://${z.url}`);if($.username||$.password||$.pathname!=="/"||$.search||$.hash)throw Error("Invalid CONNECT authority");if(await this.endpoint($),this.stopped){w.destroy();return}w.write(`HTTP/1.1 200 Connection Established\r
|
|
7
|
+
\r
|
|
8
|
+
`),w.setTimeout(1e4,()=>w.destroy());let J=(G)=>{if(w.pause(),w.setTimeout(0),G[0]===22){let Z=a(D(this.privateDirectory,"tls"));this.track(Z),Z.once("connect",()=>Z.write(JSON.stringify({password:this.password,target:$.href})+`
|
|
9
|
+
`));let K="",N=(y)=>{if(K+=y.toString(),!`OK
|
|
10
|
+
`.startsWith(K)){Z.destroy();return}if(K!==`OK
|
|
11
|
+
`)return;Z.off("data",N),Z.write(G),w.pipe(Z),Z.pipe(w)};Z.on("data",N),w.once("close",()=>Z.destroy()),Z.once("close",()=>w.destroy())}else{let Z=new URL(`http://${z.url}`);this.authenticated.add(w),this.tunnel.set(w,Z),w.unshift(G),this.inner.emit("connection",w),w.resume()}};if(Q.length)J(Q);else w.once("data",J),w.resume()}acceptTls(z){this.track(z),z.setTimeout(5000,()=>z.destroy());let w="",Q=($)=>{if(w+=$.toString(),w.length>4096){z.destroy();return}if(!w.endsWith(`
|
|
12
|
+
`))return;z.off("data",Q);try{let J=JSON.parse(w),G=Buffer.from(J.password??""),Z=Buffer.from(this.password);if(G.length!==Z.length||!T(G,Z)||typeof J.target!=="string")throw Error("Unowned TLS bridge");let K=new URL(J.target);if(K.protocol!=="https:"||K.username||K.password)throw Error("Invalid TLS authority");z.pause(),z.write(`OK
|
|
13
|
+
`);let N=new l(z,{isServer:!0,secureContext:this.certificate.context,ALPNProtocols:["http/1.1"]});this.track(N),this.authenticated.add(N),this.tunnel.set(N,K),N.setTimeout(15000,()=>N.destroy()),N.once("secure",()=>N.setTimeout(30000)),this.inner.emit("connection",N),z.resume()}catch{z.destroy()}};z.on("data",Q)}async forward(z,w){if(this.stopped){w.writeHead(503),w.end();return}if(!this.hasAuth(z)){w.writeHead(407,{"proxy-authenticate":`Basic realm="${this.realm}"`}),w.end();return}let Q=this.destination(z);if(!["http:","https:"].includes(Q.protocol)){w.writeHead(400),w.end();return}let $=await this.endpoint(Q);if(!await this.authorize(Q.href)||this.stopped){w.writeHead(403),w.end();return}let J=this.outgoing(z,Q,$,!1);J.on("response",(G)=>{w.writeHead(G.statusCode??502,O(G.headers)),G.on("error",()=>w.destroy()),G.pipe(w)}),J.on("error",()=>{if(!w.headersSent)w.writeHead(502);w.end()}),z.on("aborted",()=>J.destroy()),w.on("close",()=>J.destroy()),z.pipe(J)}outgoing(z,w,Q,$){let J=O(z.headers);if(J.host=w.host,$)J.connection="Upgrade",J.upgrade="websocket";let G=["https:","wss:"].includes(w.protocol),K=(G?c:d)({hostname:L(w.hostname),port:w.port||(G?443:80),path:w.pathname+w.search,method:z.method,headers:J,agent:!1,rejectUnauthorized:!0,ca:this.certificateAuthority,lookup:(N,y,C)=>{if(y.all)C(null,[Q]);else C(null,Q.address,Q.family)}});return K.setTimeout(30000,()=>K.destroy()),K}async upgrade(z,w,Q){if(this.stopped){w.destroy();return}if(!this.hasAuth(z)){this.challenge(w);return}if(String(z.headers.upgrade).toLowerCase()!=="websocket")throw Error("Unsupported upgrade");let $=this.destination(z),J=z.headers.origin;if(typeof J!=="string"||!await this.authorize($.href,J)){w.end(`HTTP/1.1 403 Forbidden\r
|
|
14
|
+
Connection: close\r
|
|
15
|
+
Content-Length: 0\r
|
|
16
|
+
\r
|
|
17
|
+
`);return}let G=await this.endpoint($);if(this.stopped){w.destroy();return}let Z=this.outgoing(z,$,G,!0);Z.on("upgrade",(K,N,y)=>{if(Z.setTimeout(0),N.setTimeout(0),w.setTimeout(0),this.track(N),this.stopped||w.destroyed){N.destroy();return}let C=O(K.headers);C.connection="Upgrade",C.upgrade="websocket";let S=Object.entries(C).flatMap(([v,W])=>(Array.isArray(W)?W:[W]).filter((X)=>X!==void 0).map((X)=>`${v}: ${X}`));if(w.write(`HTTP/1.1 101 Switching Protocols\r
|
|
18
|
+
${S.join(`\r
|
|
19
|
+
`)}\r
|
|
20
|
+
\r
|
|
21
|
+
`),y.length)w.write(y);if(Q.length)N.write(Q);w.once("close",()=>N.destroy()),N.once("close",()=>w.destroy()),N.pipe(w),w.pipe(N)}),Z.on("response",(K)=>{K.resume(),w.end(`HTTP/1.1 502 Bad Gateway\r
|
|
22
|
+
Connection: close\r
|
|
23
|
+
Content-Length: 0\r
|
|
24
|
+
\r
|
|
25
|
+
`)}),Z.on("error",()=>w.destroy()),w.once("close",()=>Z.destroy()),Z.end()}}var V,U=!1,zw=0,F=new Map;function _(z,w){if(!process.connected||F.size>=512)return Promise.reject(Error("Network owner unavailable"));let Q=++zw;return new Promise(($,J)=>{let G=setTimeout(()=>{F.delete(Q),J(Error("Network owner timed out"))},5000);F.set(Q,{done(Z){clearTimeout(G),$(Z)},fail(){clearTimeout(G),J(Error("Network owner disconnected"))}}),process.send({type:z,id:Q,...w})})}function x(){V?.stop();for(let z of F.values())z.fail();F.clear(),process.exit(0)}process.on("disconnect",x);process.on("SIGTERM",x);process.on("SIGINT",x);process.on("message",(z)=>{let w=z;if(w.type==="reply"&&typeof w.id==="number"){let Q=F.get(w.id);F.delete(w.id),Q?.done(w.value);return}if(w.type!=="init"||U)return;U=!0,(async()=>{if(!w.key||!w.cert||!w.spki)throw Error("Missing private network identity");let Q={key:w.key,cert:w.cert,spki:w.spki,context:ww({key:w.key,cert:w.cert})};V=await P.start(Q,async($,J)=>await _("authorize",{url:$,origin:J})===!0,w.customResolver?async($)=>{let J=await _("resolve",{host:$});if(!Array.isArray(J)||!J.every((G)=>typeof G==="string"))throw Error("Invalid resolver result");return J}:Y,w.certificateAuthority),process.send({type:"ready",url:V.url,username:V.username,password:V.password,realm:V.realm,cleanupDirectory:V.cleanupDirectory})})().catch(()=>{process.send?.({type:"error"}),V?.stop(),process.exit(1)})});
|