inplan 0.1.27 → 0.1.29

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.
@@ -218,7 +218,9 @@ var FsControlChannel = class {
218
218
  if (!fs.existsSync(this.paths.waitLockPath)) return Promise.resolve(false);
219
219
  return Promise.resolve(fs.readFileSync(this.paths.waitLockPath, "utf8").trim() !== token);
220
220
  }
221
- presence() {
221
+ // `sinceMs` is ignored: liveness here is "is the editor PROCESS alive", which flips to false the
222
+ // instant the window closes — there's no lingering-heartbeat TTL window to disambiguate.
223
+ presence(_sinceMs) {
222
224
  const log = readLog(this.paths.logPath);
223
225
  for (let i = log.length - 1; i >= 0; i--) {
224
226
  if (log[i].type === LogEventType.EditorPid) {
@@ -7092,6 +7092,7 @@ var MemoryControlChannel = class {
7092
7092
  cursor = 0;
7093
7093
  lockToken = null;
7094
7094
  present = false;
7095
+ presentAt = 0;
7095
7096
  listeners = /* @__PURE__ */ new Set();
7096
7097
  append(event) {
7097
7098
  const seq = this.log.length ? this.log[this.log.length - 1].seq + 1 : 1;
@@ -7129,12 +7130,14 @@ var MemoryControlChannel = class {
7129
7130
  isSuperseded(token) {
7130
7131
  return Promise.resolve(this.lockToken !== null && this.lockToken !== token);
7131
7132
  }
7132
- presence() {
7133
- return Promise.resolve(this.present);
7133
+ presence(sinceMs) {
7134
+ return Promise.resolve(this.present && (sinceMs === void 0 || this.presentAt > sinceMs));
7134
7135
  }
7135
- /** Test hook: simulate the editor being present/absent. */
7136
- setPresent(present) {
7136
+ /** Test hook: simulate the editor being present/absent. `at` (epoch ms, default now) stamps when
7137
+ * the heartbeat was written, so a `presence(sinceMs)` freshness check can be exercised. */
7138
+ setPresent(present, at = Date.now()) {
7137
7139
  this.present = present;
7140
+ if (present) this.presentAt = at;
7138
7141
  }
7139
7142
  };
7140
7143
  var MemoryDocumentStore = class {
@@ -21,7 +21,7 @@
21
21
  content="default-src 'self'; style-src 'self' 'unsafe-inline'; script-src 'self' inplan-plugin:; img-src 'self' file: https:; connect-src 'self' inplan-plugin: ws://127.0.0.1:* ws://localhost:*; frame-src https://inplan.ai http://127.0.0.1:* http://localhost:*"
22
22
  />
23
23
  <title>inplan</title>
24
- <script type="module" crossorigin src="./assets/index-CLk_2VIF.js"></script>
24
+ <script type="module" crossorigin src="./assets/index-B2UMwEBL.js"></script>
25
25
  <link rel="stylesheet" crossorigin href="./assets/index-BsT_GmrR.css">
26
26
  </head>
27
27
  <body>