@vibe-lark/larkpal 0.1.20 → 0.1.22

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.
Files changed (2) hide show
  1. package/dist/main.mjs +22 -2
  2. package/package.json +1 -1
package/dist/main.mjs CHANGED
@@ -859,8 +859,18 @@ const log$25 = larkLogger("cc-runtime/process-manager");
859
859
  * 此值不可更改,否则所有用户的历史会话将无法恢复。
860
860
  */
861
861
  const LARKPAL_SESSION_NAMESPACE = "7c9e6679-7425-40de-944b-e07fc1f90ae7";
862
- /** 空闲超时时间(10 分钟) */
863
- const IDLE_TIMEOUT_MS = 600 * 1e3;
862
+ /**
863
+ * CC 进程空闲超时时间(毫秒)。
864
+ * 通过 LARKPAL_CC_IDLE_TIMEOUT 环境变量配置(单位:秒),默认 0 表示永不超时。
865
+ * 多用户场景建议设为 0(进程常驻),避免 --resume 冷启动延迟。
866
+ */
867
+ const IDLE_TIMEOUT_MS = (() => {
868
+ const envVal = process.env.LARKPAL_CC_IDLE_TIMEOUT;
869
+ if (envVal === void 0 || envVal === "") return 0;
870
+ const seconds = parseInt(envVal, 10);
871
+ if (isNaN(seconds) || seconds < 0) return 0;
872
+ return seconds * 1e3;
873
+ })();
864
874
  /** 优雅关闭等待时间(5 秒) */
865
875
  const GRACEFUL_SHUTDOWN_MS = 5e3;
866
876
  var SessionProcessManager = class {
@@ -1442,6 +1452,7 @@ var SessionProcessManager = class {
1442
1452
  resetIdleTimer(sessionId) {
1443
1453
  const existing = this.idleTimers.get(sessionId);
1444
1454
  if (existing) clearTimeout(existing);
1455
+ if (IDLE_TIMEOUT_MS <= 0) return;
1445
1456
  const timer = setTimeout(() => {
1446
1457
  log$25.info("CC 常驻进程空闲超时,自动停止", {
1447
1458
  sessionId,
@@ -8374,6 +8385,15 @@ var StreamingCardController = class StreamingCardController {
8374
8385
  this.cardKit.cardKitCardId = null;
8375
8386
  return;
8376
8387
  }
8388
+ if (apiCode === 300317 && this.cardKit.cardKitCardId) {
8389
+ const oldSeq = this.cardKit.cardKitSequence;
8390
+ this.cardKit.cardKitSequence += 100;
8391
+ log$13.warn("flushCardUpdate: sequence conflict (300317), jumping sequence", {
8392
+ oldSeq,
8393
+ newSeq: this.cardKit.cardKitSequence
8394
+ });
8395
+ return;
8396
+ }
8377
8397
  const apiDetail = extractApiDetail(err);
8378
8398
  log$13.error("card stream update failed", {
8379
8399
  apiCode,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibe-lark/larkpal",
3
- "version": "0.1.20",
3
+ "version": "0.1.22",
4
4
  "description": "LarkPal - Lark/Feishu bot service",
5
5
  "type": "module",
6
6
  "main": "./dist/main.mjs",