@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,67 @@
|
|
|
1
|
+
import type { Harness } from './assistant.ts';
|
|
2
|
+
import { type ConfigEngine } from './oauth.ts';
|
|
3
|
+
export type CredentialEntry = {
|
|
4
|
+
key: string;
|
|
5
|
+
token?: string | null;
|
|
6
|
+
expiresAt?: number | null;
|
|
7
|
+
agentId?: string | null;
|
|
8
|
+
skill?: string | null;
|
|
9
|
+
};
|
|
10
|
+
export type SettingEntry = {
|
|
11
|
+
skill: string;
|
|
12
|
+
key: string;
|
|
13
|
+
value: string;
|
|
14
|
+
agentId?: string | null;
|
|
15
|
+
};
|
|
16
|
+
export type PusherSkill = {
|
|
17
|
+
name: string;
|
|
18
|
+
credentials?: readonly string[];
|
|
19
|
+
requires?: {
|
|
20
|
+
credentials?: readonly string[];
|
|
21
|
+
};
|
|
22
|
+
setup?: {
|
|
23
|
+
routes?: ReadonlyArray<{
|
|
24
|
+
fields?: ReadonlyArray<{
|
|
25
|
+
key: string;
|
|
26
|
+
secret?: boolean;
|
|
27
|
+
}>;
|
|
28
|
+
}>;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
export interface CredentialEngine extends ConfigEngine {
|
|
32
|
+
configWatch(req: {
|
|
33
|
+
key: string;
|
|
34
|
+
}): AsyncIterable<unknown> & {
|
|
35
|
+
destroy(): void;
|
|
36
|
+
};
|
|
37
|
+
listAgents(req: {}): Promise<{
|
|
38
|
+
agents: ReadonlyArray<{
|
|
39
|
+
id: string;
|
|
40
|
+
}>;
|
|
41
|
+
}>;
|
|
42
|
+
}
|
|
43
|
+
export type CredentialTarget = {
|
|
44
|
+
setCredentials: NonNullable<Harness['setCredentials']>;
|
|
45
|
+
setSkillSettings?: (entries: ReadonlyArray<SettingEntry>) => void | Promise<void>;
|
|
46
|
+
skills?: (agentId?: string | null, modelName?: string | null, options?: {
|
|
47
|
+
readonly skipCredentialProbe?: boolean;
|
|
48
|
+
}) => Promise<ReadonlyArray<PusherSkill>>;
|
|
49
|
+
};
|
|
50
|
+
export type CredentialPusherLogger = {
|
|
51
|
+
warn(...args: unknown[]): void;
|
|
52
|
+
};
|
|
53
|
+
export type CredentialPusherHandle = (() => Promise<void>) & {
|
|
54
|
+
sync(): Promise<void>;
|
|
55
|
+
};
|
|
56
|
+
export declare function oauthStateKeyFor(credentialKey: string): string | null;
|
|
57
|
+
export declare function nextRefreshDelay(entries: ReadonlyArray<{
|
|
58
|
+
expiresAt?: number | null;
|
|
59
|
+
}>, now?: number): number;
|
|
60
|
+
export declare function credentialOwners(catalog: ReadonlyArray<PusherSkill>): ReadonlyMap<string, readonly string[]>;
|
|
61
|
+
export declare function settingFields(catalog: ReadonlyArray<PusherSkill>): ReadonlyArray<{
|
|
62
|
+
skill: string;
|
|
63
|
+
key: string;
|
|
64
|
+
}>;
|
|
65
|
+
export declare function settingConfigKey(agentId: string | undefined, skill: string, key: string): string;
|
|
66
|
+
export declare function oauthStateKey(credentialKey: string): string | undefined;
|
|
67
|
+
export declare function startCredentialPusher(harness: CredentialTarget, engine: CredentialEngine, logger?: CredentialPusherLogger | null): CredentialPusherHandle;
|
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
import { OBSIDIAN_VAULT_PATH_CREDENTIAL_KEY } from "./obsidian-key.js";
|
|
2
|
+
import { resolveAsanaCredential, resolveGoogleCredential, resolveNotionCredential, resolveSpotifyCredential, scopedKey } from "./oauth.js";
|
|
3
|
+
import { OAUTH_KEY_SPECS, oauthStateKeyFor as specStateKeyFor } from "./oauth/keys.js";
|
|
4
|
+
import ScopeLock from 'scope-lock';
|
|
5
|
+
import { credentialSlots } from '@qvac/harness/lib/tools/skills/credential-slots.ts';
|
|
6
|
+
import { REFRESH_SKEW_MS } from "./oauth/common.js";
|
|
7
|
+
const RESOLVE_BY_PROVIDER = {
|
|
8
|
+
google: resolveGoogleCredential,
|
|
9
|
+
spotify: resolveSpotifyCredential,
|
|
10
|
+
notion: resolveNotionCredential,
|
|
11
|
+
asana: resolveAsanaCredential
|
|
12
|
+
};
|
|
13
|
+
export function oauthStateKeyFor(credentialKey) {
|
|
14
|
+
return specStateKeyFor(credentialKey);
|
|
15
|
+
}
|
|
16
|
+
const PLAIN_KEYS = ['github_access_token', OBSIDIAN_VAULT_PATH_CREDENTIAL_KEY];
|
|
17
|
+
const REFRESH_INTERVAL = 10 * 60 * 1000;
|
|
18
|
+
const MIN_REFRESH_DELAY = 30_000;
|
|
19
|
+
function storeKey(key, agentId) {
|
|
20
|
+
return agentId ? `${agentId}\0${key}` : key;
|
|
21
|
+
}
|
|
22
|
+
export function nextRefreshDelay(entries, now = Date.now()) {
|
|
23
|
+
let nearest = null;
|
|
24
|
+
for (const entry of entries) {
|
|
25
|
+
if (typeof entry.expiresAt === 'number' && entry.expiresAt > 0) {
|
|
26
|
+
if (nearest === null || entry.expiresAt < nearest)
|
|
27
|
+
nearest = entry.expiresAt;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
if (nearest === null)
|
|
31
|
+
return REFRESH_INTERVAL;
|
|
32
|
+
return Math.min(REFRESH_INTERVAL, Math.max(MIN_REFRESH_DELAY, nearest - now - REFRESH_SKEW_MS));
|
|
33
|
+
}
|
|
34
|
+
async function oauthEntry(engine, { credentialKey, stateKey, provider }, agentId) {
|
|
35
|
+
const resolve = RESOLVE_BY_PROVIDER[provider];
|
|
36
|
+
const token = await resolve({ engine, agentId, credentialKey, stateKey });
|
|
37
|
+
if (!token)
|
|
38
|
+
return null;
|
|
39
|
+
const { value } = await engine.configGet({
|
|
40
|
+
key: scopedKey(agentId, stateKey)
|
|
41
|
+
});
|
|
42
|
+
let expiresAt;
|
|
43
|
+
try {
|
|
44
|
+
const state = typeof value === 'string' ? JSON.parse(value) : null;
|
|
45
|
+
expiresAt = typeof state?.expiresAt === 'number' ? state.expiresAt : undefined;
|
|
46
|
+
}
|
|
47
|
+
catch { }
|
|
48
|
+
return {
|
|
49
|
+
key: credentialKey,
|
|
50
|
+
token,
|
|
51
|
+
...(expiresAt === undefined ? {} : { expiresAt }),
|
|
52
|
+
...(agentId ? { agentId } : {})
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
async function plainEntry(engine, key, agentId) {
|
|
56
|
+
const { value } = await engine.configGet({ key: scopedKey(agentId, key) });
|
|
57
|
+
if (typeof value !== 'string' || value === '')
|
|
58
|
+
return null;
|
|
59
|
+
return {
|
|
60
|
+
key,
|
|
61
|
+
token: value,
|
|
62
|
+
...(agentId ? { agentId } : {})
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
export function credentialOwners(catalog) {
|
|
66
|
+
const owners = new Map();
|
|
67
|
+
for (const skill of catalog) {
|
|
68
|
+
for (const key of credentialSlots(skill).flat()) {
|
|
69
|
+
const list = owners.get(key) ?? [];
|
|
70
|
+
if (!list.includes(skill.name))
|
|
71
|
+
list.push(skill.name);
|
|
72
|
+
owners.set(key, list);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return owners;
|
|
76
|
+
}
|
|
77
|
+
export function settingFields(catalog) {
|
|
78
|
+
const fields = [];
|
|
79
|
+
for (const skill of catalog) {
|
|
80
|
+
for (const route of skill.setup?.routes ?? []) {
|
|
81
|
+
for (const field of route.fields ?? []) {
|
|
82
|
+
if (field.secret === true)
|
|
83
|
+
continue;
|
|
84
|
+
if (fields.some((f) => f.skill === skill.name && f.key === field.key))
|
|
85
|
+
continue;
|
|
86
|
+
fields.push({ skill: skill.name, key: field.key });
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return fields;
|
|
91
|
+
}
|
|
92
|
+
export function settingConfigKey(agentId, skill, key) {
|
|
93
|
+
return scopedKey(agentId, `settings.${skill}.${key}`);
|
|
94
|
+
}
|
|
95
|
+
export function oauthStateKey(credentialKey) {
|
|
96
|
+
return specStateKeyFor(credentialKey) ?? undefined;
|
|
97
|
+
}
|
|
98
|
+
function fanOut(entry, owners) {
|
|
99
|
+
const skills = owners.get(entry.key) ?? [];
|
|
100
|
+
return skills.length > 0 ? skills.map((skill) => ({ ...entry, skill })) : [entry];
|
|
101
|
+
}
|
|
102
|
+
async function resolveScope(engine, agentId, last, owners, logger) {
|
|
103
|
+
const entries = [];
|
|
104
|
+
for (const spec of OAUTH_KEY_SPECS) {
|
|
105
|
+
const mk = storeKey(spec.credentialKey, agentId);
|
|
106
|
+
try {
|
|
107
|
+
const entry = await oauthEntry(engine, spec, agentId);
|
|
108
|
+
if (entry) {
|
|
109
|
+
last.set(mk, entry);
|
|
110
|
+
entries.push(...fanOut(entry, owners));
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
last.delete(mk);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
catch (err) {
|
|
117
|
+
logger?.warn('credential-pusher', `credential resolve failed for ${spec.credentialKey}`, errorMessage(err));
|
|
118
|
+
const kept = last.get(mk);
|
|
119
|
+
if (kept)
|
|
120
|
+
entries.push(...fanOut(kept, owners));
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
for (const key of PLAIN_KEYS) {
|
|
124
|
+
const mk = storeKey(key, agentId);
|
|
125
|
+
try {
|
|
126
|
+
const entry = await plainEntry(engine, key, agentId);
|
|
127
|
+
if (entry) {
|
|
128
|
+
last.set(mk, entry);
|
|
129
|
+
entries.push(...fanOut(entry, owners));
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
last.delete(mk);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
catch (err) {
|
|
136
|
+
logger?.warn('credential-pusher', `credential read failed for ${key}`, errorMessage(err));
|
|
137
|
+
const kept = last.get(mk);
|
|
138
|
+
if (kept)
|
|
139
|
+
entries.push(...fanOut(kept, owners));
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return entries;
|
|
143
|
+
}
|
|
144
|
+
async function resolveSettings(engine, scopes, catalog, logger) {
|
|
145
|
+
const fields = settingFields(catalog);
|
|
146
|
+
if (fields.length === 0)
|
|
147
|
+
return [];
|
|
148
|
+
const resolved = await Promise.all(scopes.flatMap((agentId) => fields.map(async ({ skill, key }) => {
|
|
149
|
+
try {
|
|
150
|
+
const { value } = await engine.configGet({ key: settingConfigKey(agentId, skill, key) });
|
|
151
|
+
if (typeof value !== 'string' || value === '')
|
|
152
|
+
return null;
|
|
153
|
+
return { skill, key, value, ...(agentId ? { agentId } : {}) };
|
|
154
|
+
}
|
|
155
|
+
catch (err) {
|
|
156
|
+
logger?.warn('credential-pusher', `setting read failed for ${skill}.${key}`, errorMessage(err));
|
|
157
|
+
return null;
|
|
158
|
+
}
|
|
159
|
+
})));
|
|
160
|
+
const entries = [];
|
|
161
|
+
for (const entry of resolved) {
|
|
162
|
+
if (entry)
|
|
163
|
+
entries.push(entry);
|
|
164
|
+
}
|
|
165
|
+
return entries;
|
|
166
|
+
}
|
|
167
|
+
export function startCredentialPusher(harness, engine, logger) {
|
|
168
|
+
const last = new Map();
|
|
169
|
+
const watches = [];
|
|
170
|
+
let disposed = false;
|
|
171
|
+
let timer = null;
|
|
172
|
+
const pushLock = new ScopeLock({ debounce: true });
|
|
173
|
+
const armTimer = (delay) => {
|
|
174
|
+
if (disposed)
|
|
175
|
+
return;
|
|
176
|
+
if (timer)
|
|
177
|
+
clearTimeout(timer);
|
|
178
|
+
timer = setTimeout(() => {
|
|
179
|
+
timer = null;
|
|
180
|
+
schedule();
|
|
181
|
+
}, delay);
|
|
182
|
+
};
|
|
183
|
+
const catalog = async () => {
|
|
184
|
+
if (!harness.skills)
|
|
185
|
+
return [];
|
|
186
|
+
try {
|
|
187
|
+
return await harness.skills(null, null, { skipCredentialProbe: true });
|
|
188
|
+
}
|
|
189
|
+
catch (err) {
|
|
190
|
+
logger?.warn('credential-pusher', 'skill catalog read failed', errorMessage(err));
|
|
191
|
+
return [];
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
const pushAll = async () => {
|
|
195
|
+
const entries = [];
|
|
196
|
+
try {
|
|
197
|
+
const skills = await catalog();
|
|
198
|
+
const owners = credentialOwners(skills);
|
|
199
|
+
const ids = (await engine.listAgents({})).agents.map((agent) => agent.id);
|
|
200
|
+
const scopes = [undefined, ...ids];
|
|
201
|
+
for (const agentId of scopes) {
|
|
202
|
+
entries.push(...(await resolveScope(engine, agentId, last, owners, logger)));
|
|
203
|
+
}
|
|
204
|
+
if (disposed)
|
|
205
|
+
return;
|
|
206
|
+
await harness.setCredentials(entries);
|
|
207
|
+
if (harness.setSkillSettings) {
|
|
208
|
+
await harness.setSkillSettings(await resolveSettings(engine, scopes, skills, logger));
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
finally {
|
|
212
|
+
if (!disposed)
|
|
213
|
+
armTimer(nextRefreshDelay(entries));
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
const schedule = async () => {
|
|
217
|
+
if (disposed)
|
|
218
|
+
return;
|
|
219
|
+
if (!(await pushLock.lock()))
|
|
220
|
+
return;
|
|
221
|
+
try {
|
|
222
|
+
if (!disposed)
|
|
223
|
+
await pushAll();
|
|
224
|
+
}
|
|
225
|
+
catch (err) {
|
|
226
|
+
logger?.warn('credential-pusher', 'credential push failed', errorMessage(err));
|
|
227
|
+
}
|
|
228
|
+
finally {
|
|
229
|
+
pushLock.unlock();
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
const sync = async () => {
|
|
233
|
+
if (disposed)
|
|
234
|
+
return;
|
|
235
|
+
await pushLock.flush();
|
|
236
|
+
if (disposed)
|
|
237
|
+
return;
|
|
238
|
+
if (!(await pushLock.lock())) {
|
|
239
|
+
await pushLock.flush();
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
try {
|
|
243
|
+
if (!disposed)
|
|
244
|
+
await pushAll();
|
|
245
|
+
}
|
|
246
|
+
catch (err) {
|
|
247
|
+
logger?.warn('credential-pusher', 'credential sync failed', errorMessage(err));
|
|
248
|
+
}
|
|
249
|
+
finally {
|
|
250
|
+
pushLock.unlock();
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
const watchKeys = [...OAUTH_KEY_SPECS.map((s) => s.credentialKey), ...PLAIN_KEYS];
|
|
254
|
+
for (const key of watchKeys) {
|
|
255
|
+
const stream = engine.configWatch({ key: scopedKey(undefined, key) });
|
|
256
|
+
watches.push(stream);
|
|
257
|
+
(async () => {
|
|
258
|
+
for await (const _ of stream)
|
|
259
|
+
schedule();
|
|
260
|
+
if (disposed)
|
|
261
|
+
return;
|
|
262
|
+
logger?.warn('credential-pusher', `credential watch ended for ${key}, change propagation degrades to the interval until restart`);
|
|
263
|
+
})().catch((err) => {
|
|
264
|
+
if (disposed)
|
|
265
|
+
return;
|
|
266
|
+
logger?.warn('credential-pusher', `credential watch ended for ${key}`, errorMessage(err));
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
schedule();
|
|
270
|
+
const stop = async () => {
|
|
271
|
+
if (disposed)
|
|
272
|
+
return;
|
|
273
|
+
disposed = true;
|
|
274
|
+
if (timer)
|
|
275
|
+
clearTimeout(timer);
|
|
276
|
+
timer = null;
|
|
277
|
+
for (const stream of watches) {
|
|
278
|
+
try {
|
|
279
|
+
stream.destroy();
|
|
280
|
+
}
|
|
281
|
+
catch { }
|
|
282
|
+
}
|
|
283
|
+
pushLock.destroy();
|
|
284
|
+
await pushLock.flush();
|
|
285
|
+
};
|
|
286
|
+
return Object.assign(stop, { sync });
|
|
287
|
+
}
|
|
288
|
+
function errorMessage(error) {
|
|
289
|
+
return error instanceof Error ? error.message : String(error);
|
|
290
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Harness } from './assistant.ts';
|
|
2
|
+
import type { openLocalStore } from './core/local/index.ts';
|
|
3
|
+
type LocalStore = Awaited<ReturnType<typeof openLocalStore>>;
|
|
4
|
+
type Logger = {
|
|
5
|
+
warn(...args: unknown[]): void;
|
|
6
|
+
};
|
|
7
|
+
export type CustomModelTarget = Pick<Harness, 'setCustomModels'>;
|
|
8
|
+
export declare function startCustomModelPusher(harness: CustomModelTarget, state: LocalStore, logger?: Logger | null): () => Promise<void>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export function startCustomModelPusher(harness, state, logger) {
|
|
2
|
+
let disposed = false;
|
|
3
|
+
let tail = Promise.resolve();
|
|
4
|
+
let queued = false;
|
|
5
|
+
const push = async () => {
|
|
6
|
+
const rows = await state.getCustomModelRows();
|
|
7
|
+
if (disposed)
|
|
8
|
+
return;
|
|
9
|
+
await harness.setCustomModels?.(rows.map((row) => ({
|
|
10
|
+
name: row.name,
|
|
11
|
+
src: row.src,
|
|
12
|
+
projectionSrc: row.mmprojSrc ?? undefined
|
|
13
|
+
})));
|
|
14
|
+
};
|
|
15
|
+
const schedule = () => {
|
|
16
|
+
if (disposed || queued)
|
|
17
|
+
return;
|
|
18
|
+
queued = true;
|
|
19
|
+
tail = tail.then(async () => {
|
|
20
|
+
queued = false;
|
|
21
|
+
if (disposed)
|
|
22
|
+
return;
|
|
23
|
+
try {
|
|
24
|
+
await push();
|
|
25
|
+
}
|
|
26
|
+
catch (err) {
|
|
27
|
+
logger?.warn('custom-model-pusher', 'push failed', errorMessage(err));
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
const listener = () => schedule();
|
|
32
|
+
state.watch(listener);
|
|
33
|
+
schedule();
|
|
34
|
+
return async () => {
|
|
35
|
+
disposed = true;
|
|
36
|
+
state.unwatch(listener);
|
|
37
|
+
await tail;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function errorMessage(error) {
|
|
41
|
+
return error instanceof Error ? error.message : String(error);
|
|
42
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
type ProbeResponse = {
|
|
2
|
+
ok: boolean;
|
|
3
|
+
headers: {
|
|
4
|
+
get(name: string): string | null;
|
|
5
|
+
};
|
|
6
|
+
};
|
|
7
|
+
type ProbeFetch = (url: string, init: {
|
|
8
|
+
method: 'HEAD';
|
|
9
|
+
redirect: 'follow';
|
|
10
|
+
}) => Promise<ProbeResponse>;
|
|
11
|
+
export declare function normalizeModelSource(raw: string): string;
|
|
12
|
+
export declare function probeModelSource(src: string, opts?: {
|
|
13
|
+
fetch?: ProbeFetch;
|
|
14
|
+
}): Promise<number>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import defaultFetch from '#fetch';
|
|
2
|
+
export function normalizeModelSource(raw) {
|
|
3
|
+
const trimmed = raw.trim();
|
|
4
|
+
let url;
|
|
5
|
+
try {
|
|
6
|
+
url = new URL(trimmed);
|
|
7
|
+
}
|
|
8
|
+
catch {
|
|
9
|
+
return trimmed;
|
|
10
|
+
}
|
|
11
|
+
if (url.hostname !== 'huggingface.co')
|
|
12
|
+
return trimmed;
|
|
13
|
+
const segments = url.pathname.split('/').filter(Boolean);
|
|
14
|
+
if (segments.length < 2)
|
|
15
|
+
return trimmed;
|
|
16
|
+
const [org, repo, kind, ...rest] = segments;
|
|
17
|
+
const showFile = url.searchParams.get('show_file_info');
|
|
18
|
+
if (showFile && segments.length === 2) {
|
|
19
|
+
return `https://huggingface.co/${org}/${repo}/resolve/main/${showFile}`;
|
|
20
|
+
}
|
|
21
|
+
if (kind === 'blob' && rest.length > 0) {
|
|
22
|
+
return `https://huggingface.co/${org}/${repo}/resolve/${rest.join('/')}`;
|
|
23
|
+
}
|
|
24
|
+
return trimmed;
|
|
25
|
+
}
|
|
26
|
+
export async function probeModelSource(src, opts = {}) {
|
|
27
|
+
if (!/^https?:/.test(src))
|
|
28
|
+
return 0;
|
|
29
|
+
const fetchImpl = opts.fetch ?? defaultFetch;
|
|
30
|
+
let response;
|
|
31
|
+
try {
|
|
32
|
+
response = await fetchImpl(src, { method: 'HEAD', redirect: 'follow' });
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
return 0;
|
|
36
|
+
}
|
|
37
|
+
const contentType = response.headers.get('content-type') ?? '';
|
|
38
|
+
if (response.ok && contentType.includes('text/html')) {
|
|
39
|
+
throw new Error('The model source URL returned a web page, not a model file. On Hugging Face use the file download link (…/resolve/…), not the repo page.');
|
|
40
|
+
}
|
|
41
|
+
const linkedSize = Number(response.headers.get('x-linked-size'));
|
|
42
|
+
if (Number.isFinite(linkedSize) && linkedSize > 0)
|
|
43
|
+
return linkedSize;
|
|
44
|
+
const contentLength = Number(response.headers.get('content-length'));
|
|
45
|
+
return Number.isFinite(contentLength) && contentLength > 0 ? contentLength : 0;
|
|
46
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { unref } from "./unref.js";
|
|
2
|
+
export class DeadlineScheduler {
|
|
3
|
+
_onFire;
|
|
4
|
+
_timer = null;
|
|
5
|
+
_at = null;
|
|
6
|
+
constructor(onFire) {
|
|
7
|
+
this._onFire = onFire;
|
|
8
|
+
}
|
|
9
|
+
get at() {
|
|
10
|
+
return this._at;
|
|
11
|
+
}
|
|
12
|
+
schedule(deadline) {
|
|
13
|
+
const at = deadline + 1;
|
|
14
|
+
if (this._at !== null && this._at <= at)
|
|
15
|
+
return;
|
|
16
|
+
this.clear();
|
|
17
|
+
this._at = at;
|
|
18
|
+
this._timer = setTimeout(() => {
|
|
19
|
+
this._timer = null;
|
|
20
|
+
this._at = null;
|
|
21
|
+
this._onFire();
|
|
22
|
+
}, Math.max(0, at - Date.now()));
|
|
23
|
+
unref(this._timer);
|
|
24
|
+
}
|
|
25
|
+
clear() {
|
|
26
|
+
if (this._timer)
|
|
27
|
+
clearTimeout(this._timer);
|
|
28
|
+
this._timer = null;
|
|
29
|
+
this._at = null;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { MemoryBudget } from '@qvac/harness';
|
|
2
|
+
export interface HarnessDiagnostics {
|
|
3
|
+
models: Array<{
|
|
4
|
+
model: string;
|
|
5
|
+
refs: number;
|
|
6
|
+
}>;
|
|
7
|
+
suspended: boolean;
|
|
8
|
+
sdkLoaded: boolean;
|
|
9
|
+
toolNames: string[];
|
|
10
|
+
skills: string[];
|
|
11
|
+
device?: 'cpu' | 'gpu';
|
|
12
|
+
}
|
|
13
|
+
export interface RunSummary {
|
|
14
|
+
runId: string;
|
|
15
|
+
chatId: string;
|
|
16
|
+
model: string;
|
|
17
|
+
}
|
|
18
|
+
export interface AssistantDiagnostics {
|
|
19
|
+
suspended: boolean;
|
|
20
|
+
runs: RunSummary[];
|
|
21
|
+
activeChats: number;
|
|
22
|
+
queued: number;
|
|
23
|
+
}
|
|
24
|
+
export interface DiagnosticsSlice {
|
|
25
|
+
harness: HarnessDiagnostics | null;
|
|
26
|
+
assistant: AssistantDiagnostics;
|
|
27
|
+
platform: string;
|
|
28
|
+
mobileClass: boolean;
|
|
29
|
+
memoryBudget: MemoryBudget | null;
|
|
30
|
+
}
|
|
31
|
+
export declare function summarizeRuns(runs: Iterable<{
|
|
32
|
+
runId: string;
|
|
33
|
+
chatId: string;
|
|
34
|
+
model: string;
|
|
35
|
+
}>, suspended: boolean): AssistantDiagnostics;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export function summarizeRuns(runs, suspended) {
|
|
2
|
+
const list = [];
|
|
3
|
+
const chats = new Set();
|
|
4
|
+
for (const { runId, chatId, model } of runs) {
|
|
5
|
+
list.push({ runId, chatId, model });
|
|
6
|
+
chats.add(chatId);
|
|
7
|
+
}
|
|
8
|
+
return {
|
|
9
|
+
suspended,
|
|
10
|
+
runs: list,
|
|
11
|
+
activeChats: chats.size,
|
|
12
|
+
queued: list.length - chats.size
|
|
13
|
+
};
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default fetch;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default fetch;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type DriveOpFn, type GrantedDrive } from '@qvac/harness/lib/tools/fs/remote.ts';
|
|
2
|
+
import type { AcquiredDrive, DriveHost } from './core/fs-drives.ts';
|
|
3
|
+
import type { FsGrant } from './fs-grants.ts';
|
|
4
|
+
export declare const DRIVE_OP_TIMEOUT_MS = 15000;
|
|
5
|
+
export declare function sweepDriveStaging(now?: number): Promise<void>;
|
|
6
|
+
export declare function createDriveOp(drives: ReadonlyMap<string, AcquiredDrive>): DriveOpFn;
|
|
7
|
+
export interface ResolvedFsGrants {
|
|
8
|
+
readonly grantedDirs: string[];
|
|
9
|
+
readonly grantedDrives: GrantedDrive[];
|
|
10
|
+
readonly driveOp?: DriveOpFn;
|
|
11
|
+
}
|
|
12
|
+
export declare function resolveFsGrants(grants: readonly FsGrant[], driveHost: DriveHost | undefined, onDropped?: (key: string, err: unknown) => void): Promise<ResolvedFsGrants>;
|