@qvac/core 0.5.0 → 0.6.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/CHANGELOG.md +92 -1
- package/dist-lib/lib/api/agents.js +3 -2
- package/dist-lib/lib/api/app-config.d.ts +1 -1
- package/dist-lib/lib/api/app-config.js +54 -15
- package/dist-lib/lib/api/attachments.d.ts +6 -5
- package/dist-lib/lib/api/attachments.js +4 -2
- package/dist-lib/lib/api/chat.d.ts +7 -3
- package/dist-lib/lib/api/chat.js +4 -4
- package/dist-lib/lib/api/chunks.js +3 -3
- package/dist-lib/lib/api/config.js +2 -2
- package/dist-lib/lib/api/current-mesh.d.ts +3 -4
- package/dist-lib/lib/api/current-mesh.js +9 -4
- package/dist-lib/lib/api/custom-models.d.ts +8 -1
- package/dist-lib/lib/api/custom-models.js +53 -16
- package/dist-lib/lib/api/devices.d.ts +14 -5
- package/dist-lib/lib/api/devices.js +13 -8
- package/dist-lib/lib/api/diagnostics.d.ts +1 -0
- package/dist-lib/lib/api/diagnostics.js +1 -1
- package/dist-lib/lib/api/effective-ctx-size.d.ts +6 -1
- package/dist-lib/lib/api/effective-ctx-size.js +5 -3
- package/dist-lib/lib/api/execution.js +2 -1
- package/dist-lib/lib/api/files.js +2 -1
- package/dist-lib/lib/api/index.d.ts +5 -1
- package/dist-lib/lib/api/index.js +101 -102
- package/dist-lib/lib/api/instrument.js +29 -20
- package/dist-lib/lib/api/knowledge.d.ts +6 -5
- package/dist-lib/lib/api/knowledge.js +8 -6
- package/dist-lib/lib/api/local-files.js +1 -1
- package/dist-lib/lib/api/logs.js +6 -3
- package/dist-lib/lib/api/members.js +22 -13
- package/dist-lib/lib/api/mesh.js +3 -3
- package/dist-lib/lib/api/model-download.js +1 -1
- package/dist-lib/lib/api/network.d.ts +1 -0
- package/dist-lib/lib/api/network.js +1 -1
- package/dist-lib/lib/api/notifications.js +23 -13
- package/dist-lib/lib/api/rag.d.ts +6 -1
- package/dist-lib/lib/api/rag.js +20 -11
- package/dist-lib/lib/api/range.d.ts +2 -2
- package/dist-lib/lib/api/sync.js +1 -1
- package/dist-lib/lib/api/tool-activity.js +7 -3
- package/dist-lib/lib/api/tool-configs.js +2 -4
- package/dist-lib/lib/api/upload-frames.d.ts +7 -8
- package/dist-lib/lib/api/upload-frames.js +2 -1
- package/dist-lib/lib/api/watchable.d.ts +6 -1
- package/dist-lib/lib/api/watchable.js +23 -14
- package/dist-lib/lib/assistant/fetch-body.js +4 -2
- package/dist-lib/lib/assistant/harness.d.ts +48 -27
- package/dist-lib/lib/assistant/harness.js +40 -16
- package/dist-lib/lib/assistant/history.d.ts +9 -7
- package/dist-lib/lib/assistant/history.js +77 -42
- package/dist-lib/lib/assistant/message.d.ts +5 -3
- package/dist-lib/lib/assistant/message.js +4 -2
- package/dist-lib/lib/assistant/skill-encode.d.ts +3 -1
- package/dist-lib/lib/assistant/skill-encode.js +52 -62
- package/dist-lib/lib/assistant-client.js +7 -4
- package/dist-lib/lib/assistant-tree.js +27 -11
- package/dist-lib/lib/assistant.d.ts +31 -11
- package/dist-lib/lib/assistant.js +846 -390
- package/dist-lib/lib/audio-format.d.ts +1 -1
- package/dist-lib/lib/audio-format.js +1 -1
- package/dist-lib/lib/chat-title.js +9 -4
- package/dist-lib/lib/client.js +3 -2
- package/dist-lib/lib/collabora/convert.d.ts +2 -2
- package/dist-lib/lib/collabora/convert.js +6 -3
- package/dist-lib/lib/collabora/entry.js +9 -5
- package/dist-lib/lib/collabora/protocol.d.ts +2 -2
- package/dist-lib/lib/collabora/protocol.js +14 -7
- package/dist-lib/lib/collabora/worker.js +14 -7
- package/dist-lib/lib/compaction.d.ts +5 -6
- package/dist-lib/lib/compaction.js +14 -7
- package/dist-lib/lib/core/account-recovery.d.ts +4 -3
- package/dist-lib/lib/core/account-recovery.js +7 -4
- package/dist-lib/lib/core/agent.js +17 -15
- package/dist-lib/lib/core/approval-rules.d.ts +7 -6
- package/dist-lib/lib/core/approval-rules.js +12 -6
- package/dist-lib/lib/core/archived-mesh.d.ts +7 -5
- package/dist-lib/lib/core/archived-mesh.js +25 -22
- package/dist-lib/lib/core/async-iterable.js +10 -5
- package/dist-lib/lib/core/attachment-link.d.ts +2 -2
- package/dist-lib/lib/core/audio-attachment.js +1 -1
- package/dist-lib/lib/core/blind-peers.d.ts +2 -2
- package/dist-lib/lib/core/chat-activity.d.ts +2 -2
- package/dist-lib/lib/core/chat-activity.js +42 -21
- package/dist-lib/lib/core/chat-group.d.ts +8 -6
- package/dist-lib/lib/core/chat-group.js +17 -10
- package/dist-lib/lib/core/chat-order.d.ts +11 -9
- package/dist-lib/lib/core/chat-order.js +1 -3
- package/dist-lib/lib/core/chat-search.d.ts +4 -4
- package/dist-lib/lib/core/chat-search.js +38 -24
- package/dist-lib/lib/core/chat.d.ts +20 -14
- package/dist-lib/lib/core/chat.js +50 -31
- package/dist-lib/lib/core/chunk.d.ts +19 -23
- package/dist-lib/lib/core/chunk.js +27 -21
- package/dist-lib/lib/core/collections.d.ts +70 -0
- package/dist-lib/lib/core/collections.js +70 -0
- package/dist-lib/lib/core/contract/activity.d.ts +6 -2
- package/dist-lib/lib/core/contract/activity.js +15 -12
- package/dist-lib/lib/core/contract/agents.js +3 -2
- package/dist-lib/lib/core/contract/approval-rules.js +1 -1
- package/dist-lib/lib/core/contract/attestations.js +1 -1
- package/dist-lib/lib/core/contract/chat-group.js +1 -1
- package/dist-lib/lib/core/contract/chat.d.ts +2 -0
- package/dist-lib/lib/core/contract/chat.js +67 -1
- package/dist-lib/lib/core/contract/chunks.js +15 -9
- package/dist-lib/lib/core/contract/compute.d.ts +1 -1
- package/dist-lib/lib/core/contract/compute.js +4 -2
- package/dist-lib/lib/core/contract/devices.js +6 -5
- package/dist-lib/lib/core/contract/grant-order.js +5 -6
- package/dist-lib/lib/core/contract/index.js +4 -2
- package/dist-lib/lib/core/contract/indexing.js +3 -3
- package/dist-lib/lib/core/contract/invites.d.ts +8 -3
- package/dist-lib/lib/core/contract/invites.js +52 -26
- package/dist-lib/lib/core/contract/joined-meshes.js +3 -3
- package/dist-lib/lib/core/contract/knowledge.js +5 -5
- package/dist-lib/lib/core/contract/members.d.ts +13 -2
- package/dist-lib/lib/core/contract/members.js +46 -25
- package/dist-lib/lib/core/contract/mesh-kind.js +9 -8
- package/dist-lib/lib/core/contract/seal.js +1 -1
- package/dist-lib/lib/core/contract/seed-defaults.js +1 -3
- package/dist-lib/lib/core/contract/tool-activity.js +10 -5
- package/dist-lib/lib/core/contract/tool-configs.js +1 -2
- package/dist-lib/lib/core/contract/writers.d.ts +6 -1
- package/dist-lib/lib/core/contract/writers.js +55 -34
- package/dist-lib/lib/core/departures.js +16 -8
- package/dist-lib/lib/core/device-invites.js +3 -2
- package/dist-lib/lib/core/devices.js +6 -3
- package/dist-lib/lib/core/document-attachment.d.ts +20 -11
- package/dist-lib/lib/core/document-attachment.js +10 -5
- package/dist-lib/lib/core/files/attachments.d.ts +2 -5
- package/dist-lib/lib/core/files/attachments.js +6 -3
- package/dist-lib/lib/core/files/index.d.ts +46 -52
- package/dist-lib/lib/core/files/index.js +149 -94
- package/dist-lib/lib/core/files/knowledge.d.ts +2 -5
- package/dist-lib/lib/core/files/local-index.d.ts +4 -1
- package/dist-lib/lib/core/files/local-index.js +9 -5
- package/dist-lib/lib/core/files/preview/image.d.ts +0 -1
- package/dist-lib/lib/core/files/preview/image.js +9 -6
- package/dist-lib/lib/core/files/preview/index.d.ts +8 -11
- package/dist-lib/lib/core/files/preview/index.js +20 -15
- package/dist-lib/lib/core/files/processing/claims.d.ts +6 -5
- package/dist-lib/lib/core/files/processing/claims.js +16 -8
- package/dist-lib/lib/core/files/processing/document.d.ts +21 -50
- package/dist-lib/lib/core/files/processing/index.d.ts +21 -13
- package/dist-lib/lib/core/files/processing/index.js +74 -37
- package/dist-lib/lib/core/files/processing/ownership.d.ts +8 -1
- package/dist-lib/lib/core/files/processing/ownership.js +1 -1
- package/dist-lib/lib/core/files/processing/protocol.d.ts +19 -19
- package/dist-lib/lib/core/files/processing/protocol.js +5 -5
- package/dist-lib/lib/core/files/processing/settle.d.ts +10 -7
- package/dist-lib/lib/core/files/processing/settle.js +22 -11
- package/dist-lib/lib/core/files/processing/source.js +14 -8
- package/dist-lib/lib/core/files/processing/state.d.ts +14 -11
- package/dist-lib/lib/core/files/processing/state.js +24 -12
- package/dist-lib/lib/core/files/rag/build.d.ts +2 -2
- package/dist-lib/lib/core/files/rag/build.js +2 -1
- package/dist-lib/lib/core/files/rag/document-types.d.ts +4 -6
- package/dist-lib/lib/core/files/rag/index.d.ts +12 -13
- package/dist-lib/lib/core/files/rag/index.js +9 -2
- package/dist-lib/lib/core/files/rag/load.d.ts +10 -9
- package/dist-lib/lib/core/files/rag/load.js +26 -13
- package/dist-lib/lib/core/files/rag/policy.js +2 -1
- package/dist-lib/lib/core/files/rag/produce.js +33 -19
- package/dist-lib/lib/core/files/rag/retrieval/full-text.d.ts +5 -3
- package/dist-lib/lib/core/files/rag/retrieval/full-text.js +30 -10
- package/dist-lib/lib/core/files/records/chunks.js +4 -2
- package/dist-lib/lib/core/files/records/index.d.ts +1 -0
- package/dist-lib/lib/core/files/records/index.js +1 -0
- package/dist-lib/lib/core/files/records/knowledge.d.ts +10 -11
- package/dist-lib/lib/core/files/records/knowledge.js +9 -8
- package/dist-lib/lib/core/files/records/linkage.js +6 -3
- package/dist-lib/lib/core/files/records/output.d.ts +5 -4
- package/dist-lib/lib/core/files/records/output.js +8 -4
- package/dist-lib/lib/core/files/records/purge.d.ts +4 -0
- package/dist-lib/lib/core/files/records/purge.js +108 -0
- package/dist-lib/lib/core/files/records/reclaim.js +43 -25
- package/dist-lib/lib/core/files/records/routing.d.ts +4 -6
- package/dist-lib/lib/core/files/records/routing.js +15 -8
- package/dist-lib/lib/core/files/records/source.d.ts +5 -4
- package/dist-lib/lib/core/files/records/source.js +20 -14
- package/dist-lib/lib/core/files/records/sweep.js +1 -3
- package/dist-lib/lib/core/files/store/blob.d.ts +11 -10
- package/dist-lib/lib/core/files/store/blob.js +54 -19
- package/dist-lib/lib/core/files/store/index.d.ts +2 -6
- package/dist-lib/lib/core/files/store/index.js +10 -5
- package/dist-lib/lib/core/files/store/inline.d.ts +2 -2
- package/dist-lib/lib/core/files/store/inline.js +6 -3
- package/dist-lib/lib/core/files/store/reference.d.ts +6 -9
- package/dist-lib/lib/core/files/store/reference.js +25 -17
- package/dist-lib/lib/core/files/store/server.d.ts +7 -6
- package/dist-lib/lib/core/files/store/server.js +22 -11
- package/dist-lib/lib/core/files/store/sweep.js +13 -7
- package/dist-lib/lib/core/files/upload-input.d.ts +4 -12
- package/dist-lib/lib/core/files/upload-input.js +10 -5
- package/dist-lib/lib/core/files/upload.d.ts +27 -24
- package/dist-lib/lib/core/files/upload.js +74 -51
- package/dist-lib/lib/core/fs-drives.js +4 -2
- package/dist-lib/lib/core/grant-expiry.js +12 -7
- package/dist-lib/lib/core/handoff-channel.js +27 -13
- package/dist-lib/lib/core/harness-loan.js +35 -17
- package/dist-lib/lib/core/helpers/index.js +6 -2
- package/dist-lib/lib/core/hosted-agents.js +19 -12
- package/dist-lib/lib/core/id.js +1 -1
- package/dist-lib/lib/core/identity.js +6 -3
- package/dist-lib/lib/core/image/cache-sweep.d.ts +12 -10
- package/dist-lib/lib/core/image/cache-sweep.js +11 -6
- package/dist-lib/lib/core/image/normalize.d.ts +6 -0
- package/dist-lib/lib/core/image/normalize.js +12 -2
- package/dist-lib/lib/core/image/sniff.js +42 -21
- package/dist-lib/lib/core/inference-calls-receiver.js +7 -4
- package/dist-lib/lib/core/invite-grants.js +4 -2
- package/dist-lib/lib/core/invite.js +2 -1
- package/dist-lib/lib/core/local/files.d.ts +2 -0
- package/dist-lib/lib/core/local/files.js +51 -19
- package/dist-lib/lib/core/local/index.d.ts +69 -46
- package/dist-lib/lib/core/local/index.js +146 -129
- package/dist-lib/lib/core/membership.d.ts +12 -2
- package/dist-lib/lib/core/membership.js +55 -33
- package/dist-lib/lib/core/mesh-seed-handoff.js +7 -1
- package/dist-lib/lib/core/mesh.d.ts +37 -27
- package/dist-lib/lib/core/mesh.js +131 -73
- package/dist-lib/lib/core/migrations/agent-catalog.js +3 -2
- package/dist-lib/lib/core/migrations/agent-indexes.js +3 -3
- package/dist-lib/lib/core/migrations/file-index.js +7 -4
- package/dist-lib/lib/core/migrations/index.d.ts +4 -3
- package/dist-lib/lib/core/migrations/membership.js +9 -4
- package/dist-lib/lib/core/migrations/seal.js +3 -2
- package/dist-lib/lib/core/min-version.js +4 -2
- package/dist-lib/lib/core/next-frame.d.ts +5 -4
- package/dist-lib/lib/core/next-frame.js +6 -3
- package/dist-lib/lib/core/notification.d.ts +5 -1
- package/dist-lib/lib/core/notification.js +89 -77
- package/dist-lib/lib/core/ota-config.js +2 -1
- package/dist-lib/lib/core/pdf/rasterize.d.ts +18 -0
- package/dist-lib/lib/core/pdf/rasterize.js +57 -0
- package/dist-lib/lib/core/prompt-history.js +4 -2
- package/dist-lib/lib/core/range.d.ts +4 -4
- package/dist-lib/lib/core/range.js +12 -6
- package/dist-lib/lib/core/rank.d.ts +5 -4
- package/dist-lib/lib/core/rank.js +2 -1
- package/dist-lib/lib/core/send.d.ts +4 -4
- package/dist-lib/lib/core/send.js +6 -3
- package/dist-lib/lib/core/skill-overlay-receiver.js +7 -4
- package/dist-lib/lib/core/skill-secrets.js +16 -9
- package/dist-lib/lib/core/sync/chunks.js +2 -1
- package/dist-lib/lib/core/sync/devices.js +3 -1
- package/dist-lib/lib/core/sync/files.d.ts +2 -4
- package/dist-lib/lib/core/sync/files.js +28 -20
- package/dist-lib/lib/core/sync/index.d.ts +2 -5
- package/dist-lib/lib/core/sync/index.js +33 -15
- package/dist-lib/lib/core/sync-status.js +10 -7
- package/dist-lib/lib/core/system-info.js +4 -2
- package/dist-lib/lib/core/tool-activity.d.ts +4 -3
- package/dist-lib/lib/core/tool-activity.js +1 -1
- package/dist-lib/lib/core/tool-configs.js +12 -7
- package/dist-lib/lib/core.d.ts +38 -26
- package/dist-lib/lib/core.js +1009 -541
- package/dist-lib/lib/credential-pusher.d.ts +20 -20
- package/dist-lib/lib/credential-pusher.js +65 -43
- package/dist-lib/lib/custom-model-pusher.d.ts +7 -3
- package/dist-lib/lib/custom-model-pusher.js +15 -7
- package/dist-lib/lib/custom-model-task.d.ts +1 -0
- package/dist-lib/lib/custom-model-task.js +12 -0
- package/dist-lib/lib/deadline.js +4 -2
- package/dist-lib/lib/diagnostics.d.ts +1 -5
- package/dist-lib/lib/frame-readable.d.ts +3 -0
- package/dist-lib/lib/frame-readable.js +3 -0
- package/dist-lib/lib/fs-drive-bridge.js +24 -14
- package/dist-lib/lib/fs-grants.js +13 -8
- package/dist-lib/lib/guards.d.ts +3 -0
- package/dist-lib/lib/guards.js +9 -0
- package/dist-lib/lib/inference-calls.d.ts +28 -23
- package/dist-lib/lib/inference-calls.js +25 -13
- package/dist-lib/lib/integrations/mcp-providers.d.ts +2 -2
- package/dist-lib/lib/integrations/setup-routes.d.ts +2 -2
- package/dist-lib/lib/knowledge-search.d.ts +6 -5
- package/dist-lib/lib/knowledge-search.js +26 -18
- package/dist-lib/lib/kv-cache-reclaim.js +4 -2
- package/dist-lib/lib/kv-cache.js +8 -4
- package/dist-lib/lib/legacy-core-domain.d.ts +42 -42
- package/dist-lib/lib/log-buffer.js +2 -1
- package/dist-lib/lib/log.js +25 -15
- package/dist-lib/lib/mesh-scoped-engine.js +12 -4
- package/dist-lib/lib/model-catalog-revision.js +6 -3
- package/dist-lib/lib/model-clamp.js +6 -3
- package/dist-lib/lib/model-context.d.ts +8 -3
- package/dist-lib/lib/model-context.js +13 -5
- package/dist-lib/lib/model-download-status.js +4 -2
- package/dist-lib/lib/model-download.d.ts +12 -4
- package/dist-lib/lib/model-download.js +200 -103
- package/dist-lib/lib/model-idle-pusher.d.ts +2 -2
- package/dist-lib/lib/model-idle-pusher.js +3 -4
- package/dist-lib/lib/oauth/browser-connect.d.ts +10 -8
- package/dist-lib/lib/oauth/browser-connect.js +33 -20
- package/dist-lib/lib/oauth/client.d.ts +2 -2
- package/dist-lib/lib/oauth/flow-core.js +23 -9
- package/dist-lib/lib/oauth/flow.d.ts +1 -3
- package/dist-lib/lib/oauth/flow.js +9 -5
- package/dist-lib/lib/oauth/keys.d.ts +4 -4
- package/dist-lib/lib/oauth/keys.js +18 -12
- package/dist-lib/lib/oauth/loopback.d.ts +2 -2
- package/dist-lib/lib/oauth/loopback.js +147 -107
- package/dist-lib/lib/oauth/loopback.stub.d.ts +2 -2
- package/dist-lib/lib/oauth/loopback.stub.js +1 -1
- package/dist-lib/lib/oauth/pkce.d.ts +4 -2
- package/dist-lib/lib/oauth/pkce.js +10 -0
- package/dist-lib/lib/oauth/providers.js +5 -5
- package/dist-lib/lib/oauth/redirect-types.d.ts +12 -7
- package/dist-lib/lib/oauth/register.js +3 -2
- package/dist-lib/lib/oauth/registry.d.ts +2 -2
- package/dist-lib/lib/oauth/registry.js +2 -1
- package/dist-lib/lib/oauth/resolve.d.ts +30 -10
- package/dist-lib/lib/oauth/resolve.js +12 -6
- package/dist-lib/lib/oauth/token-exchange-core.d.ts +12 -4
- package/dist-lib/lib/oauth/token-exchange-core.js +1 -1
- package/dist-lib/lib/oauth/types.d.ts +12 -12
- package/dist-lib/lib/oauth.d.ts +4 -5
- package/dist-lib/lib/oauth.js +2 -3
- package/dist-lib/lib/reconnecting-watch.d.ts +1 -1
- package/dist-lib/lib/reconnecting-watch.js +6 -6
- package/dist-lib/lib/retry-budget.js +6 -3
- package/dist-lib/lib/run-notices.d.ts +1 -0
- package/dist-lib/lib/run-notices.js +5 -2
- package/dist-lib/lib/run-transcript.d.ts +2 -4
- package/dist-lib/lib/run-transcript.js +4 -2
- package/dist-lib/lib/skill-readiness.js +4 -2
- package/dist-lib/lib/skill-types.d.ts +16 -16
- package/dist-lib/lib/suspend-lifecycle.d.ts +4 -4
- package/dist-lib/lib/suspend-lifecycle.js +10 -5
- package/dist-lib/lib/task.js +22 -12
- package/dist-lib/lib/unref.d.ts +3 -2
- package/dist-lib/lib/unref.js +2 -1
- package/dist-lib/lib/wav-duration.js +10 -5
- package/dist-lib/lib/write-queue.d.ts +5 -4
- package/dist-lib/lib/write-queue.js +2 -1
- package/dist-lib/schema/build.js +10 -6
- package/dist-lib/schema/config.d.ts +2 -3
- package/dist-lib/schema/content.d.ts +17 -2
- package/dist-lib/schema/content.js +2 -1
- package/dist-lib/schema/engine.d.ts +3 -2
- package/dist-lib/schema/engine.js +95 -6
- package/dist-lib/schema/field-order.js +22 -11
- package/dist-lib/schema/indexes.d.ts +22 -0
- package/dist-lib/schema/{helpers.js → indexes.js} +14 -57
- package/dist-lib/schema/local.d.ts +3 -2
- package/dist-lib/schema/local.js +7 -2
- package/dist-lib/schema/media-kind.d.ts +8 -0
- package/dist-lib/schema/media-kind.js +52 -0
- package/dist-lib/schema/qvac.d.ts +12 -9
- package/dist-lib/schema/qvac.js +18 -4
- package/dist-lib/spec/bind.js +12 -0
- package/dist-lib/spec/calls.js +4 -0
- package/dist-lib/spec/capabilities.d.ts +12 -4
- package/dist-lib/spec/hrpc/hrpc.json +54 -2
- package/dist-lib/spec/hrpc/index.js +53 -5
- package/dist-lib/spec/hrpc/messages.js +783 -494
- package/dist-lib/spec/hyperschema/index.js +783 -494
- package/dist-lib/spec/hyperschema/schema.json +247 -1
- package/dist-lib/spec/hyperschema/types.d.ts +69 -1
- package/dist-lib/spec/local/hyperdb/index.js +1 -1
- package/dist-lib/spec/local/hyperdb/messages.js +82 -14
- package/dist-lib/spec/local/hyperschema/index.js +42 -8
- package/dist-lib/spec/local/hyperschema/schema.json +27 -1
- package/dist-lib/spec/local/hyperschema/types.d.ts +6 -1
- package/dist-lib/spec/mesh/hyperdb/db.json +16 -1
- package/dist-lib/spec/mesh/hyperdb/index.js +72 -3
- package/dist-lib/spec/mesh/hyperdb/messages.js +400 -221
- package/dist-lib/spec/mesh/hyperdispatch/dispatch.json +7 -1
- package/dist-lib/spec/mesh/hyperdispatch/index.js +18 -1
- package/dist-lib/spec/mesh/hyperdispatch/messages.js +117 -2
- package/dist-lib/spec/mesh/hyperschema/index.js +117 -2
- package/dist-lib/spec/mesh/hyperschema/schema.json +65 -1
- package/dist-lib/spec/mesh/hyperschema/types.d.ts +19 -1
- package/package.json +8 -4
- package/tui/app.mjs +2424 -941
- package/tui/boot.mjs +18 -49
- package/tui/index.mjs +10 -5
- package/tui/lib/boot-timing.mjs +8 -8
- package/tui/lib/busy-words.mjs +21 -22
- package/tui/lib/export.mjs +100 -32
- package/tui/lib/knowledge-command.mjs +64 -19
- package/tui/lib/knowledge-import.mjs +52 -18
- package/tui/lib/render.mjs +65 -33
- package/tui/lib/save-file.mjs +30 -13
- package/tui/lib/select.mjs +23 -5
- package/tui/lib/selection.mjs +6 -4
- package/tui/lib/setup.mjs +11 -19
- package/tui/lib/sidebar.mjs +23 -13
- package/tui/lib/splash.mjs +6 -7
- package/tui/lib/upload-frames.mjs +1 -2
- package/tui/lib/usage.mjs +13 -9
- package/tui/lib/wrap.mjs +35 -6
- package/tui/main.mjs +54 -78
- package/worker/assistant-sidecar.mjs +5 -10
- package/worker/stow-entry.mjs +7 -4
- package/dist-lib/lib/custom-model-source.d.ts +0 -15
- package/dist-lib/lib/custom-model-source.js +0 -46
- package/dist-lib/lib/oauth/common.d.ts +0 -38
- package/dist-lib/lib/oauth/common.js +0 -34
- package/dist-lib/schema/helpers.d.ts +0 -33
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { diffusionDownloadName } from '@qvac/harness/lib/models/model-catalog.ts';
|
|
2
2
|
import { RUN_FAILURE_REASONS } from '../run-notices.js';
|
|
3
3
|
import { toEngineSkill } from './skill-encode.js';
|
|
4
|
+
import { isRecord } from '../guards.js';
|
|
5
|
+
export function isHarnessEvent(event, type) {
|
|
6
|
+
return event.type === type;
|
|
7
|
+
}
|
|
4
8
|
export function harnessListModels(harness) {
|
|
5
9
|
return async ({ type, cachedOnly, fullRegistry } = {}) => ({
|
|
6
10
|
models: [
|
|
@@ -21,17 +25,34 @@ export function harnessClearKvCache(harness) {
|
|
|
21
25
|
error: 'Harness does not support KV cache deletion'
|
|
22
26
|
};
|
|
23
27
|
}
|
|
28
|
+
export const PREVIEW_CONTRACT_MATCHES = true;
|
|
29
|
+
export const DELETE_CONTRACT_MATCHES = true;
|
|
30
|
+
export function harnessPreviewModelSource(harness) {
|
|
31
|
+
return async ({ src, mmprojSrc }) => {
|
|
32
|
+
if (!harness.previewModelSource) {
|
|
33
|
+
throw new Error('harness does not support previewModelSource');
|
|
34
|
+
}
|
|
35
|
+
const preview = await harness.previewModelSource({ src, mmprojSrc: mmprojSrc ?? undefined });
|
|
36
|
+
return {
|
|
37
|
+
...preview,
|
|
38
|
+
files: preview.files ? [...preview.files] : undefined,
|
|
39
|
+
fitReasons: preview.fitReasons ? [...preview.fitReasons] : undefined
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
}
|
|
24
43
|
export function harnessTranscribe(harness) {
|
|
25
44
|
return async ({ audio, model }) => {
|
|
26
|
-
if (!harness.transcribe)
|
|
45
|
+
if (!harness.transcribe) {
|
|
27
46
|
throw new Error('harness does not support transcribe');
|
|
47
|
+
}
|
|
28
48
|
return { text: await harness.transcribe({ audio, model: model ?? '' }) };
|
|
29
49
|
};
|
|
30
50
|
}
|
|
31
51
|
export function harnessDetectLanguage(harness) {
|
|
32
52
|
return async ({ text, topK }) => {
|
|
33
|
-
if (!harness.detectLanguage)
|
|
53
|
+
if (!harness.detectLanguage) {
|
|
34
54
|
throw new Error('harness does not support detectLanguage');
|
|
55
|
+
}
|
|
35
56
|
const languages = await harness.detectLanguage({ text, topK: topK || undefined });
|
|
36
57
|
return {
|
|
37
58
|
languages: languages.map(({ code, language, probability }) => ({
|
|
@@ -52,8 +73,9 @@ export function harnessSpeak(harness) {
|
|
|
52
73
|
}
|
|
53
74
|
export function harnessSkillCatalog(harness, syncCredentials) {
|
|
54
75
|
return async (agentId, modelName, options) => {
|
|
55
|
-
if (options?.refresh)
|
|
76
|
+
if (options?.refresh) {
|
|
56
77
|
await syncCredentials?.();
|
|
78
|
+
}
|
|
57
79
|
return {
|
|
58
80
|
skills: ((await harness.skills?.(agentId, modelName, options)) ?? []).map(toEngineSkill)
|
|
59
81
|
};
|
|
@@ -75,8 +97,9 @@ export function harnessSkillManagement(harness) {
|
|
|
75
97
|
return file ? { found: true, content: file.content, origin: file.origin } : { found: false };
|
|
76
98
|
},
|
|
77
99
|
async writeSkillFile(name, content) {
|
|
78
|
-
if (!harness.writeSkillFile)
|
|
100
|
+
if (!harness.writeSkillFile) {
|
|
79
101
|
return { ok: false };
|
|
102
|
+
}
|
|
80
103
|
return harness.writeSkillFile(name, content);
|
|
81
104
|
},
|
|
82
105
|
async copySkillForEdit(name) {
|
|
@@ -108,8 +131,9 @@ export function toolReportEntry(tool) {
|
|
|
108
131
|
}
|
|
109
132
|
export function harnessSpeakStream(harness) {
|
|
110
133
|
return async function* (text) {
|
|
111
|
-
if (!harness.speakStream)
|
|
134
|
+
if (!harness.speakStream) {
|
|
112
135
|
throw new Error('harness does not support speakStream');
|
|
136
|
+
}
|
|
113
137
|
for await (const { audio, sampleRate } of harness.speakStream({ model: '', text })) {
|
|
114
138
|
yield { audio, sampleRate };
|
|
115
139
|
}
|
|
@@ -117,25 +141,24 @@ export function harnessSpeakStream(harness) {
|
|
|
117
141
|
}
|
|
118
142
|
export function harnessDeathReason(status) {
|
|
119
143
|
const HARNESS_DIED = RUN_FAILURE_REASONS.harnessDied;
|
|
120
|
-
if (typeof status !== 'object' || status === null)
|
|
144
|
+
if (typeof status !== 'object' || status === null) {
|
|
121
145
|
return HARNESS_DIED;
|
|
122
|
-
|
|
123
|
-
const detail = typeof
|
|
124
|
-
const code = typeof
|
|
125
|
-
if (!detail)
|
|
146
|
+
}
|
|
147
|
+
const detail = 'error' in status && typeof status.error === 'string' && status.error ? status.error : null;
|
|
148
|
+
const code = 'code' in status && typeof status.code === 'string' && status.code ? status.code : null;
|
|
149
|
+
if (!detail) {
|
|
126
150
|
return code ? `${HARNESS_DIED} (${code})` : HARNESS_DIED;
|
|
151
|
+
}
|
|
127
152
|
return code ? `${HARNESS_DIED}: ${detail} (${code})` : `${HARNESS_DIED}: ${detail}`;
|
|
128
153
|
}
|
|
129
154
|
export function harnessDied(status) {
|
|
130
|
-
if (typeof status !== 'object' || status === null || !('state' in status))
|
|
155
|
+
if (typeof status !== 'object' || status === null || !('state' in status)) {
|
|
131
156
|
return false;
|
|
157
|
+
}
|
|
132
158
|
return status.state === 'died';
|
|
133
159
|
}
|
|
134
160
|
export function modelCatalogChanged(state) {
|
|
135
|
-
return (
|
|
136
|
-
state !== null &&
|
|
137
|
-
'catalogChanged' in state &&
|
|
138
|
-
state.catalogChanged === true);
|
|
161
|
+
return isRecord(state) && state.catalogChanged === true;
|
|
139
162
|
}
|
|
140
163
|
export function imageDownloadProgress(state) {
|
|
141
164
|
if (typeof state !== 'object' ||
|
|
@@ -156,8 +179,9 @@ export function imageDownloadProgress(state) {
|
|
|
156
179
|
return null;
|
|
157
180
|
}
|
|
158
181
|
const model = diffusionDownloadName(state.model);
|
|
159
|
-
if (!model)
|
|
182
|
+
if (!model) {
|
|
160
183
|
return null;
|
|
184
|
+
}
|
|
161
185
|
return {
|
|
162
186
|
model,
|
|
163
187
|
phase: state.status === 'downloading' ? 'downloading' : 'complete',
|
|
@@ -24,13 +24,15 @@ export interface CompactResult {
|
|
|
24
24
|
readonly reason?: string;
|
|
25
25
|
}
|
|
26
26
|
export declare function couldNameSenders(chunks: ReadonlyArray<AssistantChunk>): boolean;
|
|
27
|
-
export
|
|
28
|
-
id: Buffer;
|
|
29
|
-
name: string;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
27
|
+
export interface SenderMember {
|
|
28
|
+
readonly id: Buffer;
|
|
29
|
+
readonly name: string;
|
|
30
|
+
}
|
|
31
|
+
export interface SenderDevice {
|
|
32
|
+
readonly id: Buffer;
|
|
33
|
+
readonly memberId?: Buffer | null;
|
|
34
|
+
}
|
|
35
|
+
export declare function senderNamesFrom(chunks: ReadonlyArray<AssistantChunk>, members: ReadonlyArray<SenderMember>, devices: ReadonlyArray<SenderDevice>): ReadonlyMap<string, string>;
|
|
34
36
|
export declare function senderAttribution(names: ReadonlyMap<string, string>): string;
|
|
35
37
|
export declare function historyFromChunks(chunks: ReadonlyArray<AssistantChunk>, stale?: Partial<StaleToolRuns>, senderNames?: ReadonlyMap<string, string>): ChatMessage[];
|
|
36
38
|
export declare function inputAvailableToRun(chunk: AssistantChunk, requestSeq: number): boolean;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { attachmentTurn, skillLoadedTurn } from '@qvac/harness/lib/capabilities/tool-turns.ts';
|
|
2
2
|
import { HISTORY_CHUNK_TYPES } from '../core/chunk.js';
|
|
3
3
|
import { isAudioAttachment } from '../core/audio-attachment.js';
|
|
4
|
-
import { isDocumentAttachment } from '../core/document-attachment.js';
|
|
4
|
+
import { isDocumentAttachment, isPdfAttachment } from '../core/document-attachment.js';
|
|
5
5
|
import { groupAttachmentsByMessage } from '../core/files/index.js';
|
|
6
6
|
import { IMAGE_MIMES } from '../core/image/normalize.js';
|
|
7
7
|
import { compactionTurn, foldCompactedChunks } from '../compaction.js';
|
|
8
|
+
import b4a from 'b4a';
|
|
9
|
+
import { isRecord } from '../guards.js';
|
|
8
10
|
export const TERMINAL_STATES = new Set(['completed', 'failed', 'canceled']);
|
|
9
11
|
export const HISTORY_TYPES = HISTORY_CHUNK_TYPES;
|
|
10
12
|
export const SKILL_TOOL = 'skill';
|
|
@@ -27,8 +29,9 @@ export function latestAttemptStarts(chunks) {
|
|
|
27
29
|
continue;
|
|
28
30
|
if (TERMINAL_STATES.has(chunk.runStatus?.state ?? ''))
|
|
29
31
|
continue;
|
|
30
|
-
if (chunk.runStatus?.progress?.phase === 'compacting')
|
|
32
|
+
if (chunk.runStatus?.progress?.phase === 'compacting') {
|
|
31
33
|
continue;
|
|
34
|
+
}
|
|
32
35
|
starts.set(chunk.runId, chunk.seq);
|
|
33
36
|
}
|
|
34
37
|
return starts;
|
|
@@ -44,25 +47,28 @@ export function couldNameSenders(chunks) {
|
|
|
44
47
|
for (const chunk of chunks) {
|
|
45
48
|
if (chunk.type !== 'user-message')
|
|
46
49
|
continue;
|
|
47
|
-
seen.add((chunk.senderMemberId ?? chunk.originDeviceId)
|
|
48
|
-
if (seen.size > 1)
|
|
50
|
+
seen.add(b4a.toHex(chunk.senderMemberId ?? chunk.originDeviceId));
|
|
51
|
+
if (seen.size > 1) {
|
|
49
52
|
return true;
|
|
53
|
+
}
|
|
50
54
|
}
|
|
51
55
|
return false;
|
|
52
56
|
}
|
|
53
57
|
export function senderNamesFrom(chunks, members, devices) {
|
|
54
|
-
if (members.length < 2)
|
|
58
|
+
if (members.length < 2) {
|
|
55
59
|
return new Map();
|
|
56
|
-
|
|
57
|
-
const
|
|
60
|
+
}
|
|
61
|
+
const byMember = new Map(members.map((member) => [b4a.toHex(member.id), member.name]));
|
|
62
|
+
const deviceMember = new Map(devices.map((device) => [b4a.toHex(device.id), device.memberId]));
|
|
58
63
|
const names = new Map();
|
|
59
64
|
for (const chunk of chunks) {
|
|
60
65
|
if (chunk.type !== 'user-message')
|
|
61
66
|
continue;
|
|
62
|
-
const memberId = chunk.senderMemberId ?? deviceMember.get(chunk.originDeviceId
|
|
63
|
-
const name = memberId ? byMember.get(
|
|
64
|
-
if (name)
|
|
67
|
+
const memberId = chunk.senderMemberId ?? deviceMember.get(b4a.toHex(chunk.originDeviceId));
|
|
68
|
+
const name = memberId ? byMember.get(b4a.toHex(memberId)) : undefined;
|
|
69
|
+
if (name) {
|
|
65
70
|
names.set(chunk.id, name);
|
|
71
|
+
}
|
|
66
72
|
}
|
|
67
73
|
return names;
|
|
68
74
|
}
|
|
@@ -80,16 +86,19 @@ export function historyFromChunks(chunks, stale = {}, senderNames = new Map()) {
|
|
|
80
86
|
const attachments = [];
|
|
81
87
|
const userMessages = [];
|
|
82
88
|
for (const chunk of source) {
|
|
83
|
-
if (chunk.type === 'attachment')
|
|
89
|
+
if (chunk.type === 'attachment') {
|
|
84
90
|
attachments.push(chunk);
|
|
85
|
-
|
|
91
|
+
}
|
|
92
|
+
else if (chunk.userMessage) {
|
|
86
93
|
userMessages.push(chunk);
|
|
94
|
+
}
|
|
87
95
|
}
|
|
88
96
|
const byMessage = groupAttachmentsByMessage(attachments, userMessages);
|
|
89
97
|
const history = [];
|
|
90
98
|
const replayedSkills = new Set();
|
|
91
|
-
if (folded.summary)
|
|
99
|
+
if (folded.summary) {
|
|
92
100
|
history.push({ role: 'user', content: compactionTurn(folded.summary) });
|
|
101
|
+
}
|
|
93
102
|
const byRun = new Map();
|
|
94
103
|
const anchor = (runId) => {
|
|
95
104
|
let turn = byRun.get(runId);
|
|
@@ -102,39 +111,52 @@ export function historyFromChunks(chunks, stale = {}, senderNames = new Map()) {
|
|
|
102
111
|
};
|
|
103
112
|
for (const chunk of source) {
|
|
104
113
|
if (chunk.userMessage) {
|
|
105
|
-
if (staleQuestionChunkIds.has(chunk.id))
|
|
114
|
+
if (staleQuestionChunkIds.has(chunk.id)) {
|
|
106
115
|
continue;
|
|
116
|
+
}
|
|
107
117
|
const sender = shared ? senderNames.get(chunk.id) : undefined;
|
|
108
118
|
const turn = { role: 'user', content: chunk.userMessage.text };
|
|
109
|
-
if (sender)
|
|
119
|
+
if (sender) {
|
|
110
120
|
turn.sender = sender;
|
|
121
|
+
}
|
|
111
122
|
const refs = (byMessage.get(chunk.id) ?? [])
|
|
112
|
-
.
|
|
123
|
+
.flatMap((attachmentChunk) => attachmentChunk.attachment ?? [])
|
|
113
124
|
.filter((ref) => !ref.deletedAt);
|
|
114
125
|
const images = refs.filter((ref) => IMAGE_MIMES.has(ref.mimeType.toLowerCase()));
|
|
115
126
|
const audio = refs.filter((ref) => isAudioAttachment(ref.fileName, ref.mimeType));
|
|
116
127
|
const documents = refs.filter((ref) => isDocumentAttachment(ref));
|
|
117
|
-
|
|
128
|
+
const pdfs = documents.filter(isPdfAttachment);
|
|
129
|
+
if (images.length) {
|
|
118
130
|
turn.images = images;
|
|
119
|
-
|
|
131
|
+
}
|
|
132
|
+
if (audio.length) {
|
|
120
133
|
turn.audioAttachments = audio;
|
|
121
|
-
|
|
134
|
+
}
|
|
135
|
+
if (documents.length) {
|
|
122
136
|
turn.documents = documents;
|
|
137
|
+
}
|
|
138
|
+
if (pdfs.length) {
|
|
139
|
+
turn.pdfs = pdfs;
|
|
140
|
+
}
|
|
123
141
|
history.push(turn);
|
|
124
142
|
continue;
|
|
125
143
|
}
|
|
126
|
-
if (chunk.attachment)
|
|
144
|
+
if (chunk.attachment) {
|
|
127
145
|
continue;
|
|
146
|
+
}
|
|
128
147
|
if (chunk.type === 'run-request' && chunk.runId) {
|
|
129
148
|
anchor(chunk.runId);
|
|
130
149
|
continue;
|
|
131
150
|
}
|
|
132
151
|
if (chunk.toolResult?.name === SKILL_TOOL) {
|
|
133
|
-
if (chunk.runId && staleRunIds.has(chunk.runId))
|
|
152
|
+
if (chunk.runId && staleRunIds.has(chunk.runId)) {
|
|
134
153
|
continue;
|
|
135
|
-
|
|
154
|
+
}
|
|
155
|
+
if (beforeLatestAttempt(chunk, attemptStarts)) {
|
|
136
156
|
continue;
|
|
137
|
-
|
|
157
|
+
}
|
|
158
|
+
const { result } = chunk.toolResult;
|
|
159
|
+
const loaded = isRecord(result) ? result.name : undefined;
|
|
138
160
|
if (typeof loaded === 'string' && !replayedSkills.has(loaded)) {
|
|
139
161
|
replayedSkills.add(loaded);
|
|
140
162
|
const at = history.indexOf(anchor(chunk.runId)) + 1;
|
|
@@ -143,21 +165,27 @@ export function historyFromChunks(chunks, stale = {}, senderNames = new Map()) {
|
|
|
143
165
|
continue;
|
|
144
166
|
}
|
|
145
167
|
if (chunk.toolResult) {
|
|
146
|
-
if (chunk.runId && staleRunIds.has(chunk.runId))
|
|
168
|
+
if (chunk.runId && staleRunIds.has(chunk.runId)) {
|
|
147
169
|
continue;
|
|
148
|
-
|
|
170
|
+
}
|
|
171
|
+
if (beforeLatestAttempt(chunk, attemptStarts)) {
|
|
149
172
|
continue;
|
|
173
|
+
}
|
|
150
174
|
const produced = attachmentTurn(chunk.toolResult.name, chunk.toolResult.result);
|
|
151
|
-
if (produced)
|
|
175
|
+
if (produced) {
|
|
152
176
|
history.push({ role: 'tool', content: produced });
|
|
177
|
+
}
|
|
153
178
|
continue;
|
|
154
179
|
}
|
|
155
|
-
if (!chunk.content)
|
|
180
|
+
if (!chunk.content) {
|
|
156
181
|
continue;
|
|
157
|
-
|
|
182
|
+
}
|
|
183
|
+
if (chunk.runId && staleRunIds.has(chunk.runId)) {
|
|
158
184
|
continue;
|
|
159
|
-
|
|
185
|
+
}
|
|
186
|
+
if (beforeLatestAttempt(chunk, attemptStarts)) {
|
|
160
187
|
continue;
|
|
188
|
+
}
|
|
161
189
|
anchor(chunk.runId).content += chunk.content.text;
|
|
162
190
|
}
|
|
163
191
|
return history.filter((turn) => turn.role === 'user' || turn.content.length > 0);
|
|
@@ -205,12 +233,13 @@ export function staleToolRunIds(historyChunks, approvalChunks, currentRunId) {
|
|
|
205
233
|
const empty = { runIds: new Set(), questionChunkIds: new Set() };
|
|
206
234
|
const toolRuns = new Set();
|
|
207
235
|
for (const chunk of approvalChunks) {
|
|
208
|
-
if (chunk.runId)
|
|
236
|
+
if (chunk.runId) {
|
|
209
237
|
toolRuns.add(chunk.runId);
|
|
238
|
+
}
|
|
210
239
|
}
|
|
211
|
-
if (!toolRuns.size)
|
|
240
|
+
if (!toolRuns.size) {
|
|
212
241
|
return empty;
|
|
213
|
-
|
|
242
|
+
}
|
|
214
243
|
const turnText = new Map();
|
|
215
244
|
const turnRuns = new Map();
|
|
216
245
|
const runChunk = new Map();
|
|
@@ -223,7 +252,6 @@ export function staleToolRunIds(historyChunks, approvalChunks, currentRunId) {
|
|
|
223
252
|
if (chunk.type === 'run-request' && chunk.runId && lastUser !== null) {
|
|
224
253
|
const chunkId = lastUser.chunkId;
|
|
225
254
|
if (!turnText.has(chunkId)) {
|
|
226
|
-
turnOrder.push(chunkId);
|
|
227
255
|
turnText.set(chunkId, lastUser.text);
|
|
228
256
|
}
|
|
229
257
|
turnRuns.set(chunkId, [...(turnRuns.get(chunkId) ?? []), chunk.runId]);
|
|
@@ -231,31 +259,38 @@ export function staleToolRunIds(historyChunks, approvalChunks, currentRunId) {
|
|
|
231
259
|
}
|
|
232
260
|
}
|
|
233
261
|
const currentChunkId = runChunk.get(currentRunId) ?? lastUser?.chunkId;
|
|
234
|
-
if (currentChunkId === undefined)
|
|
262
|
+
if (currentChunkId === undefined) {
|
|
235
263
|
return empty;
|
|
264
|
+
}
|
|
236
265
|
const currentText = turnText.get(currentChunkId) ?? lastUser?.text;
|
|
237
|
-
if (currentText === undefined)
|
|
266
|
+
if (currentText === undefined) {
|
|
238
267
|
return empty;
|
|
268
|
+
}
|
|
239
269
|
const target = normalizeQuestion(currentText);
|
|
240
|
-
if (isGenericAcknowledgement(target))
|
|
270
|
+
if (isGenericAcknowledgement(target)) {
|
|
241
271
|
return empty;
|
|
242
|
-
|
|
243
|
-
const
|
|
272
|
+
}
|
|
273
|
+
const turns = [...turnText];
|
|
274
|
+
const currentIndex = turns.findIndex(([chunkId]) => chunkId === currentChunkId);
|
|
275
|
+
const start = currentIndex === -1 ? turns.length - 1 : currentIndex - 1;
|
|
244
276
|
const runIds = new Set();
|
|
245
277
|
const questionChunkIds = new Set();
|
|
246
278
|
let blockHadApproval = false;
|
|
247
279
|
for (let i = start; i >= 0; i--) {
|
|
248
|
-
const chunkId =
|
|
249
|
-
if (normalizeQuestion(
|
|
280
|
+
const [chunkId, text] = turns[i];
|
|
281
|
+
if (normalizeQuestion(text) !== target) {
|
|
250
282
|
break;
|
|
283
|
+
}
|
|
251
284
|
questionChunkIds.add(chunkId);
|
|
252
285
|
for (const rid of turnRuns.get(chunkId) ?? []) {
|
|
253
286
|
runIds.add(rid);
|
|
254
|
-
if (toolRuns.has(rid))
|
|
287
|
+
if (toolRuns.has(rid)) {
|
|
255
288
|
blockHadApproval = true;
|
|
289
|
+
}
|
|
256
290
|
}
|
|
257
291
|
}
|
|
258
|
-
if (!blockHadApproval)
|
|
292
|
+
if (!blockHadApproval) {
|
|
259
293
|
return empty;
|
|
294
|
+
}
|
|
260
295
|
return { runIds, questionChunkIds };
|
|
261
296
|
}
|
|
@@ -9,6 +9,7 @@ export interface ChatMessage {
|
|
|
9
9
|
images?: AttachmentRef[];
|
|
10
10
|
audioAttachments?: AttachmentRef[];
|
|
11
11
|
documents?: DocumentAttachment[];
|
|
12
|
+
pdfs?: AttachmentRef[];
|
|
12
13
|
}
|
|
13
14
|
export declare const IMAGE_ONLY_USER_PROMPT = "The user sent one or more images without any accompanying text. Describe what the images show and respond to anything notable in them.";
|
|
14
15
|
export declare const DOCUMENT_ONLY_USER_PROMPT = "The user sent one or more documents without any accompanying text. Summarize the attached documents.";
|
|
@@ -17,9 +18,10 @@ export declare function backfillDocumentOnlyTurn(messages: ChatMessage[]): void;
|
|
|
17
18
|
export declare function backfillImageOnlyTurns(messages: ChatMessage[]): void;
|
|
18
19
|
export declare function unreadableImagesNotice(fileNames: readonly string[]): string;
|
|
19
20
|
export declare function annotateUnreadableImages(unreadable: ReadonlyMap<ChatMessage, string[]>): void;
|
|
20
|
-
export
|
|
21
|
-
retryable?: boolean;
|
|
22
|
-
}
|
|
21
|
+
export interface UnheardAudioNoticeOptions {
|
|
22
|
+
readonly retryable?: boolean;
|
|
23
|
+
}
|
|
24
|
+
export declare function unheardAudioNotice(label: string, reason: string, opts?: UnheardAudioNoticeOptions): string;
|
|
23
25
|
export declare function silentAudioNotice(fileName: string): string;
|
|
24
26
|
export declare function audioTranscriptBlock(fileName: string, transcript: string): string;
|
|
25
27
|
export interface AttachmentRef {
|
|
@@ -3,8 +3,9 @@ export const DOCUMENT_ONLY_USER_PROMPT = 'The user sent one or more documents wi
|
|
|
3
3
|
export const IMAGE_AND_DOCUMENT_USER_PROMPT = 'The user sent one or more images together with one or more documents, and no accompanying text. Describe what the images show and summarize the attached documents.';
|
|
4
4
|
export function backfillDocumentOnlyTurn(messages) {
|
|
5
5
|
const last = messages.findLast((turn) => turn.role === 'user');
|
|
6
|
-
if (!last || last.content.trim())
|
|
6
|
+
if (!last || last.content.trim()) {
|
|
7
7
|
return;
|
|
8
|
+
}
|
|
8
9
|
last.content = last.attachments?.length
|
|
9
10
|
? IMAGE_AND_DOCUMENT_USER_PROMPT
|
|
10
11
|
: DOCUMENT_ONLY_USER_PROMPT;
|
|
@@ -13,8 +14,9 @@ export function backfillImageOnlyTurns(messages) {
|
|
|
13
14
|
for (const turn of messages) {
|
|
14
15
|
if (turn.role !== 'user' || turn.content.trim())
|
|
15
16
|
continue;
|
|
16
|
-
if (turn.attachments?.length)
|
|
17
|
+
if (turn.attachments?.length) {
|
|
17
18
|
turn.content = IMAGE_ONLY_USER_PROMPT;
|
|
19
|
+
}
|
|
18
20
|
}
|
|
19
21
|
}
|
|
20
22
|
export function unreadableImagesNotice(fileNames) {
|
|
@@ -18,4 +18,6 @@ export interface Skill {
|
|
|
18
18
|
export declare function toEngineSkill(skill: Skill): AssistantSkill;
|
|
19
19
|
export declare function toEngineSkillRequirements(requires: SkillRequires): NonNullable<AssistantSkill['requirements']>;
|
|
20
20
|
export declare function toEngineInstallStep(step: InstallStep): NonNullable<AssistantSkill['install']>[number];
|
|
21
|
-
|
|
21
|
+
type EngineSetup = NonNullable<AssistantSkill['setup']>;
|
|
22
|
+
export declare function toEngineSkillSetup(setup: SkillSetup): EngineSetup;
|
|
23
|
+
export {};
|
|
@@ -10,12 +10,12 @@ export function toEngineSkill(skill) {
|
|
|
10
10
|
allowList: [...skill.allowList],
|
|
11
11
|
platforms: [...skill.platform],
|
|
12
12
|
status: skill.status,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
requirements: skill.requires ? toEngineSkillRequirements(skill.requires) : undefined,
|
|
14
|
+
install: skill.install?.map(toEngineInstallStep),
|
|
15
|
+
setup: setup ? toEngineSkillSetup(setup) : undefined,
|
|
16
|
+
stub: skill.stub,
|
|
17
|
+
minCapabilityProfile: skill.minCapabilityProfile,
|
|
18
|
+
emoji: skill.emoji
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
21
|
export function toEngineSkillRequirements(requires) {
|
|
@@ -33,65 +33,55 @@ export function toEngineInstallStep(step) {
|
|
|
33
33
|
id: step.id,
|
|
34
34
|
kind: step.kind,
|
|
35
35
|
label: step.label,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
formula: step.formula,
|
|
37
|
+
command: step.command,
|
|
38
|
+
manual: step.manual,
|
|
39
|
+
bins: step.bins && [...step.bins]
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
42
|
export function toEngineSkillSetup(setup) {
|
|
43
43
|
return {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
...(route.oauth.port !== undefined ? { port: route.oauth.port } : {}),
|
|
87
|
-
...(route.oauth.sharedIosSession !== undefined
|
|
88
|
-
? { sharedIosSession: route.oauth.sharedIosSession }
|
|
89
|
-
: {})
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
: {})
|
|
93
|
-
}))
|
|
94
|
-
}
|
|
95
|
-
: {})
|
|
44
|
+
summary: setup.summary,
|
|
45
|
+
routes: setup.routes?.map(toEngineRoute)
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function toEngineRoute(route) {
|
|
49
|
+
return {
|
|
50
|
+
kind: route.kind,
|
|
51
|
+
label: route.label,
|
|
52
|
+
provider: route.provider,
|
|
53
|
+
credentialKey: route.credentialKey,
|
|
54
|
+
description: route.description,
|
|
55
|
+
helpUrl: route.helpUrl,
|
|
56
|
+
steps: route.steps && [...route.steps],
|
|
57
|
+
configSteps: route.configSteps && [...route.configSteps],
|
|
58
|
+
fields: route.fields?.map((field) => ({
|
|
59
|
+
key: field.key,
|
|
60
|
+
label: field.label,
|
|
61
|
+
placeholder: field.placeholder,
|
|
62
|
+
secret: field.secret,
|
|
63
|
+
required: field.required
|
|
64
|
+
})),
|
|
65
|
+
satisfied: route.satisfied,
|
|
66
|
+
oauth: toEngineOauth(route.oauth)
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
function toEngineOauth(oauth) {
|
|
70
|
+
if (!oauth?.stateKey || !oauth.authUrl || !oauth.tokenUrl)
|
|
71
|
+
return undefined;
|
|
72
|
+
const tokenAuth = TOKEN_AUTH.find((mode) => mode === oauth.tokenAuth);
|
|
73
|
+
if (!tokenAuth) {
|
|
74
|
+
return undefined;
|
|
75
|
+
}
|
|
76
|
+
return {
|
|
77
|
+
stateKey: oauth.stateKey,
|
|
78
|
+
authUrl: oauth.authUrl,
|
|
79
|
+
tokenUrl: oauth.tokenUrl,
|
|
80
|
+
tokenAuth,
|
|
81
|
+
scopes: [...(oauth.scopes ?? [])],
|
|
82
|
+
extraAuthParams: oauth.extraAuthParams,
|
|
83
|
+
registrationEndpoint: oauth.registrationEndpoint,
|
|
84
|
+
port: oauth.port,
|
|
85
|
+
sharedIosSession: oauth.sharedIosSession
|
|
96
86
|
};
|
|
97
87
|
}
|
|
@@ -5,8 +5,10 @@ export class AssistantClient extends Client {
|
|
|
5
5
|
_inline;
|
|
6
6
|
constructor({ sidecar: spawnSidecar = true, storagePath, device, meshSeed, meshKey, bootstrapNodes, entry, ...engineOptions }) {
|
|
7
7
|
const inline = { core: null };
|
|
8
|
-
if (spawnSidecar && !entry)
|
|
8
|
+
if (spawnSidecar && !entry) {
|
|
9
9
|
throw new Error('sidecar mode needs a stowed bundle entry');
|
|
10
|
+
}
|
|
11
|
+
const sidecarEntry = spawnSidecar ? entry : undefined;
|
|
10
12
|
const args = [
|
|
11
13
|
storagePath,
|
|
12
14
|
device?.name ?? '',
|
|
@@ -16,14 +18,15 @@ export class AssistantClient extends Client {
|
|
|
16
18
|
meshKey ? b4a.toHex(meshKey) : '',
|
|
17
19
|
(bootstrapNodes ?? []).map((node) => `${node.host}:${node.port}`).join(',')
|
|
18
20
|
];
|
|
19
|
-
const transport =
|
|
21
|
+
const transport = sidecarEntry
|
|
20
22
|
? async () => {
|
|
21
23
|
const { default: sidecarRunner } = await import('bare-supervisor/runner/sidecar');
|
|
22
|
-
const { ipc, exit } = sidecarRunner(
|
|
24
|
+
const { ipc, exit } = sidecarRunner(sidecarEntry, args, engineOptions.logger ?? null);
|
|
23
25
|
const died = exit.then((code) => `sidecar exited (${code}) before ready`);
|
|
24
26
|
const failure = await Promise.race([ipc.ready.then(() => null), died]);
|
|
25
|
-
if (failure)
|
|
27
|
+
if (failure) {
|
|
26
28
|
throw new Error(failure);
|
|
29
|
+
}
|
|
27
30
|
return ipc;
|
|
28
31
|
}
|
|
29
32
|
: async () => {
|