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
|
@@ -1,13 +1,9 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import sources from './sources.json' with { type: 'json' };
|
|
1
3
|
import { createHash } from 'node:crypto';
|
|
2
4
|
import { SaxesParser } from 'saxes';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
{ id: 'guardian', name: 'The Guardian · Technology', url: 'https://www.theguardian.com/uk/technology/rss', language: 'en' },
|
|
6
|
-
{ id: 'ithome', name: 'IT之家', url: 'https://www.ithome.com/rss/', language: 'zh-CN' },
|
|
7
|
-
{ id: 'sspai', name: '少数派', url: 'https://sspai.com/feed', language: 'zh-CN' },
|
|
8
|
-
{ id: 'solidot', name: 'Solidot', url: 'https://www.solidot.org/index.rss', language: 'zh-CN' },
|
|
9
|
-
{ id: '36kr', name: '36氪', url: 'https://www.36kr.com/feed', language: 'zh-CN' },
|
|
10
|
-
];
|
|
5
|
+
const sourceSchema = z.object({ id: z.string(), name: z.string(), url: z.url(), language: z.enum(['zh-CN', 'en']) });
|
|
6
|
+
export const NEWS_SOURCES = sourceSchema.array().parse(sources);
|
|
11
7
|
export const newsLanguage = (locale) => /^zh(?:[-_]|$)/iu.test(locale) ? 'zh-CN' : 'en';
|
|
12
8
|
export const digest = (text) => createHash('sha256').update(text).digest('hex');
|
|
13
9
|
export function articleUrl(value) {
|
|
@@ -27,7 +23,7 @@ export function articleUrl(value) {
|
|
|
27
23
|
return null;
|
|
28
24
|
}
|
|
29
25
|
}
|
|
30
|
-
function plain(text) { return text.replace(/<[^>]*>/gu, ' ').replace(/&(?:nbsp|amp|lt|gt|quot|apos);/gu, v => ({ ' ': ' ', '&': '&', '<': '<', '>': '>', '"': '"', ''': "'" }[v] ?? v)).replace(/&#(x[0-9a-f]+|[0-9]+);/giu, (_all, value) => { const code = Number.parseInt(
|
|
26
|
+
function plain(text) { return text.replace(/<[^>]*>/gu, ' ').replace(/&(?:nbsp|amp|lt|gt|quot|apos);/gu, v => ({ ' ': ' ', '&': '&', '<': '<', '>': '>', '"': '"', ''': "'" }[v] ?? v)).replace(/&#(x[0-9a-f]+|[0-9]+);/giu, (_all, value) => { const hex = /^x/iu.test(value), code = Number.parseInt(hex ? value.slice(1) : value, hex ? 16 : 10); return code > 0 && code <= 0x10ffff ? String.fromCodePoint(code) : ''; }).replace(/\s+/gu, ' ').trim(); }
|
|
31
27
|
export function parseFeed(xml, source, now) {
|
|
32
28
|
if (Buffer.byteLength(xml) > 1024 * 1024)
|
|
33
29
|
throw Error('feed_too_large');
|
|
@@ -62,7 +58,7 @@ export function parseFeed(xml, source, now) {
|
|
|
62
58
|
if (fields && stack.length === itemDepth) {
|
|
63
59
|
const title = plain(fields.title ?? '').slice(0, 300), url = articleUrl((fields.link ?? '').trim());
|
|
64
60
|
const summary = plain(fields.description ?? fields.summary ?? fields['content:encoded'] ?? fields.content ?? '').slice(0, 1500);
|
|
65
|
-
const timestamp = Date.parse(fields.pubdate ?? fields.published ?? fields.updated ?? '');
|
|
61
|
+
const timestamp = Date.parse(fields.pubdate ?? fields.published ?? fields.updated ?? fields['dc:date'] ?? '');
|
|
66
62
|
const published_at = Number.isFinite(timestamp) && timestamp <= now.getTime() + 300000 ? new Date(timestamp).toISOString() : null;
|
|
67
63
|
if (title && url && articles.length < 200) {
|
|
68
64
|
const id = digest(url);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** Local, bounded hints only: never record these guesses as personal facts. */
|
|
2
|
+
export function lifestyleNewsInterests(texts, language = 'en') {
|
|
3
|
+
const cues = [
|
|
4
|
+
['健康', 'Health', /健康|健身|睡眠|营养|\b(?:health|fitness|sleep|nutrition)\b/iu],
|
|
5
|
+
['美食', 'Food', /美食|烹饪|做饭|食谱|\b(?:cooking|recipes?|food)\b/iu],
|
|
6
|
+
['旅行', 'Travel', /旅行|旅游|徒步|\b(?:travel|hiking)\b/iu],
|
|
7
|
+
['体育', 'Sport', /足球|篮球|网球|跑步|游泳|体育|\b(?:football|basketball|tennis|running|swimming|sports?)\b/iu],
|
|
8
|
+
['文化艺术', 'Arts and culture', /艺术|博物馆|文学|读书|\b(?:arts?|museums?|literature|reading)\b/iu],
|
|
9
|
+
['音乐电影', 'Music and film', /音乐|电影|演唱会|\b(?:music|films?|cinema|concerts?)\b/iu],
|
|
10
|
+
['园艺', 'Gardening', /园艺|种花|\bgardening\b/iu],
|
|
11
|
+
['宠物', 'Pets', /宠物|养猫|养狗|\bpets?\b/iu],
|
|
12
|
+
];
|
|
13
|
+
const result = [];
|
|
14
|
+
for (const text of texts.slice(-40).reverse())
|
|
15
|
+
for (const [zh, en, pattern] of cues)
|
|
16
|
+
if (pattern.test(text.slice(0, 1000))) {
|
|
17
|
+
const label = /^zh/iu.test(language) ? zh : en;
|
|
18
|
+
if (!result.includes(label))
|
|
19
|
+
result.push(label);
|
|
20
|
+
}
|
|
21
|
+
return result.slice(0, 8);
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=interests.js.map
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { newsArticleSchema } from '../personal-agent/life.js';
|
|
3
3
|
import { BoundedJsonStore } from '../storage/bounded-json.js';
|
|
4
|
+
import { NEWS_MAX_AGE_MS } from '../personal-agent/contracts.js';
|
|
4
5
|
import { NEWS_SOURCES, newsLanguage, digest, fetchFeed } from './feeds.js';
|
|
5
6
|
import { scoreSchema, validateScores } from './ranking.js';
|
|
6
|
-
const interest = z.object({ id: z.string(), text: z.string().min(1).max(100), weight: z.number().min(0).max(2) });
|
|
7
|
+
const interest = z.object({ id: z.string(), text: z.string().min(1).max(100), weight: z.number().min(0).max(2), seeded: z.boolean().optional(), seeded_at: z.string().optional() });
|
|
7
8
|
const article = z.object({ id: z.string(), source_id: z.string(), title: z.string().max(300), summary: z.string().max(1500), url: z.string().url(), published_at: z.string().nullable(), first_seen: z.string(), content_hash: z.string(), read: z.boolean(), saved: z.boolean(), ranking: scoreSchema.extend({ profile_version: z.number(), ready_at: z.string() }).nullable() });
|
|
8
|
-
const schema = z.object({ version: z.literal(1), profile_version: z.number(), enabled: z.boolean(), explore: z.boolean(), interests: z.array(interest).max(8), /**
|
|
9
|
+
const schema = z.object({ version: z.literal(1), profile_version: z.number(), enabled: z.boolean(), explore: z.boolean(), interests: z.array(interest).max(8), /** Mined interests may rank the page (authorized), never personal facts or push authorization. */ interests_seeded: z.boolean().default(false), blocked: z.array(z.string()).max(20), items: z.array(article).max(500), sources: z.array(z.object({ id: z.string(), last_attempt: z.string().nullable(), last_success: z.string().nullable(), error: z.string().nullable(), count: z.number() })), rank_error: z.string().nullable() });
|
|
10
|
+
/** A push interrupts the user, so it needs a clearly strong match and news that is still news. */
|
|
11
|
+
const PUSH_MIN_STRENGTH = 0.85, PUSH_MAX_AGE_MS = NEWS_MAX_AGE_MS;
|
|
9
12
|
// ponytail: bounded 500-article cache; add indexed storage only if this measured ceiling grows.
|
|
10
13
|
export class NewsService {
|
|
11
14
|
options;
|
|
@@ -35,6 +38,7 @@ export class NewsService {
|
|
|
35
38
|
// News is on by default; a never-configured file that says off is the old default, while any explicit choice advanced profile_version.
|
|
36
39
|
if (this.#state.profile_version === 0 && !this.#state.enabled)
|
|
37
40
|
this.#state = { ...this.#state, enabled: true };
|
|
41
|
+
this.#state.interests = this.#state.interests.map(i => ({ ...i, seeded: i.seeded ?? this.#state.interests_seeded }));
|
|
38
42
|
this.#opened = true;
|
|
39
43
|
this.#abort = new AbortController();
|
|
40
44
|
const delay = this.options.firstRefreshMs === undefined ? 20_000 : this.options.firstRefreshMs;
|
|
@@ -50,26 +54,51 @@ export class NewsService {
|
|
|
50
54
|
refreshSoon() { return this.#first ? Promise.resolve() : this.refresh(); }
|
|
51
55
|
async close() { this.#opened = false; clearTimeout(this.#first); this.#first = undefined; clearInterval(this.#timer); this.#abort.abort(); await this.#run?.catch(() => { }); await this.#tail; }
|
|
52
56
|
async configure(raw) {
|
|
53
|
-
const value = z.object({ enabled: z.boolean(), interests: z.array(z.string().trim().min(1).max(100)).max(8), explore: z.boolean(), expected_version: z.number().int().optional()
|
|
57
|
+
const value = z.object({ enabled: z.boolean(), interests: z.array(z.string().trim().min(1).max(100)).max(8), explore: z.boolean(), expected_version: z.number().int().optional(), /** The compact interests row resubmits the mined interests it displayed; true keeps those mined (still out of push) and confirms only added words. Settings saves omit it: submitting confirms. */ keep_mined: z.boolean().optional() }).strict().parse(raw);
|
|
54
58
|
return this.#serial(async () => {
|
|
55
59
|
if (value.expected_version !== undefined && value.expected_version !== this.#state.profile_version)
|
|
56
60
|
throw Error('version_conflict');
|
|
57
61
|
const next = structuredClone(this.#state);
|
|
58
62
|
const texts = [...new Set(value.interests)];
|
|
59
|
-
const interests = texts.map(text => ({ id: digest(text).slice(0, 16), text, weight: next.interests.find(i => i.text === text)?.weight ?? 1 }));
|
|
60
|
-
if (next.profile_version === 0 || value.enabled !== next.enabled || value.explore !== next.explore || JSON.stringify(interests.map(i => i.text).sort()) !== JSON.stringify(next.interests.map(i => i.text).sort()))
|
|
63
|
+
const interests = texts.map(text => ({ id: digest(text).slice(0, 16), text, weight: next.interests.find(i => i.text === text)?.weight ?? 1, seeded: value.keep_mined === true && next.interests.find(i => i.text === text)?.seeded === true }));
|
|
64
|
+
if (next.interests.some(i => i.seeded) || next.profile_version === 0 || value.enabled !== next.enabled || value.explore !== next.explore || JSON.stringify(interests.map(i => i.text).sort()) !== JSON.stringify(next.interests.map(i => i.text).sort()))
|
|
61
65
|
next.profile_version++;
|
|
62
|
-
Object.assign(next, { enabled: value.enabled, explore: value.explore, interests, interests_seeded:
|
|
66
|
+
Object.assign(next, { enabled: value.enabled, explore: value.explore, interests, interests_seeded: interests.length > 0 && interests.every(i => i.seeded), rank_error: null });
|
|
63
67
|
await this.#save(next);
|
|
64
68
|
});
|
|
65
69
|
}
|
|
66
|
-
/**
|
|
70
|
+
/** Merge mined cues without evicting confirmed interests; newer, heavier mined cues win the remaining slots. */
|
|
67
71
|
seedInterests(raw) {
|
|
68
72
|
const texts = [...new Set(raw.map(text => text.trim()).filter(text => text.length > 0 && text.length <= 100))].slice(0, 8);
|
|
69
73
|
return this.#serial(async () => {
|
|
70
|
-
if (!texts.length ||
|
|
74
|
+
if (!texts.length || !this.#state.enabled)
|
|
71
75
|
return false;
|
|
72
|
-
|
|
76
|
+
const s = this.#state, confirmed = s.interests.filter(i => !i.seeded), mined = structuredClone(s.interests.filter(i => i.seeded)), at = this.#now().toISOString();
|
|
77
|
+
for (const text of texts) {
|
|
78
|
+
if (confirmed.some(i => i.text === text))
|
|
79
|
+
continue;
|
|
80
|
+
const old = mined.find(i => i.text === text);
|
|
81
|
+
if (old)
|
|
82
|
+
old.seeded_at = at;
|
|
83
|
+
else
|
|
84
|
+
mined.push({ id: digest(text).slice(0, 16), text, weight: 1, seeded: true, seeded_at: at });
|
|
85
|
+
}
|
|
86
|
+
mined.sort((a, b) => (b.seeded_at ?? '').localeCompare(a.seeded_at ?? '') || b.weight - a.weight || (texts.includes(a.text) ? texts.indexOf(a.text) : 8) - (texts.includes(b.text) ? texts.indexOf(b.text) : 8) || a.id.localeCompare(b.id));
|
|
87
|
+
const interests = [...confirmed, ...mined.slice(0, 8 - confirmed.length)];
|
|
88
|
+
if (JSON.stringify(interests) === JSON.stringify(s.interests))
|
|
89
|
+
return false;
|
|
90
|
+
const changed = JSON.stringify(interests.map(i => i.text).sort()) !== JSON.stringify(s.interests.map(i => i.text).sort());
|
|
91
|
+
await this.#save({ ...structuredClone(s), profile_version: s.profile_version + (changed ? 1 : 0), interests, interests_seeded: !confirmed.length, rank_error: null });
|
|
92
|
+
return changed;
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
/** Withdraw only mined cues; confirmed interests remain the user's own. */
|
|
96
|
+
clearSeededInterests() {
|
|
97
|
+
return this.#serial(async () => {
|
|
98
|
+
if (!this.#state.interests.some(i => i.seeded))
|
|
99
|
+
return false;
|
|
100
|
+
const interests = this.#state.interests.filter(i => !i.seeded);
|
|
101
|
+
await this.#save({ ...structuredClone(this.#state), profile_version: interests.length || !this.#state.enabled ? this.#state.profile_version + 1 : 0, interests, interests_seeded: false, rank_error: null });
|
|
73
102
|
return true;
|
|
74
103
|
});
|
|
75
104
|
}
|
|
@@ -122,32 +151,50 @@ export class NewsService {
|
|
|
122
151
|
const fresh = visible.filter(a => now - Date.parse(a.published_at ?? a.first_seen) < 7 * 86400000);
|
|
123
152
|
const ready = fresh.filter(a => a.ranking?.profile_version === s.profile_version);
|
|
124
153
|
const fallback = ready.length === 0;
|
|
125
|
-
const
|
|
126
|
-
const
|
|
127
|
-
const counts = new Map();
|
|
154
|
+
const newest = (a, b) => Date.parse(b.published_at ?? b.first_seen) - Date.parse(a.published_at ?? a.first_seen) || a.id.localeCompare(b.id);
|
|
155
|
+
const ranked = fresh.filter(a => weight(a) > 0).sort((a, b) => (weight(b) / (1 + Math.max(0, now - Date.parse(b.published_at ?? b.first_seen)) / 86400000)) - (weight(a) / (1 + Math.max(0, now - Date.parse(a.published_at ?? a.first_seen)) / 86400000)) || newest(a, b));
|
|
156
|
+
const selected = [], counts = new Map(), exploration = new Set();
|
|
157
|
+
const available = new Set(fresh.map(a => a.source_id)).size, cap = Math.max(2, Math.min(5, Math.ceil(12 / Math.max(1, available))));
|
|
158
|
+
const add = (a) => { if (selected.some(row => row.id === a.id) || (counts.get(a.source_id) ?? 0) >= cap)
|
|
159
|
+
return false; selected.push(a); counts.set(a.source_id, (counts.get(a.source_id) ?? 0) + 1); return true; };
|
|
160
|
+
const exploreSlots = s.explore && !fallback ? 2 : 0;
|
|
128
161
|
for (const a of ranked) {
|
|
129
|
-
if (
|
|
130
|
-
continue;
|
|
131
|
-
selected.push(a);
|
|
132
|
-
counts.set(a.source_id, (counts.get(a.source_id) ?? 0) + 1);
|
|
133
|
-
if (selected.length >= 10)
|
|
162
|
+
if (selected.length >= 12 - exploreSlots)
|
|
134
163
|
break;
|
|
164
|
+
add(a);
|
|
135
165
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
if (
|
|
142
|
-
|
|
143
|
-
selected.push(a);
|
|
144
|
-
exploration.add(a.id);
|
|
145
|
-
counts.set(a.source_id, (counts.get(a.source_id) ?? 0) + 1);
|
|
166
|
+
// Fresh unmatched articles fill even a weakly personalised page. Round-robin keeps the fill source-diverse.
|
|
167
|
+
const queues = this.#sources.map(source => fresh.filter(a => a.source_id === source.id && weight(a) === 0).sort(newest)).filter(q => q.length).sort((a, b) => newest(a[0], b[0]));
|
|
168
|
+
while (selected.length < 12 && queues.some(q => q.length))
|
|
169
|
+
for (const q of queues) {
|
|
170
|
+
const a = q.shift();
|
|
171
|
+
if (a && selected.length < 12 && add(a) && exploration.size < exploreSlots)
|
|
172
|
+
exploration.add(a.id);
|
|
146
173
|
}
|
|
174
|
+
for (const a of ranked) {
|
|
175
|
+
if (selected.length >= 12)
|
|
176
|
+
break;
|
|
177
|
+
add(a);
|
|
147
178
|
}
|
|
148
179
|
const map = (a) => ({ ...a, summary: a.summary.slice(0, 700), ranking: a.ranking?.profile_version === s.profile_version ? a.ranking : null, exploration: exploration.has(a.id) });
|
|
149
180
|
return { enabled: s.enabled, explore: s.explore, interests: structuredClone(s.interests), interests_seeded: s.interests_seeded, profile_version: s.profile_version, refreshing: !!this.#run, mode: fallback ? 'timeline' : 'personalized', rank_error: s.rank_error, pending: fresh.filter(a => a.ranking?.profile_version !== s.profile_version).length, total: visible.length, items: selected.map(map), saved: s.items.filter(a => a.saved && this.#sources.some(source => source.id === a.source_id)).map(map), sources: this.#sources.map(source => ({ ...source, ...s.sources.find(s => s.id === source.id), blocked: s.blocked.includes(source.id) })) };
|
|
150
181
|
}
|
|
182
|
+
/** Articles strong enough to interrupt the user for: confirmed interests only, fresh, concrete, best first. */
|
|
183
|
+
pushCandidates() {
|
|
184
|
+
const s = this.#state, now = this.#now().getTime();
|
|
185
|
+
return s.items.filter(a => this.#pushEligibility(a) === 'eligible' && now - Date.parse(a.published_at ?? a.first_seen) < PUSH_MAX_AGE_MS)
|
|
186
|
+
.sort((a, b) => this.#pushStrength(b) - this.#pushStrength(a)).map(a => ({ ...a, summary: a.summary.slice(0, 700) }));
|
|
187
|
+
}
|
|
188
|
+
pushEligibility(articleId) { return this.#pushEligibility(this.#state.items.find(a => a.id === articleId)); }
|
|
189
|
+
#pushStrength(a) { return Math.max(0, ...(a.ranking?.matches ?? []).map(m => m.score * Math.min(1, this.#state.interests.find(i => i.id === m.interest_id && !i.seeded)?.weight ?? 0))); }
|
|
190
|
+
#pushEligibility(a) {
|
|
191
|
+
const s = this.#state;
|
|
192
|
+
if (!a || !s.enabled || s.interests_seeded || !s.interests.length || !this.#sources.some(source => source.id === a.source_id) || s.blocked.includes(a.source_id))
|
|
193
|
+
return 'ineligible';
|
|
194
|
+
if (a.ranking?.profile_version !== s.profile_version)
|
|
195
|
+
return 'pending';
|
|
196
|
+
return (a.ranking.judgment === undefined || a.ranking.judgment.substance === 'concrete') && this.#pushStrength(a) >= PUSH_MIN_STRENGTH ? 'eligible' : 'ineligible';
|
|
197
|
+
}
|
|
151
198
|
refresh() {
|
|
152
199
|
if (this.#run) {
|
|
153
200
|
this.#rerun = true;
|
|
@@ -158,6 +205,10 @@ export class NewsService {
|
|
|
158
205
|
const run = (async () => { do {
|
|
159
206
|
this.#rerun = false;
|
|
160
207
|
await this.#refresh();
|
|
208
|
+
try {
|
|
209
|
+
this.options.ranked?.();
|
|
210
|
+
}
|
|
211
|
+
catch { /* optional host hook; refresh itself succeeded */ }
|
|
161
212
|
} while (this.#rerun && this.#opened && this.#state.enabled); })();
|
|
162
213
|
this.#run = run;
|
|
163
214
|
this.options.changed?.();
|
|
@@ -208,8 +259,8 @@ export class NewsService {
|
|
|
208
259
|
}
|
|
209
260
|
if (signal.aborted || !this.#state.enabled)
|
|
210
261
|
return;
|
|
211
|
-
//
|
|
212
|
-
if (!this.#state.interests.length
|
|
262
|
+
// The user authorizes mined cues for page ranking (public excerpts + interests go to the provider), not for facts or push.
|
|
263
|
+
if (!this.#state.interests.length) {
|
|
213
264
|
if (this.#state.rank_error)
|
|
214
265
|
await this.#serial(() => this.#save({ ...this.#state, rank_error: null }));
|
|
215
266
|
return;
|
|
@@ -221,11 +272,12 @@ export class NewsService {
|
|
|
221
272
|
// Round-robin by source bounds cost without a semantic keyword prefilter.
|
|
222
273
|
const version = this.#state.profile_version, interests = structuredClone(this.#state.interests);
|
|
223
274
|
const queues = this.#sources.filter(s => !this.#state.blocked.includes(s.id)).map(s => this.#state.items.filter(a => a.source_id === s.id && a.ranking?.profile_version !== version && this.#now().getTime() - Date.parse(a.published_at ?? a.first_seen) < 7 * 86400000).sort((a, b) => b.first_seen.localeCompare(a.first_seen)));
|
|
275
|
+
const limit = Math.min(96, Math.max(24, queues.length * 4)), quota = Math.ceil(limit / Math.max(1, queues.length));
|
|
224
276
|
const batch = [];
|
|
225
|
-
|
|
277
|
+
for (let round = 0; round < quota && batch.length < limit; round++)
|
|
226
278
|
for (const q of queues) {
|
|
227
279
|
const a = q.shift();
|
|
228
|
-
if (a && batch.length <
|
|
280
|
+
if (a && batch.length < limit)
|
|
229
281
|
batch.push(a);
|
|
230
282
|
}
|
|
231
283
|
if (!batch.length) {
|
|
@@ -251,6 +303,10 @@ export class NewsService {
|
|
|
251
303
|
next.rank_error = null;
|
|
252
304
|
await this.#save(next);
|
|
253
305
|
});
|
|
306
|
+
try {
|
|
307
|
+
this.options.ranked?.();
|
|
308
|
+
}
|
|
309
|
+
catch { /* optional host hook; ranking itself succeeded */ }
|
|
254
310
|
}
|
|
255
311
|
}
|
|
256
312
|
catch {
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"id": "bbc",
|
|
4
|
+
"name": "BBC News",
|
|
5
|
+
"url": "https://feeds.bbci.co.uk/news/rss.xml",
|
|
6
|
+
"language": "en"
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
"id": "bbc-health",
|
|
10
|
+
"name": "BBC Health",
|
|
11
|
+
"url": "https://feeds.bbci.co.uk/news/health/rss.xml",
|
|
12
|
+
"language": "en"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"id": "bbc-world",
|
|
16
|
+
"name": "BBC World",
|
|
17
|
+
"url": "https://feeds.bbci.co.uk/news/world/rss.xml",
|
|
18
|
+
"language": "en"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"id": "bbc-entertainment",
|
|
22
|
+
"name": "BBC Entertainment",
|
|
23
|
+
"url": "https://feeds.bbci.co.uk/news/entertainment_and_arts/rss.xml",
|
|
24
|
+
"language": "en"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"id": "bbc-sport",
|
|
28
|
+
"name": "BBC Sport",
|
|
29
|
+
"url": "https://feeds.bbci.co.uk/sport/rss.xml",
|
|
30
|
+
"language": "en"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"id": "bbc-science",
|
|
34
|
+
"name": "BBC Science",
|
|
35
|
+
"url": "https://feeds.bbci.co.uk/news/science_and_environment/rss.xml",
|
|
36
|
+
"language": "en"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"id": "npr",
|
|
40
|
+
"name": "NPR",
|
|
41
|
+
"url": "https://feeds.npr.org/1001/rss.xml",
|
|
42
|
+
"language": "en"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"id": "npr-health",
|
|
46
|
+
"name": "NPR Health",
|
|
47
|
+
"url": "https://feeds.npr.org/1128/rss.xml",
|
|
48
|
+
"language": "en"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"id": "chinanews-scroll-news",
|
|
52
|
+
"name": "中国新闻网 · 滚动",
|
|
53
|
+
"url": "https://www.chinanews.com.cn/rss/scroll-news.xml",
|
|
54
|
+
"language": "zh-CN"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"id": "chinanews-society",
|
|
58
|
+
"name": "中国新闻网 · 社会",
|
|
59
|
+
"url": "https://www.chinanews.com.cn/rss/society.xml",
|
|
60
|
+
"language": "zh-CN"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"id": "chinanews-life",
|
|
64
|
+
"name": "中国新闻网 · 生活",
|
|
65
|
+
"url": "https://www.chinanews.com.cn/rss/life.xml",
|
|
66
|
+
"language": "zh-CN"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"id": "chinanews-sports",
|
|
70
|
+
"name": "中国新闻网 · 体育",
|
|
71
|
+
"url": "https://www.chinanews.com.cn/rss/sports.xml",
|
|
72
|
+
"language": "zh-CN"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"id": "chinanews-culture",
|
|
76
|
+
"name": "中国新闻网 · 文化",
|
|
77
|
+
"url": "https://www.chinanews.com.cn/rss/culture.xml",
|
|
78
|
+
"language": "zh-CN"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"id": "chinanews-finance",
|
|
82
|
+
"name": "中国新闻网 · 财经",
|
|
83
|
+
"url": "https://www.chinanews.com.cn/rss/finance.xml",
|
|
84
|
+
"language": "zh-CN"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"id": "dw-zh",
|
|
88
|
+
"name": "DW 中文",
|
|
89
|
+
"url": "https://rss.dw.com/rdf/rss-chi-all",
|
|
90
|
+
"language": "zh-CN"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"id": "ft-zh",
|
|
94
|
+
"name": "FT中文",
|
|
95
|
+
"url": "https://www.ftchinese.com/rss/news",
|
|
96
|
+
"language": "zh-CN"
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"id": "rfi-zh",
|
|
100
|
+
"name": "RFI 中文",
|
|
101
|
+
"url": "https://www.rfi.fr/cn/rss",
|
|
102
|
+
"language": "zh-CN"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"id": "ithome",
|
|
106
|
+
"name": "IT之家",
|
|
107
|
+
"url": "https://www.ithome.com/rss/",
|
|
108
|
+
"language": "zh-CN"
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"id": "sspai",
|
|
112
|
+
"name": "少数派",
|
|
113
|
+
"url": "https://sspai.com/feed",
|
|
114
|
+
"language": "zh-CN"
|
|
115
|
+
}
|
|
116
|
+
]
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Existing NotificationService owns admission, dedupe, routing and unknown outcomes. */
|
|
2
|
+
export function spaceRelayNotificationAdapter(space) { return { providerId: 'space-relay', inspect: () => Promise.resolve(true), prepare: input => Promise.resolve([{ title: input.title, body: input.body }]), send: async (_part, context) => { context.signal.throwIfAborted(); const current = space(); if (!current)
|
|
3
|
+
return { kind: 'retryable', definitelyNotAccepted: true }; await current.notify({ title: context.notification.title, body: context.notification.body, kind: context.notification.kind, created_at: context.notification.created_at, expires_at: context.notification.expires_at }, context.idempotency_key, context.notification); return { kind: 'accepted', receipt: { message_id: context.idempotency_key } }; } }; }
|
|
4
|
+
//# sourceMappingURL=space-relay.js.map
|
|
@@ -12,4 +12,45 @@ export function notificationResultText(value, fallback) {
|
|
|
12
12
|
return data[key];
|
|
13
13
|
return fallback;
|
|
14
14
|
}
|
|
15
|
+
const TASK_WAITING_TEXT = {
|
|
16
|
+
task_runtime_unavailable: '任务已暂停,电脑端的任务执行服务暂不可用',
|
|
17
|
+
task_runtime_recovery_unavailable: '任务已暂停,电脑端的任务执行服务尚未恢复',
|
|
18
|
+
task_session_recovery_unavailable: '任务已暂停,之前的执行会话尚未恢复',
|
|
19
|
+
task_session_inspection_unavailable: '任务已暂停,暂时无法检查之前的执行会话',
|
|
20
|
+
task_work_recovery_unavailable: '任务已暂停,之前的执行状态尚未恢复',
|
|
21
|
+
task_origin_unavailable: '任务已暂停,原来的任务对话暂不可用',
|
|
22
|
+
task_executor_unavailable: '任务已暂停,执行器暂不可用',
|
|
23
|
+
task_recovery_blocked: '任务已暂停,需要先核对恢复状态',
|
|
24
|
+
work_fence_unavailable: '任务已暂停,无法确认之前操作的执行归属',
|
|
25
|
+
uncertain_recovery: '任务已暂停,之前的执行结果尚未确认',
|
|
26
|
+
task_effect_unknown: '任务已暂停,上一次操作的结果尚未确认',
|
|
27
|
+
task_execution_unconfirmed: '任务已暂停,尚未确认执行是否已经开始',
|
|
28
|
+
task_delivery_uncertain: '任务已暂停,上次结果是否交付仍待确认',
|
|
29
|
+
delivery_interrupted: '任务结果的交付已中断',
|
|
30
|
+
task_check_unavailable: '任务已暂停,暂时无法验证执行结果',
|
|
31
|
+
task_execution_rejected: '本次任务执行未被接收',
|
|
32
|
+
plan_delegation_refused: '任务计划未被执行器接收',
|
|
33
|
+
plan_delegation_unknown: '任务计划是否被执行器接收仍待确认',
|
|
34
|
+
correction_limit: '任务已暂停,自动修正次数已用完',
|
|
35
|
+
task_initial_pending: '正在确认任务是否已启动',
|
|
36
|
+
executor_admission_pending: '正在等待执行器接收任务',
|
|
37
|
+
execution_route_required: '任务需要先选择执行方式',
|
|
38
|
+
cancellation_pending: '停止请求已记录,仍需确认正在执行的操作是否结束',
|
|
39
|
+
user_reconciled: '之前的执行结果已核对,可以决定是否继续任务',
|
|
40
|
+
};
|
|
41
|
+
/** Translate status codes before they become notification bodies; never resume work here. */
|
|
42
|
+
export function notificationTaskWaitingText(reason) {
|
|
43
|
+
if (!reason)
|
|
44
|
+
return '任务需要你补充信息';
|
|
45
|
+
if (Object.hasOwn(TASK_WAITING_TEXT, reason))
|
|
46
|
+
return TASK_WAITING_TEXT[reason] + '。请回到电脑端查看任务详情,核对后再决定是否继续。';
|
|
47
|
+
return /^[a-z][a-z0-9_]*$/u.test(reason) ? '任务已暂停。请回到电脑端查看任务详情,核对后再决定是否继续。' : reason;
|
|
48
|
+
}
|
|
49
|
+
/** Old task-status notices stay readable without rewriting delivery history. */
|
|
50
|
+
export function notificationDisplayBody(notification) {
|
|
51
|
+
if (notification.source.type !== 'task_waiting')
|
|
52
|
+
return notification.body;
|
|
53
|
+
const match = /^([a-z][a-z0-9_]*)(?:\n请在 Nova 中查看并处理。)?$/u.exec(notification.body);
|
|
54
|
+
return match && Object.hasOwn(TASK_WAITING_TEXT, match[1]) ? notificationTaskWaitingText(match[1]) : notification.body;
|
|
55
|
+
}
|
|
15
56
|
//# sourceMappingURL=content.js.map
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
const id = z.string().min(1).max(512);
|
|
3
3
|
export const bindingSchema = z.object({ id, provider: id, user_scope: id, generation: z.number().int().nonnegative(), identity: id, status: z.enum(['ready', 'unavailable', 'disconnected']) }).strict();
|
|
4
|
-
export const notificationSchema = z.object({ event_key: id, revision: id, occurrence: id, kind: z.enum(['brief', 'suggestion', 'task_progress', 'task_result', 'alert', 'attention_required']), title: z.string().max(200), body: z.string().max(131072), guard: z.object({ task_id: id.optional(), goal_revision: z.number().int().nonnegative().optional(), work_id: id.optional(), evidence_refs: z.array(id).max(256).optional(), requires_runtime: z.boolean().optional() }).strict().optional(), source: z.object({ type: id, id, version: z.string().optional() }).strict(), created_at: z.number().finite(), expires_at: z.number().finite().nullable(), not_before: z.number().finite(), priority: z.number().finite(), coalesce_key: id.nullable(), feedback: z.array(z.enum(['open', 'snooze', 'dismiss'])).max(3) }).strict();
|
|
4
|
+
export const notificationSchema = z.object({ event_key: id, revision: id, occurrence: id, kind: z.enum(['brief', 'suggestion', 'news', 'task_progress', 'task_result', 'alert', 'attention_required']), title: z.string().max(200), body: z.string().max(131072), guard: z.object({ task_id: id.optional(), goal_revision: z.number().int().nonnegative().optional(), work_id: id.optional(), evidence_refs: z.array(id).max(256).optional(), goal_ids: z.array(id).max(5).optional(), requires_runtime: z.boolean().optional() }).strict().optional(), source: z.object({ type: id, id, version: z.string().optional() }).strict(), created_at: z.number().finite(), expires_at: z.number().finite().nullable(), not_before: z.number().finite(), priority: z.number().finite(), coalesce_key: id.nullable(), feedback: z.array(z.enum(['open', 'snooze', 'dismiss'])).max(3) }).strict();
|
|
5
|
+
/** One summary per local date: `source.id` is that date, `source.version` the feed id, `guard.goal_ids` the goals it asks about; the host re-checks every goal before each send. */
|
|
6
|
+
export const goalCheckinSource = 'goal_checkin';
|
|
5
7
|
export const partSchema = z.object({ title: z.string().max(200), body: z.string().max(131072), payload: z.string().max(262144).optional() }).strict();
|
|
6
8
|
export const deliveryStatusSchema = z.enum(['pending', 'sending', 'accepted', 'retry_wait', 'blocked', 'unknown', 'cancelled', 'expired', 'superseded']);
|
|
7
9
|
export const deliverySchema = z.object({ id, notification: notificationSchema, route_revision: z.number().int(), binding: bindingSchema, status: deliveryStatusSchema, parts: z.array(z.object({ part: partSchema, key: id, receipt: z.object({ message_id: id, chat_id: id.optional() }).strict().nullable() }).strict()).max(256), attempts: z.number().int().nonnegative(), next_attempt_at: z.number(), updated_at: z.number(), error: z.string().max(128).nullable(), invalidated: z.boolean().default(false) }).strict();
|
|
8
|
-
export const notificationStateSchema = z.object({ schema_version: z.literal(1), user_scope: id, route_revision: z.number().int(), primary_binding_id: id, configured: z.boolean(),
|
|
10
|
+
export const notificationStateSchema = z.object({ schema_version: z.literal(1), user_scope: id, route_revision: z.number().int(), primary_binding_id: id, configured: z.boolean(), bindings: z.array(bindingSchema).max(32), deliveries: z.array(deliverySchema).max(10000), dedupe: z.record(id, z.number()), migrated: z.boolean(), cutoff: z.number() }).strict();
|
|
9
11
|
//# sourceMappingURL=contracts.js.map
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { createHash } from 'node:crypto';
|
|
2
|
+
import { goalCheckinSource } from './contracts.js';
|
|
2
3
|
export function feedNotification(item) {
|
|
3
|
-
const
|
|
4
|
+
const checkin = item.goal_checkin;
|
|
5
|
+
const body = checkin ? checkin.items.map(line => '· ' + line.text).join('\n') : item.prepared?.text ?? (item.kind === 'task_result' ? item.title : item.why_now);
|
|
4
6
|
const revision = createHash('sha256').update(JSON.stringify([item.kind, item.title, body])).digest('hex');
|
|
5
|
-
return { event_key: 'feed:' + item.id, revision, occurrence: item.snooze_until ? 'snooze:' + item.snooze_until : 'initial', kind: item.kind === 'task_result' ? 'task_result' : item.subject_key.startsWith('brief:') ? 'brief' : 'suggestion', title: item.title, body, source: { type: 'feed', id: item.id }, created_at: Date.parse(item.updated_at), expires_at: item.expires_at ? Date.parse(item.expires_at) : null, not_before: item.snooze_until ? Date.parse(item.snooze_until) : 0, priority: item.priority, coalesce_key: 'feed:' + item.id, feedback: item.lifecycle === 'active' ? ['open', 'snooze', 'dismiss'] : ['open'] };
|
|
7
|
+
return { event_key: 'feed:' + item.id, revision, occurrence: item.snooze_until ? 'snooze:' + item.snooze_until : 'initial', kind: item.kind === 'task_result' ? 'task_result' : item.subject_key.startsWith('brief:') ? 'brief' : item.subject_key.startsWith('news:') ? 'news' : 'suggestion', title: item.title, body, ...(checkin ? { guard: { goal_ids: checkin.items.map(line => line.goal_id) } } : {}), source: checkin ? { type: goalCheckinSource, id: checkin.local_date, version: item.id } : { type: 'feed', id: item.id }, created_at: Date.parse(item.updated_at), expires_at: item.expires_at ? Date.parse(item.expires_at) : null, not_before: item.snooze_until ? Date.parse(item.snooze_until) : 0, priority: item.priority, coalesce_key: 'feed:' + item.id, feedback: item.lifecycle === 'active' ? ['open', 'snooze', 'dismiss'] : ['open'] };
|
|
6
8
|
}
|
|
9
|
+
/** The feed item a notification mirrors: `feed` sources name it directly, a goal check-in carries it as the source version. */
|
|
10
|
+
export const feedSourceId = (n) => n.source.type === 'feed' ? n.source.id : n.source.type === goalCheckinSource ? n.source.version : undefined;
|
|
7
11
|
export const feedNotificationKey = (n) => n.event_key + ':' + n.revision + ':' + n.occurrence;
|
|
8
12
|
//# sourceMappingURL=feed.js.map
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { notificationDisplayBody } from './content.js';
|
|
1
2
|
import { createHash } from 'node:crypto';
|
|
2
3
|
import { notificationStore } from './store.js';
|
|
3
4
|
import { bindingSchema, notificationSchema, partSchema } from './contracts.js';
|
|
@@ -21,7 +22,7 @@ export class NotificationService {
|
|
|
21
22
|
this.#state = this.#initial();
|
|
22
23
|
}
|
|
23
24
|
#now() { return this.options.now?.() ?? Date.now(); }
|
|
24
|
-
#initial() { return { schema_version: 1, user_scope: this.options.userScope, route_revision: 0, primary_binding_id: 'nova', configured: false,
|
|
25
|
+
#initial() { return { schema_version: 1, user_scope: this.options.userScope, route_revision: 0, primary_binding_id: 'nova', configured: false, bindings: [{ id: 'nova', provider: 'nova', identity: 'local', generation: 0, user_scope: this.options.userScope, status: 'ready' }], deliveries: [], dedupe: {}, migrated: false, cutoff: 0 }; }
|
|
25
26
|
register(adapter) {
|
|
26
27
|
if (this.#opened)
|
|
27
28
|
throw Error('notification_adapter_already_started');
|
|
@@ -69,12 +70,18 @@ export class NotificationService {
|
|
|
69
70
|
this.#opened = true;
|
|
70
71
|
}
|
|
71
72
|
async close() { this.#opened = false; this.#stop.abort(); await this.#run; await this.#tail; }
|
|
73
|
+
display() { return this.#state.deliveries.filter(delivery => !['cancelled', 'superseded'].includes(delivery.status)).slice(-100).map(delivery => ({ id: delivery.id, kind: delivery.notification.kind, title: delivery.notification.title, body: notificationDisplayBody(delivery.notification), version: delivery.notification.revision + ':' + delivery.notification.occurrence, created_at: new Date(delivery.notification.created_at).toISOString() })); }
|
|
72
74
|
snapshot() {
|
|
73
75
|
const counts = Object.fromEntries(['pending', 'sending', 'accepted', 'retry_wait', 'blocked', 'unknown', 'cancelled', 'expired', 'superseded'].map(s => [s, 0]));
|
|
74
76
|
for (const d of this.#state.deliveries)
|
|
75
77
|
counts[d.status]++;
|
|
76
|
-
return { primary_binding_id: this.#state.primary_binding_id, route_revision: this.#state.route_revision, local: this.local, configured: this.#state.configured,
|
|
78
|
+
return { primary_binding_id: this.#state.primary_binding_id, route_revision: this.#state.route_revision, local: this.local, configured: this.#state.configured, bindings: this.#state.bindings.map(b => ({ id: b.id, provider: b.provider, user_scope: b.user_scope, generation: b.generation, status: b.status })), counts, deliveries: this.#state.deliveries.slice(-100).map(d => ({ id: d.id, title: d.notification.title, source: d.notification.source, status: d.status, error: d.error, binding_id: d.binding.id, updated_at: d.updated_at })) };
|
|
77
79
|
}
|
|
80
|
+
/** Accepted is the only delivered terminal status; its `updated_at` is set when the final part's receipt is stored. */
|
|
81
|
+
accepted(eventKey) { return this.#state.deliveries.some(d => d.status === 'accepted' && d.notification.event_key === eventKey); }
|
|
82
|
+
deliveredToday(kinds, timezone, now) { const format = new Intl.DateTimeFormat('en-CA', { timeZone: timezone, year: 'numeric', month: '2-digit', day: '2-digit' }); const today = format.format(now); return this.#state.deliveries.filter(d => d.status === 'accepted' && kinds.includes(d.notification.kind) && format.format(d.updated_at) === today).length; }
|
|
83
|
+
/** True once this exact message reached delivery: sending (the local adapter presents it while sending) or accepted. */
|
|
84
|
+
isAdmitted(key) { return this.#state.deliveries.some(d => (d.status === 'accepted' || d.status === 'sending') && d.notification.event_key === key.event_key && d.notification.revision === key.revision && d.notification.occurrence === key.occurrence); }
|
|
78
85
|
async bind(value) {
|
|
79
86
|
const binding = bindingSchema.parse(value);
|
|
80
87
|
if (binding.user_scope !== this.options.userScope)
|
|
@@ -97,7 +104,6 @@ export class NotificationService {
|
|
|
97
104
|
if (current?.identity !== binding.identity || current.generation !== binding.generation || current.status !== 'ready')
|
|
98
105
|
throw Error('notification_binding_changed');
|
|
99
106
|
s.configured = true;
|
|
100
|
-
s.legacy_binding_id = null;
|
|
101
107
|
s.primary_binding_id = id;
|
|
102
108
|
s.route_revision++;
|
|
103
109
|
for (const d of [...s.deliveries]) {
|
|
@@ -116,7 +122,7 @@ export class NotificationService {
|
|
|
116
122
|
}
|
|
117
123
|
});
|
|
118
124
|
}
|
|
119
|
-
async migrate(
|
|
125
|
+
async migrate(delivered = []) {
|
|
120
126
|
if (this.#state.migrated)
|
|
121
127
|
return;
|
|
122
128
|
await this.#mutate(s => {
|
|
@@ -124,8 +130,6 @@ export class NotificationService {
|
|
|
124
130
|
return;
|
|
125
131
|
s.migrated = true;
|
|
126
132
|
s.cutoff = this.#now() - 90 * 86400000;
|
|
127
|
-
if (!s.configured)
|
|
128
|
-
s.legacy_binding_id = legacyBindingId;
|
|
129
133
|
for (const n of delivered)
|
|
130
134
|
s.dedupe[this.#messageKey(n)] = this.#now();
|
|
131
135
|
});
|
|
@@ -161,11 +165,6 @@ export class NotificationService {
|
|
|
161
165
|
if (!target)
|
|
162
166
|
throw Error('notification_binding_missing');
|
|
163
167
|
this.#enqueue(s, n, target);
|
|
164
|
-
if (s.legacy_binding_id && n.source.type === 'feed') {
|
|
165
|
-
const extra = s.bindings.find(b => b.id === s.legacy_binding_id);
|
|
166
|
-
if (extra)
|
|
167
|
-
this.#enqueue(s, n, extra);
|
|
168
|
-
}
|
|
169
168
|
s.dedupe[key] = this.#now();
|
|
170
169
|
});
|
|
171
170
|
}
|
|
@@ -186,12 +185,14 @@ export class NotificationService {
|
|
|
186
185
|
delete p.part.payload;
|
|
187
186
|
} if (d.status !== 'sending' && d.status !== 'unknown' && !terminal.has(d.status))
|
|
188
187
|
d.status = 'cancelled'; }
|
|
189
|
-
|
|
190
|
-
|
|
188
|
+
/** `version`, when given, narrows the match to one source version (several goal check-ins can share a local date). */
|
|
189
|
+
async invalidate(type, id, notify = true, version) {
|
|
190
|
+
const matches = (d) => d.notification.source.type === type && d.notification.source.id === id && (version === undefined || d.notification.source.version === version);
|
|
191
|
+
if (!this.#state.deliveries.some(d => matches(d) && !d.invalidated))
|
|
191
192
|
return;
|
|
192
193
|
await this.#mutate(s => {
|
|
193
194
|
for (const d of s.deliveries)
|
|
194
|
-
if (d
|
|
195
|
+
if (matches(d)) {
|
|
195
196
|
d.invalidated = true;
|
|
196
197
|
d.notification.body = '';
|
|
197
198
|
d.notification.title = '';
|
|
@@ -205,6 +206,18 @@ export class NotificationService {
|
|
|
205
206
|
}
|
|
206
207
|
}, notify);
|
|
207
208
|
}
|
|
209
|
+
/** Erase queued notifications whose guard cites any of these evidence ids (permanent purge); sources need not be feed items. */
|
|
210
|
+
async invalidateByEvidence(refs, notify = true) {
|
|
211
|
+
const gone = new Set(refs);
|
|
212
|
+
const hit = (d) => !d.invalidated && (d.notification.guard?.evidence_refs ?? []).some(ref => gone.has(ref));
|
|
213
|
+
if (!gone.size || !this.#state.deliveries.some(hit))
|
|
214
|
+
return;
|
|
215
|
+
await this.#mutate(s => {
|
|
216
|
+
for (const d of s.deliveries)
|
|
217
|
+
if (hit(d))
|
|
218
|
+
this.#erase(d);
|
|
219
|
+
}, notify);
|
|
220
|
+
}
|
|
208
221
|
/** Manual resend acknowledges an uncertain prior request; normal dispatch never uses this. */
|
|
209
222
|
async retry(id, confirmUnknown = false) {
|
|
210
223
|
await this.#mutate(s => {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
1
2
|
import { BoundedJsonStore } from '../storage/bounded-json.js';
|
|
2
3
|
import { notificationStateSchema } from './contracts.js';
|
|
3
|
-
|
|
4
|
+
const storedNotificationSchema = notificationStateSchema.extend({ legacy_binding_id: z.string().min(1).max(512).nullable().optional() }).transform(value => { delete value.legacy_binding_id; return notificationStateSchema.parse(value); });
|
|
5
|
+
export const notificationStore = (path) => new BoundedJsonStore(path, storedNotificationSchema, 16 * 1024 * 1024);
|
|
4
6
|
//# sourceMappingURL=store.js.map
|