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,4 @@
|
|
|
1
|
+
import { beginModelUsage } from '../usage/model-call.js';
|
|
1
2
|
import { z } from 'zod';
|
|
2
3
|
const answer = z.object({ type: z.literal('choice'), choice: z.string(), confidence: z.number().min(0).max(1), probabilities: z.record(z.string(), z.number().min(0).max(1)) });
|
|
3
4
|
/** Shared bounded transport for personal understanding and public-news judgments. */
|
|
@@ -7,19 +8,29 @@ export async function decide(options, state, questions, signal) {
|
|
|
7
8
|
signal.throwIfAborted();
|
|
8
9
|
if (!Object.keys(questions).length)
|
|
9
10
|
return {};
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
11
|
+
const finishUsage = beginModelUsage(options.onUsage, 'https://openrouter.ai/api/alpha/decisions', options.model ?? 'typesafe/jev-1.13');
|
|
12
|
+
let usage, succeeded = false;
|
|
13
|
+
try {
|
|
14
|
+
const response = await (options.fetcher ?? fetch)('https://openrouter.ai/api/alpha/decisions', { method: 'POST', signal: AbortSignal.any([signal, AbortSignal.timeout(30000)]), headers: { Authorization: `Bearer ${options.apiKey}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ model: options.model ?? 'typesafe/jev-1.13', state, questions }) });
|
|
15
|
+
if (!response.ok)
|
|
16
|
+
throw Error(`jev_http_${response.status}`);
|
|
17
|
+
const raw = await response.json();
|
|
18
|
+
usage = raw?.usage;
|
|
19
|
+
const data = z.object({ answers: z.record(z.string(), answer) }).parse(raw);
|
|
20
|
+
if (Object.keys(data.answers).length !== Object.keys(questions).length)
|
|
21
|
+
throw Error('incomplete_decisions');
|
|
22
|
+
for (const [id, q] of Object.entries(questions)) {
|
|
23
|
+
const a = data.answers[id], labels = Object.keys(q.criteria);
|
|
24
|
+
if (!a || !labels.includes(a.choice) || Object.keys(a.probabilities).length !== labels.length || labels.some(k => a.probabilities[k] === undefined))
|
|
25
|
+
throw Error('invalid_decision');
|
|
26
|
+
if (Math.abs(Object.values(a.probabilities).reduce((sum, p) => sum + p, 0) - 1) > 0.06)
|
|
27
|
+
throw Error('invalid_probabilities');
|
|
28
|
+
}
|
|
29
|
+
succeeded = true;
|
|
30
|
+
return data.answers;
|
|
31
|
+
}
|
|
32
|
+
finally {
|
|
33
|
+
finishUsage(usage, signal.aborted ? 'cancelled' : succeeded ? 'success' : 'error');
|
|
22
34
|
}
|
|
23
|
-
return data.answers;
|
|
24
35
|
}
|
|
25
36
|
//# sourceMappingURL=jev-client.js.map
|
|
@@ -32,14 +32,13 @@ export class GatewayCompressor {
|
|
|
32
32
|
async compress(items, signal) {
|
|
33
33
|
if (items.length === 0)
|
|
34
34
|
return '';
|
|
35
|
-
const response = await this.#gateway.complete({
|
|
35
|
+
const response = await this.#gateway.complete({ usage: { feature: 'compression', operation: 'select' },
|
|
36
36
|
model: this.#model,
|
|
37
37
|
system: SELECTION_SYSTEM,
|
|
38
38
|
jsonSchema: z.toJSONSchema(selectionSchema),
|
|
39
39
|
maxTokens: 1024,
|
|
40
40
|
prompt: compressorPrompt(items),
|
|
41
|
-
...(signal === undefined ? {} : { signal }),
|
|
42
|
-
});
|
|
41
|
+
...(signal === undefined ? {} : { signal }), });
|
|
43
42
|
const { refs } = selectionSchema.parse(JSON.parse(response.text));
|
|
44
43
|
const selected = new Set(refs);
|
|
45
44
|
if (selected.size !== refs.length)
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { DASHSCOPE_COMPATIBLE_BASE_URL, DEEPSEEK_BASE_URL, GEMINI_BASE_URL, MODEL_ROUTE_LANE_IDS, MODEL_ROUTE_PROVIDER_IDS, OPENAI_BASE_URL, STEPFUN_COMPATIBLE_BASE_URL, } from '../config/model-routes.js';
|
|
2
|
+
const TEXT_AND_VISION = Object.freeze(['text', 'vision']);
|
|
3
|
+
const TEXT_ONLY = Object.freeze(['text']);
|
|
4
|
+
const EMBEDDING_ONLY = Object.freeze(['embedding']);
|
|
5
|
+
export const MODEL_CATALOG_PROVIDERS = Object.freeze([
|
|
6
|
+
Object.freeze({ id: 'qwen', label: 'Qwen (DashScope)', keyName: 'DASHSCOPE_API_KEY', baseUrl: DASHSCOPE_COMPATIBLE_BASE_URL, capabilities: TEXT_AND_VISION }),
|
|
7
|
+
Object.freeze({ id: 'deepseek', label: 'DeepSeek', keyName: 'DEEPSEEK_API_KEY', baseUrl: DEEPSEEK_BASE_URL, capabilities: TEXT_AND_VISION }),
|
|
8
|
+
Object.freeze({ id: 'openai', label: 'OpenAI', keyName: 'OPENAI_API_KEY', baseUrl: OPENAI_BASE_URL, capabilities: TEXT_ONLY }),
|
|
9
|
+
Object.freeze({ id: 'gemini', label: 'Gemini', keyName: 'GEMINI_API_KEY', baseUrl: GEMINI_BASE_URL, capabilities: TEXT_ONLY }),
|
|
10
|
+
Object.freeze({ id: 'stepfun', label: 'StepFun', keyName: 'STEPFUN_API_KEY', baseUrl: STEPFUN_COMPATIBLE_BASE_URL, capabilities: TEXT_AND_VISION }),
|
|
11
|
+
Object.freeze({ id: 'ark', label: 'Volcengine Ark', keyName: 'ARK_API_KEY', baseUrl: null, capabilities: TEXT_AND_VISION }),
|
|
12
|
+
Object.freeze({ id: 'openai-compatible', label: 'OpenAI-compatible', keyName: 'OPENAI_COMPATIBLE_API_KEY', baseUrl: null, capabilities: TEXT_AND_VISION }),
|
|
13
|
+
Object.freeze({ id: 'self-hosted', label: 'Self-hosted', keyName: 'SELF_HOSTED_LLM_API_KEY', baseUrl: null, capabilities: TEXT_ONLY }),
|
|
14
|
+
Object.freeze({ id: 'dashscope', label: 'DashScope Embedding', keyName: 'DASHSCOPE_API_KEY', baseUrl: DASHSCOPE_COMPATIBLE_BASE_URL, capabilities: EMBEDDING_ONLY }),
|
|
15
|
+
]);
|
|
16
|
+
function textModel(provider, id, label, capabilities, defaultMaxOutputTokens = 8192) {
|
|
17
|
+
return Object.freeze({ provider, id, label, capabilities, defaultMaxOutputTokens });
|
|
18
|
+
}
|
|
19
|
+
export const MODEL_CATALOG_MODELS = Object.freeze([
|
|
20
|
+
textModel('qwen', 'qwen-plus', 'Qwen Plus', TEXT_ONLY),
|
|
21
|
+
textModel('qwen', 'qwen-flash', 'Qwen Flash', TEXT_ONLY),
|
|
22
|
+
textModel('qwen', 'qwen-turbo', 'Qwen Turbo', TEXT_ONLY),
|
|
23
|
+
textModel('qwen', 'qwen3-vl-plus', 'Qwen3-VL Plus', TEXT_AND_VISION),
|
|
24
|
+
textModel('qwen', 'qwen3-vl-flash', 'Qwen3-VL Flash', TEXT_AND_VISION),
|
|
25
|
+
textModel('qwen', 'qwen-vl-max', 'Qwen-VL Max', TEXT_AND_VISION),
|
|
26
|
+
textModel('qwen', 'qwen-vl-plus', 'Qwen-VL Plus', TEXT_AND_VISION),
|
|
27
|
+
textModel('deepseek', 'deepseek-flash', 'DeepSeek Flash', TEXT_AND_VISION),
|
|
28
|
+
textModel('deepseek', 'deepseek-chat', 'DeepSeek Chat', TEXT_ONLY),
|
|
29
|
+
textModel('openai', 'gpt-6-luna', 'GPT-6 Luna', TEXT_ONLY, 16384),
|
|
30
|
+
textModel('openai', 'gpt-6-sol', 'GPT-6 Sol', TEXT_ONLY, 16384),
|
|
31
|
+
textModel('gemini', 'gemini-3.5-flash-lite', 'Gemini 3.5 Flash Lite', TEXT_ONLY),
|
|
32
|
+
textModel('stepfun', 'step-3.7-flash', 'Step 3.7 Flash', TEXT_AND_VISION),
|
|
33
|
+
textModel('ark', 'doubao-seed-2-0-pro-260215', 'Doubao Seed 2.0 Pro', TEXT_AND_VISION, 16384),
|
|
34
|
+
textModel('openai-compatible', 'gpt-6-sol', 'GPT-6 Sol', TEXT_AND_VISION, 16384),
|
|
35
|
+
textModel('dashscope', 'text-embedding-v4', 'Text Embedding v4', EMBEDDING_ONLY, 0),
|
|
36
|
+
]);
|
|
37
|
+
export const MODEL_CATALOG = Object.freeze({
|
|
38
|
+
lanes: MODEL_ROUTE_LANE_IDS,
|
|
39
|
+
providers: MODEL_CATALOG_PROVIDERS,
|
|
40
|
+
models: MODEL_CATALOG_MODELS,
|
|
41
|
+
});
|
|
42
|
+
/** Short aliases so either the aggregate or its two halves can be consumed. */
|
|
43
|
+
export const MODEL_LANE_IDS = MODEL_ROUTE_LANE_IDS;
|
|
44
|
+
export const MODEL_PROVIDERS = MODEL_CATALOG_PROVIDERS;
|
|
45
|
+
export const MODEL_MODELS = MODEL_CATALOG_MODELS;
|
|
46
|
+
const providerById = new Map(MODEL_CATALOG_PROVIDERS.map(provider => [provider.id, provider]));
|
|
47
|
+
const modelKey = (provider, model) => `${provider}\u0000${model}`;
|
|
48
|
+
const modelByKey = new Map(MODEL_CATALOG_MODELS.map(entry => [modelKey(entry.provider, entry.id), entry]));
|
|
49
|
+
export function catalogProvider(id) {
|
|
50
|
+
return providerById.get(id);
|
|
51
|
+
}
|
|
52
|
+
export function providerLabel(id) {
|
|
53
|
+
return providerById.get(id)?.label ?? id;
|
|
54
|
+
}
|
|
55
|
+
export function catalogModel(provider, model) {
|
|
56
|
+
return modelByKey.get(modelKey(provider, model));
|
|
57
|
+
}
|
|
58
|
+
/** Labels never invent capabilities; an unknown custom model keeps its id as the label. */
|
|
59
|
+
export function modelLabel(provider, model) {
|
|
60
|
+
return catalogModel(provider, model)?.label ?? model;
|
|
61
|
+
}
|
|
62
|
+
/** Catalog capabilities fail closed: a custom model id advertises none until verified. */
|
|
63
|
+
export function modelCapabilities(provider, model) {
|
|
64
|
+
return catalogModel(provider, model)?.capabilities ?? Object.freeze([]);
|
|
65
|
+
}
|
|
66
|
+
/** Fallback ceiling for a custom model id: text providers get the shared default, embeddings none. */
|
|
67
|
+
export function defaultMaxOutputTokens(provider, model) {
|
|
68
|
+
const entry = catalogModel(provider, model);
|
|
69
|
+
if (entry !== undefined)
|
|
70
|
+
return entry.defaultMaxOutputTokens;
|
|
71
|
+
return provider === 'dashscope' ? 0 : 8192;
|
|
72
|
+
}
|
|
73
|
+
/** True when the provider can route this capability for this lane. */
|
|
74
|
+
export function providerSupports(provider, capability) {
|
|
75
|
+
return providerById.get(provider)?.capabilities.includes(capability) === true;
|
|
76
|
+
}
|
|
77
|
+
export function isModelRouteProvider(value) {
|
|
78
|
+
return MODEL_ROUTE_PROVIDER_IDS.includes(value);
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=model-catalog.js.map
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { withUsageContext } from '../usage/context.js';
|
|
2
|
+
import { beginModelUsage, mergeModelUsage } from '../usage/model-call.js';
|
|
1
3
|
/**
|
|
2
4
|
* Provider-neutral model gateway plus the OpenAI-compatible implementation.
|
|
3
5
|
*
|
|
@@ -9,6 +11,12 @@
|
|
|
9
11
|
* what must match, not the client library.
|
|
10
12
|
*/
|
|
11
13
|
import { z } from 'zod';
|
|
14
|
+
import { rotatedCredential } from '../config/credential-rotation.js';
|
|
15
|
+
/** Pure voice can run without a support LLM; auxiliary work fails locally until explicitly configured. */
|
|
16
|
+
export const unconfiguredModelGateway = {
|
|
17
|
+
async *stream() { yield await Promise.reject(new GatewayError('support_model_unconfigured')); },
|
|
18
|
+
complete() { return Promise.reject(new GatewayError('support_model_unconfigured')); },
|
|
19
|
+
};
|
|
12
20
|
/** A provider failure whose message carries only a stable classification. */
|
|
13
21
|
export class GatewayError extends Error {
|
|
14
22
|
classification;
|
|
@@ -130,6 +138,7 @@ const completionSchema = z.object({
|
|
|
130
138
|
}).loose();
|
|
131
139
|
/** OpenAI-compatible transport. Prompts and outputs never enter metrics or logs. */
|
|
132
140
|
export class OpenAIModelGateway {
|
|
141
|
+
#onUsage;
|
|
133
142
|
#redirect;
|
|
134
143
|
#endpoint;
|
|
135
144
|
#apiKey;
|
|
@@ -140,6 +149,7 @@ export class OpenAIModelGateway {
|
|
|
140
149
|
#requestTimeout;
|
|
141
150
|
#streamIdleTimeout;
|
|
142
151
|
constructor(options) {
|
|
152
|
+
this.#onUsage = options.onUsage;
|
|
143
153
|
if (!options.baseUrl || (!options.apiKey && !options.allowAnonymous)) {
|
|
144
154
|
throw new TypeError('baseUrl and apiKey are required');
|
|
145
155
|
}
|
|
@@ -149,7 +159,8 @@ export class OpenAIModelGateway {
|
|
|
149
159
|
this.#clock = options.clock;
|
|
150
160
|
this.#metrics = options.metrics ?? new LoggingMetrics();
|
|
151
161
|
this.#fetch = options.fetch ?? globalThis.fetch;
|
|
152
|
-
|
|
162
|
+
// The official DashScope endpoint has a known protocol, even when selected through DASHSCOPE_MODEL_BASE_URL.
|
|
163
|
+
this.#thinkingControl = options.thinkingControl ?? (new URL(this.#endpoint).hostname === 'dashscope.aliyuncs.com' ? 'qwen' : new URL(this.#endpoint).hostname === 'api.deepseek.com' ? 'deepseek' : undefined);
|
|
153
164
|
this.#requestTimeout = options.requestTimeout ?? 120;
|
|
154
165
|
this.#streamIdleTimeout = options.streamIdleTimeout ?? 600;
|
|
155
166
|
if (!Number.isFinite(this.#streamIdleTimeout) || this.#streamIdleTimeout <= 0) {
|
|
@@ -157,6 +168,8 @@ export class OpenAIModelGateway {
|
|
|
157
168
|
}
|
|
158
169
|
}
|
|
159
170
|
async *stream(request) {
|
|
171
|
+
const finishUsage = withUsageContext(request.usage ?? {}, () => beginModelUsage(this.#onUsage, this.#endpoint, request.model));
|
|
172
|
+
let rawUsage;
|
|
160
173
|
const started = this.#clock.now();
|
|
161
174
|
const images = request.images ?? [];
|
|
162
175
|
let requestId = null;
|
|
@@ -177,6 +190,7 @@ export class OpenAIModelGateway {
|
|
|
177
190
|
const chunk = parsed.data;
|
|
178
191
|
requestId = chunk.id ?? requestId;
|
|
179
192
|
if (chunk.usage != null) {
|
|
193
|
+
rawUsage = mergeModelUsage(rawUsage, chunk.usage);
|
|
180
194
|
inputTokens = chunk.usage.prompt_tokens ?? inputTokens;
|
|
181
195
|
outputTokens = chunk.usage.completion_tokens ?? outputTokens;
|
|
182
196
|
}
|
|
@@ -204,12 +218,15 @@ export class OpenAIModelGateway {
|
|
|
204
218
|
throw new GatewayError(errorType);
|
|
205
219
|
}
|
|
206
220
|
finally {
|
|
221
|
+
finishUsage(rawUsage, request.signal?.aborted ? 'cancelled' : errorType !== null ? 'error' : finishReason === null ? 'cancelled' : 'success', requestId);
|
|
207
222
|
this.#record(request.model, images.length, started, {
|
|
208
223
|
requestId, inputTokens, outputTokens, finishReason, errorType,
|
|
209
224
|
});
|
|
210
225
|
}
|
|
211
226
|
}
|
|
212
227
|
async complete(request) {
|
|
228
|
+
const finishUsage = withUsageContext(request.usage ?? {}, () => beginModelUsage(this.#onUsage, this.#endpoint, request.model, 'llm', undefined, request.reasoning));
|
|
229
|
+
let rawUsage;
|
|
213
230
|
const started = this.#clock.now();
|
|
214
231
|
const images = request.images ?? [];
|
|
215
232
|
let requestId = null;
|
|
@@ -220,7 +237,7 @@ export class OpenAIModelGateway {
|
|
|
220
237
|
try {
|
|
221
238
|
const body = completeRequestBody(request);
|
|
222
239
|
const pending = await this.#post(this.#thinkingControl === 'deepseek' && request.reasoning === 'disabled'
|
|
223
|
-
? { ...body, thinking: { type: 'disabled' } } : this.#thinkingControl === 'openai' ? openAIBody(body) : this.#thinkingControl === 'qwen' ? qwenBody(body, request) : body, request.signal);
|
|
240
|
+
? { ...body, thinking: { type: 'disabled' } } : this.#thinkingControl === 'openai' ? openAIBody(body) : this.#thinkingControl === 'qwen' ? qwenBody(body, request) : body, request.signal, request.timeoutSeconds);
|
|
224
241
|
let raw;
|
|
225
242
|
try {
|
|
226
243
|
raw = await pending.response.json();
|
|
@@ -228,6 +245,8 @@ export class OpenAIModelGateway {
|
|
|
228
245
|
finally {
|
|
229
246
|
pending.clearRequestTimeout();
|
|
230
247
|
}
|
|
248
|
+
if (raw && typeof raw === 'object')
|
|
249
|
+
rawUsage = raw.usage;
|
|
231
250
|
const payload = completionSchema.parse(raw);
|
|
232
251
|
requestId = payload.id ?? null;
|
|
233
252
|
if (payload.usage != null) {
|
|
@@ -236,23 +255,26 @@ export class OpenAIModelGateway {
|
|
|
236
255
|
}
|
|
237
256
|
const choice = payload.choices[0];
|
|
238
257
|
finishReason = choice.finish_reason ?? null;
|
|
239
|
-
return { text: choice.message.content ?? '' };
|
|
258
|
+
return { text: choice.message.content ?? '', ...(finishReason === null ? {} : { finish_reason: finishReason }) };
|
|
240
259
|
}
|
|
241
260
|
catch (error) {
|
|
242
261
|
errorType = classify(error);
|
|
243
262
|
throw new GatewayError(errorType);
|
|
244
263
|
}
|
|
245
264
|
finally {
|
|
265
|
+
finishUsage(rawUsage, request.signal?.aborted ? 'cancelled' : errorType !== null ? 'error' : 'success', requestId);
|
|
246
266
|
this.#record(request.model, images.length, started, {
|
|
247
267
|
requestId, inputTokens, outputTokens, finishReason, errorType,
|
|
248
268
|
});
|
|
249
269
|
}
|
|
250
270
|
}
|
|
251
|
-
async #post(body, signal) {
|
|
271
|
+
async #post(body, signal, timeoutSeconds = this.#requestTimeout) {
|
|
272
|
+
if (!Number.isFinite(timeoutSeconds) || timeoutSeconds <= 0 || timeoutSeconds > 600)
|
|
273
|
+
throw new TypeError('request timeout must be between 0 and 600 seconds');
|
|
252
274
|
const timeout = new AbortController();
|
|
253
275
|
const timer = setTimeout(() => {
|
|
254
276
|
timeout.abort(new DOMException('The model request timed out', 'TimeoutError'));
|
|
255
|
-
},
|
|
277
|
+
}, timeoutSeconds * 1000);
|
|
256
278
|
const clearRequestTimeout = () => { clearTimeout(timer); };
|
|
257
279
|
try {
|
|
258
280
|
const response = await this.#fetch(this.#endpoint, {
|
|
@@ -260,7 +282,7 @@ export class OpenAIModelGateway {
|
|
|
260
282
|
redirect: this.#redirect,
|
|
261
283
|
headers: {
|
|
262
284
|
// The credential rides in the header and never in a log line or metric.
|
|
263
|
-
...(this.#apiKey ? { authorization: `Bearer ${this.#apiKey}` } : {}),
|
|
285
|
+
...(this.#apiKey ? { authorization: `Bearer ${rotatedCredential(this.#apiKey)}` } : {}),
|
|
264
286
|
'content-type': 'application/json',
|
|
265
287
|
accept: body.stream === true ? 'text/event-stream' : 'application/json',
|
|
266
288
|
},
|
|
@@ -280,16 +302,19 @@ export class OpenAIModelGateway {
|
|
|
280
302
|
}
|
|
281
303
|
}
|
|
282
304
|
#record(model, imageCount, started, outcome) {
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
305
|
+
try {
|
|
306
|
+
this.#metrics.record({
|
|
307
|
+
model,
|
|
308
|
+
image_count: imageCount,
|
|
309
|
+
request_id: outcome.requestId,
|
|
310
|
+
latency: this.#clock.now() - started,
|
|
311
|
+
input_tokens: outcome.inputTokens,
|
|
312
|
+
output_tokens: outcome.outputTokens,
|
|
313
|
+
finish_reason: outcome.finishReason,
|
|
314
|
+
error_type: outcome.errorType,
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
catch { /* Diagnostics cannot break model work. */ }
|
|
293
318
|
}
|
|
294
319
|
}
|
|
295
320
|
function classify(error) {
|
|
@@ -385,9 +410,9 @@ function openAIBody(body) {
|
|
|
385
410
|
const { max_tokens, ...rest } = body;
|
|
386
411
|
return { ...rest, reasoning_effort: 'none', ...(max_tokens === undefined ? {} : { max_completion_tokens: max_tokens }) };
|
|
387
412
|
}
|
|
388
|
-
/**
|
|
413
|
+
/** Only documented hybrid models accept these controls; legacy VL models keep their own protocol. */
|
|
389
414
|
function qwenBody(body, request) {
|
|
390
|
-
const capable = ['qwen3-vl-plus', 'qwen3-vl-flash'].some(model => request.model === model || request.model.startsWith(model + '-'));
|
|
415
|
+
const capable = ['qwen-plus', 'qwen-plus-latest'].includes(request.model) || ['qwen3-vl-plus', 'qwen3-vl-flash', 'qwen3.8-max'].some(model => request.model === model || request.model.startsWith(model + '-'));
|
|
391
416
|
if (!capable || request.reasoning === undefined)
|
|
392
417
|
return body;
|
|
393
418
|
const controlled = { ...body, enable_thinking: request.reasoning === 'enabled', ...(request.reasoning === 'enabled' && request.reasoningBudget !== undefined ? { thinking_budget: request.reasoningBudget } : {}) };
|
|
@@ -396,4 +421,8 @@ function qwenBody(body, request) {
|
|
|
396
421
|
delete controlled.response_format;
|
|
397
422
|
return controlled;
|
|
398
423
|
}
|
|
424
|
+
/** Bind durable task identity without changing shared gateway state. */
|
|
425
|
+
export function gatewayWithUsage(gateway, context) {
|
|
426
|
+
return { complete: request => gateway.complete({ ...request, usage: { ...context, ...request.usage } }), stream: request => gateway.stream({ ...request, usage: { ...context, ...request.usage } }) };
|
|
427
|
+
}
|
|
399
428
|
//# sourceMappingURL=model-gateway.js.map
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export function
|
|
4
|
-
export function currentModelPurpose() { return scope.getStore() ?? 'other'; }
|
|
1
|
+
import { currentUsageContext, withUsageContext } from '../usage/context.js';
|
|
2
|
+
export function withModelPurpose(purpose, run) { return withUsageContext({ feature: purpose }, run); }
|
|
3
|
+
export function currentModelPurpose() { return currentUsageContext().feature ?? 'other'; }
|
|
5
4
|
//# sourceMappingURL=model-purpose.js.map
|