dal-code 1.0.17 → 1.0.18

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 (55) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/dist/node_modules/@dalcode/dal-bridge/package.json +2 -2
  3. package/dist/node_modules/@dalcode/dal-gateway/package.json +2 -2
  4. package/dist/node_modules/@dalcode/dal-guard/package.json +4 -4
  5. package/dist/node_modules/@dalcode/dal-halo/package.json +1 -1
  6. package/dist/node_modules/@dalcode/dal-lang/package.json +3 -3
  7. package/dist/node_modules/@dalcode/dal-lsp/package.json +3 -3
  8. package/dist/node_modules/@dalcode/dal-mcp/package.json +5 -5
  9. package/dist/node_modules/@dalcode/dal-office/package.json +2 -2
  10. package/dist/node_modules/@dalcode/dal-pi-kit/package.json +1 -1
  11. package/dist/node_modules/@dalcode/dal-plugins/package.json +2 -2
  12. package/dist/node_modules/@dalcode/dal-router/package.json +4 -4
  13. package/dist/node_modules/@dalcode/dal-skills/package.json +3 -3
  14. package/dist/node_modules/@dalcode/dal-subagent/package.json +5 -5
  15. package/dist/node_modules/@dalcode/dal-telemetry/package.json +2 -2
  16. package/dist/node_modules/@dalcode/dal-tool-catalog/package.json +2 -2
  17. package/dist/node_modules/@dalcode/dal-web/package.json +2 -2
  18. package/dist/node_modules/@dalcode/dal-workflow/package.json +2 -2
  19. package/dist/node_modules/@dalcode/deepailab/package.json +3 -3
  20. package/dist/node_modules/@earendil-works/chord/package.json +1 -1
  21. package/dist/node_modules/@earendil-works/pi-agent-core/package.json +4 -4
  22. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
  23. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
  24. package/dist/node_modules/@earendil-works/pi-ai/node_modules/agent-base/LICENSE +22 -0
  25. package/dist/node_modules/@earendil-works/pi-ai/node_modules/agent-base/README.md +69 -0
  26. package/dist/node_modules/@earendil-works/pi-ai/node_modules/agent-base/dist/helpers.js +1 -0
  27. package/dist/node_modules/@earendil-works/pi-ai/node_modules/agent-base/dist/index.js +2 -0
  28. package/dist/node_modules/@earendil-works/pi-ai/node_modules/agent-base/package.json +46 -0
  29. package/dist/node_modules/@earendil-works/pi-ai/node_modules/http-proxy-agent/LICENSE +22 -0
  30. package/dist/node_modules/@earendil-works/pi-ai/node_modules/http-proxy-agent/README.md +44 -0
  31. package/dist/node_modules/@earendil-works/pi-ai/node_modules/http-proxy-agent/dist/index.js +3 -0
  32. package/dist/node_modules/@earendil-works/pi-ai/node_modules/http-proxy-agent/package.json +48 -0
  33. package/dist/node_modules/@earendil-works/pi-ai/node_modules/https-proxy-agent/LICENSE +22 -0
  34. package/dist/node_modules/@earendil-works/pi-ai/node_modules/https-proxy-agent/README.md +70 -0
  35. package/dist/node_modules/@earendil-works/pi-ai/node_modules/https-proxy-agent/dist/index.js +7 -0
  36. package/dist/node_modules/@earendil-works/pi-ai/node_modules/https-proxy-agent/dist/parse-proxy-response.js +4 -0
  37. package/dist/node_modules/@earendil-works/pi-ai/node_modules/https-proxy-agent/package.json +51 -0
  38. package/dist/node_modules/@earendil-works/pi-ai/package.json +2 -2
  39. package/dist/node_modules/@earendil-works/pi-client/package.json +3 -3
  40. package/dist/node_modules/@earendil-works/pi-protocol/package.json +2 -2
  41. package/dist/node_modules/@earendil-works/pi-server/package.json +5 -5
  42. package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/package.json +3 -3
  43. package/dist/node_modules/@earendil-works/pi-telemetry/package.json +1 -1
  44. package/dist/node_modules/@earendil-works/pi-tui/package.json +1 -1
  45. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  46. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  47. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  48. package/examples/extensions/gondolin/package-lock.json +2 -2
  49. package/examples/extensions/gondolin/package.json +1 -1
  50. package/examples/extensions/sandbox/package-lock.json +2 -2
  51. package/examples/extensions/sandbox/package.json +1 -1
  52. package/examples/extensions/with-deps/package-lock.json +2 -2
  53. package/examples/extensions/with-deps/package.json +1 -1
  54. package/npm-shrinkwrap.json +2383 -2467
  55. package/package.json +1 -3
