oasis_test 0.1.122 → 0.1.123

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/index.js +23 -4
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -203955,6 +203955,7 @@ var DaemonWsClient = class {
203955
203955
  this.onUpdate = onUpdate;
203956
203956
  this.daemonVersion = daemonVersion;
203957
203957
  this.spawnSessionProcess = opts.spawnSessionProcess;
203958
+ this.countDetachedSessions = opts.countDetachedSessions;
203958
203959
  this.pingIntervalMs = opts.pingIntervalMs ?? PING_INTERVAL_MS;
203959
203960
  this.silenceTimeoutMs = opts.silenceTimeoutMs ?? SILENCE_TIMEOUT_MS;
203960
203961
  this.reconnectDelayMs = opts.reconnectDelayMs ?? RECONNECT_DELAY_MS;
@@ -203989,6 +203990,7 @@ var DaemonWsClient = class {
203989
203990
  /** setup 期间收到 kill 的派发。spawn 返回后先杀句柄,不得再宣告 session_started。 */
203990
203991
  cancelledPendingDispatchIds = /* @__PURE__ */ new Set();
203991
203992
  spawnSessionProcess;
203993
+ countDetachedSessions;
203992
203994
  /**
203993
203995
  * 回执 outbox(proposal run-ledger §4.2):**服务端据以判决的帧**发出后先留一份,收到
203994
203996
  * 服务端 ack 才删;ws 抖动坏窗口发失败/丢失的帧,在重连时全量重发——投递升级 at-least-once,
@@ -204306,7 +204308,8 @@ var DaemonWsClient = class {
204306
204308
  this.pendingUpdateSince = null;
204307
204309
  this.onUpdate();
204308
204310
  } else {
204309
- log2("[node-cli]", "\u2190 update\uFF1A\u7A7A\u95F2,\u7ACB\u5373\u62C9\u53D6\u6700\u65B0\u7248\u672C\u5E76\u91CD\u542F");
204311
+ const detached = this.countDetachedSessions?.() ?? 0;
204312
+ log2("[node-cli]", detached > 0 ? `\u2190 update\uFF1A\u672C\u8FDB\u7A0B\u5185\u65E0\u4F1A\u8BDD\uFF08\u53E6\u6709 ${detached} \u4E2A\u72EC\u7ACB\u4F1A\u8BDD\u5728\u8DD1\uFF0C**\u4E0D\u53D7\u672C\u6B21\u91CD\u542F\u5F71\u54CD**\uFF09\uFF0C\u7ACB\u5373\u62C9\u53D6\u6700\u65B0\u7248\u672C\u5E76\u91CD\u542F` : "\u2190 update\uFF1A\u7A7A\u95F2,\u7ACB\u5373\u62C9\u53D6\u6700\u65B0\u7248\u672C\u5E76\u91CD\u542F");
204310
204313
  this.onUpdate();
204311
204314
  }
204312
204315
  break;
@@ -204555,7 +204558,8 @@ async function startNode(opts) {
204555
204558
  const client = new DaemonWsClient(opts.serverUrl, opts.nodeId, sessions, adapters, opts.token, runtimes, opts.nodeName, opts.reportRuntimes ?? false, true, opts.onUpdate, opts.daemonVersion, {
204556
204559
  // chat 文件浏览 handler 用它定位会话目录;production 不传 = 与 adapter 同款默认根(~/.oasis/work)。
204557
204560
  ...opts.workRoot !== void 0 ? { workRoot: opts.workRoot } : {},
204558
- ...opts.spawnSessionProcess ? { spawnSessionProcess: opts.spawnSessionProcess } : {}
204561
+ ...opts.spawnSessionProcess ? { spawnSessionProcess: opts.spawnSessionProcess } : {},
204562
+ ...opts.countDetachedSessions ? { countDetachedSessions: opts.countDetachedSessions } : {}
204559
204563
  });
204560
204564
  console.log(`[oasis node] ${opts.nodeId} \u2192 ${opts.serverUrl}`);
204561
204565
  client.start();
@@ -209440,6 +209444,20 @@ function sweepOrphanSessions(sessionRoots2, deps) {
209440
209444
  }
209441
209445
  return removed;
209442
209446
  }
209447
+ function countLiveSessions(sessionRoots2, deps) {
209448
+ if (!deps.flockAvailable) return 0;
209449
+ let n = 0;
209450
+ for (const root of sessionRoots2) {
209451
+ let dirs;
209452
+ try {
209453
+ dirs = fs38.readdirSync(root);
209454
+ } catch {
209455
+ continue;
209456
+ }
209457
+ for (const d of dirs) if (deps.isLocked(path32.join(root, d, "lock"))) n++;
209458
+ }
209459
+ return n;
209460
+ }
209443
209461
 
209444
209462
  // src/index.ts
209445
209463
  init_src8();
@@ -209699,7 +209717,7 @@ function shimScript() {
209699
209717
  }
209700
209718
 
209701
209719
  // src/index.ts
209702
- var PKG_VERSION = true ? "0.1.122" : "dev";
209720
+ var PKG_VERSION = true ? "0.1.123" : "dev";
209703
209721
  var LOCAL_BIN = localBin();
209704
209722
  var NPM_PREFIX = npmPrefix();
209705
209723
  var INSTANCE = DEFAULT_INSTANCE;
@@ -210221,7 +210239,8 @@ void (async () => {
210221
210239
  drainNode = ctl.drain;
210222
210240
  },
210223
210241
  // 服务端下发了数据面通行证时,把会话交给独立进程跑(daemon 重启不再连坐它)。
210224
- spawnSessionProcess
210242
+ spawnSessionProcess,
210243
+ countDetachedSessions: () => countLiveSessions(sessionRoots(), { isLocked: isSessionLocked, flockAvailable: hasFlock() })
210225
210244
  });
210226
210245
  return;
210227
210246
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oasis_test",
3
- "version": "0.1.122",
3
+ "version": "0.1.123",
4
4
  "description": "Oasis node daemon + CLI — background daemon, auto-start, full server CLI",
5
5
  "bin": {
6
6
  "oasis": "./dist/index.js"
@@ -26,6 +26,6 @@
26
26
  "node": ">=20"
27
27
  },
28
28
  "oasisRelease": {
29
- "sourceHead": "f909dea3a3e738d34800aaae2ff21febd2ed9ea3"
29
+ "sourceHead": "77b69695eb0d4289690e802db5743a48444488fd"
30
30
  }
31
31
  }