@openclaw/proxyline 0.1.0 → 0.3.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.
@@ -0,0 +1,77 @@
1
+ import type { Agent as HttpAgent } from "node:http";
2
+ import type { Dispatcher } from "undici";
3
+ import type { ProxylineTlsOptions } from "./shared.js";
4
+ export type ProxylineMode = "managed" | "ambient";
5
+ export type ProxylineSurface = "node-http" | "node-https" | "undici" | "websocket" | "connect" | "unknown";
6
+ export type ProxylineOptions = Readonly<{
7
+ mode: ProxylineMode;
8
+ proxyUrl?: string | URL;
9
+ proxyTls?: ProxylineTlsOptions;
10
+ bypassPolicy?: ProxylineBypassPolicy;
11
+ ifActive?: "error" | "reuse-compatible" | "replace";
12
+ onEvent?: (event: ProxylineEvent) => void;
13
+ undici?: ProxylineUndiciOptions;
14
+ }>;
15
+ export type ProxylineDecision = Readonly<{
16
+ kind: "proxied" | "direct" | "blocked";
17
+ reason: string;
18
+ surface: ProxylineSurface;
19
+ url: string;
20
+ proxyUrl?: string;
21
+ }>;
22
+ export type ProxylineBypassRequest = Readonly<{
23
+ surface: ProxylineSurface;
24
+ url: string;
25
+ }>;
26
+ export type ProxylineBypassPolicy = (request: ProxylineBypassRequest) => boolean;
27
+ export type ProxylineEvent = Readonly<{
28
+ type: "runtime.installed";
29
+ mode: ProxylineMode;
30
+ active: boolean;
31
+ proxyUrl?: string;
32
+ }> | Readonly<{
33
+ type: "runtime.stopped";
34
+ mode: ProxylineMode;
35
+ }> | Readonly<{
36
+ type: "decision";
37
+ decision: ProxylineDecision;
38
+ }> | Readonly<{
39
+ type: "warning";
40
+ code: string;
41
+ message: string;
42
+ }>;
43
+ export type ExplainOptions = Readonly<{
44
+ surface?: ProxylineSurface;
45
+ }>;
46
+ export type ProxylineBypassRegistration = Readonly<{
47
+ surface?: ProxylineSurface;
48
+ url: string | URL;
49
+ }>;
50
+ export type ProxylineUndiciOptions = Readonly<{
51
+ allowH2?: boolean;
52
+ bodyTimeout?: number;
53
+ headersTimeout?: number;
54
+ connect?: Readonly<{
55
+ autoSelectFamily?: boolean;
56
+ autoSelectFamilyAttemptTimeout?: number;
57
+ }>;
58
+ }>;
59
+ export type ProxylineHandle = Readonly<{
60
+ mode: ProxylineMode;
61
+ active: boolean;
62
+ proxyUrl?: string;
63
+ createNodeAgent: () => HttpAgent;
64
+ createUndiciDispatcher: () => Dispatcher;
65
+ createWebSocketAgent: () => HttpAgent;
66
+ explain: (url: string | URL, options?: ExplainOptions) => ProxylineDecision;
67
+ registerBypass: (registration: ProxylineBypassRegistration) => () => void;
68
+ stop: () => void;
69
+ withBypass: <T>(registration: ProxylineBypassRegistration, run: () => T) => T;
70
+ }>;
71
+ export type ProxyResolver = Readonly<{
72
+ active: boolean;
73
+ describeProxy: () => string | undefined;
74
+ explain: (url: string | URL, surface: ProxylineSurface) => ProxylineDecision;
75
+ getProxyForUrl: (url: string, surface?: ProxylineSurface) => string;
76
+ }>;
77
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEvD,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,SAAS,CAAC;AAElD,MAAM,MAAM,gBAAgB,GACxB,WAAW,GACX,YAAY,GACZ,QAAQ,GACR,WAAW,GACX,SAAS,GACT,SAAS,CAAC;AAEd,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CAAC;IACtC,IAAI,EAAE,aAAa,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;IACxB,QAAQ,CAAC,EAAE,mBAAmB,CAAC;IAC/B,YAAY,CAAC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,GAAG,GAAG,EAAE,OAAO,EAAE,gBAAgB,KAAK,iBAAiB,CAAC;IAC7E,cAAc,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,gBAAgB,KAAK,MAAM,CAAC;CACrE,CAAC,CAAC"}
package/dist/types.js ADDED
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openclaw/proxyline",
3
- "version": "0.1.0",
3
+ "version": "0.3.0",
4
4
  "description": "Process-global proxy routing for Node.js.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -17,10 +17,15 @@
17
17
  "url": "https://github.com/openclaw/proxyline/issues"
18
18
  },
19
19
  "homepage": "https://proxyline.dev",
20
+ "packageManager": "pnpm@10.33.2",
20
21
  "exports": {
21
22
  ".": {
22
23
  "types": "./dist/index.d.ts",
23
24
  "default": "./dist/index.js"
25
+ },
26
+ "./dispatcher-brand": {
27
+ "types": "./dist/dispatcher-brand.d.ts",
28
+ "default": "./dist/dispatcher-brand.js"
24
29
  }
25
30
  },
26
31
  "files": [
@@ -31,27 +36,31 @@
31
36
  "README.md",
32
37
  "LICENSE"
33
38
  ],
39
+ "scripts": {
40
+ "build": "tsc -p tsconfig.build.json",
41
+ "check": "pnpm build && tsc --noEmit && pnpm coverage:run",
42
+ "coverage": "pnpm build && pnpm coverage:run",
43
+ "coverage:run": "node scripts/run-coverage.mjs",
44
+ "docs:build": "node scripts/build-docs-site.mjs",
45
+ "package:dry-run": "pnpm pack --dry-run",
46
+ "prepack": "node scripts/prepack-build.mjs",
47
+ "prepare": "node scripts/prepack-build.mjs",
48
+ "publish:dry-run": "pnpm publish --dry-run --access public",
49
+ "test": "pnpm build && tsx --test test/index.test.ts test/e2e.test.ts test/package.test.ts",
50
+ "typecheck": "pnpm build && tsc --noEmit"
51
+ },
34
52
  "devDependencies": {
35
- "@types/node": "^20.19.25",
53
+ "@types/node": "^20.19.40",
36
54
  "@types/ws": "^8.18.1",
37
55
  "tsx": "^4.21.0",
38
56
  "typescript": "^5.9.3",
57
+ "undici": "^7.25.0",
39
58
  "ws": "^8.20.0"
40
59
  },
41
60
  "engines": {
42
- "node": ">=20"
61
+ "node": ">=20.18.1"
43
62
  },
44
- "dependencies": {
45
- "proxy-agent": "^8.0.1",
46
- "undici": "^7.25.0"
47
- },
48
- "scripts": {
49
- "build": "tsc -p tsconfig.build.json",
50
- "check": "pnpm typecheck && pnpm test && pnpm build",
51
- "docs:build": "node scripts/build-docs-site.mjs",
52
- "package:dry-run": "pnpm pack --dry-run",
53
- "publish:dry-run": "pnpm publish --dry-run --access public",
54
- "test": "tsx --test test/index.test.ts test/e2e.test.ts",
55
- "typecheck": "tsc --noEmit"
63
+ "peerDependencies": {
64
+ "undici": ">=7.25.0 <9"
56
65
  }
57
- }
66
+ }