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,3 +1,8 @@
|
|
|
1
|
+
import { readHostSpaceConfig, scopeHostSpaceSettings } from '../space-host/config.js';
|
|
2
|
+
import { UsageLedger } from '../usage/ledger.js';
|
|
3
|
+
import { reportUsage } from '../realtime/usage.js';
|
|
4
|
+
import { homedir } from 'node:os';
|
|
5
|
+
import { resolve } from 'node:path';
|
|
1
6
|
import { feishuNotificationAdapter } from '../notifications/adapters/feishu.js';
|
|
2
7
|
import { ClientServer } from '../server/client-server.js';
|
|
3
8
|
import { ClientPairing } from '../server/client-pairing.js';
|
|
@@ -20,7 +25,9 @@ import { prepareKnowledge } from '../knowledge/assembly.js';
|
|
|
20
25
|
import { randomUUID } from 'node:crypto';
|
|
21
26
|
import { loadCapabilityRegistry } from '../config/capability-registry.js';
|
|
22
27
|
import { prepareExternalMcp } from '../executors/mcp.js';
|
|
23
|
-
import {
|
|
28
|
+
import { overlaySpaceSecrets } from '../space-host/host-admin.js';
|
|
29
|
+
import { overlaySpaceModelRoutes } from '../space-host/model-settings.js';
|
|
30
|
+
import { loadSettings, memoryStatus, requireBlockingCredentials, requireIntegratedRealtime, withoutUncredentialedModules } from '../config/config.js';
|
|
24
31
|
import { requireSelectedCascadedLlmConfig, requireSelectedCascadedRealtimeConfig } from '../config/cascaded-realtime-config.js';
|
|
25
32
|
import { remoteClientMedia } from '../server/server-config.js';
|
|
26
33
|
import { buildDesktopRealtimeComposition } from '../desktop/desktop-session.js';
|
|
@@ -32,8 +39,23 @@ import { MAX_CONCURRENT_WORK } from '../core/work-tools.js';
|
|
|
32
39
|
import { buildProductionRealtimeAssembly } from './cascaded-realtime-assembly.js';
|
|
33
40
|
import { createRealtimeTelemetry } from '../realtime/telemetry.js';
|
|
34
41
|
import { buildIntegratedRealtimeAssembly } from './cascaded-realtime-assembly.js';
|
|
35
|
-
|
|
36
|
-
|
|
42
|
+
/**
|
|
43
|
+
* Feishu notification bindings follow the published readiness in both directions. The first published value is only
|
|
44
|
+
* a baseline — the restore/open path already synced that binding — so construction never syncs twice.
|
|
45
|
+
*/
|
|
46
|
+
export function notificationReadinessEdges(sync) {
|
|
47
|
+
let previous;
|
|
48
|
+
return ready => { const initial = previous === undefined; if (ready !== previous && !initial)
|
|
49
|
+
sync(); previous = ready; };
|
|
50
|
+
}
|
|
51
|
+
export async function buildProductionComposition({ token, stop, ownership, onDiagnostic, remote = false, createServer, integratedProviders, onKnowledge, onCoding, onUsage: publishUsage, environment: operatorEnvironment = process.env, deviceRuntimeEnabled = false }) {
|
|
52
|
+
// Credentials a Space owner stored from a phone fill only variables the operator left unset.
|
|
53
|
+
const spaceModelConfigPath = operatorEnvironment.NOVA_SPACE_HOST_CONFIG ? resolve(operatorEnvironment.NOVA_SPACE_HOST_CONFIG) : undefined;
|
|
54
|
+
const environment = overlaySpaceModelRoutes(overlaySpaceSecrets(operatorEnvironment, spaceModelConfigPath, onDiagnostic), spaceModelConfigPath);
|
|
55
|
+
const baseSettings = loadSettings(environment, !remote);
|
|
56
|
+
const spaceConfigPath = environment.NOVA_SPACE_HOST_CONFIG ? resolve(environment.NOVA_SPACE_HOST_CONFIG) : undefined;
|
|
57
|
+
const spaceConfig = spaceConfigPath ? readHostSpaceConfig(spaceConfigPath) : undefined;
|
|
58
|
+
const loadedSettings = spaceConfig ? scopeHostSpaceSettings(baseSettings, spaceConfig) : baseSettings;
|
|
37
59
|
const media = remote ? remoteClientMedia(loadedSettings) : undefined;
|
|
38
60
|
if (!remote)
|
|
39
61
|
requireSelectedCascadedLlmConfig(loadedSettings);
|
|
@@ -43,6 +65,9 @@ export async function buildProductionComposition({ token, stop, ownership, onDia
|
|
|
43
65
|
requireSelectedCascadedRealtimeConfig(loadedSettings);
|
|
44
66
|
if (remote)
|
|
45
67
|
requireBlockingCredentials(loadedSettings);
|
|
68
|
+
const usage = new UsageLedger(resolve(loadedSettings.blackboard_path.replace(/^~(?=\/)/u, homedir()) + '.usage.sqlite'));
|
|
69
|
+
ownership.own(() => usage.close());
|
|
70
|
+
const onUsage = report => { usage.add(report); reportUsage(publishUsage, report); };
|
|
46
71
|
const configuredCapabilities = loadCapabilityRegistry({ environment: remote ? { ...environment, CAMERA_MODULE_ENABLED: 'false' } : environment });
|
|
47
72
|
const acceptanceCapabilities = acceptanceCapabilityRegistry(configuredCapabilities);
|
|
48
73
|
const externalMcp = await prepareExternalMcp(withoutUncredentialedModules(acceptanceCapabilities, loadedSettings), stop.signal);
|
|
@@ -54,7 +79,7 @@ export async function buildProductionComposition({ token, stop, ownership, onDia
|
|
|
54
79
|
};
|
|
55
80
|
for (const override of capabilities.overrides)
|
|
56
81
|
onDiagnostic(`[capability-override] ${override}`);
|
|
57
|
-
const knowledge = await prepareKnowledge(settings, capabilities, stop.signal);
|
|
82
|
+
const knowledge = await prepareKnowledge(settings, capabilities, stop.signal, onUsage);
|
|
58
83
|
if (knowledge !== undefined) {
|
|
59
84
|
ownership.own(() => knowledge.close());
|
|
60
85
|
onKnowledge?.(knowledge);
|
|
@@ -71,10 +96,9 @@ export async function buildProductionComposition({ token, stop, ownership, onDia
|
|
|
71
96
|
: settings.integrated_provider === 'openai' ? settings.openai_realtime_model
|
|
72
97
|
: settings.integrated_provider === 'gemini' ? settings.gemini_realtime_model : settings.qwen_realtime_model,
|
|
73
98
|
asr: settings.cascade_asr_provider, tts: settings.cascade_tts_provider,
|
|
74
|
-
vision: settings.conversation_vision_enabled,
|
|
75
99
|
});
|
|
76
100
|
let publishExecutorApproval = () => undefined;
|
|
77
|
-
const guiNames = settings.executors.filter(name => name === '
|
|
101
|
+
const guiNames = settings.executors.filter(name => name === 'mobile' || name === 'computer' || name === 'browser');
|
|
78
102
|
// Each supervised GUI executor runs one task at a time, so it adds one approval slot instead of taking Codex's.
|
|
79
103
|
const sharedApproval = guiNames.length > 0
|
|
80
104
|
? new HostApprovalController({ clock, idFactory: () => randomUUID(), capacity: MAX_CONCURRENT_WORK + guiNames.length }) : undefined;
|
|
@@ -84,12 +108,6 @@ export async function buildProductionComposition({ token, stop, ownership, onDia
|
|
|
84
108
|
closeSharedApproval = () => { sharedApproval.invalidate('shutdown'); unsubscribe(); };
|
|
85
109
|
ownership.own(closeSharedApproval);
|
|
86
110
|
}
|
|
87
|
-
const autoglm = !settings.executors.includes('autoglm') ? undefined : await (async () => {
|
|
88
|
-
const { AutoGlmExecutor, loadAutoGlmConfig } = await import('../executors/autoglm.js');
|
|
89
|
-
return new AutoGlmExecutor(loadAutoGlmConfig(environment), sharedApproval);
|
|
90
|
-
})();
|
|
91
|
-
if (autoglm !== undefined)
|
|
92
|
-
ownership.own(() => autoglm.close());
|
|
93
111
|
const mobile = !settings.executors.includes('mobile') ? undefined : await (async () => {
|
|
94
112
|
const { MobileExecutor, loadMobileConfig } = await import('../executors/mobile.js');
|
|
95
113
|
return new MobileExecutor(loadMobileConfig(environment), sharedApproval);
|
|
@@ -108,18 +126,19 @@ export async function buildProductionComposition({ token, stop, ownership, onDia
|
|
|
108
126
|
})();
|
|
109
127
|
if (browser !== undefined)
|
|
110
128
|
ownership.own(() => browser.close());
|
|
111
|
-
const guiExecutors = [...(
|
|
129
|
+
const guiExecutors = [...(mobile === undefined ? [] : [mobile]),
|
|
112
130
|
...(computer === undefined ? [] : [computer]), ...(browser === undefined ? [] : [browser])];
|
|
113
131
|
const codexResource = !capabilities.modules.coding.enabled || !settings.executors.includes('codex')
|
|
114
132
|
? null
|
|
115
133
|
: await (async () => {
|
|
116
|
-
const { createCodexAssemblyResource, createProductionCodexHost,
|
|
134
|
+
const { createCodexAssemblyResource, createProductionCodexHost, resolveCodingHostConfig, prepareManagedCodexMcp, createAcpBackendRouting, loadWindowsGuardianFactoryFromResources } = await import('../executors/codex/host.js');
|
|
117
135
|
const sourceResourcesPath = environment.CODEX_RESOURCES_PATH;
|
|
118
136
|
const codexHost = createProductionCodexHost(settings, {
|
|
119
137
|
...(sourceResourcesPath === undefined ? {} : { resourcesPath: sourceResourcesPath }),
|
|
120
138
|
onDiagnostic: code => onDiagnostic(`[runtime-diagnostic] ${code}`),
|
|
121
139
|
});
|
|
122
|
-
|
|
140
|
+
// Readiness follows the selected default backend: Codex is required only when it is the default.
|
|
141
|
+
const codexConfig = resolveCodingHostConfig(settings, codexHost.catalog);
|
|
123
142
|
if (codexConfig === null)
|
|
124
143
|
return null;
|
|
125
144
|
const resourcesPath = sourceResourcesPath ?? process.resourcesPath;
|
|
@@ -158,7 +177,7 @@ export async function buildProductionComposition({ token, stop, ownership, onDia
|
|
|
158
177
|
token,
|
|
159
178
|
stop,
|
|
160
179
|
...(createServer === undefined ? {} : { createServer: options => createServer(options, media) }),
|
|
161
|
-
...(remote ? { transportFailure: 'disconnect' } : {}),
|
|
180
|
+
...(remote ? { transportFailure: 'disconnect' } : { spaceVoice: true }),
|
|
162
181
|
telemetry,
|
|
163
182
|
progressBubbles: settings.progress_bubbles,
|
|
164
183
|
...(codexResource?.projectView === null || codexResource === null
|
|
@@ -174,6 +193,10 @@ export async function buildProductionComposition({ token, stop, ownership, onDia
|
|
|
174
193
|
clock,
|
|
175
194
|
});
|
|
176
195
|
const realtimeOptions = {
|
|
196
|
+
...(spaceConfigPath ? { spaceHostConfigPath: spaceConfigPath } : {}),
|
|
197
|
+
// The Space owner projection must read the same environment the operator passed, not the process default.
|
|
198
|
+
spaceHostEnvironment: operatorEnvironment,
|
|
199
|
+
includeSpaceMobile: !!spaceConfig,
|
|
177
200
|
textOnly: !remote,
|
|
178
201
|
nextPlaybackGeneration,
|
|
179
202
|
blackboard: blackboardOptionsFromSettings(settings),
|
|
@@ -234,6 +257,12 @@ export async function buildProductionComposition({ token, stop, ownership, onDia
|
|
|
234
257
|
}));
|
|
235
258
|
}
|
|
236
259
|
const host = composition.realtime.personalAgent;
|
|
260
|
+
if (deviceRuntimeEnabled) {
|
|
261
|
+
const { DeviceGateway } = await import('../device/gateway.js');
|
|
262
|
+
const { DeviceLedger } = await import('../device/ledger.js');
|
|
263
|
+
host.options.stopRevoker = new DeviceGateway(new DeviceLedger(host.path + '.device.json'));
|
|
264
|
+
host.options.onDiagnostic = onDiagnostic;
|
|
265
|
+
}
|
|
237
266
|
conversationOwner.host = host;
|
|
238
267
|
const projectAdapter = codexResource?.mode === 'project' ? codexResource.adapter : undefined;
|
|
239
268
|
if (projectAdapter?.targetPort)
|
|
@@ -274,20 +303,23 @@ export async function buildProductionComposition({ token, stop, ownership, onDia
|
|
|
274
303
|
onExecutorProgress: (progress, result) => composition.desktop.bridge.onExecutorProgress(progress, result),
|
|
275
304
|
onAudioFrame: frame => composition.audioBridge()?.onAudioFrame(frame), onAudioClear: (id, epoch) => composition.audioBridge()?.onAudioClear(id, epoch), onAudioAlert: (id, epoch) => composition.audioBridge()?.onAudioAlert(id, epoch), onAudioTerminal: (id, epoch) => composition.audioBridge()?.onAudioTerminal(id, epoch), }), frame => composition.publishPersonal(frame));
|
|
276
305
|
host.setConnectors(new ComposioConnector({ ...(process.platform === 'darwin' && environment.CODEX_RESOURCES_PATH ? { local: new MacCalendarClient(environment.CODEX_RESOURCES_PATH), mail: new MacMailClient(environment.CODEX_RESOURCES_PATH) } : {}), memory: () => { const memory = composition.realtime.personalMemory; return memory instanceof SubstrateMemoryResource ? memory : undefined; }, client: environment.COMPOSIO_API_KEY ? new ComposioClient(environment.COMPOSIO_API_KEY) : null, onChange: () => { void host.connectionChanged(); } }));
|
|
306
|
+
const syncNotificationOnEdge = notificationReadinessEdges(() => { void syncNotificationBinding().catch(() => undefined); });
|
|
277
307
|
const feishu = new FeishuConnector({
|
|
278
308
|
executable: environment.FEISHU_CLI_PATH ?? 'lark-cli',
|
|
279
309
|
credentialRoot: join(host.path + '.feishu', 'credentials'),
|
|
280
310
|
statePath: join(host.path + '.feishu', 'state.json'),
|
|
281
|
-
onChange:
|
|
311
|
+
onChange: snapshot => { host.connectionChanged(); syncNotificationOnEdge(snapshot.notification_ready === true); },
|
|
282
312
|
processingGrant: (...args) => composition.realtime.personalMemory?.processingGrant?.(...args),
|
|
283
|
-
|
|
284
|
-
|
|
313
|
+
get processingConsentTransition() {
|
|
314
|
+
const memory = composition.realtime.personalMemory;
|
|
315
|
+
return memory?.feishuProcessingConsent ? memory.feishuProcessingConsent.bind(memory) : undefined;
|
|
316
|
+
},
|
|
285
317
|
ingestBatch: async (messages, signal) => {
|
|
286
318
|
const memory = composition.realtime.personalMemory;
|
|
287
319
|
if (!(memory instanceof SubstrateMemoryResource))
|
|
288
320
|
throw Error('请先启用本地记忆');
|
|
289
321
|
signal.throwIfAborted();
|
|
290
|
-
const changed = await memory.ingestEvidenceBatch(messages.map(message => ({ sourceId: message.source_id, locator: message.locator, text: message.raw_text, observedAt: message.observed_at, kind: 'im', ...(message.sender_id ? { im: { sender_id: message.sender_id, account_id: message.account_id, provider: 'feishu', message_id: message.message_id, chat_id: message.chat_id, recipient_id: message.recipient_id, sender_name: message.sender_name, mention_ids: message.mention_ids, thread_id: message.thread_id, parent_id: message.parent_id, root_id: message.root_id, upper_message_id: message.upper_message_id, source_url: message.source_url, mention: message.mention, auto_capture: message.auto_capture } } : {}), ...(message.processing_consent ? { processingConsent: message.processing_consent } : {}), retentionUntil: message.retention_until, senderId: message.sender_id, accountId: message.account_id })));
|
|
322
|
+
const changed = await memory.ingestEvidenceBatch(messages.map(message => ({ sourceId: message.source_id, locator: message.locator, text: message.raw_text, observedAt: message.observed_at, kind: 'im', ...(message.sender_id ? { im: { sender_type: message.sender_type, sender_id: message.sender_id, account_id: message.account_id, provider: 'feishu', message_id: message.message_id, chat_id: message.chat_id, recipient_id: message.recipient_id, sender_name: message.sender_name, mention_ids: message.mention_ids, thread_id: message.thread_id, parent_id: message.parent_id, root_id: message.root_id, upper_message_id: message.upper_message_id, source_url: message.source_url, mention: message.mention, auto_capture: message.auto_capture } } : {}), ...(message.processing_consent ? { processingConsent: message.processing_consent } : {}), retentionUntil: message.retention_until, senderId: message.sender_id, accountId: message.account_id })));
|
|
291
323
|
signal.throwIfAborted();
|
|
292
324
|
if (changed)
|
|
293
325
|
await host.sourceChanged();
|
|
@@ -324,8 +356,9 @@ export async function buildProductionComposition({ token, stop, ownership, onDia
|
|
|
324
356
|
};
|
|
325
357
|
host.setFeishu({
|
|
326
358
|
snapshot: () => feishu.snapshot(),
|
|
359
|
+
restore: () => feishu.restore(),
|
|
327
360
|
command: async (method, params) => { const result = await feishu.command(method, z.record(z.string(), z.unknown()).parse(params)); await syncNotificationBinding(); return result; },
|
|
328
|
-
open: async () => { await feishu.open(); await syncNotificationBinding(); await host.notifications.migrate(
|
|
361
|
+
open: async () => { await feishu.open(); await syncNotificationBinding(); await host.notifications.migrate(); },
|
|
329
362
|
close: async () => { await feishu.close(); },
|
|
330
363
|
});
|
|
331
364
|
ownership.own(() => composition.desktop.server.close());
|
|
@@ -373,6 +406,8 @@ export async function buildProductionComposition({ token, stop, ownership, onDia
|
|
|
373
406
|
return {
|
|
374
407
|
...composition,
|
|
375
408
|
phoneControl,
|
|
409
|
+
usage,
|
|
410
|
+
memoryStatus: memoryStatus(loadedSettings),
|
|
376
411
|
closeAuxiliary: async () => {
|
|
377
412
|
try {
|
|
378
413
|
await phoneQueue;
|
|
@@ -382,6 +417,7 @@ export async function buildProductionComposition({ token, stop, ownership, onDia
|
|
|
382
417
|
finally {
|
|
383
418
|
closeSharedApproval();
|
|
384
419
|
telemetry.close();
|
|
420
|
+
await usage.close();
|
|
385
421
|
}
|
|
386
422
|
},
|
|
387
423
|
};
|