@pipod/cli 0.1.13 → 0.1.15
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 +38 -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
|
@@ -11153,7 +11153,16 @@ function createRemoteRuntime(opts) {
|
|
|
11153
11153
|
get isStreaming() {
|
|
11154
11154
|
return cache.state.isStreaming;
|
|
11155
11155
|
},
|
|
11156
|
+
/**
|
|
11157
|
+
* Once an ending is recorded (§6.2) the client has no turn left to wait for, so it reads
|
|
11158
|
+
* as idle. InteractiveMode's extension shutdown requester only shuts down when the session
|
|
11159
|
+
* is idle and otherwise waits for `agent_settled`; without this a `/pod detach` or its
|
|
11160
|
+
* chord would sit until the pod's turn ended, though a leave never touches pod-side pi, and
|
|
11161
|
+
* a dropped transport or a pod-side pi exit may never settle the stream at all. A local
|
|
11162
|
+
* extension's `ctx.shutdown()` records no ending, so it still waits for the turn as in pi.
|
|
11163
|
+
*/
|
|
11156
11164
|
get isIdle() {
|
|
11165
|
+
if (bridge.intent) return true;
|
|
11157
11166
|
return !cache.state.isStreaming && !cache.state.isCompacting;
|
|
11158
11167
|
},
|
|
11159
11168
|
get isCompacting() {
|
|
@@ -11829,7 +11838,7 @@ function isRecord2(value) {
|
|
|
11829
11838
|
|
|
11830
11839
|
// src/account/gateway-rpc.ts
|
|
11831
11840
|
import { randomBytes as randomBytes5, randomUUID as randomUUID4 } from "crypto";
|
|
11832
|
-
import
|
|
11841
|
+
import WebSocket3 from "ws";
|
|
11833
11842
|
|
|
11834
11843
|
// src/client/stream-events.ts
|
|
11835
11844
|
function clone(value) {
|
|
@@ -12384,6 +12393,29 @@ function asleepReasonFromError(error2) {
|
|
|
12384
12393
|
return "idle_stop";
|
|
12385
12394
|
}
|
|
12386
12395
|
|
|
12396
|
+
// src/account/session-websocket.ts
|
|
12397
|
+
import { HttpsProxyAgent } from "https-proxy-agent";
|
|
12398
|
+
import { getProxyForUrl } from "proxy-from-env";
|
|
12399
|
+
import WebSocket2 from "ws";
|
|
12400
|
+
function createSessionWebSocket(url) {
|
|
12401
|
+
const target = new URL(url);
|
|
12402
|
+
const transportUrl = new URL(url);
|
|
12403
|
+
transportUrl.protocol = target.protocol === "wss:" ? "https:" : "http:";
|
|
12404
|
+
const proxy = getProxyForUrl(target.href) || getProxyForUrl(transportUrl.href);
|
|
12405
|
+
if (!proxy) return new WebSocket2(url);
|
|
12406
|
+
let agent;
|
|
12407
|
+
try {
|
|
12408
|
+
const proxyUrl = new URL(proxy);
|
|
12409
|
+
if (proxyUrl.protocol !== "http:" && proxyUrl.protocol !== "https:") {
|
|
12410
|
+
throw new Error("unsupported proxy protocol");
|
|
12411
|
+
}
|
|
12412
|
+
agent = new HttpsProxyAgent(proxyUrl);
|
|
12413
|
+
} catch {
|
|
12414
|
+
throw new Error("Invalid session proxy configuration: expected an HTTP(S) proxy URL");
|
|
12415
|
+
}
|
|
12416
|
+
return new WebSocket2(url, { agent });
|
|
12417
|
+
}
|
|
12418
|
+
|
|
12387
12419
|
// src/account/gateway-rpc.ts
|
|
12388
12420
|
var GATEWAY_MODELS_TIMEOUT_MS = 5e3;
|
|
12389
12421
|
var FILE_LIST_MAX_ENTRIES = 50;
|
|
@@ -12797,7 +12829,7 @@ var GatewayRpcClient = class _GatewayRpcClient extends RpcClientBase {
|
|
|
12797
12829
|
*/
|
|
12798
12830
|
async wake() {
|
|
12799
12831
|
if (this.userClosed) throw new PiPodError("connection to the pi session was closed");
|
|
12800
|
-
if (!this.closed && this.ws?.readyState ===
|
|
12832
|
+
if (!this.closed && this.ws?.readyState === WebSocket3.OPEN) return;
|
|
12801
12833
|
if (this.waking) {
|
|
12802
12834
|
await this.waitUntilConnected();
|
|
12803
12835
|
return;
|
|
@@ -12924,7 +12956,7 @@ var GatewayRpcClient = class _GatewayRpcClient extends RpcClientBase {
|
|
|
12924
12956
|
}
|
|
12925
12957
|
pingWatchdogTick() {
|
|
12926
12958
|
const ws = this.ws;
|
|
12927
|
-
if (!ws || ws.readyState !==
|
|
12959
|
+
if (!ws || ws.readyState !== WebSocket3.OPEN) return;
|
|
12928
12960
|
const deadlineMs = this.opts.pongDeadlineMs ?? PONG_DEADLINE_MS;
|
|
12929
12961
|
if (this.now() - this.lastActivityAt > deadlineMs) {
|
|
12930
12962
|
debug("gateway-rpc: pong deadline exceeded; terminating half-open socket");
|
|
@@ -13057,7 +13089,7 @@ var GatewayRpcClient = class _GatewayRpcClient extends RpcClientBase {
|
|
|
13057
13089
|
ticket,
|
|
13058
13090
|
...this.lastSessionId ? { fromSeq: this.lastSeq, fromSession: this.lastSessionId } : {}
|
|
13059
13091
|
});
|
|
13060
|
-
const create = this.opts.createWebSocket ??
|
|
13092
|
+
const create = this.opts.createWebSocket ?? createSessionWebSocket;
|
|
13061
13093
|
const ws = create(url);
|
|
13062
13094
|
this.connectingSockets.add(ws);
|
|
13063
13095
|
let settled = false;
|
|
@@ -13542,7 +13574,7 @@ var GatewayRpcClient = class _GatewayRpcClient extends RpcClientBase {
|
|
|
13542
13574
|
async waitUntilConnected() {
|
|
13543
13575
|
const deadline = this.now() + (this.opts.dropRecoveryMs ?? DROP_RECOVERY_MS);
|
|
13544
13576
|
while (this.now() < deadline) {
|
|
13545
|
-
if (!this.closed && this.ws?.readyState ===
|
|
13577
|
+
if (!this.closed && this.ws?.readyState === WebSocket3.OPEN) return;
|
|
13546
13578
|
if (this.userClosed) throw new Error("connection to the pi session was closed");
|
|
13547
13579
|
await new Promise((r) => setTimeout(r, 50));
|
|
13548
13580
|
}
|
|
@@ -13599,7 +13631,7 @@ var GatewayRpcClient = class _GatewayRpcClient extends RpcClientBase {
|
|
|
13599
13631
|
this.pendingSemantic.get(replyType)?.accept(value);
|
|
13600
13632
|
}
|
|
13601
13633
|
wsSend(message) {
|
|
13602
|
-
if (!this.ws || this.ws.readyState !==
|
|
13634
|
+
if (!this.ws || this.ws.readyState !== WebSocket3.OPEN) {
|
|
13603
13635
|
throw this.connectionClosedError();
|
|
13604
13636
|
}
|
|
13605
13637
|
this.ws.send(JSON.stringify(message));
|