@listen-fire/engine 0.12.0-rc.7 → 0.12.0-rc.8
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/public/limiter.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// The limiter slot: a module's declared limits held across the calls it makes
|
|
3
3
|
// (`limitRequest`, then `limited` around the call), the slot a host fills
|
|
4
|
-
// (`installLimiter`),
|
|
4
|
+
// (`installLimiter`), the in-process limiter a host starts from, and a
|
|
5
|
+
// vendor's rate-limit wait read (`vendorWaitMs`) and turned into a throttle on
|
|
6
|
+
// the caller's key (`throttleAfter`).
|
|
5
7
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
8
|
if (k2 === undefined) k2 = k;
|
|
7
9
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
package/dist/public/testing.d.ts
CHANGED
package/dist/public/testing.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// For test files only: a ready test host, its fakes, the run host's contract
|
|
3
3
|
// cases a store implementation must pass, and the browser slot's contract
|
|
4
|
-
// cases with a scripted page to hold a module to them without a browser
|
|
4
|
+
// cases with a scripted page to hold a module to them without a browser, and
|
|
5
|
+
// the limiter slot's contract cases a limiter implementation must pass.
|
|
5
6
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
7
|
if (k2 === undefined) k2 = k;
|
|
7
8
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -21,3 +22,4 @@ __exportStar(require("../services/movement_engine/test_host"), exports);
|
|
|
21
22
|
__exportStar(require("../services/run_host/contract"), exports);
|
|
22
23
|
__exportStar(require("../services/browser/contract"), exports);
|
|
23
24
|
__exportStar(require("../services/browser/fake_browser"), exports);
|
|
25
|
+
__exportStar(require("../services/limiter/contract"), exports);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { WireDeclaredLimitShape } from '@listen-fire/engine-contracts';
|
|
2
|
+
export { vendorWaitMs } from '@listen-fire/module-runtime/vendor_wait';
|
|
2
3
|
/** One limit a request is under, resolved to the bucket it counts in. */
|
|
3
4
|
export interface LimitBucket {
|
|
4
5
|
key: string;
|
|
@@ -64,6 +65,10 @@ export interface Held {
|
|
|
64
65
|
export declare function acquireOrWait(limiter: Limiter, request: LimitRequest): Promise<Held>;
|
|
65
66
|
/** Run `call` once `limiter` grants `request`; its permit released after. */
|
|
66
67
|
export declare function limited<T>(limiter: Limiter, request: LimitRequest, call: () => Promise<T>): Promise<T>;
|
|
68
|
+
/** A vendor's "wait `waitMs`" (`vendorWaitMs`, or the caller's default) as a
|
|
69
|
+
* throttle on `caller`'s key: every call made as that caller, by any host
|
|
70
|
+
* sharing `limiter`, is refused until then, and `acquireOrWait` waits it out. */
|
|
71
|
+
export declare function throttleAfter(limiter: Limiter, caller: Caller, waitMs: number, now?: number): Promise<void>;
|
|
67
72
|
/** The limiter filling the slot: the built-in until a host installs another. */
|
|
68
73
|
export declare function limiterSlot(): Limiter;
|
|
69
74
|
export declare function installLimiter(limiter: Limiter): void;
|
|
@@ -12,15 +12,18 @@
|
|
|
12
12
|
// a manifest. The built-in, `@lf/memory-limiter`, keeps them in this process
|
|
13
13
|
// (`MemoryLimiter`); lf's Rust one is the same (crates/lf/src/limiter.rs).
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.MemoryLimiter = exports.HOLD_MS = void 0;
|
|
15
|
+
exports.MemoryLimiter = exports.HOLD_MS = exports.vendorWaitMs = void 0;
|
|
16
16
|
exports.throttleKey = throttleKey;
|
|
17
17
|
exports.durationMs = durationMs;
|
|
18
18
|
exports.limitRequest = limitRequest;
|
|
19
19
|
exports.acquireOrWait = acquireOrWait;
|
|
20
20
|
exports.limited = limited;
|
|
21
|
+
exports.throttleAfter = throttleAfter;
|
|
21
22
|
exports.limiterSlot = limiterSlot;
|
|
22
23
|
exports.installLimiter = installLimiter;
|
|
23
24
|
const node_crypto_1 = require("node:crypto");
|
|
25
|
+
var vendor_wait_1 = require("@listen-fire/module-runtime/vendor_wait");
|
|
26
|
+
Object.defineProperty(exports, "vendorWaitMs", { enumerable: true, get: function () { return vendor_wait_1.vendorWaitMs; } });
|
|
24
27
|
/** No call outlives a segment's wall clock (its default), so a permit its
|
|
25
28
|
* holder never released lapses then. */
|
|
26
29
|
exports.HOLD_MS = 900_000;
|
|
@@ -101,6 +104,12 @@ async function limited(limiter, request, call) {
|
|
|
101
104
|
await held.release();
|
|
102
105
|
}
|
|
103
106
|
}
|
|
107
|
+
/** A vendor's "wait `waitMs`" (`vendorWaitMs`, or the caller's default) as a
|
|
108
|
+
* throttle on `caller`'s key: every call made as that caller, by any host
|
|
109
|
+
* sharing `limiter`, is refused until then, and `acquireOrWait` waits it out. */
|
|
110
|
+
async function throttleAfter(limiter, caller, waitMs, now = Date.now()) {
|
|
111
|
+
await limiter.throttle({ key: throttleKey(caller), until: new Date(now + waitMs).toISOString() });
|
|
112
|
+
}
|
|
104
113
|
// ── The slot this process's calls ask ───────────────────────────────────────
|
|
105
114
|
let slot;
|
|
106
115
|
/** The limiter filling the slot: the built-in until a host installs another. */
|
|
@@ -473,6 +473,11 @@ const RENDER_SIGNATURE = {
|
|
|
473
473
|
description: 'The page: "a4" (the default) or "letter".',
|
|
474
474
|
},
|
|
475
475
|
{ name: 'margin', type: { kind: 'number' }, description: 'The margin on every side, in points (a whole number from 0 to 200). The default is 30.' },
|
|
476
|
+
{
|
|
477
|
+
name: 'name',
|
|
478
|
+
type: { kind: 'string' },
|
|
479
|
+
description: 'The file\'s name, as the system it is written to shows it: ".pdf" is added when it does not end with it. The default is "movement-artifact.pdf".',
|
|
480
|
+
},
|
|
476
481
|
],
|
|
477
482
|
dataDependency: 'none',
|
|
478
483
|
// Pure: it reads nothing, writes nowhere, asks no model and never parks.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@listen-fire/engine",
|
|
3
3
|
"license": "Apache-2.0",
|
|
4
|
-
"version": "0.12.0-rc.
|
|
4
|
+
"version": "0.12.0-rc.8",
|
|
5
5
|
"description": "The movement engine for this release's language and its host contract: the Rust engine's shim, the EngineHost families, the run host, the embed kit, and the adapter and model types they reach. Every shell (the hosted product, the `lf` command line, an embedder) runs the same engine. A run pinned to a release this one does not read is refused by name. Embedders reach it only through public/* (the exports map); the internals resolve only under the `movement-engine-internals` condition, which only test runners set",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": "22.20.0"
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"safe-stable-stringify": "2.5.0",
|
|
19
19
|
"zod": "4.1.12",
|
|
20
|
-
"@listen-fire/movement-lang": "^0.12.0-rc.
|
|
21
|
-
"@listen-fire/engine-contracts": "^0.12.0-rc.
|
|
22
|
-
"@listen-fire/module-runtime": "^0.12.0-rc.
|
|
20
|
+
"@listen-fire/movement-lang": "^0.12.0-rc.8",
|
|
21
|
+
"@listen-fire/engine-contracts": "^0.12.0-rc.8",
|
|
22
|
+
"@listen-fire/module-runtime": "^0.12.0-rc.8"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@types/jest": "29.5.14",
|