@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,30 @@
|
|
|
1
|
+
import { registerAgentRoutes } from "./agents.js";
|
|
2
|
+
import { registerApprovalRuleRoutes } from "./approval-rules.js";
|
|
3
|
+
import { registerAttestationRoutes } from "./attestations.js";
|
|
4
|
+
import { registerChatRoutes } from "./chat.js";
|
|
5
|
+
import { registerChatGroupRoutes } from "./chat-group.js";
|
|
6
|
+
import { registerChunkRoutes } from "./chunks.js";
|
|
7
|
+
import { registerDeviceRoutes } from "./devices.js";
|
|
8
|
+
import { registerIndexingRoutes } from "./indexing.js";
|
|
9
|
+
import { registerKnowledgeRoutes } from "./knowledge.js";
|
|
10
|
+
import { registerMemberRoutes } from "./members.js";
|
|
11
|
+
import { registerSeedDefaultsRoutes } from "./seed-defaults.js";
|
|
12
|
+
import { registerToolActivityRoutes } from "./tool-activity.js";
|
|
13
|
+
import { registerToolConfigsRoutes } from "./tool-configs.js";
|
|
14
|
+
import { registerWriterRoutes } from "./writers.js";
|
|
15
|
+
export function registerRoutes(router) {
|
|
16
|
+
registerWriterRoutes(router);
|
|
17
|
+
registerChunkRoutes(router);
|
|
18
|
+
registerAgentRoutes(router);
|
|
19
|
+
registerChatRoutes(router);
|
|
20
|
+
registerChatGroupRoutes(router);
|
|
21
|
+
registerApprovalRuleRoutes(router);
|
|
22
|
+
registerDeviceRoutes(router);
|
|
23
|
+
registerKnowledgeRoutes(router);
|
|
24
|
+
registerIndexingRoutes(router);
|
|
25
|
+
registerSeedDefaultsRoutes(router);
|
|
26
|
+
registerToolConfigsRoutes(router);
|
|
27
|
+
registerToolActivityRoutes(router);
|
|
28
|
+
registerAttestationRoutes(router);
|
|
29
|
+
registerMemberRoutes(router);
|
|
30
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { trackActivity } from "./activity.js";
|
|
2
|
+
import { claimSource } from "../files/index.js";
|
|
3
|
+
const INDEXING_STATUS = '@qvac/indexing-status';
|
|
4
|
+
const KNOWLEDGE_ARTIFACTS = '@qvac/knowledge-artifacts';
|
|
5
|
+
export const INDEXING_CLAIM_TTL_MS = 10 * 60 * 1000;
|
|
6
|
+
export const INDEXING_MAX_CLOCK_SKEW_MS = 60 * 60 * 1000;
|
|
7
|
+
export function registerIndexingRoutes(router) {
|
|
8
|
+
router.add('@qvac/claim-indexing', trackActivity(async (op, { tx, node, log }) => {
|
|
9
|
+
const knowledge = await claimSource(tx, op.knowledgeId);
|
|
10
|
+
if (!knowledge || knowledge.deletedAt) {
|
|
11
|
+
log?.debug('contract', 'claim-indexing dropped: no live knowledge', { id: op.id });
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
const existing = await tx.get(INDEXING_STATUS, { id: op.id });
|
|
15
|
+
if (existing) {
|
|
16
|
+
if (existing.status === 'ready') {
|
|
17
|
+
log?.debug('contract', 'claim-indexing dropped: already ready', { id: op.id });
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const poisoned = existing.at > op.at + INDEXING_MAX_CLOCK_SKEW_MS;
|
|
21
|
+
if (!poisoned) {
|
|
22
|
+
if (existing.status === 'indexing' && existing.expiresAt > op.at) {
|
|
23
|
+
log?.debug('contract', 'claim-indexing dropped: live claim', { id: op.id });
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
if (op.at <= existing.at) {
|
|
27
|
+
log?.debug('contract', 'claim-indexing dropped: stale claim', { id: op.id });
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
const claimed = {
|
|
33
|
+
id: op.id,
|
|
34
|
+
knowledgeId: op.knowledgeId,
|
|
35
|
+
chatId: knowledge.chatId,
|
|
36
|
+
status: 'indexing',
|
|
37
|
+
claimId: op.claimId,
|
|
38
|
+
claimedBy: node.key,
|
|
39
|
+
at: op.at,
|
|
40
|
+
expiresAt: op.at + INDEXING_CLAIM_TTL_MS
|
|
41
|
+
};
|
|
42
|
+
await tx.insert(INDEXING_STATUS, claimed);
|
|
43
|
+
return claimed;
|
|
44
|
+
}));
|
|
45
|
+
router.add('@qvac/resolve-indexing', trackActivity(async (op, { tx, node, log }) => {
|
|
46
|
+
const existing = await tx.get(INDEXING_STATUS, { id: op.id });
|
|
47
|
+
if (!existing) {
|
|
48
|
+
log?.debug('contract', 'resolve-indexing dropped: unknown row', { id: op.id });
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
if (existing.status !== 'indexing') {
|
|
52
|
+
log?.debug('contract', 'resolve-indexing dropped: not in flight', { id: op.id });
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
if (existing.claimId !== op.claimId || !existing.claimedBy.equals(node.key)) {
|
|
56
|
+
log?.debug('contract', 'resolve-indexing dropped: not the claim holder', { id: op.id });
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const knowledge = await claimSource(tx, existing.knowledgeId);
|
|
60
|
+
if (!knowledge || knowledge.deletedAt) {
|
|
61
|
+
log?.debug('contract', 'resolve-indexing dropped: no live knowledge', { id: op.id });
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
if (op.status === 'ready') {
|
|
65
|
+
const artifact = await tx.get(KNOWLEDGE_ARTIFACTS, { id: op.id });
|
|
66
|
+
if (!artifact || artifact.knowledgeId !== existing.knowledgeId) {
|
|
67
|
+
log?.debug('contract', 'resolve-indexing dropped: ready without its artifact', {
|
|
68
|
+
id: op.id
|
|
69
|
+
});
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
const settled = {
|
|
74
|
+
...existing,
|
|
75
|
+
status: op.status,
|
|
76
|
+
at: existing.at + 1,
|
|
77
|
+
error: op.status === 'failed' ? (op.error ?? null) : null
|
|
78
|
+
};
|
|
79
|
+
await tx.insert(INDEXING_STATUS, settled);
|
|
80
|
+
return settled;
|
|
81
|
+
}));
|
|
82
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { trackActivity } from "./activity.js";
|
|
2
|
+
import { assertArtifactOutput } from "../files/index.js";
|
|
3
|
+
const CHATS = '@qvac/chats';
|
|
4
|
+
const KNOWLEDGE = '@qvac/knowledge';
|
|
5
|
+
const KNOWLEDGE_ARTIFACTS = '@qvac/knowledge-artifacts';
|
|
6
|
+
export function registerKnowledgeRoutes(router) {
|
|
7
|
+
router.add('@qvac/add-knowledge', trackActivity(async ({ knowledge }, { tx, log }) => {
|
|
8
|
+
const chat = await tx.get(CHATS, { id: knowledge.chatId });
|
|
9
|
+
if (chat?.deletedAt) {
|
|
10
|
+
log?.debug('contract', 'add-knowledge dropped: chat is deleted', {
|
|
11
|
+
chatId: knowledge.chatId,
|
|
12
|
+
id: knowledge.id
|
|
13
|
+
});
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
const existing = await tx.get(KNOWLEDGE, { id: knowledge.id });
|
|
17
|
+
if (existing && existing.updatedAt > knowledge.updatedAt) {
|
|
18
|
+
log?.debug('contract', 'add-knowledge dropped: stale updatedAt', { id: knowledge.id });
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
await tx.insert(KNOWLEDGE, knowledge);
|
|
22
|
+
return knowledge;
|
|
23
|
+
}));
|
|
24
|
+
router.add('@qvac/remove-knowledge', trackActivity(async (op, { tx, log }) => {
|
|
25
|
+
const existing = await tx.get(KNOWLEDGE, { id: op.knowledgeId });
|
|
26
|
+
if (!existing) {
|
|
27
|
+
log?.debug('contract', 'remove-knowledge dropped: unknown knowledge', {
|
|
28
|
+
id: op.knowledgeId
|
|
29
|
+
});
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
if (existing.deletedAt)
|
|
33
|
+
return;
|
|
34
|
+
const updatedAt = Math.max(existing.updatedAt + 1, op.at);
|
|
35
|
+
const tombstoned = { ...existing, deletedAt: op.at, updatedAt };
|
|
36
|
+
await tx.insert(KNOWLEDGE, tombstoned);
|
|
37
|
+
return tombstoned;
|
|
38
|
+
}));
|
|
39
|
+
router.add('@qvac/add-knowledge-artifact', trackActivity(async ({ artifact }, { tx, log }) => {
|
|
40
|
+
try {
|
|
41
|
+
assertArtifactOutput(artifact);
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
log?.debug('contract', 'artifact dropped: invalid output', { id: artifact.id, error });
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const existing = await tx.get(KNOWLEDGE_ARTIFACTS, {
|
|
48
|
+
id: artifact.id
|
|
49
|
+
});
|
|
50
|
+
if (existing)
|
|
51
|
+
return;
|
|
52
|
+
await tx.insert(KNOWLEDGE_ARTIFACTS, artifact);
|
|
53
|
+
return artifact;
|
|
54
|
+
}));
|
|
55
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { verifyDeviceProof } from "../identity.js";
|
|
2
|
+
import { liveDeviceForWriter, trackActivity } from "./activity.js";
|
|
3
|
+
const DEVICES = '@qvac/devices';
|
|
4
|
+
const MEMBERS = '@qvac/members';
|
|
5
|
+
function link(device, memberId, proof, attestedAt) {
|
|
6
|
+
return { ...device, memberId, memberProof: proof, attestedAt };
|
|
7
|
+
}
|
|
8
|
+
export function registerMemberRoutes(router) {
|
|
9
|
+
router.add('@qvac/mint-member', trackActivity(async ({ member, proof }, { tx, node, log }) => {
|
|
10
|
+
const minter = await liveDeviceForWriter(tx, node.key);
|
|
11
|
+
if (!minter) {
|
|
12
|
+
log?.warn('contract', 'mint-member dropped: the writer has no device row');
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
if (minter.memberId) {
|
|
16
|
+
log?.warn('contract', 'mint-member dropped: the writer is already inside a member');
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
if (await tx.findOne(MEMBERS)) {
|
|
20
|
+
log?.warn('contract', 'mint-member dropped: the mesh already holds a member');
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
if (!(await verifyDeviceProof(proof, { memberId: member.id, deviceId: minter.id }))) {
|
|
24
|
+
log?.warn('contract', 'mint-member dropped: the proof does not root the minter at the member');
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const minted = {
|
|
28
|
+
id: member.id,
|
|
29
|
+
name: member.name,
|
|
30
|
+
joinedAt: member.joinedAt,
|
|
31
|
+
updatedAt: member.updatedAt
|
|
32
|
+
};
|
|
33
|
+
await tx.insert(MEMBERS, minted);
|
|
34
|
+
await tx.insert(DEVICES, link(minter, member.id, proof, member.joinedAt));
|
|
35
|
+
log?.info('contract', 'member minted', { id: member.id.toString('hex').slice(0, 16) });
|
|
36
|
+
return minted;
|
|
37
|
+
}));
|
|
38
|
+
router.add('@qvac/update-member', trackActivity(async ({ member }, { tx, node, log }) => {
|
|
39
|
+
const author = await liveDeviceForWriter(tx, node.key);
|
|
40
|
+
if (!author?.memberId?.equals(member.id)) {
|
|
41
|
+
log?.warn('contract', 'update-member dropped: the writer is no device of this member');
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const existing = await tx.get(MEMBERS, { id: member.id });
|
|
45
|
+
if (!existing) {
|
|
46
|
+
log?.debug('contract', 'update-member dropped: unknown member');
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
if (member.updatedAt < existing.updatedAt) {
|
|
50
|
+
log?.debug('contract', 'update-member dropped: not newer than the stored row');
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const next = {
|
|
54
|
+
id: member.id,
|
|
55
|
+
name: member.name,
|
|
56
|
+
joinedAt: existing.joinedAt,
|
|
57
|
+
updatedAt: member.updatedAt
|
|
58
|
+
};
|
|
59
|
+
await tx.insert(MEMBERS, next);
|
|
60
|
+
return next;
|
|
61
|
+
}));
|
|
62
|
+
router.add('@qvac/attest-member-device', async (op, { tx, node, log }) => {
|
|
63
|
+
const device = await tx.get(DEVICES, { id: op.deviceId });
|
|
64
|
+
if (!device) {
|
|
65
|
+
log?.debug('contract', 'attest-member-device dropped: unknown device');
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
if (device.memberId && !device.memberId.equals(op.memberId)) {
|
|
69
|
+
log?.warn('contract', 'attest-member-device dropped: a device may not change member');
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
const signer = await liveDeviceForWriter(tx, node.key);
|
|
73
|
+
const speaksForMember = signer?.memberId?.equals(op.memberId) || signer?.id.equals(op.deviceId);
|
|
74
|
+
if (!speaksForMember) {
|
|
75
|
+
log?.warn('contract', 'attest-member-device dropped: the writer speaks for another member');
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
const member = await tx.get(MEMBERS, { id: op.memberId });
|
|
79
|
+
if (!member) {
|
|
80
|
+
log?.debug('contract', 'attest-member-device dropped: no member row to attest into');
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
if (!(await verifyDeviceProof(op.proof, { memberId: op.memberId, deviceId: op.deviceId }))) {
|
|
84
|
+
log?.warn('contract', 'attest-member-device dropped: the proof does not stand');
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
if (device.memberId?.equals(op.memberId) && op.attestedAt <= (device.attestedAt || 0)) {
|
|
88
|
+
log?.debug('contract', 'attest-member-device dropped: not newer than the stored attestation');
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
await tx.insert(DEVICES, link(device, op.memberId, op.proof, op.attestedAt));
|
|
92
|
+
log?.info('contract', 'device attested to a member', {
|
|
93
|
+
id: op.deviceId.toString('hex').slice(0, 16)
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { trackActivity } from "./activity.js";
|
|
2
|
+
const AGENTS = '@qvac/agents';
|
|
3
|
+
const CHATS = '@qvac/chats';
|
|
4
|
+
const MESH_BLIND_PEERS = '@qvac/mesh-blind-peers';
|
|
5
|
+
export function registerSeedDefaultsRoutes(router) {
|
|
6
|
+
router.add('@qvac/seed-defaults', trackActivity(async (op, { tx, log }) => {
|
|
7
|
+
let seeded = false;
|
|
8
|
+
if (!(await tx.get(AGENTS, { id: op.agent.id }))) {
|
|
9
|
+
await tx.insert(AGENTS, op.agent);
|
|
10
|
+
log?.info('contract', 'seeded default agent', {
|
|
11
|
+
id: op.agent.id,
|
|
12
|
+
model: op.agent.modelName
|
|
13
|
+
});
|
|
14
|
+
seeded = true;
|
|
15
|
+
}
|
|
16
|
+
if (!(await tx.get(CHATS, { id: op.chat.id }))) {
|
|
17
|
+
await tx.insert(CHATS, op.chat);
|
|
18
|
+
log?.info('contract', 'seeded first chat', { id: op.chat.id });
|
|
19
|
+
seeded = true;
|
|
20
|
+
}
|
|
21
|
+
for (const peer of op.blindPeers ?? []) {
|
|
22
|
+
if (!(await tx.get(MESH_BLIND_PEERS, { key: peer.key }))) {
|
|
23
|
+
await tx.insert(MESH_BLIND_PEERS, peer);
|
|
24
|
+
seeded = true;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return seeded;
|
|
28
|
+
}));
|
|
29
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { capToolActivityArguments } from "../../../schema/qvac.js";
|
|
2
|
+
const TOOL_ACTIVITY = '@qvac/tool-activity';
|
|
3
|
+
const TOOL_ACTIVITY_COUNTERS = '@qvac/tool-activity-counter';
|
|
4
|
+
export function registerToolActivityRoutes(router) {
|
|
5
|
+
router.add('@qvac/append-tool-activity', async ({ activity }, { tx, log }) => {
|
|
6
|
+
const existing = await tx.get(TOOL_ACTIVITY, { id: activity.id });
|
|
7
|
+
if (existing)
|
|
8
|
+
return;
|
|
9
|
+
const counter = await tx.get(TOOL_ACTIVITY_COUNTERS, {
|
|
10
|
+
agentId: activity.agentId
|
|
11
|
+
});
|
|
12
|
+
const seq = (counter?.count ?? 0) + 1;
|
|
13
|
+
const capped = capToolActivityArguments(activity.arguments);
|
|
14
|
+
await tx.insert(TOOL_ACTIVITY_COUNTERS, {
|
|
15
|
+
agentId: activity.agentId,
|
|
16
|
+
count: seq
|
|
17
|
+
});
|
|
18
|
+
await tx.insert(TOOL_ACTIVITY, { ...activity, arguments: capped, seq });
|
|
19
|
+
log?.debug('contract', 'tool activity recorded', {
|
|
20
|
+
agentId: activity.agentId,
|
|
21
|
+
toolName: activity.toolName,
|
|
22
|
+
decision: activity.decision
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { toolConfigsWithinBounds } from "../../../schema/qvac.js";
|
|
2
|
+
import { toolConfigsCarrySecret } from "../tool-configs.js";
|
|
3
|
+
import { trackActivity } from "./activity.js";
|
|
4
|
+
const TOOL_CONFIGS = '@qvac/tool-configs';
|
|
5
|
+
const AGENTS = '@qvac/agents';
|
|
6
|
+
export function registerToolConfigsRoutes(router) {
|
|
7
|
+
router.add('@qvac/put-tool-configs', trackActivity(async ({ settings }, { tx, log }) => {
|
|
8
|
+
if (!toolConfigsWithinBounds(settings.settings)) {
|
|
9
|
+
log?.debug('contract', 'put-tool-configs dropped: settings exceed the wire cap', {
|
|
10
|
+
agentId: settings.agentId,
|
|
11
|
+
toolName: settings.toolName
|
|
12
|
+
});
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
if (toolConfigsCarrySecret(settings.settings)) {
|
|
16
|
+
log?.debug('contract', 'put-tool-configs dropped: settings carry a replicated secret', {
|
|
17
|
+
agentId: settings.agentId,
|
|
18
|
+
toolName: settings.toolName
|
|
19
|
+
});
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
const existing = await tx.get(TOOL_CONFIGS, {
|
|
23
|
+
agentId: settings.agentId,
|
|
24
|
+
toolName: settings.toolName
|
|
25
|
+
});
|
|
26
|
+
if (existing && existing.updatedAt > settings.updatedAt) {
|
|
27
|
+
log?.debug('contract', 'put-tool-configs dropped: stale updatedAt', {
|
|
28
|
+
agentId: settings.agentId,
|
|
29
|
+
toolName: settings.toolName
|
|
30
|
+
});
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
if (!settings.deletedAt) {
|
|
34
|
+
const agent = await tx.get(AGENTS, { id: settings.agentId });
|
|
35
|
+
if (!agent || agent.deletedAt) {
|
|
36
|
+
log?.debug('contract', 'put-tool-configs dropped: agent missing or deleted', {
|
|
37
|
+
agentId: settings.agentId,
|
|
38
|
+
toolName: settings.toolName
|
|
39
|
+
});
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
await tx.insert(TOOL_CONFIGS, settings);
|
|
44
|
+
log?.debug('contract', existing ? 'tool configs updated' : 'tool configs created', {
|
|
45
|
+
agentId: settings.agentId,
|
|
46
|
+
toolName: settings.toolName
|
|
47
|
+
});
|
|
48
|
+
return settings;
|
|
49
|
+
}));
|
|
50
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { AutobeeHost, AutobeeNode } from 'autobee';
|
|
2
|
+
import type HyperDB from 'hyperdb';
|
|
3
|
+
import type { Logger } from '../../log.ts';
|
|
4
|
+
export interface RouterContext {
|
|
5
|
+
readonly tx: HyperDB;
|
|
6
|
+
readonly host: AutobeeHost;
|
|
7
|
+
readonly node: AutobeeNode;
|
|
8
|
+
readonly meshPublicKey: Buffer;
|
|
9
|
+
readonly meshDevicePublicKey: Buffer;
|
|
10
|
+
readonly log: Logger | null;
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import crypto from 'hypercore-crypto';
|
|
2
|
+
import { markWriterRevoked, trackActivity } from "./activity.js";
|
|
3
|
+
const DEVICES = '@qvac/devices';
|
|
4
|
+
async function admitDevice({ tx, log }, id, device, writerKey) {
|
|
5
|
+
const existing = await tx.get(DEVICES, { id });
|
|
6
|
+
if (!device) {
|
|
7
|
+
if (!existing)
|
|
8
|
+
return 'writer-only';
|
|
9
|
+
log?.debug('contract', 'admission refused: no profile to weigh against the existing row');
|
|
10
|
+
return 'refused';
|
|
11
|
+
}
|
|
12
|
+
if (existing &&
|
|
13
|
+
(existing.revoked ? device.joinedAt <= existing.joinedAt : device.joinedAt < existing.joinedAt)) {
|
|
14
|
+
log?.debug('contract', 'admission refused: claim is not newer than the device row');
|
|
15
|
+
return 'refused';
|
|
16
|
+
}
|
|
17
|
+
const alreadyAdmitted = existing && !existing.revoked && existing.writerKey?.equals(writerKey) === true;
|
|
18
|
+
await tx.insert(DEVICES, {
|
|
19
|
+
...existing,
|
|
20
|
+
name: device.name,
|
|
21
|
+
joinedAt: device.joinedAt,
|
|
22
|
+
capabilityProfile: device.capabilityProfile,
|
|
23
|
+
recommendedModelName: device.recommendedModelName,
|
|
24
|
+
installedToolNames: device.installedToolNames ?? existing?.installedToolNames,
|
|
25
|
+
installedSkillNames: device.installedSkillNames ?? existing?.installedSkillNames,
|
|
26
|
+
installedModelNames: device.installedModelNames ?? existing?.installedModelNames,
|
|
27
|
+
cachedModelNames: device.cachedModelNames ?? existing?.cachedModelNames,
|
|
28
|
+
readySkillNames: device.readySkillNames ?? existing?.readySkillNames,
|
|
29
|
+
appVersion: device.appVersion ?? existing?.appVersion,
|
|
30
|
+
appBuild: device.appBuild ?? existing?.appBuild,
|
|
31
|
+
appChannel: device.appChannel ?? existing?.appChannel,
|
|
32
|
+
platform: device.platform ?? existing?.platform,
|
|
33
|
+
id,
|
|
34
|
+
writerKey,
|
|
35
|
+
revoked: false,
|
|
36
|
+
revokedAt: 0,
|
|
37
|
+
revokedBy: null
|
|
38
|
+
});
|
|
39
|
+
if (existing?.writerKey && !existing.writerKey.equals(writerKey)) {
|
|
40
|
+
await markWriterRevoked(tx, existing.writerKey, true);
|
|
41
|
+
}
|
|
42
|
+
await markWriterRevoked(tx, writerKey, false);
|
|
43
|
+
if (!alreadyAdmitted) {
|
|
44
|
+
log?.info('contract', 'device admitted', { id: id.toString('hex').slice(0, 16) });
|
|
45
|
+
}
|
|
46
|
+
return 'admitted';
|
|
47
|
+
}
|
|
48
|
+
export function registerWriterRoutes(router) {
|
|
49
|
+
router.add('@qvac/add-writer', trackActivity(async (payload, context) => {
|
|
50
|
+
if (!payload.device) {
|
|
51
|
+
await context.host.addWriter(payload.writerKey);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
const admission = await admitDevice(context, payload.device.id, payload.device, payload.writerKey);
|
|
55
|
+
if (admission !== 'admitted')
|
|
56
|
+
return;
|
|
57
|
+
await context.host.addWriter(payload.writerKey);
|
|
58
|
+
return payload.device;
|
|
59
|
+
}));
|
|
60
|
+
router.add('@qvac/remove-writer', trackActivity(async (payload, context) => {
|
|
61
|
+
await context.host.removeWriter(payload.writerKey);
|
|
62
|
+
const id = payload.deviceId;
|
|
63
|
+
if (!id)
|
|
64
|
+
return;
|
|
65
|
+
const existing = await context.tx.get(DEVICES, { id });
|
|
66
|
+
if (!existing) {
|
|
67
|
+
context.log?.debug('contract', 'remove-writer: no device row to revoke');
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
if (existing.writerKey && !existing.writerKey.equals(payload.writerKey)) {
|
|
71
|
+
context.log?.debug('contract', 'remove-writer dropped: writer key already superseded');
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
const revoked = {
|
|
75
|
+
...existing,
|
|
76
|
+
revoked: true,
|
|
77
|
+
revokedAt: payload.revokedAt ?? 0,
|
|
78
|
+
revokedBy: context.node.key
|
|
79
|
+
};
|
|
80
|
+
await context.tx.insert(DEVICES, revoked);
|
|
81
|
+
await markWriterRevoked(context.tx, payload.writerKey, true);
|
|
82
|
+
context.log?.info('contract', 'writer removed, device revoked', {
|
|
83
|
+
id: id.toString('hex').slice(0, 16)
|
|
84
|
+
});
|
|
85
|
+
if (context.node.key.equals(payload.writerKey))
|
|
86
|
+
return;
|
|
87
|
+
return revoked;
|
|
88
|
+
}));
|
|
89
|
+
router.add('@qvac/join', trackActivity(async (payload, context) => {
|
|
90
|
+
let valid = false;
|
|
91
|
+
try {
|
|
92
|
+
valid = crypto.verify(context.node.key, payload.signature, context.meshPublicKey);
|
|
93
|
+
}
|
|
94
|
+
catch {
|
|
95
|
+
valid = false;
|
|
96
|
+
}
|
|
97
|
+
if (!valid) {
|
|
98
|
+
context.log?.warn('contract', 'join dropped: invalid writer-claim signature');
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
const id = payload.deviceId;
|
|
102
|
+
if (!id) {
|
|
103
|
+
await context.host.addWriter(context.node.key);
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
const admission = await admitDevice(context, id, payload.device, context.node.key);
|
|
107
|
+
if (admission === 'refused')
|
|
108
|
+
return;
|
|
109
|
+
await context.host.addWriter(context.node.key);
|
|
110
|
+
return admission === 'admitted' ? payload.device : null;
|
|
111
|
+
}));
|
|
112
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type Corestore from 'corestore';
|
|
2
|
+
import type Hyperswarm from 'hyperswarm';
|
|
3
|
+
import type Wakeup from 'protomux-wakeup';
|
|
4
|
+
import type { Logger } from '../../index.ts';
|
|
5
|
+
import type { LocalMeshDeparture } from '../../spec/local/hyperschema/types.d.ts';
|
|
6
|
+
import type { BlindPeeringOpts } from './blind-peers.ts';
|
|
7
|
+
interface DepartureRows {
|
|
8
|
+
departures(): Promise<LocalMeshDeparture[]>;
|
|
9
|
+
deleteDeparture(key: Buffer): Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
export interface PendingDeparturesOptions {
|
|
12
|
+
swarm: Hyperswarm;
|
|
13
|
+
logger?: Logger | null;
|
|
14
|
+
blindPeerKeys?: ReadonlyArray<Buffer>;
|
|
15
|
+
blindPeeringOpts?: BlindPeeringOpts;
|
|
16
|
+
wakeup?: Wakeup;
|
|
17
|
+
}
|
|
18
|
+
export declare class PendingDepartures {
|
|
19
|
+
private readonly _store;
|
|
20
|
+
private readonly _local;
|
|
21
|
+
private readonly _swarm;
|
|
22
|
+
private readonly _log;
|
|
23
|
+
private readonly _blindPeerKeys;
|
|
24
|
+
private readonly _blindPeeringOpts;
|
|
25
|
+
private readonly _wakeup;
|
|
26
|
+
private readonly _active;
|
|
27
|
+
private readonly _parked;
|
|
28
|
+
private readonly _lock;
|
|
29
|
+
private _closing;
|
|
30
|
+
constructor(store: Corestore, local: DepartureRows, opts: PendingDeparturesOptions);
|
|
31
|
+
flush(activeKey?: Buffer | null): void;
|
|
32
|
+
private _flush;
|
|
33
|
+
private _deliver;
|
|
34
|
+
park(key: Buffer): Promise<void>;
|
|
35
|
+
unpark(key: Buffer): void;
|
|
36
|
+
drop(key: Buffer): Promise<void>;
|
|
37
|
+
suspend(): Promise<void>;
|
|
38
|
+
resume(): Promise<void>;
|
|
39
|
+
close(): Promise<void>;
|
|
40
|
+
}
|
|
41
|
+
export {};
|