@hermenics/deepseek-code 0.13.6 → 0.15.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 +9 -1
- package/dist/browser-egress-worker.mjs +2 -2
- package/dist/cli.mjs +902 -864
- package/dist/runtime.mjs +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -53,8 +53,16 @@ For automation, use headless pipe mode:
|
|
|
53
53
|
```bash
|
|
54
54
|
echo "explain this project" | deepseek --pipe
|
|
55
55
|
cat src/index.tsx | deepseek --pipe --json "summarize"
|
|
56
|
+
echo "summarize this project" | deepseek --pipe --jsonl
|
|
57
|
+
cat src/index.tsx | deepseek --pipe --jsonl --output-schema ./summary.schema.json
|
|
56
58
|
```
|
|
57
59
|
|
|
60
|
+
`--json` preserves the legacy one-shot JSON protocol: stdout receives only `{ "ok": true, "output": "...", "tools": [...] }` on success or `{ "ok": false, "error": "..." }` on failure. `--json` and `--jsonl` cannot be used together.
|
|
61
|
+
|
|
62
|
+
`--jsonl` emits JSON Lines v1: one JSON object per line, each with `version: 1` and a `type`. A successful run emits `start`, zero or more streamed `token` events (`text`) and `tool_call` events (`name`), then `done` (`ok`, `output`, `tools`, and `usage`). An `error` event has `ok: false`, `error`, `partialOutput`, and `usage`; it also has `issues` when `--output-schema` rejects the final output. `usage` contains nullable `tokens` and `costUsd`, their `tokenStatus` and `costStatus` (`measured`, `partial`, or `unavailable`), and `costEstimated`. Each validation issue contains `instancePath` and `keyword`. Argument or schema preflight failures can emit `error` before `start`.
|
|
63
|
+
|
|
64
|
+
`--output-schema <path>` accepts one local JSON Schema file (up to 1,000,000 bytes). The complete schema JSON, including annotations, must serialize to no more than 32 KiB; larger schemas are rejected rather than truncated. `$ref` references must be local, and remote references are not resolved; `$dynamicRef` and `$recursiveRef` are rejected. Schema annotation keywords such as `title`, `description`, `examples`, and `$comment` are omitted from the model-facing schema. The prompt requires exactly one JSON value, with no prose, Markdown, or code fences; Ajv's configured draft-07 validator checks the final response locally and rejects unsupported keywords or unregistered formats during preflight. Failures use the selected output format and exit with status 1. In text mode, output is streamed before final validation and a validation error is reported on stderr; in JSONL, a failed final-output check includes `issues` (up to 20 entries, with `instancePath` and `keyword`).
|
|
65
|
+
|
|
58
66
|
### DeepSeek Pods on your own server
|
|
59
67
|
|
|
60
68
|
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:
|
|
@@ -120,7 +128,7 @@ Each provider also exposes provider-specific models (Bedrock, Vertex, local).
|
|
|
120
128
|
|
|
121
129
|
The agent has access to these tools out of the box:
|
|
122
130
|
|
|
123
|
-
`ReadFile` · `WriteFile` · `EditFile` · `PatchFile` · `Shell` · `Glob` · `Grep` · `Lsp` · `Git` · `ReadFolder` · `WebFetch` · `Skill` · `SubAgent` · `AskAgent` · `Workflow` · `Memory` · `Todo` · `Introspect` · `MoA` · `AskUserQuestions`
|
|
131
|
+
`ReadFile` · `WriteFile` · `EditFile` · `PatchFile` · `Shell` · `Glob` · `Grep` · `Lsp` · `Git` · `ReadFolder` · `WebFetch` · `WebSearch` · `Skill` · `SubAgent` · `AskAgent` · `Workflow` · `Memory` · `Todo` · `Introspect` · `MoA` · `AskUserQuestions`
|
|
124
132
|
|
|
125
133
|
Shell command execution currently requires Linux with a working bubblewrap sandbox. On macOS, Windows, or a Linux host where the sandbox cannot start, commands fail closed before execution.
|
|
126
134
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import{createSecureContext as re}from"node:tls";import{createServer as
|
|
1
|
+
import{createSecureContext as re}from"node:tls";import{createServer as x,request as G}from"node:http";import{request as X}from"node:https";import{TLSSocket as V}from"node:tls";import{connect as J,createServer as Q,isIP as P}from"node:net";import{randomBytes as C,timingSafeEqual as _}from"node:crypto";import{mkdtempSync as Y,rmSync as Z}from"node:fs";import{tmpdir as ee}from"node:os";import{join as b}from"node:path";import{lookup as F}from"dns/promises";import{isIP as R}from"node:net";import{BlockList as H,isIP as N}from"node:net";var z=20000,ce=z*4;var O=[["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]],W=[["::",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 k(t,e){let o=new H;for(let[n,r]of t)o.addSubnet(n,r,e);return o}var j=k(O,"ipv4"),q=k(W,"ipv6");function w(t){let e=N(t);if(e===4)return j.check(t,"ipv4");if(e===6&&/^::ffff:[0-9a-f]{1,4}:[0-9a-f]{1,4}$/i.test(t))return!0;if(e===6)return q.check(t,"ipv6");return!0}var K=2000,S=2048,h=async(t)=>{let e;try{return(await Promise.race([F(t,{all:!0}),new Promise((n,r)=>{e=setTimeout(()=>r(Error("DNS timeout")),K)})])).map((n)=>n.address)}finally{clearTimeout(e)}};function L(t){return t.replace(/^\[|\]$/g,"").replace(/\.$/,"").toLowerCase()}function v(t){let e=L(t);if(e==="localhost"||e.endsWith(".localhost"))return!0;if(R(e)===4)return e.startsWith("127.");return e==="::1"}async function U(t,e=h){if(t==="about:blank")return{kind:"loopback",origin:"about:blank"};if(t.length>S)return{kind:"blocked",reason:`URL longer than ${S} characters`};let o;try{o=new URL(t)}catch{return{kind:"blocked",reason:"not a valid URL"}}if(o.protocol!=="http:"&&o.protocol!=="https:")return{kind:"blocked",reason:`${o.protocol} URLs are not allowed; use http or https`};if(o.username||o.password)return{kind:"blocked",reason:"URLs with embedded credentials are not allowed"};let n=o.origin,r=L(o.hostname);if(v(r))return{kind:"loopback",origin:n};if(r==="metadata.google.internal")return{kind:"blocked",origin:n,reason:"cloud metadata endpoints are blocked"};if(R(r))return w(r)?{kind:"blocked",origin:n,reason:`${r} is not a public address`}:{kind:"public",origin:n};let i;try{i=await e(r)}catch{return{kind:"blocked",origin:n,reason:`could not resolve ${r}`}}if(i.length===0)return{kind:"blocked",origin:n,reason:`could not resolve ${r}`};let s=i.find((a)=>w(a));return s?{kind:"blocked",origin:n,reason:`${r} resolves to non-public address ${s}`}:{kind:"public",origin:n}}var te=["connection","proxy-connection","proxy-authorization","proxy-authenticate","keep-alive","te","trailer","transfer-encoding","upgrade"];function T(t){let e={...t},o=String(t.connection??"").split(",").map((n)=>n.trim().toLowerCase());for(let n of[...te,...o])delete e[n];return e}function I(t){return t.replace(/^\[|\]$/g,"").replace(/\.$/,"")}class f{certificate;authorize;resolve;certificateAuthority;username="codimium";password=C(32).toString("hex");realm=C(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=x();inner=x();innerTls=Q((t)=>this.acceptTls(t));privateDirectory=Y(b(ee(),"deepseek-egress-tls-"));stopped=!1;_url="";constructor(t,e,o,n){this.certificate=t;this.authorize=e;this.resolve=o;this.certificateAuthority=n;this.inner.setTimeout(30000);for(let[r,i]of[[this.server,!1],[this.inner,!0]])r.maxHeadersCount=100,r.headersTimeout=15000,r.requestTimeout=30000,r.on("request",(s,a)=>{this.forward(s,a,i).catch(()=>{if(!a.headersSent)a.writeHead(502);a.end()})}),r.on("upgrade",(s,a,c)=>{this.upgrade(s,a,c,i).catch(()=>a.destroy())}),r.on("connection",(s)=>this.track(s)),r.on("clientError",(s,a)=>a.destroy());this.server.on("connect",(r,i,s)=>{this.connect(r,i,s).catch(()=>i.destroy())})}static async start(t,e,o=h,n){let r=new f(t,e,o,n);try{await new Promise((s,a)=>{r.innerTls.once("error",a),r.innerTls.listen(b(r.privateDirectory,"tls"),()=>{r.innerTls.off("error",a),s()})}),await new Promise((s,a)=>{r.server.once("error",a),r.server.listen(0,"127.0.0.1",()=>{r.server.off("error",a),s()})});let i=r.server.address();if(!i||typeof i==="string")throw r.stop(),Error("Codimium network protection did not bind");return r._url=`http://127.0.0.1:${i.port}`,r}catch(i){throw r.stop(),i}}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 t of this.sockets)t.destroy();this.sockets.clear(),Z(this.privateDirectory,{recursive:!0,force:!0})}track(t){this.sockets.add(t),t.once("close",()=>this.sockets.delete(t)),t.on("error",()=>t.destroy())}hasAuth(t,e=!1){if(e&&this.authenticated.has(t.socket))return!0;let o=Buffer.from(String(t.headers["proxy-authorization"]??""));return o.length===this.authorization.length&&_(o,this.authorization)}challenge(t){t.end(`HTTP/1.1 407 Proxy Authentication Required\r
|
|
2
2
|
Proxy-Authenticate: Basic realm="${this.realm}"\r
|
|
3
3
|
Connection: close\r
|
|
4
4
|
Content-Length: 0\r
|
|
5
5
|
\r
|
|
6
|
-
`)}destination(t){let e=this.tunnel.get(t.socket),o=e?new URL(t.url??"/",e):new URL(t.url??"");if(!["http:","https:","ws:","wss:"].includes(o.protocol)||o.username||o.password)throw Error("Unsupported proxy URL");if(e&&(o.host!==e.host||o.protocol!==e.protocol))throw Error("Tunnel authority changed");if(e&&new URL(`${e.protocol}//${t.headers.host??""}`).host!==e.host)throw Error("Tunnel Host changed");return o}async endpoint(t){let e=new URL(t);e.protocol=t.protocol==="ws:"?"http:":t.protocol==="wss:"?"https:":t.protocol;let o=[];if((await
|
|
6
|
+
`)}destination(t){let e=this.tunnel.get(t.socket),o=e?new URL(t.url??"/",e):new URL(t.url??"");if(!["http:","https:","ws:","wss:"].includes(o.protocol)||o.username||o.password)throw Error("Unsupported proxy URL");if(e&&(o.host!==e.host||o.protocol!==e.protocol))throw Error("Tunnel authority changed");if(e&&new URL(`${e.protocol}//${t.headers.host??""}`).host!==e.host)throw Error("Tunnel Host changed");return o}async endpoint(t){let e=new URL(t);e.protocol=t.protocol==="ws:"?"http:":t.protocol==="wss:"?"https:":t.protocol;let o=[];if((await U(e.href,async(a)=>(o=await this.resolve(a),o))).kind==="blocked")throw Error("Blocked egress address");let r=I(t.hostname);if(P(r))o=[r];else if(v(r))o=["127.0.0.1"];if(!o.length)throw Error("No verified egress address");let i=o[0],s=P(i);if(!s||i==="127.0.0.1"&&Number(t.port)===Number(new URL(this.url).port))throw Error("Invalid or recursive egress address");return{address:i,family:s}}async connect(t,e,o){if(this.stopped){e.destroy();return}if(!this.hasAuth(t)){this.challenge(e);return}let n=new URL(`https://${t.url}`);if(n.username||n.password||n.pathname!=="/"||n.search||n.hash)throw Error("Invalid CONNECT authority");if(await this.endpoint(n),this.stopped){e.destroy();return}e.write(`HTTP/1.1 200 Connection Established\r
|
|
7
7
|
\r
|
|
8
8
|
`),e.setTimeout(1e4,()=>e.destroy());let r=(i)=>{if(e.pause(),e.setTimeout(0),i[0]===22){let s=J(b(this.privateDirectory,"tls"));this.track(s),s.once("connect",()=>s.write(JSON.stringify({password:this.password,target:n.href})+`
|
|
9
9
|
`));let a="",c=(l)=>{if(a+=l.toString(),!`OK
|