@@ -0,0 +1,22 @@
1
+ (The MIT License)
2
+
3
+ Copyright (c) 2013 Nathan Rajlich <nathan@tootallnate.net>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ 'Software'), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,69 @@
1
+ agent-base
2
+ ==========
3
+ ### Turn a function into an [`http.Agent`][http.Agent] instance
4
+
5
+ This module is a thin wrapper around the base `http.Agent` class.
6
+
7
+ It provides an abstract class that must define a `connect()` function,
8
+ which is responsible for creating the underlying socket that the HTTP
9
+ client requests will use.
10
+
11
+ The `connect()` function may return an arbitrary `Duplex` stream, or
12
+ another `http.Agent` instance to delegate the request to, and may be
13
+ asynchronous (by defining an `async` function).
14
+
15
+ Instances of this agent can be used with the `http` and `https`
16
+ modules. To differentiate, the options parameter in the `connect()`
17
+ function includes a `secureEndpoint` property, which can be checked
18
+ to determine what type of socket should be returned.
19
+
20
+ #### Some subclasses:
21
+
22
+ Here are some more interesting uses of `agent-base`.
23
+ Send a pull request to list yours!
24
+
25
+ * [`http-proxy-agent`][http-proxy-agent]: An HTTP(s) proxy `http.Agent` implementation for HTTP endpoints
26
+ * [`https-proxy-agent`][https-proxy-agent]: An HTTP(s) proxy `http.Agent` implementation for HTTPS endpoints
27
+ * [`pac-proxy-agent`][pac-proxy-agent]: A PAC file proxy `http.Agent` implementation for HTTP and HTTPS
28
+ * [`socks-proxy-agent`][socks-proxy-agent]: A SOCKS proxy `http.Agent` implementation for HTTP and HTTPS
29
+
30
+ Example
31
+ -------
32
+
33
+ Here's a minimal example that creates a new `net.Socket` or `tls.Socket`
34
+ based on the `secureEndpoint` property. This agent can be used with both
35
+ the `http` and `https` modules.
36
+
37
+ ```ts
38
+ import * as net from 'net';
39
+ import * as tls from 'tls';
40
+ import * as http from 'http';
41
+ import { Agent } from 'agent-base';
42
+
43
+ class MyAgent extends Agent {
44
+ connect(req, opts) {
45
+ // `secureEndpoint` is true when using the "https" module
46
+ if (opts.secureEndpoint) {
47
+ return tls.connect(opts);
48
+ } else {
49
+ return net.connect(opts);
50
+ }
51
+ }
52
+ });
53
+
54
+ // Keep alive enabled means that `connect()` will only be
55
+ // invoked when a new connection needs to be created
56
+ const agent = new MyAgent({ keepAlive: true });
57
+
58
+ // Pass the `agent` option when creating the HTTP request
59
+ http.get('http://nodejs.org/api/', { agent }, (res) => {
60
+ console.log('"response" event!', res.headers);
61
+ res.pipe(process.stdout);
62
+ });
63
+ ```
64
+
65
+ [http-proxy-agent]: ../http-proxy-agent
66
+ [https-proxy-agent]: ../https-proxy-agent
67
+ [pac-proxy-agent]: ../pac-proxy-agent
68
+ [socks-proxy-agent]: ../socks-proxy-agent
69
+ [http.Agent]: https://nodejs.org/api/http.html#http_class_http_agent
@@ -0,0 +1 @@
1
+ var h=Object.defineProperty;var s=(t,r)=>h(t,"name",{value:r,configurable:!0});import*as i from"http";import*as p from"https";async function a(t){let r=0;const e=[];for await(const n of t)r+=n.length,e.push(n);return Buffer.concat(e,r)}s(a,"toBuffer");async function m(t){const e=(await a(t)).toString("utf8");try{return JSON.parse(e)}catch(n){const o=n;throw o.message+=` (input: ${e})`,o}}s(m,"json");function g(t,r={}){const n=((typeof t=="string"?t:t.href).startsWith("https:")?p:i).request(t,r),o=new Promise((c,f)=>{n.once("response",c).once("error",f).end()});return n.then=o.then.bind(o),n}s(g,"req");export{m as json,g as req,a as toBuffer};
@@ -0,0 +1,2 @@
1
+ var p=Object.defineProperty;var h=(i,t)=>p(i,"name",{value:t,configurable:!0});import*as a from"net";import*as l from"http";import{Agent as d}from"https";export*from"./helpers.js";const r=Symbol("AgentBaseInternalState");class m extends l.Agent{static{h(this,"Agent")}constructor(t){super(t),this[r]={}}isSecureEndpoint(t){if(t){if(typeof t.secureEndpoint=="boolean")return t.secureEndpoint;if(typeof t.protocol=="string")return t.protocol==="https:"}const{stack:e}=new Error;return typeof e!="string"?!1:e.split(`
2
+ `).some(s=>s.indexOf("(https.js:")!==-1||s.indexOf("node:https:")!==-1)}incrementSockets(t){if(this.maxSockets===1/0&&this.maxTotalSockets===1/0)return null;this.sockets[t]||(this.sockets[t]=[]);const e=new a.Socket({writable:!1});return this.sockets[t].push(e),this.totalSocketCount++,e}decrementSockets(t,e){if(!this.sockets[t]||e===null)return;const s=this.sockets[t],n=s.indexOf(e);n!==-1&&(s.splice(n,1),this.totalSocketCount--,s.length===0&&delete this.sockets[t])}getName(t){return this.isSecureEndpoint(t)?d.prototype.getName.call(this,t):super.getName(t)}createSocket(t,e,s){const n={...e,secureEndpoint:this.isSecureEndpoint(e)},c=this.getName(n),u=this.incrementSockets(c);Promise.resolve().then(()=>this.connect(t,n)).then(o=>{if(this.decrementSockets(c,u),typeof o.addRequest=="function")try{return o.addRequest(t,n)}catch(f){return s(f)}this[r].currentSocket=o,super.createSocket(t,e,s)},o=>{this.decrementSockets(c,u),s(o)})}createConnection(){const t=this[r].currentSocket;if(this[r].currentSocket=void 0,!t)throw new Error("No socket was returned in the `connect()` function");return t}get defaultPort(){return this[r].defaultPort??(this.protocol==="https:"?443:80)}set defaultPort(t){this[r]&&(this[r].defaultPort=t)}get protocol(){return this[r].protocol??(this.isSecureEndpoint()?"https:":"http:")}set protocol(t){this[r]&&(this[r].protocol=t)}}export{m as Agent};
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "agent-base",
3
+ "version": "9.0.0",
4
+ "type": "module",
5
+ "description": "Turn a function into an `http.Agent` instance",
6
+ "exports": {
7
+ "types": "./dist/index.d.ts",
8
+ "default": "./dist/index.js"
9
+ },
10
+ "files": [
11
+ "dist"
12
+ ],
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "https://github.com/TooTallNate/proxy-agents.git",
16
+ "directory": "packages/agent-base"
17
+ },
18
+ "keywords": [
19
+ "http",
20
+ "agent",
21
+ "base",
22
+ "barebones",
23
+ "https"
24
+ ],
25
+ "author": "Nathan Rajlich <nathan@tootallnate.net> (http://n8.io/)",
26
+ "license": "MIT",
27
+ "devDependencies": {
28
+ "@types/debug": "^4.1.7",
29
+ "@types/node": "^22.13.0",
30
+ "@types/semver": "^7.3.13",
31
+ "@types/ws": "^8.5.4",
32
+ "async-listen": "^3.0.0",
33
+ "typescript": "^5.1.6",
34
+ "ws": "^8.13.0",
35
+ "tsconfig": "0.0.0"
36
+ },
37
+ "engines": {
38
+ "node": ">= 20"
39
+ },
40
+ "scripts": {
41
+ "build": "tsc",
42
+ "test": "vitest",
43
+ "lint": "eslint . --ext .ts",
44
+ "pack": "node ../../scripts/pack.mjs"
45
+ }
46
+ }
@@ -0,0 +1,22 @@
1
+ (The MIT License)
2
+
3
+ Copyright (c) 2013 Nathan Rajlich <nathan@tootallnate.net>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ 'Software'), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,44 @@
1
+ http-proxy-agent
2
+ ================
3
+ ### An HTTP(s) proxy `http.Agent` implementation for HTTP
4
+
5
+ This module provides an `http.Agent` implementation that connects to a specified
6
+ HTTP or HTTPS proxy server, and can be used with the built-in `http` module.
7
+
8
+ __Note:__ For HTTP proxy usage with the `https` module, check out
9
+ [`https-proxy-agent`](../https-proxy-agent).
10
+
11
+
12
+ Example
13
+ -------
14
+
15
+ ```ts
16
+ import * as http from 'http';
17
+ import { HttpProxyAgent } from 'http-proxy-agent';
18
+
19
+ const agent = new HttpProxyAgent('http://168.63.76.32:3128');
20
+
21
+ http.get('http://nodejs.org/api/', { agent }, (res) => {
22
+ console.log('"response" event!', res.headers);
23
+ res.pipe(process.stdout);
24
+ });
25
+ ```
26
+
27
+ API
28
+ ---
29
+
30
+ ### new HttpProxyAgent(proxy: string | URL, options?: HttpProxyAgentOptions)
31
+
32
+ The `HttpProxyAgent` class implements an `http.Agent` subclass that connects
33
+ to the specified "HTTP(s) proxy server" in order to proxy HTTP requests.
34
+
35
+ The `proxy` argument is the URL for the proxy server.
36
+
37
+ The `options` argument accepts the usual `http.Agent` constructor options, and
38
+ some additional properties:
39
+
40
+ * `headers` - Object containing additional headers to send to the proxy server
41
+ in each request. This may also be a function that returns a headers object.
42
+
43
+ **NOTE:** If your proxy does not strip these headers from the request, they
44
+ will also be sent to the destination server.
@@ -0,0 +1,3 @@
1
+ var y=Object.defineProperty;var h=(i,t)=>y(i,"name",{value:t,configurable:!0});import*as l from"net";import*as x from"tls";import m from"debug";import{once as g}from"events";import{Agent as P}from"agent-base";import{URL as f}from"url";import{createNegotiateAuth as A}from"proxy-agent-negotiate";const r=m("http-proxy-agent");class H extends P{static{h(this,"HttpProxyAgent")}constructor(t,e){super(e),this.proxy=typeof t=="string"?new f(t):t,this.proxyHeaders=e?.headers??{},r("Creating new HttpProxyAgent instance: %o",this.proxy.href),e?.negotiate?this.onProxyAuth=A():e?.onProxyAuth&&(this.onProxyAuth=e.onProxyAuth);const o=(this.proxy.hostname||this.proxy.host).replace(/^\[|\]$/g,""),s=this.proxy.port?parseInt(this.proxy.port,10):this.proxy.protocol==="https:"?443:80;this.connectOpts={...e?C(e,"headers","onProxyAuth","negotiate"):null,host:o,port:s}}addRequest(t,e){t._header=null,this.setRequestProps(t,e),super.addRequest(t,e)}setRequestProps(t,e){const{proxy:o}=this,s=e.secureEndpoint?"https:":"http:",n=t.getHeader("host")||"localhost",c=`${s}//${n}`,u=new f(t.path,c);e.port!==80&&(u.port=String(e.port)),t.path=String(u);const a=typeof this.proxyHeaders=="function"?this.proxyHeaders():{...this.proxyHeaders};if(o.username||o.password){const p=`${decodeURIComponent(o.username)}:${decodeURIComponent(o.password)}`;a["Proxy-Authorization"]=`Basic ${Buffer.from(p).toString("base64")}`}a["Proxy-Connection"]||(a["Proxy-Connection"]=this.keepAlive?"Keep-Alive":"close");for(const p of Object.keys(a)){const d=a[p];d&&t.setHeader(p,d)}}async connect(t,e){t._header=null,t.path.includes("://")||this.setRequestProps(t,e);let o,s;r("Regenerating stored HTTP header string for request"),t._implicitHeader(),t.outputData&&t.outputData.length>0&&(r("Patching connection write() output buffer with updated header"),o=t.outputData[0].data,s=o.indexOf(`\r
2
+ \r
3
+ `)+4,t.outputData[0].data=t._header+o.substring(s),r("Output buffer: %o",t.outputData[0].data));let n;this.proxy.protocol==="https:"?(r("Creating `tls.Socket`: %o",this.connectOpts),n=x.connect(this.connectOpts)):(r("Creating `net.Socket`: %o",this.connectOpts),n=l.connect(this.connectOpts)),await g(n,"connect");const c={socket:n};return t.emit("proxyConnect",c),this.emit("proxyConnect",c,t),t.emit("proxy",{proxy:this.proxy.href,socket:n}),n}}H.protocols=["http","https"];function C(i,...t){const e={};let o;for(o in i)t.includes(o)||(e[o]=i[o]);return e}h(C,"omit");export{H as HttpProxyAgent};
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "http-proxy-agent",
3
+ "version": "9.1.0",
4
+ "type": "module",
5
+ "description": "An HTTP(s) proxy `http.Agent` implementation for HTTP",
6
+ "exports": {
7
+ "types": "./dist/index.d.ts",
8
+ "default": "./dist/index.js"
9
+ },
10
+ "files": [
11
+ "dist"
12
+ ],
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "https://github.com/TooTallNate/proxy-agents.git",
16
+ "directory": "packages/http-proxy-agent"
17
+ },
18
+ "keywords": [
19
+ "http",
20
+ "proxy",
21
+ "endpoint",
22
+ "agent"
23
+ ],
24
+ "author": "Nathan Rajlich <nathan@tootallnate.net> (http://n8.io/)",
25
+ "license": "MIT",
26
+ "dependencies": {
27
+ "debug": "^4.3.4",
28
+ "agent-base": "9.0.0",
29
+ "proxy-agent-negotiate": "1.1.0"
30
+ },
31
+ "devDependencies": {
32
+ "@types/debug": "^4.1.7",
33
+ "@types/node": "^22.13.0",
34
+ "async-listen": "^3.0.0",
35
+ "typescript": "^5.1.6",
36
+ "tsconfig": "0.0.0",
37
+ "proxy": "4.1.0"
38
+ },
39
+ "engines": {
40
+ "node": ">= 20"
41
+ },
42
+ "scripts": {
43
+ "build": "tsc",
44
+ "test": "vitest",
45
+ "lint": "eslint . --ext .ts",
46
+ "pack": "node ../../scripts/pack.mjs"
47
+ }
48
+ }
@@ -0,0 +1,22 @@
1
+ (The MIT License)
2
+
3
+ Copyright (c) 2013 Nathan Rajlich <nathan@tootallnate.net>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ 'Software'), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,70 @@
1
+ https-proxy-agent
2
+ ================
3
+ ### An HTTP(s) proxy `http.Agent` implementation for HTTPS
4
+
5
+ This module provides an `http.Agent` implementation that connects to a specified
6
+ HTTP or HTTPS proxy server, and can be used with the built-in `https` module.
7
+
8
+ Specifically, this `Agent` implementation connects to an intermediary "proxy"
9
+ server and issues the [CONNECT HTTP method][CONNECT], which tells the proxy to
10
+ open a direct TCP connection to the destination server.
11
+
12
+ Since this agent implements the CONNECT HTTP method, it also works with other
13
+ protocols that use this method when connecting over proxies (i.e. WebSockets).
14
+ See the "Examples" section below for more.
15
+
16
+ Examples
17
+ --------
18
+
19
+ #### `https` module example
20
+
21
+ ```ts
22
+ import * as https from 'https';
23
+ import { HttpsProxyAgent } from 'https-proxy-agent';
24
+
25
+ const agent = new HttpsProxyAgent('http://168.63.76.32:3128');
26
+
27
+ https.get('https://example.com', { agent }, (res) => {
28
+ console.log('"response" event!', res.headers);
29
+ res.pipe(process.stdout);
30
+ });
31
+ ```
32
+
33
+ #### `ws` WebSocket connection example
34
+
35
+ ```ts
36
+ import WebSocket from 'ws';
37
+ import { HttpsProxyAgent } from 'https-proxy-agent';
38
+
39
+ const agent = new HttpsProxyAgent('http://168.63.76.32:3128');
40
+ const socket = new WebSocket('ws://echo.websocket.org', { agent });
41
+
42
+ socket.on('open', function () {
43
+ console.log('"open" event!');
44
+ socket.send('hello world');
45
+ });
46
+
47
+ socket.on('message', function (data, flags) {
48
+ console.log('"message" event! %j %j', data, flags);
49
+ socket.close();
50
+ });
51
+ ```
52
+
53
+ API
54
+ ---
55
+
56
+ ### new HttpsProxyAgent(proxy: string | URL, options?: HttpsProxyAgentOptions)
57
+
58
+ The `HttpsProxyAgent` class implements an `http.Agent` subclass that connects
59
+ to the specified "HTTP(s) proxy server" in order to proxy HTTPS and/or WebSocket
60
+ requests. This is achieved by using the [HTTP `CONNECT` method][CONNECT].
61
+
62
+ The `proxy` argument is the URL for the proxy server.
63
+
64
+ The `options` argument accepts the usual `http.Agent` constructor options, and
65
+ some additional properties:
66
+
67
+ * `headers` - Object containing additional headers to send to the proxy server
68
+ in the `CONNECT` request.
69
+
70
+ [CONNECT]: http://en.wikipedia.org/wiki/HTTP_tunnel#HTTP_CONNECT_Tunneling
@@ -0,0 +1,7 @@
1
+ var k=Object.defineProperty;var d=(n,e)=>k(n,"name",{value:e,configurable:!0});import*as y from"net";import*as m from"tls";import w from"assert";import H from"debug";import{Agent as O}from"agent-base";import{URL as b}from"url";import{parseProxyResponse as A}from"./parse-proxy-response.js";import{createNegotiateAuth as v}from"proxy-agent-negotiate";const p=H("https-proxy-agent"),l=d(n=>n.servername===void 0&&n.host&&!y.isIP(n.host)?{...n,servername:n.host}:n,"setServernameFromNonIpHost");class I extends O{static{d(this,"HttpsProxyAgent")}constructor(e,t){super(t),this.options={path:void 0},this.proxy=typeof e=="string"?new b(e):e,this.proxyHeaders=t?.headers??{},p("Creating new HttpsProxyAgent instance: %o",this.proxy.href),t?.negotiate?this.onProxyAuth=v():t?.onProxyAuth&&(this.onProxyAuth=t.onProxyAuth);const r=(this.proxy.hostname||this.proxy.host).replace(/^\[|\]$/g,""),o=this.proxy.port?parseInt(this.proxy.port,10):this.proxy.protocol==="https:"?443:80;this.connectOpts={ALPNProtocols:["http/1.1"],...t?P(t,"headers","onProxyAuth","negotiate"):null,host:r,port:o}}async connect(e,t){const{proxy:r}=this;if(!t.host)throw new TypeError('No "host" provided');let o;r.protocol==="https:"?(p("Creating `tls.Socket`: %o",this.connectOpts),o=m.connect(l(this.connectOpts))):(p("Creating `net.Socket`: %o",this.connectOpts),o=y.connect(this.connectOpts));const s=typeof this.proxyHeaders=="function"?this.proxyHeaders():{...this.proxyHeaders},c=y.isIPv6(t.host)?`[${t.host}]`:t.host;let f=`CONNECT ${c}:${t.port} HTTP/1.1\r
2
+ `;if(r.username||r.password){const i=`${decodeURIComponent(r.username)}:${decodeURIComponent(r.password)}`;s["Proxy-Authorization"]=`Basic ${Buffer.from(i).toString("base64")}`}s.Host=`${c}:${t.port}`,s["Proxy-Connection"]||(s["Proxy-Connection"]=this.keepAlive?"Keep-Alive":"close");for(const i of Object.keys(s))f+=`${i}: ${s[i]}\r
3
+ `;const x=A(o);o.write(`${f}\r
4
+ `);const{connect:a,buffered:u}=await x;if(e.emit("proxyConnect",a),this.emit("proxyConnect",a,e),e.emit("proxy",{proxy:this.proxy.href,socket:o}),a.statusCode===200)return e.once("socket",C),t.secureEndpoint?(p("Upgrading socket connection to TLS"),m.connect({...P(l(t),"host","path","port"),socket:o})):o;if(a.statusCode===407&&this.onProxyAuth){p("Got 407 response, invoking onProxyAuth callback"),o.destroy();const i=a.headers["proxy-authenticate"]||"",$=Array.isArray(i)?i[0].split(/\s/)[0]:i.split(/\s/)[0],g=await this.onProxyAuth({response:a,scheme:$});return this._connectWithAuth(e,t,g.headers)}o.destroy();const h=new y.Socket({writable:!1});return h.readable=!0,e.once("socket",i=>{p("Replaying proxy buffer for failed request"),w(i.listenerCount("data")>0),i.push(u),i.push(null)}),h}async _connectWithAuth(e,t,r){const{proxy:o}=this;let s;o.protocol==="https:"?s=m.connect(l(this.connectOpts)):s=y.connect(this.connectOpts);const c=typeof this.proxyHeaders=="function"?this.proxyHeaders():{...this.proxyHeaders},f=y.isIPv6(t.host)?`[${t.host}]`:t.host;let x=`CONNECT ${f}:${t.port} HTTP/1.1\r
5
+ `;if(o.username||o.password){const h=`${decodeURIComponent(o.username)}:${decodeURIComponent(o.password)}`;c["Proxy-Authorization"]=`Basic ${Buffer.from(h).toString("base64")}`}Object.assign(c,r),c.Host=`${f}:${t.port}`,c["Proxy-Connection"]||(c["Proxy-Connection"]=this.keepAlive?"Keep-Alive":"close");for(const h of Object.keys(c))x+=`${h}: ${c[h]}\r
6
+ `;const a=A(s);s.write(`${x}\r
7
+ `);const{connect:u}=await a;if(e.emit("proxyConnect",u),this.emit("proxyConnect",u,e),u.statusCode===200)return e.once("socket",C),t.secureEndpoint?(p("Upgrading socket connection to TLS"),m.connect({...P(l(t),"host","path","port"),socket:s})):s;throw s.destroy(),new Error(`Proxy authentication failed with status ${u.statusCode} after retry`)}}I.protocols=["http","https"];function C(n){setImmediate(()=>{n.resume()})}d(C,"resume");function P(n,...e){const t={};let r;for(r in n)e.includes(r)||(t[r]=n[r]);return t}d(P,"omit");export{I as HttpsProxyAgent};
@@ -0,0 +1,4 @@
1
+ var P=Object.defineProperty;var n=(e,c)=>P(e,"name",{value:c,configurable:!0});import T from"debug";const a=T("https-proxy-agent:parse-proxy-response");function H(e){return new Promise((c,t)=>{let x=0;const v=[];function i(){const r=e.read();r?N(r):e.once("readable",i)}n(i,"read");function d(){e.removeListener("end",g),e.removeListener("error",m),e.removeListener("readable",i)}n(d,"cleanup");function g(){d(),a("onend"),t(new Error("Proxy connection ended before receiving CONNECT response"))}n(g,"onend");function m(r){d(),a("onerror %o",r),t(r)}n(m,"onerror");function N(r){v.push(r),x+=r.length;const u=Buffer.concat(v,x),C=u.indexOf(`\r
2
+ \r
3
+ `);if(C===-1){a("have not received end of HTTP headers yet..."),i();return}const b=u.slice(0,C).toString("ascii").split(`\r
4
+ `),p=b.shift();if(!p)return e.destroy(),t(new Error("No header received from proxy CONNECT response"));const L=p.split(" "),E=+L[1],O=L.slice(2).join(" "),o={};for(const s of b){if(!s)continue;const l=s.indexOf(":");if(l===-1)return e.destroy(),t(new Error(`Invalid header from proxy CONNECT response: "${s}"`));const y=s.slice(0,l).toLowerCase(),h=s.slice(l+1).trimStart(),f=o[y];typeof f=="string"?o[y]=[f,h]:Array.isArray(f)?f.push(h):o[y]=h}a("got proxy server response: %o %o",p,o),d(),c({connect:{statusCode:E,statusText:O,headers:o},buffered:u})}n(N,"ondata"),e.on("error",m),e.on("end",g),i()})}n(H,"parseProxyResponse");export{H as parseProxyResponse};
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "https-proxy-agent",
3
+ "version": "9.1.0",
4
+ "type": "module",
5
+ "description": "An HTTP(s) proxy `http.Agent` implementation for HTTPS",
6
+ "exports": {
7
+ "types": "./dist/index.d.ts",
8
+ "default": "./dist/index.js"
9
+ },
10
+ "files": [
11
+ "dist"
12
+ ],
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "https://github.com/TooTallNate/proxy-agents.git",
16
+ "directory": "packages/https-proxy-agent"
17
+ },
18
+ "keywords": [
19
+ "https",
20
+ "proxy",
21
+ "endpoint",
22
+ "agent"
23
+ ],
24
+ "author": "Nathan Rajlich <nathan@tootallnate.net> (http://n8.io/)",
25
+ "license": "MIT",
26
+ "dependencies": {
27
+ "debug": "^4.3.4",
28
+ "agent-base": "9.0.0",
29
+ "proxy-agent-negotiate": "1.1.0"
30
+ },
31
+ "devDependencies": {
32
+ "@types/async-retry": "^1.4.5",
33
+ "@types/debug": "^4.1.7",
34
+ "@types/node": "^22.13.0",
35
+ "async-listen": "^3.0.0",
36
+ "async-retry": "^1.3.3",
37
+ "typescript": "^5.1.6",
38
+ "proxy": "4.1.0",
39
+ "tsconfig": "0.0.0"
40
+ },
41
+ "engines": {
42
+ "node": ">= 20"
43
+ },
44
+ "scripts": {
45
+ "build": "tsc",
46
+ "test": "vitest --exclude test/e2e.test.ts",
47
+ "test-e2e": "vitest run test/e2e.test.ts",
48
+ "lint": "eslint --ext .ts",
49
+ "pack": "node ../../scripts/pack.mjs"
50
+ }
51
+ }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@earendil-works/pi-ai",
3
- "version": "1.0.17",
3
+ "version": "1.0.18",
4
4
  "description": "Unified LLM API with automatic model discovery and provider configuration",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -54,7 +54,7 @@
