@cotal-ai/core 0.135.7 → 0.135.9
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/endpoint.d.ts.map +1 -1
- package/dist/endpoint.js +19 -3
- package/dist/endpoint.js.map +1 -1
- package/dist/presence-heartbeat.d.ts +9 -0
- package/dist/presence-heartbeat.d.ts.map +1 -0
- package/dist/presence-heartbeat.js +9 -0
- package/dist/presence-heartbeat.js.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** The next heartbeat of an endpoint that beats at its own phase. Beats fall on
|
|
2
|
+
* `phaseMs + beat * intervalMs`; the next is the first after `lastBeat` that is not already past, so
|
|
3
|
+
* a beat the loop could not reach in time is skipped rather than queued, and a beat never moves to
|
|
4
|
+
* the instant the previous one happened to run. */
|
|
5
|
+
export declare function nextHeartbeat(phaseMs: number, intervalMs: number, lastBeat: number, nowMs: number): {
|
|
6
|
+
beat: number;
|
|
7
|
+
delayMs: number;
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=presence-heartbeat.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presence-heartbeat.d.ts","sourceRoot":"","sources":["../src/presence-heartbeat.ts"],"names":[],"mappings":"AAAA;;;oDAGoD;AACpD,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAGrI"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** The next heartbeat of an endpoint that beats at its own phase. Beats fall on
|
|
2
|
+
* `phaseMs + beat * intervalMs`; the next is the first after `lastBeat` that is not already past, so
|
|
3
|
+
* a beat the loop could not reach in time is skipped rather than queued, and a beat never moves to
|
|
4
|
+
* the instant the previous one happened to run. */
|
|
5
|
+
export function nextHeartbeat(phaseMs, intervalMs, lastBeat, nowMs) {
|
|
6
|
+
const beat = Math.max(lastBeat + 1, Math.ceil((nowMs - phaseMs) / intervalMs));
|
|
7
|
+
return { beat, delayMs: Math.max(0, phaseMs + beat * intervalMs - nowMs) };
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=presence-heartbeat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presence-heartbeat.js","sourceRoot":"","sources":["../src/presence-heartbeat.ts"],"names":[],"mappings":"AAAA;;;oDAGoD;AACpD,MAAM,UAAU,aAAa,CAAC,OAAe,EAAE,UAAkB,EAAE,QAAgB,EAAE,KAAa;IAChG,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,GAAG,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,GAAG,OAAO,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC;IAC/E,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,GAAG,IAAI,GAAG,UAAU,GAAG,KAAK,CAAC,EAAE,CAAC;AAC7E,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cotal-ai/core",
|
|
3
3
|
"description": "The Cotal protocol: endpoint, subjects, message types, the NATS client layer, and the extension contracts.",
|
|
4
|
-
"version": "0.135.
|
|
4
|
+
"version": "0.135.9",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"cotal",
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
"scripts": {
|
|
95
95
|
"typecheck": "tsc -p tsconfig.json --noEmit && tsc -p tsconfig.smoke.json",
|
|
96
96
|
"build": "tsc -p tsconfig.json",
|
|
97
|
-
"test": "pnpm smoke:seat-idle-results && tsx smoke/native-nkey-signing.smoke.ts && tsx smoke/resolve.smoke.ts && tsx smoke/registry-aliases.smoke.ts && tsx smoke/backup.smoke.ts && tsx smoke/space-auth.smoke.ts && pnpm smoke:schema-own-properties && pnpm smoke:schema-own-properties-controls && node --test smoke/advisory-lock.test.mjs",
|
|
97
|
+
"test": "pnpm smoke:seat-idle-results && tsx smoke/presence-heartbeat.smoke.ts && tsx smoke/native-nkey-signing.smoke.ts && tsx smoke/resolve.smoke.ts && tsx smoke/registry-aliases.smoke.ts && tsx smoke/backup.smoke.ts && tsx smoke/space-auth.smoke.ts && pnpm smoke:schema-own-properties && pnpm smoke:schema-own-properties-controls && node --test smoke/advisory-lock.test.mjs",
|
|
98
98
|
"smoke:backup": "tsx smoke/backup.smoke.ts",
|
|
99
99
|
"smoke:seat-idle-load": "tsx smoke/seat-idle-load.smoke.ts",
|
|
100
100
|
"smoke:seat-idle-results": "tsx smoke/seat-idle-results.smoke.ts",
|