@dev-anywhere/proxy 0.5.0 → 0.5.2
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/{chunk-RSJKBUBY.js → chunk-UT3VNKEC.js} +18 -12
- package/dist/{chunk-RSJKBUBY.js.map → chunk-UT3VNKEC.js.map} +1 -1
- package/dist/{chunk-OEXRT54F.js → chunk-UTSTY2XA.js} +2 -2
- package/dist/index.js +2 -2
- package/dist/serve.js +52 -9
- package/dist/serve.js.map +1 -1
- package/dist/session-worker.js +7 -3
- package/dist/session-worker.js.map +1 -1
- package/dist/{terminal-4EXLE5C7.js → terminal-ME6PDFTF.js} +3 -3
- package/dist/terminal-worker.js +2 -2
- package/package.json +3 -3
- /package/dist/{chunk-OEXRT54F.js.map → chunk-UTSTY2XA.js.map} +0 -0
- /package/dist/{terminal-4EXLE5C7.js.map → terminal-ME6PDFTF.js.map} +0 -0
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./chunk-3HJM2NFD.js";
|
|
5
5
|
import {
|
|
6
6
|
createIpcReader
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-UT3VNKEC.js";
|
|
8
8
|
import {
|
|
9
9
|
terminalLogger
|
|
10
10
|
} from "./chunk-NOUZTHUN.js";
|
|
@@ -112,4 +112,4 @@ export {
|
|
|
112
112
|
waitForMessage,
|
|
113
113
|
swapServeSocket
|
|
114
114
|
};
|
|
115
|
-
//# sourceMappingURL=chunk-
|
|
115
|
+
//# sourceMappingURL=chunk-UTSTY2XA.js.map
|
package/dist/index.js
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
import {
|
|
13
13
|
createIpcReader,
|
|
14
14
|
serializeIpc
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-UT3VNKEC.js";
|
|
16
16
|
import {
|
|
17
17
|
CONFIG_PATH,
|
|
18
18
|
PID_PATH,
|
|
@@ -269,7 +269,7 @@ var program = new Command("dev-anywhere").description("Dev Anywhere - transparen
|
|
|
269
269
|
console.error(err instanceof Error ? err.message : String(err));
|
|
270
270
|
process.exit(1);
|
|
271
271
|
}
|
|
272
|
-
const { startTerminal } = await import("./terminal-
|
|
272
|
+
const { startTerminal } = await import("./terminal-ME6PDFTF.js");
|
|
273
273
|
const { provider, args } = invocation;
|
|
274
274
|
await startTerminal(args, provider);
|
|
275
275
|
});
|
package/dist/serve.js
CHANGED
|
@@ -50,7 +50,7 @@ import {
|
|
|
50
50
|
serializeControl,
|
|
51
51
|
serializeIpc,
|
|
52
52
|
serializeWorkerMsg
|
|
53
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-UT3VNKEC.js";
|
|
54
54
|
import {
|
|
55
55
|
buildProviderEnv,
|
|
56
56
|
loadConfig,
|
|
@@ -2238,6 +2238,7 @@ var WorkerRegistry = class {
|
|
|
2238
2238
|
children = /* @__PURE__ */ new Map();
|
|
2239
2239
|
readySessions = /* @__PURE__ */ new Set();
|
|
2240
2240
|
readyWaiters = /* @__PURE__ */ new Map();
|
|
2241
|
+
pendingNativeSessions = /* @__PURE__ */ new Map();
|
|
2241
2242
|
// 记录哪些 session 是 spawn 时带 --stream-delta 的;forwardEvent 据此决定是否跳过 aggregated 去重
|
|
2242
2243
|
streamDeltaSessions = /* @__PURE__ */ new Set();
|
|
2243
2244
|
onEnvelopeDropped(raw) {
|
|
@@ -2346,10 +2347,23 @@ var WorkerRegistry = class {
|
|
|
2346
2347
|
this.sockets.set(sessionId, sock);
|
|
2347
2348
|
createWorkerReader(
|
|
2348
2349
|
sock,
|
|
2349
|
-
(msg) =>
|
|
2350
|
+
(msg) => {
|
|
2351
|
+
try {
|
|
2352
|
+
this.handleWorkerMessage(sessionId, msg);
|
|
2353
|
+
} catch (err) {
|
|
2354
|
+
serviceLogger.error(
|
|
2355
|
+
{ sessionId, error: err instanceof Error ? err.message : String(err) },
|
|
2356
|
+
"Worker message handler failed"
|
|
2357
|
+
);
|
|
2358
|
+
}
|
|
2359
|
+
},
|
|
2350
2360
|
(err, line) => {
|
|
2351
2361
|
serviceLogger.warn(
|
|
2352
|
-
{
|
|
2362
|
+
{
|
|
2363
|
+
sessionId,
|
|
2364
|
+
err: err.message,
|
|
2365
|
+
lineLen: line.length
|
|
2366
|
+
},
|
|
2353
2367
|
"Worker IPC message dropped (parse/schema error)"
|
|
2354
2368
|
);
|
|
2355
2369
|
}
|
|
@@ -2410,6 +2424,7 @@ var WorkerRegistry = class {
|
|
|
2410
2424
|
this.sockets.delete(sessionId);
|
|
2411
2425
|
this.readySessions.delete(sessionId);
|
|
2412
2426
|
this.streamDeltaSessions.delete(sessionId);
|
|
2427
|
+
this.pendingNativeSessions.delete(sessionId);
|
|
2413
2428
|
this.rejectReadyWaiters(
|
|
2414
2429
|
new Error(`Worker session deleted before ready: ${sessionId}`),
|
|
2415
2430
|
sessionId
|
|
@@ -2422,6 +2437,7 @@ var WorkerRegistry = class {
|
|
|
2422
2437
|
this.sockets.delete(sessionId);
|
|
2423
2438
|
this.readySessions.delete(sessionId);
|
|
2424
2439
|
this.streamDeltaSessions.delete(sessionId);
|
|
2440
|
+
this.pendingNativeSessions.delete(sessionId);
|
|
2425
2441
|
this.children.delete(sessionId);
|
|
2426
2442
|
this.rejectReadyWaiters(
|
|
2427
2443
|
new Error(`Worker process terminated before ready: ${sessionId}`),
|
|
@@ -2443,11 +2459,15 @@ var WorkerRegistry = class {
|
|
|
2443
2459
|
}
|
|
2444
2460
|
this.sockets.clear();
|
|
2445
2461
|
this.readySessions.clear();
|
|
2462
|
+
this.pendingNativeSessions.clear();
|
|
2446
2463
|
this.rejectReadyWaiters(new Error("Worker registry destroyed"));
|
|
2447
2464
|
}
|
|
2448
2465
|
handleWorkerMessage(sessionId, msg) {
|
|
2449
2466
|
switch (msg.type) {
|
|
2450
2467
|
case "worker_ready":
|
|
2468
|
+
if (msg.nativeSession) {
|
|
2469
|
+
this.captureNativeSession(sessionId, msg.nativeSession);
|
|
2470
|
+
}
|
|
2451
2471
|
this.readySessions.add(sessionId);
|
|
2452
2472
|
this.resolveReadyWaiters(sessionId);
|
|
2453
2473
|
serviceLogger.info({ sessionId, pid: msg.pid }, "Worker ready");
|
|
@@ -2492,18 +2512,17 @@ var WorkerRegistry = class {
|
|
|
2492
2512
|
this.forwardApprovalRequest(sessionId, msg);
|
|
2493
2513
|
break;
|
|
2494
2514
|
case "worker_claude_session_id":
|
|
2495
|
-
this.
|
|
2515
|
+
this.captureNativeSession(sessionId, { provider: "claude", sessionId: msg.sessionId });
|
|
2496
2516
|
serviceLogger.info(
|
|
2497
2517
|
{ sessionId, claudeSessionId: msg.sessionId },
|
|
2498
2518
|
"Claude session ID captured"
|
|
2499
2519
|
);
|
|
2500
2520
|
break;
|
|
2501
2521
|
case "worker_native_session_id":
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
}
|
|
2522
|
+
this.captureNativeSession(sessionId, {
|
|
2523
|
+
provider: msg.provider,
|
|
2524
|
+
sessionId: msg.sessionId
|
|
2525
|
+
});
|
|
2507
2526
|
serviceLogger.info(
|
|
2508
2527
|
{ sessionId, provider: msg.provider, nativeSessionId: msg.sessionId },
|
|
2509
2528
|
"Native JSON session ID captured"
|
|
@@ -2511,6 +2530,22 @@ var WorkerRegistry = class {
|
|
|
2511
2530
|
break;
|
|
2512
2531
|
}
|
|
2513
2532
|
}
|
|
2533
|
+
takePendingNativeSession(sessionId) {
|
|
2534
|
+
const nativeSession = this.pendingNativeSessions.get(sessionId);
|
|
2535
|
+
this.pendingNativeSessions.delete(sessionId);
|
|
2536
|
+
return nativeSession;
|
|
2537
|
+
}
|
|
2538
|
+
captureNativeSession(sessionId, nativeSession) {
|
|
2539
|
+
if (!this.deps.sessionManager.getSession(sessionId)) {
|
|
2540
|
+
this.pendingNativeSessions.set(sessionId, nativeSession);
|
|
2541
|
+
return;
|
|
2542
|
+
}
|
|
2543
|
+
if (nativeSession.provider === "claude") {
|
|
2544
|
+
this.deps.sessionManager.setClaudeSessionId(sessionId, nativeSession.sessionId);
|
|
2545
|
+
} else {
|
|
2546
|
+
this.deps.sessionManager.setHistorySessionId(sessionId, nativeSession.sessionId);
|
|
2547
|
+
}
|
|
2548
|
+
}
|
|
2514
2549
|
// worker 连接断开或异常时的统一清理入口。仅记录一份,不再区分 close vs error 语义。
|
|
2515
2550
|
onDisconnect(sessionId) {
|
|
2516
2551
|
this.sockets.delete(sessionId);
|
|
@@ -3838,6 +3873,14 @@ var RelaySessionCreateHandler = class {
|
|
|
3838
3873
|
);
|
|
3839
3874
|
return;
|
|
3840
3875
|
}
|
|
3876
|
+
const nativeSession = this.deps.workerRegistry.takePendingNativeSession(session.id);
|
|
3877
|
+
if (nativeSession) {
|
|
3878
|
+
if (nativeSession.provider === "claude") {
|
|
3879
|
+
this.deps.sessionManager.setClaudeSessionId(session.id, nativeSession.sessionId);
|
|
3880
|
+
} else {
|
|
3881
|
+
this.deps.sessionManager.setHistorySessionId(session.id, nativeSession.sessionId);
|
|
3882
|
+
}
|
|
3883
|
+
}
|
|
3841
3884
|
if (options.resumeSessionId) {
|
|
3842
3885
|
this.deps.sessionManager.setHistorySessionId(session.id, options.resumeSessionId);
|
|
3843
3886
|
}
|