54
54
  "dependencies": {
55
55
  "@anthropic-ai/sdk": "0.124.0",
56
56
  "@aws-sdk/client-bedrock-runtime": "3.1127.0",
57
- "@earendil-works/pi-telemetry": "^1.0.17",
57
+ "@earendil-works/pi-telemetry": "^1.0.18",
58
58
  "@google/genai": "2.21.0",
59
59
  "@opentelemetry/api": "1.9.0",
60
60
  "@smithy/node-http-handler": "4.12.1",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@earendil-works/pi-client",
3
- "version": "1.0.17",
3
+ "version": "1.0.18",
4
4
  "description": "Transport-neutral client for remote pi sessions over framed CBOR bytes",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -40,7 +40,7 @@
40
40
  "node": ">=22.19.0"
41
41
  },
42
42
  "dependencies": {
43
- "@earendil-works/chord": "^1.0.17",
44
- "@earendil-works/pi-protocol": "^1.0.17"
43
+ "@earendil-works/chord": "^1.0.18",
44
+ "@earendil-works/pi-protocol": "^1.0.18"
45
45
  }
46
46
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@earendil-works/pi-protocol",
3
- "version": "1.0.17",
3
+ "version": "1.0.18",
4
4
  "description": "Transport-neutral CBOR protocol for remote pi sessions",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -33,7 +33,7 @@
