@ixo/oracle-runtime-workers 0.12.0 → 0.13.0
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/package.json +2 -2
- package/src/do/contracts.ts +28 -0
- package/src/matrix/gateway-do.ts +22 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ixo/oracle-runtime-workers",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "QiForge oracle runtime for Cloudflare Workers — Durable Object per user (SQLite in WASM over DO storage), Matrix E2EE gateway Durable Object, Hono HTTP/SSE shell.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"@composio/core": "0.10.0",
|
|
34
34
|
"@composio/langchain": "0.9.2",
|
|
35
35
|
"@ixo/editor": "6.0.1",
|
|
36
|
-
"@ixo/matrix-bot-workers-sdk": "0.
|
|
36
|
+
"@ixo/matrix-bot-workers-sdk": "0.7.0",
|
|
37
37
|
"@ixo/matrix-crdt": "^1.2.5",
|
|
38
38
|
"@langchain/core": "1.1.48",
|
|
39
39
|
"@langchain/langgraph": "1.3.2",
|
package/src/do/contracts.ts
CHANGED
|
@@ -73,6 +73,34 @@ export interface OracleWorkerEnv {
|
|
|
73
73
|
MATRIX_HOT_ROOMS?: string;
|
|
74
74
|
/** Cap on events replayed per room after a restart (SDK default 0 = unbounded). */
|
|
75
75
|
MATRIX_BACKFILL_MAX_EVENTS?: string;
|
|
76
|
+
/**
|
|
77
|
+
* Gateway memory guards (`@ixo/matrix-bot-workers-sdk` 0.5+): events per
|
|
78
|
+
* room per `/sync` batch (default 30), the largest `/sync` response held
|
|
79
|
+
* in memory (default 16 MiB; over it the batch is re-requested at timeline
|
|
80
|
+
* limit 1 and the rooms catch up through `/messages`), events per catch-up
|
|
81
|
+
* page (default 100), the largest catch-up page (default 10 MiB; a bigger
|
|
82
|
+
* one is fetched again smaller) and the largest ciphertext the bot will
|
|
83
|
+
* decrypt (default 0 = no cap). A cap of `0` switches that guard off.
|
|
84
|
+
*/
|
|
85
|
+
MATRIX_SYNC_TIMELINE_LIMIT?: string;
|
|
86
|
+
MATRIX_SYNC_BYTES_CAP?: string;
|
|
87
|
+
MATRIX_CATCHUP_PAGE_SIZE?: string;
|
|
88
|
+
MATRIX_PAGE_BYTES_CAP?: string;
|
|
89
|
+
MATRIX_MAX_DECRYPT_BYTES?: string;
|
|
90
|
+
/**
|
|
91
|
+
* `true` restores every room key the account's key backup holds on a
|
|
92
|
+
* device's first start (SDK 0.6+), capped at `..._MAX_KEYS` (default
|
|
93
|
+
* 5,000; a larger backup is skipped and keys stay on demand). Off by
|
|
94
|
+
* default: the gateway reads keys from the backup one session at a time.
|
|
95
|
+
*/
|
|
96
|
+
MATRIX_BACKUP_BULK_RESTORE?: string;
|
|
97
|
+
MATRIX_BACKUP_BULK_RESTORE_MAX_KEYS?: string;
|
|
98
|
+
/**
|
|
99
|
+
* Keep-alive fuse (SDK 0.7+): while the gateway object works, its alarm is
|
|
100
|
+
* re-armed this far ahead so a host drain brings it back within the fuse
|
|
101
|
+
* (default 10 s, floor 2 s, `0` = off).
|
|
102
|
+
*/
|
|
103
|
+
MATRIX_KEEPALIVE_FUSE_MS?: string;
|
|
76
104
|
|
|
77
105
|
// --- storage ------------------------------------------------------------
|
|
78
106
|
/**
|
package/src/matrix/gateway-do.ts
CHANGED
|
@@ -310,6 +310,23 @@ export class MatrixGatewayDO
|
|
|
310
310
|
env.MATRIX_RECYCLE_AFTER_SENDS ?? String(DEFAULT_RECYCLE_AFTER_SENDS),
|
|
311
311
|
MATRIX_HOT_ROOMS: env.MATRIX_HOT_ROOMS,
|
|
312
312
|
MATRIX_BACKFILL_MAX_EVENTS: env.MATRIX_BACKFILL_MAX_EVENTS,
|
|
313
|
+
// Memory guards (SDK 0.5+): byte-capped /sync and catch-up pages and
|
|
314
|
+
// an optional ciphertext cap on decryption. Unset = the SDK defaults.
|
|
315
|
+
MATRIX_SYNC_TIMELINE_LIMIT: env.MATRIX_SYNC_TIMELINE_LIMIT,
|
|
316
|
+
MATRIX_SYNC_BYTES_CAP: env.MATRIX_SYNC_BYTES_CAP,
|
|
317
|
+
MATRIX_CATCHUP_PAGE_SIZE: env.MATRIX_CATCHUP_PAGE_SIZE,
|
|
318
|
+
MATRIX_PAGE_BYTES_CAP: env.MATRIX_PAGE_BYTES_CAP,
|
|
319
|
+
MATRIX_MAX_DECRYPT_BYTES: env.MATRIX_MAX_DECRYPT_BYTES,
|
|
320
|
+
// Opt-in bulk restore of the key backup on a device's first start
|
|
321
|
+
// (SDK 0.6+); off by default — the gateway fetches room keys from the
|
|
322
|
+
// backup on demand, one session at a time.
|
|
323
|
+
MATRIX_BACKUP_BULK_RESTORE: env.MATRIX_BACKUP_BULK_RESTORE,
|
|
324
|
+
MATRIX_BACKUP_BULK_RESTORE_MAX_KEYS:
|
|
325
|
+
env.MATRIX_BACKUP_BULK_RESTORE_MAX_KEYS,
|
|
326
|
+
// Keep-alive fuse (SDK 0.7+): the alarm is re-armed a few seconds
|
|
327
|
+
// ahead while the object works, so a host drain brings it back within
|
|
328
|
+
// the fuse instead of at the next cycle.
|
|
329
|
+
MATRIX_KEEPALIVE_FUSE_MS: env.MATRIX_KEEPALIVE_FUSE_MS,
|
|
313
330
|
LOG_LEVEL: env.LOG_LEVEL,
|
|
314
331
|
});
|
|
315
332
|
return {
|
|
@@ -685,14 +702,13 @@ export class MatrixGatewayDO
|
|
|
685
702
|
}
|
|
686
703
|
|
|
687
704
|
/**
|
|
688
|
-
*
|
|
689
|
-
*
|
|
705
|
+
* After every successful start of this instance — a request, the
|
|
706
|
+
* keep-alive alarm bringing it back after a reset, a device rotation
|
|
707
|
+
* (the SDK's `onStarted` hook, detached from the caller). That is the
|
|
690
708
|
* moment to re-dispatch the turns a previous incarnation left unfinished.
|
|
691
709
|
*/
|
|
692
|
-
override async
|
|
693
|
-
|
|
694
|
-
if (result.started) this.scheduleInboxReplay();
|
|
695
|
-
return result;
|
|
710
|
+
protected override async onStarted(_result: StartResult): Promise<void> {
|
|
711
|
+
this.scheduleInboxReplay();
|
|
696
712
|
}
|
|
697
713
|
|
|
698
714
|
private scheduleInboxReplay(): void {
|