@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
|
@@ -2,21 +2,24 @@ import b4a from 'b4a';
|
|
|
2
2
|
import { getAgent } from './agent.js';
|
|
3
3
|
import { getChat } from './chat.js';
|
|
4
4
|
import { NO_SUCH_AGENT, NOT_THE_HOST, SENDER_REVOKED } from './skill-secrets.js';
|
|
5
|
-
|
|
5
|
+
import { DEVICES } from './collections.js';
|
|
6
6
|
export const NO_SUCH_CHAT = 'no such chat on the device hosting this agent';
|
|
7
7
|
export const NO_RECORD_STORE = 'the device hosting this agent is not recording prompts right now';
|
|
8
8
|
const MAX_ANSWER_BYTES = 2 * 1024 * 1024;
|
|
9
9
|
export function createInferenceCallsReceiver(opts) {
|
|
10
10
|
return async (request, fromDeviceId) => {
|
|
11
11
|
const sender = await opts.mesh.view.get(DEVICES, { id: fromDeviceId });
|
|
12
|
-
if (!sender || sender.revoked)
|
|
12
|
+
if (!sender || sender.revoked) {
|
|
13
13
|
throw new Error(SENDER_REVOKED);
|
|
14
|
+
}
|
|
14
15
|
const chat = await getChat(opts.mesh, request.chatId);
|
|
15
|
-
if (!chat)
|
|
16
|
+
if (!chat) {
|
|
16
17
|
throw new Error(NO_SUCH_CHAT);
|
|
18
|
+
}
|
|
17
19
|
const agent = await getAgent(opts.mesh, chat.agentId);
|
|
18
|
-
if (!agent)
|
|
20
|
+
if (!agent) {
|
|
19
21
|
throw new Error(NO_SUCH_AGENT);
|
|
22
|
+
}
|
|
20
23
|
if (!agent.providerDeviceId || !b4a.equals(agent.providerDeviceId, opts.deviceId)) {
|
|
21
24
|
throw new Error(NOT_THE_HOST);
|
|
22
25
|
}
|
|
@@ -20,10 +20,12 @@ function inviteClaimMessage(binding) {
|
|
|
20
20
|
}
|
|
21
21
|
export function inviteGrantTermsRefusal(terms, mintedAt) {
|
|
22
22
|
const { expiresAt, maxUses } = terms;
|
|
23
|
-
if (!expiresAt)
|
|
23
|
+
if (!expiresAt) {
|
|
24
24
|
return INVITE_GRANT_NO_EXPIRY;
|
|
25
|
-
|
|
25
|
+
}
|
|
26
|
+
if (expiresAt > mintedAt + GRANT_MAX_TTL_MS) {
|
|
26
27
|
return INVITE_GRANT_TOO_LONG;
|
|
28
|
+
}
|
|
27
29
|
if (!maxUses || !Number.isInteger(maxUses) || maxUses < 1 || maxUses > GRANT_MAX_USES) {
|
|
28
30
|
return INVITE_GRANT_USES_OUT_OF_RANGE;
|
|
29
31
|
}
|
|
@@ -19,8 +19,9 @@ export function encodeMeshInvite(invite) {
|
|
|
19
19
|
}
|
|
20
20
|
export function decodeMeshInvite(raw) {
|
|
21
21
|
const value = raw.trim().toLowerCase();
|
|
22
|
-
if (!value.startsWith(INVITE_PREFIX))
|
|
22
|
+
if (!value.startsWith(INVITE_PREFIX)) {
|
|
23
23
|
return null;
|
|
24
|
+
}
|
|
24
25
|
let payload;
|
|
25
26
|
try {
|
|
26
27
|
payload = decodeStruct(INVITE_STRUCT, z32.decode(value.slice(INVITE_PREFIX.length)));
|
|
@@ -14,6 +14,8 @@ export declare class LocalFiles {
|
|
|
14
14
|
touch(key: FileKey, now?: number): Promise<void>;
|
|
15
15
|
private _write;
|
|
16
16
|
markCleared(file: FileKey): Promise<void>;
|
|
17
|
+
retireChats(meshKey: Buffer, purged: ReadonlyMap<string, number>): Promise<void>;
|
|
18
|
+
forget(file: FileKey): Promise<void>;
|
|
17
19
|
meshOf(coreKey: Buffer, blockOffset: number): Promise<Buffer | null>;
|
|
18
20
|
backfilled(meshKey: Buffer): Promise<boolean>;
|
|
19
21
|
markBackfilled(meshKey: Buffer): Promise<void>;
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import b4a from 'b4a';
|
|
2
|
-
|
|
3
|
-
const FILES_BY_BLOB = '@local/files-by-blob';
|
|
4
|
-
const RECLAIMABLE_FILES = '@local/reclaimable-files-by-last-accessed';
|
|
5
|
-
const LIVE_FILES = '@local/live-files';
|
|
6
|
-
const CONFIG = '@local/config';
|
|
2
|
+
import { LOCAL_CONFIG, LOCAL_FILES, LOCAL_FILES_BY_BLOB, LOCAL_LIVE_FILES, LOCAL_RECLAIMABLE_FILES_BY_LAST_ACCESSED } from '../collections.js';
|
|
7
3
|
const TOUCH_GRAIN_MS = 60 * 60 * 1000;
|
|
8
4
|
export class LocalFiles {
|
|
9
5
|
_db;
|
|
@@ -59,12 +55,12 @@ export class LocalFiles {
|
|
|
59
55
|
const tx = this._db.transaction();
|
|
60
56
|
let changed = false;
|
|
61
57
|
for (const file of files) {
|
|
62
|
-
const known = await tx.get(
|
|
58
|
+
const known = await tx.get(LOCAL_FILES, keyOf(file));
|
|
63
59
|
const row = next(file, known);
|
|
64
60
|
if (!row) {
|
|
65
61
|
continue;
|
|
66
62
|
}
|
|
67
|
-
await tx.insert(
|
|
63
|
+
await tx.insert(LOCAL_FILES, row);
|
|
68
64
|
changed = true;
|
|
69
65
|
}
|
|
70
66
|
if (changed) {
|
|
@@ -78,45 +74,81 @@ export class LocalFiles {
|
|
|
78
74
|
markCleared(file) {
|
|
79
75
|
return this._locked(async () => {
|
|
80
76
|
const tx = this._db.transaction();
|
|
81
|
-
const known = await tx.get(
|
|
77
|
+
const known = await tx.get(LOCAL_FILES, keyOf(file));
|
|
82
78
|
if (!known) {
|
|
83
79
|
await tx.close();
|
|
84
80
|
return;
|
|
85
81
|
}
|
|
86
|
-
await tx.insert(
|
|
82
|
+
await tx.insert(LOCAL_FILES, { ...known, cleared: true });
|
|
83
|
+
await tx.flush();
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
retireChats(meshKey, purged) {
|
|
87
|
+
return this._locked(async () => {
|
|
88
|
+
const tx = this._db.transaction();
|
|
89
|
+
let changed = false;
|
|
90
|
+
for (const row of await tx.find(LOCAL_FILES, meshRange(meshKey)).toArray()) {
|
|
91
|
+
const at = row.chatId ? purged.get(row.chatId) : undefined;
|
|
92
|
+
if (!at || row.deletedAt) {
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
await tx.insert(LOCAL_FILES, { ...row, deletedAt: at });
|
|
96
|
+
changed = true;
|
|
97
|
+
}
|
|
98
|
+
if (changed) {
|
|
99
|
+
await tx.flush();
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
await tx.close();
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
forget(file) {
|
|
107
|
+
return this._locked(async () => {
|
|
108
|
+
const tx = this._db.transaction();
|
|
109
|
+
if (!(await tx.get(LOCAL_FILES, keyOf(file)))) {
|
|
110
|
+
await tx.close();
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
await tx.delete(LOCAL_FILES, keyOf(file));
|
|
87
114
|
await tx.flush();
|
|
88
115
|
});
|
|
89
116
|
}
|
|
90
117
|
async meshOf(coreKey, blockOffset) {
|
|
91
118
|
const key = { coreKey, blockOffset };
|
|
92
|
-
const row = await this._db.findOne(
|
|
119
|
+
const row = await this._db.findOne(LOCAL_FILES_BY_BLOB, { gte: key, lte: key });
|
|
93
120
|
return row?.meshKey ?? null;
|
|
94
121
|
}
|
|
95
122
|
async backfilled(meshKey) {
|
|
96
|
-
return (await this._db.get(
|
|
123
|
+
return ((await this._db.get(LOCAL_CONFIG, { key: backfillKey(meshKey) })) !== null);
|
|
97
124
|
}
|
|
98
125
|
markBackfilled(meshKey) {
|
|
99
126
|
return this._locked(async () => {
|
|
100
127
|
const tx = this._db.transaction();
|
|
101
|
-
await tx.insert(
|
|
128
|
+
await tx.insert(LOCAL_CONFIG, { key: backfillKey(meshKey), value: true });
|
|
102
129
|
await tx.flush();
|
|
103
130
|
});
|
|
104
131
|
}
|
|
105
132
|
list(meshKey) {
|
|
106
|
-
return this._db.find(
|
|
133
|
+
return this._db.find(LOCAL_FILES, meshRange(meshKey)).toArray();
|
|
107
134
|
}
|
|
108
135
|
live(meshKey) {
|
|
109
|
-
return this._db.find(
|
|
136
|
+
return this._db.find(LOCAL_LIVE_FILES, meshRange(meshKey)).toArray();
|
|
110
137
|
}
|
|
111
138
|
stale(cutoff) {
|
|
112
|
-
return this._db
|
|
139
|
+
return this._db
|
|
140
|
+
.find(LOCAL_RECLAIMABLE_FILES_BY_LAST_ACCESSED, { lt: { lastAccessed: cutoff } })
|
|
141
|
+
.toArray();
|
|
113
142
|
}
|
|
114
143
|
}
|
|
115
144
|
export async function dropMeshFiles(tx, meshKey) {
|
|
116
|
-
const rows = await tx
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
145
|
+
const rows = await tx
|
|
146
|
+
.find(LOCAL_FILES, { gte: { meshKey }, lte: { meshKey } })
|
|
147
|
+
.toArray();
|
|
148
|
+
for (const row of rows) {
|
|
149
|
+
await tx.delete(LOCAL_FILES, keyOf(row));
|
|
150
|
+
}
|
|
151
|
+
await tx.delete(LOCAL_CONFIG, { key: backfillKey(meshKey) });
|
|
120
152
|
}
|
|
121
153
|
function meshRange(meshKey) {
|
|
122
154
|
return meshKey ? { gte: { meshKey }, lte: { meshKey } } : {};
|
|
@@ -9,6 +9,62 @@ export interface ResolvedSession {
|
|
|
9
9
|
readonly writerSeed: string | undefined;
|
|
10
10
|
readonly compute: boolean;
|
|
11
11
|
}
|
|
12
|
+
export interface ArchivedMeshMembership extends LocalMeshMembership {
|
|
13
|
+
readonly leftAt: number;
|
|
14
|
+
}
|
|
15
|
+
export interface ConfigEntry {
|
|
16
|
+
readonly key: string;
|
|
17
|
+
readonly value: unknown;
|
|
18
|
+
}
|
|
19
|
+
export interface ChatOrderEntry {
|
|
20
|
+
readonly chatId: string;
|
|
21
|
+
readonly sortKey: Buffer;
|
|
22
|
+
}
|
|
23
|
+
export interface ChatOrderCursor {
|
|
24
|
+
readonly sortKey: Uint8Array;
|
|
25
|
+
readonly chatId: string;
|
|
26
|
+
}
|
|
27
|
+
export interface ListChatOrderOptions {
|
|
28
|
+
readonly limit?: number;
|
|
29
|
+
readonly before?: ChatOrderCursor;
|
|
30
|
+
}
|
|
31
|
+
export interface BeginModelTransferOptions {
|
|
32
|
+
readonly transferred?: boolean;
|
|
33
|
+
}
|
|
34
|
+
export interface CompleteModelTransferOptions {
|
|
35
|
+
readonly name: string;
|
|
36
|
+
readonly transferId: string;
|
|
37
|
+
readonly downloaded?: boolean;
|
|
38
|
+
}
|
|
39
|
+
export interface DeviceProfile {
|
|
40
|
+
readonly capabilityProfile: LocalCapabilityProfile;
|
|
41
|
+
readonly recommendedModelName: string;
|
|
42
|
+
readonly platform?: string;
|
|
43
|
+
}
|
|
44
|
+
export interface EnsuredIdentity {
|
|
45
|
+
readonly identity: LocalIdentity;
|
|
46
|
+
readonly mnemonic: string | null;
|
|
47
|
+
}
|
|
48
|
+
export interface ResolveSessionOptions {
|
|
49
|
+
readonly seed?: Buffer;
|
|
50
|
+
readonly baseKey?: Buffer;
|
|
51
|
+
readonly new?: boolean;
|
|
52
|
+
readonly writerSeed?: string;
|
|
53
|
+
readonly compute?: boolean;
|
|
54
|
+
}
|
|
55
|
+
export interface RecordMeshOptions {
|
|
56
|
+
readonly deviceId: Buffer;
|
|
57
|
+
readonly account?: boolean;
|
|
58
|
+
}
|
|
59
|
+
export interface RecordDepartureOptions {
|
|
60
|
+
readonly creator: boolean;
|
|
61
|
+
}
|
|
62
|
+
export interface AdoptAccountMeshOptions {
|
|
63
|
+
readonly account?: Buffer | null;
|
|
64
|
+
}
|
|
65
|
+
export interface MarkAwaitingAdmissionOptions {
|
|
66
|
+
readonly awaitingAdmission: boolean;
|
|
67
|
+
}
|
|
12
68
|
export declare function openLocalStore(storage: CorestoreStorage): LocalStore;
|
|
13
69
|
declare class LocalStore {
|
|
14
70
|
private readonly _db;
|
|
@@ -18,10 +74,7 @@ declare class LocalStore {
|
|
|
18
74
|
private _locked;
|
|
19
75
|
get(key: string): Promise<unknown>;
|
|
20
76
|
set(key: string, value: unknown): Promise<void>;
|
|
21
|
-
setAll(entries: ReadonlyArray<
|
|
22
|
-
readonly key: string;
|
|
23
|
-
readonly value: unknown;
|
|
24
|
-
}>): Promise<void>;
|
|
77
|
+
setAll(entries: ReadonlyArray<ConfigEntry>): Promise<void>;
|
|
25
78
|
rekey(fromKey: string, toKey: string): Promise<unknown>;
|
|
26
79
|
deleteAll(keys: ReadonlyArray<string>): Promise<void>;
|
|
27
80
|
getAppConfigRow(): Promise<LocalAppConfig | null>;
|
|
@@ -29,27 +82,12 @@ declare class LocalStore {
|
|
|
29
82
|
getChatNotify(chatId: string): Promise<LocalChatNotify | null>;
|
|
30
83
|
ackChatNotify(chatId: string, seq: number): Promise<void>;
|
|
31
84
|
clearChatNotify(chatId: string): Promise<void>;
|
|
32
|
-
writeChatOrder(meshKey: Buffer, rows: ReadonlyArray<
|
|
33
|
-
|
|
34
|
-
sortKey: Buffer;
|
|
35
|
-
}>, gone?: ReadonlyArray<string>): Promise<void>;
|
|
36
|
-
listChatOrder(meshKey: Buffer, { limit, before }?: {
|
|
37
|
-
limit?: number;
|
|
38
|
-
before?: {
|
|
39
|
-
sortKey: Buffer;
|
|
40
|
-
chatId: string;
|
|
41
|
-
};
|
|
42
|
-
}): Promise<LocalChatOrder[]>;
|
|
85
|
+
writeChatOrder(meshKey: Buffer, rows: ReadonlyArray<ChatOrderEntry>, gone?: ReadonlyArray<string>): Promise<void>;
|
|
86
|
+
listChatOrder(meshKey: Buffer, { limit, before }?: ListChatOrderOptions): Promise<LocalChatOrder[]>;
|
|
43
87
|
private _dropChatOrder;
|
|
44
88
|
private _chatOrderIn;
|
|
45
|
-
beginModelTransfer(name: string, { transferred }?:
|
|
46
|
-
|
|
47
|
-
}): Promise<LocalModelNotify>;
|
|
48
|
-
completeModelTransfer({ name, transferId, downloaded }: {
|
|
49
|
-
name: string;
|
|
50
|
-
transferId: string;
|
|
51
|
-
downloaded?: boolean;
|
|
52
|
-
}): Promise<void>;
|
|
89
|
+
beginModelTransfer(name: string, { transferred }?: BeginModelTransferOptions): Promise<LocalModelNotify>;
|
|
90
|
+
completeModelTransfer({ name, transferId, downloaded }: CompleteModelTransferOptions): Promise<void>;
|
|
53
91
|
getModelNotifications(): Promise<LocalModelNotify[]>;
|
|
54
92
|
ackModelNotification(notificationId: string): Promise<void>;
|
|
55
93
|
getModelDownloadRows(): Promise<LocalModelDownload[]>;
|
|
@@ -60,7 +98,7 @@ declare class LocalStore {
|
|
|
60
98
|
deleteCustomModelRow(name: string): Promise<void>;
|
|
61
99
|
ensureDevice(publicKey: Buffer, seed?: DeviceMetadata): Promise<DeviceMetadata | null>;
|
|
62
100
|
renameDevice(publicKey: Buffer, name: string): Promise<void>;
|
|
63
|
-
saveDeviceProfile(publicKey: Buffer, capabilityProfile
|
|
101
|
+
saveDeviceProfile(publicKey: Buffer, { capabilityProfile, recommendedModelName, platform }: DeviceProfile): Promise<void>;
|
|
64
102
|
readIdentity(): Promise<LocalIdentity | null>;
|
|
65
103
|
saveDisplayName(displayName: string, displayNameAt?: number): Promise<LocalIdentity | null>;
|
|
66
104
|
readMemberProof(meshKey: Buffer): Promise<LocalMemberProof | null>;
|
|
@@ -68,42 +106,27 @@ declare class LocalStore {
|
|
|
68
106
|
readAccountRecovery(meshKey: Buffer): Promise<LocalAccountRecovery | null>;
|
|
69
107
|
recordAccountRecovery(row: LocalAccountRecovery): Promise<void>;
|
|
70
108
|
replaceIdentity(identity: Omit<LocalIdentity, 'id'>): Promise<void>;
|
|
71
|
-
ensureIdentity(devicePublicKey: Buffer, createdAt: number): Promise<
|
|
72
|
-
|
|
73
|
-
mnemonic: string | null;
|
|
74
|
-
}>;
|
|
75
|
-
resolveSession(deviceId: Buffer, opts?: {
|
|
76
|
-
seed?: Buffer;
|
|
77
|
-
baseKey?: Buffer;
|
|
78
|
-
new?: boolean;
|
|
79
|
-
writerSeed?: string;
|
|
80
|
-
compute?: boolean;
|
|
81
|
-
}): Promise<ResolvedSession>;
|
|
109
|
+
ensureIdentity(devicePublicKey: Buffer, createdAt: number): Promise<EnsuredIdentity>;
|
|
110
|
+
resolveSession(deviceId: Buffer, opts?: ResolveSessionOptions): Promise<ResolvedSession>;
|
|
82
111
|
createCandidateSession(seed: Buffer, baseKey: Buffer, compute?: boolean): ResolvedSession;
|
|
83
112
|
private _activeMembership;
|
|
84
113
|
private _membership;
|
|
85
114
|
private _migrateLegacySession;
|
|
86
115
|
private _legacyMembership;
|
|
87
|
-
recordMesh(
|
|
88
|
-
account?: boolean;
|
|
89
|
-
}): Promise<void>;
|
|
116
|
+
recordMesh(key: Buffer, session: ResolvedSession, { deviceId, account }: RecordMeshOptions): Promise<void>;
|
|
90
117
|
setAccountMesh(deviceId: Buffer, key: Buffer): Promise<void>;
|
|
91
|
-
recordDeparture(key: Buffer, opts:
|
|
92
|
-
creator: boolean;
|
|
93
|
-
}): Promise<void>;
|
|
118
|
+
recordDeparture(key: Buffer, opts: RecordDepartureOptions): Promise<void>;
|
|
94
119
|
departures(): Promise<LocalMeshDeparture[]>;
|
|
95
120
|
deleteDeparture(key: Buffer): Promise<void>;
|
|
96
121
|
archiveMesh(key: Buffer): Promise<void>;
|
|
97
122
|
forgetMesh(key: Buffer): Promise<void>;
|
|
98
|
-
markAwaitingAdmission(key: Buffer,
|
|
123
|
+
markAwaitingAdmission(key: Buffer, opts: MarkAwaitingAdmissionOptions): Promise<void>;
|
|
99
124
|
awaitsAdmission(key: Buffer): Promise<boolean>;
|
|
100
125
|
markMeshMigrated(key: Buffer, migratedAt: number): Promise<void>;
|
|
101
|
-
adoptAccountMesh(deviceId: Buffer, key: Buffer, { account }:
|
|
102
|
-
account?: Buffer | null;
|
|
103
|
-
}): Promise<void>;
|
|
126
|
+
adoptAccountMesh(deviceId: Buffer, key: Buffer, { account }: AdoptAccountMeshOptions): Promise<void>;
|
|
104
127
|
private _pointersAt;
|
|
105
128
|
listMeshes(): Promise<LocalMeshMembership[]>;
|
|
106
|
-
listArchivedMeshes(): Promise<
|
|
129
|
+
listArchivedMeshes(): Promise<ArchivedMeshMembership[]>;
|
|
107
130
|
accountMesh(deviceId: Buffer): Promise<LocalMeshMembership | null>;
|
|
108
131
|
readMeshSession(key: Buffer): Promise<ResolvedSession | null>;
|
|
109
132
|
watch(listener: () => void): void;
|