33
33
  "node": ">=22.19.0"
34
34
  },
35
35
  "dependencies": {
36
- "@earendil-works/chord": "^1.0.17",
36
+ "@earendil-works/chord": "^1.0.18",
37
37
  "typebox": "1.3.27"
38
38
  }
39
39
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@earendil-works/pi-server",
3
- "version": "1.0.17",
3
+ "version": "1.0.18",
4
4
  "description": "experimental server package for pi",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -39,9 +39,9 @@
39
39
  "node": ">=22.19.0"
40
40
  },
41
41
  "dependencies": {
42
- "@earendil-works/chord": "^1.0.17",
43
- "@earendil-works/pi-agent-core": "^1.0.17",
44
- "@earendil-works/pi-ai": "^1.0.17",
45
- "@earendil-works/pi-protocol": "^1.0.17"
42
+ "@earendil-works/chord": "^1.0.18",
43
+ "@earendil-works/pi-agent-core": "^1.0.18",
44
+ "@earendil-works/pi-ai": "^1.0.18",
45
+ "@earendil-works/pi-protocol": "^1.0.18"
46
46
  }
47
47
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@earendil-works/pi-session-backend-sqlite-node",
3
- "version": "1.0.17",
3
+ "version": "1.0.18",
4
4
  "description": "Node sqlite session backend for @earendil-works/pi-agent-core sessions",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -27,7 +27,7 @@
