@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,186 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { pipelinePromise, Readable } from 'streamx';
|
|
4
|
+
import { STAGING_DIR as HARNESS_STAGING_DIR } from '@qvac/harness/lib/staging.ts';
|
|
5
|
+
import { userTmpPath } from '@qvac/harness/lib/tmp-path.ts';
|
|
6
|
+
import { MAX_DRIVE_BYTES } from '@qvac/harness/lib/tools/fs/remote.ts';
|
|
7
|
+
export const DRIVE_OP_TIMEOUT_MS = 15_000;
|
|
8
|
+
const STAGING_DIR = userTmpPath('qvac-fs-drive-host');
|
|
9
|
+
const STAGING_MAX_AGE_MS = 60 * 60 * 1000;
|
|
10
|
+
const noop = () => { };
|
|
11
|
+
export async function sweepDriveStaging(now = Date.now()) {
|
|
12
|
+
const names = await fs.promises.readdir(STAGING_DIR).catch(() => []);
|
|
13
|
+
await Promise.all(names.map(async (name) => {
|
|
14
|
+
const file = path.join(STAGING_DIR, name);
|
|
15
|
+
const stat = await fs.promises.stat(file).catch(() => null);
|
|
16
|
+
if (stat && now - stat.mtimeMs > STAGING_MAX_AGE_MS) {
|
|
17
|
+
await fs.promises.unlink(file).catch(noop);
|
|
18
|
+
}
|
|
19
|
+
}));
|
|
20
|
+
}
|
|
21
|
+
function withDeadline(op, ms, task) {
|
|
22
|
+
const controller = new AbortController();
|
|
23
|
+
const { promise, resolve, reject } = Promise.withResolvers();
|
|
24
|
+
const timer = setTimeout(() => {
|
|
25
|
+
controller.abort();
|
|
26
|
+
reject(new Error(`drive ${op} timed out on the host`));
|
|
27
|
+
}, ms);
|
|
28
|
+
task(controller.signal).then((value) => {
|
|
29
|
+
clearTimeout(timer);
|
|
30
|
+
resolve(value);
|
|
31
|
+
}, (err) => {
|
|
32
|
+
clearTimeout(timer);
|
|
33
|
+
reject(err);
|
|
34
|
+
});
|
|
35
|
+
return promise;
|
|
36
|
+
}
|
|
37
|
+
async function stagedPath(prefix) {
|
|
38
|
+
await fs.promises.mkdir(STAGING_DIR, { recursive: true, mode: 0o700 });
|
|
39
|
+
const unique = `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
|
|
40
|
+
return path.join(STAGING_DIR, `${prefix}-${unique}`);
|
|
41
|
+
}
|
|
42
|
+
function stripMetadata(entry) {
|
|
43
|
+
if (!entry)
|
|
44
|
+
return null;
|
|
45
|
+
return { ...entry, value: { ...entry.value, metadata: null } };
|
|
46
|
+
}
|
|
47
|
+
async function pipeCapped(source, target, cap, signal) {
|
|
48
|
+
const sink = fs.createWriteStream(target, { mode: 0o600 });
|
|
49
|
+
let sinkError = null;
|
|
50
|
+
sink.on('error', (err) => {
|
|
51
|
+
sinkError = err;
|
|
52
|
+
});
|
|
53
|
+
let written = 0;
|
|
54
|
+
let truncated = false;
|
|
55
|
+
try {
|
|
56
|
+
for await (const chunk of source) {
|
|
57
|
+
if (signal.aborted)
|
|
58
|
+
break;
|
|
59
|
+
if (sinkError)
|
|
60
|
+
throw sinkError;
|
|
61
|
+
if (written >= cap) {
|
|
62
|
+
truncated = true;
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
const room = cap - written;
|
|
66
|
+
const slice = chunk.byteLength > room ? chunk.subarray(0, room) : chunk;
|
|
67
|
+
sink.write(slice);
|
|
68
|
+
written += slice.byteLength;
|
|
69
|
+
if (slice.byteLength < chunk.byteLength)
|
|
70
|
+
truncated = true;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
finally {
|
|
74
|
+
await new Promise((resolve) => sink.end(resolve));
|
|
75
|
+
}
|
|
76
|
+
if (sinkError)
|
|
77
|
+
throw sinkError;
|
|
78
|
+
return truncated;
|
|
79
|
+
}
|
|
80
|
+
function folderRange(folder) {
|
|
81
|
+
const trimmed = folder === '/' ? '' : folder.replace(/\/+$/, '');
|
|
82
|
+
return { gt: `${trimmed}/`, lt: `${trimmed}0` };
|
|
83
|
+
}
|
|
84
|
+
async function handleRequest(acquired, request, signal) {
|
|
85
|
+
const drive = acquired.drive;
|
|
86
|
+
switch (request.op) {
|
|
87
|
+
case 'entry': {
|
|
88
|
+
const entry = await drive.entry(request.key, { timeout: DRIVE_OP_TIMEOUT_MS, wait: true });
|
|
89
|
+
return { entry: stripMetadata(entry) };
|
|
90
|
+
}
|
|
91
|
+
case 'get': {
|
|
92
|
+
const entry = await drive.entry(request.key, { timeout: DRIVE_OP_TIMEOUT_MS, wait: true });
|
|
93
|
+
if (!entry)
|
|
94
|
+
return { path: null };
|
|
95
|
+
if ((entry.value.blob?.byteLength ?? 0) > MAX_DRIVE_BYTES) {
|
|
96
|
+
return { error: `get exceeds ${MAX_DRIVE_BYTES} bytes: ${request.key}` };
|
|
97
|
+
}
|
|
98
|
+
const buffer = await drive.get(request.key, { timeout: DRIVE_OP_TIMEOUT_MS, wait: true });
|
|
99
|
+
if (!buffer)
|
|
100
|
+
return { path: null };
|
|
101
|
+
const target = await stagedPath('drive-get');
|
|
102
|
+
signal.addEventListener('abort', () => void fs.promises.unlink(target).catch(noop), {
|
|
103
|
+
once: true
|
|
104
|
+
});
|
|
105
|
+
await fs.promises.writeFile(target, buffer, { mode: 0o600 });
|
|
106
|
+
return { path: target };
|
|
107
|
+
}
|
|
108
|
+
case 'read': {
|
|
109
|
+
const target = await stagedPath('drive-read');
|
|
110
|
+
signal.addEventListener('abort', () => void fs.promises.unlink(target).catch(noop), {
|
|
111
|
+
once: true
|
|
112
|
+
});
|
|
113
|
+
const truncated = await pipeCapped(drive.createReadStream(request.key), target, MAX_DRIVE_BYTES, signal);
|
|
114
|
+
return { path: target, truncated };
|
|
115
|
+
}
|
|
116
|
+
case 'list': {
|
|
117
|
+
const skip = new Set(request.skip);
|
|
118
|
+
const entries = [];
|
|
119
|
+
let cursor = null;
|
|
120
|
+
const ignore = (key) => key.split('/').some((seg) => skip.has(seg));
|
|
121
|
+
const range = folderRange(request.folder);
|
|
122
|
+
const gt = request.cursor ?? range.gt;
|
|
123
|
+
for await (const raw of drive.entries({ gt, lt: range.lt }, { ignore })) {
|
|
124
|
+
entries.push(stripMetadata(raw));
|
|
125
|
+
if (entries.length >= request.limit) {
|
|
126
|
+
cursor = raw.key;
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return { entries, cursor };
|
|
131
|
+
}
|
|
132
|
+
case 'write': {
|
|
133
|
+
if (!acquired.writable)
|
|
134
|
+
return { error: `drive is read-only: cannot write ${request.key}` };
|
|
135
|
+
const resolvedPath = path.resolve(request.path);
|
|
136
|
+
if (path.relative(HARNESS_STAGING_DIR, resolvedPath).startsWith('..')) {
|
|
137
|
+
return { error: `write path is outside the staging directory: ${request.path}` };
|
|
138
|
+
}
|
|
139
|
+
const source = Readable.from(fs.createReadStream(resolvedPath));
|
|
140
|
+
const sink = drive.createWriteStream(request.key, request.executable ? { executable: true } : undefined);
|
|
141
|
+
signal.addEventListener('abort', () => {
|
|
142
|
+
source.destroy();
|
|
143
|
+
sink.destroy();
|
|
144
|
+
}, { once: true });
|
|
145
|
+
await pipelinePromise(source, sink);
|
|
146
|
+
await fs.promises.unlink(resolvedPath).catch(noop);
|
|
147
|
+
return {};
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
export function createDriveOp(drives) {
|
|
152
|
+
return async (request) => {
|
|
153
|
+
const acquired = drives.get(request.driveKey);
|
|
154
|
+
if (!acquired)
|
|
155
|
+
return { error: `drive not granted for this run: ${request.driveKey}` };
|
|
156
|
+
try {
|
|
157
|
+
return await withDeadline(request.op, DRIVE_OP_TIMEOUT_MS, (signal) => handleRequest(acquired, request, signal));
|
|
158
|
+
}
|
|
159
|
+
catch (err) {
|
|
160
|
+
return { error: err instanceof Error ? err.message : String(err) };
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
export async function resolveFsGrants(grants, driveHost, onDropped) {
|
|
165
|
+
const grantedDirs = grants
|
|
166
|
+
.filter((grant) => grant.kind === 'local')
|
|
167
|
+
.map((grant) => grant.path);
|
|
168
|
+
const hyperGrants = grants.filter((grant) => grant.kind === 'hyper');
|
|
169
|
+
if (!driveHost || hyperGrants.length === 0)
|
|
170
|
+
return { grantedDirs, grantedDrives: [] };
|
|
171
|
+
const drives = new Map();
|
|
172
|
+
const grantedDrives = [];
|
|
173
|
+
for (const grant of hyperGrants) {
|
|
174
|
+
try {
|
|
175
|
+
const acquired = await driveHost.acquire(grant.key);
|
|
176
|
+
drives.set(grant.key, acquired);
|
|
177
|
+
grantedDrives.push({ key: grant.key, writable: acquired.writable });
|
|
178
|
+
}
|
|
179
|
+
catch (err) {
|
|
180
|
+
onDropped?.(grant.key, err);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
if (drives.size === 0)
|
|
184
|
+
return { grantedDirs, grantedDrives: [] };
|
|
185
|
+
return { grantedDirs, grantedDrives, driveOp: createDriveOp(drives) };
|
|
186
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type FsGrant = {
|
|
2
|
+
readonly kind: 'local';
|
|
3
|
+
readonly path: string;
|
|
4
|
+
} | HyperGrant;
|
|
5
|
+
export interface HyperGrant {
|
|
6
|
+
readonly kind: 'hyper';
|
|
7
|
+
readonly key: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function fsGrantsFrom(value: unknown): FsGrant[];
|
|
10
|
+
export declare function grantedDirsFrom(value: unknown): string[];
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import HypercoreId from 'hypercore-id-encoding';
|
|
3
|
+
function parseHyperKey(value) {
|
|
4
|
+
if (typeof value !== 'string')
|
|
5
|
+
return null;
|
|
6
|
+
try {
|
|
7
|
+
HypercoreId.decode(value);
|
|
8
|
+
return value;
|
|
9
|
+
}
|
|
10
|
+
catch {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export function fsGrantsFrom(value) {
|
|
15
|
+
if (!Array.isArray(value))
|
|
16
|
+
return [];
|
|
17
|
+
const grants = [];
|
|
18
|
+
for (const item of value) {
|
|
19
|
+
if (typeof item === 'string') {
|
|
20
|
+
if (path.isAbsolute(item))
|
|
21
|
+
grants.push({ kind: 'local', path: item });
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
if (!item || typeof item !== 'object')
|
|
25
|
+
continue;
|
|
26
|
+
const kind = item.kind;
|
|
27
|
+
if (kind === 'local') {
|
|
28
|
+
const dir = item.path;
|
|
29
|
+
if (typeof dir === 'string' && path.isAbsolute(dir))
|
|
30
|
+
grants.push({ kind: 'local', path: dir });
|
|
31
|
+
}
|
|
32
|
+
else if (kind === 'hyper') {
|
|
33
|
+
const key = parseHyperKey(item.key);
|
|
34
|
+
if (key)
|
|
35
|
+
grants.push({ kind: 'hyper', key });
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return grants;
|
|
39
|
+
}
|
|
40
|
+
export function grantedDirsFrom(value) {
|
|
41
|
+
if (!Array.isArray(value))
|
|
42
|
+
return [];
|
|
43
|
+
return value.filter((dir) => typeof dir === 'string' && path.isAbsolute(dir));
|
|
44
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function defaultImageCacheDir(): string;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export type { SkillSetup, SkillSetupField, SkillSetupRoute } from '../skill-types.ts';
|
|
2
|
+
export { isMcpTokenProvider, MCP_TOKEN_PROVIDERS, type McpProviderConfig, type McpTokenProvider, resolveMcpProvider } from './mcp-providers.ts';
|
|
3
|
+
export { OAUTH_PROVIDERS, type OAuthIntegrationConfig, resolveOAuthProviderByCredentialKey } from './oauth-providers.ts';
|
|
4
|
+
export { deriveSetupRoutes, SETUP_ROUTE_KIND } from './setup-routes.ts';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type McpTokenProvider = 'github';
|
|
2
|
+
export type McpProviderConfig = {
|
|
3
|
+
readonly provider: McpTokenProvider;
|
|
4
|
+
readonly credentialKey: string;
|
|
5
|
+
readonly label: string;
|
|
6
|
+
readonly description: string;
|
|
7
|
+
readonly tokenHelpUrl: string;
|
|
8
|
+
readonly guide?: ReadonlyArray<string> | undefined;
|
|
9
|
+
};
|
|
10
|
+
export declare const MCP_TOKEN_PROVIDERS: ReadonlyArray<McpProviderConfig>;
|
|
11
|
+
export declare function isMcpTokenProvider(value: unknown): value is McpTokenProvider;
|
|
12
|
+
export declare function resolveMcpProvider(provider: McpTokenProvider): McpProviderConfig;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const GITHUB_CONFIG = {
|
|
2
|
+
provider: 'github',
|
|
3
|
+
credentialKey: 'github_access_token',
|
|
4
|
+
label: 'GitHub',
|
|
5
|
+
description: 'Repos, pull requests, issues, and workflow runs — Personal Access Token',
|
|
6
|
+
tokenHelpUrl: 'https://github.com/settings/tokens',
|
|
7
|
+
guide: [
|
|
8
|
+
'Create a personal access token (classic) at https://github.com/settings/tokens — scopes: repo and read:org. Classic tokens work everywhere; fine-grained ones need per-org enablement.',
|
|
9
|
+
'Paste it above and click Save.',
|
|
10
|
+
'For organizations enforcing SAML SSO, authorize the token for the org after creating it.'
|
|
11
|
+
]
|
|
12
|
+
};
|
|
13
|
+
const REGISTRY = {
|
|
14
|
+
github: GITHUB_CONFIG
|
|
15
|
+
};
|
|
16
|
+
export const MCP_TOKEN_PROVIDERS = Object.values(REGISTRY);
|
|
17
|
+
export function isMcpTokenProvider(value) {
|
|
18
|
+
return typeof value === 'string' && Object.hasOwn(REGISTRY, value);
|
|
19
|
+
}
|
|
20
|
+
export function resolveMcpProvider(provider) {
|
|
21
|
+
return REGISTRY[provider];
|
|
22
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { OAuthProvider } from '../oauth/types.ts';
|
|
2
|
+
import type { SkillSetupField } from '../skill-types.ts';
|
|
3
|
+
export type OAuthIntegrationConfig = {
|
|
4
|
+
readonly provider: OAuthProvider;
|
|
5
|
+
readonly credentialKey: string;
|
|
6
|
+
readonly label: string;
|
|
7
|
+
readonly description: string;
|
|
8
|
+
readonly helpUrl?: string | undefined;
|
|
9
|
+
readonly fields?: ReadonlyArray<SkillSetupField> | undefined;
|
|
10
|
+
readonly guide?: ReadonlyArray<string> | undefined;
|
|
11
|
+
readonly configGuide?: ReadonlyArray<string> | undefined;
|
|
12
|
+
};
|
|
13
|
+
export declare const OAUTH_PROVIDERS: ReadonlyArray<OAuthIntegrationConfig>;
|
|
14
|
+
export declare function resolveOAuthProviderByCredentialKey(credentialKey: string): OAuthIntegrationConfig | null;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { ASANA_MCP_CREDENTIAL_KEY, GMAIL_CREDENTIAL_KEY, GOOGLE_CALENDAR_CREDENTIAL_KEY, GOOGLE_DOCS_CREDENTIAL_KEY, GOOGLE_DRIVE_CREDENTIAL_KEY, GOOGLE_SHEETS_CREDENTIAL_KEY, NOTION_MCP_CREDENTIAL_KEY, SPOTIFY_CREDENTIAL_KEY } from "../oauth/keys.js";
|
|
2
|
+
const OAUTH_CLIENT_FIELDS = [
|
|
3
|
+
{
|
|
4
|
+
key: 'clientId',
|
|
5
|
+
label: 'Client ID',
|
|
6
|
+
placeholder: 'OAuth client ID from your app'
|
|
7
|
+
},
|
|
8
|
+
{ key: 'clientSecret', label: 'Client Secret', secret: true }
|
|
9
|
+
];
|
|
10
|
+
function googleConfig(input) {
|
|
11
|
+
return {
|
|
12
|
+
provider: 'google',
|
|
13
|
+
credentialKey: input.credentialKey,
|
|
14
|
+
label: input.label,
|
|
15
|
+
description: input.description,
|
|
16
|
+
fields: OAUTH_CLIENT_FIELDS,
|
|
17
|
+
guide: [
|
|
18
|
+
`Click Connect and approve access in the browser. Approving grants ${input.grants} only.`,
|
|
19
|
+
'Each Google skill is connected separately, with its own app and its own approval.'
|
|
20
|
+
],
|
|
21
|
+
configGuide: [
|
|
22
|
+
`[Open Google Cloud Console](https://console.cloud.google.com/flows/enableapi?apiid=${input.api}) to enable the ${input.label} API`,
|
|
23
|
+
'[Open OAuth clients](https://console.cloud.google.com/auth/clients) to create an OAuth client — choose "Desktop app" as the type',
|
|
24
|
+
'[Open OAuth audience](https://console.cloud.google.com/auth/audience) and add your Google account as a test user'
|
|
25
|
+
]
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
const GOOGLE_CONFIGS = [
|
|
29
|
+
googleConfig({
|
|
30
|
+
credentialKey: GMAIL_CREDENTIAL_KEY,
|
|
31
|
+
label: 'Gmail',
|
|
32
|
+
description: 'Read, search, send, and manage Gmail messages and labels',
|
|
33
|
+
api: 'gmail.googleapis.com',
|
|
34
|
+
grants: 'access to your Gmail'
|
|
35
|
+
}),
|
|
36
|
+
googleConfig({
|
|
37
|
+
credentialKey: GOOGLE_CALENDAR_CREDENTIAL_KEY,
|
|
38
|
+
label: 'Google Calendar',
|
|
39
|
+
description: 'List, create, update, and delete Google Calendar events',
|
|
40
|
+
api: 'calendar-json.googleapis.com',
|
|
41
|
+
grants: 'access to your calendars'
|
|
42
|
+
}),
|
|
43
|
+
googleConfig({
|
|
44
|
+
credentialKey: GOOGLE_DOCS_CREDENTIAL_KEY,
|
|
45
|
+
label: 'Google Docs',
|
|
46
|
+
description: 'Create, read, and edit Google Docs documents',
|
|
47
|
+
api: 'docs.googleapis.com,drive.googleapis.com',
|
|
48
|
+
grants: 'access to your documents and Drive files'
|
|
49
|
+
}),
|
|
50
|
+
googleConfig({
|
|
51
|
+
credentialKey: GOOGLE_DRIVE_CREDENTIAL_KEY,
|
|
52
|
+
label: 'Google Drive',
|
|
53
|
+
description: 'Search, list, and manage Google Drive files and folders',
|
|
54
|
+
api: 'drive.googleapis.com',
|
|
55
|
+
grants: 'access to your Drive files'
|
|
56
|
+
}),
|
|
57
|
+
googleConfig({
|
|
58
|
+
credentialKey: GOOGLE_SHEETS_CREDENTIAL_KEY,
|
|
59
|
+
label: 'Google Sheets',
|
|
60
|
+
description: 'Create, read, and update Google Sheets spreadsheets',
|
|
61
|
+
api: 'sheets.googleapis.com,drive.googleapis.com',
|
|
62
|
+
grants: 'access to your spreadsheets and Drive files'
|
|
63
|
+
})
|
|
64
|
+
];
|
|
65
|
+
const SPOTIFY_FIELDS = [
|
|
66
|
+
{
|
|
67
|
+
key: 'clientId',
|
|
68
|
+
label: 'Client ID',
|
|
69
|
+
placeholder: 'From your app at developer.spotify.com'
|
|
70
|
+
}
|
|
71
|
+
];
|
|
72
|
+
const SPOTIFY_CONFIG = {
|
|
73
|
+
provider: 'spotify',
|
|
74
|
+
credentialKey: SPOTIFY_CREDENTIAL_KEY,
|
|
75
|
+
label: 'Spotify',
|
|
76
|
+
description: 'Search, library, and playback control — playback requires Spotify Premium',
|
|
77
|
+
helpUrl: 'https://developer.spotify.com/dashboard',
|
|
78
|
+
fields: SPOTIFY_FIELDS,
|
|
79
|
+
guide: [
|
|
80
|
+
'Search and library browsing work with any Spotify account; controlling playback (play, pause, skip) requires Spotify Premium and an open Spotify app on a device.',
|
|
81
|
+
'Create your own app at https://developer.spotify.com/dashboard (Spotify requires the app owner to hold a Premium subscription).',
|
|
82
|
+
'In the app settings, add these exact Redirect URIs: http://127.0.0.1:18974/callback (desktop) and, for mobile, the Redirect URI shown in this connect form (the scheme varies per build, e.g. qvac://oauth-callback or qvac-dev://oauth-callback).',
|
|
83
|
+
'Paste the Client ID above and click Connect, then approve access in the browser. No Client Secret is needed — Workbench uses PKCE.'
|
|
84
|
+
]
|
|
85
|
+
};
|
|
86
|
+
const ASANA_CONFIG = {
|
|
87
|
+
provider: 'asana',
|
|
88
|
+
credentialKey: ASANA_MCP_CREDENTIAL_KEY,
|
|
89
|
+
label: 'Asana',
|
|
90
|
+
description: 'Tasks, projects, and comments',
|
|
91
|
+
helpUrl: 'https://app.asana.com/0/my-apps',
|
|
92
|
+
fields: OAUTH_CLIENT_FIELDS,
|
|
93
|
+
configGuide: [
|
|
94
|
+
'[Open the Asana developer console](https://app.asana.com/0/my-apps) and create an MCP app',
|
|
95
|
+
'In OAuth settings, add the exact redirect URI shown below',
|
|
96
|
+
'In "Manage distribution", allow the workspace you want this connection to access'
|
|
97
|
+
]
|
|
98
|
+
};
|
|
99
|
+
const NOTION_CONFIG = {
|
|
100
|
+
provider: 'notion',
|
|
101
|
+
credentialKey: NOTION_MCP_CREDENTIAL_KEY,
|
|
102
|
+
label: 'Notion',
|
|
103
|
+
description: 'Pages, databases, and blocks',
|
|
104
|
+
guide: [
|
|
105
|
+
"Click Connect and approve access in the browser — Workbench uses Notion's hosted MCP OAuth, so no app credentials are needed."
|
|
106
|
+
]
|
|
107
|
+
};
|
|
108
|
+
export const OAUTH_PROVIDERS = [
|
|
109
|
+
...GOOGLE_CONFIGS,
|
|
110
|
+
SPOTIFY_CONFIG,
|
|
111
|
+
ASANA_CONFIG,
|
|
112
|
+
NOTION_CONFIG
|
|
113
|
+
];
|
|
114
|
+
export function resolveOAuthProviderByCredentialKey(credentialKey) {
|
|
115
|
+
return OAUTH_PROVIDERS.find((config) => config.credentialKey === credentialKey) ?? null;
|
|
116
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { SkillEntry, SkillSetup } from '../skill-types.ts';
|
|
2
|
+
export declare const SETUP_ROUTE_KIND: {
|
|
3
|
+
readonly oauth: "oauth";
|
|
4
|
+
readonly token: "token";
|
|
5
|
+
readonly install: "install";
|
|
6
|
+
readonly picker: "picker";
|
|
7
|
+
readonly instructions: "instructions";
|
|
8
|
+
};
|
|
9
|
+
export type DeriveSetupOptions = {
|
|
10
|
+
readonly sandboxed?: boolean;
|
|
11
|
+
};
|
|
12
|
+
export declare function deriveSetupRoutes(entry: SkillEntry, options?: DeriveSetupOptions): SkillSetup;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { OBSIDIAN_VAULT_PATH_CREDENTIAL_KEY } from "../obsidian-key.js";
|
|
2
|
+
import { MCP_TOKEN_PROVIDERS } from "./mcp-providers.js";
|
|
3
|
+
import { resolveOAuthProviderByCredentialKey } from "./oauth-providers.js";
|
|
4
|
+
const UNSUPPORTED_STATE = 'unsupported';
|
|
5
|
+
export const SETUP_ROUTE_KIND = {
|
|
6
|
+
oauth: 'oauth',
|
|
7
|
+
token: 'token',
|
|
8
|
+
install: 'install',
|
|
9
|
+
picker: 'picker',
|
|
10
|
+
instructions: 'instructions'
|
|
11
|
+
};
|
|
12
|
+
const OBSIDIAN_SKILL_NAME = 'obsidian';
|
|
13
|
+
const OBSIDIAN_VAULT_PICKER = {
|
|
14
|
+
kind: SETUP_ROUTE_KIND.picker,
|
|
15
|
+
label: 'Select a vault folder',
|
|
16
|
+
provider: OBSIDIAN_SKILL_NAME,
|
|
17
|
+
credentialKey: OBSIDIAN_VAULT_PATH_CREDENTIAL_KEY,
|
|
18
|
+
description: "Pick the vault's top-level folder — the one containing its `.obsidian` settings folder, which marks it a valid Obsidian vault. Workbench then reads and writes that folder's Markdown files directly instead of using the Obsidian CLI; app-only actions (open, plugins, sync) still need the CLI and are unavailable while a folder is set. Disconnect to restore CLI mode."
|
|
19
|
+
};
|
|
20
|
+
export function deriveSetupRoutes(entry, options = {}) {
|
|
21
|
+
const base = entry.metadata.setup ?? { routes: derivedRoutes(entry) };
|
|
22
|
+
if (entry.metadata.name === OBSIDIAN_SKILL_NAME) {
|
|
23
|
+
return appendVaultPicker(base, options.sandboxed === true);
|
|
24
|
+
}
|
|
25
|
+
return base;
|
|
26
|
+
}
|
|
27
|
+
function appendVaultPicker(setup, preferPicker) {
|
|
28
|
+
const routes = setup.routes ?? [];
|
|
29
|
+
if (routes.some((route) => route.kind === SETUP_ROUTE_KIND.picker)) {
|
|
30
|
+
return preferPicker ? prioritizeVaultPicker(setup) : setup;
|
|
31
|
+
}
|
|
32
|
+
const next = preferPicker
|
|
33
|
+
? [OBSIDIAN_VAULT_PICKER, ...routes]
|
|
34
|
+
: [...routes, OBSIDIAN_VAULT_PICKER];
|
|
35
|
+
return { ...setup, routes: next };
|
|
36
|
+
}
|
|
37
|
+
function prioritizeVaultPicker(setup) {
|
|
38
|
+
const routes = setup.routes ?? [];
|
|
39
|
+
const picker = routes.find((route) => route.kind === SETUP_ROUTE_KIND.picker);
|
|
40
|
+
if (!picker || routes[0]?.kind === SETUP_ROUTE_KIND.picker) {
|
|
41
|
+
return setup;
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
...setup,
|
|
45
|
+
routes: [picker, ...routes.filter((route) => route.kind !== SETUP_ROUTE_KIND.picker)]
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function derivedRoutes(entry) {
|
|
49
|
+
const routes = [];
|
|
50
|
+
for (const key of credentialKeysFor(entry)) {
|
|
51
|
+
const route = credentialRoute(key);
|
|
52
|
+
if (route) {
|
|
53
|
+
routes.push(route);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
const install = installRoute(entry);
|
|
57
|
+
if (install) {
|
|
58
|
+
routes.push(install);
|
|
59
|
+
}
|
|
60
|
+
return routes;
|
|
61
|
+
}
|
|
62
|
+
function credentialKeysFor(entry) {
|
|
63
|
+
const transports = entry.metadata.transports ?? [];
|
|
64
|
+
if (transports.length > 0) {
|
|
65
|
+
return transports.map((transport) => transport.credentialKey);
|
|
66
|
+
}
|
|
67
|
+
return entry.metadata.requires?.credentials ?? [];
|
|
68
|
+
}
|
|
69
|
+
function credentialRoute(credentialKey) {
|
|
70
|
+
const oauth = resolveOAuthProviderByCredentialKey(credentialKey);
|
|
71
|
+
if (oauth) {
|
|
72
|
+
return {
|
|
73
|
+
kind: SETUP_ROUTE_KIND.oauth,
|
|
74
|
+
label: `Connect ${oauth.label}`,
|
|
75
|
+
provider: oauth.provider,
|
|
76
|
+
credentialKey,
|
|
77
|
+
description: oauth.description,
|
|
78
|
+
helpUrl: oauth.helpUrl,
|
|
79
|
+
fields: oauth.fields,
|
|
80
|
+
steps: oauth.guide,
|
|
81
|
+
configSteps: oauth.configGuide
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
const token = MCP_TOKEN_PROVIDERS.find((config) => config.credentialKey === credentialKey);
|
|
85
|
+
if (token) {
|
|
86
|
+
return {
|
|
87
|
+
kind: SETUP_ROUTE_KIND.token,
|
|
88
|
+
label: `Connect ${token.label}`,
|
|
89
|
+
provider: token.provider,
|
|
90
|
+
credentialKey,
|
|
91
|
+
description: token.description,
|
|
92
|
+
helpUrl: token.tokenHelpUrl,
|
|
93
|
+
steps: token.guide,
|
|
94
|
+
fields: [{ key: credentialKey, label: token.label, secret: true, required: true }]
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
function installRoute(entry) {
|
|
100
|
+
const steps = entry.metadata.install ?? [];
|
|
101
|
+
if (steps.length === 0 || entry.state === UNSUPPORTED_STATE) {
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
const step = steps[0];
|
|
105
|
+
if (!step) {
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
return {
|
|
109
|
+
kind: SETUP_ROUTE_KIND.install,
|
|
110
|
+
label: step.label,
|
|
111
|
+
description: step.formula ? `Installs \`${step.formula}\`.` : undefined,
|
|
112
|
+
satisfied: entry.available
|
|
113
|
+
};
|
|
114
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { AbortSignal } from 'bare-abort-controller';
|
|
2
|
+
import type { Capabilities } from './api/index.ts';
|
|
3
|
+
import type { AssistantRagSearchRequest } from '../spec/hyperschema/types.d.ts';
|
|
4
|
+
export declare function searchKnowledge(engine: Pick<Capabilities, 'ragSearch' | 'fileStatusWatch'>, request: AssistantRagSearchRequest, options: {
|
|
5
|
+
signal: AbortSignal;
|
|
6
|
+
preparing: (active: boolean) => void;
|
|
7
|
+
}): Promise<import("../spec/index").AssistantRagSearchResponse>;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { isWholeDocumentQuery, referencedDocuments } from "./core/files/index.js";
|
|
2
|
+
import { raceAbort } from '@qvac/harness/race-abort';
|
|
3
|
+
export async function searchKnowledge(engine, request, options) {
|
|
4
|
+
const { signal, preparing } = options;
|
|
5
|
+
const search = await raceAbort(engine.ragSearch(request), signal);
|
|
6
|
+
if (!search.enabled || !search.hasKnowledge || !search.pendingFiles?.length)
|
|
7
|
+
return search;
|
|
8
|
+
const watch = engine.fileStatusWatch({ chatId: request.chatId });
|
|
9
|
+
const iterator = watch[Symbol.asyncIterator]();
|
|
10
|
+
let wanted = null;
|
|
11
|
+
let waiting = false;
|
|
12
|
+
try {
|
|
13
|
+
while (true) {
|
|
14
|
+
const next = await raceAbort(iterator.next(), signal);
|
|
15
|
+
if (next.done)
|
|
16
|
+
throw new Error('file status closed while preparing documents');
|
|
17
|
+
const files = next.value.files;
|
|
18
|
+
if (!wanted) {
|
|
19
|
+
const named = referencedDocuments(request.query, files.map((file) => ({ ...file, title: file.fileName })));
|
|
20
|
+
const requested = request.attachmentIds?.length
|
|
21
|
+
? files.filter((file) => request.attachmentIds.includes(file.fileId))
|
|
22
|
+
: named.length
|
|
23
|
+
? named
|
|
24
|
+
: isWholeDocumentQuery(request.query)
|
|
25
|
+
? files
|
|
26
|
+
: [];
|
|
27
|
+
wanted = new Set(requested
|
|
28
|
+
.filter((file) => search.pendingFiles.includes(file.fileName))
|
|
29
|
+
.map((file) => file.fileId));
|
|
30
|
+
if (wanted.size === 0)
|
|
31
|
+
return search;
|
|
32
|
+
}
|
|
33
|
+
if (!files.some((file) => wanted.has(file.fileId) && pending(file))) {
|
|
34
|
+
return await raceAbort(engine.ragSearch(request), signal);
|
|
35
|
+
}
|
|
36
|
+
if (!waiting) {
|
|
37
|
+
waiting = true;
|
|
38
|
+
preparing(true);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
finally {
|
|
43
|
+
watch.destroy();
|
|
44
|
+
if (waiting)
|
|
45
|
+
preparing(false);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function pending(file) {
|
|
49
|
+
const rag = file.processors.find((processor) => processor.processorId === 'rag');
|
|
50
|
+
return (!file.readyForChat &&
|
|
51
|
+
['pending', 'running', 'uploading'].includes(file.state) &&
|
|
52
|
+
rag?.state !== 'not-applicable');
|
|
53
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { AssistantAgent } from '../spec/hyperschema/types.d.ts';
|
|
2
|
+
export declare function chatKvCacheKey(chatId: string): string;
|
|
3
|
+
export declare function chatRepairKvCacheKey(chatId: string, acceptedRepairs: number): string;
|
|
4
|
+
export declare function disappearedChatIds(known: ReadonlySet<string>, current: ReadonlyArray<string>): string[];
|
|
5
|
+
export declare function agentRekeyFingerprint(agent: AssistantAgent): string;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export function chatKvCacheKey(chatId) {
|
|
2
|
+
return `chat-${chatId}`;
|
|
3
|
+
}
|
|
4
|
+
export function chatRepairKvCacheKey(chatId, acceptedRepairs) {
|
|
5
|
+
const base = chatKvCacheKey(chatId);
|
|
6
|
+
return acceptedRepairs > 0 ? `${base}/r${acceptedRepairs}` : base;
|
|
7
|
+
}
|
|
8
|
+
export function disappearedChatIds(known, current) {
|
|
9
|
+
const live = new Set(current);
|
|
10
|
+
const gone = [];
|
|
11
|
+
for (const id of known)
|
|
12
|
+
if (!live.has(id))
|
|
13
|
+
gone.push(id);
|
|
14
|
+
return gone;
|
|
15
|
+
}
|
|
16
|
+
export function agentRekeyFingerprint(agent) {
|
|
17
|
+
return JSON.stringify([
|
|
18
|
+
agent.bio,
|
|
19
|
+
agent.modelName,
|
|
20
|
+
agent.ctxSize ?? 0,
|
|
21
|
+
agent.kvCacheK ?? '',
|
|
22
|
+
agent.kvCacheV ?? '',
|
|
23
|
+
agent.enabledTools ?? null,
|
|
24
|
+
agent.enabledSkills ?? null,
|
|
25
|
+
agent.toolsScope ?? '',
|
|
26
|
+
agent.skillsScope ?? '',
|
|
27
|
+
agent.disabledToolsets ?? null
|
|
28
|
+
]);
|
|
29
|
+
}
|