@qvac/core 0.0.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +198 -0
- package/NOTICE.md +13 -0
- package/README.md +694 -0
- package/SECURITY.md +6 -0
- package/dist/assistant.bundle +47257 -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/helpers.d.ts +28 -0
- package/dist-lib/schema/helpers.js +176 -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/schema/vendor.d.ts +5 -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 +336 -1
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Buffer } from 'buffer';
|
|
2
|
+
import type { AbortSignal } from 'bare-abort-controller';
|
|
3
|
+
import type { QvacKnowledgeArtifact } from '../../../../spec/mesh/hyperschema/types.d.ts';
|
|
4
|
+
import type { FileDocument, FileProcessor } from '../processing/index.ts';
|
|
5
|
+
import { type FileRecord } from '../records/index.ts';
|
|
6
|
+
import { type PreviewEncoder } from './image.ts';
|
|
7
|
+
import type { Mesh } from '../../mesh.ts';
|
|
8
|
+
export { previewEncoder } from './image.ts';
|
|
9
|
+
export type { PreviewEncoder } from './image.ts';
|
|
10
|
+
export declare const PREVIEW_VERSION = "processor:preview:1";
|
|
11
|
+
export declare class PreviewProcessor implements FileProcessor {
|
|
12
|
+
readonly id = "preview";
|
|
13
|
+
readonly version = "processor:preview:1";
|
|
14
|
+
readonly input = "attachment";
|
|
15
|
+
readonly output = "inline";
|
|
16
|
+
readonly mediaKind = "image";
|
|
17
|
+
private readonly _deviceId;
|
|
18
|
+
private readonly _retryMs;
|
|
19
|
+
private readonly _encoder;
|
|
20
|
+
constructor(options: {
|
|
21
|
+
deviceId: Buffer | null;
|
|
22
|
+
retryMs?: number;
|
|
23
|
+
encoder?: () => Promise<PreviewEncoder | null>;
|
|
24
|
+
});
|
|
25
|
+
applies(file: FileRecord): boolean;
|
|
26
|
+
canProduce(file: FileRecord, host: {
|
|
27
|
+
mesh: Mesh;
|
|
28
|
+
}): Promise<boolean>;
|
|
29
|
+
accepts(output: QvacKnowledgeArtifact, file: FileRecord): boolean;
|
|
30
|
+
produce(document: FileDocument, signal: AbortSignal): Promise<void>;
|
|
31
|
+
close(): Promise<boolean>;
|
|
32
|
+
}
|
|
33
|
+
export declare function previewId(file: Pick<FileRecord, 'id' | 'blobId'>): string;
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import b4a from 'b4a';
|
|
2
|
+
import { Buffer } from 'buffer';
|
|
3
|
+
import crypto from 'hypercore-crypto';
|
|
4
|
+
import { processorArtifactId } from "../records/index.js";
|
|
5
|
+
import { parseBlobReference } from "../store/index.js";
|
|
6
|
+
import { IMAGE_MIMES } from "../../image/normalize.js";
|
|
7
|
+
import { previewEncoder } from "./image.js";
|
|
8
|
+
import { AbortedError } from '@qvac/harness/race-abort';
|
|
9
|
+
import { getChat } from "../../chat.js";
|
|
10
|
+
export { previewEncoder } from "./image.js";
|
|
11
|
+
export const PREVIEW_VERSION = 'processor:preview:1';
|
|
12
|
+
const RETRY_MS = 30_000;
|
|
13
|
+
export class PreviewProcessor {
|
|
14
|
+
id = 'preview';
|
|
15
|
+
version = PREVIEW_VERSION;
|
|
16
|
+
input = 'attachment';
|
|
17
|
+
output = 'inline';
|
|
18
|
+
mediaKind = 'image';
|
|
19
|
+
_deviceId;
|
|
20
|
+
_retryMs;
|
|
21
|
+
_encoder;
|
|
22
|
+
constructor(options) {
|
|
23
|
+
this._deviceId = options.deviceId;
|
|
24
|
+
this._retryMs = options.retryMs ?? RETRY_MS;
|
|
25
|
+
this._encoder = options.encoder ?? previewEncoder;
|
|
26
|
+
}
|
|
27
|
+
applies(file) {
|
|
28
|
+
return (file.kind === 'attachment' &&
|
|
29
|
+
file.preview === true &&
|
|
30
|
+
IMAGE_MIMES.has(file.mimeType.toLowerCase()));
|
|
31
|
+
}
|
|
32
|
+
async canProduce(file, host) {
|
|
33
|
+
return !file.deletedAt && !(await getChat(host.mesh, file.chatId))?.deletedAt;
|
|
34
|
+
}
|
|
35
|
+
accepts(output, file) {
|
|
36
|
+
if (output.embedderVersion !== this.version)
|
|
37
|
+
return false;
|
|
38
|
+
try {
|
|
39
|
+
return output.id === previewId(file);
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
async produce(document, signal) {
|
|
46
|
+
const file = document.record;
|
|
47
|
+
const id = previewId(file);
|
|
48
|
+
document.state.artifactIdMemo = id;
|
|
49
|
+
const existing = (await document.artifacts()).find((row) => this.accepts(row, file));
|
|
50
|
+
if (existing) {
|
|
51
|
+
document.work({ state: 'ready' });
|
|
52
|
+
await document.claims.settle(id);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
if (document.claims.isFailed(id))
|
|
56
|
+
return;
|
|
57
|
+
const encode = await this._encoder();
|
|
58
|
+
if (!encode) {
|
|
59
|
+
document.work({ state: 'pending', reason: 'image processor unavailable on this device' });
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
if (!this._deviceId ||
|
|
63
|
+
!file.originDeviceId ||
|
|
64
|
+
!b4a.equals(this._deviceId, file.originDeviceId)) {
|
|
65
|
+
document.state.preferredUntil ??= Math.min(file.createdAt, Date.now()) + this._retryMs;
|
|
66
|
+
if (document.state.preferredUntil > Date.now()) {
|
|
67
|
+
document.work({
|
|
68
|
+
state: 'pending',
|
|
69
|
+
reason: 'waiting for uploader',
|
|
70
|
+
retryAt: document.state.preferredUntil
|
|
71
|
+
});
|
|
72
|
+
document.schedule(document.state.preferredUntil);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
const retryAt = document.source.blockedUntil();
|
|
77
|
+
if (retryAt) {
|
|
78
|
+
document.schedule(retryAt);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
if (await document.claims.blockedByStatus(id))
|
|
82
|
+
return;
|
|
83
|
+
const source = await document.source.read(signal);
|
|
84
|
+
if (source.kind !== 'bytes') {
|
|
85
|
+
const retryAt = source.kind === 'missing' ? source.retryAt : undefined;
|
|
86
|
+
document.work({
|
|
87
|
+
state: source.kind === 'missing' ? 'pending' : 'failed',
|
|
88
|
+
reason: 'source unavailable',
|
|
89
|
+
retryAt
|
|
90
|
+
});
|
|
91
|
+
if (retryAt)
|
|
92
|
+
document.schedule(retryAt);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
if (signal.aborted || document.paused() || document.closed())
|
|
96
|
+
return;
|
|
97
|
+
const claim = await document.claims.claim(id);
|
|
98
|
+
if (!claim)
|
|
99
|
+
return;
|
|
100
|
+
document.work({ state: 'running' });
|
|
101
|
+
try {
|
|
102
|
+
const bytes = await encode(source.bytes, signal);
|
|
103
|
+
const current = await document.current();
|
|
104
|
+
if (signal.aborted)
|
|
105
|
+
throw new AbortedError();
|
|
106
|
+
if (!current || current.deletedAt || previewId(current) !== id) {
|
|
107
|
+
throw new Error('source no longer available');
|
|
108
|
+
}
|
|
109
|
+
await document.publish({
|
|
110
|
+
id,
|
|
111
|
+
sourceHash: previewSource(file),
|
|
112
|
+
embedderVersion: this.version,
|
|
113
|
+
dimensions: 0,
|
|
114
|
+
artifactBlobId: document.inline(bytes, 'image/jpeg')
|
|
115
|
+
});
|
|
116
|
+
if (claim.claimId) {
|
|
117
|
+
await document.resolve({ artifactId: id, claimId: claim.claimId, status: 'ready' });
|
|
118
|
+
}
|
|
119
|
+
document.source.clear();
|
|
120
|
+
document.work({ state: 'ready' });
|
|
121
|
+
}
|
|
122
|
+
catch (error) {
|
|
123
|
+
const interrupted = signal.aborted || document.paused() || document.closed();
|
|
124
|
+
const reason = interrupted
|
|
125
|
+
? 'interrupted: suspend'
|
|
126
|
+
: error instanceof Error
|
|
127
|
+
? error.message
|
|
128
|
+
: String(error);
|
|
129
|
+
document.work({ state: interrupted ? 'pending' : 'failed', reason });
|
|
130
|
+
if (!interrupted)
|
|
131
|
+
document.claims.markFailed(id);
|
|
132
|
+
if (claim.claimId && !document.closed()) {
|
|
133
|
+
await document
|
|
134
|
+
.resolve({ artifactId: id, claimId: claim.claimId, status: 'failed', error: reason })
|
|
135
|
+
.catch(() => { });
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
close() {
|
|
140
|
+
return Promise.resolve(true);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
export function previewId(file) {
|
|
144
|
+
return processorArtifactId({
|
|
145
|
+
processorId: 'preview',
|
|
146
|
+
hash: hash([file.id, previewSource(file), PREVIEW_VERSION])
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
function previewSource(file) {
|
|
150
|
+
const { blobId, coreKey } = parseBlobReference(file.blobId);
|
|
151
|
+
return hash([
|
|
152
|
+
coreKey ?? '',
|
|
153
|
+
blobId.blockOffset,
|
|
154
|
+
blobId.blockLength,
|
|
155
|
+
blobId.byteOffset,
|
|
156
|
+
blobId.byteLength
|
|
157
|
+
]);
|
|
158
|
+
}
|
|
159
|
+
function hash(values) {
|
|
160
|
+
return b4a.toString(crypto.hash(Buffer.from(JSON.stringify(values))), 'hex');
|
|
161
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Mesh } from '../../mesh.ts';
|
|
2
|
+
import type { FileState } from './state.ts';
|
|
3
|
+
export type IndexingClaimsOptions = {
|
|
4
|
+
mesh: Mesh;
|
|
5
|
+
schedule: (deadline: number) => void;
|
|
6
|
+
paused: () => boolean;
|
|
7
|
+
closed: () => boolean;
|
|
8
|
+
state?: FileState;
|
|
9
|
+
advisory?: boolean;
|
|
10
|
+
};
|
|
11
|
+
export declare class IndexingClaims {
|
|
12
|
+
private readonly _mesh;
|
|
13
|
+
private readonly _schedule;
|
|
14
|
+
private readonly _paused;
|
|
15
|
+
private readonly _closed;
|
|
16
|
+
private readonly _state;
|
|
17
|
+
private readonly _advisory;
|
|
18
|
+
constructor(opts: IndexingClaimsOptions);
|
|
19
|
+
markFailed(artifactId: string): void;
|
|
20
|
+
isFailed(artifactId: string): boolean;
|
|
21
|
+
claim(artifactId: string, knowledgeId: string): Promise<{
|
|
22
|
+
claimId: string;
|
|
23
|
+
} | null>;
|
|
24
|
+
blockedByStatus(artifactId: string): Promise<boolean>;
|
|
25
|
+
settle(artifactId: string, knowledgeId: string): Promise<void>;
|
|
26
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { claimIndexing, getIndexingStatus, isClaimLive, resolveIndexing } from "./protocol.js";
|
|
2
|
+
export class IndexingClaims {
|
|
3
|
+
_mesh;
|
|
4
|
+
_schedule;
|
|
5
|
+
_paused;
|
|
6
|
+
_closed;
|
|
7
|
+
_state;
|
|
8
|
+
_advisory;
|
|
9
|
+
constructor(opts) {
|
|
10
|
+
this._mesh = opts.mesh;
|
|
11
|
+
this._schedule = opts.schedule;
|
|
12
|
+
this._paused = opts.paused;
|
|
13
|
+
this._closed = opts.closed;
|
|
14
|
+
this._state = opts.state ?? opts.mesh.files.state;
|
|
15
|
+
this._advisory = opts.advisory ?? false;
|
|
16
|
+
}
|
|
17
|
+
markFailed(artifactId) {
|
|
18
|
+
this._state.artifact(artifactId).terminal = true;
|
|
19
|
+
}
|
|
20
|
+
isFailed(artifactId) {
|
|
21
|
+
return this._state.artifact(artifactId).terminal === true;
|
|
22
|
+
}
|
|
23
|
+
async claim(artifactId, knowledgeId) {
|
|
24
|
+
try {
|
|
25
|
+
const { row, won } = await claimIndexing(this._mesh, {
|
|
26
|
+
artifactId,
|
|
27
|
+
knowledgeId,
|
|
28
|
+
at: Date.now()
|
|
29
|
+
});
|
|
30
|
+
if (won)
|
|
31
|
+
return { claimId: row.claimId };
|
|
32
|
+
if (isClaimLive(row, Date.now()))
|
|
33
|
+
this._schedule(row.expiresAt);
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
catch (err) {
|
|
37
|
+
if (this._advisory &&
|
|
38
|
+
!this._closed() &&
|
|
39
|
+
!this._paused() &&
|
|
40
|
+
!(await getIndexingStatus(this._mesh, artifactId))) {
|
|
41
|
+
return { claimId: '' };
|
|
42
|
+
}
|
|
43
|
+
logger.debug('rag', 'claim not placed', { id: artifactId, err });
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
async blockedByStatus(artifactId) {
|
|
48
|
+
if (this.isFailed(artifactId))
|
|
49
|
+
return true;
|
|
50
|
+
const row = await getIndexingStatus(this._mesh, artifactId);
|
|
51
|
+
if (!row)
|
|
52
|
+
return false;
|
|
53
|
+
if (row.status === 'ready')
|
|
54
|
+
return true;
|
|
55
|
+
if (isClaimLive(row, Date.now())) {
|
|
56
|
+
this._schedule(row.expiresAt);
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
async settle(artifactId, knowledgeId) {
|
|
62
|
+
if (this._paused() || this._closed())
|
|
63
|
+
return;
|
|
64
|
+
const row = await getIndexingStatus(this._mesh, artifactId);
|
|
65
|
+
if (row?.status === 'ready')
|
|
66
|
+
return;
|
|
67
|
+
if (row && isClaimLive(row, Date.now())) {
|
|
68
|
+
this._schedule(row.expiresAt);
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
if (this._paused() || this._closed())
|
|
72
|
+
return;
|
|
73
|
+
const claim = await this.claim(artifactId, knowledgeId);
|
|
74
|
+
if (!claim?.claimId)
|
|
75
|
+
return;
|
|
76
|
+
try {
|
|
77
|
+
const { applied } = await resolveIndexing(this._mesh, {
|
|
78
|
+
artifactId,
|
|
79
|
+
claimId: claim.claimId,
|
|
80
|
+
status: 'ready'
|
|
81
|
+
});
|
|
82
|
+
if (applied)
|
|
83
|
+
logger.info('rag', 'repaired to ready', { id: artifactId });
|
|
84
|
+
}
|
|
85
|
+
catch (err) {
|
|
86
|
+
logger.debug('rag', 'repair resolve dropped', { id: artifactId, err });
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import type { AbortSignal } from 'bare-abort-controller';
|
|
2
|
+
import type { BlobId } from 'hyperblobs';
|
|
3
|
+
import { type IndexingProgress } from '../rag/index.ts';
|
|
4
|
+
import { IndexingClaims } from './claims.ts';
|
|
5
|
+
import { ArtifactOwnership } from './ownership.ts';
|
|
6
|
+
import { resolveIndexing } from './protocol.ts';
|
|
7
|
+
import type { IndexingSource } from './source.ts';
|
|
8
|
+
import { type FileRecord } from '../records/index.ts';
|
|
9
|
+
import type { Mesh } from '../../mesh.ts';
|
|
10
|
+
import type { LocalWork } from './state.ts';
|
|
11
|
+
import type { FileProcessor } from './index.ts';
|
|
12
|
+
export declare class FileDocument {
|
|
13
|
+
private readonly _mesh;
|
|
14
|
+
readonly record: FileRecord;
|
|
15
|
+
readonly state: ReturnType<Mesh['files']['state']['document']>;
|
|
16
|
+
readonly source: ReturnType<typeof fileSource>;
|
|
17
|
+
readonly claims: {
|
|
18
|
+
markFailed: IndexingClaims['markFailed'];
|
|
19
|
+
isFailed: IndexingClaims['isFailed'];
|
|
20
|
+
blockedByStatus: IndexingClaims['blockedByStatus'];
|
|
21
|
+
claim: (id: string) => ReturnType<IndexingClaims['claim']>;
|
|
22
|
+
settle: (id: string) => Promise<void>;
|
|
23
|
+
};
|
|
24
|
+
readonly ownership: ArtifactOwnership;
|
|
25
|
+
readonly schedule: (deadline: number) => void;
|
|
26
|
+
readonly closed: () => boolean;
|
|
27
|
+
readonly paused: () => boolean;
|
|
28
|
+
private readonly _output;
|
|
29
|
+
private readonly _progress?;
|
|
30
|
+
private readonly _processor;
|
|
31
|
+
constructor(mesh: Mesh, options: {
|
|
32
|
+
record: FileRecord;
|
|
33
|
+
processor: FileProcessor;
|
|
34
|
+
source: IndexingSource;
|
|
35
|
+
output: IndexingSource;
|
|
36
|
+
schedule: (deadline: number) => void;
|
|
37
|
+
closed: () => boolean;
|
|
38
|
+
paused: () => boolean;
|
|
39
|
+
progress?: IndexingProgress;
|
|
40
|
+
});
|
|
41
|
+
get localCoreKey(): string;
|
|
42
|
+
artifact(id: string): {
|
|
43
|
+
knowledgeId?: string;
|
|
44
|
+
terminal?: boolean;
|
|
45
|
+
failedReference?: string;
|
|
46
|
+
unavailable?: {
|
|
47
|
+
blobRef: string;
|
|
48
|
+
repeated: boolean;
|
|
49
|
+
};
|
|
50
|
+
rebuildFailures?: number;
|
|
51
|
+
published?: {
|
|
52
|
+
artifactBlobId: string;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
readArtifact(id: string): Readonly<{
|
|
56
|
+
knowledgeId?: string;
|
|
57
|
+
terminal?: boolean;
|
|
58
|
+
failedReference?: string;
|
|
59
|
+
unavailable?: {
|
|
60
|
+
blobRef: string;
|
|
61
|
+
repeated: boolean;
|
|
62
|
+
};
|
|
63
|
+
rebuildFailures?: number;
|
|
64
|
+
published?: {
|
|
65
|
+
artifactBlobId: string;
|
|
66
|
+
};
|
|
67
|
+
}> | undefined;
|
|
68
|
+
output(id: string, reference: string): {
|
|
69
|
+
read: (signal?: AbortSignal) => Promise<import("./source.ts").SourceRead>;
|
|
70
|
+
blockedUntil: () => number | null;
|
|
71
|
+
miss: () => number;
|
|
72
|
+
clear: () => void;
|
|
73
|
+
};
|
|
74
|
+
artifacts(): Promise<import("../../../../spec/index").QvacKnowledgeArtifact[]>;
|
|
75
|
+
statuses(): Promise<import("../../../../spec/index").QvacIndexingStatus[]>;
|
|
76
|
+
current(): Promise<FileRecord | null>;
|
|
77
|
+
publish(input: Omit<Parameters<Mesh['files']['publish']>[0], 'knowledgeId'>): Promise<import("../../../../spec/index").QvacKnowledgeArtifact>;
|
|
78
|
+
resolve(input: Parameters<typeof resolveIndexing>[1]): Promise<{
|
|
79
|
+
row: import("../../../../spec/index").QvacIndexingStatus;
|
|
80
|
+
applied: boolean;
|
|
81
|
+
}>;
|
|
82
|
+
write(bytes: Buffer): Promise<{
|
|
83
|
+
blobRef: BlobId;
|
|
84
|
+
artifactBlobId: string;
|
|
85
|
+
}>;
|
|
86
|
+
inline(bytes: Buffer, mimeType: string): string;
|
|
87
|
+
work(state: LocalWork): void;
|
|
88
|
+
load(state: LocalWork, artifactId?: string): void;
|
|
89
|
+
report(update: Omit<Parameters<IndexingProgress>[0], 'knowledgeId' | 'chatId'>): void;
|
|
90
|
+
}
|
|
91
|
+
declare function fileSource(source: IndexingSource, { id, reference }: {
|
|
92
|
+
id: string;
|
|
93
|
+
reference: string;
|
|
94
|
+
}): {
|
|
95
|
+
read: (signal?: AbortSignal) => Promise<import("./source.ts").SourceRead>;
|
|
96
|
+
blockedUntil: () => number | null;
|
|
97
|
+
miss: () => number;
|
|
98
|
+
clear: () => void;
|
|
99
|
+
};
|
|
100
|
+
export {};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import {} from "../rag/index.js";
|
|
2
|
+
import { IndexingClaims } from "./claims.js";
|
|
3
|
+
import { ArtifactOwnership } from "./ownership.js";
|
|
4
|
+
import { listIndexingByKnowledge, resolveIndexing } from "./protocol.js";
|
|
5
|
+
import { fileRecord } from "../records/index.js";
|
|
6
|
+
export class FileDocument {
|
|
7
|
+
_mesh;
|
|
8
|
+
record;
|
|
9
|
+
state;
|
|
10
|
+
source;
|
|
11
|
+
claims;
|
|
12
|
+
ownership;
|
|
13
|
+
schedule;
|
|
14
|
+
closed;
|
|
15
|
+
paused;
|
|
16
|
+
_output;
|
|
17
|
+
_progress;
|
|
18
|
+
_processor;
|
|
19
|
+
constructor(mesh, options) {
|
|
20
|
+
const { record } = options;
|
|
21
|
+
this._mesh = mesh;
|
|
22
|
+
this.record = record;
|
|
23
|
+
this._processor = options.processor;
|
|
24
|
+
const state = mesh.files.processorState(options.processor.id);
|
|
25
|
+
this.state = state.document(record.id);
|
|
26
|
+
this.source = fileSource(options.source, { id: record.id, reference: record.blobId });
|
|
27
|
+
this._output = options.output;
|
|
28
|
+
this.schedule = options.schedule;
|
|
29
|
+
this.closed = () => options.closed() || !!mesh.closing;
|
|
30
|
+
this.paused = options.paused;
|
|
31
|
+
this._progress = options.progress;
|
|
32
|
+
const claims = new IndexingClaims({
|
|
33
|
+
mesh,
|
|
34
|
+
...options,
|
|
35
|
+
state,
|
|
36
|
+
advisory: record.kind === 'attachment'
|
|
37
|
+
});
|
|
38
|
+
this.claims = {
|
|
39
|
+
markFailed: (id) => claims.markFailed(id),
|
|
40
|
+
isFailed: (id) => claims.isFailed(id),
|
|
41
|
+
blockedByStatus: (id) => claims.blockedByStatus(id),
|
|
42
|
+
claim: (id) => claims.claim(id, record.id),
|
|
43
|
+
settle: (id) => claims.settle(id, record.id)
|
|
44
|
+
};
|
|
45
|
+
this.ownership = new ArtifactOwnership(mesh, state);
|
|
46
|
+
}
|
|
47
|
+
get localCoreKey() {
|
|
48
|
+
return this._mesh.blobs.core.key.toString('hex');
|
|
49
|
+
}
|
|
50
|
+
artifact(id) {
|
|
51
|
+
return this._mesh.files.processorState(this._processor.id).artifact(id);
|
|
52
|
+
}
|
|
53
|
+
readArtifact(id) {
|
|
54
|
+
return this._mesh.files.state.readArtifact(id);
|
|
55
|
+
}
|
|
56
|
+
output(id, reference) {
|
|
57
|
+
this.artifact(id).knowledgeId = this.record.id;
|
|
58
|
+
return fileSource(this._output, { id, reference });
|
|
59
|
+
}
|
|
60
|
+
artifacts() {
|
|
61
|
+
return this._mesh.files.artifacts(this.record.id);
|
|
62
|
+
}
|
|
63
|
+
statuses() {
|
|
64
|
+
return listIndexingByKnowledge(this._mesh, { knowledgeId: this.record.id });
|
|
65
|
+
}
|
|
66
|
+
current() {
|
|
67
|
+
return fileRecord(this._mesh.view, this.record.id, this._processor.input);
|
|
68
|
+
}
|
|
69
|
+
publish(input) {
|
|
70
|
+
return this._mesh.files.publish({ ...input, knowledgeId: this.record.id });
|
|
71
|
+
}
|
|
72
|
+
resolve(input) {
|
|
73
|
+
return resolveIndexing(this._mesh, input);
|
|
74
|
+
}
|
|
75
|
+
async write(bytes) {
|
|
76
|
+
const { blobRef, reference } = await this._mesh.files.put(bytes);
|
|
77
|
+
return { blobRef, artifactBlobId: reference };
|
|
78
|
+
}
|
|
79
|
+
inline(bytes, mimeType) {
|
|
80
|
+
return this._mesh.files.inline(bytes, mimeType);
|
|
81
|
+
}
|
|
82
|
+
work(state) {
|
|
83
|
+
this._mesh.files.work(this.record.id, state, this._processor.id);
|
|
84
|
+
}
|
|
85
|
+
load(state, artifactId) {
|
|
86
|
+
this._mesh.files.load(this.record.id, state, { artifactId, processorId: this._processor.id });
|
|
87
|
+
}
|
|
88
|
+
report(update) {
|
|
89
|
+
const progress = { ...update, knowledgeId: this.record.id, chatId: this.record.chatId };
|
|
90
|
+
this._mesh.files.report(progress, this._processor.id);
|
|
91
|
+
this._progress?.(progress);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
function fileSource(source, { id, reference }) {
|
|
95
|
+
return {
|
|
96
|
+
read: (signal) => source.read(id, reference, signal),
|
|
97
|
+
blockedUntil: () => source.retryBlockedUntil(id, Date.now()),
|
|
98
|
+
miss: () => source.retryMiss(id, Date.now()),
|
|
99
|
+
clear: () => source.retryClear(id)
|
|
100
|
+
};
|
|
101
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { type AbortSignal } from 'bare-abort-controller';
|
|
2
|
+
import { type IndexingProgress } from '../rag/index.ts';
|
|
3
|
+
import { type FileInput, type FileRecord } from '../records/index.ts';
|
|
4
|
+
import type { Mesh } from '../../mesh.ts';
|
|
5
|
+
import { FileDocument } from './document.ts';
|
|
6
|
+
import type { QvacKnowledgeArtifact } from '../../../../spec/mesh/hyperschema/types.d.ts';
|
|
7
|
+
export interface FileProcessor {
|
|
8
|
+
readonly id: string;
|
|
9
|
+
readonly version: string;
|
|
10
|
+
readonly input: FileInput;
|
|
11
|
+
readonly output: 'blob' | 'inline';
|
|
12
|
+
readonly mediaKind?: string;
|
|
13
|
+
accepts?(output: QvacKnowledgeArtifact, document: FileRecord): boolean;
|
|
14
|
+
applies(document: FileRecord): boolean;
|
|
15
|
+
canProduce(document: FileRecord, host: {
|
|
16
|
+
mesh: Mesh;
|
|
17
|
+
deviceId: Buffer | null;
|
|
18
|
+
}): boolean | Promise<boolean>;
|
|
19
|
+
produce(document: FileDocument, signal: AbortSignal): Promise<void>;
|
|
20
|
+
load?(document: FileDocument, signal: AbortSignal): Promise<void>;
|
|
21
|
+
close(): Promise<boolean>;
|
|
22
|
+
}
|
|
23
|
+
export declare class FileProcessing {
|
|
24
|
+
private readonly _mesh;
|
|
25
|
+
private readonly _processor;
|
|
26
|
+
private readonly _deviceId;
|
|
27
|
+
private readonly _source;
|
|
28
|
+
private readonly _output;
|
|
29
|
+
private readonly _progress?;
|
|
30
|
+
private readonly _lanes;
|
|
31
|
+
private readonly _deadlines;
|
|
32
|
+
private readonly _scheduler;
|
|
33
|
+
private _scanning;
|
|
34
|
+
private _dirty;
|
|
35
|
+
private _paused;
|
|
36
|
+
private _closed;
|
|
37
|
+
private _close;
|
|
38
|
+
private _indexCleared;
|
|
39
|
+
private readonly _onDirty;
|
|
40
|
+
private readonly _onAll;
|
|
41
|
+
constructor(mesh: Mesh, options: {
|
|
42
|
+
processor: FileProcessor;
|
|
43
|
+
deviceId: Buffer | null;
|
|
44
|
+
retryMs?: number;
|
|
45
|
+
progress?: IndexingProgress;
|
|
46
|
+
});
|
|
47
|
+
start(): void;
|
|
48
|
+
suspend(): Promise<void>;
|
|
49
|
+
resume(): void;
|
|
50
|
+
reconnect(): void;
|
|
51
|
+
close(): Promise<void>;
|
|
52
|
+
get indexCleared(): boolean;
|
|
53
|
+
settle(): Promise<void>;
|
|
54
|
+
enqueue(ids: Iterable<string>, options?: {
|
|
55
|
+
wait?: boolean;
|
|
56
|
+
}): Promise<void>;
|
|
57
|
+
private _enqueue;
|
|
58
|
+
get active(): boolean;
|
|
59
|
+
pending(id: string): boolean;
|
|
60
|
+
prioritize(ids: string[]): void;
|
|
61
|
+
private _shutdown;
|
|
62
|
+
private _stop;
|
|
63
|
+
private _kick;
|
|
64
|
+
private _scan;
|
|
65
|
+
private _documents;
|
|
66
|
+
private _pump;
|
|
67
|
+
private _drain;
|
|
68
|
+
private _schedule;
|
|
69
|
+
private _retry;
|
|
70
|
+
}
|
|
71
|
+
export type { FileDocument } from './document.ts';
|
|
72
|
+
export { isClaimLive, listIndexingByChat } from './protocol.ts';
|
|
73
|
+
export { FileState } from './state.ts';
|
|
74
|
+
export type { IndexingProgressEntry, LocalWork } from './state.ts';
|
|
75
|
+
export { settleFiles } from './settle.ts';
|