@qvac/core 0.5.0 → 0.6.1
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/CHANGELOG.md +92 -1
- package/dist-lib/lib/api/agents.js +3 -2
- package/dist-lib/lib/api/app-config.d.ts +1 -1
- package/dist-lib/lib/api/app-config.js +54 -15
- package/dist-lib/lib/api/attachments.d.ts +6 -5
- package/dist-lib/lib/api/attachments.js +4 -2
- package/dist-lib/lib/api/chat.d.ts +7 -3
- package/dist-lib/lib/api/chat.js +4 -4
- package/dist-lib/lib/api/chunks.js +3 -3
- package/dist-lib/lib/api/config.js +2 -2
- package/dist-lib/lib/api/current-mesh.d.ts +3 -4
- package/dist-lib/lib/api/current-mesh.js +9 -4
- package/dist-lib/lib/api/custom-models.d.ts +8 -1
- package/dist-lib/lib/api/custom-models.js +53 -16
- package/dist-lib/lib/api/devices.d.ts +14 -5
- package/dist-lib/lib/api/devices.js +13 -8
- package/dist-lib/lib/api/diagnostics.d.ts +1 -0
- package/dist-lib/lib/api/diagnostics.js +1 -1
- package/dist-lib/lib/api/effective-ctx-size.d.ts +6 -1
- package/dist-lib/lib/api/effective-ctx-size.js +5 -3
- package/dist-lib/lib/api/execution.js +2 -1
- package/dist-lib/lib/api/files.js +2 -1
- package/dist-lib/lib/api/index.d.ts +5 -1
- package/dist-lib/lib/api/index.js +101 -102
- package/dist-lib/lib/api/instrument.js +29 -20
- package/dist-lib/lib/api/knowledge.d.ts +6 -5
- package/dist-lib/lib/api/knowledge.js +8 -6
- package/dist-lib/lib/api/local-files.js +1 -1
- package/dist-lib/lib/api/logs.js +6 -3
- package/dist-lib/lib/api/members.js +22 -13
- package/dist-lib/lib/api/mesh.js +3 -3
- package/dist-lib/lib/api/model-download.js +1 -1
- package/dist-lib/lib/api/network.d.ts +1 -0
- package/dist-lib/lib/api/network.js +1 -1
- package/dist-lib/lib/api/notifications.js +23 -13
- package/dist-lib/lib/api/rag.d.ts +6 -1
- package/dist-lib/lib/api/rag.js +20 -11
- package/dist-lib/lib/api/range.d.ts +2 -2
- package/dist-lib/lib/api/sync.js +1 -1
- package/dist-lib/lib/api/tool-activity.js +7 -3
- package/dist-lib/lib/api/tool-configs.js +2 -4
- package/dist-lib/lib/api/upload-frames.d.ts +7 -8
- package/dist-lib/lib/api/upload-frames.js +2 -1
- package/dist-lib/lib/api/watchable.d.ts +6 -1
- package/dist-lib/lib/api/watchable.js +23 -14
- package/dist-lib/lib/assistant/fetch-body.js +4 -2
- package/dist-lib/lib/assistant/harness.d.ts +48 -27
- package/dist-lib/lib/assistant/harness.js +40 -16
- package/dist-lib/lib/assistant/history.d.ts +9 -7
- package/dist-lib/lib/assistant/history.js +77 -42
- package/dist-lib/lib/assistant/message.d.ts +5 -3
- package/dist-lib/lib/assistant/message.js +4 -2
- package/dist-lib/lib/assistant/skill-encode.d.ts +3 -1
- package/dist-lib/lib/assistant/skill-encode.js +52 -62
- package/dist-lib/lib/assistant-client.js +7 -4
- package/dist-lib/lib/assistant-tree.js +27 -11
- package/dist-lib/lib/assistant.d.ts +31 -11
- package/dist-lib/lib/assistant.js +846 -390
- package/dist-lib/lib/audio-format.d.ts +1 -1
- package/dist-lib/lib/audio-format.js +1 -1
- package/dist-lib/lib/chat-title.js +9 -4
- package/dist-lib/lib/client.js +3 -2
- package/dist-lib/lib/collabora/convert.d.ts +2 -2
- package/dist-lib/lib/collabora/convert.js +6 -3
- package/dist-lib/lib/collabora/entry.js +9 -5
- package/dist-lib/lib/collabora/protocol.d.ts +2 -2
- package/dist-lib/lib/collabora/protocol.js +14 -7
- package/dist-lib/lib/collabora/worker.js +14 -7
- package/dist-lib/lib/compaction.d.ts +5 -6
- package/dist-lib/lib/compaction.js +14 -7
- package/dist-lib/lib/core/account-recovery.d.ts +4 -3
- package/dist-lib/lib/core/account-recovery.js +7 -4
- package/dist-lib/lib/core/agent.js +17 -15
- package/dist-lib/lib/core/approval-rules.d.ts +7 -6
- package/dist-lib/lib/core/approval-rules.js +12 -6
- package/dist-lib/lib/core/archived-mesh.d.ts +7 -5
- package/dist-lib/lib/core/archived-mesh.js +25 -22
- package/dist-lib/lib/core/async-iterable.js +10 -5
- package/dist-lib/lib/core/attachment-link.d.ts +2 -2
- package/dist-lib/lib/core/audio-attachment.js +1 -1
- package/dist-lib/lib/core/blind-peers.d.ts +2 -2
- package/dist-lib/lib/core/chat-activity.d.ts +2 -2
- package/dist-lib/lib/core/chat-activity.js +42 -21
- package/dist-lib/lib/core/chat-group.d.ts +8 -6
- package/dist-lib/lib/core/chat-group.js +17 -10
- package/dist-lib/lib/core/chat-order.d.ts +11 -9
- package/dist-lib/lib/core/chat-order.js +1 -3
- package/dist-lib/lib/core/chat-search.d.ts +4 -4
- package/dist-lib/lib/core/chat-search.js +38 -24
- package/dist-lib/lib/core/chat.d.ts +20 -14
- package/dist-lib/lib/core/chat.js +50 -31
- package/dist-lib/lib/core/chunk.d.ts +19 -23
- package/dist-lib/lib/core/chunk.js +27 -21
- package/dist-lib/lib/core/collections.d.ts +70 -0
- package/dist-lib/lib/core/collections.js +70 -0
- package/dist-lib/lib/core/contract/activity.d.ts +6 -2
- package/dist-lib/lib/core/contract/activity.js +15 -12
- package/dist-lib/lib/core/contract/agents.js +3 -2
- package/dist-lib/lib/core/contract/approval-rules.js +1 -1
- package/dist-lib/lib/core/contract/attestations.js +1 -1
- package/dist-lib/lib/core/contract/chat-group.js +1 -1
- package/dist-lib/lib/core/contract/chat.d.ts +2 -0
- package/dist-lib/lib/core/contract/chat.js +67 -1
- package/dist-lib/lib/core/contract/chunks.js +15 -9
- package/dist-lib/lib/core/contract/compute.d.ts +1 -1
- package/dist-lib/lib/core/contract/compute.js +4 -2
- package/dist-lib/lib/core/contract/devices.js +6 -5
- package/dist-lib/lib/core/contract/grant-order.js +5 -6
- package/dist-lib/lib/core/contract/index.js +4 -2
- package/dist-lib/lib/core/contract/indexing.js +3 -3
- package/dist-lib/lib/core/contract/invites.d.ts +8 -3
- package/dist-lib/lib/core/contract/invites.js +52 -26
- package/dist-lib/lib/core/contract/joined-meshes.js +3 -3
- package/dist-lib/lib/core/contract/knowledge.js +5 -5
- package/dist-lib/lib/core/contract/members.d.ts +13 -2
- package/dist-lib/lib/core/contract/members.js +46 -25
- package/dist-lib/lib/core/contract/mesh-kind.js +9 -8
- package/dist-lib/lib/core/contract/seal.js +1 -1
- package/dist-lib/lib/core/contract/seed-defaults.js +1 -3
- package/dist-lib/lib/core/contract/tool-activity.js +10 -5
- package/dist-lib/lib/core/contract/tool-configs.js +1 -2
- package/dist-lib/lib/core/contract/writers.d.ts +6 -1
- package/dist-lib/lib/core/contract/writers.js +55 -34
- package/dist-lib/lib/core/departures.js +16 -8
- package/dist-lib/lib/core/device-invites.js +3 -2
- package/dist-lib/lib/core/devices.js +6 -3
- package/dist-lib/lib/core/document-attachment.d.ts +20 -11
- package/dist-lib/lib/core/document-attachment.js +10 -5
- package/dist-lib/lib/core/files/attachments.d.ts +2 -5
- package/dist-lib/lib/core/files/attachments.js +6 -3
- package/dist-lib/lib/core/files/index.d.ts +46 -52
- package/dist-lib/lib/core/files/index.js +149 -94
- package/dist-lib/lib/core/files/knowledge.d.ts +2 -5
- package/dist-lib/lib/core/files/local-index.d.ts +4 -1
- package/dist-lib/lib/core/files/local-index.js +9 -5
- package/dist-lib/lib/core/files/preview/image.d.ts +0 -1
- package/dist-lib/lib/core/files/preview/image.js +9 -6
- package/dist-lib/lib/core/files/preview/index.d.ts +8 -11
- package/dist-lib/lib/core/files/preview/index.js +20 -15
- package/dist-lib/lib/core/files/processing/claims.d.ts +6 -5
- package/dist-lib/lib/core/files/processing/claims.js +16 -8
- package/dist-lib/lib/core/files/processing/document.d.ts +21 -50
- package/dist-lib/lib/core/files/processing/index.d.ts +21 -13
- package/dist-lib/lib/core/files/processing/index.js +74 -37
- package/dist-lib/lib/core/files/processing/ownership.d.ts +8 -1
- package/dist-lib/lib/core/files/processing/ownership.js +1 -1
- package/dist-lib/lib/core/files/processing/protocol.d.ts +19 -19
- package/dist-lib/lib/core/files/processing/protocol.js +5 -5
- package/dist-lib/lib/core/files/processing/settle.d.ts +10 -7
- package/dist-lib/lib/core/files/processing/settle.js +22 -11
- package/dist-lib/lib/core/files/processing/source.js +14 -8
- package/dist-lib/lib/core/files/processing/state.d.ts +14 -11
- package/dist-lib/lib/core/files/processing/state.js +24 -12
- package/dist-lib/lib/core/files/rag/build.d.ts +2 -2
- package/dist-lib/lib/core/files/rag/build.js +2 -1
- package/dist-lib/lib/core/files/rag/document-types.d.ts +4 -6
- package/dist-lib/lib/core/files/rag/index.d.ts +12 -13
- package/dist-lib/lib/core/files/rag/index.js +9 -2
- package/dist-lib/lib/core/files/rag/load.d.ts +10 -9
- package/dist-lib/lib/core/files/rag/load.js +26 -13
- package/dist-lib/lib/core/files/rag/policy.js +2 -1
- package/dist-lib/lib/core/files/rag/produce.js +33 -19
- package/dist-lib/lib/core/files/rag/retrieval/full-text.d.ts +5 -3
- package/dist-lib/lib/core/files/rag/retrieval/full-text.js +30 -10
- package/dist-lib/lib/core/files/records/chunks.js +4 -2
- package/dist-lib/lib/core/files/records/index.d.ts +1 -0
- package/dist-lib/lib/core/files/records/index.js +1 -0
- package/dist-lib/lib/core/files/records/knowledge.d.ts +10 -11
- package/dist-lib/lib/core/files/records/knowledge.js +9 -8
- package/dist-lib/lib/core/files/records/linkage.js +6 -3
- package/dist-lib/lib/core/files/records/output.d.ts +5 -4
- package/dist-lib/lib/core/files/records/output.js +8 -4
- package/dist-lib/lib/core/files/records/purge.d.ts +4 -0
- package/dist-lib/lib/core/files/records/purge.js +108 -0
- package/dist-lib/lib/core/files/records/reclaim.js +43 -25
- package/dist-lib/lib/core/files/records/routing.d.ts +4 -6
- package/dist-lib/lib/core/files/records/routing.js +15 -8
- package/dist-lib/lib/core/files/records/source.d.ts +5 -4
- package/dist-lib/lib/core/files/records/source.js +20 -14
- package/dist-lib/lib/core/files/records/sweep.js +1 -3
- package/dist-lib/lib/core/files/store/blob.d.ts +11 -10
- package/dist-lib/lib/core/files/store/blob.js +54 -19
- package/dist-lib/lib/core/files/store/index.d.ts +2 -6
- package/dist-lib/lib/core/files/store/index.js +10 -5
- package/dist-lib/lib/core/files/store/inline.d.ts +2 -2
- package/dist-lib/lib/core/files/store/inline.js +6 -3
- package/dist-lib/lib/core/files/store/reference.d.ts +6 -9
- package/dist-lib/lib/core/files/store/reference.js +25 -17
- package/dist-lib/lib/core/files/store/server.d.ts +7 -6
- package/dist-lib/lib/core/files/store/server.js +22 -11
- package/dist-lib/lib/core/files/store/sweep.js +13 -7
- package/dist-lib/lib/core/files/upload-input.d.ts +4 -12
- package/dist-lib/lib/core/files/upload-input.js +10 -5
- package/dist-lib/lib/core/files/upload.d.ts +27 -24
- package/dist-lib/lib/core/files/upload.js +74 -51
- package/dist-lib/lib/core/fs-drives.js +4 -2
- package/dist-lib/lib/core/grant-expiry.js +12 -7
- package/dist-lib/lib/core/handoff-channel.js +27 -13
- package/dist-lib/lib/core/harness-loan.js +35 -17
- package/dist-lib/lib/core/helpers/index.js +6 -2
- package/dist-lib/lib/core/hosted-agents.js +19 -12
- package/dist-lib/lib/core/id.js +1 -1
- package/dist-lib/lib/core/identity.js +6 -3
- package/dist-lib/lib/core/image/cache-sweep.d.ts +12 -10
- package/dist-lib/lib/core/image/cache-sweep.js +11 -6
- package/dist-lib/lib/core/image/normalize.d.ts +6 -0
- package/dist-lib/lib/core/image/normalize.js +12 -2
- package/dist-lib/lib/core/image/sniff.js +42 -21
- package/dist-lib/lib/core/inference-calls-receiver.js +7 -4
- package/dist-lib/lib/core/invite-grants.js +4 -2
- package/dist-lib/lib/core/invite.js +2 -1
- package/dist-lib/lib/core/local/files.d.ts +2 -0
- package/dist-lib/lib/core/local/files.js +51 -19
- package/dist-lib/lib/core/local/index.d.ts +69 -46
- package/dist-lib/lib/core/local/index.js +146 -129
- package/dist-lib/lib/core/membership.d.ts +12 -2
- package/dist-lib/lib/core/membership.js +55 -33
- package/dist-lib/lib/core/mesh-seed-handoff.js +7 -1
- package/dist-lib/lib/core/mesh.d.ts +37 -27
- package/dist-lib/lib/core/mesh.js +131 -73
- package/dist-lib/lib/core/migrations/agent-catalog.js +3 -2
- package/dist-lib/lib/core/migrations/agent-indexes.js +3 -3
- package/dist-lib/lib/core/migrations/file-index.js +7 -4
- package/dist-lib/lib/core/migrations/index.d.ts +4 -3
- package/dist-lib/lib/core/migrations/membership.js +9 -4
- package/dist-lib/lib/core/migrations/seal.js +3 -2
- package/dist-lib/lib/core/min-version.js +4 -2
- package/dist-lib/lib/core/next-frame.d.ts +5 -4
- package/dist-lib/lib/core/next-frame.js +6 -3
- package/dist-lib/lib/core/notification.d.ts +5 -1
- package/dist-lib/lib/core/notification.js +89 -77
- package/dist-lib/lib/core/ota-config.js +2 -1
- package/dist-lib/lib/core/pdf/rasterize.d.ts +18 -0
- package/dist-lib/lib/core/pdf/rasterize.js +57 -0
- package/dist-lib/lib/core/prompt-history.js +4 -2
- package/dist-lib/lib/core/range.d.ts +4 -4
- package/dist-lib/lib/core/range.js +12 -6
- package/dist-lib/lib/core/rank.d.ts +5 -4
- package/dist-lib/lib/core/rank.js +2 -1
- package/dist-lib/lib/core/send.d.ts +4 -4
- package/dist-lib/lib/core/send.js +6 -3
- package/dist-lib/lib/core/skill-overlay-receiver.js +7 -4
- package/dist-lib/lib/core/skill-secrets.js +16 -9
- package/dist-lib/lib/core/sync/chunks.js +2 -1
- package/dist-lib/lib/core/sync/devices.js +3 -1
- package/dist-lib/lib/core/sync/files.d.ts +2 -4
- package/dist-lib/lib/core/sync/files.js +28 -20
- package/dist-lib/lib/core/sync/index.d.ts +2 -5
- package/dist-lib/lib/core/sync/index.js +33 -15
- package/dist-lib/lib/core/sync-status.js +10 -7
- package/dist-lib/lib/core/system-info.js +4 -2
- package/dist-lib/lib/core/tool-activity.d.ts +4 -3
- package/dist-lib/lib/core/tool-activity.js +1 -1
- package/dist-lib/lib/core/tool-configs.js +12 -7
- package/dist-lib/lib/core.d.ts +38 -26
- package/dist-lib/lib/core.js +1009 -541
- package/dist-lib/lib/credential-pusher.d.ts +20 -20
- package/dist-lib/lib/credential-pusher.js +65 -43
- package/dist-lib/lib/custom-model-pusher.d.ts +7 -3
- package/dist-lib/lib/custom-model-pusher.js +15 -7
- package/dist-lib/lib/custom-model-task.d.ts +1 -0
- package/dist-lib/lib/custom-model-task.js +12 -0
- package/dist-lib/lib/deadline.js +4 -2
- package/dist-lib/lib/diagnostics.d.ts +1 -5
- package/dist-lib/lib/frame-readable.d.ts +3 -0
- package/dist-lib/lib/frame-readable.js +3 -0
- package/dist-lib/lib/fs-drive-bridge.js +24 -14
- package/dist-lib/lib/fs-grants.js +13 -8
- package/dist-lib/lib/guards.d.ts +3 -0
- package/dist-lib/lib/guards.js +9 -0
- package/dist-lib/lib/inference-calls.d.ts +28 -23
- package/dist-lib/lib/inference-calls.js +25 -13
- package/dist-lib/lib/integrations/mcp-providers.d.ts +2 -2
- package/dist-lib/lib/integrations/setup-routes.d.ts +2 -2
- package/dist-lib/lib/knowledge-search.d.ts +6 -5
- package/dist-lib/lib/knowledge-search.js +26 -18
- package/dist-lib/lib/kv-cache-reclaim.js +4 -2
- package/dist-lib/lib/kv-cache.js +8 -4
- package/dist-lib/lib/legacy-core-domain.d.ts +42 -42
- package/dist-lib/lib/log-buffer.js +2 -1
- package/dist-lib/lib/log.js +25 -15
- package/dist-lib/lib/mesh-scoped-engine.js +12 -4
- package/dist-lib/lib/model-catalog-revision.js +6 -3
- package/dist-lib/lib/model-clamp.js +6 -3
- package/dist-lib/lib/model-context.d.ts +8 -3
- package/dist-lib/lib/model-context.js +13 -5
- package/dist-lib/lib/model-download-status.js +4 -2
- package/dist-lib/lib/model-download.d.ts +12 -4
- package/dist-lib/lib/model-download.js +200 -103
- package/dist-lib/lib/model-idle-pusher.d.ts +2 -2
- package/dist-lib/lib/model-idle-pusher.js +3 -4
- package/dist-lib/lib/oauth/browser-connect.d.ts +10 -8
- package/dist-lib/lib/oauth/browser-connect.js +33 -20
- package/dist-lib/lib/oauth/client.d.ts +2 -2
- package/dist-lib/lib/oauth/flow-core.js +23 -9
- package/dist-lib/lib/oauth/flow.d.ts +1 -3
- package/dist-lib/lib/oauth/flow.js +9 -5
- package/dist-lib/lib/oauth/keys.d.ts +4 -4
- package/dist-lib/lib/oauth/keys.js +18 -12
- package/dist-lib/lib/oauth/loopback.d.ts +2 -2
- package/dist-lib/lib/oauth/loopback.js +147 -107
- package/dist-lib/lib/oauth/loopback.stub.d.ts +2 -2
- package/dist-lib/lib/oauth/loopback.stub.js +1 -1
- package/dist-lib/lib/oauth/pkce.d.ts +4 -2
- package/dist-lib/lib/oauth/pkce.js +10 -0
- package/dist-lib/lib/oauth/providers.js +5 -5
- package/dist-lib/lib/oauth/redirect-types.d.ts +12 -7
- package/dist-lib/lib/oauth/register.js +3 -2
- package/dist-lib/lib/oauth/registry.d.ts +2 -2
- package/dist-lib/lib/oauth/registry.js +2 -1
- package/dist-lib/lib/oauth/resolve.d.ts +30 -10
- package/dist-lib/lib/oauth/resolve.js +12 -6
- package/dist-lib/lib/oauth/token-exchange-core.d.ts +12 -4
- package/dist-lib/lib/oauth/token-exchange-core.js +1 -1
- package/dist-lib/lib/oauth/types.d.ts +12 -12
- package/dist-lib/lib/oauth.d.ts +4 -5
- package/dist-lib/lib/oauth.js +2 -3
- package/dist-lib/lib/reconnecting-watch.d.ts +1 -1
- package/dist-lib/lib/reconnecting-watch.js +6 -6
- package/dist-lib/lib/retry-budget.js +6 -3
- package/dist-lib/lib/run-notices.d.ts +1 -0
- package/dist-lib/lib/run-notices.js +5 -2
- package/dist-lib/lib/run-transcript.d.ts +2 -4
- package/dist-lib/lib/run-transcript.js +4 -2
- package/dist-lib/lib/skill-readiness.js +4 -2
- package/dist-lib/lib/skill-types.d.ts +16 -16
- package/dist-lib/lib/suspend-lifecycle.d.ts +4 -4
- package/dist-lib/lib/suspend-lifecycle.js +10 -5
- package/dist-lib/lib/task.js +22 -12
- package/dist-lib/lib/unref.d.ts +3 -2
- package/dist-lib/lib/unref.js +2 -1
- package/dist-lib/lib/wav-duration.js +10 -5
- package/dist-lib/lib/write-queue.d.ts +5 -4
- package/dist-lib/lib/write-queue.js +2 -1
- package/dist-lib/schema/build.js +10 -6
- package/dist-lib/schema/config.d.ts +2 -3
- package/dist-lib/schema/content.d.ts +17 -2
- package/dist-lib/schema/content.js +2 -1
- package/dist-lib/schema/engine.d.ts +3 -2
- package/dist-lib/schema/engine.js +95 -6
- package/dist-lib/schema/field-order.js +22 -11
- package/dist-lib/schema/indexes.d.ts +22 -0
- package/dist-lib/schema/{helpers.js → indexes.js} +14 -57
- package/dist-lib/schema/local.d.ts +3 -2
- package/dist-lib/schema/local.js +7 -2
- package/dist-lib/schema/media-kind.d.ts +8 -0
- package/dist-lib/schema/media-kind.js +52 -0
- package/dist-lib/schema/qvac.d.ts +12 -9
- package/dist-lib/schema/qvac.js +18 -4
- package/dist-lib/spec/bind.js +12 -0
- package/dist-lib/spec/calls.js +4 -0
- package/dist-lib/spec/capabilities.d.ts +12 -4
- package/dist-lib/spec/hrpc/hrpc.json +54 -2
- package/dist-lib/spec/hrpc/index.js +53 -5
- package/dist-lib/spec/hrpc/messages.js +783 -494
- package/dist-lib/spec/hyperschema/index.js +783 -494
- package/dist-lib/spec/hyperschema/schema.json +247 -1
- package/dist-lib/spec/hyperschema/types.d.ts +69 -1
- package/dist-lib/spec/local/hyperdb/index.js +1 -1
- package/dist-lib/spec/local/hyperdb/messages.js +82 -14
- package/dist-lib/spec/local/hyperschema/index.js +42 -8
- package/dist-lib/spec/local/hyperschema/schema.json +27 -1
- package/dist-lib/spec/local/hyperschema/types.d.ts +6 -1
- package/dist-lib/spec/mesh/hyperdb/db.json +16 -1
- package/dist-lib/spec/mesh/hyperdb/index.js +72 -3
- package/dist-lib/spec/mesh/hyperdb/messages.js +400 -221
- package/dist-lib/spec/mesh/hyperdispatch/dispatch.json +7 -1
- package/dist-lib/spec/mesh/hyperdispatch/index.js +18 -1
- package/dist-lib/spec/mesh/hyperdispatch/messages.js +117 -2
- package/dist-lib/spec/mesh/hyperschema/index.js +117 -2
- package/dist-lib/spec/mesh/hyperschema/schema.json +65 -1
- package/dist-lib/spec/mesh/hyperschema/types.d.ts +19 -1
- package/package.json +8 -4
- package/tui/app.mjs +2424 -941
- package/tui/boot.mjs +18 -49
- package/tui/index.mjs +10 -5
- package/tui/lib/boot-timing.mjs +8 -8
- package/tui/lib/busy-words.mjs +21 -22
- package/tui/lib/export.mjs +100 -32
- package/tui/lib/knowledge-command.mjs +64 -19
- package/tui/lib/knowledge-import.mjs +52 -18
- package/tui/lib/render.mjs +65 -33
- package/tui/lib/save-file.mjs +30 -13
- package/tui/lib/select.mjs +23 -5
- package/tui/lib/selection.mjs +6 -4
- package/tui/lib/setup.mjs +11 -19
- package/tui/lib/sidebar.mjs +23 -13
- package/tui/lib/splash.mjs +6 -7
- package/tui/lib/upload-frames.mjs +1 -2
- package/tui/lib/usage.mjs +13 -9
- package/tui/lib/wrap.mjs +35 -6
- package/tui/main.mjs +54 -78
- package/worker/assistant-sidecar.mjs +5 -10
- package/worker/stow-entry.mjs +7 -4
- package/dist-lib/lib/custom-model-source.d.ts +0 -15
- package/dist-lib/lib/custom-model-source.js +0 -46
- package/dist-lib/lib/oauth/common.d.ts +0 -38
- package/dist-lib/lib/oauth/common.js +0 -34
- package/dist-lib/schema/helpers.d.ts +0 -33
package/CHANGELOG.md
CHANGED
|
@@ -13,6 +13,95 @@ release.
|
|
|
13
13
|
|
|
14
14
|
## [Unreleased]
|
|
15
15
|
|
|
16
|
+
### Fixed
|
|
17
|
+
|
|
18
|
+
- `duck` crashed at start on Bare 1.33 and later, `--help` and `--version`
|
|
19
|
+
included, with "Invalid left-hand side expression in prefix operation": Bare
|
|
20
|
+
now links what `import.meta.resolve()` names, and the TUI named a `SKILL.md`.
|
|
21
|
+
|
|
22
|
+
## [0.6.1] - 2026-09-29
|
|
23
|
+
|
|
24
|
+
### Fixed
|
|
25
|
+
|
|
26
|
+
- A connected skill's OAuth token and settings reach the harness again. Since
|
|
27
|
+
0.4.0 the credential pusher listed agents without naming the account mesh, so
|
|
28
|
+
every push failed before `setCredentials` and a skill read `needs-setup` as if
|
|
29
|
+
it had no credential. The pusher now lists the account mesh's agents, and
|
|
30
|
+
between accounts pushes the shared scope alone. (#265)
|
|
31
|
+
|
|
32
|
+
## [0.6.0] - 2026-09-28
|
|
33
|
+
|
|
34
|
+
### Added
|
|
35
|
+
|
|
36
|
+
- Loading and unloading a model by hand, for a Models screen. `loadModel` loads
|
|
37
|
+
a downloaded model under the settings of the agent on this device that runs
|
|
38
|
+
it, so that agent's next reply finds it loaded; it never downloads, and returns
|
|
39
|
+
`loaded: false` with `reason: 'memory'` when it would not fit beside what is
|
|
40
|
+
loaded. Chat models loaded this way stay loaded side by side. `unloadModel`
|
|
41
|
+
puts a reply this device is generating with the model back in the queue, and it
|
|
42
|
+
completes once the model has been loaded again. Both bump `modelCatalogWatch`,
|
|
43
|
+
and `isLoaded` in `listModels` is right for chat, embedding, speech and
|
|
44
|
+
transcription models. A harness older than `@qvac/harness` 0.6 refuses both.
|
|
45
|
+
|
|
46
|
+
```js
|
|
47
|
+
const { loaded, reason } = await engine.loadModel({ name: 'Qwen3.5-4B-Q4_K_M' })
|
|
48
|
+
await engine.unloadModel({ name: 'Qwen3.5-4B-Q4_K_M' })
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
(#242)
|
|
52
|
+
|
|
53
|
+
- `previewCustomModel` checks a link or path through the harness before
|
|
54
|
+
anything is added, and returns the resolved link, size, context window,
|
|
55
|
+
architecture, size label, task type, license and fit, a file list for a
|
|
56
|
+
repository with several weights, or a refusal with its reason.
|
|
57
|
+
`customModelsWatch` rows carry `contextLength`, `taskType`, `license` and
|
|
58
|
+
`label`. (#215)
|
|
59
|
+
- An attached PDF's scanned, figure and text-less pages reach a vision model as
|
|
60
|
+
images, at most 10 per message, alongside the PDF as a document. A PDF whose
|
|
61
|
+
pages rendered is no longer reported as unread. Core now depends on
|
|
62
|
+
`bare-pdfium`. (#94)
|
|
63
|
+
- `setModelReleased({ name, released })` and `releasedModels` on the app
|
|
64
|
+
config: the models this device does not fetch ahead of need. (#189)
|
|
65
|
+
|
|
66
|
+
### Changed
|
|
67
|
+
|
|
68
|
+
- A custom model is named by an id derived from its file (`custom:…`), not by
|
|
69
|
+
what the caller typed. `addCustomModel` takes a `label` in place of `name` and
|
|
70
|
+
returns `{ id }`, and `removeCustomModel`, `deleteModel` and an agent's
|
|
71
|
+
`modelName` take that id. `addCustomModel` runs the preview first and rejects
|
|
72
|
+
a refused source, a multi-weight repository or a model that is not a text
|
|
73
|
+
model, storing nothing; with no harness that can preview, it rejects.
|
|
74
|
+
`removeCustomModel` also frees the downloaded copy and answers with the
|
|
75
|
+
`deleteModel` summary in place of `{ ok }`. Needs `@qvac/harness` 0.6. See
|
|
76
|
+
[custom models](docs/api/models.md#custom-models). (#215)
|
|
77
|
+
|
|
78
|
+
```js
|
|
79
|
+
// 0.5.0
|
|
80
|
+
await engine.addCustomModel({ name: 'Qwen3 small', src })
|
|
81
|
+
await engine.removeCustomModel({ name: 'Qwen3 small' })
|
|
82
|
+
// 0.6.0
|
|
83
|
+
const { id } = await engine.addCustomModel({ label: 'Qwen3 small', src })
|
|
84
|
+
await engine.removeCustomModel({ name: id })
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
- `deleteModel` no longer has the model downloaded again straight away. It
|
|
88
|
+
stops an in-flight transfer and releases the model, which is fetched again
|
|
89
|
+
only when a run needs it or on `retryModelDownload`. (#189)
|
|
90
|
+
- `@qvac/harness` 0.6.0, with `@qvac/inference` 0.20.0. (#215)
|
|
91
|
+
- For a host embedding Core, `startOAuthLoopback` is now
|
|
92
|
+
`openOAuthLoopback(port, { credentialKey, state })`, and `waitForCode` no
|
|
93
|
+
longer takes the state. One server per fixed port is shared by every flow
|
|
94
|
+
redirecting to it. (#181)
|
|
95
|
+
|
|
96
|
+
### Fixed
|
|
97
|
+
|
|
98
|
+
- Two OAuth flows landing on the same loopback port superseded each other, so
|
|
99
|
+
sibling skills of one provider could not connect at the same time. A callback
|
|
100
|
+
is now routed to the flow whose `state` it carries. (#181)
|
|
101
|
+
- `networkWatch` and `diagnosticsWatch` logged two churn lines a second on an
|
|
102
|
+
idle device. A sampled watch that wakes with the same answer is no longer
|
|
103
|
+
counted as churn, and a real burst is reported once per window. (#145)
|
|
104
|
+
|
|
16
105
|
## [0.5.0] - 2026-09-26
|
|
17
106
|
|
|
18
107
|
### Added
|
|
@@ -963,7 +1052,9 @@ Published under the `release-0.1` dist-tag.
|
|
|
963
1052
|
await assistant.ready()
|
|
964
1053
|
```
|
|
965
1054
|
|
|
966
|
-
[Unreleased]: https://github.com/tetherto/qvac-core/compare/v0.
|
|
1055
|
+
[Unreleased]: https://github.com/tetherto/qvac-core/compare/v0.6.1...HEAD
|
|
1056
|
+
[0.6.1]: https://github.com/tetherto/qvac-core/compare/v0.6.0...v0.6.1
|
|
1057
|
+
[0.6.0]: https://github.com/tetherto/qvac-core/compare/v0.5.0...v0.6.0
|
|
967
1058
|
[0.5.0]: https://github.com/tetherto/qvac-core/compare/v0.4.1...v0.5.0
|
|
968
1059
|
[0.4.1]: https://github.com/tetherto/qvac-core/compare/v0.4.0...v0.4.1
|
|
969
1060
|
[0.4.0]: https://github.com/tetherto/qvac-core/compare/v0.3.3...v0.4.0
|
|
@@ -32,8 +32,9 @@ export function createAgentsApi(pool, deviceId, computeLender = null) {
|
|
|
32
32
|
getDefaultAgent: async ({ meshId, providerDeviceId }) => {
|
|
33
33
|
const mesh = await requireMesh(pool, meshId);
|
|
34
34
|
const agent = await getDefaultAgent(mesh, providerDeviceId ?? undefined);
|
|
35
|
-
if (!agent)
|
|
35
|
+
if (!agent) {
|
|
36
36
|
return {};
|
|
37
|
+
}
|
|
37
38
|
return { agent: await withOrphaned(mesh, agent) };
|
|
38
39
|
},
|
|
39
40
|
updateAgent: async ({ agentId, meshId, config }) => {
|
|
@@ -44,6 +45,6 @@ export function createAgentsApi(pool, deviceId, computeLender = null) {
|
|
|
44
45
|
const mesh = await requireMesh(pool, meshId);
|
|
45
46
|
return withOrphaned(mesh, await deleteAgent(mesh, deviceId, agentId));
|
|
46
47
|
},
|
|
47
|
-
agentsWatch: meshWatchable(
|
|
48
|
+
agentsWatch: meshWatchable(pool, (request, mesh) => list(mesh, request.providerDeviceId ?? undefined), { name: 'agentsWatch' })
|
|
48
49
|
};
|
|
49
50
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { openLocalStore } from '../core/local/index.ts';
|
|
2
2
|
import type { CapabilityHandlers } from '../../spec/capabilities.d.ts';
|
|
3
3
|
type LocalStore = Awaited<ReturnType<typeof openLocalStore>>;
|
|
4
|
-
export declare function createAppConfigApi(state: LocalStore): Pick<CapabilityHandlers, 'getConfig' | 'setConfig' | 'setModelPaused' | 'configWatchTyped'>;
|
|
4
|
+
export declare function createAppConfigApi(state: LocalStore): Pick<CapabilityHandlers, 'getConfig' | 'setConfig' | 'setModelPaused' | 'setModelReleased' | 'configWatchTyped'>;
|
|
5
5
|
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
1
2
|
import { watchable } from './watchable.js';
|
|
2
3
|
const EMPTY_CAPABILITIES = {
|
|
3
4
|
chat: false,
|
|
@@ -20,14 +21,30 @@ const DEFAULT_CONFIG = {
|
|
|
20
21
|
lastModelName: null,
|
|
21
22
|
onboardingCompleted: false,
|
|
22
23
|
delegation: EMPTY_DELEGATION,
|
|
23
|
-
pausedModels: []
|
|
24
|
+
pausedModels: [],
|
|
25
|
+
releasedModels: []
|
|
24
26
|
};
|
|
27
|
+
const DelegationSchema = z.object({
|
|
28
|
+
enabled: z.boolean().optional(),
|
|
29
|
+
targetDeviceId: z.string().nullish(),
|
|
30
|
+
targetAgentId: z.string().nullish(),
|
|
31
|
+
capabilities: z
|
|
32
|
+
.object({
|
|
33
|
+
chat: z.boolean().optional(),
|
|
34
|
+
transcription: z.boolean().optional(),
|
|
35
|
+
tts: z.boolean().optional(),
|
|
36
|
+
embeddings: z.boolean().optional(),
|
|
37
|
+
knowledge: z.boolean().optional()
|
|
38
|
+
})
|
|
39
|
+
.nullish()
|
|
40
|
+
});
|
|
25
41
|
function normalizeDelegation(raw) {
|
|
26
|
-
|
|
42
|
+
const parsed = DelegationSchema.safeParse(raw);
|
|
43
|
+
if (!parsed.success) {
|
|
27
44
|
return { ...EMPTY_DELEGATION, capabilities: { ...EMPTY_CAPABILITIES } };
|
|
28
45
|
}
|
|
29
|
-
const d =
|
|
30
|
-
const c =
|
|
46
|
+
const d = parsed.data;
|
|
47
|
+
const c = d.capabilities ?? EMPTY_CAPABILITIES;
|
|
31
48
|
return {
|
|
32
49
|
enabled: d.enabled ?? false,
|
|
33
50
|
targetDeviceId: d.targetDeviceId ?? null,
|
|
@@ -42,8 +59,9 @@ function normalizeDelegation(raw) {
|
|
|
42
59
|
};
|
|
43
60
|
}
|
|
44
61
|
function toConfig(row) {
|
|
45
|
-
if (!row)
|
|
62
|
+
if (!row) {
|
|
46
63
|
return { ...DEFAULT_CONFIG, delegation: normalizeDelegation(null) };
|
|
64
|
+
}
|
|
47
65
|
return {
|
|
48
66
|
activeAgentId: row.activeAgentId ?? null,
|
|
49
67
|
activeChatId: row.activeChatId ?? null,
|
|
@@ -52,7 +70,8 @@ function toConfig(row) {
|
|
|
52
70
|
lastModelName: row.lastModelName ?? null,
|
|
53
71
|
onboardingCompleted: row.onboardingCompleted ?? false,
|
|
54
72
|
delegation: normalizeDelegation(row.delegation),
|
|
55
|
-
pausedModels: row.pausedModels ?? []
|
|
73
|
+
pausedModels: row.pausedModels ?? [],
|
|
74
|
+
releasedModels: row.releasedModels ?? []
|
|
56
75
|
};
|
|
57
76
|
}
|
|
58
77
|
function applyWrite(current, update) {
|
|
@@ -64,9 +83,20 @@ function applyWrite(current, update) {
|
|
|
64
83
|
lastModelName: current.lastModelName,
|
|
65
84
|
onboardingCompleted: update.onboardingCompleted ?? false,
|
|
66
85
|
delegation: normalizeDelegation(update.delegation),
|
|
67
|
-
pausedModels: current.pausedModels
|
|
86
|
+
pausedModels: current.pausedModels,
|
|
87
|
+
releasedModels: current.releasedModels
|
|
68
88
|
};
|
|
69
89
|
}
|
|
90
|
+
function toggled(names, name, on) {
|
|
91
|
+
const set = new Set(names);
|
|
92
|
+
if (on) {
|
|
93
|
+
set.add(name);
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
set.delete(name);
|
|
97
|
+
}
|
|
98
|
+
return [...set];
|
|
99
|
+
}
|
|
70
100
|
async function readConfig(state) {
|
|
71
101
|
return toConfig(await state.getAppConfigRow());
|
|
72
102
|
}
|
|
@@ -79,7 +109,8 @@ function toRow(config) {
|
|
|
79
109
|
lastModelName: config.lastModelName,
|
|
80
110
|
onboardingCompleted: config.onboardingCompleted,
|
|
81
111
|
delegation: config.delegation,
|
|
82
|
-
pausedModels: config.pausedModels
|
|
112
|
+
pausedModels: config.pausedModels,
|
|
113
|
+
releasedModels: config.releasedModels
|
|
83
114
|
};
|
|
84
115
|
}
|
|
85
116
|
export function createAppConfigApi(state) {
|
|
@@ -94,15 +125,23 @@ export function createAppConfigApi(state) {
|
|
|
94
125
|
async setModelPaused(input) {
|
|
95
126
|
const row = await state.updateAppConfigRow((current) => {
|
|
96
127
|
const config = toConfig(current);
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
128
|
+
return toRow({
|
|
129
|
+
...config,
|
|
130
|
+
pausedModels: toggled(config.pausedModels ?? [], input.name, input.paused ?? false)
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
return toConfig(row);
|
|
134
|
+
},
|
|
135
|
+
async setModelReleased(input) {
|
|
136
|
+
const row = await state.updateAppConfigRow((current) => {
|
|
137
|
+
const config = toConfig(current);
|
|
138
|
+
return toRow({
|
|
139
|
+
...config,
|
|
140
|
+
releasedModels: toggled(config.releasedModels ?? [], input.name, input.released ?? false)
|
|
141
|
+
});
|
|
103
142
|
});
|
|
104
143
|
return toConfig(row);
|
|
105
144
|
},
|
|
106
|
-
configWatchTyped: watchable(
|
|
145
|
+
configWatchTyped: watchable(() => state, () => readConfig(state), { name: 'configWatchTyped' })
|
|
107
146
|
};
|
|
108
147
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { CapabilityHandlers } from '../../spec/capabilities.d.ts';
|
|
2
2
|
import { type MeshPool } from './current-mesh.ts';
|
|
3
3
|
export { MAX_ATTACHMENT_BYTES } from '../core/files/attachments.ts';
|
|
4
|
-
export
|
|
5
|
-
maxBytes?: number;
|
|
6
|
-
deviceId?: Buffer | null;
|
|
7
|
-
inactivityMs?: number;
|
|
8
|
-
}
|
|
4
|
+
export interface CreateAttachmentsApiOptions {
|
|
5
|
+
readonly maxBytes?: number;
|
|
6
|
+
readonly deviceId?: Buffer | null;
|
|
7
|
+
readonly inactivityMs?: number;
|
|
8
|
+
}
|
|
9
|
+
export declare function createAttachmentsApi(pool: MeshPool, options?: CreateAttachmentsApiOptions): Pick<CapabilityHandlers, 'uploadAttachment' | 'downloadAttachment' | 'deleteAttachment'>;
|
|
@@ -5,10 +5,12 @@ export function createAttachmentsApi(pool, options = {}) {
|
|
|
5
5
|
return {
|
|
6
6
|
async *uploadAttachment(frames) {
|
|
7
7
|
const upload = await openUpload(frames);
|
|
8
|
-
if (!upload)
|
|
8
|
+
if (!upload) {
|
|
9
9
|
return;
|
|
10
|
-
|
|
10
|
+
}
|
|
11
|
+
if (!upload.first.meshId) {
|
|
11
12
|
throw new Error(UPLOAD_NAMES_NO_MESH);
|
|
13
|
+
}
|
|
12
14
|
const mesh = await requireMesh(pool, upload.first.meshId);
|
|
13
15
|
yield* mesh.files.attachments(options).uploadAttachment(upload.rest);
|
|
14
16
|
},
|
|
@@ -3,7 +3,11 @@ import type { openLocalStore } from '../core/local/index.ts';
|
|
|
3
3
|
import { type MeshPool } from './current-mesh.ts';
|
|
4
4
|
type LocalStore = ReturnType<typeof openLocalStore>;
|
|
5
5
|
type ChatCapabilities = Pick<CapabilityHandlers, 'createChat' | 'listChats' | 'getChat' | 'renameChat' | 'setChatRagEnabled' | 'setChatWebSearchEnabled' | 'deleteChat' | 'chatsWatch' | 'listChatActivity' | 'chatActivityWatch' | 'searchChats'>;
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
export interface CreateChatApiOptions {
|
|
7
|
+
readonly deviceId: Buffer | null;
|
|
8
|
+
readonly inferenceCalls?: {
|
|
9
|
+
forget(chatId: string): Promise<void>;
|
|
10
|
+
} | null;
|
|
11
|
+
}
|
|
12
|
+
export declare function createChatApi(pool: MeshPool, local: LocalStore, { deviceId, inferenceCalls }: CreateChatApiOptions): ChatCapabilities;
|
|
9
13
|
export {};
|
package/dist-lib/lib/api/chat.js
CHANGED
|
@@ -5,7 +5,7 @@ import { listChatPage } from '../core/chat-order.js';
|
|
|
5
5
|
import { searchChats } from '../core/chat-search.js';
|
|
6
6
|
import { meshWatchable, requireMesh } from './current-mesh.js';
|
|
7
7
|
const SEARCH_SUPERSEDED_ABORT = 'superseded by a newer chat search';
|
|
8
|
-
export function createChatApi(pool,
|
|
8
|
+
export function createChatApi(pool, local, { deviceId, inferenceCalls = null }) {
|
|
9
9
|
let searchAbort = null;
|
|
10
10
|
const chatList = (mesh, { limit, cursor }) => listChatPage(mesh, local, { limit: limit || undefined, cursor: cursor ?? undefined });
|
|
11
11
|
const chatActivity = (mesh, chatIds) => listChatActivity(mesh, chatIds ?? undefined).then((activities) => ({ activities }));
|
|
@@ -14,16 +14,16 @@ export function createChatApi(pool, deviceId, local, inferenceCalls = null) {
|
|
|
14
14
|
listChats: async (request) => chatList(await requireMesh(pool, request.meshId), request),
|
|
15
15
|
getChat: async ({ chatId, meshId }) => mustGetActiveChatListing(await requireMesh(pool, meshId), chatId),
|
|
16
16
|
renameChat: async ({ chatId, meshId, config }) => renameChat(await requireMesh(pool, meshId), chatId, config.title),
|
|
17
|
-
setChatRagEnabled: async ({ chatId, enabled, meshId }) => setChatRagEnabled(await requireMesh(pool, meshId), chatId, enabled ?? false),
|
|
17
|
+
setChatRagEnabled: async ({ chatId, enabled, meshId }) => setChatRagEnabled(await requireMesh(pool, meshId), chatId, { ragEnabled: enabled ?? false }),
|
|
18
18
|
setChatWebSearchEnabled: async ({ chatId, enabled, meshId }) => setChatWebSearchEnabled(await requireMesh(pool, meshId), chatId, enabled ?? false),
|
|
19
19
|
deleteChat: async ({ chatId, meshId }) => {
|
|
20
20
|
const deleted = await deleteChat(await requireMesh(pool, meshId), deviceId, chatId);
|
|
21
21
|
await inferenceCalls?.forget(chatId);
|
|
22
22
|
return deleted;
|
|
23
23
|
},
|
|
24
|
-
chatsWatch: meshWatchable(
|
|
24
|
+
chatsWatch: meshWatchable(pool, (request, store) => chatList(store, request), { name: 'chatsWatch', changes: local }),
|
|
25
25
|
listChatActivity: async (input) => chatActivity(await requireMesh(pool, input.meshId), input.chatIds),
|
|
26
|
-
chatActivityWatch: meshWatchable(
|
|
26
|
+
chatActivityWatch: meshWatchable(pool, (request, store) => chatActivity(store, request.chatIds), { name: 'chatActivityWatch' }),
|
|
27
27
|
searchChats: async (input) => {
|
|
28
28
|
searchAbort?.abort(SEARCH_SUPERSEDED_ABORT);
|
|
29
29
|
const controller = new AbortController();
|
|
@@ -31,10 +31,10 @@ export function createChunksApi(pool, deviceId) {
|
|
|
31
31
|
});
|
|
32
32
|
return { chunks: await recordLinks(mesh, chunks) };
|
|
33
33
|
},
|
|
34
|
-
chunksWatch: meshWatchable(
|
|
34
|
+
chunksWatch: meshWatchable(pool, async ({ meshId, ...input }, mesh) => ({
|
|
35
35
|
chunks: await recordLinks(mesh, await listChunks(mesh, chunkSelection(input)))
|
|
36
|
-
})),
|
|
37
|
-
runRequestsWatch: meshWatchable(
|
|
36
|
+
}), { name: 'chunksWatch' }),
|
|
37
|
+
runRequestsWatch: meshWatchable(pool, async (_request, mesh) => ({ chunks: await listRunRequests(mesh, deviceId) }), { name: 'runRequestsWatch' })
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
40
|
function chunkSelection({ chatId, type, types, ...rest }) {
|
|
@@ -8,8 +8,8 @@ export function createConfigApi(state) {
|
|
|
8
8
|
await state.set(key, value);
|
|
9
9
|
return { ok: true };
|
|
10
10
|
},
|
|
11
|
-
configWatch: watchable(
|
|
11
|
+
configWatch: watchable(() => state, async ({ key }) => ({
|
|
12
12
|
value: await state.get(key)
|
|
13
|
-
}))
|
|
13
|
+
}), { name: 'configWatch' })
|
|
14
14
|
};
|
|
15
15
|
}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
+
import type { Readable } from 'streamx';
|
|
1
2
|
import type { Mesh } from '../core/mesh.ts';
|
|
3
|
+
import { type WatchableOptions } from './watchable.ts';
|
|
2
4
|
export type MeshPool = (meshId: string) => Mesh | null | Promise<Mesh | null>;
|
|
3
5
|
export declare const NO_SUCH_MESH = "no such mesh";
|
|
4
6
|
export declare function requireMesh(pool: MeshPool, meshId: string): Promise<Mesh>;
|
|
5
7
|
export declare function isMissingMesh(err: unknown): boolean;
|
|
6
|
-
export declare function meshWatchable<TRequest extends MeshScoped, TResult>(
|
|
7
|
-
watch(listener: () => void): void;
|
|
8
|
-
unwatch(listener: () => void): void;
|
|
9
|
-
}): (request: TRequest) => import("streamx").Readable<import("streamx").ReadableEvents> & AsyncIterable<TResult>;
|
|
8
|
+
export declare function meshWatchable<TRequest extends MeshScoped, TResult>(pool: MeshPool, query: (request: TRequest, mesh: Mesh) => Promise<TResult>, { name, changes }: WatchableOptions): (request: TRequest) => Readable & AsyncIterable<TResult>;
|
|
10
9
|
interface MeshScoped {
|
|
11
10
|
readonly meshId: string;
|
|
12
11
|
}
|
|
@@ -2,15 +2,20 @@ import { watchable } from './watchable.js';
|
|
|
2
2
|
export const NO_SUCH_MESH = 'no such mesh';
|
|
3
3
|
export async function requireMesh(pool, meshId) {
|
|
4
4
|
const mesh = await pool(meshId);
|
|
5
|
-
if (!mesh)
|
|
5
|
+
if (!mesh) {
|
|
6
6
|
throw new Error(`${NO_SUCH_MESH}: ${meshId}`);
|
|
7
|
-
|
|
7
|
+
}
|
|
8
|
+
if (!mesh.opened) {
|
|
8
9
|
await mesh.ready();
|
|
10
|
+
}
|
|
9
11
|
return mesh;
|
|
10
12
|
}
|
|
11
13
|
export function isMissingMesh(err) {
|
|
12
14
|
return err instanceof Error && err.message.startsWith(`${NO_SUCH_MESH}: `);
|
|
13
15
|
}
|
|
14
|
-
export function meshWatchable(
|
|
15
|
-
return watchable(
|
|
16
|
+
export function meshWatchable(pool, query, { name, changes }) {
|
|
17
|
+
return watchable((request) => requireMesh(pool, request.meshId), query, {
|
|
18
|
+
name,
|
|
19
|
+
changes
|
|
20
|
+
});
|
|
16
21
|
}
|
|
@@ -1,5 +1,12 @@
|
|
|
1
|
+
import type { AssistantCustomModelPreview, AssistantDeleteModelResponse, AssistantPreviewCustomModelRequest } from '../../spec/hyperschema/types.d.ts';
|
|
1
2
|
import type { openLocalStore } from '../core/local/index.ts';
|
|
2
3
|
import type { CapabilityHandlers } from '../../spec/capabilities.d.ts';
|
|
3
4
|
type LocalStore = Awaited<ReturnType<typeof openLocalStore>>;
|
|
4
|
-
export declare
|
|
5
|
+
export declare const CUSTOM_MODEL_ID_PREFIX = "custom:";
|
|
6
|
+
export declare function customModelId(src: string): string;
|
|
7
|
+
export type CustomModelFileDelete = (request: {
|
|
8
|
+
name: string;
|
|
9
|
+
}) => Promise<AssistantDeleteModelResponse>;
|
|
10
|
+
export type CustomModelPreviewSource = (request: AssistantPreviewCustomModelRequest) => Promise<AssistantCustomModelPreview>;
|
|
11
|
+
export declare function createCustomModelApi(state: LocalStore, preview: CustomModelPreviewSource | null, deleteFiles?: CustomModelFileDelete | null): Pick<CapabilityHandlers, 'customModelsWatch' | 'addCustomModel' | 'removeCustomModel' | 'previewCustomModel'>;
|
|
5
12
|
export {};
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
+
import b4a from 'b4a';
|
|
2
|
+
import crypto from 'hypercore-crypto';
|
|
1
3
|
import { watchable } from './watchable.js';
|
|
2
|
-
import {
|
|
4
|
+
import { customModelTaskRefusal } from '../custom-model-task.js';
|
|
5
|
+
export const CUSTOM_MODEL_ID_PREFIX = 'custom:';
|
|
6
|
+
export function customModelId(src) {
|
|
7
|
+
return CUSTOM_MODEL_ID_PREFIX + b4a.toHex(crypto.hash(b4a.from(src))).slice(0, 12);
|
|
8
|
+
}
|
|
3
9
|
async function readCustomModels(state) {
|
|
4
10
|
const rows = await state.getCustomModelRows();
|
|
5
11
|
return {
|
|
@@ -11,35 +17,66 @@ async function readCustomModels(state) {
|
|
|
11
17
|
supportsThinking: row.supportsThinking ?? false,
|
|
12
18
|
supportsVision: row.supportsVision ?? false,
|
|
13
19
|
expectedSize: row.expectedSize ?? 0,
|
|
14
|
-
createdAt: row.createdAt
|
|
20
|
+
createdAt: row.createdAt,
|
|
21
|
+
contextLength: row.contextLength ?? 0,
|
|
22
|
+
taskType: row.taskType ?? null,
|
|
23
|
+
license: row.license ?? null,
|
|
24
|
+
label: row.label || row.name
|
|
15
25
|
}))
|
|
16
26
|
};
|
|
17
27
|
}
|
|
18
|
-
export function createCustomModelApi(state) {
|
|
28
|
+
export function createCustomModelApi(state, preview, deleteFiles = null) {
|
|
29
|
+
const previewSource = async (request) => {
|
|
30
|
+
if (!preview)
|
|
31
|
+
throw new Error('no model source preview bound');
|
|
32
|
+
return await preview(request);
|
|
33
|
+
};
|
|
19
34
|
return {
|
|
20
|
-
customModelsWatch: watchable(
|
|
35
|
+
customModelsWatch: watchable(() => state, () => readCustomModels(state), { name: 'customModelsWatch' }),
|
|
36
|
+
previewCustomModel: previewSource,
|
|
21
37
|
addCustomModel: async (input) => {
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
38
|
+
const checked = await previewSource({ src: input.src, mmprojSrc: input.mmprojSrc });
|
|
39
|
+
if (!checked.ok) {
|
|
40
|
+
throw new Error(checked.reason || 'The model source was refused.');
|
|
41
|
+
}
|
|
42
|
+
if (!checked.src) {
|
|
43
|
+
throw new Error('This repository holds several models; add one of its files.');
|
|
44
|
+
}
|
|
45
|
+
const unrunnable = customModelTaskRefusal(checked.taskType);
|
|
46
|
+
if (unrunnable) {
|
|
47
|
+
throw new Error(unrunnable);
|
|
48
|
+
}
|
|
49
|
+
const id = customModelId(checked.src);
|
|
50
|
+
const label = input.label.trim();
|
|
51
|
+
const taken = (await state.getCustomModelRows()).find((row) => (row.label || row.name) === label && row.name !== id);
|
|
52
|
+
if (taken) {
|
|
53
|
+
throw new Error(`${label} is already the name of another model you added.`);
|
|
54
|
+
}
|
|
27
55
|
const row = {
|
|
28
|
-
name:
|
|
29
|
-
|
|
30
|
-
|
|
56
|
+
name: id,
|
|
57
|
+
label,
|
|
58
|
+
src: checked.src,
|
|
59
|
+
mmprojSrc: checked.mmprojSrc ?? null,
|
|
31
60
|
supportsTools: input.supportsTools ?? false,
|
|
32
61
|
supportsThinking: input.supportsThinking ?? false,
|
|
33
62
|
supportsVision: input.supportsVision ?? false,
|
|
34
|
-
expectedSize
|
|
35
|
-
|
|
63
|
+
expectedSize: input.expectedSize && input.expectedSize > 0
|
|
64
|
+
? input.expectedSize
|
|
65
|
+
: (checked.sizeBytes ?? 0),
|
|
66
|
+
createdAt: Date.now(),
|
|
67
|
+
contextLength: checked.contextLength ?? 0,
|
|
68
|
+
taskType: checked.taskType ?? null,
|
|
69
|
+
license: checked.license ?? null
|
|
36
70
|
};
|
|
37
71
|
await state.putCustomModelRow(row);
|
|
38
|
-
return {
|
|
72
|
+
return { id };
|
|
39
73
|
},
|
|
40
74
|
removeCustomModel: async ({ name }) => {
|
|
75
|
+
const rows = await state.getCustomModelRows();
|
|
76
|
+
const custom = rows.some((row) => row.name === name);
|
|
77
|
+
const freed = deleteFiles && custom ? await deleteFiles({ name }) : { name, removed: 0, freedBytes: 0 };
|
|
41
78
|
await state.deleteCustomModelRow(name);
|
|
42
|
-
return
|
|
79
|
+
return freed;
|
|
43
80
|
}
|
|
44
81
|
};
|
|
45
82
|
}
|
|
@@ -2,8 +2,17 @@ import type { AssistantCapabilityProfile } from '../../spec/hyperschema/types.d.
|
|
|
2
2
|
import type { Mesh } from '../core/mesh.ts';
|
|
3
3
|
import { type MeshPool } from './current-mesh.ts';
|
|
4
4
|
import type { CapabilityHandlers } from '../../spec/capabilities.d.ts';
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
export interface CreateDevicesApiOptions {
|
|
6
|
+
readonly deviceId: Buffer;
|
|
7
|
+
readonly removeWriter: (writerKey: Buffer, deviceId: Buffer, mesh: Mesh) => Promise<void>;
|
|
8
|
+
readonly renameLocal: (name: string) => Promise<void>;
|
|
9
|
+
readonly saveProfileLocal: (capabilityProfile: AssistantCapabilityProfile, recommendedModelName: string, platform?: string) => Promise<void>;
|
|
10
|
+
readonly readLocalProfile: () => {
|
|
11
|
+
capabilityProfile: AssistantCapabilityProfile;
|
|
12
|
+
recommendedModelName: string;
|
|
13
|
+
platform?: string;
|
|
14
|
+
} | null;
|
|
15
|
+
readonly isAccount: (mesh: Mesh) => boolean;
|
|
16
|
+
readonly computeLender?: (() => Promise<Buffer | null>) | null;
|
|
17
|
+
}
|
|
18
|
+
export declare function createDevicesApi(pool: MeshPool, { deviceId, removeWriter, renameLocal, saveProfileLocal, readLocalProfile, isAccount, computeLender }: CreateDevicesApiOptions): Pick<CapabilityHandlers, 'listDevices' | 'getDevice' | 'devicesWatch' | 'deviceInfo' | 'saveDeviceCapabilities' | 'saveDeviceProfile' | 'removeDevice' | 'renameDevice'>;
|
|
@@ -2,7 +2,7 @@ import { MAX_DEVICE_NAME_CHARS, deviceNameWithinBounds } from '../../schema/qvac
|
|
|
2
2
|
import { saveDeviceCapabilities } from '../core/devices.js';
|
|
3
3
|
import { meshWatchable, requireMesh } from './current-mesh.js';
|
|
4
4
|
import b4a from 'b4a';
|
|
5
|
-
|
|
5
|
+
import { DEVICES } from '../core/collections.js';
|
|
6
6
|
function toEngineDevice(device, overrides = {}) {
|
|
7
7
|
return {
|
|
8
8
|
id: device.id,
|
|
@@ -25,13 +25,14 @@ function toEngineDevice(device, overrides = {}) {
|
|
|
25
25
|
...overrides
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
|
-
export function createDevicesApi(pool, deviceId, removeWriter, renameLocal, saveProfileLocal, readLocalProfile, isAccount, computeLender = null) {
|
|
28
|
+
export function createDevicesApi(pool, { deviceId, removeWriter, renameLocal, saveProfileLocal, readLocalProfile, isAccount, computeLender = null }) {
|
|
29
29
|
const mustGetDevice = async (mesh, id) => {
|
|
30
30
|
const snap = mesh.view.snapshot();
|
|
31
31
|
try {
|
|
32
32
|
const device = await snap.get(DEVICES, { id });
|
|
33
|
-
if (!device)
|
|
33
|
+
if (!device) {
|
|
34
34
|
throw new Error(`device not found: ${b4a.toHex(id)}`);
|
|
35
|
+
}
|
|
35
36
|
return device;
|
|
36
37
|
}
|
|
37
38
|
finally {
|
|
@@ -51,7 +52,7 @@ export function createDevicesApi(pool, deviceId, removeWriter, renameLocal, save
|
|
|
51
52
|
return {
|
|
52
53
|
listDevices: async (request) => list(await requireMesh(pool, request.meshId)),
|
|
53
54
|
getDevice: async ({ deviceId: id, meshId }) => toEngineDevice(await mustGetDevice(await requireMesh(pool, meshId), id)),
|
|
54
|
-
devicesWatch: meshWatchable(
|
|
55
|
+
devicesWatch: meshWatchable(pool, (_request, mesh) => list(mesh), { name: 'devicesWatch' }),
|
|
55
56
|
deviceInfo: async () => {
|
|
56
57
|
logger.info(['api', 'devices'], 'deviceInfo handler reached');
|
|
57
58
|
const computeLenderId = (await computeLender?.()) ?? undefined;
|
|
@@ -70,21 +71,25 @@ export function createDevicesApi(pool, deviceId, removeWriter, renameLocal, save
|
|
|
70
71
|
return { ok: true };
|
|
71
72
|
},
|
|
72
73
|
removeDevice: async ({ deviceId: target, meshId }) => {
|
|
73
|
-
if (
|
|
74
|
+
if (b4a.equals(target, deviceId)) {
|
|
74
75
|
throw new Error('cannot remove own device, use leaveMesh');
|
|
76
|
+
}
|
|
75
77
|
const mesh = await requireMesh(pool, meshId);
|
|
76
78
|
const device = await mustGetDevice(mesh, target);
|
|
77
|
-
if (device.revoked)
|
|
79
|
+
if (device.revoked) {
|
|
78
80
|
return { ok: true };
|
|
79
|
-
|
|
81
|
+
}
|
|
82
|
+
if (!device.writerKey) {
|
|
80
83
|
throw new Error('device has no writer key, cannot remove');
|
|
84
|
+
}
|
|
81
85
|
await removeWriter(device.writerKey, target, mesh);
|
|
82
86
|
return { ok: true };
|
|
83
87
|
},
|
|
84
88
|
renameDevice: async ({ meshId, config }) => {
|
|
85
89
|
const trimmed = config.name.trim();
|
|
86
|
-
if (!trimmed)
|
|
90
|
+
if (!trimmed) {
|
|
87
91
|
throw new Error('device name must not be empty');
|
|
92
|
+
}
|
|
88
93
|
if (!deviceNameWithinBounds(trimmed)) {
|
|
89
94
|
throw new Error(`device name must be at most ${MAX_DEVICE_NAME_CHARS} characters`);
|
|
90
95
|
}
|
|
@@ -3,5 +3,6 @@ export interface DiagnosticsSource {
|
|
|
3
3
|
watch(listener: () => void): void;
|
|
4
4
|
unwatch(listener: () => void): void;
|
|
5
5
|
snapshot(): Record<string, unknown>;
|
|
6
|
+
readonly sampled: true;
|
|
6
7
|
}
|
|
7
8
|
export declare function createDiagnosticsApi(source: DiagnosticsSource): Pick<CapabilityHandlers, 'diagnostics' | 'diagnosticsWatch'>;
|
|
@@ -2,6 +2,6 @@ import { watchable } from './watchable.js';
|
|
|
2
2
|
export function createDiagnosticsApi(source) {
|
|
3
3
|
return {
|
|
4
4
|
diagnostics: async () => ({ stats: source.snapshot() }),
|
|
5
|
-
diagnosticsWatch: watchable(
|
|
5
|
+
diagnosticsWatch: watchable(() => source, async () => ({ stats: source.snapshot() }), { name: 'diagnosticsWatch' })
|
|
6
6
|
};
|
|
7
7
|
}
|
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
import type { QvacAgent } from '../../spec/mesh/hyperschema/types.d.ts';
|
|
2
|
-
|
|
2
|
+
import { type ModelContextOptions } from '../model-context.ts';
|
|
3
|
+
export interface EffectiveCtxSizeOptions extends ModelContextOptions {
|
|
4
|
+
readonly appCtxSize: number;
|
|
5
|
+
readonly platform: string | null;
|
|
6
|
+
}
|
|
7
|
+
export declare function effectiveCtxSize(agent: Pick<QvacAgent, 'ctxSize' | 'modelName'> | null, opts: EffectiveCtxSizeOptions): number;
|