@pipod/cli 0.1.13 → 0.1.14
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/dist/cli.js +29 -6
- package/dist/cli.js.map +1 -1
- package/man/pipod-config.5 +13 -1
- package/man/pipod-config.5.md +13 -0
- package/man/pipod.1 +1 -1
- package/package.json +5 -2
package/dist/cli.js
CHANGED
|
@@ -11829,7 +11829,7 @@ function isRecord2(value) {
|
|
|
11829
11829
|
|
|
11830
11830
|
// src/account/gateway-rpc.ts
|
|
11831
11831
|
import { randomBytes as randomBytes5, randomUUID as randomUUID4 } from "crypto";
|
|
11832
|
-
import
|
|
11832
|
+
import WebSocket3 from "ws";
|
|
11833
11833
|
|
|
11834
11834
|
// src/client/stream-events.ts
|
|
11835
11835
|
function clone(value) {
|
|
@@ -12384,6 +12384,29 @@ function asleepReasonFromError(error2) {
|
|
|
12384
12384
|
return "idle_stop";
|
|
12385
12385
|
}
|
|
12386
12386
|
|
|
12387
|
+
// src/account/session-websocket.ts
|
|
12388
|
+
import { HttpsProxyAgent } from "https-proxy-agent";
|
|
12389
|
+
import { getProxyForUrl } from "proxy-from-env";
|
|
12390
|
+
import WebSocket2 from "ws";
|
|
12391
|
+
function createSessionWebSocket(url) {
|
|
12392
|
+
const target = new URL(url);
|
|
12393
|
+
const transportUrl = new URL(url);
|
|
12394
|
+
transportUrl.protocol = target.protocol === "wss:" ? "https:" : "http:";
|
|
12395
|
+
const proxy = getProxyForUrl(target.href) || getProxyForUrl(transportUrl.href);
|
|
12396
|
+
if (!proxy) return new WebSocket2(url);
|
|
12397
|
+
let agent;
|
|
12398
|
+
try {
|
|
12399
|
+
const proxyUrl = new URL(proxy);
|
|
12400
|
+
if (proxyUrl.protocol !== "http:" && proxyUrl.protocol !== "https:") {
|
|
12401
|
+
throw new Error("unsupported proxy protocol");
|
|
12402
|
+
}
|
|
12403
|
+
agent = new HttpsProxyAgent(proxyUrl);
|
|
12404
|
+
} catch {
|
|
12405
|
+
throw new Error("Invalid session proxy configuration: expected an HTTP(S) proxy URL");
|
|
12406
|
+
}
|
|
12407
|
+
return new WebSocket2(url, { agent });
|
|
12408
|
+
}
|
|
12409
|
+
|
|
12387
12410
|
// src/account/gateway-rpc.ts
|
|
12388
12411
|
var GATEWAY_MODELS_TIMEOUT_MS = 5e3;
|
|
12389
12412
|
var FILE_LIST_MAX_ENTRIES = 50;
|
|
@@ -12797,7 +12820,7 @@ var GatewayRpcClient = class _GatewayRpcClient extends RpcClientBase {
|
|
|
12797
12820
|
*/
|
|
12798
12821
|
async wake() {
|
|
12799
12822
|
if (this.userClosed) throw new PiPodError("connection to the pi session was closed");
|
|
12800
|
-
if (!this.closed && this.ws?.readyState ===
|
|
12823
|
+
if (!this.closed && this.ws?.readyState === WebSocket3.OPEN) return;
|
|
12801
12824
|
if (this.waking) {
|
|
12802
12825
|
await this.waitUntilConnected();
|
|
12803
12826
|
return;
|
|
@@ -12924,7 +12947,7 @@ var GatewayRpcClient = class _GatewayRpcClient extends RpcClientBase {
|
|
|
12924
12947
|
}
|
|
12925
12948
|
pingWatchdogTick() {
|
|
12926
12949
|
const ws = this.ws;
|
|
12927
|
-
if (!ws || ws.readyState !==
|
|
12950
|
+
if (!ws || ws.readyState !== WebSocket3.OPEN) return;
|
|
12928
12951
|
const deadlineMs = this.opts.pongDeadlineMs ?? PONG_DEADLINE_MS;
|
|
12929
12952
|
if (this.now() - this.lastActivityAt > deadlineMs) {
|
|
12930
12953
|
debug("gateway-rpc: pong deadline exceeded; terminating half-open socket");
|
|
@@ -13057,7 +13080,7 @@ var GatewayRpcClient = class _GatewayRpcClient extends RpcClientBase {
|
|
|
13057
13080
|
ticket,
|
|
13058
13081
|
...this.lastSessionId ? { fromSeq: this.lastSeq, fromSession: this.lastSessionId } : {}
|
|
13059
13082
|
});
|
|
13060
|
-
const create = this.opts.createWebSocket ??
|
|
13083
|
+
const create = this.opts.createWebSocket ?? createSessionWebSocket;
|
|
13061
13084
|
const ws = create(url);
|
|
13062
13085
|
this.connectingSockets.add(ws);
|
|
13063
13086
|
let settled = false;
|
|
@@ -13542,7 +13565,7 @@ var GatewayRpcClient = class _GatewayRpcClient extends RpcClientBase {
|
|
|
13542
13565
|
async waitUntilConnected() {
|
|
13543
13566
|
const deadline = this.now() + (this.opts.dropRecoveryMs ?? DROP_RECOVERY_MS);
|
|
13544
13567
|
while (this.now() < deadline) {
|
|
13545
|
-
if (!this.closed && this.ws?.readyState ===
|
|
13568
|
+
if (!this.closed && this.ws?.readyState === WebSocket3.OPEN) return;
|
|
13546
13569
|
if (this.userClosed) throw new Error("connection to the pi session was closed");
|
|
13547
13570
|
await new Promise((r) => setTimeout(r, 50));
|
|
13548
13571
|
}
|
|
@@ -13599,7 +13622,7 @@ var GatewayRpcClient = class _GatewayRpcClient extends RpcClientBase {
|
|
|
13599
13622
|
this.pendingSemantic.get(replyType)?.accept(value);
|
|
13600
13623
|
}
|
|
13601
13624
|
wsSend(message) {
|
|
13602
|
-
if (!this.ws || this.ws.readyState !==
|
|
13625
|
+
if (!this.ws || this.ws.readyState !== WebSocket3.OPEN) {
|
|
13603
13626
|
throw this.connectionClosedError();
|
|
13604
13627
|
}
|
|
13605
13628
|
this.ws.send(JSON.stringify(message));
|