@qvac/core 1.0.0-rc.1 → 1.0.0-rc.3
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/CHANGELOG.md +1008 -1
- package/README.md +40 -81
- package/dist-lib/index.d.ts +1 -1
- package/dist-lib/index.js +1 -1
- package/dist-lib/lib/api/agent-folders.d.ts +22 -0
- package/dist-lib/lib/api/agent-folders.js +115 -0
- package/dist-lib/lib/api/agents.d.ts +19 -2
- package/dist-lib/lib/api/agents.js +121 -24
- package/dist-lib/lib/api/app-config.d.ts +4 -1
- package/dist-lib/lib/api/app-config.js +17 -6
- package/dist-lib/lib/api/attachments.js +3 -2
- package/dist-lib/lib/api/chat-move.d.ts +4 -0
- package/dist-lib/lib/api/chat-move.js +7 -0
- package/dist-lib/lib/api/chat.d.ts +13 -2
- package/dist-lib/lib/api/chat.js +114 -9
- package/dist-lib/lib/api/chunk-delta.d.ts +12 -0
- package/dist-lib/lib/api/chunk-delta.js +115 -0
- package/dist-lib/lib/api/chunks.d.ts +17 -2
- package/dist-lib/lib/api/chunks.js +70 -13
- package/dist-lib/lib/api/config.d.ts +6 -2
- package/dist-lib/lib/api/config.js +47 -5
- package/dist-lib/lib/api/current-mesh.d.ts +13 -5
- package/dist-lib/lib/api/current-mesh.js +15 -11
- package/dist-lib/lib/api/custom-models.d.ts +7 -1
- package/dist-lib/lib/api/custom-models.js +12 -12
- package/dist-lib/lib/api/device-routes.d.ts +9 -0
- package/dist-lib/lib/api/device-routes.js +123 -0
- package/dist-lib/lib/api/devices.d.ts +3 -2
- package/dist-lib/lib/api/devices.js +23 -11
- package/dist-lib/lib/api/diagnostics.d.ts +2 -1
- package/dist-lib/lib/api/diagnostics.js +2 -2
- package/dist-lib/lib/api/execution.d.ts +12 -1
- package/dist-lib/lib/api/execution.js +44 -14
- package/dist-lib/lib/api/files.d.ts +1 -1
- package/dist-lib/lib/api/files.js +65 -8
- package/dist-lib/lib/api/host-run-log.d.ts +2 -41
- package/dist-lib/lib/api/host-run-log.js +35 -83
- package/dist-lib/lib/api/index.d.ts +28 -6
- package/dist-lib/lib/api/index.js +101 -33
- package/dist-lib/lib/api/instrument.d.ts +2 -2
- package/dist-lib/lib/api/instrument.js +24 -48
- package/dist-lib/lib/api/knowledge.d.ts +4 -1
- package/dist-lib/lib/api/knowledge.js +25 -7
- package/dist-lib/lib/api/local-files.d.ts +5 -1
- package/dist-lib/lib/api/local-files.js +9 -5
- package/dist-lib/lib/api/logs.js +3 -3
- package/dist-lib/lib/api/members.d.ts +10 -1
- package/dist-lib/lib/api/members.js +67 -26
- package/dist-lib/lib/api/mesh.d.ts +12 -4
- package/dist-lib/lib/api/mesh.js +12 -8
- package/dist-lib/lib/api/model-download.d.ts +2 -1
- package/dist-lib/lib/api/model-download.js +2 -2
- package/dist-lib/lib/api/network.d.ts +10 -2
- package/dist-lib/lib/api/network.js +8 -2
- package/dist-lib/lib/api/notifications.d.ts +3 -1
- package/dist-lib/lib/api/notifications.js +14 -9
- package/dist-lib/lib/api/projects.d.ts +20 -0
- package/dist-lib/lib/api/projects.js +169 -0
- package/dist-lib/lib/api/rag.d.ts +0 -1
- package/dist-lib/lib/api/rag.js +71 -34
- package/dist-lib/lib/api/served.d.ts +17 -0
- package/dist-lib/lib/api/served.js +48 -0
- package/dist-lib/lib/api/sync.d.ts +2 -1
- package/dist-lib/lib/api/sync.js +2 -2
- package/dist-lib/lib/api/tool-activity.d.ts +2 -1
- package/dist-lib/lib/api/tool-activity.js +4 -3
- package/dist-lib/lib/api/tool-configs.d.ts +2 -1
- package/dist-lib/lib/api/tool-configs.js +6 -9
- package/dist-lib/lib/api/upload-frames.d.ts +0 -1
- package/dist-lib/lib/api/upload-frames.js +0 -1
- package/dist-lib/lib/api/watchable.d.ts +3 -2
- package/dist-lib/lib/api/watchable.js +2 -3
- package/dist-lib/lib/api/workspace.d.ts +5 -0
- package/dist-lib/lib/api/workspace.js +47 -0
- package/dist-lib/lib/assistant/fake-models.d.ts +20 -0
- package/dist-lib/lib/assistant/fake-models.js +112 -0
- package/dist-lib/lib/assistant/harness.d.ts +37 -31
- package/dist-lib/lib/assistant/harness.js +51 -10
- package/dist-lib/lib/assistant/history.d.ts +30 -17
- package/dist-lib/lib/assistant/history.js +179 -87
- package/dist-lib/lib/assistant/host-run-log.d.ts +6 -1
- package/dist-lib/lib/assistant/host-run-log.js +24 -36
- package/dist-lib/lib/assistant/message.d.ts +27 -1
- package/dist-lib/lib/assistant/message.js +65 -2
- package/dist-lib/lib/assistant/model-round.d.ts +100 -0
- package/dist-lib/lib/assistant/model-round.js +619 -0
- package/dist-lib/lib/assistant/pdf-budget.d.ts +11 -0
- package/dist-lib/lib/assistant/pdf-budget.js +12 -0
- package/dist-lib/lib/assistant/pdf-pages.d.ts +25 -0
- package/dist-lib/lib/assistant/pdf-pages.js +75 -0
- package/dist-lib/lib/assistant/round-host.d.ts +42 -0
- package/dist-lib/lib/assistant/round-host.js +241 -0
- package/dist-lib/lib/assistant/skill-encode.d.ts +2 -1
- package/dist-lib/lib/assistant/skill-encode.js +2 -1
- package/dist-lib/lib/assistant/video-budget.d.ts +13 -0
- package/dist-lib/lib/assistant/video-budget.js +29 -0
- package/dist-lib/lib/assistant-client.d.ts +4 -1
- package/dist-lib/lib/assistant-client.js +27 -8
- package/dist-lib/lib/assistant-tree.d.ts +10 -3
- package/dist-lib/lib/assistant-tree.js +63 -20
- package/dist-lib/lib/assistant.d.ts +93 -24
- package/dist-lib/lib/assistant.js +2048 -1231
- package/dist-lib/lib/audio-format.js +1 -1
- package/dist-lib/lib/chat-suggestion.d.ts +3 -0
- package/dist-lib/lib/chat-suggestion.js +47 -0
- package/dist-lib/lib/client.d.ts +2 -2
- package/dist-lib/lib/client.js +10 -1
- package/dist-lib/lib/compaction.d.ts +3 -1
- package/dist-lib/lib/compaction.js +18 -4
- package/dist-lib/lib/constants.d.ts +10 -0
- package/dist-lib/lib/constants.js +10 -0
- package/dist-lib/lib/core/agent-copies.d.ts +9 -0
- package/dist-lib/lib/core/agent-copies.js +40 -0
- package/dist-lib/lib/core/agent-hosting.d.ts +25 -0
- package/dist-lib/lib/core/agent-hosting.js +71 -0
- package/dist-lib/lib/core/agent.d.ts +9 -1
- package/dist-lib/lib/core/agent.js +45 -19
- package/dist-lib/lib/core/archived-mesh.d.ts +11 -6
- package/dist-lib/lib/core/archived-mesh.js +77 -58
- package/dist-lib/lib/core/async-iterable.js +1 -1
- package/dist-lib/lib/core/blind-peers.d.ts +1 -0
- package/dist-lib/lib/core/blind-peers.js +1 -0
- package/dist-lib/lib/core/chat-activity.d.ts +1 -1
- package/dist-lib/lib/core/chat-activity.js +45 -34
- package/dist-lib/lib/core/chat-copy.d.ts +42 -0
- package/dist-lib/lib/core/chat-copy.js +395 -0
- package/dist-lib/lib/core/chat-fork.d.ts +16 -0
- package/dist-lib/lib/core/chat-fork.js +246 -0
- package/dist-lib/lib/core/chat-group.js +8 -7
- package/dist-lib/lib/core/chat-move.d.ts +75 -0
- package/dist-lib/lib/core/chat-move.js +598 -0
- package/dist-lib/lib/core/chat-order.d.ts +2 -1
- package/dist-lib/lib/core/chat-order.js +19 -4
- package/dist-lib/lib/core/chat-project.d.ts +2 -0
- package/dist-lib/lib/core/chat-project.js +15 -0
- package/dist-lib/lib/core/chat-read.d.ts +4 -0
- package/dist-lib/lib/core/chat-read.js +49 -0
- package/dist-lib/lib/core/chat-search.js +14 -12
- package/dist-lib/lib/core/chat.d.ts +33 -4
- package/dist-lib/lib/core/chat.js +122 -39
- package/dist-lib/lib/core/chunk.d.ts +35 -7
- package/dist-lib/lib/core/chunk.js +250 -45
- package/dist-lib/lib/core/collections.d.ts +40 -1
- package/dist-lib/lib/core/collections.js +40 -1
- package/dist-lib/lib/core/config-value.d.ts +6 -0
- package/dist-lib/lib/core/config-value.js +14 -0
- package/dist-lib/lib/core/contract/activity.d.ts +3 -2
- package/dist-lib/lib/core/contract/activity.js +39 -21
- package/dist-lib/lib/core/contract/agent-join.d.ts +10 -0
- package/dist-lib/lib/core/contract/agent-join.js +104 -0
- package/dist-lib/lib/core/contract/agents.d.ts +5 -0
- package/dist-lib/lib/core/contract/agents.js +142 -3
- package/dist-lib/lib/core/contract/chat.d.ts +4 -0
- package/dist-lib/lib/core/contract/chat.js +53 -3
- package/dist-lib/lib/core/contract/chunks.d.ts +7 -0
- package/dist-lib/lib/core/contract/chunks.js +125 -38
- package/dist-lib/lib/core/contract/devices.js +6 -4
- package/dist-lib/lib/core/contract/index.d.ts +2 -3
- package/dist-lib/lib/core/contract/index.js +36 -11
- package/dist-lib/lib/core/contract/indexing.d.ts +1 -0
- package/dist-lib/lib/core/contract/indexing.js +51 -7
- package/dist-lib/lib/core/contract/invites.d.ts +3 -14
- package/dist-lib/lib/core/contract/invites.js +26 -36
- package/dist-lib/lib/core/contract/joined-meshes.js +3 -1
- package/dist-lib/lib/core/contract/knowledge.d.ts +1 -0
- package/dist-lib/lib/core/contract/knowledge.js +57 -6
- package/dist-lib/lib/core/contract/members.d.ts +3 -1
- package/dist-lib/lib/core/contract/members.js +34 -4
- package/dist-lib/lib/core/contract/mesh-kind.d.ts +3 -3
- package/dist-lib/lib/core/contract/mesh-kind.js +20 -16
- package/dist-lib/lib/core/contract/mesh-name.d.ts +3 -0
- package/dist-lib/lib/core/contract/mesh-name.js +31 -0
- package/dist-lib/lib/core/contract/mesh-rules.d.ts +8 -0
- package/dist-lib/lib/core/contract/mesh-rules.js +35 -0
- package/dist-lib/lib/core/contract/mesh-seeds.d.ts +2 -0
- package/dist-lib/lib/core/contract/mesh-seeds.js +26 -0
- package/dist-lib/lib/core/contract/model-requests.d.ts +26 -0
- package/dist-lib/lib/core/contract/model-requests.js +280 -0
- package/dist-lib/lib/core/contract/oldest-version.d.ts +9 -0
- package/dist-lib/lib/core/contract/oldest-version.js +20 -0
- package/dist-lib/lib/core/contract/open-join.d.ts +2 -0
- package/dist-lib/lib/core/contract/open-join.js +77 -0
- package/dist-lib/lib/core/contract/project-device-keys.d.ts +7 -0
- package/dist-lib/lib/core/contract/project-device-keys.js +38 -0
- package/dist-lib/lib/core/contract/project-host-keys.d.ts +7 -0
- package/dist-lib/lib/core/contract/project-host-keys.js +41 -0
- package/dist-lib/lib/core/contract/project-order.d.ts +2 -0
- package/dist-lib/lib/core/contract/project-order.js +25 -0
- package/dist-lib/lib/core/contract/projects.d.ts +21 -0
- package/dist-lib/lib/core/contract/projects.js +327 -0
- package/dist-lib/lib/core/contract/public-mesh.d.ts +3 -0
- package/dist-lib/lib/core/contract/public-mesh.js +31 -0
- package/dist-lib/lib/core/contract/public-seeds.d.ts +9 -0
- package/dist-lib/lib/core/contract/public-seeds.js +43 -0
- package/dist-lib/lib/core/contract/roles.d.ts +10 -0
- package/dist-lib/lib/core/contract/roles.js +121 -0
- package/dist-lib/lib/core/contract/run-requests.d.ts +10 -0
- package/dist-lib/lib/core/contract/run-requests.js +81 -0
- package/dist-lib/lib/core/contract/seed-defaults.d.ts +3 -1
- package/dist-lib/lib/core/contract/seed-defaults.js +17 -4
- package/dist-lib/lib/core/contract/shipped-rows.d.ts +2 -0
- package/dist-lib/lib/core/contract/shipped-rows.js +22 -0
- package/dist-lib/lib/core/contract/skill-secrets.d.ts +3 -0
- package/dist-lib/lib/core/contract/skill-secrets.js +32 -0
- package/dist-lib/lib/core/contract/tool-activity.js +12 -1
- package/dist-lib/lib/core/contract/tool-configs.js +2 -1
- package/dist-lib/lib/core/contract/types.d.ts +2 -2
- package/dist-lib/lib/core/contract/workspace.d.ts +31 -0
- package/dist-lib/lib/core/contract/workspace.js +311 -0
- package/dist-lib/lib/core/contract/writers.js +100 -16
- package/dist-lib/lib/core/departures.d.ts +16 -5
- package/dist-lib/lib/core/departures.js +79 -6
- package/dist-lib/lib/core/device-control.d.ts +21 -0
- package/dist-lib/lib/core/device-control.js +91 -0
- package/dist-lib/lib/core/device-seal.d.ts +4 -0
- package/dist-lib/lib/core/device-seal.js +22 -0
- package/dist-lib/lib/core/devices.d.ts +2 -1
- package/dist-lib/lib/core/devices.js +5 -3
- package/dist-lib/lib/core/document-attachment.d.ts +10 -0
- package/dist-lib/lib/core/document-attachment.js +14 -0
- package/dist-lib/lib/core/files/attachments.js +8 -7
- package/dist-lib/lib/core/files/index.d.ts +27 -14
- package/dist-lib/lib/core/files/index.js +220 -43
- package/dist-lib/lib/core/files/knowledge.d.ts +10 -1
- package/dist-lib/lib/core/files/knowledge.js +77 -5
- package/dist-lib/lib/core/files/preview/index.js +6 -2
- package/dist-lib/lib/core/files/processing/claims.d.ts +7 -0
- package/dist-lib/lib/core/files/processing/claims.js +33 -7
- package/dist-lib/lib/core/files/processing/document.d.ts +8 -0
- package/dist-lib/lib/core/files/processing/document.js +26 -2
- package/dist-lib/lib/core/files/processing/index.d.ts +8 -3
- package/dist-lib/lib/core/files/processing/index.js +99 -73
- package/dist-lib/lib/core/files/processing/protocol.d.ts +7 -1
- package/dist-lib/lib/core/files/processing/protocol.js +14 -3
- package/dist-lib/lib/core/files/processing/source.d.ts +4 -0
- package/dist-lib/lib/core/files/processing/source.js +12 -4
- package/dist-lib/lib/core/files/processing/state.d.ts +5 -1
- package/dist-lib/lib/core/files/processing/state.js +9 -1
- package/dist-lib/lib/core/files/rag/build.d.ts +5 -1
- package/dist-lib/lib/core/files/rag/build.js +32 -8
- package/dist-lib/lib/core/files/rag/failure.d.ts +20 -0
- package/dist-lib/lib/core/files/rag/failure.js +57 -0
- package/dist-lib/lib/core/files/rag/index.d.ts +13 -2
- package/dist-lib/lib/core/files/rag/index.js +30 -8
- package/dist-lib/lib/core/files/rag/joined-index.d.ts +6 -0
- package/dist-lib/lib/core/files/rag/joined-index.js +35 -0
- package/dist-lib/lib/core/files/rag/limits.d.ts +1 -0
- package/dist-lib/lib/core/files/rag/limits.js +1 -0
- package/dist-lib/lib/core/files/rag/load.js +6 -3
- package/dist-lib/lib/core/files/rag/policy.d.ts +10 -1
- package/dist-lib/lib/core/files/rag/policy.js +23 -2
- package/dist-lib/lib/core/files/rag/produce.d.ts +1 -1
- package/dist-lib/lib/core/files/rag/produce.js +31 -18
- package/dist-lib/lib/core/files/rag/retrieval/full-text.d.ts +2 -0
- package/dist-lib/lib/core/files/rag/retrieval/full-text.js +8 -2
- package/dist-lib/lib/core/files/rag/similarity.d.ts +2 -2
- package/dist-lib/lib/core/files/rag/similarity.js +2 -3
- package/dist-lib/lib/core/files/records/chunks.js +22 -1
- package/dist-lib/lib/core/files/records/index.d.ts +1 -1
- package/dist-lib/lib/core/files/records/index.js +1 -1
- package/dist-lib/lib/core/files/records/knowledge.d.ts +11 -1
- package/dist-lib/lib/core/files/records/knowledge.js +40 -3
- package/dist-lib/lib/core/files/records/purge.js +13 -8
- package/dist-lib/lib/core/files/records/reclaim.js +20 -48
- package/dist-lib/lib/core/files/records/routing.d.ts +1 -1
- package/dist-lib/lib/core/files/records/routing.js +6 -2
- package/dist-lib/lib/core/files/records/source.js +3 -5
- package/dist-lib/lib/core/files/records/sweep.d.ts +3 -0
- package/dist-lib/lib/core/files/records/sweep.js +9 -3
- package/dist-lib/lib/core/files/store/blob.d.ts +2 -0
- package/dist-lib/lib/core/files/store/blob.js +2 -2
- package/dist-lib/lib/core/files/store/index.d.ts +3 -1
- package/dist-lib/lib/core/files/store/index.js +4 -1
- package/dist-lib/lib/core/files/store/reference.d.ts +3 -0
- package/dist-lib/lib/core/files/store/reference.js +12 -2
- package/dist-lib/lib/core/files/store/sweep.js +3 -1
- package/dist-lib/lib/core/files/upload.d.ts +5 -1
- package/dist-lib/lib/core/files/upload.js +53 -14
- package/dist-lib/lib/core/first-event.d.ts +6 -0
- package/dist-lib/lib/core/first-event.js +13 -0
- package/dist-lib/lib/core/fs-drives.d.ts +6 -3
- package/dist-lib/lib/core/fs-drives.js +30 -18
- package/dist-lib/lib/core/id.d.ts +1 -0
- package/dist-lib/lib/core/id.js +3 -0
- package/dist-lib/lib/core/identity.d.ts +3 -1
- package/dist-lib/lib/core/identity.js +25 -4
- package/dist-lib/lib/core/invite.d.ts +6 -2
- package/dist-lib/lib/core/invite.js +22 -8
- package/dist-lib/lib/core/local/files.d.ts +2 -1
- package/dist-lib/lib/core/local/files.js +5 -7
- package/dist-lib/lib/core/local/index.d.ts +86 -7
- package/dist-lib/lib/core/local/index.js +312 -27
- package/dist-lib/lib/core/local/run-logs.d.ts +38 -0
- package/dist-lib/lib/core/local/run-logs.js +132 -0
- package/dist-lib/lib/core/member-key.d.ts +7 -0
- package/dist-lib/lib/core/member-key.js +24 -0
- package/dist-lib/lib/core/membership.d.ts +3 -14
- package/dist-lib/lib/core/membership.js +3 -96
- package/dist-lib/lib/core/mesh.d.ts +107 -30
- package/dist-lib/lib/core/mesh.js +625 -171
- package/dist-lib/lib/core/migrations/agent-tools-scope.d.ts +2 -0
- package/dist-lib/lib/core/migrations/agent-tools-scope.js +24 -0
- package/dist-lib/lib/core/migrations/chat-chunks.d.ts +4 -0
- package/dist-lib/lib/core/migrations/chat-chunks.js +47 -0
- package/dist-lib/lib/core/migrations/file-index.d.ts +1 -1
- package/dist-lib/lib/core/migrations/file-index.js +8 -6
- package/dist-lib/lib/core/migrations/index.d.ts +2 -1
- package/dist-lib/lib/core/migrations/index.js +69 -8
- package/dist-lib/lib/core/model-requests.d.ts +13 -0
- package/dist-lib/lib/core/model-requests.js +65 -0
- package/dist-lib/lib/core/next-frame.js +2 -1
- package/dist-lib/lib/core/notification.js +100 -25
- package/dist-lib/lib/core/pdf/figure.d.ts +22 -0
- package/dist-lib/lib/core/pdf/figure.js +64 -0
- package/dist-lib/lib/core/pdf/rasterize.d.ts +12 -3
- package/dist-lib/lib/core/pdf/rasterize.js +77 -28
- package/dist-lib/lib/core/peer-duplex.d.ts +34 -0
- package/dist-lib/lib/core/{harness-loan.js → peer-duplex.js} +104 -45
- package/dist-lib/lib/core/project-keys.d.ts +13 -0
- package/dist-lib/lib/core/project-keys.js +56 -0
- package/dist-lib/lib/core/prompt-history.js +4 -4
- package/dist-lib/lib/core/protocol-pairing.d.ts +11 -0
- package/dist-lib/lib/core/protocol-pairing.js +22 -0
- package/dist-lib/lib/core/public-mesh.d.ts +26 -0
- package/dist-lib/lib/core/public-mesh.js +94 -0
- package/dist-lib/lib/core/purge.d.ts +3 -0
- package/dist-lib/lib/core/purge.js +7 -0
- package/dist-lib/lib/core/run-driver.d.ts +17 -0
- package/dist-lib/lib/core/run-driver.js +20 -0
- package/dist-lib/lib/core/run-requests.d.ts +11 -0
- package/dist-lib/lib/core/run-requests.js +58 -0
- package/dist-lib/lib/core/send.d.ts +2 -0
- package/dist-lib/lib/core/send.js +17 -4
- package/dist-lib/lib/core/senders.d.ts +19 -0
- package/dist-lib/lib/core/senders.js +45 -0
- package/dist-lib/lib/core/shared-agents.d.ts +40 -0
- package/dist-lib/lib/core/shared-agents.js +283 -0
- package/dist-lib/lib/core/skill-secrets.d.ts +10 -16
- package/dist-lib/lib/core/skill-secrets.js +90 -72
- package/dist-lib/lib/core/sync/background.d.ts +35 -0
- package/dist-lib/lib/core/sync/background.js +85 -0
- package/dist-lib/lib/core/sync/changed.d.ts +20 -0
- package/dist-lib/lib/core/sync/changed.js +7 -0
- package/dist-lib/lib/core/sync/devices.js +6 -3
- package/dist-lib/lib/core/sync/files.d.ts +1 -0
- package/dist-lib/lib/core/sync/files.js +50 -72
- package/dist-lib/lib/core/sync/index.d.ts +1 -1
- package/dist-lib/lib/core/sync/index.js +164 -81
- package/dist-lib/lib/core/sync/view-updates.d.ts +33 -0
- package/dist-lib/lib/core/sync/view-updates.js +133 -0
- package/dist-lib/lib/core/sync-status.js +3 -3
- package/dist-lib/lib/core/system-info.d.ts +2 -2
- package/dist-lib/lib/core/system-info.js +10 -11
- package/dist-lib/lib/core/tool-configs.d.ts +5 -3
- package/dist-lib/lib/core/tool-configs.js +11 -11
- package/dist-lib/lib/core/transcript-visibility.d.ts +5 -5
- package/dist-lib/lib/core/transcript-visibility.js +27 -31
- package/dist-lib/lib/core/upgrade-agents.d.ts +11 -0
- package/dist-lib/lib/core/upgrade-agents.js +78 -0
- package/dist-lib/lib/core/video/attachment.d.ts +1 -0
- package/dist-lib/lib/core/video/attachment.js +7 -0
- package/dist-lib/lib/core/video/digest.d.ts +16 -0
- package/dist-lib/lib/core/video/digest.js +57 -0
- package/dist-lib/lib/core/video/frames.d.ts +32 -0
- package/dist-lib/lib/core/video/frames.js +224 -0
- package/dist-lib/lib/core/workspace-upgrade.d.ts +22 -0
- package/dist-lib/lib/core/workspace-upgrade.js +50 -0
- package/dist-lib/lib/core.d.ts +303 -84
- package/dist-lib/lib/core.js +3952 -1511
- package/dist-lib/lib/credential-pusher.d.ts +17 -7
- package/dist-lib/lib/credential-pusher.js +111 -62
- package/dist-lib/lib/custom-model-pusher.d.ts +2 -4
- package/dist-lib/lib/custom-model-task.d.ts +2 -1
- package/dist-lib/lib/custom-model-task.js +2 -2
- package/dist-lib/lib/device-tree.d.ts +18 -0
- package/dist-lib/lib/device-tree.js +32 -0
- package/dist-lib/lib/diagnostics.d.ts +7 -0
- package/dist-lib/lib/diagnostics.js +22 -0
- package/dist-lib/lib/doctor/checks.d.ts +15 -0
- package/dist-lib/lib/doctor/checks.js +272 -0
- package/dist-lib/lib/doctor/redact.d.ts +4 -0
- package/dist-lib/lib/doctor/redact.js +31 -0
- package/dist-lib/lib/doctor/render.d.ts +8 -0
- package/dist-lib/lib/doctor/render.js +83 -0
- package/dist-lib/lib/doctor/tree.d.ts +5 -0
- package/dist-lib/lib/doctor/tree.js +167 -0
- package/dist-lib/lib/downloads-allowed-pusher.d.ts +8 -0
- package/dist-lib/lib/downloads-allowed-pusher.js +37 -0
- package/dist-lib/lib/errors.d.ts +794 -0
- package/dist-lib/lib/errors.js +728 -0
- package/dist-lib/lib/fs-drive-bridge.d.ts +8 -1
- package/dist-lib/lib/fs-drive-bridge.js +312 -31
- package/dist-lib/lib/guards.d.ts +1 -0
- package/dist-lib/lib/guards.js +4 -0
- package/dist-lib/lib/inference-calls.d.ts +1 -2
- package/dist-lib/lib/inference-calls.js +2 -10
- package/dist-lib/lib/integrations/setup-routes.js +7 -5
- package/dist-lib/lib/knowledge-search.d.ts +1 -1
- package/dist-lib/lib/knowledge-search.js +5 -51
- package/dist-lib/lib/kv-cache-reclaim.d.ts +2 -1
- package/dist-lib/lib/kv-cache-reclaim.js +30 -0
- package/dist-lib/lib/kv-cache-retention.d.ts +35 -0
- package/dist-lib/lib/kv-cache-retention.js +98 -0
- package/dist-lib/lib/latest-frame.d.ts +10 -0
- package/dist-lib/lib/latest-frame.js +48 -0
- package/dist-lib/lib/log.d.ts +7 -6
- package/dist-lib/lib/log.js +14 -7
- package/dist-lib/lib/logger-type.d.ts +2 -5
- package/dist-lib/lib/mesh-scoped-engine.js +42 -2
- package/dist-lib/lib/model-download-status.d.ts +3 -3
- package/dist-lib/lib/model-download.d.ts +16 -12
- package/dist-lib/lib/model-download.js +90 -34
- package/dist-lib/lib/model-idle-pusher.d.ts +2 -4
- package/dist-lib/lib/model-memory-cap.d.ts +27 -0
- package/dist-lib/lib/model-memory-cap.js +69 -0
- package/dist-lib/lib/models-watch.d.ts +1 -1
- package/dist-lib/lib/models-watch.js +4 -4
- package/dist-lib/lib/oauth/browser-connect.js +3 -2
- package/dist-lib/lib/oauth/flow-core.js +5 -3
- package/dist-lib/lib/oauth/flow.js +1 -1
- package/dist-lib/lib/oauth/loopback.d.ts +1 -0
- package/dist-lib/lib/oauth/loopback.js +57 -12
- package/dist-lib/lib/oauth/providers.js +4 -2
- package/dist-lib/lib/oauth/redirect-types.d.ts +1 -0
- package/dist-lib/lib/oauth/register.js +35 -19
- package/dist-lib/lib/oauth/request.d.ts +10 -0
- package/dist-lib/lib/oauth/request.js +22 -0
- package/dist-lib/lib/oauth/resolve.js +13 -5
- package/dist-lib/lib/oauth/token-exchange-core.js +31 -33
- package/dist-lib/lib/oauth/types.d.ts +3 -0
- package/dist-lib/lib/oauth.d.ts +2 -1
- package/dist-lib/lib/oauth.js +1 -0
- package/dist-lib/lib/persistent-dir.d.ts +1 -0
- package/dist-lib/lib/persistent-dir.js +9 -0
- package/dist-lib/lib/probe-rounds.d.ts +3 -0
- package/dist-lib/lib/probe-rounds.js +5 -0
- package/dist-lib/lib/reconnecting-watch.js +19 -11
- package/dist-lib/lib/run-input.d.ts +14 -0
- package/dist-lib/lib/run-input.js +33 -0
- package/dist-lib/lib/run-notices.d.ts +5 -0
- package/dist-lib/lib/run-notices.js +13 -2
- package/dist-lib/lib/run-replay.d.ts +44 -0
- package/dist-lib/lib/run-replay.js +158 -0
- package/dist-lib/lib/run-transcript.d.ts +11 -12
- package/dist-lib/lib/run-transcript.js +16 -18
- package/dist-lib/lib/suspend-lifecycle.js +15 -5
- package/dist-lib/lib/task.js +6 -4
- package/dist-lib/lib/test-env.d.ts +1 -0
- package/dist-lib/lib/test-env.js +4 -0
- package/dist-lib/schema/build.js +66 -55
- package/dist-lib/schema/config.d.ts +1 -1
- package/dist-lib/schema/config.js +1 -1
- package/dist-lib/schema/content.d.ts +5 -1
- package/dist-lib/schema/content.js +60 -12
- package/dist-lib/schema/engine.d.ts +1 -0
- package/dist-lib/schema/engine.js +780 -155
- package/dist-lib/schema/field-order.js +8 -1
- package/dist-lib/schema/indexes.d.ts +7 -0
- package/dist-lib/schema/indexes.js +48 -3
- package/dist-lib/schema/local.js +80 -5
- package/dist-lib/schema/qvac.d.ts +4 -1
- package/dist-lib/schema/qvac.js +474 -14
- package/dist-lib/spec/bind.js +212 -48
- package/dist-lib/spec/calls.js +46 -5
- package/dist-lib/spec/capabilities.d.ts +100 -18
- package/dist-lib/spec/config/hyperconf/index.js +1 -1
- package/dist-lib/spec/hrpc/hrpc.json +739 -206
- package/dist-lib/spec/hrpc/index.js +844 -345
- package/dist-lib/spec/hrpc/messages.js +3906 -1749
- package/dist-lib/spec/hyperschema/index.js +3906 -1749
- package/dist-lib/spec/hyperschema/schema.json +4809 -3119
- package/dist-lib/spec/hyperschema/types.d.ts +482 -62
- package/dist-lib/spec/local/hyperdb/db.json +95 -1
- package/dist-lib/spec/local/hyperdb/index.js +459 -2
- package/dist-lib/spec/local/hyperdb/messages.js +1565 -487
- package/dist-lib/spec/local/hyperschema/index.js +573 -16
- package/dist-lib/spec/local/hyperschema/schema.json +354 -1
- package/dist-lib/spec/local/hyperschema/types.d.ts +85 -2
- package/dist-lib/spec/mesh/hyperdb/db.json +577 -7
- package/dist-lib/spec/mesh/hyperdb/index.js +2224 -6
- package/dist-lib/spec/mesh/hyperdb/messages.js +6476 -1266
- package/dist-lib/spec/mesh/hyperdispatch/dispatch.json +193 -1
- package/dist-lib/spec/mesh/hyperdispatch/index.js +545 -1
- package/dist-lib/spec/mesh/hyperdispatch/messages.js +3655 -265
- package/dist-lib/spec/mesh/hyperschema/index.js +3655 -265
- package/dist-lib/spec/mesh/hyperschema/schema.json +1974 -19
- package/dist-lib/spec/mesh/hyperschema/types.d.ts +498 -6
- package/package.json +64 -43
- package/worker/assistant-sidecar.mjs +18 -2
- package/worker/stow-entry.mjs +2 -0
- package/dist-lib/lib/core/contract/compute.d.ts +0 -11
- package/dist-lib/lib/core/contract/compute.js +0 -48
- package/dist-lib/lib/core/device-invites.d.ts +0 -11
- package/dist-lib/lib/core/device-invites.js +0 -63
- package/dist-lib/lib/core/files/processing/settle.d.ts +0 -13
- package/dist-lib/lib/core/files/processing/settle.js +0 -86
- package/dist-lib/lib/core/grant-expiry.d.ts +0 -11
- package/dist-lib/lib/core/grant-expiry.js +0 -66
- package/dist-lib/lib/core/handoff-channel.d.ts +0 -47
- package/dist-lib/lib/core/handoff-channel.js +0 -123
- package/dist-lib/lib/core/harness-loan.d.ts +0 -29
- package/dist-lib/lib/core/host-run-log-store.d.ts +0 -114
- package/dist-lib/lib/core/host-run-log-store.js +0 -976
- package/dist-lib/lib/core/hosted-agents.d.ts +0 -38
- package/dist-lib/lib/core/hosted-agents.js +0 -140
- package/dist-lib/lib/core/inference-calls-handoff.d.ts +0 -20
- package/dist-lib/lib/core/inference-calls-handoff.js +0 -37
- package/dist-lib/lib/core/inference-calls-receiver.d.ts +0 -14
- package/dist-lib/lib/core/inference-calls-receiver.js +0 -42
- package/dist-lib/lib/core/mesh-seed-handoff.d.ts +0 -25
- package/dist-lib/lib/core/mesh-seed-handoff.js +0 -52
- package/dist-lib/lib/core/migrations/device-indexes.d.ts +0 -2
- package/dist-lib/lib/core/migrations/device-indexes.js +0 -7
- package/dist-lib/lib/core/secret-handoff.d.ts +0 -17
- package/dist-lib/lib/core/secret-handoff.js +0 -29
- package/dist-lib/lib/core/skill-overlay-handoff.d.ts +0 -25
- package/dist-lib/lib/core/skill-overlay-handoff.js +0 -50
- package/dist-lib/lib/core/skill-overlay-receiver.d.ts +0 -8
- package/dist-lib/lib/core/skill-overlay-receiver.js +0 -23
- package/dist-lib/lib/image-cache-dir.d.ts +0 -1
- package/dist-lib/lib/image-cache-dir.js +0 -5
- package/dist-lib/lib/log-levels.d.ts +0 -7
- package/dist-lib/lib/log-levels.js +0 -1
- package/dist-lib/lib/logger.d.ts +0 -5
- package/dist-lib/lib/logger.js +0 -18
- package/dist-lib/lib/oauth/loopback.stub.d.ts +0 -3
- package/dist-lib/lib/oauth/loopback.stub.js +0 -6
- package/tui/README.md +0 -142
- package/tui/app.mjs +0 -6939
- package/tui/boot.mjs +0 -111
- package/tui/index.mjs +0 -53
- package/tui/lib/boot-timing.mjs +0 -41
- package/tui/lib/busy-words.mjs +0 -116
- package/tui/lib/export.mjs +0 -194
- package/tui/lib/knowledge-command.mjs +0 -190
- package/tui/lib/knowledge-import.mjs +0 -171
- package/tui/lib/render.mjs +0 -196
- package/tui/lib/save-file.mjs +0 -88
- package/tui/lib/select.mjs +0 -81
- package/tui/lib/selection.mjs +0 -18
- package/tui/lib/setup.mjs +0 -101
- package/tui/lib/sidebar.mjs +0 -63
- package/tui/lib/splash-art.mjs +0 -107
- package/tui/lib/splash.mjs +0 -18
- package/tui/lib/upload-frames.mjs +0 -9
- package/tui/lib/usage.mjs +0 -59
- package/tui/lib/wrap.mjs +0 -143
- package/tui/main.mjs +0 -264
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
interface RunRequestFields {
|
|
2
|
+
readonly capability?: string | null;
|
|
3
|
+
readonly originDeviceId: Buffer;
|
|
4
|
+
readonly runnerDeviceId?: Buffer | null;
|
|
5
|
+
readonly runTakenBy?: Buffer | null;
|
|
6
|
+
}
|
|
7
|
+
export interface RunDriverInput {
|
|
8
|
+
readonly request: RunRequestFields;
|
|
9
|
+
readonly agent: {
|
|
10
|
+
readonly providerDeviceId: Buffer;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export declare function runDriver({ request, agent }: RunDriverInput): Buffer | null;
|
|
14
|
+
export declare function drivenBy(input: RunDriverInput, deviceId: Buffer): boolean;
|
|
15
|
+
export declare function offeredTo(request: RunRequestFields, deviceId: Buffer): boolean;
|
|
16
|
+
export declare function handedOff(request: RunRequestFields, deviceId: Buffer): boolean;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import b4a from 'b4a';
|
|
2
|
+
export function runDriver({ request, agent }) {
|
|
3
|
+
if (request.capability) {
|
|
4
|
+
return agent.providerDeviceId;
|
|
5
|
+
}
|
|
6
|
+
return request.runnerDeviceId ? (request.runTakenBy ?? null) : request.originDeviceId;
|
|
7
|
+
}
|
|
8
|
+
export function drivenBy(input, deviceId) {
|
|
9
|
+
const driver = runDriver(input);
|
|
10
|
+
return !!driver && b4a.equals(driver, deviceId);
|
|
11
|
+
}
|
|
12
|
+
function untaken(request) {
|
|
13
|
+
return !request.capability && !!request.runnerDeviceId && !request.runTakenBy;
|
|
14
|
+
}
|
|
15
|
+
export function offeredTo(request, deviceId) {
|
|
16
|
+
return untaken(request) && b4a.equals(request.runnerDeviceId, deviceId);
|
|
17
|
+
}
|
|
18
|
+
export function handedOff(request, deviceId) {
|
|
19
|
+
return untaken(request) && b4a.equals(request.originDeviceId, deviceId);
|
|
20
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { QvacAgent, QvacChunk } from '../../spec/mesh/hyperschema/types.d.ts';
|
|
2
|
+
import type { Mesh, MeshDispatcher } from './mesh.ts';
|
|
3
|
+
export interface RunnerChoice {
|
|
4
|
+
readonly deviceId: Buffer;
|
|
5
|
+
readonly peers: ReadonlyArray<string>;
|
|
6
|
+
readonly agent: Pick<QvacAgent, 'providerDeviceId'>;
|
|
7
|
+
}
|
|
8
|
+
export declare function pickRunner(mesh: Mesh, { deviceId, peers, agent }: RunnerChoice): Promise<Buffer | undefined>;
|
|
9
|
+
export declare function takeRunRequest(store: Mesh, id: string): Promise<QvacChunk>;
|
|
10
|
+
export declare function handedOffRequests(store: Mesh, deviceId: Buffer, chatId: string): Promise<QvacChunk[]>;
|
|
11
|
+
export declare function takeBack(requests: ReadonlyArray<QvacChunk>, into: MeshDispatcher): void;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import b4a from 'b4a';
|
|
2
|
+
import { isMobilePlatform } from '@qvac/harness/lib/models/model-catalog.ts';
|
|
3
|
+
import { CAPABILITY_PROFILES } from '../../schema/qvac.js';
|
|
4
|
+
import { CoreError } from '../errors.js';
|
|
5
|
+
import { getChunk, mustGetChunk } from './chunk.js';
|
|
6
|
+
import { openToTake, runHasTerminalStatus, runTaker } from './contract/run-requests.js';
|
|
7
|
+
import { liveDevicesOf } from './contract/activity.js';
|
|
8
|
+
import { DEVICES, RUN_REQUESTS } from './collections.js';
|
|
9
|
+
const rank = (device) => CAPABILITY_PROFILES.indexOf(device.capabilityProfile);
|
|
10
|
+
export async function pickRunner(mesh, { deviceId, peers, agent }) {
|
|
11
|
+
const self = await mesh.view.get(DEVICES, { id: deviceId });
|
|
12
|
+
const member = self?.memberId;
|
|
13
|
+
if (!member) {
|
|
14
|
+
return undefined;
|
|
15
|
+
}
|
|
16
|
+
const connected = new Set(peers);
|
|
17
|
+
const ours = (await liveDevicesOf(mesh.view, member)).filter((device) => !!device.memberId &&
|
|
18
|
+
b4a.equals(device.memberId, member) &&
|
|
19
|
+
!b4a.equals(device.id, deviceId) &&
|
|
20
|
+
connected.has(b4a.toHex(device.id)));
|
|
21
|
+
const provider = ours.find((device) => b4a.equals(device.id, agent.providerDeviceId));
|
|
22
|
+
if (provider) {
|
|
23
|
+
return provider.id;
|
|
24
|
+
}
|
|
25
|
+
const desktops = ours.filter((device) => !isMobilePlatform(device.platform ?? ''));
|
|
26
|
+
return desktops.sort((a, b) => rank(b) - rank(a))[0]?.id;
|
|
27
|
+
}
|
|
28
|
+
export async function takeRunRequest(store, id) {
|
|
29
|
+
const request = await getChunk(store, id);
|
|
30
|
+
if (request?.type !== 'run-request') {
|
|
31
|
+
throw new CoreError('CHUNK_NOT_FOUND', [id]);
|
|
32
|
+
}
|
|
33
|
+
if (request.runnerDeviceId && !(await runTaker(store.view, request, store.localWriterKey))) {
|
|
34
|
+
throw new CoreError('RUN_REQUEST_NOT_OURS', [id]);
|
|
35
|
+
}
|
|
36
|
+
const { chatId, runId } = request;
|
|
37
|
+
if (!openToTake(request) || !runId || (await runHasTerminalStatus(store.view, chatId, runId))) {
|
|
38
|
+
throw new CoreError('RUN_REQUEST_TAKEN', [id]);
|
|
39
|
+
}
|
|
40
|
+
await store.dispatch('take-run-request', { id, at: Date.now() });
|
|
41
|
+
return mustGetChunk(store, id);
|
|
42
|
+
}
|
|
43
|
+
export async function handedOffRequests(store, deviceId, chatId) {
|
|
44
|
+
const range = { gte: { chatId }, lte: { chatId } };
|
|
45
|
+
const handed = [];
|
|
46
|
+
for await (const request of store.view.find(RUN_REQUESTS, range)) {
|
|
47
|
+
const ours = openToTake(request) && b4a.equals(request.originDeviceId, deviceId);
|
|
48
|
+
if (ours && request.runId && !(await runHasTerminalStatus(store.view, chatId, request.runId))) {
|
|
49
|
+
handed.push(request);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return handed;
|
|
53
|
+
}
|
|
54
|
+
export function takeBack(requests, into) {
|
|
55
|
+
for (const request of requests) {
|
|
56
|
+
into.dispatch('take-run-request', { id: request.id, at: Date.now() });
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -1,27 +1,39 @@
|
|
|
1
|
+
import { CoreError } from '../errors.js';
|
|
2
|
+
import { mustGetActiveAgent } from './agent.js';
|
|
1
3
|
import { buildChat, enrichChat, mustGetActiveChat } from './chat.js';
|
|
2
4
|
import { appendChunk, listChunks } from './chunk.js';
|
|
3
5
|
import { randomId } from './id.js';
|
|
6
|
+
import { handedOffRequests, pickRunner, takeBack } from './run-requests.js';
|
|
7
|
+
import { runDefinition } from './shared-agents.js';
|
|
4
8
|
export async function sendMessage(mesh, input) {
|
|
5
9
|
const existing = input.chatId ? await mustGetActiveChat(mesh, input.chatId) : null;
|
|
6
10
|
const agentId = input.agentId ?? existing?.agentId;
|
|
7
11
|
if (!agentId) {
|
|
8
|
-
throw new
|
|
12
|
+
throw new CoreError('SEND_AGENT_REQUIRED');
|
|
9
13
|
}
|
|
14
|
+
const agent = await runDefinition(mesh, await mustGetActiveAgent(mesh, agentId));
|
|
10
15
|
const chat = existing ?? buildChat({ agentId, title: input.title ?? '' });
|
|
11
16
|
const chatId = chat.id;
|
|
12
17
|
const parentId = input.parentRunId
|
|
13
18
|
? await parentRequestId(mesh, chatId, input.parentRunId)
|
|
14
19
|
: undefined;
|
|
15
20
|
const runId = randomId();
|
|
21
|
+
const { originDeviceId } = input;
|
|
22
|
+
const handed = existing ? await handedOffRequests(mesh, originDeviceId, chatId) : [];
|
|
23
|
+
const runner = agent && input.peers && !input.capability && !handed.length
|
|
24
|
+
? await pickRunner(mesh, { deviceId: originDeviceId, peers: input.peers, agent })
|
|
25
|
+
: undefined;
|
|
16
26
|
const batch = mesh.batch();
|
|
17
27
|
if (!existing) {
|
|
18
28
|
batch.dispatch('put-chat', { chat });
|
|
19
29
|
}
|
|
30
|
+
takeBack(handed, batch);
|
|
20
31
|
const { id: chunkId } = await appendChunk(mesh, {
|
|
21
32
|
chatId,
|
|
22
33
|
type: 'user-message',
|
|
23
34
|
userMessage: { text: input.text },
|
|
24
|
-
originDeviceId
|
|
35
|
+
originDeviceId,
|
|
36
|
+
senderNameAtSend: input.senderNameAtSend
|
|
25
37
|
}, batch);
|
|
26
38
|
await appendChunk(mesh, {
|
|
27
39
|
chatId,
|
|
@@ -32,7 +44,8 @@ export async function sendMessage(mesh, input) {
|
|
|
32
44
|
capabilityArgs: input.capabilityArgs,
|
|
33
45
|
enhance: input.enhance,
|
|
34
46
|
parentId,
|
|
35
|
-
originDeviceId
|
|
47
|
+
originDeviceId,
|
|
48
|
+
runnerDeviceId: runner
|
|
36
49
|
}, batch);
|
|
37
50
|
await batch.flush();
|
|
38
51
|
return {
|
|
@@ -46,7 +59,7 @@ export async function parentRequestId(mesh, chatId, parentRunId) {
|
|
|
46
59
|
const requests = await listChunks(mesh, { chatId, type: 'run-request' });
|
|
47
60
|
const parent = requests.find((chunk) => chunk.runId === parentRunId);
|
|
48
61
|
if (!parent) {
|
|
49
|
-
throw new
|
|
62
|
+
throw new CoreError('RUN_NOT_FOUND', [parentRunId]);
|
|
50
63
|
}
|
|
51
64
|
return parent.id;
|
|
52
65
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type HyperDB from 'hyperdb';
|
|
2
|
+
import type { ReadChunk } from './chunk.ts';
|
|
3
|
+
import type { Mesh } from './mesh.ts';
|
|
4
|
+
export interface Sender {
|
|
5
|
+
readonly name?: string | undefined;
|
|
6
|
+
readonly live: boolean;
|
|
7
|
+
readonly inProject: boolean;
|
|
8
|
+
}
|
|
9
|
+
export type Senders = (memberId: Buffer) => Promise<Sender>;
|
|
10
|
+
export type SenderLookup = (meshId: string) => Promise<Senders | null>;
|
|
11
|
+
export type SentChunk = ReadChunk & {
|
|
12
|
+
readonly senderName?: string | undefined;
|
|
13
|
+
readonly senderNotInProject?: boolean;
|
|
14
|
+
readonly senderFormerMember?: boolean;
|
|
15
|
+
readonly senderCopiedBy?: Buffer | undefined;
|
|
16
|
+
};
|
|
17
|
+
export declare function projectSenders(workspace: HyperDB, project: HyperDB): Senders;
|
|
18
|
+
export declare function ourSenderName(mesh: Mesh, meshId: string, lookup: SenderLookup | null | undefined): Promise<string | undefined>;
|
|
19
|
+
export declare function withSenders(chunks: ReadonlyArray<ReadChunk>, senders: Senders | null): Promise<SentChunk[]>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import b4a from 'b4a';
|
|
2
|
+
import { MEMBERS, PROJECT_MEMBERS } from './collections.js';
|
|
3
|
+
import { liveDevicesOf } from './contract/activity.js';
|
|
4
|
+
export function projectSenders(workspace, project) {
|
|
5
|
+
return async (memberId) => {
|
|
6
|
+
const [member, live, inProject] = await Promise.all([
|
|
7
|
+
workspace.get(MEMBERS, { id: memberId }),
|
|
8
|
+
liveDevicesOf(workspace, memberId),
|
|
9
|
+
project.get(PROJECT_MEMBERS, { memberId })
|
|
10
|
+
]);
|
|
11
|
+
return { name: member?.name, live: live.length > 0, inProject: inProject !== null };
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export async function ourSenderName(mesh, meshId, lookup) {
|
|
15
|
+
const ours = mesh.ourMemberId ?? (await mesh.refreshOurMember())?.memberId;
|
|
16
|
+
const senders = ours && lookup ? await lookup(meshId) : null;
|
|
17
|
+
return ours && senders ? (await senders(ours)).name : undefined;
|
|
18
|
+
}
|
|
19
|
+
export async function withSenders(chunks, senders) {
|
|
20
|
+
if (!senders) {
|
|
21
|
+
return [...chunks];
|
|
22
|
+
}
|
|
23
|
+
const known = new Map();
|
|
24
|
+
const senderOf = (id) => {
|
|
25
|
+
const hex = b4a.toHex(id);
|
|
26
|
+
const found = known.get(hex) ?? senders(id);
|
|
27
|
+
known.set(hex, found);
|
|
28
|
+
return found;
|
|
29
|
+
};
|
|
30
|
+
return Promise.all(chunks.map(async (chunk) => {
|
|
31
|
+
if (chunk.type !== 'user-message' || !chunk.requesterMemberId) {
|
|
32
|
+
return chunk;
|
|
33
|
+
}
|
|
34
|
+
const writer = chunk.requesterMemberId;
|
|
35
|
+
const sender = chunk.senderMemberId ?? writer;
|
|
36
|
+
const { name, live, inProject } = await senderOf(sender);
|
|
37
|
+
return {
|
|
38
|
+
...chunk,
|
|
39
|
+
senderName: name,
|
|
40
|
+
senderNotInProject: live && !inProject,
|
|
41
|
+
senderFormerMember: name !== undefined && !live,
|
|
42
|
+
senderCopiedBy: b4a.equals(sender, writer) ? undefined : writer
|
|
43
|
+
};
|
|
44
|
+
}));
|
|
45
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { QvacAgent } from '../../spec/mesh/hyperschema/types.d.ts';
|
|
2
|
+
import type { Mesh, MeshBatch } from './mesh.ts';
|
|
3
|
+
export declare function ownerOf(workspace: Mesh, agent: QvacAgent): Promise<Buffer | null>;
|
|
4
|
+
export declare function liveSharedAgent(workspace: Mesh, agentId: string): Promise<QvacAgent | null>;
|
|
5
|
+
export declare function shareAgent(account: Mesh, workspace: Mesh, agentId: string): Promise<QvacAgent>;
|
|
6
|
+
export declare function unshareAgent(workspace: Mesh, agentId: string): Promise<void>;
|
|
7
|
+
export declare function followSharedAgents(account: Mesh, workspace: Mesh): Promise<void>;
|
|
8
|
+
export interface ListedAgent extends QvacAgent {
|
|
9
|
+
readonly ownerMemberId?: Buffer;
|
|
10
|
+
readonly shared: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare function workspaceAgents(workspace: Mesh, own: ReadonlyArray<QvacAgent>): Promise<ListedAgent[]>;
|
|
13
|
+
export type PickRefusal = 'AGENT_NOT_SHARED' | 'CHAT_AGENT_UNAVAILABLE';
|
|
14
|
+
export interface AgentPicks {
|
|
15
|
+
pick(into: Mesh, agentId: string | null | undefined, refusal?: PickRefusal): Promise<void>;
|
|
16
|
+
unpick(into: Mesh, agentId: string): Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
export declare function accountPicks(account: () => Mesh | null): AgentPicks;
|
|
19
|
+
export interface PickScope {
|
|
20
|
+
readonly account: Mesh | null;
|
|
21
|
+
readonly workspace: Mesh | null;
|
|
22
|
+
readonly sharePublicSeed: (workspace: Mesh, hostDeviceId: Buffer) => Promise<void>;
|
|
23
|
+
readonly shareProjectSeed: (batch: MeshBatch, seal: HostSeal) => Promise<void>;
|
|
24
|
+
}
|
|
25
|
+
export interface HostSeal {
|
|
26
|
+
readonly workspace: Mesh;
|
|
27
|
+
readonly project: Mesh;
|
|
28
|
+
readonly agent: QvacAgent;
|
|
29
|
+
readonly picking?: boolean;
|
|
30
|
+
}
|
|
31
|
+
export interface AgentPick {
|
|
32
|
+
readonly into: Mesh;
|
|
33
|
+
readonly agentId: string | null | undefined;
|
|
34
|
+
readonly refusal?: PickRefusal;
|
|
35
|
+
}
|
|
36
|
+
export declare function pickAgent(scope: PickScope, { into, agentId, refusal }: AgentPick): Promise<void>;
|
|
37
|
+
export declare function unpickAgent(workspace: Mesh, into: Mesh, agentId: string): Promise<void>;
|
|
38
|
+
export declare function followPickedAgents(workspace: Mesh, into: Mesh): Promise<void>;
|
|
39
|
+
export declare function runDefinition(mesh: Mesh, row: QvacAgent | null): Promise<QvacAgent | null>;
|
|
40
|
+
export declare function unpickMemberAgents(workspace: Mesh, into: Mesh, memberId: Buffer): Promise<void>;
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
import b4a from 'b4a';
|
|
2
|
+
import { encode } from '../../spec/mesh/hyperschema/index.js';
|
|
3
|
+
import { CoreError } from '../errors.js';
|
|
4
|
+
import { mustGetActiveAgent } from './agent.js';
|
|
5
|
+
import { copyAgent } from './agent-copies.js';
|
|
6
|
+
import { stripped } from './chat-copy.js';
|
|
7
|
+
import { listsMember, readProject } from './contract/projects.js';
|
|
8
|
+
import { ACTIVE_CHATS_BY_AGENT, AGENT_USERS, AGENTS, AGENTS_BY_PROVIDER, DEVICES } from './collections.js';
|
|
9
|
+
import { devicesOfMember } from './contract/activity.js';
|
|
10
|
+
export async function ownerOf(workspace, agent) {
|
|
11
|
+
const device = await workspace.view.get(DEVICES, { id: agent.providerDeviceId });
|
|
12
|
+
return device?.memberId ?? null;
|
|
13
|
+
}
|
|
14
|
+
async function ours(workspace, agent) {
|
|
15
|
+
const owner = await ownerOf(workspace, agent);
|
|
16
|
+
return !!owner && !!workspace.ourMemberId && b4a.equals(owner, workspace.ourMemberId);
|
|
17
|
+
}
|
|
18
|
+
async function theirs(workspace, agent) {
|
|
19
|
+
const owner = await ownerOf(workspace, agent);
|
|
20
|
+
return !!owner && !!workspace.ourMemberId && !b4a.equals(owner, workspace.ourMemberId);
|
|
21
|
+
}
|
|
22
|
+
export async function liveSharedAgent(workspace, agentId) {
|
|
23
|
+
const agent = await workspace.view.get(AGENTS, { id: agentId });
|
|
24
|
+
return agent && !agent.deletedAt ? agent : null;
|
|
25
|
+
}
|
|
26
|
+
function sharedRow(agent, updatedAt) {
|
|
27
|
+
return { ...stripped(agent), isDefault: false, updatedAt };
|
|
28
|
+
}
|
|
29
|
+
export async function shareAgent(account, workspace, agentId) {
|
|
30
|
+
const agent = await mustGetActiveAgent(account, agentId);
|
|
31
|
+
if (!(await ours(workspace, agent))) {
|
|
32
|
+
throw new CoreError('AGENT_HOST_NOT_IN_WORKSPACE');
|
|
33
|
+
}
|
|
34
|
+
const held = await workspace.view.get(AGENTS, { id: agentId });
|
|
35
|
+
if (held && !held.deletedAt && !(await ours(workspace, held))) {
|
|
36
|
+
throw new CoreError('AGENT_NOT_OURS');
|
|
37
|
+
}
|
|
38
|
+
if (held && !held.deletedAt && held.updatedAt >= agent.updatedAt) {
|
|
39
|
+
return held;
|
|
40
|
+
}
|
|
41
|
+
const row = sharedRow(agent, Math.max(agent.updatedAt, (held?.updatedAt ?? 0) + 1));
|
|
42
|
+
await workspace.dispatch('put-agent', { agent: row });
|
|
43
|
+
return row;
|
|
44
|
+
}
|
|
45
|
+
export async function unshareAgent(workspace, agentId) {
|
|
46
|
+
const shared = await liveSharedAgent(workspace, agentId);
|
|
47
|
+
if (!shared) {
|
|
48
|
+
throw new CoreError('AGENT_NOT_SHARED', [agentId]);
|
|
49
|
+
}
|
|
50
|
+
if (!(await ours(workspace, shared))) {
|
|
51
|
+
throw new CoreError('AGENT_NOT_OURS');
|
|
52
|
+
}
|
|
53
|
+
const at = Math.max(Date.now(), shared.updatedAt + 1);
|
|
54
|
+
await workspace.dispatch('put-agent', { agent: { ...shared, deletedAt: at, updatedAt: at } });
|
|
55
|
+
}
|
|
56
|
+
export async function followSharedAgents(account, workspace) {
|
|
57
|
+
for (const copy of await workspace.view.find(AGENTS).toArray()) {
|
|
58
|
+
if (workspace.closing || account.closing)
|
|
59
|
+
return;
|
|
60
|
+
if (copy.deletedAt || !(await ours(workspace, copy)))
|
|
61
|
+
continue;
|
|
62
|
+
const agent = await account.view.get(AGENTS, { id: copy.id });
|
|
63
|
+
if (agent && agent.updatedAt > copy.updatedAt) {
|
|
64
|
+
await workspace.dispatch('put-agent', { agent: sharedRow(agent, agent.updatedAt) });
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
export async function workspaceAgents(workspace, own) {
|
|
69
|
+
const member = workspace.ourMemberId;
|
|
70
|
+
const ownIds = new Set(own.map((agent) => agent.id));
|
|
71
|
+
const listed = [];
|
|
72
|
+
for (const agent of own) {
|
|
73
|
+
const copy = await liveSharedAgent(workspace, agent.id);
|
|
74
|
+
const shared = !!copy && (await ours(workspace, copy));
|
|
75
|
+
listed.push({ ...agent, ownerMemberId: member ?? undefined, shared });
|
|
76
|
+
}
|
|
77
|
+
for (const copy of await workspace.view.find(AGENTS).toArray()) {
|
|
78
|
+
const owner = copy.deletedAt || ownIds.has(copy.id) ? null : await ownerOf(workspace, copy);
|
|
79
|
+
if (owner && !(member && b4a.equals(owner, member))) {
|
|
80
|
+
listed.push({ ...copy, ownerMemberId: owner, shared: true });
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return listed;
|
|
84
|
+
}
|
|
85
|
+
export function accountPicks(account) {
|
|
86
|
+
return {
|
|
87
|
+
pick: (into, agentId) => copyAgent(account(), into, agentId),
|
|
88
|
+
unpick: async () => { }
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
function pickedRow(shared, workspace, updatedAt) {
|
|
92
|
+
return { ...sharedRow(shared, updatedAt), sharedIn: workspace.key };
|
|
93
|
+
}
|
|
94
|
+
function sameContent(a, b) {
|
|
95
|
+
return b4a.equals(encode('@qvac/agent', { ...a, updatedAt: 0 }), encode('@qvac/agent', { ...b, updatedAt: 0 }));
|
|
96
|
+
}
|
|
97
|
+
function restored(workspace, shared, held) {
|
|
98
|
+
if (held && sameContent(held, pickedRow(shared, workspace, 0))) {
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
return pickedRow(shared, workspace, Math.max(shared.updatedAt, (held?.updatedAt ?? 0) + 1));
|
|
102
|
+
}
|
|
103
|
+
function picked(copy, workspace) {
|
|
104
|
+
return !!copy && !copy.deletedAt && !!copy.sharedIn && b4a.equals(copy.sharedIn, workspace.key);
|
|
105
|
+
}
|
|
106
|
+
function follows(workspace, into, copy) {
|
|
107
|
+
return into.role === 'project' || (!!copy.sharedIn && b4a.equals(copy.sharedIn, workspace.key));
|
|
108
|
+
}
|
|
109
|
+
function inUse(into, agentId) {
|
|
110
|
+
return into.view.findOne(ACTIVE_CHATS_BY_AGENT, { gte: { agentId }, lte: { agentId } });
|
|
111
|
+
}
|
|
112
|
+
function userOf(workspace, into) {
|
|
113
|
+
if (into.role === 'project') {
|
|
114
|
+
return { projectId: into.key };
|
|
115
|
+
}
|
|
116
|
+
return workspace.ourMemberId ? { memberId: workspace.ourMemberId } : null;
|
|
117
|
+
}
|
|
118
|
+
function refuse(refusal, agentId) {
|
|
119
|
+
return refusal === 'AGENT_NOT_SHARED'
|
|
120
|
+
? new CoreError('AGENT_NOT_SHARED', [agentId])
|
|
121
|
+
: new CoreError('CHAT_AGENT_UNAVAILABLE');
|
|
122
|
+
}
|
|
123
|
+
export async function pickAgent(scope, { into, agentId, refusal = 'AGENT_NOT_SHARED' }) {
|
|
124
|
+
const { account, workspace } = scope;
|
|
125
|
+
if (!agentId || !workspace) {
|
|
126
|
+
return copyAgent(account, into, agentId);
|
|
127
|
+
}
|
|
128
|
+
const own = into.role === 'public' ? await account?.view.get(AGENTS, { id: agentId }) : null;
|
|
129
|
+
if (own && !own.deletedAt) {
|
|
130
|
+
return copyAgent(account, into, agentId);
|
|
131
|
+
}
|
|
132
|
+
const shared = await liveSharedAgent(workspace, agentId);
|
|
133
|
+
if (!shared) {
|
|
134
|
+
throw refuse(refusal, agentId);
|
|
135
|
+
}
|
|
136
|
+
const held = await into.view.get(AGENTS, { id: agentId });
|
|
137
|
+
if (into.role === 'public' && (await heldByAnother(into, { workspace, held, shared }))) {
|
|
138
|
+
throw new CoreError('CHAT_AGENT_UNAVAILABLE');
|
|
139
|
+
}
|
|
140
|
+
if (refusal === 'CHAT_AGENT_UNAVAILABLE' &&
|
|
141
|
+
(await leftProject(into, { workspace, held, shared }))) {
|
|
142
|
+
throw new CoreError('CHAT_AGENT_UNAVAILABLE');
|
|
143
|
+
}
|
|
144
|
+
const row = restored(workspace, shared, held);
|
|
145
|
+
if (row) {
|
|
146
|
+
await into.dispatch('put-agent', { agent: row });
|
|
147
|
+
}
|
|
148
|
+
const user = userOf(workspace, into);
|
|
149
|
+
const userId = user?.memberId ?? user?.projectId;
|
|
150
|
+
if (!user || !userId) {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
if (user.memberId && (await theirs(workspace, shared))) {
|
|
154
|
+
await scope.sharePublicSeed(workspace, shared.providerDeviceId);
|
|
155
|
+
}
|
|
156
|
+
const batch = workspace.batch();
|
|
157
|
+
const picking = !(await workspace.view.get(AGENT_USERS, { agentId, userId }));
|
|
158
|
+
if (picking) {
|
|
159
|
+
batch.dispatch('put-agent-user', { agentId, ...user });
|
|
160
|
+
}
|
|
161
|
+
if (user.projectId) {
|
|
162
|
+
await scope.shareProjectSeed(batch, { workspace, project: into, agent: shared, picking });
|
|
163
|
+
}
|
|
164
|
+
await batch.flush();
|
|
165
|
+
}
|
|
166
|
+
export async function unpickAgent(workspace, into, agentId) {
|
|
167
|
+
const copy = await into.view.get(AGENTS, { id: agentId });
|
|
168
|
+
if (await inUse(into, agentId)) {
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
if (picked(copy, workspace)) {
|
|
172
|
+
const at = Math.max(Date.now(), copy.updatedAt + 1);
|
|
173
|
+
await into.dispatch('put-agent', { agent: { ...stripped(copy), deletedAt: at, updatedAt: at } });
|
|
174
|
+
}
|
|
175
|
+
else if (into.role !== 'project') {
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
const user = userOf(workspace, into);
|
|
179
|
+
const userId = user?.memberId ?? user?.projectId;
|
|
180
|
+
if (user && userId && (await workspace.view.get(AGENT_USERS, { agentId, userId }))) {
|
|
181
|
+
await workspace.dispatch('put-agent-user', { agentId, ...user, removed: true });
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
export async function followPickedAgents(workspace, into) {
|
|
185
|
+
for (const copy of await into.view.find(AGENTS).toArray()) {
|
|
186
|
+
if (into.closing || workspace.closing)
|
|
187
|
+
return;
|
|
188
|
+
const shared = await workspace.view.get(AGENTS, { id: copy.id });
|
|
189
|
+
if (!follows(workspace, into, copy)) {
|
|
190
|
+
continue;
|
|
191
|
+
}
|
|
192
|
+
if (await ownerRemoved(into, { workspace, copy, shared })) {
|
|
193
|
+
if (!copy.deletedAt) {
|
|
194
|
+
const at = copy.updatedAt + 1;
|
|
195
|
+
await into.dispatch('put-agent', {
|
|
196
|
+
agent: { ...stripped(copy), deletedAt: at, updatedAt: at }
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
continue;
|
|
200
|
+
}
|
|
201
|
+
if (!shared || (await unpicked(into, copy, shared))) {
|
|
202
|
+
continue;
|
|
203
|
+
}
|
|
204
|
+
if (copy.deletedAt && (await leftProject(into, { workspace, held: copy, shared }))) {
|
|
205
|
+
continue;
|
|
206
|
+
}
|
|
207
|
+
const row = restored(workspace, shared, copy);
|
|
208
|
+
if (row) {
|
|
209
|
+
await into.dispatch('put-agent', { agent: row });
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
async function ownerRemoved(into, { workspace, copy, shared }) {
|
|
214
|
+
if (into.role === 'project' && shared) {
|
|
215
|
+
return false;
|
|
216
|
+
}
|
|
217
|
+
const host = await workspace.view.get(DEVICES, { id: copy.providerDeviceId });
|
|
218
|
+
if (!host?.revoked || !host.memberId) {
|
|
219
|
+
return false;
|
|
220
|
+
}
|
|
221
|
+
const owner = shared && (await ownerOf(workspace, shared));
|
|
222
|
+
return !owner || !b4a.equals(owner, host.memberId);
|
|
223
|
+
}
|
|
224
|
+
async function heldByAnother(into, { workspace, held, shared }) {
|
|
225
|
+
if (!held || b4a.equals(held.providerDeviceId, shared.providerDeviceId)) {
|
|
226
|
+
return false;
|
|
227
|
+
}
|
|
228
|
+
if (await ownerRemoved(into, { workspace, copy: held, shared })) {
|
|
229
|
+
return true;
|
|
230
|
+
}
|
|
231
|
+
if (!held.deletedAt) {
|
|
232
|
+
return false;
|
|
233
|
+
}
|
|
234
|
+
const [was, now] = [await ownerOf(workspace, held), await ownerOf(workspace, shared)];
|
|
235
|
+
return !was || !now || !b4a.equals(was, now);
|
|
236
|
+
}
|
|
237
|
+
async function leftProject(into, { workspace, shared }) {
|
|
238
|
+
if (into.role !== 'project') {
|
|
239
|
+
return false;
|
|
240
|
+
}
|
|
241
|
+
const used = await workspace.view.get(AGENT_USERS, { agentId: shared.id, userId: into.key });
|
|
242
|
+
const host = await into.view.get(DEVICES, { id: shared.providerDeviceId });
|
|
243
|
+
const [owner, project] = [
|
|
244
|
+
await ownerOf(workspace, shared),
|
|
245
|
+
await readProject(workspace.view, into.key)
|
|
246
|
+
];
|
|
247
|
+
const listed = !!owner && !!project && listsMember(project, owner);
|
|
248
|
+
if (host?.revoked) {
|
|
249
|
+
return listed || !used;
|
|
250
|
+
}
|
|
251
|
+
return !used && !listed;
|
|
252
|
+
}
|
|
253
|
+
async function unpicked(into, copy, shared) {
|
|
254
|
+
return !!copy.deletedAt && (!!shared.deletedAt || !(await inUse(into, copy.id)));
|
|
255
|
+
}
|
|
256
|
+
export async function runDefinition(mesh, row) {
|
|
257
|
+
const workspace = row && (await mesh.pickedFrom?.());
|
|
258
|
+
if (!row || !workspace || !follows(workspace, mesh, row)) {
|
|
259
|
+
return row;
|
|
260
|
+
}
|
|
261
|
+
const shared = await workspace.view.get(AGENTS, { id: row.id });
|
|
262
|
+
if (!shared || shared.deletedAt || (await ownerRemoved(mesh, { workspace, copy: row, shared }))) {
|
|
263
|
+
return null;
|
|
264
|
+
}
|
|
265
|
+
return pickedRow(shared, workspace, row.updatedAt);
|
|
266
|
+
}
|
|
267
|
+
export async function unpickMemberAgents(workspace, into, memberId) {
|
|
268
|
+
for (const device of await devicesOfMember(workspace.view, memberId)) {
|
|
269
|
+
if (!device.memberId || !b4a.equals(device.memberId, memberId)) {
|
|
270
|
+
continue;
|
|
271
|
+
}
|
|
272
|
+
const range = { gte: { providerDeviceId: device.id }, lte: { providerDeviceId: device.id } };
|
|
273
|
+
for (const copy of await into.view.find(AGENTS_BY_PROVIDER, range).toArray()) {
|
|
274
|
+
if (copy.deletedAt || !copy.sharedIn) {
|
|
275
|
+
continue;
|
|
276
|
+
}
|
|
277
|
+
const at = Math.max(Date.now(), copy.updatedAt + 1);
|
|
278
|
+
await into.dispatch('put-agent', {
|
|
279
|
+
agent: { ...stripped(copy), deletedAt: at, updatedAt: at }
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
}
|
|
@@ -1,25 +1,19 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { QvacAgent } from '../../spec/mesh/hyperschema/types.d.ts';
|
|
1
|
+
import type { AssistantPushSkillSecretRequest } from '../../spec/hyperschema/types.d.ts';
|
|
3
2
|
import type { openLocalStore } from './local/index.ts';
|
|
4
3
|
import type { Mesh } from './mesh.ts';
|
|
5
|
-
|
|
6
|
-
export declare const NOT_THE_HOST = "this device does not host that agent";
|
|
7
|
-
export declare const SENDER_REVOKED = "the sending device is no longer in the mesh";
|
|
8
|
-
export declare const HOST_REVOKED = "the device hosting this agent is no longer in the mesh";
|
|
9
|
-
export declare const NO_SUCH_AGENT = "no agent with that id";
|
|
10
|
-
export declare const NOT_A_SETUP_FIELD = "that skill declares no such setup field";
|
|
4
|
+
export type SkillSecretRequest = AssistantPushSkillSecretRequest;
|
|
11
5
|
export type SetupFields = (skillName: string) => Promise<ReadonlyMap<string, boolean> | null>;
|
|
12
6
|
export interface SkillSecretsOptions {
|
|
13
|
-
readonly mesh: Mesh;
|
|
14
7
|
readonly local: ReturnType<typeof openLocalStore>;
|
|
15
|
-
readonly deviceId: Uint8Array;
|
|
16
8
|
readonly setupFields: SetupFields;
|
|
17
9
|
readonly onstored: () => Promise<unknown>;
|
|
18
10
|
}
|
|
19
|
-
export declare function
|
|
20
|
-
export
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
readonly
|
|
11
|
+
export declare function storeSkillSecret(opts: SkillSecretsOptions, request: SkillSecretRequest): Promise<void>;
|
|
12
|
+
export declare function isDeviceKey(key: string): boolean;
|
|
13
|
+
type LocalStore = ReturnType<typeof openLocalStore>;
|
|
14
|
+
export interface SkillSecretSync {
|
|
15
|
+
readonly account: Mesh;
|
|
16
|
+
readonly local: LocalStore;
|
|
24
17
|
}
|
|
25
|
-
export declare function
|
|
18
|
+
export declare function syncSkillSecrets(sync: SkillSecretSync): Promise<boolean>;
|
|
19
|
+
export {};
|