@dev-anywhere/relay 0.4.62 → 0.4.64

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.
@@ -129,6 +129,9 @@ var SessionStatusPayloadSchema = z4.object({
129
129
  });
130
130
  var PtyStatePayloadSchema = z4.object({
131
131
  state: z4.enum(ptySemanticStateValues),
132
+ // Semantic event sequence. Present for runtime PTY semantic events; optional for
133
+ // legacy cleanup messages from older proxies.
134
+ seq: z4.number().int().nonnegative().optional(),
132
135
  title: z4.string().optional(),
133
136
  tool: z4.string().optional()
134
137
  });
@@ -1071,6 +1074,12 @@ var RelayRegistry = class {
1071
1074
  state.sessions.add(sessionId);
1072
1075
  }
1073
1076
  }
1077
+ setSessionsForProxy(proxyId, sessionIds) {
1078
+ const state = this.proxyStates.get(proxyId);
1079
+ if (state) {
1080
+ state.sessions = new Set(sessionIds);
1081
+ }
1082
+ }
1074
1083
  // 通过 sessionId 反查所属 proxyId
1075
1084
  getProxyForSession(sessionId) {
1076
1085
  for (const [proxyId, state] of this.proxyStates) {
@@ -1568,9 +1577,10 @@ function handleProxyConnection(ws, registry, logger, chaos) {
1568
1577
  if (result.kind === "control" && result.message.type === "session_sync") {
1569
1578
  if (!proxyWs.proxyId) return;
1570
1579
  const { sessions } = result.message;
1571
- for (const s of sessions) {
1572
- registry.addSessionToProxy(proxyWs.proxyId, s.id);
1573
- }
1580
+ registry.setSessionsForProxy(
1581
+ proxyWs.proxyId,
1582
+ sessions.map((s) => s.id)
1583
+ );
1574
1584
  logger.info({ proxyId: proxyWs.proxyId, count: sessions.length }, "Session sync received");
1575
1585
  return;
1576
1586
  }
@@ -3358,4 +3368,4 @@ export {
3358
3368
  parseRelayChaosFromEnv,
3359
3369
  createRelayServer
3360
3370
  };
3361
- //# sourceMappingURL=chunk-6YMW37ML.js.map
3371
+ //# sourceMappingURL=chunk-PM4ZJUGS.js.map