planx 20.87.0 → 20.88.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/agent.main.mjs +1 -1
- package/blob.main.mjs +2 -2
- package/config.main.mjs +2 -2
- package/domain.main.mjs +2 -2
- package/egress.main.mjs +2 -2
- package/explorer.main.mjs +1 -1
- package/filesystem.main.mjs +2 -2
- package/intelligence.main.mjs +1 -1
- package/log.main.mjs +1 -1
- package/nosturn.main.mjs +1 -1
- package/package.json +7 -7
- package/planx-networkd.main.mjs +1 -1
- package/presentation.main.mjs +1 -1
- package/session.main.mjs +1 -1
- package/transport.main.mjs +1 -1
package/intelligence.main.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
globalThis.__PLANX_SERVICE_VERSION__="20.
|
|
1
|
+
globalThis.__PLANX_SERVICE_VERSION__="20.88.0";
|
|
2
2
|
import*as fo from"node:fs";import{join as LOe}from"node:path";import{join as Ql}from"node:path";var jn=["You condense the output of a coding-agent tool call so a stronger model can continue the task with fewer tokens.","Keep everything the next step may depend on: file paths, identifiers, error messages, numbers, exit status, final state.","Error messages, exit status and final state are always kept, whatever the instruction says.",'The "Recent instruction" is what the agent is trying to establish with this call: whatever directly answers it must be kept verbatim (code lines included); if the answer is that something is absent, state that absence explicitly; everything else may be folded aggressively.',"Extract only. Do not add interpretations, conclusions or advice that are not in the output.","The instruction is only a guide to what matters; never restate it, and never write about task progress, remaining steps or what the agent should do next, since none of that is in the output.","Write in the language of the tool output (usually English), not the language of the instruction.","Remove repetition, decoration, progress output and anything derivable from the retained lines.","Do not alter, reformat or paraphrase paths, identifiers, code lines or error text; copy them verbatim.",'Reply with the condensed text only, starting with "[llm]" on the first line. Be strictly shorter than the input.'].join(" ");function tT(e){let t=typeof e.toolInput=="string"?e.toolInput:JSON.stringify(e.toolInput??{}),r=e.instruction?`
|
|
3
3
|
Recent instruction: ${e.instruction}`:"";return`Tool: ${e.toolName}
|
|
4
4
|
Input: ${t}${r}
|
package/log.main.mjs
CHANGED
package/nosturn.main.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "planx",
|
|
3
|
-
"version": "20.
|
|
3
|
+
"version": "20.88.0",
|
|
4
4
|
"author": "Nozomu Miyamoto",
|
|
5
5
|
"description": "planx — Angular DI ベースの machina ターミナルマルチプレクサ / ピアセッション管理 CLI",
|
|
6
6
|
"type": "module",
|
|
@@ -50,12 +50,12 @@
|
|
|
50
50
|
"ws": "8.22.0"
|
|
51
51
|
},
|
|
52
52
|
"optionalDependencies": {
|
|
53
|
-
"@fails-components/webtransport-transport-http3-quiche": "npm:@10p.io/webtransport-quiche@20.
|
|
54
|
-
"@10p.io/tunnel-darwin-arm64": "20.
|
|
55
|
-
"@10p.io/tunnel-darwin-x64": "20.
|
|
56
|
-
"@10p.io/tunnel-linux-x64-gnu": "20.
|
|
57
|
-
"@10p.io/tunnel-linux-arm64-gnu": "20.
|
|
58
|
-
"@10p.io/tunnel-linux-x64-musl": "20.
|
|
53
|
+
"@fails-components/webtransport-transport-http3-quiche": "npm:@10p.io/webtransport-quiche@20.88.0",
|
|
54
|
+
"@10p.io/tunnel-darwin-arm64": "20.88.0",
|
|
55
|
+
"@10p.io/tunnel-darwin-x64": "20.88.0",
|
|
56
|
+
"@10p.io/tunnel-linux-x64-gnu": "20.88.0",
|
|
57
|
+
"@10p.io/tunnel-linux-arm64-gnu": "20.88.0",
|
|
58
|
+
"@10p.io/tunnel-linux-x64-musl": "20.88.0",
|
|
59
59
|
"onnxruntime-node": "1.30.0"
|
|
60
60
|
},
|
|
61
61
|
"publishConfig": {
|
package/planx-networkd.main.mjs
CHANGED
|
@@ -72,7 +72,7 @@ StandardError=append:/var/log/planx-networkd.err.log
|
|
|
72
72
|
|
|
73
73
|
[Install]
|
|
74
74
|
WantedBy=multi-user.target
|
|
75
|
-
`});import{writeFileSync as Ir,mkdirSync as $r,unlinkSync as Ur}from"node:fs";import{execFileSync as Br}from"node:child_process";function Ve(e){if(e.getuid&&e.getuid()!==0)throw new Error("must run as root (try: sudo planx network install)")}var Hr,b,Fe=B(()=>{Hr=typeof process.getuid=="function"?process.getuid.bind(process):void 0,b={writeFile:(e,t)=>Ir(e,t),mkdir:e=>$r(e,{recursive:!0}),exec:(e,t)=>Br(e,t,{stdio:"inherit"}),log:e=>console.log(e),platform:process.platform,getuid:Hr,rm:e=>{try{Ur(e)}catch{}}}});import{dirname as K}from"node:path";function z(e,t=b){t.mkdir(K(C)),t.writeFile(C,ie(e.nodePath,e.bundlePath)),t.exec("chmod",["755",C]),t.log(`[planx-networkd install] installed launcher: ${C} -> ${e.bundlePath}`)}function fe(e=b){e.mkdir(K(A)),e.writeFile(A,ue);try{e.exec("launchctl",["bootout",`system/${He}`])}catch{}e.exec("launchctl",["bootstrap","system",A]),e.log(`[planx-networkd install] installed launchd unit: ${A}`)}function pe(e=b){e.mkdir(K(P)),e.writeFile(P,de),e.exec("systemctl",["daemon-reload"]),e.exec("systemctl",["enable","--now","planx-networkd"]),e.log(`[planx-networkd install] installed systemd unit: ${P}`)}function he(e=b){e.mkdir(K(R)),e.writeFile(R,ce),e.log(`[planx-networkd install] installed macOS resolver hook: ${R}`)}function me(e=b){e.mkdir(K(N)),e.writeFile(N,le),e.exec("systemctl",["reload-or-restart","systemd-resolved"]),e.log(`[planx-networkd install] installed Linux resolved zone config: ${N}`)}function ge(e=b){try{e.exec("launchctl",["bootout",`system/${He}`])}catch{}e.rm?.(A),e.log(`[planx-networkd uninstall] removed launchd unit: ${A}`)}function ye(e=b){try{e.exec("systemctl",["disable","--now","planx-networkd"])}catch{}e.rm?.(P);try{e.exec("systemctl",["daemon-reload"])}catch{}e.log(`[planx-networkd uninstall] removed systemd unit: ${P}`)}function G(e=b){e.rm?.(C),e.log(`[planx-networkd uninstall] removed launcher: ${C}`)}function Se(e=b){e.rm?.(R),e.log(`[planx-networkd uninstall] removed macOS resolver hook: ${R}`)}function be(e=b){e.rm?.(N);try{e.exec("systemctl",["reload-or-restart","systemd-resolved"])}catch{}e.log(`[planx-networkd uninstall] removed Linux resolved zone config: ${N}`)}var je=B(()=>{Me();Fe()});var At={};Rt(At,{LAUNCHD_DEST:()=>A,LAUNCHD_PLIST:()=>ue,LINUX_RESOLVED_CONTENT:()=>le,LINUX_RESOLVED_DEST:()=>N,MACOS_RESOLVER_CONTENT:()=>ce,MACOS_RESOLVER_DEST:()=>R,NETWORKD_BIN_DEST:()=>C,RESOLVER_DNS_PORT:()=>ae,SYSTEMD_DEST:()=>P,SYSTEMD_UNIT:()=>de,buildNetworkdWrapper:()=>ie,installLaunchd:()=>fe,installLinuxResolved:()=>me,installMacosResolver:()=>he,installNetworkdBin:()=>z,installSystemd:()=>pe,runInstall:()=>Mr,runUninstall:()=>Vr,uninstallLaunchd:()=>ge,uninstallLinuxResolved:()=>be,uninstallMacosResolver:()=>Se,uninstallNetworkdBin:()=>G,uninstallSystemd:()=>ye});async function Mr(e=b,t){if(Ve(e),e.platform==="darwin"){t&&z(t,e),fe(e),he(e);return}if(e.platform==="linux"){t&&z(t,e),pe(e),me(e);return}if(e.platform==="win32"){e.log("[planx-networkd install] Windows: use NSSM or sc.exe to register `planx-networkd` as a service.");return}throw new Error(`unsupported platform: ${e.platform}`)}async function Vr(e=b){if(Ve(e),e.platform==="darwin"){ge(e),G(e),Se(e);return}if(e.platform==="linux"){ye(e),G(e),be(e);return}if(e.platform==="win32"){e.log("[planx-networkd uninstall] Windows: remove the `planx-networkd` service via NSSM or sc.exe delete.");return}throw new Error(`unsupported platform: ${e.platform}`)}var Ot=B(()=>{Me();je();Fe();je()});import{createServer as jr}from"node:http";import{existsSync as Kr,unlinkSync as Dt,chmodSync as zr}from"node:fs";import{createRequire as Nt}from"node:module";import{readFileSync as Lt}from"node:fs";function It(){try{let e=Lt("/usr/bin/ldd","utf8");return/musl/i.test(e)?"musl":"gnu"}catch{return"gnu"}}function $t(e=process.platform,t=process.arch){if(e==="darwin")return`@10p.io/tunnel-darwin-${t}`;if(e==="linux")return`@10p.io/tunnel-linux-${t}-${It()}`;if(e==="win32")return`@10p.io/tunnel-win32-${t}-msvc`;throw new Error(`[planx-networkd] unsupported platform: ${e}/${t}`)}function Ke(e){let t=()=>{throw new Error(`[planx-networkd] native binding unavailable: ${e}`)};return{setupVnet:t,addSelfAddress:t,addPeerAddress:t,removePeerAddress:t,injectTcpData:t,injectTcpClose:t,setEgressCapture:t,injectUdpDatagram:t,onEvent:t,offEvent:t}}function Ut(){let e=$t();try{let r=Nt(import.meta.url)(e);return!r||typeof r.setupVnet!="function"?Ke(`subpackage ${e} loaded but missing exports`):r}catch(t){return Ke(`${e} not installed (${t.message})`)}}var xe=null;function w(){return xe||(xe=Ut()),xe}var Zr=new Proxy({},{get(e,t){return w()[t]}});var Bt=new Date(Date.now()-process.uptime()*1e3).toISOString();function Ht(){let e=w();if(typeof e.version!="function")return"unknown";try{return e.version()}catch{return"unavailable"}}function ze(){return{version:"20.87.0",nativeVersion:Ht(),uptime:Math.floor(process.uptime()),pid:process.pid,platform:process.platform,arch:process.arch,nodeVersion:process.version,startedAt:Bt}}var H=null;function U(){return H}function we(e,t){if(e.enabled&&!e.socksPort)throw new Error("egress capture \u3092 on \u306B\u3059\u308B\u306B\u306F socksPort (front door \u306E port) \u304C\u8981\u308B");if(!e.enabled&&e.socksPort&&H!==null&&e.socksPort!==H)return{bypass:[],failed:[`front door ${H} \u304C capture \u3057\u3066\u3044\u308B\u306E\u3067 ${e.socksPort} \u304B\u3089\u306E off \u306F\u7121\u8996\u3057\u305F`]};let r=t.setEgressCapture({enabled:e.enabled,bypass:e.enabled?e.bypass:[],ipv6:e.enabled&&e.ipv6===!0});return H=e.enabled?e.socksPort??null:null,r}var Mt={"/health":()=>ze(),"/egress/capture/status":()=>({socksPort:U()})};function W(e,t,r){e.writeHead(t,{"content-type":"application/json"}),e.end(JSON.stringify(r))}function Ge(e,t){let r=(e.url??"/").split("?")[0],n=Mt[r];if(!n)return W(t,404,{error:`not found: ${r}`});if(e.method!=="GET")return W(t,405,{error:`method not allowed: ${e.method}`});try{W(t,200,n())}catch(s){W(t,500,{error:s instanceof Error?s.message:String(s)})}}var Vt="/var/run/planx-networkd.sock",Ft="\\\\.\\pipe\\planx-networkd";function Ye(e=process.platform){return e==="win32"?Ft:Vt}import*as ct from"node:net";function L(e){let t=e.split(":");if(t.length!==8||t.some(r=>!/^[0-9a-fA-F]{1,4}$/.test(r)))throw new Error(`[planx-networkd] invalid hip string (expected 8 full groups): "${e}"`);return t.map(r=>r.toLowerCase().padStart(4,"0")).join(":")}function Ee(e){let t=new Uint8Array(16);return L(e).split(":").forEach((r,n)=>{let s=parseInt(r,16);t[n*2]=s>>8,t[n*2+1]=s&255}),t}function Te(e){if(e.length!==16)throw new Error(`[planx-networkd] invalid hip bytes (expected 16, got ${e.length})`);let t=[];for(let r=0;r<16;r+=2)t.push(((e[r]<<8|e[r+1])>>>0).toString(16).padStart(4,"0"));return t.join(":")}import{Buffer as nt}from"node:buffer";var ke,Xe=!!globalThis.__webrtcProxyDebug||typeof process<"u"&&!!(!((ke=process.env)===null||ke===void 0)&&ke.PLANX_PROXY_DEBUG);var M;(function(e){e[e.Success=0]="Success",e[e.GeneralFailure=1]="GeneralFailure",e[e.ConnectionNotAllowed=2]="ConnectionNotAllowed",e[e.NetworkUnreachable=3]="NetworkUnreachable",e[e.HostUnreachable=4]="HostUnreachable",e[e.ConnectionRefused=5]="ConnectionRefused",e[e.TtlExpired=6]="TtlExpired",e[e.CommandNotSupported=7]="CommandNotSupported",e[e.AddressTypeNotSupported=8]="AddressTypeNotSupported"})(M||(M={}));var k=1,I=3,v=4;var Zt={[k]:4,[v]:16},$=class{constructor(){this.buf=Buffer.alloc(0),this.methodDone=!1,this.replyDone=!1}push(t){this.buf=this.buf.length===0?t:Buffer.concat([this.buf,t])}takeMethodReply(){if(this.methodDone||this.buf.length<2)return null;if(this.buf[0]!==5)throw new Error(`[socks] method reply unsupported version: ${this.buf[0]}`);let t=this.buf[1];return this.buf=this.buf.subarray(2),this.methodDone=!0,{method:t}}takeConnectReply(){if(!this.methodDone||this.replyDone||this.buf.length<4)return null;if(this.buf[0]!==5)throw new Error(`[socks] connect reply unsupported version: ${this.buf[0]}`);let t=this.buf[3],r=t===I?this.buf.length<5?null:this.buf[4]+1:Zt[t];if(r===void 0)throw new Error(`[socks] connect reply unsupported ATYP: ${t}`);if(r===null)return null;let n=4+r+2;if(this.buf.length<n)return null;let s=this.buf[1],l=this.buf[n-2]<<8|this.buf[n-1];return this.buf=this.buf.subarray(n),this.replyDone=!0,{reply:s,atyp:t,bndPort:l}}drainRest(){let t=this.buf;return this.buf=Buffer.alloc(0),t}};var D=e=>new Error(`socks address: ${e}`);function V(e,t){if(!Number.isInteger(t)||t<0||t>65535)throw D(`port out of range: ${t}`);let r=[t>>8,t&255];if(e.kind==="ipv4"){if(e.addr.length!==4)throw D("ipv4 must be 4 bytes");return Uint8Array.from([k,...e.addr,...r])}if(e.kind==="ipv6"){if(e.addr.length!==16)throw D("ipv6 must be 16 bytes");return Uint8Array.from([v,...e.addr,...r])}let n=new TextEncoder().encode(e.name);if(n.length===0||n.length>255)throw D(`domain length ${n.length} is not in 1..255`);return Uint8Array.from([I,n.length,...n,...r])}function Qt(e){if(e.length===0)throw D("empty");let t=e[0];if(t===k)return{address:{kind:"ipv4",addr:e.slice(1,5)},end:5};if(t===v)return{address:{kind:"ipv6",addr:e.slice(1,17)},end:17};if(t===I){if(e.length<2)throw D("domain length missing");let r=2+e[1];return{address:{kind:"domain",name:new TextDecoder().decode(e.slice(2,r))},end:r}}throw D(`unknown atyp 0x${t.toString(16)}`)}function Ce(e){let{address:t,end:r}=Qt(e);if(e.length<r+2)throw D(`truncated (${e.length} < ${r+2})`);return{address:t,port:e[r]<<8|e[r+1],length:r+2}}function Ae(e,t=0){return Buffer.from([5,1,t,...e])}var Oe=e=>new Error(`socks udp: ${e}`),er=Uint8Array.of(k,0,0,0,0,0,0);function De(e,t){let r=new Uint8Array(3+e.length+t.length);return r.set(e,3),r.set(t,3+e.length),r}function Pe(e){if(e.length<3)throw Oe(`too short (${e.length})`);if(e[0]!==0||e[1]!==0)throw Oe("reserved bytes must be 0");let t;try{t=Ce(e.subarray(3))}catch(r){throw Oe(r instanceof Error?r.message:String(r))}return{frag:e[2],target:t,data:e.subarray(3+t.length)}}function Re(e=er){return Buffer.from([5,3,0,...e])}function F(){return Buffer.from([5,1,0])}function Ne(e,t){if(e.length!==16)throw new Error(`[socks] connect request addr must be 16 bytes, got ${e.length}`);let r=Buffer.alloc(22);return r.set([5,1,0,v],0),r.set(e,4),r.writeUInt16BE(t&65535,20),r}var J=new TextEncoder,Le=new TextDecoder;var fs=J.encode(`0\r
|
|
75
|
+
`});import{writeFileSync as Ir,mkdirSync as $r,unlinkSync as Ur}from"node:fs";import{execFileSync as Br}from"node:child_process";function Ve(e){if(e.getuid&&e.getuid()!==0)throw new Error("must run as root (try: sudo planx network install)")}var Hr,b,Fe=B(()=>{Hr=typeof process.getuid=="function"?process.getuid.bind(process):void 0,b={writeFile:(e,t)=>Ir(e,t),mkdir:e=>$r(e,{recursive:!0}),exec:(e,t)=>Br(e,t,{stdio:"inherit"}),log:e=>console.log(e),platform:process.platform,getuid:Hr,rm:e=>{try{Ur(e)}catch{}}}});import{dirname as K}from"node:path";function z(e,t=b){t.mkdir(K(C)),t.writeFile(C,ie(e.nodePath,e.bundlePath)),t.exec("chmod",["755",C]),t.log(`[planx-networkd install] installed launcher: ${C} -> ${e.bundlePath}`)}function fe(e=b){e.mkdir(K(A)),e.writeFile(A,ue);try{e.exec("launchctl",["bootout",`system/${He}`])}catch{}e.exec("launchctl",["bootstrap","system",A]),e.log(`[planx-networkd install] installed launchd unit: ${A}`)}function pe(e=b){e.mkdir(K(P)),e.writeFile(P,de),e.exec("systemctl",["daemon-reload"]),e.exec("systemctl",["enable","--now","planx-networkd"]),e.log(`[planx-networkd install] installed systemd unit: ${P}`)}function he(e=b){e.mkdir(K(R)),e.writeFile(R,ce),e.log(`[planx-networkd install] installed macOS resolver hook: ${R}`)}function me(e=b){e.mkdir(K(N)),e.writeFile(N,le),e.exec("systemctl",["reload-or-restart","systemd-resolved"]),e.log(`[planx-networkd install] installed Linux resolved zone config: ${N}`)}function ge(e=b){try{e.exec("launchctl",["bootout",`system/${He}`])}catch{}e.rm?.(A),e.log(`[planx-networkd uninstall] removed launchd unit: ${A}`)}function ye(e=b){try{e.exec("systemctl",["disable","--now","planx-networkd"])}catch{}e.rm?.(P);try{e.exec("systemctl",["daemon-reload"])}catch{}e.log(`[planx-networkd uninstall] removed systemd unit: ${P}`)}function G(e=b){e.rm?.(C),e.log(`[planx-networkd uninstall] removed launcher: ${C}`)}function Se(e=b){e.rm?.(R),e.log(`[planx-networkd uninstall] removed macOS resolver hook: ${R}`)}function be(e=b){e.rm?.(N);try{e.exec("systemctl",["reload-or-restart","systemd-resolved"])}catch{}e.log(`[planx-networkd uninstall] removed Linux resolved zone config: ${N}`)}var je=B(()=>{Me();Fe()});var At={};Rt(At,{LAUNCHD_DEST:()=>A,LAUNCHD_PLIST:()=>ue,LINUX_RESOLVED_CONTENT:()=>le,LINUX_RESOLVED_DEST:()=>N,MACOS_RESOLVER_CONTENT:()=>ce,MACOS_RESOLVER_DEST:()=>R,NETWORKD_BIN_DEST:()=>C,RESOLVER_DNS_PORT:()=>ae,SYSTEMD_DEST:()=>P,SYSTEMD_UNIT:()=>de,buildNetworkdWrapper:()=>ie,installLaunchd:()=>fe,installLinuxResolved:()=>me,installMacosResolver:()=>he,installNetworkdBin:()=>z,installSystemd:()=>pe,runInstall:()=>Mr,runUninstall:()=>Vr,uninstallLaunchd:()=>ge,uninstallLinuxResolved:()=>be,uninstallMacosResolver:()=>Se,uninstallNetworkdBin:()=>G,uninstallSystemd:()=>ye});async function Mr(e=b,t){if(Ve(e),e.platform==="darwin"){t&&z(t,e),fe(e),he(e);return}if(e.platform==="linux"){t&&z(t,e),pe(e),me(e);return}if(e.platform==="win32"){e.log("[planx-networkd install] Windows: use NSSM or sc.exe to register `planx-networkd` as a service.");return}throw new Error(`unsupported platform: ${e.platform}`)}async function Vr(e=b){if(Ve(e),e.platform==="darwin"){ge(e),G(e),Se(e);return}if(e.platform==="linux"){ye(e),G(e),be(e);return}if(e.platform==="win32"){e.log("[planx-networkd uninstall] Windows: remove the `planx-networkd` service via NSSM or sc.exe delete.");return}throw new Error(`unsupported platform: ${e.platform}`)}var Ot=B(()=>{Me();je();Fe();je()});import{createServer as jr}from"node:http";import{existsSync as Kr,unlinkSync as Dt,chmodSync as zr}from"node:fs";import{createRequire as Nt}from"node:module";import{readFileSync as Lt}from"node:fs";function It(){try{let e=Lt("/usr/bin/ldd","utf8");return/musl/i.test(e)?"musl":"gnu"}catch{return"gnu"}}function $t(e=process.platform,t=process.arch){if(e==="darwin")return`@10p.io/tunnel-darwin-${t}`;if(e==="linux")return`@10p.io/tunnel-linux-${t}-${It()}`;if(e==="win32")return`@10p.io/tunnel-win32-${t}-msvc`;throw new Error(`[planx-networkd] unsupported platform: ${e}/${t}`)}function Ke(e){let t=()=>{throw new Error(`[planx-networkd] native binding unavailable: ${e}`)};return{setupVnet:t,addSelfAddress:t,addPeerAddress:t,removePeerAddress:t,injectTcpData:t,injectTcpClose:t,setEgressCapture:t,injectUdpDatagram:t,onEvent:t,offEvent:t}}function Ut(){let e=$t();try{let r=Nt(import.meta.url)(e);return!r||typeof r.setupVnet!="function"?Ke(`subpackage ${e} loaded but missing exports`):r}catch(t){return Ke(`${e} not installed (${t.message})`)}}var xe=null;function w(){return xe||(xe=Ut()),xe}var Zr=new Proxy({},{get(e,t){return w()[t]}});var Bt=new Date(Date.now()-process.uptime()*1e3).toISOString();function Ht(){let e=w();if(typeof e.version!="function")return"unknown";try{return e.version()}catch{return"unavailable"}}function ze(){return{version:"20.88.0",nativeVersion:Ht(),uptime:Math.floor(process.uptime()),pid:process.pid,platform:process.platform,arch:process.arch,nodeVersion:process.version,startedAt:Bt}}var H=null;function U(){return H}function we(e,t){if(e.enabled&&!e.socksPort)throw new Error("egress capture \u3092 on \u306B\u3059\u308B\u306B\u306F socksPort (front door \u306E port) \u304C\u8981\u308B");if(!e.enabled&&e.socksPort&&H!==null&&e.socksPort!==H)return{bypass:[],failed:[`front door ${H} \u304C capture \u3057\u3066\u3044\u308B\u306E\u3067 ${e.socksPort} \u304B\u3089\u306E off \u306F\u7121\u8996\u3057\u305F`]};let r=t.setEgressCapture({enabled:e.enabled,bypass:e.enabled?e.bypass:[],ipv6:e.enabled&&e.ipv6===!0});return H=e.enabled?e.socksPort??null:null,r}var Mt={"/health":()=>ze(),"/egress/capture/status":()=>({socksPort:U()})};function W(e,t,r){e.writeHead(t,{"content-type":"application/json"}),e.end(JSON.stringify(r))}function Ge(e,t){let r=(e.url??"/").split("?")[0],n=Mt[r];if(!n)return W(t,404,{error:`not found: ${r}`});if(e.method!=="GET")return W(t,405,{error:`method not allowed: ${e.method}`});try{W(t,200,n())}catch(s){W(t,500,{error:s instanceof Error?s.message:String(s)})}}var Vt="/var/run/planx-networkd.sock",Ft="\\\\.\\pipe\\planx-networkd";function Ye(e=process.platform){return e==="win32"?Ft:Vt}import*as ct from"node:net";function L(e){let t=e.split(":");if(t.length!==8||t.some(r=>!/^[0-9a-fA-F]{1,4}$/.test(r)))throw new Error(`[planx-networkd] invalid hip string (expected 8 full groups): "${e}"`);return t.map(r=>r.toLowerCase().padStart(4,"0")).join(":")}function Ee(e){let t=new Uint8Array(16);return L(e).split(":").forEach((r,n)=>{let s=parseInt(r,16);t[n*2]=s>>8,t[n*2+1]=s&255}),t}function Te(e){if(e.length!==16)throw new Error(`[planx-networkd] invalid hip bytes (expected 16, got ${e.length})`);let t=[];for(let r=0;r<16;r+=2)t.push(((e[r]<<8|e[r+1])>>>0).toString(16).padStart(4,"0"));return t.join(":")}import{Buffer as nt}from"node:buffer";var ke,Xe=!!globalThis.__webrtcProxyDebug||typeof process<"u"&&!!(!((ke=process.env)===null||ke===void 0)&&ke.PLANX_PROXY_DEBUG);var M;(function(e){e[e.Success=0]="Success",e[e.GeneralFailure=1]="GeneralFailure",e[e.ConnectionNotAllowed=2]="ConnectionNotAllowed",e[e.NetworkUnreachable=3]="NetworkUnreachable",e[e.HostUnreachable=4]="HostUnreachable",e[e.ConnectionRefused=5]="ConnectionRefused",e[e.TtlExpired=6]="TtlExpired",e[e.CommandNotSupported=7]="CommandNotSupported",e[e.AddressTypeNotSupported=8]="AddressTypeNotSupported"})(M||(M={}));var k=1,I=3,v=4;var Zt={[k]:4,[v]:16},$=class{constructor(){this.buf=Buffer.alloc(0),this.methodDone=!1,this.replyDone=!1}push(t){this.buf=this.buf.length===0?t:Buffer.concat([this.buf,t])}takeMethodReply(){if(this.methodDone||this.buf.length<2)return null;if(this.buf[0]!==5)throw new Error(`[socks] method reply unsupported version: ${this.buf[0]}`);let t=this.buf[1];return this.buf=this.buf.subarray(2),this.methodDone=!0,{method:t}}takeConnectReply(){if(!this.methodDone||this.replyDone||this.buf.length<4)return null;if(this.buf[0]!==5)throw new Error(`[socks] connect reply unsupported version: ${this.buf[0]}`);let t=this.buf[3],r=t===I?this.buf.length<5?null:this.buf[4]+1:Zt[t];if(r===void 0)throw new Error(`[socks] connect reply unsupported ATYP: ${t}`);if(r===null)return null;let n=4+r+2;if(this.buf.length<n)return null;let s=this.buf[1],l=this.buf[n-2]<<8|this.buf[n-1];return this.buf=this.buf.subarray(n),this.replyDone=!0,{reply:s,atyp:t,bndPort:l}}drainRest(){let t=this.buf;return this.buf=Buffer.alloc(0),t}};var D=e=>new Error(`socks address: ${e}`);function V(e,t){if(!Number.isInteger(t)||t<0||t>65535)throw D(`port out of range: ${t}`);let r=[t>>8,t&255];if(e.kind==="ipv4"){if(e.addr.length!==4)throw D("ipv4 must be 4 bytes");return Uint8Array.from([k,...e.addr,...r])}if(e.kind==="ipv6"){if(e.addr.length!==16)throw D("ipv6 must be 16 bytes");return Uint8Array.from([v,...e.addr,...r])}let n=new TextEncoder().encode(e.name);if(n.length===0||n.length>255)throw D(`domain length ${n.length} is not in 1..255`);return Uint8Array.from([I,n.length,...n,...r])}function Qt(e){if(e.length===0)throw D("empty");let t=e[0];if(t===k)return{address:{kind:"ipv4",addr:e.slice(1,5)},end:5};if(t===v)return{address:{kind:"ipv6",addr:e.slice(1,17)},end:17};if(t===I){if(e.length<2)throw D("domain length missing");let r=2+e[1];return{address:{kind:"domain",name:new TextDecoder().decode(e.slice(2,r))},end:r}}throw D(`unknown atyp 0x${t.toString(16)}`)}function Ce(e){let{address:t,end:r}=Qt(e);if(e.length<r+2)throw D(`truncated (${e.length} < ${r+2})`);return{address:t,port:e[r]<<8|e[r+1],length:r+2}}function Ae(e,t=0){return Buffer.from([5,1,t,...e])}var Oe=e=>new Error(`socks udp: ${e}`),er=Uint8Array.of(k,0,0,0,0,0,0);function De(e,t){let r=new Uint8Array(3+e.length+t.length);return r.set(e,3),r.set(t,3+e.length),r}function Pe(e){if(e.length<3)throw Oe(`too short (${e.length})`);if(e[0]!==0||e[1]!==0)throw Oe("reserved bytes must be 0");let t;try{t=Ce(e.subarray(3))}catch(r){throw Oe(r instanceof Error?r.message:String(r))}return{frag:e[2],target:t,data:e.subarray(3+t.length)}}function Re(e=er){return Buffer.from([5,3,0,...e])}function F(){return Buffer.from([5,1,0])}function Ne(e,t){if(e.length!==16)throw new Error(`[socks] connect request addr must be 16 bytes, got ${e.length}`);let r=Buffer.alloc(22);return r.set([5,1,0,v],0),r.set(e,4),r.writeUInt16BE(t&65535,20),r}var J=new TextEncoder,Le=new TextDecoder;var fs=J.encode(`0\r
|
|
76
76
|
\r
|
|
77
77
|
`);var xs=Buffer.from(`\r
|
|
78
78
|
\r
|
package/presentation.main.mjs
CHANGED
package/session.main.mjs
CHANGED
package/transport.main.mjs
CHANGED