27
27
  "node": ">=22.19.0"
28
28
  },
29
29
  "dependencies": {
30
- "@earendil-works/pi-ai": "^1.0.17",
31
- "@earendil-works/pi-agent-core": "^1.0.17"
30
+ "@earendil-works/pi-ai": "^1.0.18",
31
+ "@earendil-works/pi-agent-core": "^1.0.18"
32
32
  }
33
33
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@earendil-works/pi-telemetry",
3
- "version": "1.0.17",
3
+ "version": "1.0.18",
4
4
  "description": "Vendor-neutral telemetry contracts and typed schema utilities for pi",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@earendil-works/pi-tui",
3
- "version": "1.0.17",
3
+ "version": "1.0.18",
4
4
  "description": "Terminal User Interface library with differential rendering for efficient text-based applications",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pi-extension-custom-provider",
3
- "version": "0.1.15",
3
+ "version": "0.1.16",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pi-extension-custom-provider",
9
- "version": "0.1.15",
9
+ "version": "0.1.16",
10
10
  "dependencies": {
11
11
  "@anthropic-ai/sdk": "^0.52.0"
12
12
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-extension-custom-provider-anthropic",
3
3
  "private": true,
4
- "version": "0.1.15",
4
+ "version": "0.1.16",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-extension-custom-provider-gitlab-duo",
3
3
  "private": true,
4
- "version": "0.1.15",
4
+ "version": "0.1.16",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pi-extension-gondolin",
3
- "version": "0.1.15",
3
+ "version": "0.1.16",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pi-extension-gondolin",
9
- "version": "0.1.15",
9
+ "version": "0.1.16",
10
10
  "dependencies": {
11
11
  "@earendil-works/gondolin": "0.12.0"
12
12
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-extension-gondolin",
3
3
  "private": true,
4
- "version": "0.1.15",
4
+ "version": "0.1.16",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pi-extension-sandbox",
3
- "version": "1.15.15",
3
+ "version": "1.15.16",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pi-extension-sandbox",
9
- "version": "1.15.15",
9
+ "version": "1.15.16",
10
10
  "dependencies": {
11
11
  "@anthropic-ai/sandbox-runtime": "^0.0.26"
12
12
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-extension-sandbox",
3
3
  "private": true,
4
- "version": "1.15.15",
4
+ "version": "1.15.16",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",