editmamei 0.22.3 → 0.22.4
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/bin/editmamei-core-darwin-arm64 +0 -0
- package/dist/bin/editmamei-core-darwin-x64 +0 -0
- package/dist/bin/editmamei-core-win-x64.exe +0 -0
- package/dist/core/server.js +32 -0
- package/dist/license/entitlement.js +2 -2
- package/dist/license/ping-refresh.js +8 -4
- package/dist/skills/editmamei-skill.zip +0 -0
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/core/server.js
CHANGED
|
@@ -330,6 +330,37 @@ export class EditmameiServer {
|
|
|
330
330
|
`${err instanceof Error ? err.message : String(err)}`);
|
|
331
331
|
}
|
|
332
332
|
}
|
|
333
|
+
async ensureEntitledModuleFresh(delivery = {}) {
|
|
334
|
+
if (this.moduleSkipReason !== null)
|
|
335
|
+
return;
|
|
336
|
+
if (!isProEntitled())
|
|
337
|
+
return;
|
|
338
|
+
const underTest = process.env.VITEST !== undefined || process.env.NODE_ENV === 'test';
|
|
339
|
+
if (underTest && !delivery.fetchImpl)
|
|
340
|
+
return;
|
|
341
|
+
const license = readLicense();
|
|
342
|
+
if (!license)
|
|
343
|
+
return;
|
|
344
|
+
try {
|
|
345
|
+
const prov = await provisionModules(license.key, {
|
|
346
|
+
config: delivery.config,
|
|
347
|
+
fetchImpl: delivery.fetchImpl,
|
|
348
|
+
signingKeys: delivery.signingKeys,
|
|
349
|
+
sleep: delivery.sleep,
|
|
350
|
+
});
|
|
351
|
+
for (const m of prov.installed) {
|
|
352
|
+
this.logger.info(`Pro module updated to v${m.version} — restart to load.`);
|
|
353
|
+
}
|
|
354
|
+
for (const e of prov.errors) {
|
|
355
|
+
this.logger.warn(`Pro-module freshness check could not provision the ${e.sku} module ` +
|
|
356
|
+
`(staying on the installed version): ${e.message}`);
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
catch (err) {
|
|
360
|
+
this.logger.warn(`Background Pro-module freshness check failed (staying on the installed version): ` +
|
|
361
|
+
`${err instanceof Error ? err.message : String(err)}`);
|
|
362
|
+
}
|
|
363
|
+
}
|
|
333
364
|
assertToolsClassified() {
|
|
334
365
|
for (const tool of this.toolRegistry.list()) {
|
|
335
366
|
tierOf(tool.name);
|
|
@@ -485,6 +516,7 @@ export class EditmameiServer {
|
|
|
485
516
|
await this.server.connect(transport);
|
|
486
517
|
void this.session.initialize().catch(() => undefined);
|
|
487
518
|
void this.reprovisionIfModuleSkipped();
|
|
519
|
+
void this.ensureEntitledModuleFresh();
|
|
488
520
|
this.telemetry.start();
|
|
489
521
|
void this.telemetry.flushOutboxOnStartup();
|
|
490
522
|
this.server.onclose = () => {
|
|
@@ -4,8 +4,8 @@ import { readLicense, writeLicense, clearLicense, } from './store.js';
|
|
|
4
4
|
import { PolarLicenseClient, PolarLicenseError } from './polar-client.js';
|
|
5
5
|
import { Logger } from '../utils/logger.js';
|
|
6
6
|
const logger = new Logger('License');
|
|
7
|
-
export const GRACE_MS =
|
|
8
|
-
export const REFRESH_AFTER_MS =
|
|
7
|
+
export const GRACE_MS = 7 * 24 * 60 * 60 * 1000;
|
|
8
|
+
export const REFRESH_AFTER_MS = 24 * 60 * 60 * 1000;
|
|
9
9
|
export const EXPIRED_REFRESH_TIMEOUT_MS = 5_000;
|
|
10
10
|
export const CLOCK_SKEW_TOLERANCE_MS = 24 * 60 * 60 * 1000;
|
|
11
11
|
export function evaluateEntitlement(rec, now) {
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { refreshIfStale } from './entitlement.js';
|
|
2
|
-
export
|
|
3
|
-
|
|
2
|
+
export const PING_REFRESH_MIN_INTERVAL_MS = 15 * 60_000;
|
|
3
|
+
export function createPingLicenseRefresher(refresh = refreshIfStale, opts = {}) {
|
|
4
|
+
const now = opts.now ?? Date.now;
|
|
5
|
+
const minIntervalMs = opts.minIntervalMs ?? PING_REFRESH_MIN_INTERVAL_MS;
|
|
6
|
+
let lastAttemptAt = Number.NEGATIVE_INFINITY;
|
|
4
7
|
return () => {
|
|
5
|
-
|
|
8
|
+
const t = now();
|
|
9
|
+
if (t - lastAttemptAt < minIntervalMs)
|
|
6
10
|
return;
|
|
7
|
-
|
|
11
|
+
lastAttemptAt = t;
|
|
8
12
|
try {
|
|
9
13
|
void refresh().catch(() => { });
|
|
10
14
|
}
|
|
Binary file
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.22.
|
|
1
|
+
export const VERSION = '0.22.4';
|