@qvac/core 0.0.0 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +198 -0
- package/NOTICE.md +13 -0
- package/README.md +694 -0
- package/SECURITY.md +6 -0
- package/dist/assistant.bundle +47256 -0
- package/dist/assistant.cjs +18 -0
- package/dist/assistant.d.ts +8 -0
- package/dist/prebuilds-manifest.json +380 -0
- package/dist-lib/client.d.ts +2 -0
- package/dist-lib/client.js +1 -0
- package/dist-lib/index.d.ts +13 -0
- package/dist-lib/index.js +10 -0
- package/dist-lib/lib/agent-icons.d.ts +3 -0
- package/dist-lib/lib/agent-icons.js +1 -0
- package/dist-lib/lib/api/agents.d.ts +5 -0
- package/dist-lib/lib/api/agents.js +38 -0
- package/dist-lib/lib/api/app-config.d.ts +5 -0
- package/dist-lib/lib/api/app-config.js +108 -0
- package/dist-lib/lib/api/approval-rules.d.ts +3 -0
- package/dist-lib/lib/api/approval-rules.js +9 -0
- package/dist-lib/lib/api/attachments.d.ts +8 -0
- package/dist-lib/lib/api/attachments.js +15 -0
- package/dist-lib/lib/api/chat-groups.d.ts +5 -0
- package/dist-lib/lib/api/chat-groups.js +12 -0
- package/dist-lib/lib/api/chat.d.ts +5 -0
- package/dist-lib/lib/api/chat.js +38 -0
- package/dist-lib/lib/api/chunks.d.ts +5 -0
- package/dist-lib/lib/api/chunks.js +61 -0
- package/dist-lib/lib/api/config.d.ts +5 -0
- package/dist-lib/lib/api/config.js +15 -0
- package/dist-lib/lib/api/current-mesh.d.ts +5 -0
- package/dist-lib/lib/api/current-mesh.js +12 -0
- package/dist-lib/lib/api/custom-models.d.ts +5 -0
- package/dist-lib/lib/api/custom-models.js +45 -0
- package/dist-lib/lib/api/devices.d.ts +8 -0
- package/dist-lib/lib/api/devices.js +125 -0
- package/dist-lib/lib/api/diagnostics.d.ts +7 -0
- package/dist-lib/lib/api/diagnostics.js +7 -0
- package/dist-lib/lib/api/effective-ctx-size.d.ts +2 -0
- package/dist-lib/lib/api/effective-ctx-size.js +10 -0
- package/dist-lib/lib/api/execution.d.ts +3 -0
- package/dist-lib/lib/api/execution.js +45 -0
- package/dist-lib/lib/api/files.d.ts +3 -0
- package/dist-lib/lib/api/files.js +48 -0
- package/dist-lib/lib/api/index.d.ts +62 -0
- package/dist-lib/lib/api/index.js +172 -0
- package/dist-lib/lib/api/instrument.d.ts +2 -0
- package/dist-lib/lib/api/instrument.js +86 -0
- package/dist-lib/lib/api/knowledge.d.ts +8 -0
- package/dist-lib/lib/api/knowledge.js +26 -0
- package/dist-lib/lib/api/logs.d.ts +14 -0
- package/dist-lib/lib/api/logs.js +116 -0
- package/dist-lib/lib/api/mesh.d.ts +13 -0
- package/dist-lib/lib/api/mesh.js +25 -0
- package/dist-lib/lib/api/model-download.d.ts +5 -0
- package/dist-lib/lib/api/model-download.js +47 -0
- package/dist-lib/lib/api/network.d.ts +8 -0
- package/dist-lib/lib/api/network.js +6 -0
- package/dist-lib/lib/api/notifications.d.ts +21 -0
- package/dist-lib/lib/api/notifications.js +108 -0
- package/dist-lib/lib/api/rag.d.ts +7 -0
- package/dist-lib/lib/api/rag.js +216 -0
- package/dist-lib/lib/api/sync.d.ts +3 -0
- package/dist-lib/lib/api/sync.js +6 -0
- package/dist-lib/lib/api/tool-activity.d.ts +5 -0
- package/dist-lib/lib/api/tool-activity.js +53 -0
- package/dist-lib/lib/api/tool-configs.d.ts +6 -0
- package/dist-lib/lib/api/tool-configs.js +27 -0
- package/dist-lib/lib/api/watchable.d.ts +12 -0
- package/dist-lib/lib/api/watchable.js +121 -0
- package/dist-lib/lib/assistant-client.d.ts +21 -0
- package/dist-lib/lib/assistant-client.js +52 -0
- package/dist-lib/lib/assistant-tree.d.ts +50 -0
- package/dist-lib/lib/assistant-tree.js +184 -0
- package/dist-lib/lib/assistant.d.ts +425 -0
- package/dist-lib/lib/assistant.js +2706 -0
- package/dist-lib/lib/audio-format.d.ts +4 -0
- package/dist-lib/lib/audio-format.js +4 -0
- package/dist-lib/lib/chat-title.d.ts +5 -0
- package/dist-lib/lib/chat-title.js +58 -0
- package/dist-lib/lib/client.d.ts +25 -0
- package/dist-lib/lib/client.js +53 -0
- package/dist-lib/lib/collabora/convert.d.ts +9 -0
- package/dist-lib/lib/collabora/convert.js +62 -0
- package/dist-lib/lib/collabora/entry.d.ts +1 -0
- package/dist-lib/lib/collabora/entry.js +44 -0
- package/dist-lib/lib/collabora/protocol.d.ts +15 -0
- package/dist-lib/lib/collabora/protocol.js +24 -0
- package/dist-lib/lib/collabora/worker.d.ts +5 -0
- package/dist-lib/lib/collabora/worker.js +111 -0
- package/dist-lib/lib/compaction.d.ts +30 -0
- package/dist-lib/lib/compaction.js +95 -0
- package/dist-lib/lib/constants.d.ts +4 -0
- package/dist-lib/lib/constants.js +4 -0
- package/dist-lib/lib/core/agent.d.ts +15 -0
- package/dist-lib/lib/core/agent.js +149 -0
- package/dist-lib/lib/core/app-build.d.ts +7 -0
- package/dist-lib/lib/core/app-build.js +1 -0
- package/dist-lib/lib/core/approval-rules.d.ts +15 -0
- package/dist-lib/lib/core/approval-rules.js +41 -0
- package/dist-lib/lib/core/async-iterable.d.ts +13 -0
- package/dist-lib/lib/core/async-iterable.js +65 -0
- package/dist-lib/lib/core/attachment-link.d.ts +7 -0
- package/dist-lib/lib/core/attachment-link.js +6 -0
- package/dist-lib/lib/core/audio-attachment.d.ts +1 -0
- package/dist-lib/lib/core/audio-attachment.js +4 -0
- package/dist-lib/lib/core/blind-peers.d.ts +6 -0
- package/dist-lib/lib/core/blind-peers.js +13 -0
- package/dist-lib/lib/core/chat-activity.d.ts +7 -0
- package/dist-lib/lib/core/chat-activity.js +244 -0
- package/dist-lib/lib/core/chat-group.d.ts +14 -0
- package/dist-lib/lib/core/chat-group.js +79 -0
- package/dist-lib/lib/core/chat-search.d.ts +17 -0
- package/dist-lib/lib/core/chat-search.js +199 -0
- package/dist-lib/lib/core/chat.d.ts +37 -0
- package/dist-lib/lib/core/chat.js +196 -0
- package/dist-lib/lib/core/chunk.d.ts +61 -0
- package/dist-lib/lib/core/chunk.js +212 -0
- package/dist-lib/lib/core/contract/activity.d.ts +11 -0
- package/dist-lib/lib/core/contract/activity.js +45 -0
- package/dist-lib/lib/core/contract/agents.d.ts +2 -0
- package/dist-lib/lib/core/contract/agents.js +29 -0
- package/dist-lib/lib/core/contract/approval-rules.d.ts +2 -0
- package/dist-lib/lib/core/contract/approval-rules.js +14 -0
- package/dist-lib/lib/core/contract/attestations.d.ts +2 -0
- package/dist-lib/lib/core/contract/attestations.js +14 -0
- package/dist-lib/lib/core/contract/chat-group.d.ts +2 -0
- package/dist-lib/lib/core/contract/chat-group.js +20 -0
- package/dist-lib/lib/core/contract/chat.d.ts +2 -0
- package/dist-lib/lib/core/contract/chat.js +18 -0
- package/dist-lib/lib/core/contract/chunks.d.ts +2 -0
- package/dist-lib/lib/core/contract/chunks.js +156 -0
- package/dist-lib/lib/core/contract/devices.d.ts +2 -0
- package/dist-lib/lib/core/contract/devices.js +110 -0
- package/dist-lib/lib/core/contract/index.d.ts +2 -0
- package/dist-lib/lib/core/contract/index.js +30 -0
- package/dist-lib/lib/core/contract/indexing.d.ts +4 -0
- package/dist-lib/lib/core/contract/indexing.js +82 -0
- package/dist-lib/lib/core/contract/knowledge.d.ts +2 -0
- package/dist-lib/lib/core/contract/knowledge.js +55 -0
- package/dist-lib/lib/core/contract/members.d.ts +2 -0
- package/dist-lib/lib/core/contract/members.js +96 -0
- package/dist-lib/lib/core/contract/seed-defaults.d.ts +2 -0
- package/dist-lib/lib/core/contract/seed-defaults.js +29 -0
- package/dist-lib/lib/core/contract/tool-activity.d.ts +2 -0
- package/dist-lib/lib/core/contract/tool-activity.js +25 -0
- package/dist-lib/lib/core/contract/tool-configs.d.ts +2 -0
- package/dist-lib/lib/core/contract/tool-configs.js +50 -0
- package/dist-lib/lib/core/contract/types.d.ts +11 -0
- package/dist-lib/lib/core/contract/types.js +1 -0
- package/dist-lib/lib/core/contract/writers.d.ts +2 -0
- package/dist-lib/lib/core/contract/writers.js +112 -0
- package/dist-lib/lib/core/cpu-info-node.d.ts +3 -0
- package/dist-lib/lib/core/cpu-info-node.js +2 -0
- package/dist-lib/lib/core/departures.d.ts +41 -0
- package/dist-lib/lib/core/departures.js +145 -0
- package/dist-lib/lib/core/device-attestation.d.ts +6 -0
- package/dist-lib/lib/core/device-attestation.js +12 -0
- package/dist-lib/lib/core/devices.d.ts +14 -0
- package/dist-lib/lib/core/devices.js +11 -0
- package/dist-lib/lib/core/document-attachment.d.ts +22 -0
- package/dist-lib/lib/core/document-attachment.js +35 -0
- package/dist-lib/lib/core/files/attachments.d.ts +8 -0
- package/dist-lib/lib/core/files/attachments.js +50 -0
- package/dist-lib/lib/core/files/index.d.ts +133 -0
- package/dist-lib/lib/core/files/index.js +585 -0
- package/dist-lib/lib/core/files/knowledge.d.ts +9 -0
- package/dist-lib/lib/core/files/knowledge.js +31 -0
- package/dist-lib/lib/core/files/preview/image.d.ts +4 -0
- package/dist-lib/lib/core/files/preview/image.js +42 -0
- package/dist-lib/lib/core/files/preview/index.d.ts +33 -0
- package/dist-lib/lib/core/files/preview/index.js +161 -0
- package/dist-lib/lib/core/files/processing/claims.d.ts +26 -0
- package/dist-lib/lib/core/files/processing/claims.js +89 -0
- package/dist-lib/lib/core/files/processing/document.d.ts +100 -0
- package/dist-lib/lib/core/files/processing/document.js +101 -0
- package/dist-lib/lib/core/files/processing/index.d.ts +75 -0
- package/dist-lib/lib/core/files/processing/index.js +295 -0
- package/dist-lib/lib/core/files/processing/ownership.d.ts +11 -0
- package/dist-lib/lib/core/files/processing/ownership.js +41 -0
- package/dist-lib/lib/core/files/processing/protocol.d.ts +29 -0
- package/dist-lib/lib/core/files/processing/protocol.js +70 -0
- package/dist-lib/lib/core/files/processing/settle.d.ts +10 -0
- package/dist-lib/lib/core/files/processing/settle.js +75 -0
- package/dist-lib/lib/core/files/processing/source.d.ts +36 -0
- package/dist-lib/lib/core/files/processing/source.js +96 -0
- package/dist-lib/lib/core/files/processing/state.d.ts +64 -0
- package/dist-lib/lib/core/files/processing/state.js +118 -0
- package/dist-lib/lib/core/files/rag/artifact/codec.d.ts +3 -0
- package/dist-lib/lib/core/files/rag/artifact/codec.js +172 -0
- package/dist-lib/lib/core/files/rag/artifact/id.d.ts +10 -0
- package/dist-lib/lib/core/files/rag/artifact/id.js +39 -0
- package/dist-lib/lib/core/files/rag/artifact/types.d.ts +24 -0
- package/dist-lib/lib/core/files/rag/artifact/types.js +41 -0
- package/dist-lib/lib/core/files/rag/build.d.ts +25 -0
- package/dist-lib/lib/core/files/rag/build.js +60 -0
- package/dist-lib/lib/core/files/rag/chunk/chunking.d.ts +12 -0
- package/dist-lib/lib/core/files/rag/chunk/chunking.js +117 -0
- package/dist-lib/lib/core/files/rag/chunk/metadata.d.ts +30 -0
- package/dist-lib/lib/core/files/rag/chunk/metadata.js +89 -0
- package/dist-lib/lib/core/files/rag/chunk/tokenizer.d.ts +7 -0
- package/dist-lib/lib/core/files/rag/chunk/tokenizer.js +18 -0
- package/dist-lib/lib/core/files/rag/document-types.d.ts +11 -0
- package/dist-lib/lib/core/files/rag/document-types.js +94 -0
- package/dist-lib/lib/core/files/rag/extract/csv-text.d.ts +1 -0
- package/dist-lib/lib/core/files/rag/extract/csv-text.js +117 -0
- package/dist-lib/lib/core/files/rag/extract/document-types.d.ts +22 -0
- package/dist-lib/lib/core/files/rag/extract/document-types.js +152 -0
- package/dist-lib/lib/core/files/rag/extract/extract.d.ts +17 -0
- package/dist-lib/lib/core/files/rag/extract/extract.js +81 -0
- package/dist-lib/lib/core/files/rag/extract/html-table-text.d.ts +1 -0
- package/dist-lib/lib/core/files/rag/extract/html-table-text.js +125 -0
- package/dist-lib/lib/core/files/rag/extract/html-text.d.ts +1 -0
- package/dist-lib/lib/core/files/rag/extract/html-text.js +132 -0
- package/dist-lib/lib/core/files/rag/extract/office-collabora.d.ts +2 -0
- package/dist-lib/lib/core/files/rag/extract/office-collabora.js +8 -0
- package/dist-lib/lib/core/files/rag/extract/pdf-platform.d.ts +17 -0
- package/dist-lib/lib/core/files/rag/extract/pdf-platform.js +141 -0
- package/dist-lib/lib/core/files/rag/extract/pdf-text.d.ts +12 -0
- package/dist-lib/lib/core/files/rag/extract/pdf-text.js +43 -0
- package/dist-lib/lib/core/files/rag/extract/rtf-text.d.ts +1 -0
- package/dist-lib/lib/core/files/rag/extract/rtf-text.js +15 -0
- package/dist-lib/lib/core/files/rag/extract/text-decoding.d.ts +1 -0
- package/dist-lib/lib/core/files/rag/extract/text-decoding.js +91 -0
- package/dist-lib/lib/core/files/rag/extract/types.d.ts +36 -0
- package/dist-lib/lib/core/files/rag/extract/types.js +12 -0
- package/dist-lib/lib/core/files/rag/extract/utf.d.ts +2 -0
- package/dist-lib/lib/core/files/rag/extract/utf.js +18 -0
- package/dist-lib/lib/core/files/rag/index.d.ts +54 -0
- package/dist-lib/lib/core/files/rag/index.js +79 -0
- package/dist-lib/lib/core/files/rag/limits.d.ts +2 -0
- package/dist-lib/lib/core/files/rag/limits.js +2 -0
- package/dist-lib/lib/core/files/rag/load.d.ts +28 -0
- package/dist-lib/lib/core/files/rag/load.js +250 -0
- package/dist-lib/lib/core/files/rag/models.d.ts +1 -0
- package/dist-lib/lib/core/files/rag/models.js +1 -0
- package/dist-lib/lib/core/files/rag/policy.d.ts +2 -0
- package/dist-lib/lib/core/files/rag/policy.js +23 -0
- package/dist-lib/lib/core/files/rag/produce.d.ts +21 -0
- package/dist-lib/lib/core/files/rag/produce.js +214 -0
- package/dist-lib/lib/core/files/rag/retrieval/citation-match.d.ts +2 -0
- package/dist-lib/lib/core/files/rag/retrieval/citation-match.js +16 -0
- package/dist-lib/lib/core/files/rag/retrieval/coverage.d.ts +4 -0
- package/dist-lib/lib/core/files/rag/retrieval/coverage.js +48 -0
- package/dist-lib/lib/core/files/rag/retrieval/diversity.d.ts +10 -0
- package/dist-lib/lib/core/files/rag/retrieval/diversity.js +37 -0
- package/dist-lib/lib/core/files/rag/retrieval/floor.d.ts +5 -0
- package/dist-lib/lib/core/files/rag/retrieval/floor.js +21 -0
- package/dist-lib/lib/core/files/rag/retrieval/format.d.ts +6 -0
- package/dist-lib/lib/core/files/rag/retrieval/format.js +21 -0
- package/dist-lib/lib/core/files/rag/retrieval/full-text.d.ts +22 -0
- package/dist-lib/lib/core/files/rag/retrieval/full-text.js +137 -0
- package/dist-lib/lib/core/files/rag/retrieval/knowledge.d.ts +2 -0
- package/dist-lib/lib/core/files/rag/retrieval/knowledge.js +53 -0
- package/dist-lib/lib/core/files/rag/retrieval/notices.d.ts +16 -0
- package/dist-lib/lib/core/files/rag/retrieval/notices.js +27 -0
- package/dist-lib/lib/core/files/rag/retrieval/scoring.d.ts +8 -0
- package/dist-lib/lib/core/files/rag/retrieval/scoring.js +82 -0
- package/dist-lib/lib/core/files/rag/retrieval/search.d.ts +3 -0
- package/dist-lib/lib/core/files/rag/retrieval/search.js +46 -0
- package/dist-lib/lib/core/files/rag/retrieval/selection.d.ts +10 -0
- package/dist-lib/lib/core/files/rag/retrieval/selection.js +63 -0
- package/dist-lib/lib/core/files/rag/retrieval/source-tag-filter.d.ts +6 -0
- package/dist-lib/lib/core/files/rag/retrieval/source-tag-filter.js +79 -0
- package/dist-lib/lib/core/files/rag/retrieval/sources.d.ts +13 -0
- package/dist-lib/lib/core/files/rag/retrieval/sources.js +20 -0
- package/dist-lib/lib/core/files/rag/retrieval/target.d.ts +13 -0
- package/dist-lib/lib/core/files/rag/retrieval/target.js +89 -0
- package/dist-lib/lib/core/files/rag/retrieval/terms.d.ts +8 -0
- package/dist-lib/lib/core/files/rag/retrieval/terms.js +70 -0
- package/dist-lib/lib/core/files/rag/retrieval/types.d.ts +28 -0
- package/dist-lib/lib/core/files/rag/retrieval/types.js +1 -0
- package/dist-lib/lib/core/files/rag/retrieval/web-sources.d.ts +8 -0
- package/dist-lib/lib/core/files/rag/retrieval/web-sources.js +41 -0
- package/dist-lib/lib/core/files/rag/retrieval/whole-document-query.d.ts +1 -0
- package/dist-lib/lib/core/files/rag/retrieval/whole-document-query.js +96 -0
- package/dist-lib/lib/core/files/rag/vector/memory.d.ts +15 -0
- package/dist-lib/lib/core/files/rag/vector/memory.js +135 -0
- package/dist-lib/lib/core/files/rag/vector/types.d.ts +28 -0
- package/dist-lib/lib/core/files/rag/vector/types.js +1 -0
- package/dist-lib/lib/core/files/records/chunks.d.ts +3 -0
- package/dist-lib/lib/core/files/records/chunks.js +12 -0
- package/dist-lib/lib/core/files/records/index.d.ts +10 -0
- package/dist-lib/lib/core/files/records/index.js +8 -0
- package/dist-lib/lib/core/files/records/knowledge.d.ts +22 -0
- package/dist-lib/lib/core/files/records/knowledge.js +105 -0
- package/dist-lib/lib/core/files/records/linkage.d.ts +11 -0
- package/dist-lib/lib/core/files/records/linkage.js +27 -0
- package/dist-lib/lib/core/files/records/output.d.ts +8 -0
- package/dist-lib/lib/core/files/records/output.js +38 -0
- package/dist-lib/lib/core/files/records/reclaim.d.ts +5 -0
- package/dist-lib/lib/core/files/records/reclaim.js +73 -0
- package/dist-lib/lib/core/files/records/routing.d.ts +23 -0
- package/dist-lib/lib/core/files/records/routing.js +62 -0
- package/dist-lib/lib/core/files/records/source.d.ts +16 -0
- package/dist-lib/lib/core/files/records/source.js +70 -0
- package/dist-lib/lib/core/files/records/sweep.d.ts +2 -0
- package/dist-lib/lib/core/files/records/sweep.js +30 -0
- package/dist-lib/lib/core/files/store/blob.d.ts +29 -0
- package/dist-lib/lib/core/files/store/blob.js +98 -0
- package/dist-lib/lib/core/files/store/index.d.ts +36 -0
- package/dist-lib/lib/core/files/store/index.js +89 -0
- package/dist-lib/lib/core/files/store/inline.d.ts +8 -0
- package/dist-lib/lib/core/files/store/inline.js +38 -0
- package/dist-lib/lib/core/files/store/reference.d.ts +27 -0
- package/dist-lib/lib/core/files/store/reference.js +168 -0
- package/dist-lib/lib/core/files/store/server.d.ts +27 -0
- package/dist-lib/lib/core/files/store/server.js +114 -0
- package/dist-lib/lib/core/files/store/sweep.d.ts +2 -0
- package/dist-lib/lib/core/files/store/sweep.js +45 -0
- package/dist-lib/lib/core/files/upload-input.d.ts +27 -0
- package/dist-lib/lib/core/files/upload-input.js +52 -0
- package/dist-lib/lib/core/files/upload.d.ts +32 -0
- package/dist-lib/lib/core/files/upload.js +201 -0
- package/dist-lib/lib/core/fs-drives.d.ts +18 -0
- package/dist-lib/lib/core/fs-drives.js +58 -0
- package/dist-lib/lib/core/gpu-info-node.d.ts +3 -0
- package/dist-lib/lib/core/gpu-info-node.js +2 -0
- package/dist-lib/lib/core/handoff-channel.d.ts +46 -0
- package/dist-lib/lib/core/handoff-channel.js +102 -0
- package/dist-lib/lib/core/health-assistant.d.ts +7 -0
- package/dist-lib/lib/core/health-assistant.js +24 -0
- package/dist-lib/lib/core/helpers/index.d.ts +5 -0
- package/dist-lib/lib/core/helpers/index.js +74 -0
- package/dist-lib/lib/core/hosted-agents.d.ts +36 -0
- package/dist-lib/lib/core/hosted-agents.js +127 -0
- package/dist-lib/lib/core/id.d.ts +1 -0
- package/dist-lib/lib/core/id.js +5 -0
- package/dist-lib/lib/core/identity.d.ts +14 -0
- package/dist-lib/lib/core/identity.js +45 -0
- package/dist-lib/lib/core/image/cache-sweep.d.ts +12 -0
- package/dist-lib/lib/core/image/cache-sweep.js +67 -0
- package/dist-lib/lib/core/image/normalize.d.ts +3 -0
- package/dist-lib/lib/core/image/normalize.js +49 -0
- package/dist-lib/lib/core/image/sniff.d.ts +3 -0
- package/dist-lib/lib/core/image/sniff.js +149 -0
- package/dist-lib/lib/core/invite.d.ts +14 -0
- package/dist-lib/lib/core/invite.js +36 -0
- package/dist-lib/lib/core/local/index.d.ts +71 -0
- package/dist-lib/lib/core/local/index.js +391 -0
- package/dist-lib/lib/core/membership.d.ts +15 -0
- package/dist-lib/lib/core/membership.js +40 -0
- package/dist-lib/lib/core/mesh.d.ts +153 -0
- package/dist-lib/lib/core/mesh.js +509 -0
- package/dist-lib/lib/core/migrations/agent-catalog.d.ts +6 -0
- package/dist-lib/lib/core/migrations/agent-catalog.js +17 -0
- package/dist-lib/lib/core/migrations/index.d.ts +5 -0
- package/dist-lib/lib/core/migrations/index.js +7 -0
- package/dist-lib/lib/core/migrations/membership.d.ts +11 -0
- package/dist-lib/lib/core/migrations/membership.js +26 -0
- package/dist-lib/lib/core/min-version.d.ts +6 -0
- package/dist-lib/lib/core/min-version.js +31 -0
- package/dist-lib/lib/core/next-frame.d.ts +6 -0
- package/dist-lib/lib/core/next-frame.js +27 -0
- package/dist-lib/lib/core/notification.d.ts +6 -0
- package/dist-lib/lib/core/notification.js +162 -0
- package/dist-lib/lib/core/ota-config.d.ts +19 -0
- package/dist-lib/lib/core/ota-config.js +44 -0
- package/dist-lib/lib/core/prompt-history.d.ts +12 -0
- package/dist-lib/lib/core/prompt-history.js +40 -0
- package/dist-lib/lib/core/search-fold.d.ts +1 -0
- package/dist-lib/lib/core/search-fold.js +4 -0
- package/dist-lib/lib/core/secret-handoff.d.ts +17 -0
- package/dist-lib/lib/core/secret-handoff.js +29 -0
- package/dist-lib/lib/core/send.d.ts +18 -0
- package/dist-lib/lib/core/send.js +46 -0
- package/dist-lib/lib/core/skill-overlay-handoff.d.ts +25 -0
- package/dist-lib/lib/core/skill-overlay-handoff.js +50 -0
- package/dist-lib/lib/core/skill-overlay-receiver.d.ts +8 -0
- package/dist-lib/lib/core/skill-overlay-receiver.js +20 -0
- package/dist-lib/lib/core/skill-secrets.d.ts +25 -0
- package/dist-lib/lib/core/skill-secrets.js +79 -0
- package/dist-lib/lib/core/sync/chats.d.ts +3 -0
- package/dist-lib/lib/core/sync/chats.js +5 -0
- package/dist-lib/lib/core/sync/chunks.d.ts +9 -0
- package/dist-lib/lib/core/sync/chunks.js +16 -0
- package/dist-lib/lib/core/sync/devices.d.ts +4 -0
- package/dist-lib/lib/core/sync/devices.js +12 -0
- package/dist-lib/lib/core/sync/files.d.ts +16 -0
- package/dist-lib/lib/core/sync/files.js +109 -0
- package/dist-lib/lib/core/sync/index.d.ts +5 -0
- package/dist-lib/lib/core/sync/index.js +63 -0
- package/dist-lib/lib/core/sync-status.d.ts +17 -0
- package/dist-lib/lib/core/sync-status.js +129 -0
- package/dist-lib/lib/core/system-info.d.ts +24 -0
- package/dist-lib/lib/core/system-info.js +66 -0
- package/dist-lib/lib/core/tool-activity.d.ts +22 -0
- package/dist-lib/lib/core/tool-activity.js +39 -0
- package/dist-lib/lib/core/tool-configs.d.ts +13 -0
- package/dist-lib/lib/core/tool-configs.js +141 -0
- package/dist-lib/lib/core.d.ts +291 -0
- package/dist-lib/lib/core.js +2126 -0
- package/dist-lib/lib/credential-pusher.d.ts +67 -0
- package/dist-lib/lib/credential-pusher.js +290 -0
- package/dist-lib/lib/custom-model-pusher.d.ts +9 -0
- package/dist-lib/lib/custom-model-pusher.js +42 -0
- package/dist-lib/lib/custom-model-source.d.ts +15 -0
- package/dist-lib/lib/custom-model-source.js +46 -0
- package/dist-lib/lib/deadline.d.ts +9 -0
- package/dist-lib/lib/deadline.js +31 -0
- package/dist-lib/lib/diagnostics.d.ts +35 -0
- package/dist-lib/lib/diagnostics.js +14 -0
- package/dist-lib/lib/fetch-node.d.ts +1 -0
- package/dist-lib/lib/fetch-node.js +1 -0
- package/dist-lib/lib/fs-drive-bridge.d.ts +12 -0
- package/dist-lib/lib/fs-drive-bridge.js +186 -0
- package/dist-lib/lib/fs-grant-keys.d.ts +2 -0
- package/dist-lib/lib/fs-grant-keys.js +6 -0
- package/dist-lib/lib/fs-grants.d.ts +10 -0
- package/dist-lib/lib/fs-grants.js +44 -0
- package/dist-lib/lib/image-cache-dir.d.ts +1 -0
- package/dist-lib/lib/image-cache-dir.js +5 -0
- package/dist-lib/lib/integrations/index.d.ts +4 -0
- package/dist-lib/lib/integrations/index.js +3 -0
- package/dist-lib/lib/integrations/mcp-providers.d.ts +12 -0
- package/dist-lib/lib/integrations/mcp-providers.js +22 -0
- package/dist-lib/lib/integrations/oauth-providers.d.ts +14 -0
- package/dist-lib/lib/integrations/oauth-providers.js +116 -0
- package/dist-lib/lib/integrations/setup-routes.d.ts +12 -0
- package/dist-lib/lib/integrations/setup-routes.js +114 -0
- package/dist-lib/lib/knowledge-search.d.ts +7 -0
- package/dist-lib/lib/knowledge-search.js +53 -0
- package/dist-lib/lib/kv-cache-reclaim.d.ts +5 -0
- package/dist-lib/lib/kv-cache-reclaim.js +29 -0
- package/dist-lib/lib/kv-cache.d.ts +18 -0
- package/dist-lib/lib/kv-cache.js +33 -0
- package/dist-lib/lib/legacy-core-domain.d.ts +258 -0
- package/dist-lib/lib/legacy-core-domain.js +1 -0
- package/dist-lib/lib/llm-model-names.d.ts +1 -0
- package/dist-lib/lib/llm-model-names.js +1 -0
- package/dist-lib/lib/log-buffer.d.ts +7 -0
- package/dist-lib/lib/log-buffer.js +16 -0
- package/dist-lib/lib/log-levels.d.ts +7 -0
- package/dist-lib/lib/log-levels.js +1 -0
- package/dist-lib/lib/log.d.ts +60 -0
- package/dist-lib/lib/log.js +149 -0
- package/dist-lib/lib/logger-type.d.ts +13 -0
- package/dist-lib/lib/logger-type.js +1 -0
- package/dist-lib/lib/logger.d.ts +5 -0
- package/dist-lib/lib/logger.js +18 -0
- package/dist-lib/lib/model-catalog-revision.d.ts +9 -0
- package/dist-lib/lib/model-catalog-revision.js +65 -0
- package/dist-lib/lib/model-clamp.d.ts +6 -0
- package/dist-lib/lib/model-clamp.js +20 -0
- package/dist-lib/lib/model-context.d.ts +13 -0
- package/dist-lib/lib/model-context.js +71 -0
- package/dist-lib/lib/model-download-status.d.ts +29 -0
- package/dist-lib/lib/model-download-status.js +56 -0
- package/dist-lib/lib/model-download.d.ts +191 -0
- package/dist-lib/lib/model-download.js +787 -0
- package/dist-lib/lib/oauth/asana.d.ts +35 -0
- package/dist-lib/lib/oauth/asana.js +71 -0
- package/dist-lib/lib/oauth/browser-connect.d.ts +22 -0
- package/dist-lib/lib/oauth/browser-connect.js +83 -0
- package/dist-lib/lib/oauth/client.d.ts +9 -0
- package/dist-lib/lib/oauth/client.js +9 -0
- package/dist-lib/lib/oauth/common.d.ts +38 -0
- package/dist-lib/lib/oauth/common.js +36 -0
- package/dist-lib/lib/oauth/crypto.d.ts +3 -0
- package/dist-lib/lib/oauth/crypto.js +25 -0
- package/dist-lib/lib/oauth/fetch-platform.d.ts +1 -0
- package/dist-lib/lib/oauth/fetch-platform.js +1 -0
- package/dist-lib/lib/oauth/flow-core.d.ts +6 -0
- package/dist-lib/lib/oauth/flow-core.js +37 -0
- package/dist-lib/lib/oauth/flow.d.ts +3 -0
- package/dist-lib/lib/oauth/flow.js +24 -0
- package/dist-lib/lib/oauth/google.d.ts +37 -0
- package/dist-lib/lib/oauth/google.js +77 -0
- package/dist-lib/lib/oauth/host.d.ts +5 -0
- package/dist-lib/lib/oauth/host.js +3 -0
- package/dist-lib/lib/oauth/keys.d.ts +25 -0
- package/dist-lib/lib/oauth/keys.js +93 -0
- package/dist-lib/lib/oauth/loopback.d.ts +3 -0
- package/dist-lib/lib/oauth/loopback.js +119 -0
- package/dist-lib/lib/oauth/loopback.stub.d.ts +3 -0
- package/dist-lib/lib/oauth/loopback.stub.js +6 -0
- package/dist-lib/lib/oauth/notion.d.ts +34 -0
- package/dist-lib/lib/oauth/notion.js +82 -0
- package/dist-lib/lib/oauth/pkce-runtime.d.ts +3 -0
- package/dist-lib/lib/oauth/pkce-runtime.js +5 -0
- package/dist-lib/lib/oauth/pkce.d.ts +8 -0
- package/dist-lib/lib/oauth/pkce.js +6 -0
- package/dist-lib/lib/oauth/providers.d.ts +5 -0
- package/dist-lib/lib/oauth/providers.js +73 -0
- package/dist-lib/lib/oauth/redirect-types.d.ts +19 -0
- package/dist-lib/lib/oauth/redirect-types.js +1 -0
- package/dist-lib/lib/oauth/register.d.ts +3 -0
- package/dist-lib/lib/oauth/register.js +34 -0
- package/dist-lib/lib/oauth/resolve.d.ts +17 -0
- package/dist-lib/lib/oauth/resolve.js +57 -0
- package/dist-lib/lib/oauth/spotify.d.ts +32 -0
- package/dist-lib/lib/oauth/spotify.js +73 -0
- package/dist-lib/lib/oauth/token-exchange-core.d.ts +6 -0
- package/dist-lib/lib/oauth/token-exchange-core.js +97 -0
- package/dist-lib/lib/oauth/token-exchange.d.ts +5 -0
- package/dist-lib/lib/oauth/token-exchange.js +9 -0
- package/dist-lib/lib/oauth/types.d.ts +54 -0
- package/dist-lib/lib/oauth/types.js +1 -0
- package/dist-lib/lib/oauth.client.d.ts +5 -0
- package/dist-lib/lib/oauth.client.js +2 -0
- package/dist-lib/lib/oauth.d.ts +14 -0
- package/dist-lib/lib/oauth.js +12 -0
- package/dist-lib/lib/obsidian-key.d.ts +1 -0
- package/dist-lib/lib/obsidian-key.js +1 -0
- package/dist-lib/lib/race-resource.d.ts +5 -0
- package/dist-lib/lib/race-resource.js +25 -0
- package/dist-lib/lib/reconnecting-watch.d.ts +2 -0
- package/dist-lib/lib/reconnecting-watch.js +78 -0
- package/dist-lib/lib/retry-budget.d.ts +14 -0
- package/dist-lib/lib/retry-budget.js +39 -0
- package/dist-lib/lib/run-notices.d.ts +23 -0
- package/dist-lib/lib/run-notices.js +33 -0
- package/dist-lib/lib/run-transcript.d.ts +35 -0
- package/dist-lib/lib/run-transcript.js +106 -0
- package/dist-lib/lib/skill-readiness.d.ts +2 -0
- package/dist-lib/lib/skill-readiness.js +21 -0
- package/dist-lib/lib/skill-types.d.ts +70 -0
- package/dist-lib/lib/skill-types.js +1 -0
- package/dist-lib/lib/spec-loader.d.ts +14 -0
- package/dist-lib/lib/spec-loader.js +9 -0
- package/dist-lib/lib/suspend-lifecycle.d.ts +17 -0
- package/dist-lib/lib/suspend-lifecycle.js +33 -0
- package/dist-lib/lib/task.d.ts +26 -0
- package/dist-lib/lib/task.js +69 -0
- package/dist-lib/lib/unref.d.ts +3 -0
- package/dist-lib/lib/unref.js +4 -0
- package/dist-lib/lib/wav-duration.d.ts +1 -0
- package/dist-lib/lib/wav-duration.js +53 -0
- package/dist-lib/lib/write-queue.d.ts +22 -0
- package/dist-lib/lib/write-queue.js +39 -0
- package/dist-lib/schema/build.d.ts +1 -0
- package/dist-lib/schema/build.js +120 -0
- package/dist-lib/schema/config.d.ts +4 -0
- package/dist-lib/schema/config.js +7 -0
- package/dist-lib/schema/content.d.ts +20 -0
- package/dist-lib/schema/content.js +122 -0
- package/dist-lib/schema/engine.d.ts +2 -0
- package/dist-lib/schema/engine.js +2013 -0
- package/dist-lib/schema/field-order.d.ts +1 -0
- package/dist-lib/schema/field-order.js +95 -0
- package/dist-lib/schema/local.d.ts +2 -0
- package/dist-lib/schema/local.js +133 -0
- package/dist-lib/schema/qvac.d.ts +22 -0
- package/dist-lib/schema/qvac.js +722 -0
- package/dist-lib/spec/bind.d.ts +2 -0
- package/dist-lib/spec/bind.js +520 -0
- package/dist-lib/spec/calls.d.ts +3 -0
- package/dist-lib/spec/calls.js +129 -0
- package/dist-lib/spec/capabilities.d.ts +263 -0
- package/dist-lib/spec/config/hyperconf/index.d.ts +15 -0
- package/dist-lib/spec/config/hyperconf/index.js +24 -0
- package/dist-lib/spec/config/hyperconf/package.json +3 -0
- package/dist-lib/spec/config/hyperschema/index.js +81 -0
- package/dist-lib/spec/config/hyperschema/schema.json +19 -0
- package/dist-lib/spec/hrpc/hrpc.json +1500 -0
- package/dist-lib/spec/hrpc/index.d.ts +3 -0
- package/dist-lib/spec/hrpc/index.js +1545 -0
- package/dist-lib/spec/hrpc/messages.d.ts +4 -0
- package/dist-lib/spec/hrpc/messages.js +8373 -0
- package/dist-lib/spec/hyperschema/index.d.ts +20 -0
- package/dist-lib/spec/hyperschema/index.js +8373 -0
- package/dist-lib/spec/hyperschema/schema.json +6202 -0
- package/dist-lib/spec/hyperschema/types.d.ts +1545 -0
- package/dist-lib/spec/index.d.ts +36 -0
- package/dist-lib/spec/index.js +6 -0
- package/dist-lib/spec/local/hyperdb/db.json +186 -0
- package/dist-lib/spec/local/hyperdb/index.d.ts +9 -0
- package/dist-lib/spec/local/hyperdb/index.js +855 -0
- package/dist-lib/spec/local/hyperdb/messages.js +2189 -0
- package/dist-lib/spec/local/hyperschema/index.js +1208 -0
- package/dist-lib/spec/local/hyperschema/schema.json +639 -0
- package/dist-lib/spec/local/hyperschema/types.d.ts +159 -0
- package/dist-lib/spec/mesh/hyperdb/db.json +702 -0
- package/dist-lib/spec/mesh/hyperdb/index.d.ts +9 -0
- package/dist-lib/spec/mesh/hyperdb/index.js +2260 -0
- package/dist-lib/spec/mesh/hyperdb/messages.js +7453 -0
- package/dist-lib/spec/mesh/hyperdispatch/dispatch.json +174 -0
- package/dist-lib/spec/mesh/hyperdispatch/index.d.ts +13 -0
- package/dist-lib/spec/mesh/hyperdispatch/index.js +566 -0
- package/dist-lib/spec/mesh/hyperdispatch/messages.js +5713 -0
- package/dist-lib/spec/mesh/hyperschema/index.d.ts +14 -0
- package/dist-lib/spec/mesh/hyperschema/index.js +5713 -0
- package/dist-lib/spec/mesh/hyperschema/schema.json +3142 -0
- package/dist-lib/spec/mesh/hyperschema/types.d.ts +754 -0
- package/ducks.png +0 -0
- package/package.json +332 -1
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import b4a from 'b4a';
|
|
2
|
+
import Protomux, {} from 'protomux';
|
|
3
|
+
export const HOST_UNREACHABLE = 'the device hosting this agent is not connected';
|
|
4
|
+
export const HOST_SILENT = 'the device hosting this agent did not answer';
|
|
5
|
+
export const ACK_TIMEOUT_MS = 60_000;
|
|
6
|
+
export class HandoffChannel {
|
|
7
|
+
_opts;
|
|
8
|
+
_ackTimeoutMs;
|
|
9
|
+
_peers;
|
|
10
|
+
_waiters;
|
|
11
|
+
_nextId;
|
|
12
|
+
constructor(opts) {
|
|
13
|
+
this._opts = opts;
|
|
14
|
+
this._ackTimeoutMs = opts.ackTimeoutMs ?? ACK_TIMEOUT_MS;
|
|
15
|
+
this._peers = new Map();
|
|
16
|
+
this._waiters = new Map();
|
|
17
|
+
this._nextId = 0;
|
|
18
|
+
}
|
|
19
|
+
addStream(stream) {
|
|
20
|
+
const deviceId = b4a.toString(stream.remotePublicKey, 'hex');
|
|
21
|
+
if (this._peers.has(deviceId))
|
|
22
|
+
return;
|
|
23
|
+
const channel = Protomux.from(stream.noiseStream).createChannel({
|
|
24
|
+
protocol: this._opts.protocol,
|
|
25
|
+
onclose: () => {
|
|
26
|
+
if (channel)
|
|
27
|
+
this._drop(deviceId, channel);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
if (!channel)
|
|
31
|
+
return;
|
|
32
|
+
const requests = channel.addMessage({
|
|
33
|
+
encoding: this._opts.requestEncoding,
|
|
34
|
+
onmessage: (m) => void this._serve(deviceId, m)
|
|
35
|
+
});
|
|
36
|
+
const responses = channel.addMessage({
|
|
37
|
+
encoding: this._opts.ackEncoding,
|
|
38
|
+
onmessage: (m) => this._settle(deviceId, m)
|
|
39
|
+
});
|
|
40
|
+
this._peers.set(deviceId, { channel, remoteKey: stream.remotePublicKey, requests, responses });
|
|
41
|
+
channel.open();
|
|
42
|
+
}
|
|
43
|
+
send(hostDeviceId, request) {
|
|
44
|
+
const deviceId = b4a.toString(hostDeviceId, 'hex');
|
|
45
|
+
const peer = this._peers.get(deviceId);
|
|
46
|
+
if (!peer)
|
|
47
|
+
return Promise.reject(new Error(HOST_UNREACHABLE));
|
|
48
|
+
const id = this._nextId++;
|
|
49
|
+
const { promise, resolve, reject } = Promise.withResolvers();
|
|
50
|
+
const timer = setTimeout(() => this._fail((w) => w === this._waiters.get(id), new Error(HOST_SILENT)), this._ackTimeoutMs);
|
|
51
|
+
this._waiters.set(id, { deviceId, timer, resolve, reject });
|
|
52
|
+
peer.requests.send({ id, request });
|
|
53
|
+
return promise;
|
|
54
|
+
}
|
|
55
|
+
destroy() {
|
|
56
|
+
for (const peer of this._peers.values())
|
|
57
|
+
peer.channel.close();
|
|
58
|
+
this._peers.clear();
|
|
59
|
+
this._fail(() => true, new Error(`${this._opts.protocol} destroyed`));
|
|
60
|
+
}
|
|
61
|
+
async _serve(deviceId, m) {
|
|
62
|
+
const peer = this._peers.get(deviceId);
|
|
63
|
+
if (!peer)
|
|
64
|
+
return;
|
|
65
|
+
let error = '';
|
|
66
|
+
let result = null;
|
|
67
|
+
try {
|
|
68
|
+
result = await this._opts.onrequest(m.request, peer.remoteKey);
|
|
69
|
+
}
|
|
70
|
+
catch (err) {
|
|
71
|
+
error = err instanceof Error ? err.message : String(err);
|
|
72
|
+
}
|
|
73
|
+
peer.responses.send(this._opts.buildAck(m.id, error, result));
|
|
74
|
+
}
|
|
75
|
+
_settle(deviceId, ack) {
|
|
76
|
+
const waiter = this._waiters.get(ack.id);
|
|
77
|
+
if (!waiter || waiter.deviceId !== deviceId)
|
|
78
|
+
return;
|
|
79
|
+
this._waiters.delete(ack.id);
|
|
80
|
+
clearTimeout(waiter.timer);
|
|
81
|
+
const { error, result } = this._opts.readAck(ack);
|
|
82
|
+
if (error)
|
|
83
|
+
waiter.reject(new Error(error));
|
|
84
|
+
else
|
|
85
|
+
waiter.resolve(result);
|
|
86
|
+
}
|
|
87
|
+
_drop(deviceId, channel) {
|
|
88
|
+
if (this._peers.get(deviceId)?.channel !== channel)
|
|
89
|
+
return;
|
|
90
|
+
this._peers.delete(deviceId);
|
|
91
|
+
this._fail((waiter) => waiter.deviceId === deviceId, new Error(HOST_UNREACHABLE));
|
|
92
|
+
}
|
|
93
|
+
_fail(match, err) {
|
|
94
|
+
for (const [id, waiter] of this._waiters) {
|
|
95
|
+
if (!match(waiter))
|
|
96
|
+
continue;
|
|
97
|
+
this._waiters.delete(id);
|
|
98
|
+
clearTimeout(waiter.timer);
|
|
99
|
+
waiter.reject(err);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { QvacAgent, QvacDevice } from '../../spec/mesh/hyperschema/types.d.ts';
|
|
2
|
+
export declare const HEALTH_ASSISTANT_ID = "qvac-health-assistant";
|
|
3
|
+
export type HealthAssistantHost = Pick<QvacDevice, 'id' | 'platform'>;
|
|
4
|
+
export interface HealthAssistantOptions {
|
|
5
|
+
readonly at?: number;
|
|
6
|
+
}
|
|
7
|
+
export declare function buildHealthAssistant(device: HealthAssistantHost, { at }?: HealthAssistantOptions): QvacAgent;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { MEDPSY_1_7B, MEDPSY_4B } from '@qvac/harness/model-catalog';
|
|
2
|
+
export const HEALTH_ASSISTANT_ID = 'qvac-health-assistant';
|
|
3
|
+
export function buildHealthAssistant(device, { at = Date.now() } = {}) {
|
|
4
|
+
const mobile = device.platform === 'android' || device.platform === 'ios';
|
|
5
|
+
return {
|
|
6
|
+
id: HEALTH_ASSISTANT_ID,
|
|
7
|
+
name: 'Health Assistant',
|
|
8
|
+
bio: 'You are a health-focused assistant. Provide clear, helpful information about health and wellbeing.',
|
|
9
|
+
providerDeviceId: device.id,
|
|
10
|
+
modelName: mobile ? MEDPSY_1_7B : MEDPSY_4B,
|
|
11
|
+
reasoning: 'inherit',
|
|
12
|
+
enabledSkills: [],
|
|
13
|
+
enabledTools: [],
|
|
14
|
+
installedSkills: [],
|
|
15
|
+
isDefault: false,
|
|
16
|
+
iconName: 'heart',
|
|
17
|
+
toolsScope: 'all',
|
|
18
|
+
skillsScope: 'selected',
|
|
19
|
+
approvalMode: 'ask',
|
|
20
|
+
disabledToolsets: [],
|
|
21
|
+
createdAt: at,
|
|
22
|
+
updatedAt: at
|
|
23
|
+
};
|
|
24
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { QvacDevice, QvacSeedDefaultsOperation } from '../../../spec/mesh/hyperschema/types.d.ts';
|
|
2
|
+
import type { Mesh } from '../mesh.ts';
|
|
3
|
+
export declare function buildDefaultSeed(device: QvacDevice, blindPeerKeys: ReadonlyArray<Buffer>): QvacSeedDefaultsOperation;
|
|
4
|
+
export declare function isOwnRevokedRow(mesh: Mesh, device: QvacDevice): boolean;
|
|
5
|
+
export declare function isOwnKickedRow(mesh: Mesh, device: QvacDevice): boolean;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { randomId } from "../id.js";
|
|
2
|
+
const DEFAULT_AGENT_NAME = 'QV.AC';
|
|
3
|
+
const DEFAULT_AGENT_BIO = 'You are a helpful local assistant. Be clear, practical, and concise.';
|
|
4
|
+
const DEFAULT_AGENT_ICON = 'artificial-intelligence';
|
|
5
|
+
const DEFAULT_FIRST_CHAT_TITLE = 'New Chat';
|
|
6
|
+
function seedableAgent(agent) {
|
|
7
|
+
return {
|
|
8
|
+
id: agent.id,
|
|
9
|
+
name: agent.name,
|
|
10
|
+
bio: agent.bio,
|
|
11
|
+
providerDeviceId: agent.providerDeviceId,
|
|
12
|
+
modelName: agent.modelName,
|
|
13
|
+
reasoning: agent.reasoning,
|
|
14
|
+
enabledSkills: agent.enabledSkills,
|
|
15
|
+
enabledTools: agent.enabledTools,
|
|
16
|
+
installedSkills: agent.installedSkills,
|
|
17
|
+
isDefault: agent.isDefault,
|
|
18
|
+
iconName: agent.iconName,
|
|
19
|
+
toolsScope: agent.toolsScope,
|
|
20
|
+
skillsScope: agent.skillsScope,
|
|
21
|
+
createdAt: agent.createdAt,
|
|
22
|
+
updatedAt: agent.updatedAt
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function seedableChat(chat) {
|
|
26
|
+
return {
|
|
27
|
+
id: chat.id,
|
|
28
|
+
agentId: chat.agentId,
|
|
29
|
+
title: chat.title,
|
|
30
|
+
webSearchEnabled: chat.webSearchEnabled,
|
|
31
|
+
createdAt: chat.createdAt,
|
|
32
|
+
updatedAt: chat.updatedAt
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export function buildDefaultSeed(device, blindPeerKeys) {
|
|
36
|
+
const now = Date.now();
|
|
37
|
+
const agentId = randomId();
|
|
38
|
+
return {
|
|
39
|
+
agent: seedableAgent({
|
|
40
|
+
id: agentId,
|
|
41
|
+
name: DEFAULT_AGENT_NAME,
|
|
42
|
+
bio: DEFAULT_AGENT_BIO,
|
|
43
|
+
providerDeviceId: device.id,
|
|
44
|
+
modelName: device.recommendedModelName,
|
|
45
|
+
reasoning: 'inherit',
|
|
46
|
+
enabledSkills: [],
|
|
47
|
+
enabledTools: [],
|
|
48
|
+
installedSkills: [],
|
|
49
|
+
isDefault: true,
|
|
50
|
+
iconName: DEFAULT_AGENT_ICON,
|
|
51
|
+
toolsScope: 'all',
|
|
52
|
+
skillsScope: 'selected',
|
|
53
|
+
createdAt: now,
|
|
54
|
+
updatedAt: now
|
|
55
|
+
}),
|
|
56
|
+
chat: seedableChat({
|
|
57
|
+
id: randomId(),
|
|
58
|
+
agentId,
|
|
59
|
+
title: DEFAULT_FIRST_CHAT_TITLE,
|
|
60
|
+
webSearchEnabled: true,
|
|
61
|
+
createdAt: now,
|
|
62
|
+
updatedAt: now
|
|
63
|
+
}),
|
|
64
|
+
blindPeers: blindPeerKeys.map((key) => ({ key }))
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
export function isOwnRevokedRow(mesh, device) {
|
|
68
|
+
return device.revoked === true && device.writerKey?.equals(mesh.localWriterKey) === true;
|
|
69
|
+
}
|
|
70
|
+
export function isOwnKickedRow(mesh, device) {
|
|
71
|
+
if (!isOwnRevokedRow(mesh, device))
|
|
72
|
+
return false;
|
|
73
|
+
return device.revokedBy?.equals(mesh.localWriterKey) !== true;
|
|
74
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Logger } from '../logger-type.ts';
|
|
2
|
+
import type { AssistantSkill } from '../../spec/hyperschema/types.d.ts';
|
|
3
|
+
import type { openLocalStore } from './local/index.ts';
|
|
4
|
+
import type { Mesh } from './mesh.ts';
|
|
5
|
+
import type { SecretRequest } from './secret-handoff.ts';
|
|
6
|
+
export declare const HELD_AGENTS_KEY = "skill-values.held-agents";
|
|
7
|
+
export interface HostedAgentsOptions {
|
|
8
|
+
readonly mesh: Mesh;
|
|
9
|
+
readonly local: ReturnType<typeof openLocalStore>;
|
|
10
|
+
readonly deviceId: Buffer;
|
|
11
|
+
readonly catalog: () => Promise<ReadonlyArray<AssistantSkill>>;
|
|
12
|
+
readonly send: (hostDeviceId: Uint8Array, request: SecretRequest) => Promise<void>;
|
|
13
|
+
readonly onmoved: () => Promise<unknown>;
|
|
14
|
+
readonly log?: Logger | null;
|
|
15
|
+
}
|
|
16
|
+
export declare class HostedAgents {
|
|
17
|
+
private readonly _mesh;
|
|
18
|
+
private readonly _local;
|
|
19
|
+
private readonly _deviceId;
|
|
20
|
+
private readonly _catalog;
|
|
21
|
+
private readonly _send;
|
|
22
|
+
private readonly _onmoved;
|
|
23
|
+
private readonly _log;
|
|
24
|
+
private readonly _lock;
|
|
25
|
+
private _closed;
|
|
26
|
+
private readonly _onDirty;
|
|
27
|
+
constructor(opts: HostedAgentsOptions);
|
|
28
|
+
start(): void;
|
|
29
|
+
kick(): void;
|
|
30
|
+
close(): Promise<void>;
|
|
31
|
+
private _run;
|
|
32
|
+
private _pass;
|
|
33
|
+
private _handOver;
|
|
34
|
+
private _stored;
|
|
35
|
+
private _held;
|
|
36
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import b4a from 'b4a';
|
|
2
|
+
import ScopeLock from 'scope-lock';
|
|
3
|
+
import { getAgent, listAgents } from "./agent.js";
|
|
4
|
+
import { agentSkillValues } from "./skill-secrets.js";
|
|
5
|
+
const SCOPE = ['p2p', 'skill-values'];
|
|
6
|
+
export const HELD_AGENTS_KEY = 'skill-values.held-agents';
|
|
7
|
+
export class HostedAgents {
|
|
8
|
+
_mesh;
|
|
9
|
+
_local;
|
|
10
|
+
_deviceId;
|
|
11
|
+
_catalog;
|
|
12
|
+
_send;
|
|
13
|
+
_onmoved;
|
|
14
|
+
_log;
|
|
15
|
+
_lock = new ScopeLock({ debounce: true });
|
|
16
|
+
_closed;
|
|
17
|
+
_onDirty = () => this.kick();
|
|
18
|
+
constructor(opts) {
|
|
19
|
+
this._mesh = opts.mesh;
|
|
20
|
+
this._local = opts.local;
|
|
21
|
+
this._deviceId = opts.deviceId;
|
|
22
|
+
this._catalog = opts.catalog;
|
|
23
|
+
this._send = opts.send;
|
|
24
|
+
this._onmoved = opts.onmoved;
|
|
25
|
+
this._log = opts.log ?? null;
|
|
26
|
+
this._closed = false;
|
|
27
|
+
}
|
|
28
|
+
start() {
|
|
29
|
+
this._mesh.on('agents-dirty', this._onDirty);
|
|
30
|
+
this.kick();
|
|
31
|
+
}
|
|
32
|
+
kick() {
|
|
33
|
+
void this._run();
|
|
34
|
+
}
|
|
35
|
+
async close() {
|
|
36
|
+
this._closed = true;
|
|
37
|
+
this._mesh.off('agents-dirty', this._onDirty);
|
|
38
|
+
this._lock.destroy();
|
|
39
|
+
await this._lock.flush();
|
|
40
|
+
}
|
|
41
|
+
async _run() {
|
|
42
|
+
if (this._closed)
|
|
43
|
+
return;
|
|
44
|
+
if (!(await this._lock.lock()))
|
|
45
|
+
return;
|
|
46
|
+
try {
|
|
47
|
+
if (!this._closed && !this._mesh.closing)
|
|
48
|
+
await this._pass();
|
|
49
|
+
}
|
|
50
|
+
catch (err) {
|
|
51
|
+
this._log?.warn(SCOPE, 'hosted agent pass failed', err);
|
|
52
|
+
}
|
|
53
|
+
finally {
|
|
54
|
+
this._lock.unlock();
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
async _pass() {
|
|
58
|
+
const held = await this._held();
|
|
59
|
+
const hosted = new Set((await listAgents(this._mesh))
|
|
60
|
+
.filter((agent) => b4a.equals(agent.providerDeviceId, this._deviceId))
|
|
61
|
+
.map((agent) => agent.id));
|
|
62
|
+
const holding = new Set([...held, ...hosted]);
|
|
63
|
+
const departed = [...holding].filter((id) => !hosted.has(id));
|
|
64
|
+
if (departed.length > 0) {
|
|
65
|
+
const catalog = await this._catalog();
|
|
66
|
+
for (const id of departed) {
|
|
67
|
+
try {
|
|
68
|
+
if (await this._handOver(id, catalog))
|
|
69
|
+
holding.delete(id);
|
|
70
|
+
}
|
|
71
|
+
catch (err) {
|
|
72
|
+
this._log?.warn(SCOPE, 'skill values could not follow the agent', err);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
if (!sameIds(held, holding))
|
|
77
|
+
await this._local.set(HELD_AGENTS_KEY, [...holding]);
|
|
78
|
+
}
|
|
79
|
+
async _handOver(id, catalog) {
|
|
80
|
+
const agent = await getAgent(this._mesh, id);
|
|
81
|
+
if (!agent)
|
|
82
|
+
return false;
|
|
83
|
+
if (agent.deletedAt)
|
|
84
|
+
return true;
|
|
85
|
+
const stored = await this._stored(agentSkillValues(catalog, agent));
|
|
86
|
+
if (stored.length === 0)
|
|
87
|
+
return true;
|
|
88
|
+
for (const [skillName, values] of bySkill(stored)) {
|
|
89
|
+
await this._send(agent.providerDeviceId, { agentId: id, skillName, values });
|
|
90
|
+
}
|
|
91
|
+
await this._local.deleteAll(stored.map((value) => value.storageKey));
|
|
92
|
+
await this._onmoved();
|
|
93
|
+
return true;
|
|
94
|
+
}
|
|
95
|
+
async _stored(values) {
|
|
96
|
+
const stored = [];
|
|
97
|
+
for (const value of values) {
|
|
98
|
+
const held = await this._local.get(value.storageKey);
|
|
99
|
+
if (typeof held === 'string' && held !== '')
|
|
100
|
+
stored.push({ ...value, value: held });
|
|
101
|
+
}
|
|
102
|
+
return stored;
|
|
103
|
+
}
|
|
104
|
+
async _held() {
|
|
105
|
+
const stored = await this._local.get(HELD_AGENTS_KEY);
|
|
106
|
+
const ids = new Set();
|
|
107
|
+
if (Array.isArray(stored)) {
|
|
108
|
+
for (const id of stored) {
|
|
109
|
+
if (typeof id === 'string')
|
|
110
|
+
ids.add(id);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return ids;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
function sameIds(a, b) {
|
|
117
|
+
return a.size === b.size && [...a].every((id) => b.has(id));
|
|
118
|
+
}
|
|
119
|
+
function bySkill(values) {
|
|
120
|
+
const bundles = new Map();
|
|
121
|
+
for (const { skillName, key, value } of values) {
|
|
122
|
+
const bundle = bundles.get(skillName) ?? [];
|
|
123
|
+
bundle.push({ key, value });
|
|
124
|
+
bundles.set(skillName, bundle);
|
|
125
|
+
}
|
|
126
|
+
return bundles;
|
|
127
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function randomId(): string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { KeyPair } from 'hypercore-crypto';
|
|
2
|
+
export declare const MAX_PROOF_BYTES = 1024;
|
|
3
|
+
export interface MintedIdentity {
|
|
4
|
+
readonly publicKey: Buffer;
|
|
5
|
+
readonly proof: Buffer;
|
|
6
|
+
}
|
|
7
|
+
export interface ExpectedDeviceProof {
|
|
8
|
+
readonly memberId: Buffer;
|
|
9
|
+
readonly deviceId: Buffer;
|
|
10
|
+
}
|
|
11
|
+
export declare function generateMnemonic(): Promise<string>;
|
|
12
|
+
export declare function mintIdentity(mnemonic: string, devicePublicKey: Buffer): Promise<MintedIdentity>;
|
|
13
|
+
export declare function attestDeviceProof(devicePublicKey: Buffer, parent: KeyPair, parentProof: Buffer): Promise<Buffer>;
|
|
14
|
+
export declare function verifyDeviceProof(proof: Buffer, expected: ExpectedDeviceProof): Promise<boolean>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import c from 'compact-encoding';
|
|
2
|
+
import { ProofEncoding } from 'keet-identity-key/lib/encoding.js';
|
|
3
|
+
export const MAX_PROOF_BYTES = 1024;
|
|
4
|
+
let loaded = null;
|
|
5
|
+
async function identityKey() {
|
|
6
|
+
if (loaded === null)
|
|
7
|
+
loaded = await import('keet-identity-key');
|
|
8
|
+
return loaded.default;
|
|
9
|
+
}
|
|
10
|
+
export async function generateMnemonic() {
|
|
11
|
+
return (await identityKey()).generateMnemonic();
|
|
12
|
+
}
|
|
13
|
+
export async function mintIdentity(mnemonic, devicePublicKey) {
|
|
14
|
+
const IdentityKey = await identityKey();
|
|
15
|
+
const identity = await IdentityKey.from({ mnemonic });
|
|
16
|
+
return { publicKey: identity.identityPublicKey, proof: await identity.bootstrap(devicePublicKey) };
|
|
17
|
+
}
|
|
18
|
+
export async function attestDeviceProof(devicePublicKey, parent, parentProof) {
|
|
19
|
+
if (!parentProof)
|
|
20
|
+
throw new Error('attestDeviceProof needs the parent proof');
|
|
21
|
+
return (await identityKey()).attestDevice(devicePublicKey, parent, parentProof);
|
|
22
|
+
}
|
|
23
|
+
export async function verifyDeviceProof(proof, expected) {
|
|
24
|
+
if (proof.byteLength > MAX_PROOF_BYTES)
|
|
25
|
+
return false;
|
|
26
|
+
let decoded;
|
|
27
|
+
try {
|
|
28
|
+
decoded = c.decode(ProofEncoding, proof);
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
if (decoded.data)
|
|
34
|
+
return false;
|
|
35
|
+
try {
|
|
36
|
+
const IdentityKey = await identityKey();
|
|
37
|
+
return !!IdentityKey.verify(proof, null, {
|
|
38
|
+
expectedIdentity: expected.memberId,
|
|
39
|
+
expectedDevice: expected.deviceId
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const IMAGE_CACHE_MAX_BYTES: number;
|
|
2
|
+
export declare const IMAGE_CACHE_MAX_AGE_MS: number;
|
|
3
|
+
export declare function imageCacheName(image: {
|
|
4
|
+
blobId: string;
|
|
5
|
+
fileName: string;
|
|
6
|
+
}): string;
|
|
7
|
+
export declare function sweepImageCache(dir: string, { maxBytes, maxAgeMs, keep, inUse }?: {
|
|
8
|
+
maxBytes?: number;
|
|
9
|
+
maxAgeMs?: number;
|
|
10
|
+
keep?: ReadonlySet<string>;
|
|
11
|
+
inUse?: (name: string) => boolean;
|
|
12
|
+
}): Promise<void>;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import crypto from 'hypercore-crypto';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
export const IMAGE_CACHE_MAX_BYTES = 512 * 1024 * 1024;
|
|
5
|
+
export const IMAGE_CACHE_MAX_AGE_MS = 365 * 24 * 60 * 60 * 1000;
|
|
6
|
+
const STALE_PARTIAL_MS = 60 * 60 * 1000;
|
|
7
|
+
const STAGING_SUFFIX = /\.partial-[0-9a-f]{8}$/;
|
|
8
|
+
export function imageCacheName(image) {
|
|
9
|
+
const key = crypto.hash(Buffer.from(image.blobId)).toString('hex').slice(0, 32);
|
|
10
|
+
const name = image.fileName.replace(/[^a-zA-Z0-9_.-]/g, '_').slice(-40);
|
|
11
|
+
return `${key}-${name}`;
|
|
12
|
+
}
|
|
13
|
+
export async function sweepImageCache(dir, { maxBytes = IMAGE_CACHE_MAX_BYTES, maxAgeMs = IMAGE_CACHE_MAX_AGE_MS, keep, inUse } = {}) {
|
|
14
|
+
const names = await fs.promises.readdir(dir).catch(toNull);
|
|
15
|
+
if (!names)
|
|
16
|
+
return;
|
|
17
|
+
const now = Date.now();
|
|
18
|
+
const entries = [];
|
|
19
|
+
let total = 0;
|
|
20
|
+
for (const entry of await liveEntries(dir, names, now)) {
|
|
21
|
+
total += entry.size;
|
|
22
|
+
if (inUse?.(entry.name))
|
|
23
|
+
continue;
|
|
24
|
+
if (keep && !keep.has(entry.name)) {
|
|
25
|
+
await fs.promises.unlink(entry.file).catch(noop);
|
|
26
|
+
total -= entry.size;
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
if (now - entry.mtimeMs > maxAgeMs) {
|
|
30
|
+
await fs.promises.unlink(entry.file).catch(noop);
|
|
31
|
+
total -= entry.size;
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
entries.push(entry);
|
|
35
|
+
}
|
|
36
|
+
if (total <= maxBytes)
|
|
37
|
+
return;
|
|
38
|
+
entries.sort((a, b) => a.mtimeMs - b.mtimeMs);
|
|
39
|
+
for (const entry of entries) {
|
|
40
|
+
if (total <= maxBytes)
|
|
41
|
+
return;
|
|
42
|
+
if (inUse?.(entry.name))
|
|
43
|
+
continue;
|
|
44
|
+
await fs.promises.unlink(entry.file).catch(noop);
|
|
45
|
+
total -= entry.size;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
async function liveEntries(dir, names, now) {
|
|
49
|
+
const entries = [];
|
|
50
|
+
for (const name of names) {
|
|
51
|
+
const file = path.join(dir, name);
|
|
52
|
+
const stats = await fs.promises.stat(file).catch(toNull);
|
|
53
|
+
if (!stats?.isFile())
|
|
54
|
+
continue;
|
|
55
|
+
if (STAGING_SUFFIX.test(name)) {
|
|
56
|
+
if (now - stats.mtimeMs > STALE_PARTIAL_MS)
|
|
57
|
+
await fs.promises.unlink(file).catch(noop);
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
entries.push({ file, name, size: stats.size, mtimeMs: stats.mtimeMs });
|
|
61
|
+
}
|
|
62
|
+
return entries;
|
|
63
|
+
}
|
|
64
|
+
function toNull() {
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
function noop() { }
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export const MAX_IMAGE_WIDTH = 768;
|
|
2
|
+
export const IMAGE_MIMES = new Set([
|
|
3
|
+
'image/jpeg',
|
|
4
|
+
'image/jpg',
|
|
5
|
+
'image/png',
|
|
6
|
+
'image/webp',
|
|
7
|
+
'image/gif',
|
|
8
|
+
'image/bmp',
|
|
9
|
+
'image/x-ms-bmp',
|
|
10
|
+
'image/heic',
|
|
11
|
+
'image/heif',
|
|
12
|
+
'image/avif',
|
|
13
|
+
'image/tiff',
|
|
14
|
+
'image/tif'
|
|
15
|
+
]);
|
|
16
|
+
let media;
|
|
17
|
+
async function loadMedia() {
|
|
18
|
+
if (media !== undefined)
|
|
19
|
+
return media;
|
|
20
|
+
try {
|
|
21
|
+
media = await import('bare-media');
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
media = null;
|
|
25
|
+
}
|
|
26
|
+
return media;
|
|
27
|
+
}
|
|
28
|
+
export async function normalizeImageForModel(bytes) {
|
|
29
|
+
const mod = await loadMedia();
|
|
30
|
+
if (!mod)
|
|
31
|
+
return bytes;
|
|
32
|
+
try {
|
|
33
|
+
const frame = firstFrame(await mod.image.decode(bytes));
|
|
34
|
+
const oriented = await mod.image.orientate(frame, { file: bytes });
|
|
35
|
+
const resized = await mod.image.resize(oriented, { maxWidth: MAX_IMAGE_WIDTH });
|
|
36
|
+
return await mod.image.encode(resized, { mimetype: 'image/jpeg' });
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
return bytes;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function firstFrame(decoded) {
|
|
43
|
+
if (!decoded.frames)
|
|
44
|
+
return decoded;
|
|
45
|
+
const [first] = decoded.frames;
|
|
46
|
+
if (!first)
|
|
47
|
+
throw new Error('decoded image had no frames');
|
|
48
|
+
return first;
|
|
49
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export type SniffedImageMime = 'image/png' | 'image/jpeg' | 'image/heic' | 'image/avif' | 'image/webp' | 'image/gif' | 'image/bmp' | 'image/tiff';
|
|
2
|
+
export declare function detectImageMime(bytes: Uint8Array): SniffedImageMime | null;
|
|
3
|
+
export declare function mapDeclaredToSniffed(declared: string): SniffedImageMime | null;
|