@rynx-ai/daemon 0.1.11-beta.41 → 0.1.11-beta.42

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rynx-ai/plugin-channel-lark",
3
- "version": "0.1.11-beta.41",
3
+ "version": "0.1.11-beta.42",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/rynx-ai/rynx.git",
@@ -3,10 +3,13 @@ import { closeSync, fsyncSync, mkdirSync, openSync, readFileSync, renameSync, rm
3
3
  import { dirname, join } from "node:path";
4
4
  import { rynxHome } from "@rynx-ai/core";
5
5
  const LEASE_SCHEMA_VERSION = 1;
6
- // The detached updater can spend 24h waiting for idle before cutover begins.
7
- // Once accepted, retain a separate bounded recovery window long enough for the
8
- // package switch and rollback even if the updater is killed at its outer limit.
9
- const DEFAULT_LEASE_TTL_MS = 30 * 60 * 60 * 1_000;
6
+ // The lease is acquired only after shutdown-if-idle has closed admission and
7
+ // confirmed the daemon is idle. Keep a bounded cutover/rollback window without
8
+ // fencing a recovered daemon for hours when an updater disappears.
9
+ const DEFAULT_LEASE_TTL_MS = 15 * 60 * 1_000;
10
+ // Accept the previous production bound during rolling upgrades, then shorten
11
+ // it on load. Reject anything beyond that historical contract as corrupt.
12
+ const LEGACY_MAX_LEASE_TTL_MS = 30 * 60 * 60 * 1_000;
10
13
  const EXPIRY_RETRY_MS = 1_000;
11
14
  const MAX_TIMER_DELAY_MS = 2_147_483_647;
12
15
  const LEASE_TOKEN_PATTERN = /^[A-Za-z0-9_-]{32,256}$/;
@@ -132,13 +135,23 @@ export class MaintenanceLeaseStore {
132
135
  return undefined;
133
136
  throw new Error("maintenance lease state is unreadable", { cause: error });
134
137
  }
135
- if (!isPersistedLease(parsed, this.ttlMs)) {
138
+ if (!isPersistedLease(parsed, Math.max(this.ttlMs, LEGACY_MAX_LEASE_TTL_MS))) {
136
139
  throw new Error("maintenance lease state is invalid");
137
140
  }
138
- if (parsed.expiresAt <= this.now()) {
141
+ const now = this.now();
142
+ if (parsed.expiresAt <= now) {
139
143
  this.clearFile();
140
144
  return undefined;
141
145
  }
146
+ if (parsed.expiresAt - parsed.createdAt > this.ttlMs) {
147
+ const shortened = {
148
+ ...parsed,
149
+ createdAt: now,
150
+ expiresAt: Math.min(parsed.expiresAt, now + this.ttlMs),
151
+ };
152
+ this.writePersistedLease(shortened);
153
+ return shortened;
154
+ }
142
155
  return parsed;
143
156
  }
144
157
  writePersistedLease(lease) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rynx-ai/daemon",
3
- "version": "0.1.11-beta.41",
3
+ "version": "0.1.11-beta.42",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/rynx-ai/rynx.git",
@@ -51,18 +51,18 @@
51
51
  "tar": "^7.5.19",
52
52
  "undici": "^7.28.0",
53
53
  "ws": "^8.21.0",
54
- "@rynx-ai/emulator": "0.1.11-beta.41",
55
- "@rynx-ai/plugin-runner": "0.1.11-beta.41",
56
- "@rynx-ai/plugin-sdk": "0.1.11-beta.41",
57
- "@rynx-ai/protocol": "0.1.11-beta.41",
58
- "@rynx-ai/remote-runtime-client": "0.1.11-beta.41",
59
- "@rynx-ai/core": "0.1.11-beta.41",
60
- "@rynx-ai/server": "0.1.11-beta.41"
54
+ "@rynx-ai/core": "0.1.11-beta.42",
55
+ "@rynx-ai/emulator": "0.1.11-beta.42",
56
+ "@rynx-ai/plugin-runner": "0.1.11-beta.42",
57
+ "@rynx-ai/plugin-sdk": "0.1.11-beta.42",
58
+ "@rynx-ai/protocol": "0.1.11-beta.42",
59
+ "@rynx-ai/remote-runtime-client": "0.1.11-beta.42",
60
+ "@rynx-ai/server": "0.1.11-beta.42"
61
61
  },
62
62
  "devDependencies": {
63
63
  "@types/ws": "^8.18.1",
64
- "@rynx-ai/browser-cdp": "0.1.11-beta.41",
65
- "@rynx-ai/plugin-channel-lark": "0.1.11-beta.41"
64
+ "@rynx-ai/plugin-channel-lark": "0.1.11-beta.42",
65
+ "@rynx-ai/browser-cdp": "0.1.11-beta.42"
66
66
  },
67
67
  "scripts": {
68
68
  "build": "rm -rf dist bundled-plugins && tsc -p tsconfig.json && chmod +x dist/index-daemon.js && node ../../scripts/stage-bundled-plugins.mjs",