@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/dist-lib/lib/task.js
CHANGED
|
@@ -16,20 +16,22 @@ export async function runTask(engine, request) {
|
|
|
16
16
|
for await (const frame of engine.chunksWatch({ chatId, meshId })) {
|
|
17
17
|
const chunks = frame.chunks ?? [];
|
|
18
18
|
const state = terminalState(chunks, runId);
|
|
19
|
-
if (state)
|
|
20
|
-
return collect(chatId, runId, state
|
|
19
|
+
if (state) {
|
|
20
|
+
return collect(chunks, { chatId, runId, state });
|
|
21
|
+
}
|
|
21
22
|
}
|
|
22
23
|
throw new Error(`chunk stream ended before the run settled: ${chatId}`);
|
|
23
24
|
}
|
|
24
25
|
function terminalState(chunks, runId) {
|
|
25
26
|
for (const chunk of chunks) {
|
|
26
27
|
const state = chunk.runId === runId ? chunk.runStatus?.state : undefined;
|
|
27
|
-
if (state && TERMINAL_STATES.has(state))
|
|
28
|
+
if (state && TERMINAL_STATES.has(state)) {
|
|
28
29
|
return state;
|
|
30
|
+
}
|
|
29
31
|
}
|
|
30
32
|
return null;
|
|
31
33
|
}
|
|
32
|
-
function collect(chatId, runId, state
|
|
34
|
+
function collect(all, { chatId, runId, state }) {
|
|
33
35
|
const chunks = all.filter((chunk) => chunk.runId === runId);
|
|
34
36
|
const text = [];
|
|
35
37
|
const thinking = [];
|
|
@@ -40,22 +42,30 @@ function collect(chatId, runId, state, all) {
|
|
|
40
42
|
let metrics = null;
|
|
41
43
|
for (const chunk of chunks) {
|
|
42
44
|
const call = chunk.toolCall;
|
|
43
|
-
if (chunk.type === 'tool-result')
|
|
45
|
+
if (chunk.type === 'tool-result') {
|
|
44
46
|
text.length = 0;
|
|
45
|
-
|
|
47
|
+
}
|
|
48
|
+
if (chunk.content) {
|
|
46
49
|
text.push(chunk.content.text);
|
|
47
|
-
|
|
50
|
+
}
|
|
51
|
+
if (chunk.thinking) {
|
|
48
52
|
thinking.push(chunk.thinking.text);
|
|
49
|
-
|
|
53
|
+
}
|
|
54
|
+
if (call) {
|
|
50
55
|
toolCalls.push({ name: call.name, arguments: call.arguments });
|
|
51
|
-
|
|
56
|
+
}
|
|
57
|
+
if (chunk.attachment && !chunk.attachment.deletedAt) {
|
|
52
58
|
attachments.push(chunk.attachment);
|
|
53
|
-
|
|
59
|
+
}
|
|
60
|
+
if (chunk.sources) {
|
|
54
61
|
sources.push(...chunk.sources.sources);
|
|
55
|
-
|
|
62
|
+
}
|
|
63
|
+
if (chunk.runStatus?.reason) {
|
|
56
64
|
reason = chunk.runStatus.reason;
|
|
57
|
-
|
|
65
|
+
}
|
|
66
|
+
if (chunk.runStatus?.metrics) {
|
|
58
67
|
metrics = chunk.runStatus.metrics;
|
|
68
|
+
}
|
|
59
69
|
}
|
|
60
70
|
return {
|
|
61
71
|
chatId,
|
package/dist-lib/lib/unref.d.ts
CHANGED
package/dist-lib/lib/unref.js
CHANGED
|
@@ -4,8 +4,9 @@ const RIFF_HEADER_BYTES = 12;
|
|
|
4
4
|
const CHUNK_HEADER_BYTES = 8;
|
|
5
5
|
function ascii(bytes, start, end) {
|
|
6
6
|
let out = '';
|
|
7
|
-
for (let i = start; i < end; i++)
|
|
7
|
+
for (let i = start; i < end; i++) {
|
|
8
8
|
out += String.fromCharCode(bytes[i] ?? 0);
|
|
9
|
+
}
|
|
9
10
|
return out;
|
|
10
11
|
}
|
|
11
12
|
function readWavHeader(head) {
|
|
@@ -37,16 +38,20 @@ function readWavHeader(head) {
|
|
|
37
38
|
}
|
|
38
39
|
export function wavDurationSeconds(head, totalBytes) {
|
|
39
40
|
const header = readWavHeader(head);
|
|
40
|
-
if (!header)
|
|
41
|
+
if (!header) {
|
|
41
42
|
return null;
|
|
42
|
-
|
|
43
|
+
}
|
|
44
|
+
if (header.format !== WAV_FORMAT_PCM && header.format !== WAV_FORMAT_IEEE_FLOAT) {
|
|
43
45
|
return null;
|
|
46
|
+
}
|
|
44
47
|
const frameBytes = header.channels * (header.bitsPerSample / 8);
|
|
45
|
-
if (!(frameBytes > 0) || !(header.sampleRate > 0))
|
|
48
|
+
if (!(frameBytes > 0) || !(header.sampleRate > 0)) {
|
|
46
49
|
return null;
|
|
50
|
+
}
|
|
47
51
|
const available = totalBytes - header.dataStart;
|
|
48
|
-
if (!(available > 0))
|
|
52
|
+
if (!(available > 0)) {
|
|
49
53
|
return null;
|
|
54
|
+
}
|
|
50
55
|
const dataBytes = header.dataSize > 0 && header.dataSize <= available ? header.dataSize : available;
|
|
51
56
|
const seconds = dataBytes / (header.sampleRate * frameBytes);
|
|
52
57
|
return Number.isFinite(seconds) && seconds > 0 ? seconds : null;
|
|
@@ -7,16 +7,17 @@ export interface WriteQueueOptions {
|
|
|
7
7
|
afterMs: number;
|
|
8
8
|
}) => void;
|
|
9
9
|
}
|
|
10
|
+
export interface PendingScope {
|
|
11
|
+
readonly scope: string;
|
|
12
|
+
readonly waiting: number;
|
|
13
|
+
}
|
|
10
14
|
export declare class WriteQueue {
|
|
11
15
|
private readonly _scopes;
|
|
12
16
|
private readonly _slowMs;
|
|
13
17
|
private readonly _onSlow;
|
|
14
18
|
constructor({ slowMs, onSlow }?: WriteQueueOptions);
|
|
15
19
|
run<T>(name: string, write: string, task: () => Promise<T>): Promise<T>;
|
|
16
|
-
pending(): Array<
|
|
17
|
-
scope: string;
|
|
18
|
-
waiting: number;
|
|
19
|
-
}>;
|
|
20
|
+
pending(): Array<PendingScope>;
|
|
20
21
|
private _enter;
|
|
21
22
|
private _leave;
|
|
22
23
|
}
|
package/dist-lib/schema/build.js
CHANGED
|
@@ -79,14 +79,14 @@ registerLocalTypes(localSchema.namespace('local'));
|
|
|
79
79
|
Hyperschema.toDisk(localSchema, { esm: true });
|
|
80
80
|
HyperschemaTS.toDisk(localSchema);
|
|
81
81
|
const db = HyperDB.from(LOCAL_SCHEMA_DIR, LOCAL_DB_DIR);
|
|
82
|
-
registerLocalCollections(db.namespace('local'), path.join(dir, '
|
|
82
|
+
registerLocalCollections(db.namespace('local'), path.join(dir, 'indexes.js'));
|
|
83
83
|
HyperDB.toDisk(db, { esm: true });
|
|
84
84
|
const meshSchema = Hyperschema.from(MESH_SCHEMA_DIR);
|
|
85
85
|
registerQvacTypes(meshSchema.namespace('qvac'));
|
|
86
86
|
Hyperschema.toDisk(meshSchema, { esm: true });
|
|
87
87
|
HyperschemaTS.toDisk(meshSchema);
|
|
88
88
|
const meshDb = HyperDB.from(MESH_SCHEMA_DIR, MESH_DB_DIR);
|
|
89
|
-
registerQvacCollections(meshDb.namespace('qvac'), path.join(dir, '
|
|
89
|
+
registerQvacCollections(meshDb.namespace('qvac'), path.join(dir, 'indexes.js'));
|
|
90
90
|
HyperDB.toDisk(meshDb, { esm: true });
|
|
91
91
|
const dispatch = Hyperdispatch.from(MESH_SCHEMA_DIR, MESH_DISPATCH_DIR);
|
|
92
92
|
registerQvacDispatch(dispatch.namespace('qvac'));
|
|
@@ -99,18 +99,21 @@ config.setProduction('@conf/config', { minSupportedVersion: VENDORED_MIN_SUPPORT
|
|
|
99
99
|
Hyperconf.toDisk(config);
|
|
100
100
|
fs.writeFileSync(path.join(CONFIG_CONF_DIR, 'package.json'), `${JSON.stringify({ type: 'commonjs' }, null, 2)}\n`);
|
|
101
101
|
writeConfigTypes(path.join(CONFIG_CONF_DIR, 'index.d.ts'));
|
|
102
|
-
for (const file of [MESH_DISPATCH_JSON, MESH_DB_JSON, LOCAL_DB_JSON])
|
|
102
|
+
for (const file of [MESH_DISPATCH_JSON, MESH_DB_JSON, LOCAL_DB_JSON]) {
|
|
103
103
|
assertUniqueIds(file);
|
|
104
|
+
}
|
|
104
105
|
try {
|
|
105
106
|
for (const tag of baselines) {
|
|
106
107
|
regen.validate(MESH_DB_JSON, LOCAL_DB_JSON, MESH_DISPATCH_JSON, { tag });
|
|
107
108
|
}
|
|
108
|
-
if (baselines.length > 0)
|
|
109
|
+
if (baselines.length > 0) {
|
|
109
110
|
assertFieldOrder(ROOT, MESH_SCHEMA_JSON, baselines);
|
|
111
|
+
}
|
|
110
112
|
}
|
|
111
113
|
finally {
|
|
112
|
-
if (rewound.length > 0)
|
|
114
|
+
if (rewound.length > 0) {
|
|
113
115
|
unstageSpec(ROOT, BASELINE_DIRS);
|
|
116
|
+
}
|
|
114
117
|
}
|
|
115
118
|
console.log('assistant schema + hrpc + bind + client + local + mesh hyperdb generated under spec/');
|
|
116
119
|
function assertUniqueIds(file) {
|
|
@@ -118,8 +121,9 @@ function assertUniqueIds(file) {
|
|
|
118
121
|
const byId = new Map();
|
|
119
122
|
for (const { id, name } of schema) {
|
|
120
123
|
const clash = byId.get(id);
|
|
121
|
-
if (clash)
|
|
124
|
+
if (clash) {
|
|
122
125
|
throw new Error(`${path.basename(file)}: id ${id} is on both ${clash} and ${name}`);
|
|
126
|
+
}
|
|
123
127
|
byId.set(id, name);
|
|
124
128
|
}
|
|
125
129
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
}): void;
|
|
1
|
+
import type { Registry } from './content.ts';
|
|
2
|
+
export declare function registerConfigTypes(ns: Registry): void;
|
|
4
3
|
export declare const VENDORED_MIN_SUPPORTED_VERSION = ">=0.19.0";
|
|
@@ -17,5 +17,20 @@ export declare const CHUNK_PAYLOAD_FIELDS: {
|
|
|
17
17
|
};
|
|
18
18
|
export type ChunkType = keyof typeof CHUNK_PAYLOAD_FIELDS;
|
|
19
19
|
export type ChunkPayloadField = (typeof CHUNK_PAYLOAD_FIELDS)[ChunkType];
|
|
20
|
-
export
|
|
21
|
-
|
|
20
|
+
export interface Registry {
|
|
21
|
+
register(definition: object): void;
|
|
22
|
+
}
|
|
23
|
+
export interface CollectionRegistry {
|
|
24
|
+
require(helpersPath: string): void;
|
|
25
|
+
readonly collections: Registry;
|
|
26
|
+
readonly indexes: Registry;
|
|
27
|
+
}
|
|
28
|
+
export interface Field {
|
|
29
|
+
readonly name: string;
|
|
30
|
+
readonly type: string;
|
|
31
|
+
readonly required?: boolean;
|
|
32
|
+
readonly array?: boolean;
|
|
33
|
+
readonly useDefault?: boolean;
|
|
34
|
+
}
|
|
35
|
+
export declare function versionedRegistrar(ns: Registry, namespace: string): (name: string, fields: ReadonlyArray<Field>) => void;
|
|
36
|
+
export declare function registerContentTypes(ns: Registry, namespace: string): void;
|
|
@@ -100,8 +100,9 @@ export function registerContentTypes(ns, namespace) {
|
|
|
100
100
|
{ name: 'createdAt', type: 'uint', required: true },
|
|
101
101
|
{ name: 'deletedAt', type: 'uint' }
|
|
102
102
|
];
|
|
103
|
-
if (namespace === 'assistant')
|
|
103
|
+
if (namespace === 'assistant') {
|
|
104
104
|
attachment.push({ name: 'url', type: 'string' });
|
|
105
|
+
}
|
|
105
106
|
versioned('chunk-content-attachment', attachment);
|
|
106
107
|
versioned('chunk-content-run-request', [{ name: 'agentId', type: 'string', required: true }]);
|
|
107
108
|
versioned('chunk-content-compaction', [
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function
|
|
1
|
+
import { type Registry } from './content.ts';
|
|
2
|
+
export declare function registerEngineTypes(ns: Registry): void;
|
|
3
|
+
export declare function registerEngineApi(api: Registry): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { registerContentTypes, versionedRegistrar } from './content.js';
|
|
2
|
-
import { MEDIA_KINDS } from './
|
|
2
|
+
import { MEDIA_KINDS } from './media-kind.js';
|
|
3
3
|
import { APP_CHANNELS, CAPABILITY_PROFILES, INDEXING_STATES } from './qvac.js';
|
|
4
4
|
const rangeBounds = () => [
|
|
5
5
|
{ name: 'gt', type: 'uint' },
|
|
@@ -1018,7 +1018,8 @@ export function registerEngineTypes(ns) {
|
|
|
1018
1018
|
{ name: 'lastModelName', type: 'string' },
|
|
1019
1019
|
{ name: 'onboardingCompleted', type: 'bool', required: true },
|
|
1020
1020
|
{ name: 'delegation', type: '@assistant/delegation', required: true },
|
|
1021
|
-
{ name: 'pausedModels', type: 'string', array: true }
|
|
1021
|
+
{ name: 'pausedModels', type: 'string', array: true },
|
|
1022
|
+
{ name: 'releasedModels', type: 'string', array: true }
|
|
1022
1023
|
]
|
|
1023
1024
|
});
|
|
1024
1025
|
ns.register({
|
|
@@ -1039,6 +1040,13 @@ export function registerEngineTypes(ns) {
|
|
|
1039
1040
|
{ name: 'paused', type: 'bool', required: true }
|
|
1040
1041
|
]
|
|
1041
1042
|
});
|
|
1043
|
+
ns.register({
|
|
1044
|
+
name: 'set-model-released-request',
|
|
1045
|
+
fields: [
|
|
1046
|
+
{ name: 'name', type: 'string', required: true },
|
|
1047
|
+
{ name: 'released', type: 'bool', required: true }
|
|
1048
|
+
]
|
|
1049
|
+
});
|
|
1042
1050
|
ns.register({
|
|
1043
1051
|
name: 'model-download-phase',
|
|
1044
1052
|
enum: ['queued', 'downloading', 'paused', 'error'],
|
|
@@ -1087,7 +1095,11 @@ export function registerEngineTypes(ns) {
|
|
|
1087
1095
|
{ name: 'supportsThinking', type: 'bool' },
|
|
1088
1096
|
{ name: 'supportsVision', type: 'bool' },
|
|
1089
1097
|
{ name: 'expectedSize', type: 'uint' },
|
|
1090
|
-
{ name: 'createdAt', type: 'uint', required: true }
|
|
1098
|
+
{ name: 'createdAt', type: 'uint', required: true },
|
|
1099
|
+
{ name: 'contextLength', type: 'uint' },
|
|
1100
|
+
{ name: 'taskType', type: 'string' },
|
|
1101
|
+
{ name: 'license', type: 'string' },
|
|
1102
|
+
{ name: 'label', type: 'string' }
|
|
1091
1103
|
]
|
|
1092
1104
|
});
|
|
1093
1105
|
ns.register({
|
|
@@ -1097,7 +1109,7 @@ export function registerEngineTypes(ns) {
|
|
|
1097
1109
|
ns.register({
|
|
1098
1110
|
name: 'add-custom-model-request',
|
|
1099
1111
|
fields: [
|
|
1100
|
-
{ name: '
|
|
1112
|
+
{ name: 'label', type: 'string', required: true },
|
|
1101
1113
|
{ name: 'src', type: 'string', required: true },
|
|
1102
1114
|
{ name: 'mmprojSrc', type: 'string' },
|
|
1103
1115
|
{ name: 'supportsTools', type: 'bool' },
|
|
@@ -1106,10 +1118,48 @@ export function registerEngineTypes(ns) {
|
|
|
1106
1118
|
{ name: 'expectedSize', type: 'uint' }
|
|
1107
1119
|
]
|
|
1108
1120
|
});
|
|
1121
|
+
ns.register({
|
|
1122
|
+
name: 'add-custom-model-response',
|
|
1123
|
+
fields: [{ name: 'id', type: 'string', required: true }]
|
|
1124
|
+
});
|
|
1109
1125
|
ns.register({
|
|
1110
1126
|
name: 'remove-custom-model-request',
|
|
1111
1127
|
fields: [{ name: 'name', type: 'string', required: true }]
|
|
1112
1128
|
});
|
|
1129
|
+
ns.register({
|
|
1130
|
+
name: 'preview-custom-model-request',
|
|
1131
|
+
fields: [
|
|
1132
|
+
{ name: 'src', type: 'string', required: true },
|
|
1133
|
+
{ name: 'mmprojSrc', type: 'string' }
|
|
1134
|
+
]
|
|
1135
|
+
});
|
|
1136
|
+
ns.register({
|
|
1137
|
+
name: 'custom-model-source-file',
|
|
1138
|
+
fields: [
|
|
1139
|
+
{ name: 'src', type: 'string', required: true },
|
|
1140
|
+
{ name: 'label', type: 'string', required: true },
|
|
1141
|
+
{ name: 'sizeBytes', type: 'uint' }
|
|
1142
|
+
]
|
|
1143
|
+
});
|
|
1144
|
+
ns.register({
|
|
1145
|
+
name: 'custom-model-preview',
|
|
1146
|
+
fields: [
|
|
1147
|
+
{ name: 'ok', type: 'bool', required: true },
|
|
1148
|
+
{ name: 'refusal', type: 'string' },
|
|
1149
|
+
{ name: 'reason', type: 'string' },
|
|
1150
|
+
{ name: 'src', type: 'string' },
|
|
1151
|
+
{ name: 'files', type: '@assistant/custom-model-source-file', array: true },
|
|
1152
|
+
{ name: 'sizeBytes', type: 'uint' },
|
|
1153
|
+
{ name: 'contextLength', type: 'uint' },
|
|
1154
|
+
{ name: 'architecture', type: 'string' },
|
|
1155
|
+
{ name: 'sizeLabel', type: 'string' },
|
|
1156
|
+
{ name: 'taskType', type: 'string' },
|
|
1157
|
+
{ name: 'license', type: 'string' },
|
|
1158
|
+
{ name: 'fit', type: 'string' },
|
|
1159
|
+
{ name: 'fitReasons', type: 'string', array: true },
|
|
1160
|
+
{ name: 'mmprojSrc', type: 'string' }
|
|
1161
|
+
]
|
|
1162
|
+
});
|
|
1113
1163
|
ns.register({ name: 'log-level', enum: ['debug', 'info', 'warn', 'error'], strings: true });
|
|
1114
1164
|
ns.register({ name: 'log-origin', enum: ['core', 'client'], strings: true });
|
|
1115
1165
|
ns.register({
|
|
@@ -1912,6 +1962,25 @@ export function registerEngineTypes(ns) {
|
|
|
1912
1962
|
{ name: 'inviterName', type: 'string' }
|
|
1913
1963
|
]
|
|
1914
1964
|
});
|
|
1965
|
+
ns.register({
|
|
1966
|
+
name: 'load-model-request',
|
|
1967
|
+
fields: [{ name: 'name', type: 'string', required: true }]
|
|
1968
|
+
});
|
|
1969
|
+
ns.register({
|
|
1970
|
+
name: 'load-model-response',
|
|
1971
|
+
fields: [
|
|
1972
|
+
{ name: 'loaded', type: 'bool', required: true },
|
|
1973
|
+
{ name: 'reason', type: 'string' }
|
|
1974
|
+
]
|
|
1975
|
+
});
|
|
1976
|
+
ns.register({
|
|
1977
|
+
name: 'unload-model-request',
|
|
1978
|
+
fields: [{ name: 'name', type: 'string', required: true }]
|
|
1979
|
+
});
|
|
1980
|
+
ns.register({
|
|
1981
|
+
name: 'unload-model-response',
|
|
1982
|
+
fields: [{ name: 'unloaded', type: 'bool', required: true }]
|
|
1983
|
+
});
|
|
1915
1984
|
}
|
|
1916
1985
|
export function registerEngineApi(api) {
|
|
1917
1986
|
api.register({
|
|
@@ -2072,12 +2141,12 @@ export function registerEngineApi(api) {
|
|
|
2072
2141
|
api.register({
|
|
2073
2142
|
name: 'add-custom-model',
|
|
2074
2143
|
request: { name: '@assistant/add-custom-model-request', stream: false },
|
|
2075
|
-
response: { name: '@assistant/
|
|
2144
|
+
response: { name: '@assistant/add-custom-model-response', stream: false }
|
|
2076
2145
|
});
|
|
2077
2146
|
api.register({
|
|
2078
2147
|
name: 'remove-custom-model',
|
|
2079
2148
|
request: { name: '@assistant/remove-custom-model-request', stream: false },
|
|
2080
|
-
response: { name: '@assistant/
|
|
2149
|
+
response: { name: '@assistant/delete-model-response', stream: false }
|
|
2081
2150
|
});
|
|
2082
2151
|
api.register({
|
|
2083
2152
|
name: 'remove-device',
|
|
@@ -2639,4 +2708,24 @@ export function registerEngineApi(api) {
|
|
|
2639
2708
|
request: { name: '@assistant/preview-mesh-invite-request', stream: false },
|
|
2640
2709
|
response: { name: '@assistant/preview-mesh-invite-response', stream: false }
|
|
2641
2710
|
});
|
|
2711
|
+
api.register({
|
|
2712
|
+
name: 'load-model',
|
|
2713
|
+
request: { name: '@assistant/load-model-request', stream: false },
|
|
2714
|
+
response: { name: '@assistant/load-model-response', stream: false }
|
|
2715
|
+
});
|
|
2716
|
+
api.register({
|
|
2717
|
+
name: 'unload-model',
|
|
2718
|
+
request: { name: '@assistant/unload-model-request', stream: false },
|
|
2719
|
+
response: { name: '@assistant/unload-model-response', stream: false }
|
|
2720
|
+
});
|
|
2721
|
+
api.register({
|
|
2722
|
+
name: 'set-model-released',
|
|
2723
|
+
request: { name: '@assistant/set-model-released-request', stream: false },
|
|
2724
|
+
response: { name: '@assistant/app-config', stream: false }
|
|
2725
|
+
});
|
|
2726
|
+
api.register({
|
|
2727
|
+
name: 'preview-custom-model',
|
|
2728
|
+
request: { name: '@assistant/preview-custom-model-request', stream: false },
|
|
2729
|
+
response: { name: '@assistant/custom-model-preview', stream: false }
|
|
2730
|
+
});
|
|
2642
2731
|
}
|
|
@@ -31,8 +31,9 @@ export function assertFieldOrder(root, schemaFile, tags) {
|
|
|
31
31
|
function show(root, tag, file) {
|
|
32
32
|
const at = file.slice(root.length + 1);
|
|
33
33
|
const done = spawnSync('git', ['show', `${tag}:${at}`], { cwd: root });
|
|
34
|
-
if (done.status !== 0)
|
|
34
|
+
if (done.status !== 0) {
|
|
35
35
|
throw new Error(`git show ${tag}:${at} failed: ${done.stderr ?? ''}`);
|
|
36
|
+
}
|
|
36
37
|
return String(done.stdout);
|
|
37
38
|
}
|
|
38
39
|
function index(schema) {
|
|
@@ -41,55 +42,65 @@ function index(schema) {
|
|
|
41
42
|
function* shifts(baseline, current) {
|
|
42
43
|
for (const [name, container] of embeds(baseline, current)) {
|
|
43
44
|
const grew = grown(baseline, current, container.type);
|
|
44
|
-
if (grew.length > 0)
|
|
45
|
+
if (grew.length > 0) {
|
|
45
46
|
yield { at: name, grew, behind: container.behind };
|
|
47
|
+
}
|
|
46
48
|
}
|
|
47
49
|
}
|
|
48
50
|
function* latent(baseline, current) {
|
|
49
51
|
for (const [name, container] of embeds(baseline, current)) {
|
|
50
|
-
if (grown(baseline, current, container.type).length === 0)
|
|
52
|
+
if (grown(baseline, current, container.type).length === 0) {
|
|
51
53
|
yield name;
|
|
54
|
+
}
|
|
52
55
|
}
|
|
53
56
|
}
|
|
54
57
|
function* embeds(baseline, current) {
|
|
55
58
|
for (const [name, type] of current) {
|
|
56
59
|
const shipped = baseline.get(name);
|
|
57
|
-
if (!shipped?.fields || !type.fields)
|
|
60
|
+
if (!shipped?.fields || !type.fields) {
|
|
58
61
|
continue;
|
|
62
|
+
}
|
|
59
63
|
const known = new Set(shipped.fields.map((field) => field.name));
|
|
60
64
|
for (let i = 0; i < type.fields.length; i++) {
|
|
61
65
|
const field = type.fields[i];
|
|
62
|
-
if (!current.get(field.type)?.versions)
|
|
66
|
+
if (!current.get(field.type)?.versions) {
|
|
63
67
|
continue;
|
|
68
|
+
}
|
|
64
69
|
const behind = type.fields
|
|
65
70
|
.slice(i + 1)
|
|
66
71
|
.map((later) => later.name)
|
|
67
72
|
.filter((later) => known.has(later));
|
|
68
|
-
if (field.array && known.has(field.name))
|
|
73
|
+
if (field.array && known.has(field.name)) {
|
|
69
74
|
behind.unshift('its own later elements');
|
|
70
|
-
|
|
75
|
+
}
|
|
76
|
+
if (behind.length > 0) {
|
|
71
77
|
yield [`${name}.${field.name}`, { type: field.type, behind }];
|
|
78
|
+
}
|
|
72
79
|
}
|
|
73
80
|
}
|
|
74
81
|
}
|
|
75
82
|
function grown(baseline, current, name) {
|
|
76
83
|
const shipped = baseline.get(name);
|
|
77
84
|
const now = current.get(name);
|
|
78
|
-
if (!shipped?.versions || !now?.versions)
|
|
85
|
+
if (!shipped?.versions || !now?.versions) {
|
|
79
86
|
return [];
|
|
87
|
+
}
|
|
80
88
|
const out = [];
|
|
81
89
|
for (const version of shipped.versions) {
|
|
82
90
|
const mine = now.versions.find((entry) => entry.version === version.version);
|
|
83
|
-
if (!mine)
|
|
91
|
+
if (!mine) {
|
|
84
92
|
continue;
|
|
93
|
+
}
|
|
85
94
|
const was = baseline.get(version.type);
|
|
86
95
|
const is = current.get(mine.type);
|
|
87
|
-
if (!was?.fields || !is?.fields)
|
|
96
|
+
if (!was?.fields || !is?.fields) {
|
|
88
97
|
continue;
|
|
98
|
+
}
|
|
89
99
|
const before = was.fields.map((field) => field.name);
|
|
90
100
|
out.push(...is.fields.map((field) => field.name).filter((field) => !before.includes(field)));
|
|
91
|
-
if (was.flagsPosition === -1 && (is.flagsPosition ?? -1) >= 0)
|
|
101
|
+
if (was.flagsPosition === -1 && (is.flagsPosition ?? -1) >= 0) {
|
|
92
102
|
out.push('(flags byte)');
|
|
103
|
+
}
|
|
93
104
|
}
|
|
94
105
|
return out;
|
|
95
106
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// for strict consumers without allowJs; the *Map emitters return record rows, never a Map
|
|
2
|
+
export function chunkTypeOrdinal(type: string): number
|
|
3
|
+
export function chunksByTypeMap(record: unknown): ReadonlyArray<Record<string, unknown>>
|
|
4
|
+
export function activeAgentsMap(record: unknown): ReadonlyArray<Record<string, unknown>>
|
|
5
|
+
export function activeChatsMap(record: unknown): ReadonlyArray<Record<string, unknown>>
|
|
6
|
+
export function agentsByProviderMap(record: unknown): ReadonlyArray<Record<string, unknown>>
|
|
7
|
+
export function defaultAgentsMap(record: unknown): ReadonlyArray<Record<string, unknown>>
|
|
8
|
+
export function activeChatsByAgentMap(record: unknown): ReadonlyArray<Record<string, unknown>>
|
|
9
|
+
export function activeChatGroupsMap(record: unknown): ReadonlyArray<Record<string, unknown>>
|
|
10
|
+
export function activeKnowledgeByChatMap(record: unknown): ReadonlyArray<Record<string, unknown>>
|
|
11
|
+
export function activeToolConfigsByAgentMap(record: unknown): ReadonlyArray<Record<string, unknown>>
|
|
12
|
+
export function toolActivityByAgentMap(record: unknown): ReadonlyArray<Record<string, unknown>>
|
|
13
|
+
export function runRequestsMap(record: unknown): ReadonlyArray<Record<string, unknown>>
|
|
14
|
+
export function liveFilesMap(record: unknown): ReadonlyArray<Record<string, unknown>>
|
|
15
|
+
export function reclaimableFilesMap(record: unknown): ReadonlyArray<Record<string, unknown>>
|
|
16
|
+
export function attachmentsByMediaKindMap(record: unknown): ReadonlyArray<Record<string, unknown>>
|
|
17
|
+
export function attachmentsByMediaKindOriginMap(
|
|
18
|
+
record: unknown
|
|
19
|
+
): ReadonlyArray<Record<string, unknown>>
|
|
20
|
+
export function historyChunksMap(record: unknown): ReadonlyArray<Record<string, unknown>>
|
|
21
|
+
export function liveDevicesByWriterKeyMap(record: unknown): ReadonlyArray<Record<string, unknown>>
|
|
22
|
+
export function liveWritersByMostRecentMap(record: unknown): ReadonlyArray<Record<string, unknown>>
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
// imported by the generated spec at runtime (dbns.require embeds a relative path) — stays plain .js
|
|
2
|
+
import { mediaKindOf, mediaKindOrdinal } from './media-kind.js'
|
|
3
|
+
|
|
2
4
|
const historyChunkTypes = ['user-message', 'run-request', 'content', 'attachment', 'compaction']
|
|
3
5
|
|
|
4
6
|
// index keys hold the ordinal, kept in sync by hand with CHUNK_TYPES order in content.ts
|
|
@@ -76,9 +78,7 @@ export function activeToolConfigsByAgentMap(record) {
|
|
|
76
78
|
return [{ agentId: record.agentId }]
|
|
77
79
|
}
|
|
78
80
|
|
|
79
|
-
//
|
|
80
|
-
// agent's whole activity across every chat and device, in a peer-consistent order (seq, not wall
|
|
81
|
-
// clock). No tombstone filter: activity is immutable history.
|
|
81
|
+
// keyed by seq, not wall clock, for a peer-consistent order; no tombstone filter, it is immutable
|
|
82
82
|
export function toolActivityByAgentMap(record) {
|
|
83
83
|
if (!record.agentId) return []
|
|
84
84
|
return [{ agentId: record.agentId, seq: record.seq }]
|
|
@@ -89,57 +89,14 @@ export function runRequestsMap(record) {
|
|
|
89
89
|
return [{ chatId: record.chatId, seq: record.seq }]
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
//
|
|
93
|
-
// uint (same pattern as chunksByTypeMap); MEDIA_KINDS is the name↔ordinal source of truth, and
|
|
94
|
-
// the wire media-kind enum in engine.ts is registered from this same array so the two never drift.
|
|
95
|
-
export const MEDIA_KINDS = ['audio', 'image', 'video', 'other']
|
|
96
|
-
|
|
97
|
-
// `.mp4` is deliberately audio, not video: audio recordings ship in the mp4 container and are
|
|
98
|
-
// transcribed from their audio track (parity with isAudioAttachment). audio-attachment.ts derives
|
|
99
|
-
// isAudioAttachment from mediaKindOf, so this list is the one source of truth for "what is audio".
|
|
100
|
-
export const AUDIO_EXTENSIONS = ['.m4a', '.mp3', '.wav', '.ogg', '.flac', '.aac', '.mp4']
|
|
101
|
-
const IMAGE_EXTENSIONS = [
|
|
102
|
-
'.png',
|
|
103
|
-
'.jpg',
|
|
104
|
-
'.jpeg',
|
|
105
|
-
'.gif',
|
|
106
|
-
'.webp',
|
|
107
|
-
'.bmp',
|
|
108
|
-
'.svg',
|
|
109
|
-
'.heic',
|
|
110
|
-
'.heif',
|
|
111
|
-
'.avif'
|
|
112
|
-
]
|
|
113
|
-
const VIDEO_EXTENSIONS = ['.mov', '.webm', '.mkv', '.avi', '.m4v']
|
|
114
|
-
|
|
115
|
-
function endsWithAny(name, extensions) {
|
|
116
|
-
return extensions.some((extension) => name.endsWith(extension))
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
// classify an attachment by mime first, then filename extension. Broad by design so a generated
|
|
120
|
-
// `audio/wav` and a user `recording.m4a` both land under 'audio'.
|
|
121
|
-
export function mediaKindOf(mimeType, fileName) {
|
|
122
|
-
const mime = (mimeType || '').toLowerCase()
|
|
123
|
-
const name = (fileName || '').toLowerCase()
|
|
124
|
-
if (mime.startsWith('audio/') || endsWithAny(name, AUDIO_EXTENSIONS)) return 'audio'
|
|
125
|
-
if (mime.startsWith('image/') || endsWithAny(name, IMAGE_EXTENSIONS)) return 'image'
|
|
126
|
-
if (mime.startsWith('video/') || endsWithAny(name, VIDEO_EXTENSIONS)) return 'video'
|
|
127
|
-
return 'other'
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
export function mediaKindOrdinal(kind) {
|
|
131
|
-
const ordinal = MEDIA_KINDS.indexOf(kind)
|
|
132
|
-
if (ordinal === -1) throw new Error('Unknown media kind: ' + kind)
|
|
133
|
-
return ordinal + 1
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
// every non-deleted attachment chunk, keyed by media kind then createdAt — NOT chatId-prefixed,
|
|
137
|
-
// so one range query lists all audio (uploaded or generated) across every chat in the mesh. Drops
|
|
138
|
-
// non-attachment chunks and tombstoned attachments so a gallery never scans-and-filters.
|
|
92
|
+
// not chatId-prefixed, so one range lists every audio attachment in the mesh without filtering
|
|
139
93
|
export function attachmentsByMediaKindMap(record) {
|
|
140
94
|
if (record.type !== 'attachment') return []
|
|
141
95
|
const attachment = record.attachment
|
|
142
|
-
if (!attachment || attachment.deletedAt)
|
|
96
|
+
if (!attachment || attachment.deletedAt) {
|
|
97
|
+
return []
|
|
98
|
+
}
|
|
99
|
+
|
|
143
100
|
return [
|
|
144
101
|
{
|
|
145
102
|
mediaKind: mediaKindOrdinal(mediaKindOf(attachment.mimeType, attachment.fileName)),
|
|
@@ -148,19 +105,19 @@ export function attachmentsByMediaKindMap(record) {
|
|
|
148
105
|
]
|
|
149
106
|
}
|
|
150
107
|
|
|
151
|
-
// generated
|
|
152
|
-
// only routes runId-less uploads to knowledge). So runId presence IS the origin, kept out of the
|
|
153
|
-
// key as a plain 0/1 uint the way mediaKind is.
|
|
108
|
+
// generated output always carries a runId and an upload never does, so runId presence is origin
|
|
154
109
|
function attachmentGenerated(record) {
|
|
155
110
|
return record.runId ? 1 : 0
|
|
156
111
|
}
|
|
157
112
|
|
|
158
|
-
// the
|
|
159
|
-
// into the key so "only generated audio" / "only uploaded audio" is a range query, not a post-filter.
|
|
113
|
+
// origin in the key makes "only generated audio" a range query, not a post-filter
|
|
160
114
|
export function attachmentsByMediaKindOriginMap(record) {
|
|
161
115
|
if (record.type !== 'attachment') return []
|
|
162
116
|
const attachment = record.attachment
|
|
163
|
-
if (!attachment || attachment.deletedAt)
|
|
117
|
+
if (!attachment || attachment.deletedAt) {
|
|
118
|
+
return []
|
|
119
|
+
}
|
|
120
|
+
|
|
164
121
|
return [
|
|
165
122
|
{
|
|
166
123
|
mediaKind: mediaKindOrdinal(mediaKindOf(attachment.mimeType, attachment.fileName)),
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function
|
|
1
|
+
import { type CollectionRegistry, type Registry } from './content.ts';
|
|
2
|
+
export declare function registerLocalTypes(ns: Registry): void;
|
|
3
|
+
export declare function registerLocalCollections(dbns: CollectionRegistry, helpersPath: string): void;
|