sessix-server 0.4.0 → 0.4.1

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/index.js CHANGED
@@ -1650,7 +1650,14 @@ var SessionManager = class {
1650
1650
  runningStartedAt = /* @__PURE__ */ new Map();
1651
1651
  /** assistant 事件合并缓冲区(30ms 窗口内的 assistant 事件合并为一次发送) */
1652
1652
  pendingAssistantEvents = /* @__PURE__ */ new Map();
1653
- /** 标记哪些会话的缓冲区曾被截断(溢出过 BUFFER_MAX) */
1653
+ /**
1654
+ * 标记哪些会话的缓冲区不能代表完整历史,需要从 JSONL 补全。
1655
+ * 两种情况会被标记:
1656
+ * 1. 缓冲区溢出过 BUFFER_MAX(旧事件被丢弃)
1657
+ * 2. 会话是通过 --resume 启动的(缓冲区只有恢复后的新事件,完整历史在 JSONL 中)
1658
+ * 例如:服务器重启后用户继续聊天,sendMessage 走 resume 路径再次创建会话,
1659
+ * 此时 buffer 只有 system init + 少量新事件,不能用它替换手机端已加载的完整 turns。
1660
+ */
1654
1661
  bufferTruncated = /* @__PURE__ */ new Set();
1655
1662
  /** sessionId → projectPath 映射,用于截断时从 JSONL 补全历史 */
1656
1663
  sessionProjectPaths = /* @__PURE__ */ new Map();
@@ -1708,6 +1715,9 @@ var SessionManager = class {
1708
1715
  this.sessionAgentType.set(session.id, resolvedAgentType);
1709
1716
  this.lastBroadcastStatus.set(session.id, session.status);
1710
1717
  this.sessionProjectPaths.set(session.id, projectPath);
1718
+ if (resumeSessionId) {
1719
+ this.bufferTruncated.add(session.id);
1720
+ }
1711
1721
  this.unsubscribeSession(session.id);
1712
1722
  this.subscribeToSession(session.id);
1713
1723
  console.log(`[SessionManager] Session created: ${session.id} (project: ${projectPath})`);
@@ -4747,7 +4757,7 @@ ${e.stderr ?? ""}`);
4747
4757
  if (destinationKind === "simulator") {
4748
4758
  installCmd = ["xcrun", "simctl", "install", destinationId, appPath];
4749
4759
  } else if (destinationKind === "device") {
4750
- installCmd = ["xcrun", "devicectl", "device", "install", "app", "--device-id", destinationId, appPath];
4760
+ installCmd = ["xcrun", "devicectl", "device", "install", "app", "--device", destinationId, appPath];
4751
4761
  } else if (destinationKind === "mac") {
4752
4762
  installCmd = ["open", appPath];
4753
4763
  } else {
@@ -5435,6 +5445,10 @@ async function start(opts = {}) {
5435
5445
  await xcodeBuildExecutor.install(event.sessionId, event.projectPath);
5436
5446
  break;
5437
5447
  }
5448
+ case "xcode_install_kill": {
5449
+ xcodeBuildExecutor.killInstall(event.installId);
5450
+ break;
5451
+ }
5438
5452
  default: {
5439
5453
  wsBridge.send(ws, {
5440
5454
  type: "error",
package/dist/server.js CHANGED
@@ -1655,7 +1655,14 @@ var SessionManager = class {
1655
1655
  runningStartedAt = /* @__PURE__ */ new Map();
1656
1656
  /** assistant 事件合并缓冲区(30ms 窗口内的 assistant 事件合并为一次发送) */
1657
1657
  pendingAssistantEvents = /* @__PURE__ */ new Map();
1658
- /** 标记哪些会话的缓冲区曾被截断(溢出过 BUFFER_MAX) */
1658
+ /**
1659
+ * 标记哪些会话的缓冲区不能代表完整历史,需要从 JSONL 补全。
1660
+ * 两种情况会被标记:
1661
+ * 1. 缓冲区溢出过 BUFFER_MAX(旧事件被丢弃)
1662
+ * 2. 会话是通过 --resume 启动的(缓冲区只有恢复后的新事件,完整历史在 JSONL 中)
1663
+ * 例如:服务器重启后用户继续聊天,sendMessage 走 resume 路径再次创建会话,
1664
+ * 此时 buffer 只有 system init + 少量新事件,不能用它替换手机端已加载的完整 turns。
1665
+ */
1659
1666
  bufferTruncated = /* @__PURE__ */ new Set();
1660
1667
  /** sessionId → projectPath 映射,用于截断时从 JSONL 补全历史 */
1661
1668
  sessionProjectPaths = /* @__PURE__ */ new Map();
@@ -1713,6 +1720,9 @@ var SessionManager = class {
1713
1720
  this.sessionAgentType.set(session.id, resolvedAgentType);
1714
1721
  this.lastBroadcastStatus.set(session.id, session.status);
1715
1722
  this.sessionProjectPaths.set(session.id, projectPath);
1723
+ if (resumeSessionId) {
1724
+ this.bufferTruncated.add(session.id);
1725
+ }
1716
1726
  this.unsubscribeSession(session.id);
1717
1727
  this.subscribeToSession(session.id);
1718
1728
  console.log(`[SessionManager] Session created: ${session.id} (project: ${projectPath})`);
@@ -4752,7 +4762,7 @@ ${e.stderr ?? ""}`);
4752
4762
  if (destinationKind === "simulator") {
4753
4763
  installCmd = ["xcrun", "simctl", "install", destinationId, appPath];
4754
4764
  } else if (destinationKind === "device") {
4755
- installCmd = ["xcrun", "devicectl", "device", "install", "app", "--device-id", destinationId, appPath];
4765
+ installCmd = ["xcrun", "devicectl", "device", "install", "app", "--device", destinationId, appPath];
4756
4766
  } else if (destinationKind === "mac") {
4757
4767
  installCmd = ["open", appPath];
4758
4768
  } else {
@@ -5440,6 +5450,10 @@ async function start(opts = {}) {
5440
5450
  await xcodeBuildExecutor.install(event.sessionId, event.projectPath);
5441
5451
  break;
5442
5452
  }
5453
+ case "xcode_install_kill": {
5454
+ xcodeBuildExecutor.killInstall(event.installId);
5455
+ break;
5456
+ }
5443
5457
  default: {
5444
5458
  wsBridge.send(ws, {
5445
5459
  type: "error",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sessix-server",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "bin": {
5
5
  "sessix-server": "dist/index.js"
6
6
  },