nova-personal-agent-server 0.4.1 → 1.0.2
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/LICENSE +674 -201
- package/README.md +10 -0
- package/bin/nova-space-host.mjs +4 -0
- package/node_modules/@nova-personal-agent/relay/dist/src/cli.js +71 -0
- package/node_modules/@nova-personal-agent/relay/dist/src/client.js +340 -0
- package/node_modules/@nova-personal-agent/relay/dist/src/crypto.js +167 -0
- package/node_modules/@nova-personal-agent/relay/dist/src/live.js +169 -0
- package/node_modules/@nova-personal-agent/relay/dist/src/mailbox.js +217 -0
- package/node_modules/@nova-personal-agent/relay/dist/src/media.js +320 -0
- package/node_modules/@nova-personal-agent/relay/dist/src/pairing.js +13 -0
- package/node_modules/@nova-personal-agent/relay/dist/src/protocol.js +50 -0
- package/node_modules/@nova-personal-agent/relay/dist/src/security.js +305 -0
- package/node_modules/@nova-personal-agent/relay/dist/src/server.js +477 -0
- package/node_modules/@nova-personal-agent/relay/dist/src/source-address.js +58 -0
- package/node_modules/@nova-personal-agent/relay/package.json +1 -0
- package/package.json +11 -4
- package/runtime/dist/src/cascaded-text-provider.js +8 -3
- package/runtime/dist/src/composition/assembly.js +133 -35
- package/runtime/dist/src/composition/cascaded-realtime-assembly.js +114 -59
- package/runtime/dist/src/composition/production-composition.js +57 -21
- package/runtime/dist/src/composition/realtime-assembly.js +160 -52
- package/runtime/dist/src/composition/soul-context.js +22 -0
- package/runtime/dist/src/config/capability-registry.js +48 -3
- package/runtime/dist/src/config/cascaded-realtime-config.js +23 -10
- package/runtime/dist/src/config/config.js +541 -128
- package/runtime/dist/src/config/credential-rotation.js +26 -0
- package/runtime/dist/src/config/data-root.js +764 -0
- package/runtime/dist/src/config/diagnostics.js +3 -1
- package/runtime/dist/src/config/environment-contract.js +190 -188
- package/runtime/dist/src/config/model-routes.js +140 -0
- package/runtime/dist/src/config/voice-credentials.js +55 -0
- package/runtime/dist/src/connectors/composio/index.js +9 -0
- package/runtime/dist/src/connectors/feishu/index.js +258 -44
- package/runtime/dist/src/connectors/macos/mail.js +7 -3
- package/runtime/dist/src/connectors/macos/reader.js +3 -1
- package/runtime/dist/src/conversation-voice-provider.js +5 -2
- package/runtime/dist/src/core/causal-runtime.js +38 -3
- package/runtime/dist/src/core/context-view.js +7 -0
- package/runtime/dist/src/core/guards.js +32 -0
- package/runtime/dist/src/core/runtime.js +3 -0
- package/runtime/dist/src/core/schedule-tools.js +2 -2
- package/runtime/dist/src/core/source-processing-instructions.js +2 -2
- package/runtime/dist/src/core/source-processing-tools.js +3 -1
- package/runtime/dist/src/core/tool-schema.js +42 -7
- package/runtime/dist/src/desktop/desktop-camera.js +3 -5
- package/runtime/dist/src/desktop/desktop-control.js +41 -8
- package/runtime/dist/src/desktop/desktop-session.js +90 -19
- package/runtime/dist/src/desktop/desktop-wire.js +5 -7
- package/runtime/dist/src/desktop/startup-error.js +18 -16
- package/runtime/dist/src/desktop/workbench-acceptance.js +52 -14
- package/runtime/dist/src/desktop-entry.js +6 -2
- package/runtime/dist/src/desktop.js +5 -1
- package/runtime/dist/src/device/attempt.js +65 -0
- package/runtime/dist/src/device/authority.js +159 -0
- package/runtime/dist/src/device/gateway.js +87 -0
- package/runtime/dist/src/device/ledger.js +91 -0
- package/runtime/dist/src/device/ownership.js +92 -0
- package/runtime/dist/src/device/port.js +2 -0
- package/runtime/dist/src/device/schedule-ownership.js +103 -0
- package/runtime/dist/src/executors/acp/transport.js +2 -0
- package/runtime/dist/src/executors/browser.js +4 -3
- package/runtime/dist/src/executors/codex/adapter-project.js +58 -12
- package/runtime/dist/src/executors/codex/app-server-schema.js +12 -21
- package/runtime/dist/src/executors/codex/app-server-transport.js +32 -18
- package/runtime/dist/src/executors/codex/common.js +1 -1
- package/runtime/dist/src/executors/codex/contract.js +12 -16
- package/runtime/dist/src/executors/codex/credential-snapshot.js +1 -9
- package/runtime/dist/src/executors/codex/factory.js +54 -32
- package/runtime/dist/src/executors/codex/host-config.js +69 -20
- package/runtime/dist/src/executors/codex/launch-profile.js +3 -2
- package/runtime/dist/src/executors/codex/local-provider-credential.js +39 -0
- package/runtime/dist/src/executors/codex/process-owner.js +4 -6
- package/runtime/dist/src/executors/codex/production-host.js +33 -34
- package/runtime/dist/src/executors/codex/protocol.js +9 -14
- package/runtime/dist/src/executors/codex/session-title.js +6 -8
- package/runtime/dist/src/executors/codex/spawn-env.js +27 -6
- package/runtime/dist/src/executors/codex/turn-projection.js +12 -17
- package/runtime/dist/src/executors/codex/windows-guardian.js +4 -6
- package/runtime/dist/src/executors/coding/intake.js +12 -7
- package/runtime/dist/src/executors/computer-backend.js +18 -10
- package/runtime/dist/src/executors/computer-config.js +32 -0
- package/runtime/dist/src/executors/computer-device.js +68 -16
- package/runtime/dist/src/executors/computer-worker.js +18 -6
- package/runtime/dist/src/executors/computer.js +29 -56
- package/runtime/dist/src/executors/device-lock.js +14 -5
- package/runtime/dist/src/executors/gui-execution.js +2 -0
- package/runtime/dist/src/executors/index.js +0 -1
- package/runtime/dist/src/executors/mobile.js +9 -8
- package/runtime/dist/src/executors/native-process.js +4 -0
- package/runtime/dist/src/executors/search.js +3 -5
- package/runtime/dist/src/executors/task-resources.js +21 -0
- package/runtime/dist/src/executors/watcher.js +2 -4
- package/runtime/dist/src/experience/host.js +179 -0
- package/runtime/dist/src/index.js +2 -0
- package/runtime/dist/src/knowledge/assembly.js +3 -4
- package/runtime/dist/src/knowledge/embeddings.js +50 -34
- package/runtime/dist/src/knowledge/service.js +1 -0
- package/runtime/dist/src/knowledge/store-client.js +1 -6
- package/runtime/dist/src/knowledge/store-worker.js +1 -3
- package/runtime/dist/src/mem0/resource.js +25 -0
- package/runtime/dist/src/mem0/store-worker.js +234 -21
- package/runtime/dist/src/memory/consumer.js +31 -0
- package/runtime/dist/src/memory/engine-worker.js +210 -0
- package/runtime/dist/src/memory/entry.js +8 -1
- package/runtime/dist/src/memory/explicit-memory.js +20 -0
- package/runtime/dist/src/memory/factory.js +30 -15
- package/runtime/dist/src/memory/grounded-voicemem.js +10 -0
- package/runtime/dist/src/memory/ledger-recall-engine.js +86 -0
- package/runtime/dist/src/memory/prerecall-port.js +27 -0
- package/runtime/dist/src/memory/prerecall.js +1 -1
- package/runtime/dist/src/memory/production-engine.js +151 -0
- package/runtime/dist/src/memory/provenance.js +1 -0
- package/runtime/dist/src/memory/remote-personal-memory.js +3 -1
- package/runtime/dist/src/memory/retrieval.js +107 -22
- package/runtime/dist/src/memory/sensitivity.js +6 -2
- package/runtime/dist/src/memory/source-retrieval.js +11 -0
- package/runtime/dist/src/memory/tool-capabilities.js +46 -0
- package/runtime/dist/src/memory/voicemem-sdk/LICENSE +202 -0
- package/runtime/dist/src/memory/voicemem-sdk/NOTICE.md +97 -0
- package/runtime/dist/src/memory/voicemem-sdk/PATCH-NOTICE.md +23 -0
- package/runtime/dist/src/memory/voicemem-sdk/archive.js +12 -0
- package/runtime/dist/src/memory/voicemem-sdk/audio.js +111 -0
- package/runtime/dist/src/memory/voicemem-sdk/barge-in.js +59 -0
- package/runtime/dist/src/memory/voicemem-sdk/checkpoint.js +56 -0
- package/runtime/dist/src/memory/voicemem-sdk/cleanup.js +139 -0
- package/runtime/dist/src/memory/voicemem-sdk/dashscope-asr.js +254 -0
- package/runtime/dist/src/memory/voicemem-sdk/dashscope-tts.js +247 -0
- package/runtime/dist/src/memory/voicemem-sdk/evaluation.js +330 -0
- package/runtime/dist/src/memory/voicemem-sdk/extraction.js +220 -0
- package/runtime/dist/src/memory/voicemem-sdk/finetune-data.js +115 -0
- package/runtime/dist/src/memory/voicemem-sdk/finetune.js +170 -0
- package/runtime/dist/src/memory/voicemem-sdk/grounded-reply-preferences.js +81 -0
- package/runtime/dist/src/memory/voicemem-sdk/index.js +22 -0
- package/runtime/dist/src/memory/voicemem-sdk/local-embedding.js +164 -0
- package/runtime/dist/src/memory/voicemem-sdk/local-runtime.js +53 -0
- package/runtime/dist/src/memory/voicemem-sdk/local-speaker.js +240 -0
- package/runtime/dist/src/memory/voicemem-sdk/memory.js +767 -0
- package/runtime/dist/src/memory/voicemem-sdk/model-json.js +14 -0
- package/runtime/dist/src/memory/voicemem-sdk/personamem.js +209 -0
- package/runtime/dist/src/memory/voicemem-sdk/prompts/addenda.js +215 -0
- package/runtime/dist/src/memory/voicemem-sdk/prompts/additive-extraction.js +478 -0
- package/runtime/dist/src/memory/voicemem-sdk/prompts/index.js +32 -0
- package/runtime/dist/src/memory/voicemem-sdk/prompts/update-memory.js +152 -0
- package/runtime/dist/src/memory/voicemem-sdk/providers.js +325 -0
- package/runtime/dist/src/memory/voicemem-sdk/ranking.js +65 -0
- package/runtime/dist/src/memory/voicemem-sdk/reaction.js +33 -0
- package/runtime/dist/src/memory/voicemem-sdk/realtime.js +215 -0
- package/runtime/dist/src/memory/voicemem-sdk/reply.js +68 -0
- package/runtime/dist/src/memory/voicemem-sdk/routing.js +209 -0
- package/runtime/dist/src/memory/voicemem-sdk/slots.js +61 -0
- package/runtime/dist/src/memory/voicemem-sdk/speaker-bindings.js +120 -0
- package/runtime/dist/src/memory/voicemem-sdk/speaker-profiles.js +327 -0
- package/runtime/dist/src/memory/voicemem-sdk/store.js +577 -0
- package/runtime/dist/src/memory/voicemem-sdk/stream.js +317 -0
- package/runtime/dist/src/memory/voicemem-sdk/subgraph.js +113 -0
- package/runtime/dist/src/memory/voicemem-sdk/summaries.js +56 -0
- package/runtime/dist/src/memory/voicemem-sdk/time.js +157 -0
- package/runtime/dist/src/memory/voicemem-sdk/types.js +2 -0
- package/runtime/dist/src/memory-ledger/store-client.js +235 -37
- package/runtime/dist/src/memory-ledger/store-worker.js +8 -5
- package/runtime/dist/src/memory-ledger/store.js +91 -1
- package/runtime/dist/src/memory-substrate/consolidation.js +23 -7
- package/runtime/dist/src/memory-substrate/diary.js +27 -0
- package/runtime/dist/src/memory-substrate/engine-outbox.js +107 -0
- package/runtime/dist/src/memory-substrate/explicit-memory.js +112 -0
- package/runtime/dist/src/memory-substrate/fact-fidelity.js +68 -0
- package/runtime/dist/src/memory-substrate/feishu-consent.js +41 -0
- package/runtime/dist/src/memory-substrate/file-authority.js +29 -6
- package/runtime/dist/src/memory-substrate/life-operations.js +35 -9
- package/runtime/dist/src/memory-substrate/markdown-repository.js +271 -65
- package/runtime/dist/src/memory-substrate/memory-documents.js +96 -0
- package/runtime/dist/src/memory-substrate/migration.js +2 -0
- package/runtime/dist/src/memory-substrate/purge.js +12 -2
- package/runtime/dist/src/memory-substrate/resource.js +514 -129
- package/runtime/dist/src/memory-substrate/retrieval.js +8 -5
- package/runtime/dist/src/memory-substrate/source-operations.js +9 -1
- package/runtime/dist/src/memory-substrate/source-processing.js +436 -40
- package/runtime/dist/src/memory-substrate/source-retrieval.js +28 -0
- package/runtime/dist/src/memory-substrate/source-state.js +8 -0
- package/runtime/dist/src/memory-substrate/space-source-input.js +90 -0
- package/runtime/dist/src/memory-substrate/store.js +125 -23
- package/runtime/dist/src/model/goal-checkin-writer.js +72 -0
- package/runtime/dist/src/model/goal-writer.js +80 -0
- package/runtime/dist/src/model/jev-client.js +24 -13
- package/runtime/dist/src/model/model-adapters.js +2 -3
- package/runtime/dist/src/model/model-catalog.js +80 -0
- package/runtime/dist/src/model/model-gateway.js +47 -18
- package/runtime/dist/src/model/model-purpose.js +3 -4
- package/runtime/dist/src/model/personal-writer.js +536 -44
- package/runtime/dist/src/model/proactivity.js +50 -6
- package/runtime/dist/src/model/responses-model-gateway.js +59 -0
- package/runtime/dist/src/model/task-verifier.js +3 -3
- package/runtime/dist/src/model/timeline-anchors.js +77 -0
- package/runtime/dist/src/model/timeline-perspective.js +13 -0
- package/runtime/dist/src/model/timeline-selection.js +182 -0
- package/runtime/dist/src/model/understanding-writer.js +27 -0
- package/runtime/dist/src/model/vision-capability.js +3 -1
- package/runtime/dist/src/model/workbench-writer.js +96 -0
- package/runtime/dist/src/news/feeds.js +6 -10
- package/runtime/dist/src/news/interests.js +23 -0
- package/runtime/dist/src/news/service.js +87 -31
- package/runtime/dist/src/news/sources.json +116 -0
- package/runtime/dist/src/notifications/adapters/space-relay.js +4 -0
- package/runtime/dist/src/notifications/content.js +41 -0
- package/runtime/dist/src/notifications/contracts.js +4 -2
- package/runtime/dist/src/notifications/feed.js +6 -2
- package/runtime/dist/src/notifications/service.js +27 -14
- package/runtime/dist/src/notifications/store.js +3 -1
- package/runtime/dist/src/personal-agent/app-context.js +39 -4
- package/runtime/dist/src/personal-agent/chat-failure.js +37 -0
- package/runtime/dist/src/personal-agent/computer-use/contract.js +42 -0
- package/runtime/dist/src/personal-agent/computer-use/session.js +280 -0
- package/runtime/dist/src/personal-agent/computer-use/skill.js +18 -0
- package/runtime/dist/src/personal-agent/computer-use/tools.js +15 -0
- package/runtime/dist/src/personal-agent/context-candidates.js +9 -13
- package/runtime/dist/src/personal-agent/context-dependencies.js +28 -0
- package/runtime/dist/src/personal-agent/contracts.js +24 -4
- package/runtime/dist/src/personal-agent/conversation-runtime.js +440 -42
- package/runtime/dist/src/personal-agent/conversation-tool-bridge.js +97 -0
- package/runtime/dist/src/personal-agent/conversation-tool-policy.js +22 -0
- package/runtime/dist/src/personal-agent/conversations.js +71 -15
- package/runtime/dist/src/personal-agent/daily-brief.js +5 -0
- package/runtime/dist/src/personal-agent/daily-workbench.js +558 -0
- package/runtime/dist/src/personal-agent/discovery-window.js +36 -0
- package/runtime/dist/src/personal-agent/goal-checkin.js +53 -0
- package/runtime/dist/src/personal-agent/host.js +2379 -223
- package/runtime/dist/src/personal-agent/identity-context.js +33 -0
- package/runtime/dist/src/personal-agent/life.js +129 -11
- package/runtime/dist/src/personal-agent/local-shell.js +181 -0
- package/runtime/dist/src/personal-agent/local-tools.js +234 -0
- package/runtime/dist/src/personal-agent/preferred-name-sync.js +35 -0
- package/runtime/dist/src/personal-agent/profile-warmup.js +100 -39
- package/runtime/dist/src/personal-agent/project-digests.js +7 -3
- package/runtime/dist/src/personal-agent/project-history.js +36 -0
- package/runtime/dist/src/personal-agent/reading-copies.js +183 -0
- package/runtime/dist/src/personal-agent/scheduled-tasks.js +50 -13
- package/runtime/dist/src/personal-agent/scheduled-tool-runtime.js +26 -10
- package/runtime/dist/src/personal-agent/source-processing-agent.js +239 -17
- package/runtime/dist/src/personal-agent/sources.js +9 -1
- package/runtime/dist/src/personal-agent/store.js +124 -14
- package/runtime/dist/src/personal-agent/task-loop.js +3 -0
- package/runtime/dist/src/personal-agent/tasks.js +16 -4
- package/runtime/dist/src/personal-agent/timeline-brief.js +462 -0
- package/runtime/dist/src/personal-agent/timeline-cache.js +191 -0
- package/runtime/dist/src/personal-agent/timeline-cluster.js +30 -0
- package/runtime/dist/src/personal-agent/timeline-inputs.js +47 -0
- package/runtime/dist/src/personal-agent/timeline-time.js +60 -0
- package/runtime/dist/src/personal-agent/understanding-products.js +49 -0
- package/runtime/dist/src/personal-agent/understanding.js +7 -22
- package/runtime/dist/src/personal-agent/workbench-context.js +17 -21
- package/runtime/dist/src/personal-agent/workbench-copy.js +124 -0
- package/runtime/dist/src/personal-agent/workbench-evidence.js +77 -0
- package/runtime/dist/src/personal-agent/workbench-instructions.js +21 -0
- package/runtime/dist/src/personal-agent/workbench-runtime.js +1006 -0
- package/runtime/dist/src/personal-agent/workbench-shell-class.js +304 -0
- package/runtime/dist/src/personal-agent/workbench-store.js +292 -0
- package/runtime/dist/src/personal-agent/workbench-temporal.js +66 -0
- package/runtime/dist/src/projects/project-native-resource.js +10 -8
- package/runtime/dist/src/projects/project-store.js +36 -4
- package/runtime/dist/src/realtime/bridge.js +77 -8
- package/runtime/dist/src/realtime/capabilities.js +19 -0
- package/runtime/dist/src/realtime/cascaded/adapter.js +180 -40
- package/runtime/dist/src/realtime/cascaded/ark-llm.js +150 -24
- package/runtime/dist/src/realtime/cascaded/chat-completions-llm.js +243 -83
- package/runtime/dist/src/realtime/cascaded/llm-stream-limits.js +18 -0
- package/runtime/dist/src/realtime/cascaded/llm.js +96 -0
- package/runtime/dist/src/realtime/cascaded/openai-compatible-speech.js +251 -0
- package/runtime/dist/src/realtime/cascaded/provider.js +8 -0
- package/runtime/dist/src/realtime/evidence.js +1 -1
- package/runtime/dist/src/realtime/frontend-instructions.js +76 -55
- package/runtime/dist/src/realtime/gemini.js +14 -3
- package/runtime/dist/src/realtime/host-delivery.js +37 -4
- package/runtime/dist/src/realtime/protocol.js +18 -3
- package/runtime/dist/src/realtime/provider-projection.js +4 -1
- package/runtime/dist/src/realtime/provider-session.js +73 -16
- package/runtime/dist/src/realtime/qwen-transport.js +35 -4
- package/runtime/dist/src/realtime/qwen.js +144 -9
- package/runtime/dist/src/realtime/service-state.js +0 -1
- package/runtime/dist/src/realtime/service.js +93 -7
- package/runtime/dist/src/realtime/session.js +39 -32
- package/runtime/dist/src/realtime/sglang-native.js +214 -0
- package/runtime/dist/src/realtime/system-prompts.en.js +14 -2
- package/runtime/dist/src/realtime/telemetry.js +6 -3
- package/runtime/dist/src/realtime/tool-continuations.js +84 -7
- package/runtime/dist/src/realtime/transport.js +17 -0
- package/runtime/dist/src/realtime/usage.js +33 -17
- package/runtime/dist/src/realtime/volcengine/ark.js +40 -15
- package/runtime/dist/src/realtime/volcengine/asr.js +2 -1
- package/runtime/dist/src/realtime/volcengine/silence-endpointing.js +1 -7
- package/runtime/dist/src/realtime/volcengine/tts.js +2 -1
- package/runtime/dist/src/server/aoq-chat-server.js +1 -1
- package/runtime/dist/src/server/client-server.js +21 -0
- package/runtime/dist/src/server-entry.js +3 -0
- package/runtime/dist/src/space-host/admin-socket.js +115 -0
- package/runtime/dist/src/space-host/audio-owner.js +44 -0
- package/runtime/dist/src/space-host/cli.js +195 -0
- package/runtime/dist/src/space-host/config.js +247 -0
- package/runtime/dist/src/space-host/context-input.js +12 -0
- package/runtime/dist/src/space-host/contracts.js +10 -0
- package/runtime/dist/src/space-host/host-admin.js +114 -0
- package/runtime/dist/src/space-host/key-delivery.js +28 -0
- package/runtime/dist/src/space-host/mobile-tools.js +9 -0
- package/runtime/dist/src/space-host/model-settings.js +213 -0
- package/runtime/dist/src/space-host/projection.js +37 -0
- package/runtime/dist/src/space-host/push.js +137 -0
- package/runtime/dist/src/space-host/relay-transport.js +55 -0
- package/runtime/dist/src/space-host/service.js +841 -0
- package/runtime/dist/src/space-host/voice-crypto.js +240 -0
- package/runtime/dist/src/space-host/voice.js +600 -0
- package/runtime/dist/src/space-host/windows-secret-key.js +82 -0
- package/runtime/dist/src/storage/private-database.js +7 -10
- package/runtime/dist/src/text/unicode-normalize.js +5 -1
- package/runtime/dist/src/understanding/candidates.js +8 -10
- package/runtime/dist/src/understanding/fixture.js +1 -1
- package/runtime/dist/src/understanding/pipeline.js +4 -4
- package/runtime/dist/src/usage/context.js +23 -0
- package/runtime/dist/src/usage/index.js +4 -0
- package/runtime/dist/src/usage/ledger-worker.js +90 -0
- package/runtime/dist/src/usage/ledger.js +74 -0
- package/runtime/dist/src/usage/model-call.js +63 -0
- package/runtime/dist/src/usage/pricing.js +68 -0
- package/runtime/dist/src/usage/summary.js +69 -0
- package/runtime/dist/src/voicemem/store-client.js +104 -21
- package/runtime/dist/src/voicemem/store-worker.js +5 -8
- package/runtime/dist/src/voicemem/versioned-memory.js +1 -1
- package/src/command.mjs +8 -1
- package/runtime/dist/src/executors/autoglm.js +0 -376
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { assertId, assertPrincipal, encodeEnvelope, RelayError, validateEnvelope } from './protocol.js';
|
|
2
|
+
/** In-memory transport only. It neither persists nor acknowledges messages. Even
|
|
3
|
+
* successful writes may be lost; final replies must separately go through Mailbox
|
|
4
|
+
* and its durable cursor/ACK protocol. Streams are never replayed on reconnect.
|
|
5
|
+
* Invoke sweep periodically from the service to close idle sockets proactively;
|
|
6
|
+
* all device operations independently enforce expiry without relying on a timer. */
|
|
7
|
+
export class LiveRelay {
|
|
8
|
+
authority;
|
|
9
|
+
connections = new Map();
|
|
10
|
+
options;
|
|
11
|
+
lastNow = 0;
|
|
12
|
+
constructor(authority, options = {}) {
|
|
13
|
+
this.authority = authority;
|
|
14
|
+
if (!authority || typeof authority.assertActive !== 'function' || typeof authority.assertCanSend !== 'function') {
|
|
15
|
+
throw new RelayError('authority_required');
|
|
16
|
+
}
|
|
17
|
+
this.options = { clock: Date.now, heartbeatMs: 30_000, maxStreamTtlMs: 60_000,
|
|
18
|
+
maxMessageBytes: 512 * 1024, maxQueueMessages: 64, maxQueueBytes: 1024 * 1024,
|
|
19
|
+
maxConnections: 1024, ...options };
|
|
20
|
+
for (const [key, value] of Object.entries(this.options)) {
|
|
21
|
+
if (key !== 'clock' && (!Number.isSafeInteger(value) || Number(value) <= 0))
|
|
22
|
+
throw new RelayError('invalid_limit');
|
|
23
|
+
}
|
|
24
|
+
if (typeof this.options.clock !== 'function')
|
|
25
|
+
throw new RelayError('invalid_clock');
|
|
26
|
+
}
|
|
27
|
+
connect(principal, receiver) {
|
|
28
|
+
const p = this.authenticate(principal);
|
|
29
|
+
this.sweep();
|
|
30
|
+
const key = this.key(p.space, p.device);
|
|
31
|
+
const prior = this.connections.get(key);
|
|
32
|
+
if (!prior && this.connections.size >= this.options.maxConnections)
|
|
33
|
+
throw new RelayError('connection_limit');
|
|
34
|
+
if (prior)
|
|
35
|
+
this.drop(prior, 'replaced');
|
|
36
|
+
const connection = { key, principal: p, receiver, deadline: this.now() + this.options.heartbeatMs,
|
|
37
|
+
queue: [], messages: 0, bytes: 0, pumping: false, closed: false };
|
|
38
|
+
this.connections.set(key, connection);
|
|
39
|
+
return Object.freeze({
|
|
40
|
+
heartbeat: () => {
|
|
41
|
+
this.authenticate(p);
|
|
42
|
+
if (!this.current(connection))
|
|
43
|
+
throw new RelayError('stale_connection');
|
|
44
|
+
connection.deadline = this.now() + this.options.heartbeatMs;
|
|
45
|
+
},
|
|
46
|
+
close: () => { this.authenticate(p); this.drop(connection, 'disconnected'); },
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
presence(principal, device) {
|
|
50
|
+
const p = this.authenticate(principal);
|
|
51
|
+
assertId(device);
|
|
52
|
+
const connection = this.connections.get(this.key(p.space, device));
|
|
53
|
+
return connection !== undefined && this.current(connection);
|
|
54
|
+
}
|
|
55
|
+
/** Accepts only streams; mailbox envelopes must use durable Mailbox.
|
|
56
|
+
* Returns after bounded enqueue, not delivery or persistence. Rejection at
|
|
57
|
+
* later dequeue (expiry/revocation) drops that frame, without an offline queue. */
|
|
58
|
+
send(principal, envelope) {
|
|
59
|
+
const p = this.authenticate(principal);
|
|
60
|
+
const bytes = validateEnvelope(envelope, p, this.options.maxMessageBytes);
|
|
61
|
+
const snapshot = Object.freeze(JSON.parse(encodeEnvelope(envelope)));
|
|
62
|
+
this.authority.assertCanSend(p, snapshot);
|
|
63
|
+
if (snapshot.chan !== 'stream')
|
|
64
|
+
throw new RelayError('stream_required');
|
|
65
|
+
const now = this.now();
|
|
66
|
+
if (snapshot.expiresAt !== null && snapshot.expiresAt <= now)
|
|
67
|
+
throw new RelayError('expired');
|
|
68
|
+
if (snapshot.chan === 'stream' && snapshot.expiresAt - now > this.options.maxStreamTtlMs)
|
|
69
|
+
throw new RelayError('ttl_too_long');
|
|
70
|
+
const connection = this.connections.get(this.key(p.space, snapshot.to));
|
|
71
|
+
if (!connection || !this.current(connection))
|
|
72
|
+
throw new RelayError('offline');
|
|
73
|
+
if (connection.messages + 1 > this.options.maxQueueMessages || connection.bytes + bytes > this.options.maxQueueBytes) {
|
|
74
|
+
this.drop(connection, 'backpressure');
|
|
75
|
+
throw new RelayError('backpressure');
|
|
76
|
+
}
|
|
77
|
+
connection.queue.push({ principal: p, envelope: snapshot, bytes });
|
|
78
|
+
connection.messages++;
|
|
79
|
+
connection.bytes += bytes;
|
|
80
|
+
if (!connection.pumping) {
|
|
81
|
+
// pump has a rejection handler even if a clock/authority/transport throws.
|
|
82
|
+
void this.pump(connection).catch(() => this.drop(connection, 'transport_failed'));
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
/** Trusted service maintenance, not a device endpoint. */
|
|
86
|
+
sweep() {
|
|
87
|
+
for (const connection of this.connections.values())
|
|
88
|
+
this.current(connection);
|
|
89
|
+
}
|
|
90
|
+
authenticate(principal) {
|
|
91
|
+
const snapshot = Object.freeze({ space: principal.space, device: principal.device, epoch: principal.epoch });
|
|
92
|
+
assertPrincipal(snapshot);
|
|
93
|
+
this.authority.assertActive(snapshot);
|
|
94
|
+
return snapshot;
|
|
95
|
+
}
|
|
96
|
+
now() {
|
|
97
|
+
const now = this.options.clock();
|
|
98
|
+
if (!Number.isSafeInteger(now) || now < 0)
|
|
99
|
+
throw new RelayError('invalid_clock');
|
|
100
|
+
this.lastNow = Math.max(this.lastNow, now);
|
|
101
|
+
return this.lastNow;
|
|
102
|
+
}
|
|
103
|
+
key(space, device) { return `${space}:${device}`; }
|
|
104
|
+
current(connection) {
|
|
105
|
+
if (connection.closed || this.connections.get(connection.key) !== connection)
|
|
106
|
+
return false;
|
|
107
|
+
if (connection.deadline <= this.now()) {
|
|
108
|
+
this.drop(connection, 'heartbeat_expired');
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
try {
|
|
112
|
+
this.authority.assertActive(connection.principal);
|
|
113
|
+
}
|
|
114
|
+
catch {
|
|
115
|
+
this.drop(connection, 'revoked');
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
return true;
|
|
119
|
+
}
|
|
120
|
+
drop(connection, reason) {
|
|
121
|
+
if (connection.closed)
|
|
122
|
+
return;
|
|
123
|
+
connection.closed = true;
|
|
124
|
+
if (this.connections.get(connection.key) === connection)
|
|
125
|
+
this.connections.delete(connection.key);
|
|
126
|
+
connection.queue.length = 0;
|
|
127
|
+
connection.messages = 0;
|
|
128
|
+
connection.bytes = 0;
|
|
129
|
+
try {
|
|
130
|
+
connection.receiver.close(reason);
|
|
131
|
+
}
|
|
132
|
+
catch { /* Transport cleanup must not corrupt relay state. */ }
|
|
133
|
+
}
|
|
134
|
+
async pump(connection) {
|
|
135
|
+
connection.pumping = true;
|
|
136
|
+
try {
|
|
137
|
+
while (this.current(connection)) {
|
|
138
|
+
const pending = connection.queue.shift();
|
|
139
|
+
if (!pending)
|
|
140
|
+
return;
|
|
141
|
+
try {
|
|
142
|
+
const { principal, envelope } = pending;
|
|
143
|
+
if (envelope.expiresAt !== null && envelope.expiresAt <= this.now())
|
|
144
|
+
continue;
|
|
145
|
+
try {
|
|
146
|
+
this.authority.assertActive(principal);
|
|
147
|
+
this.authority.assertCanSend(principal, envelope);
|
|
148
|
+
}
|
|
149
|
+
catch {
|
|
150
|
+
continue;
|
|
151
|
+
}
|
|
152
|
+
await connection.receiver.send(envelope);
|
|
153
|
+
}
|
|
154
|
+
finally {
|
|
155
|
+
if (!connection.closed) {
|
|
156
|
+
connection.messages--;
|
|
157
|
+
connection.bytes -= pending.bytes;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
catch {
|
|
163
|
+
this.drop(connection, 'transport_failed');
|
|
164
|
+
}
|
|
165
|
+
finally {
|
|
166
|
+
connection.pumping = false;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { DatabaseSync } from 'node:sqlite';
|
|
3
|
+
import { assertPrincipal, encodeEnvelope, RelayError, validateEnvelope } from './protocol.js';
|
|
4
|
+
const defaults = { maxMessageBytes: 16_384, maxMessages: 100_000, maxMessagesPerDevice: 20_000,
|
|
5
|
+
maxBytes: 256 * 1024 * 1024, maxBytesPerDevice: 64 * 1024 * 1024,
|
|
6
|
+
maxHistory: 1_000_000, maxHistoryPerDevice: 100_000, maxPageSize: 100 };
|
|
7
|
+
/** Synchronous, transactional opaque mailbox kernel; callers must supply trusted authority.
|
|
8
|
+
* Dedup hashes are never evicted: history quotas deliberately fail closed when full.
|
|
9
|
+
* prune releases payload capacity, not ID history. Database lifecycle/reset needs a new
|
|
10
|
+
* namespace and external snapshot coordination, never reuse this namespace after deleting history.
|
|
11
|
+
*/
|
|
12
|
+
export class MailboxStore {
|
|
13
|
+
authority;
|
|
14
|
+
db;
|
|
15
|
+
limits;
|
|
16
|
+
clock;
|
|
17
|
+
lastNow = 0;
|
|
18
|
+
constructor(path, authority, options = {}) {
|
|
19
|
+
this.authority = authority;
|
|
20
|
+
if (!authority || typeof authority.assertActive !== 'function' || typeof authority.assertCanSend !== 'function') {
|
|
21
|
+
throw new RelayError('authority_required');
|
|
22
|
+
}
|
|
23
|
+
this.limits = { ...defaults };
|
|
24
|
+
for (const key of Object.keys(defaults)) {
|
|
25
|
+
const value = options[key] ?? defaults[key];
|
|
26
|
+
if (!Number.isSafeInteger(value) || value < 1)
|
|
27
|
+
throw new RelayError('invalid_options');
|
|
28
|
+
this.limits[key] = value;
|
|
29
|
+
}
|
|
30
|
+
this.clock = options.now ?? Date.now;
|
|
31
|
+
if (typeof this.clock !== 'function')
|
|
32
|
+
throw new RelayError('invalid_clock');
|
|
33
|
+
this.db = new DatabaseSync(path);
|
|
34
|
+
// DELETE journal avoids a long-lived WAL growing behind readers; SQLite reuses freed pages.
|
|
35
|
+
this.db.exec(`PRAGMA journal_mode=DELETE; PRAGMA synchronous=FULL; PRAGMA busy_timeout=5000;
|
|
36
|
+
CREATE TABLE IF NOT EXISTS mailbox_devices (
|
|
37
|
+
space TEXT NOT NULL, device TEXT NOT NULL, last INTEGER NOT NULL DEFAULT 0,
|
|
38
|
+
ack INTEGER NOT NULL DEFAULT 0, delivered INTEGER NOT NULL DEFAULT 0,
|
|
39
|
+
floor INTEGER NOT NULL DEFAULT 0, PRIMARY KEY(space, device));
|
|
40
|
+
CREATE TABLE IF NOT EXISTS mailbox_history (
|
|
41
|
+
space TEXT NOT NULL, sender TEXT NOT NULL, id TEXT NOT NULL, recipient TEXT NOT NULL,
|
|
42
|
+
seq INTEGER NOT NULL, digest TEXT NOT NULL, PRIMARY KEY(space,sender,id));
|
|
43
|
+
CREATE INDEX IF NOT EXISTS mailbox_history_recipient ON mailbox_history(space,recipient);
|
|
44
|
+
CREATE TABLE IF NOT EXISTS mailbox_messages (
|
|
45
|
+
space TEXT NOT NULL, recipient TEXT NOT NULL, seq INTEGER NOT NULL,
|
|
46
|
+
payload TEXT NOT NULL, bytes INTEGER NOT NULL, expires INTEGER,
|
|
47
|
+
PRIMARY KEY(space,recipient,seq));`);
|
|
48
|
+
}
|
|
49
|
+
// Clamp only within this instance. The adapter must provide trustworthy wall time across restarts.
|
|
50
|
+
now() {
|
|
51
|
+
const now = this.clock();
|
|
52
|
+
if (!Number.isSafeInteger(now) || now < 0)
|
|
53
|
+
throw new RelayError('invalid_clock');
|
|
54
|
+
this.lastNow = Math.max(this.lastNow, now);
|
|
55
|
+
return this.lastNow;
|
|
56
|
+
}
|
|
57
|
+
active(p) {
|
|
58
|
+
this.authority.assertActive(p);
|
|
59
|
+
assertPrincipal(p);
|
|
60
|
+
}
|
|
61
|
+
transaction(operation) {
|
|
62
|
+
this.db.exec('BEGIN IMMEDIATE');
|
|
63
|
+
try {
|
|
64
|
+
const result = operation();
|
|
65
|
+
this.db.exec('COMMIT');
|
|
66
|
+
return result;
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
this.db.exec('ROLLBACK');
|
|
70
|
+
throw error;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
state(p) {
|
|
74
|
+
return this.db.prepare('SELECT last,ack,delivered,floor FROM mailbox_devices WHERE space=? AND device=?')
|
|
75
|
+
.get(p.space, p.device) ?? { last: 0, ack: 0, delivered: 0, floor: 0 };
|
|
76
|
+
}
|
|
77
|
+
cursor(cursor) {
|
|
78
|
+
if (!Number.isSafeInteger(cursor) || cursor < 0)
|
|
79
|
+
throw new RelayError('invalid_cursor');
|
|
80
|
+
}
|
|
81
|
+
send(p, envelope) {
|
|
82
|
+
this.active(p);
|
|
83
|
+
validateEnvelope(envelope, p, this.limits.maxMessageBytes);
|
|
84
|
+
if (envelope.chan !== 'mailbox')
|
|
85
|
+
throw new RelayError('invalid_channel');
|
|
86
|
+
this.authority.assertCanSend(p, envelope);
|
|
87
|
+
const payload = encodeEnvelope(envelope);
|
|
88
|
+
const bytes = Buffer.byteLength(payload);
|
|
89
|
+
const digest = createHash('sha256').update(payload).digest('hex');
|
|
90
|
+
return this.transaction(() => {
|
|
91
|
+
const old = this.db.prepare('SELECT seq,digest FROM mailbox_history WHERE space=? AND sender=? AND id=?')
|
|
92
|
+
.get(p.space, p.device, envelope.id);
|
|
93
|
+
if (old) {
|
|
94
|
+
if (old.digest !== digest)
|
|
95
|
+
throw new RelayError('id_conflict');
|
|
96
|
+
return { seq: Number(old.seq), duplicate: true };
|
|
97
|
+
}
|
|
98
|
+
this.now();
|
|
99
|
+
const pressure = () => {
|
|
100
|
+
const global = this.db.prepare('SELECT count(*) AS count, coalesce(sum(bytes),0) AS bytes FROM mailbox_messages').get();
|
|
101
|
+
const local = this.db.prepare('SELECT count(*) AS count, coalesce(sum(bytes),0) AS bytes FROM mailbox_messages WHERE space=? AND recipient=?')
|
|
102
|
+
.get(p.space, envelope.to);
|
|
103
|
+
return { global: Number(global.count) >= this.limits.maxMessages || Number(global.bytes) + bytes > this.limits.maxBytes,
|
|
104
|
+
local: Number(local.count) >= this.limits.maxMessagesPerDevice || Number(local.bytes) + bytes > this.limits.maxBytesPerDevice };
|
|
105
|
+
};
|
|
106
|
+
let full = pressure();
|
|
107
|
+
if (full.global || full.local) {
|
|
108
|
+
// ACKed ciphertext is disposable; retain its permanent ID hash and an explicit recovery floor.
|
|
109
|
+
const space = full.global ? null : p.space, device = full.global ? null : envelope.to;
|
|
110
|
+
this.db.prepare(`UPDATE mailbox_devices SET floor=max(floor,ack) WHERE (space,device) IN (
|
|
111
|
+
SELECT m.space,m.recipient FROM mailbox_messages m JOIN mailbox_devices d ON d.space=m.space AND d.device=m.recipient
|
|
112
|
+
WHERE m.seq<=d.ack AND (? IS NULL OR (m.space=? AND m.recipient=?)))`).run(space, space, device);
|
|
113
|
+
this.db.prepare(`DELETE FROM mailbox_messages WHERE (? IS NULL OR (space=? AND recipient=?)) AND EXISTS (
|
|
114
|
+
SELECT 1 FROM mailbox_devices d WHERE d.space=mailbox_messages.space AND d.device=mailbox_messages.recipient
|
|
115
|
+
AND mailbox_messages.seq<=d.ack)`).run(space, space, device);
|
|
116
|
+
full = pressure();
|
|
117
|
+
if (full.global || full.local)
|
|
118
|
+
throw new RelayError('capacity_exceeded');
|
|
119
|
+
}
|
|
120
|
+
const history = this.db.prepare('SELECT count(*) AS count FROM mailbox_history').get();
|
|
121
|
+
const localHistory = this.db.prepare('SELECT count(*) AS count FROM mailbox_history WHERE space=? AND recipient=?').get(p.space, envelope.to);
|
|
122
|
+
if (Number(history.count) >= this.limits.maxHistory || Number(localHistory.count) >= this.limits.maxHistoryPerDevice) {
|
|
123
|
+
throw new RelayError('history_capacity_exceeded');
|
|
124
|
+
}
|
|
125
|
+
this.db.prepare('INSERT OR IGNORE INTO mailbox_devices(space,device) VALUES (?,?)').run(p.space, envelope.to);
|
|
126
|
+
const seq = this.state({ ...p, device: envelope.to }).last + 1;
|
|
127
|
+
if (!Number.isSafeInteger(seq))
|
|
128
|
+
throw new RelayError('sequence_exhausted');
|
|
129
|
+
this.db.prepare('UPDATE mailbox_devices SET last=? WHERE space=? AND device=?').run(seq, p.space, envelope.to);
|
|
130
|
+
this.db.prepare('INSERT INTO mailbox_messages VALUES (?,?,?,?,?,?)').run(p.space, envelope.to, seq, payload, bytes, envelope.expiresAt);
|
|
131
|
+
this.db.prepare('INSERT INTO mailbox_history VALUES (?,?,?,?,?,?)').run(p.space, p.device, envelope.id, envelope.to, seq, digest);
|
|
132
|
+
return { seq, duplicate: false };
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
read(p, options = {}) {
|
|
136
|
+
this.active(p);
|
|
137
|
+
const limit = options.limit ?? this.limits.maxPageSize;
|
|
138
|
+
if (!Number.isSafeInteger(limit) || limit < 1 || limit > this.limits.maxPageSize)
|
|
139
|
+
throw new RelayError('invalid_limit');
|
|
140
|
+
const maxBytes = options.maxBytes ?? Number.MAX_SAFE_INTEGER;
|
|
141
|
+
if (!Number.isSafeInteger(maxBytes) || maxBytes < 1)
|
|
142
|
+
throw new RelayError('invalid_limit');
|
|
143
|
+
return this.transaction(() => {
|
|
144
|
+
const state = this.state(p);
|
|
145
|
+
const after = options.after ?? state.ack;
|
|
146
|
+
this.cursor(after);
|
|
147
|
+
if (after < state.floor)
|
|
148
|
+
throw new RelayError('cursor_expired');
|
|
149
|
+
if (after > Math.max(state.delivered, state.floor))
|
|
150
|
+
throw new RelayError('cursor_not_delivered');
|
|
151
|
+
const rows = this.db.prepare('SELECT seq,payload,expires FROM mailbox_messages WHERE space=? AND recipient=? AND seq>? ORDER BY seq LIMIT ?')
|
|
152
|
+
.iterate(p.space, p.device, after, limit);
|
|
153
|
+
const now = this.now();
|
|
154
|
+
const messages = [];
|
|
155
|
+
let bytes = 0;
|
|
156
|
+
let nextCursor = after;
|
|
157
|
+
for (const row of rows) {
|
|
158
|
+
// Pre-upgrade mailboxes may contain sender-controlled deadlines. Expired legacy
|
|
159
|
+
// rows are non-deliverable, but must not poison the recipient's entire cursor.
|
|
160
|
+
if (row.expires !== null && Number(row.expires) <= now) {
|
|
161
|
+
nextCursor = Number(row.seq);
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
164
|
+
const message = { seq: Number(row.seq), envelope: JSON.parse(String(row.payload)) };
|
|
165
|
+
const entryBytes = Buffer.byteLength(JSON.stringify(message)) + (messages.length ? 1 : 0);
|
|
166
|
+
if (bytes + entryBytes > maxBytes) {
|
|
167
|
+
if (!messages.length)
|
|
168
|
+
throw new RelayError('page_too_small');
|
|
169
|
+
break;
|
|
170
|
+
}
|
|
171
|
+
bytes += entryBytes;
|
|
172
|
+
messages.push(message);
|
|
173
|
+
nextCursor = message.seq;
|
|
174
|
+
}
|
|
175
|
+
// Keep legacy rows until normal pruning so a lost ACK/restart can traverse the gap again.
|
|
176
|
+
// An explicit post-snapshot read at the retained floor delivers that cursor even
|
|
177
|
+
// when the page is empty, allowing recovery to be durably acknowledged.
|
|
178
|
+
if (nextCursor > state.delivered)
|
|
179
|
+
this.db.prepare('UPDATE mailbox_devices SET delivered=max(delivered,?) WHERE space=? AND device=?').run(nextCursor, p.space, p.device);
|
|
180
|
+
return { messages, nextCursor, ackCursor: state.ack, hasMore: nextCursor < state.last };
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
acknowledge(p, cursor) {
|
|
184
|
+
this.active(p);
|
|
185
|
+
this.cursor(cursor);
|
|
186
|
+
return this.transaction(() => {
|
|
187
|
+
const state = this.state(p);
|
|
188
|
+
if (cursor > state.delivered)
|
|
189
|
+
throw new RelayError('cursor_not_delivered');
|
|
190
|
+
const ack = Math.max(state.ack, cursor);
|
|
191
|
+
this.db.prepare('UPDATE mailbox_devices SET ack=? WHERE space=? AND device=?').run(ack, p.space, p.device);
|
|
192
|
+
return ack;
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
/** Deliberate prefix loss: subsequent reads below throughCursor fail cursor_expired.
|
|
196
|
+
* After coordinating snapshot recovery, query status(p) and resume with
|
|
197
|
+
* read(p, {after: status.retainedAfter}). A stale concurrent floor still fails explicitly.
|
|
198
|
+
*/
|
|
199
|
+
prune(p, throughCursor) {
|
|
200
|
+
this.active(p);
|
|
201
|
+
this.cursor(throughCursor);
|
|
202
|
+
this.transaction(() => {
|
|
203
|
+
const state = this.state(p);
|
|
204
|
+
if (throughCursor > state.last)
|
|
205
|
+
throw new RelayError('invalid_cursor');
|
|
206
|
+
this.db.prepare('DELETE FROM mailbox_messages WHERE space=? AND recipient=? AND seq<=?').run(p.space, p.device, throughCursor);
|
|
207
|
+
this.db.prepare('UPDATE mailbox_devices SET floor=max(floor,?) WHERE space=? AND device=?').run(throughCursor, p.space, p.device);
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
/** Recipient-scoped recovery metadata; querying does not advance delivery or ACK. */
|
|
211
|
+
status(p) {
|
|
212
|
+
this.active(p);
|
|
213
|
+
const state = this.state(p);
|
|
214
|
+
return { lastCursor: state.last, ackCursor: state.ack, deliveredCursor: state.delivered, retainedAfter: state.floor };
|
|
215
|
+
}
|
|
216
|
+
close() { this.db.close(); }
|
|
217
|
+
}
|