@qvac/core 0.2.1 → 0.2.2
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/.claude/skills/compaction/SKILL.md +9 -4
- package/.claude/skills/pr-create/SKILL.md +24 -3
- package/.claude/skills/pr-review/SKILL.md +248 -40
- package/CLAUDE.md +1 -3
- package/README.md +3 -1
- package/dist-lib/client.js +1 -1
- package/dist-lib/index.js +8 -8
- package/dist-lib/lib/api/agents.d.ts +1 -1
- package/dist-lib/lib/api/agents.js +10 -9
- package/dist-lib/lib/api/app-config.js +1 -1
- package/dist-lib/lib/api/approval-rules.js +9 -5
- package/dist-lib/lib/api/attachments.js +25 -3
- package/dist-lib/lib/api/chat-groups.d.ts +1 -1
- package/dist-lib/lib/api/chat-groups.js +5 -4
- package/dist-lib/lib/api/chat.js +8 -8
- package/dist-lib/lib/api/chunks.js +11 -11
- package/dist-lib/lib/api/config.js +1 -1
- package/dist-lib/lib/api/custom-models.js +2 -2
- package/dist-lib/lib/api/devices.d.ts +1 -1
- package/dist-lib/lib/api/devices.js +9 -9
- package/dist-lib/lib/api/diagnostics.js +1 -1
- package/dist-lib/lib/api/effective-ctx-size.js +1 -1
- package/dist-lib/lib/api/execution.js +4 -4
- package/dist-lib/lib/api/files.js +2 -2
- package/dist-lib/lib/api/index.d.ts +1 -0
- package/dist-lib/lib/api/index.js +33 -33
- package/dist-lib/lib/api/instrument.js +1 -1
- package/dist-lib/lib/api/knowledge.js +4 -4
- package/dist-lib/lib/api/logs.js +1 -1
- package/dist-lib/lib/api/members.d.ts +4 -1
- package/dist-lib/lib/api/members.js +88 -18
- package/dist-lib/lib/api/mesh.d.ts +13 -3
- package/dist-lib/lib/api/mesh.js +25 -2
- package/dist-lib/lib/api/model-download.js +1 -1
- package/dist-lib/lib/api/network.js +1 -1
- package/dist-lib/lib/api/notifications.js +3 -3
- package/dist-lib/lib/api/rag.js +7 -7
- package/dist-lib/lib/api/sync.js +1 -1
- package/dist-lib/lib/api/tool-activity.js +4 -4
- package/dist-lib/lib/api/tool-configs.js +5 -5
- package/dist-lib/lib/api/watchable.js +1 -1
- package/dist-lib/lib/assistant/fetch-body.d.ts +5 -0
- package/dist-lib/lib/assistant/fetch-body.js +36 -0
- package/dist-lib/lib/assistant/harness.d.ts +225 -0
- package/dist-lib/lib/assistant/harness.js +154 -0
- package/dist-lib/lib/assistant/history.d.ts +32 -0
- package/dist-lib/lib/assistant/history.js +232 -0
- package/dist-lib/lib/assistant/message.d.ts +45 -0
- package/dist-lib/lib/assistant/message.js +47 -0
- package/dist-lib/lib/assistant/skill-encode.d.ts +21 -0
- package/dist-lib/lib/assistant/skill-encode.js +71 -0
- package/dist-lib/lib/assistant-client.js +2 -2
- package/dist-lib/lib/assistant-tree.js +10 -4
- package/dist-lib/lib/assistant.d.ts +25 -285
- package/dist-lib/lib/assistant.js +250 -637
- package/dist-lib/lib/audio-format.js +2 -2
- package/dist-lib/lib/client.js +2 -2
- package/dist-lib/lib/collabora/convert.js +1 -1
- package/dist-lib/lib/collabora/entry.js +1 -1
- package/dist-lib/lib/collabora/worker.js +1 -1
- package/dist-lib/lib/compaction.d.ts +1 -2
- package/dist-lib/lib/compaction.js +8 -6
- package/dist-lib/lib/constants.js +1 -1
- package/dist-lib/lib/core/account-recovery.d.ts +19 -0
- package/dist-lib/lib/core/account-recovery.js +50 -0
- package/dist-lib/lib/core/agent.js +8 -4
- package/dist-lib/lib/core/app-build.d.ts +1 -1
- package/dist-lib/lib/core/approval-rules.d.ts +1 -0
- package/dist-lib/lib/core/approval-rules.js +3 -1
- package/dist-lib/lib/core/archived-mesh.d.ts +25 -0
- package/dist-lib/lib/core/archived-mesh.js +162 -0
- package/dist-lib/lib/core/chat-activity.js +1 -1
- package/dist-lib/lib/core/chat-group.d.ts +1 -0
- package/dist-lib/lib/core/chat-group.js +24 -4
- package/dist-lib/lib/core/chat-search.js +2 -2
- package/dist-lib/lib/core/chat.js +5 -5
- package/dist-lib/lib/core/chunk.d.ts +1 -1
- package/dist-lib/lib/core/chunk.js +4 -4
- package/dist-lib/lib/core/contract/agents.js +1 -1
- package/dist-lib/lib/core/contract/approval-rules.js +6 -4
- 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.js +1 -1
- package/dist-lib/lib/core/contract/chunks.js +2 -2
- package/dist-lib/lib/core/contract/compute.d.ts +11 -0
- package/dist-lib/lib/core/contract/compute.js +45 -0
- package/dist-lib/lib/core/contract/devices.js +16 -3
- package/dist-lib/lib/core/contract/index.d.ts +3 -1
- package/dist-lib/lib/core/contract/index.js +19 -16
- package/dist-lib/lib/core/contract/indexing.js +2 -2
- package/dist-lib/lib/core/contract/joined-meshes.js +1 -1
- package/dist-lib/lib/core/contract/knowledge.js +2 -2
- package/dist-lib/lib/core/contract/members.js +2 -2
- package/dist-lib/lib/core/contract/seal.d.ts +2 -0
- package/dist-lib/lib/core/contract/seal.js +8 -0
- package/dist-lib/lib/core/contract/seed-defaults.js +1 -1
- package/dist-lib/lib/core/contract/tool-activity.js +1 -1
- package/dist-lib/lib/core/contract/tool-configs.js +3 -3
- package/dist-lib/lib/core/contract/writers.js +66 -42
- package/dist-lib/lib/core/departures.js +1 -1
- package/dist-lib/lib/core/device-invites.js +1 -1
- package/dist-lib/lib/core/document-attachment.js +2 -2
- package/dist-lib/lib/core/files/attachments.js +3 -3
- package/dist-lib/lib/core/files/index.d.ts +2 -2
- package/dist-lib/lib/core/files/index.js +19 -19
- package/dist-lib/lib/core/files/knowledge.js +3 -3
- package/dist-lib/lib/core/files/preview/image.js +1 -1
- package/dist-lib/lib/core/files/preview/index.js +6 -6
- package/dist-lib/lib/core/files/processing/claims.js +1 -1
- package/dist-lib/lib/core/files/processing/document.js +5 -5
- package/dist-lib/lib/core/files/processing/index.js +8 -8
- package/dist-lib/lib/core/files/processing/ownership.js +1 -1
- package/dist-lib/lib/core/files/processing/protocol.js +3 -3
- package/dist-lib/lib/core/files/processing/source.js +1 -1
- package/dist-lib/lib/core/files/rag/artifact/codec.js +1 -1
- package/dist-lib/lib/core/files/rag/artifact/id.js +1 -1
- package/dist-lib/lib/core/files/rag/artifact/types.d.ts +4 -4
- package/dist-lib/lib/core/files/rag/build.js +2 -2
- package/dist-lib/lib/core/files/rag/chunk/chunking.js +2 -2
- package/dist-lib/lib/core/files/rag/document-types.d.ts +3 -3
- package/dist-lib/lib/core/files/rag/extract/document-types.d.ts +9 -9
- package/dist-lib/lib/core/files/rag/extract/extract.js +7 -7
- package/dist-lib/lib/core/files/rag/extract/html-text.js +1 -1
- package/dist-lib/lib/core/files/rag/extract/office-collabora.js +2 -2
- package/dist-lib/lib/core/files/rag/extract/pdf-platform.js +1 -1
- package/dist-lib/lib/core/files/rag/extract/pdf-text.js +1 -1
- package/dist-lib/lib/core/files/rag/extract/text-decoding.js +1 -1
- package/dist-lib/lib/core/files/rag/extract/types.d.ts +2 -2
- package/dist-lib/lib/core/files/rag/index.js +22 -22
- package/dist-lib/lib/core/files/rag/load.js +5 -5
- package/dist-lib/lib/core/files/rag/policy.js +2 -2
- package/dist-lib/lib/core/files/rag/produce.js +5 -5
- package/dist-lib/lib/core/files/rag/retrieval/coverage.js +2 -2
- package/dist-lib/lib/core/files/rag/retrieval/diversity.js +1 -1
- package/dist-lib/lib/core/files/rag/retrieval/floor.js +2 -2
- package/dist-lib/lib/core/files/rag/retrieval/format.js +1 -1
- package/dist-lib/lib/core/files/rag/retrieval/full-text.js +18 -11
- package/dist-lib/lib/core/files/rag/retrieval/knowledge.js +5 -5
- package/dist-lib/lib/core/files/rag/retrieval/scoring.js +2 -2
- package/dist-lib/lib/core/files/rag/retrieval/search.js +4 -4
- package/dist-lib/lib/core/files/rag/retrieval/selection.js +2 -2
- package/dist-lib/lib/core/files/rag/retrieval/sources.js +2 -2
- package/dist-lib/lib/core/files/rag/retrieval/terms.js +1 -1
- package/dist-lib/lib/core/files/rag/retrieval/web-sources.js +1 -1
- package/dist-lib/lib/core/files/records/chunks.js +1 -1
- package/dist-lib/lib/core/files/records/index.js +8 -8
- package/dist-lib/lib/core/files/records/knowledge.js +2 -2
- package/dist-lib/lib/core/files/records/output.js +1 -1
- package/dist-lib/lib/core/files/records/reclaim.js +5 -5
- package/dist-lib/lib/core/files/records/routing.js +7 -7
- package/dist-lib/lib/core/files/store/blob.js +2 -2
- package/dist-lib/lib/core/files/store/index.js +7 -7
- package/dist-lib/lib/core/files/store/reference.js +2 -2
- package/dist-lib/lib/core/files/store/server.js +1 -1
- package/dist-lib/lib/core/files/store/sweep.js +1 -1
- package/dist-lib/lib/core/files/upload-input.js +2 -2
- package/dist-lib/lib/core/files/upload.d.ts +1 -1
- package/dist-lib/lib/core/files/upload.js +6 -6
- package/dist-lib/lib/core/harness-loan.d.ts +29 -0
- package/dist-lib/lib/core/harness-loan.js +187 -0
- package/dist-lib/lib/core/helpers/index.d.ts +2 -1
- package/dist-lib/lib/core/helpers/index.js +4 -4
- package/dist-lib/lib/core/hosted-agents.js +2 -2
- package/dist-lib/lib/core/identity.d.ts +2 -0
- package/dist-lib/lib/core/identity.js +4 -2
- package/dist-lib/lib/core/invite.d.ts +1 -0
- package/dist-lib/lib/core/invite.js +4 -2
- package/dist-lib/lib/core/local/index.d.ts +12 -3
- package/dist-lib/lib/core/local/index.js +75 -16
- package/dist-lib/lib/core/membership.d.ts +3 -0
- package/dist-lib/lib/core/membership.js +15 -1
- package/dist-lib/lib/core/mesh-seed-handoff.js +1 -1
- package/dist-lib/lib/core/mesh.d.ts +9 -3
- package/dist-lib/lib/core/mesh.js +41 -26
- package/dist-lib/lib/core/migrations/agent-catalog.js +1 -1
- package/dist-lib/lib/core/migrations/index.js +5 -3
- package/dist-lib/lib/core/migrations/membership.js +2 -2
- package/dist-lib/lib/core/migrations/seal.d.ts +3 -0
- package/dist-lib/lib/core/migrations/seal.js +30 -0
- package/dist-lib/lib/core/next-frame.js +1 -1
- package/dist-lib/lib/core/notification.js +1 -1
- package/dist-lib/lib/core/ota-config.js +1 -1
- package/dist-lib/lib/core/secret-handoff.js +1 -1
- package/dist-lib/lib/core/send.js +3 -3
- package/dist-lib/lib/core/skill-overlay-handoff.js +1 -1
- package/dist-lib/lib/core/skill-overlay-receiver.js +2 -2
- package/dist-lib/lib/core/skill-secrets.js +3 -3
- package/dist-lib/lib/core/sync/devices.js +1 -1
- package/dist-lib/lib/core/sync/index.js +8 -5
- package/dist-lib/lib/core/sync-status.js +1 -1
- package/dist-lib/lib/core/system-info.js +1 -1
- package/dist-lib/lib/core/tool-activity.js +2 -2
- package/dist-lib/lib/core/tool-configs.js +2 -2
- package/dist-lib/lib/core.d.ts +41 -3
- package/dist-lib/lib/core.js +525 -90
- package/dist-lib/lib/credential-pusher.js +4 -4
- package/dist-lib/lib/deadline.js +1 -1
- package/dist-lib/lib/fs-drive-bridge.js +4 -2
- package/dist-lib/lib/integrations/index.js +3 -3
- package/dist-lib/lib/integrations/oauth-providers.js +1 -1
- package/dist-lib/lib/integrations/setup-routes.d.ts +5 -5
- package/dist-lib/lib/integrations/setup-routes.js +3 -3
- package/dist-lib/lib/knowledge-search.js +1 -1
- package/dist-lib/lib/log.js +3 -3
- package/dist-lib/lib/mesh-scoped-engine.d.ts +3 -0
- package/dist-lib/lib/mesh-scoped-engine.js +96 -0
- package/dist-lib/lib/model-context.d.ts +2 -2
- package/dist-lib/lib/model-context.js +1 -1
- package/dist-lib/lib/model-download.js +6 -6
- package/dist-lib/lib/oauth/asana.js +3 -3
- package/dist-lib/lib/oauth/browser-connect.js +1 -1
- package/dist-lib/lib/oauth/client.js +2 -2
- package/dist-lib/lib/oauth/common.d.ts +1 -1
- package/dist-lib/lib/oauth/common.js +1 -1
- package/dist-lib/lib/oauth/flow-core.js +3 -3
- package/dist-lib/lib/oauth/flow.js +2 -2
- package/dist-lib/lib/oauth/google.js +4 -4
- package/dist-lib/lib/oauth/host.js +3 -3
- package/dist-lib/lib/oauth/loopback.js +1 -1
- package/dist-lib/lib/oauth/notion.js +3 -3
- package/dist-lib/lib/oauth/providers.js +1 -1
- package/dist-lib/lib/oauth/resolve.js +1 -1
- package/dist-lib/lib/oauth/spotify.js +3 -3
- package/dist-lib/lib/oauth/token-exchange.js +1 -1
- package/dist-lib/lib/oauth.client.js +2 -2
- package/dist-lib/lib/oauth.js +12 -12
- package/dist-lib/lib/run-notices.d.ts +7 -7
- package/dist-lib/lib/run-transcript.js +1 -1
- package/dist-lib/schema/build.js +12 -6
- package/dist-lib/schema/content.d.ts +11 -11
- package/dist-lib/schema/engine.js +193 -30
- package/dist-lib/schema/field-order.js +2 -2
- package/dist-lib/schema/local.js +18 -4
- package/dist-lib/schema/qvac.js +15 -6
- package/dist-lib/spec/bind.js +41 -0
- package/dist-lib/spec/calls.js +12 -0
- package/dist-lib/spec/capabilities.d.ts +36 -12
- package/dist-lib/spec/hrpc/hrpc.json +161 -5
- package/dist-lib/spec/hrpc/index.js +154 -9
- package/dist-lib/spec/hrpc/messages.js +549 -129
- package/dist-lib/spec/hyperschema/index.js +549 -129
- package/dist-lib/spec/hyperschema/schema.json +370 -40
- package/dist-lib/spec/hyperschema/types.d.ts +85 -1
- package/dist-lib/spec/local/hyperdb/db.json +15 -0
- package/dist-lib/spec/local/hyperdb/index.js +70 -1
- package/dist-lib/spec/local/hyperdb/messages.js +300 -117
- package/dist-lib/spec/local/hyperschema/index.js +97 -4
- package/dist-lib/spec/local/hyperschema/schema.json +58 -1
- package/dist-lib/spec/local/hyperschema/types.d.ts +14 -0
- package/dist-lib/spec/mesh/hyperdb/messages.js +393 -288
- package/dist-lib/spec/mesh/hyperdispatch/dispatch.json +6 -0
- package/dist-lib/spec/mesh/hyperdispatch/index.js +18 -1
- package/dist-lib/spec/mesh/hyperdispatch/messages.js +176 -85
- package/dist-lib/spec/mesh/hyperschema/index.js +176 -85
- package/dist-lib/spec/mesh/hyperschema/schema.json +71 -21
- package/dist-lib/spec/mesh/hyperschema/types.d.ts +14 -1
- package/package.json +15 -9
- package/tui/README.md +7 -0
- package/tui/app.mjs +311 -14
- package/tui/lib/busy-words.mjs +57 -5
- package/tui/lib/export.mjs +1 -0
- package/tui/lib/render.mjs +9 -2
- package/tui/main.mjs +5 -2
package/dist-lib/lib/api/chat.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { AbortController } from 'bare-abort-controller';
|
|
2
|
-
import { createChat, deleteChat, listSidebar, mustGetActiveChatListing, renameChat, setChatRagEnabled, setChatWebSearchEnabled } from
|
|
3
|
-
import { listChatActivity } from
|
|
4
|
-
import { searchChats } from
|
|
5
|
-
import { requireMesh } from
|
|
6
|
-
import { watchable } from
|
|
2
|
+
import { createChat, deleteChat, listSidebar, mustGetActiveChatListing, renameChat, setChatRagEnabled, setChatWebSearchEnabled } from '../core/chat.js';
|
|
3
|
+
import { listChatActivity } from '../core/chat-activity.js';
|
|
4
|
+
import { searchChats } from '../core/chat-search.js';
|
|
5
|
+
import { requireMesh } from './current-mesh.js';
|
|
6
|
+
import { watchable } from './watchable.js';
|
|
7
7
|
const SEARCH_SUPERSEDED_ABORT = 'superseded by a newer chat search';
|
|
8
8
|
export function createChatApi(current, deviceId) {
|
|
9
9
|
let searchAbort = null;
|
|
@@ -12,11 +12,11 @@ export function createChatApi(current, deviceId) {
|
|
|
12
12
|
return {
|
|
13
13
|
createChat: async (input) => createChat(await requireMesh(current), input),
|
|
14
14
|
listChats: async (request) => chatList(await requireMesh(current, request?.meshId)),
|
|
15
|
-
getChat: async ({ id }) => mustGetActiveChatListing(await requireMesh(current), id),
|
|
16
|
-
renameChat: async ({ id, title }) => renameChat(await requireMesh(current), id, title),
|
|
15
|
+
getChat: async ({ id, meshId }) => mustGetActiveChatListing(await requireMesh(current, meshId), id),
|
|
16
|
+
renameChat: async ({ id, title, meshId }) => renameChat(await requireMesh(current, meshId), id, title),
|
|
17
17
|
setChatRagEnabled: async ({ id, enabled }) => setChatRagEnabled(await requireMesh(current), id, enabled ?? false),
|
|
18
18
|
setChatWebSearchEnabled: async ({ id, enabled }) => setChatWebSearchEnabled(await requireMesh(current), id, enabled ?? false),
|
|
19
|
-
deleteChat: async ({ id }) => deleteChat(await requireMesh(current), deviceId, id),
|
|
19
|
+
deleteChat: async ({ id, meshId }) => deleteChat(await requireMesh(current, meshId), deviceId, id),
|
|
20
20
|
chatsWatch: watchable('chatsWatch', (request) => requireMesh(current, request?.meshId), (_request, store) => chatList(store)),
|
|
21
21
|
listChatActivity: async (input) => chatActivity(await requireMesh(current), input?.chatIds),
|
|
22
22
|
chatActivityWatch: watchable('chatActivityWatch', () => requireMesh(current), (request, store) => chatActivity(store, request?.chatIds)),
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { appendChunk, listAttachmentsByKind, listChunks, resolveApproval, updateChunk } from
|
|
2
|
-
import { requireMesh } from
|
|
3
|
-
import { watchable } from
|
|
1
|
+
import { appendChunk, listAttachmentsByKind, listChunks, resolveApproval, updateChunk } from '../core/chunk.js';
|
|
2
|
+
import { requireMesh } from './current-mesh.js';
|
|
3
|
+
import { watchable } from './watchable.js';
|
|
4
4
|
export function createChunksApi(current) {
|
|
5
5
|
return {
|
|
6
|
-
appendChunk: async (input) => appendChunk(await requireMesh(current), input),
|
|
7
|
-
updateChunk: async (input) => {
|
|
8
|
-
await updateChunk(await requireMesh(current), input);
|
|
6
|
+
appendChunk: async ({ meshId, ...input }) => appendChunk(await requireMesh(current, meshId), input),
|
|
7
|
+
updateChunk: async ({ meshId, ...input }) => {
|
|
8
|
+
await updateChunk(await requireMesh(current, meshId), input);
|
|
9
9
|
return { ok: true };
|
|
10
10
|
},
|
|
11
11
|
resolveApproval: async (input) => {
|
|
12
|
-
await resolveApproval(await requireMesh(current), {
|
|
12
|
+
await resolveApproval(await requireMesh(current, input.meshId), {
|
|
13
13
|
id: input.id,
|
|
14
14
|
approved: input.approved === true,
|
|
15
15
|
scope: input.scope ?? undefined,
|
|
@@ -18,8 +18,8 @@ export function createChunksApi(current) {
|
|
|
18
18
|
});
|
|
19
19
|
return { ok: true };
|
|
20
20
|
},
|
|
21
|
-
listChunks: async ({ chatId, type, types, fromSeq, reverse, limit }) => ({
|
|
22
|
-
chunks: await listChunks(await requireMesh(current), {
|
|
21
|
+
listChunks: async ({ chatId, type, types, fromSeq, reverse, limit, meshId }) => ({
|
|
22
|
+
chunks: await listChunks(await requireMesh(current, meshId), {
|
|
23
23
|
chatId,
|
|
24
24
|
type: type ?? undefined,
|
|
25
25
|
types: types ?? undefined,
|
|
@@ -37,7 +37,7 @@ export function createChunksApi(current) {
|
|
|
37
37
|
limit: limit || undefined
|
|
38
38
|
})
|
|
39
39
|
}),
|
|
40
|
-
chunksWatch: watchable('chunksWatch', () => requireMesh(current), async ({ chatId, type, types, fromSeq, reverse, limit }, mesh) => ({
|
|
40
|
+
chunksWatch: watchable('chunksWatch', (request) => requireMesh(current, request?.meshId), async ({ chatId, type, types, fromSeq, reverse, limit }, mesh) => ({
|
|
41
41
|
chunks: await listChunks(mesh, {
|
|
42
42
|
chatId,
|
|
43
43
|
type: type ?? undefined,
|
|
@@ -47,7 +47,7 @@ export function createChunksApi(current) {
|
|
|
47
47
|
limit: limit || undefined
|
|
48
48
|
})
|
|
49
49
|
})),
|
|
50
|
-
runRequestsWatch: watchable('runRequestsWatch', () => requireMesh(current), async (_request, mesh) => {
|
|
50
|
+
runRequestsWatch: watchable('runRequestsWatch', (request) => requireMesh(current, request?.meshId), async (_request, mesh) => {
|
|
51
51
|
const snap = mesh.view.snapshot();
|
|
52
52
|
try {
|
|
53
53
|
const chunks = await snap.find('@qvac/run-requests').toArray();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { watchable } from
|
|
2
|
-
import { normalizeModelSource, probeModelSource } from
|
|
1
|
+
import { watchable } from './watchable.js';
|
|
2
|
+
import { normalizeModelSource, probeModelSource } from '../custom-model-source.js';
|
|
3
3
|
async function readCustomModels(state) {
|
|
4
4
|
const rows = await state.getCustomModelRows();
|
|
5
5
|
return {
|
|
@@ -5,4 +5,4 @@ export declare function createDevicesApi(current: CurrentMesh, deviceId: Buffer,
|
|
|
5
5
|
capabilityProfile: AssistantCapabilityProfile;
|
|
6
6
|
recommendedModelName: string;
|
|
7
7
|
platform?: string;
|
|
8
|
-
} | null): Pick<CapabilityHandlers, 'listDevices' | 'devicesWatch' | 'deviceInfo' | 'saveDeviceCapabilities' | 'saveDeviceProfile' | 'removeDevice' | 'renameDevice'>;
|
|
8
|
+
} | null, computeLender?: (() => Promise<Buffer | null>) | null): Pick<CapabilityHandlers, 'listDevices' | 'devicesWatch' | 'deviceInfo' | 'saveDeviceCapabilities' | 'saveDeviceProfile' | 'removeDevice' | 'renameDevice'>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { saveDeviceCapabilities } from
|
|
2
|
-
import { requireMesh } from
|
|
3
|
-
import { watchable } from
|
|
1
|
+
import { saveDeviceCapabilities } from '../core/devices.js';
|
|
2
|
+
import { requireMesh } from './current-mesh.js';
|
|
3
|
+
import { watchable } from './watchable.js';
|
|
4
4
|
const DEVICES = '@qvac/devices';
|
|
5
5
|
function toEngineDevice(device, overrides = {}) {
|
|
6
6
|
return {
|
|
@@ -24,7 +24,7 @@ function toEngineDevice(device, overrides = {}) {
|
|
|
24
24
|
...overrides
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
|
-
export function createDevicesApi(current, deviceId, removeWriter, renameLocal, saveProfileLocal, readLocalProfile) {
|
|
27
|
+
export function createDevicesApi(current, deviceId, removeWriter, renameLocal, saveProfileLocal, readLocalProfile, computeLender = null) {
|
|
28
28
|
const mustGetDevice = async (mesh, id) => {
|
|
29
29
|
const snap = mesh.view.snapshot();
|
|
30
30
|
try {
|
|
@@ -37,8 +37,7 @@ export function createDevicesApi(current, deviceId, removeWriter, renameLocal, s
|
|
|
37
37
|
await snap.close();
|
|
38
38
|
}
|
|
39
39
|
};
|
|
40
|
-
const list = async () => {
|
|
41
|
-
const mesh = await requireMesh(current);
|
|
40
|
+
const list = async (mesh) => {
|
|
42
41
|
const snap = mesh.view.snapshot();
|
|
43
42
|
try {
|
|
44
43
|
const devices = await snap.find(DEVICES).toArray();
|
|
@@ -49,11 +48,12 @@ export function createDevicesApi(current, deviceId, removeWriter, renameLocal, s
|
|
|
49
48
|
}
|
|
50
49
|
};
|
|
51
50
|
return {
|
|
52
|
-
listDevices: list,
|
|
53
|
-
devicesWatch: watchable('devicesWatch', () => requireMesh(current), list),
|
|
51
|
+
listDevices: async (request) => list(await requireMesh(current, request?.meshId)),
|
|
52
|
+
devicesWatch: watchable('devicesWatch', (request) => requireMesh(current, request?.meshId), (_request, mesh) => list(mesh)),
|
|
54
53
|
deviceInfo: async () => {
|
|
55
54
|
logger.info(['api', 'devices'], 'deviceInfo handler reached');
|
|
56
|
-
|
|
55
|
+
const computeLenderId = (await computeLender?.()) ?? undefined;
|
|
56
|
+
return { id: deviceId, supportsKvCacheDeletion: true, computeLenderId };
|
|
57
57
|
},
|
|
58
58
|
saveDeviceCapabilities: async (input) => {
|
|
59
59
|
await saveDeviceCapabilities(await requireMesh(current), {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defaultContextForModel, MOBILE_CONTEXT_SIZE, MODEL_CONTEXT_TARGET, modelContextTargetForPlatform } from
|
|
1
|
+
import { defaultContextForModel, MOBILE_CONTEXT_SIZE, MODEL_CONTEXT_TARGET, modelContextTargetForPlatform } from '../model-context.js';
|
|
2
2
|
export function effectiveCtxSize(agent, appCtxSize, platform) {
|
|
3
3
|
const configured = agent?.ctxSize || appCtxSize;
|
|
4
4
|
if (configured)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { appendChunk, listChunks } from
|
|
2
|
-
import { randomId } from
|
|
3
|
-
import { parentRequestId, sendMessage } from
|
|
4
|
-
import { requireMesh } from
|
|
1
|
+
import { appendChunk, listChunks } from '../core/chunk.js';
|
|
2
|
+
import { randomId } from '../core/id.js';
|
|
3
|
+
import { parentRequestId, sendMessage } from '../core/send.js';
|
|
4
|
+
import { requireMesh } from './current-mesh.js';
|
|
5
5
|
const TERMINAL_STATES = new Set(['completed', 'failed', 'canceled']);
|
|
6
6
|
export function createExecutionApi(current, deviceId) {
|
|
7
7
|
return {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AbortController } from 'bare-abort-controller';
|
|
2
2
|
import { Readable } from 'streamx';
|
|
3
|
-
import { requireMesh } from
|
|
3
|
+
import { requireMesh } from './current-mesh.js';
|
|
4
4
|
export function createFilesApi(current) {
|
|
5
5
|
return {
|
|
6
6
|
async filePreview(request) {
|
|
@@ -13,7 +13,7 @@ export function createFilesApi(current) {
|
|
|
13
13
|
fileRead(request) {
|
|
14
14
|
const abort = new AbortController();
|
|
15
15
|
async function* read() {
|
|
16
|
-
const mesh = await requireMesh(current);
|
|
16
|
+
const mesh = await requireMesh(current, request.meshId);
|
|
17
17
|
const close = () => stream.destroy();
|
|
18
18
|
mesh.files.once('close', close);
|
|
19
19
|
try {
|
|
@@ -44,6 +44,7 @@ interface ApiDeps {
|
|
|
44
44
|
ragIndex?: (() => VectorIndex | null) | null;
|
|
45
45
|
ragEmbed?: (() => IndexingEmbedder | null) | null;
|
|
46
46
|
platform?: (() => string | null) | null;
|
|
47
|
+
computeLender?: (() => Promise<Buffer | null>) | null;
|
|
47
48
|
pushSkillSecret?: ((request: AssistantPushSkillSecretRequest) => Promise<void>) | null;
|
|
48
49
|
skills?: ((agentId?: string | null, modelName?: string | null, options?: {
|
|
49
50
|
readonly refresh?: boolean;
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import { toAsyncIterable } from
|
|
2
|
-
import { normalizeImageForModel } from
|
|
3
|
-
import { detectImageMime } from
|
|
4
|
-
import { createAgentsApi } from
|
|
5
|
-
import { createApprovalRulesApi } from
|
|
6
|
-
import { createAttachmentsApi } from
|
|
7
|
-
import { createChatApi } from
|
|
8
|
-
import { createChatGroupsApi } from
|
|
9
|
-
import { createChunksApi } from
|
|
10
|
-
import { createAppConfigApi } from
|
|
11
|
-
import { createConfigApi } from
|
|
12
|
-
import { createDevicesApi } from
|
|
13
|
-
import { createDiagnosticsApi } from
|
|
14
|
-
import { createExecutionApi } from
|
|
15
|
-
import { createKnowledgeApi } from
|
|
16
|
-
import { createFilesApi } from
|
|
17
|
-
import { createLogsApi } from
|
|
18
|
-
import { instrument } from
|
|
19
|
-
import { watchable } from
|
|
20
|
-
import { createMembersApi } from
|
|
21
|
-
import { createMeshApi } from
|
|
22
|
-
import { createNetworkApi } from
|
|
23
|
-
import { createNotificationsApi } from
|
|
24
|
-
import { createModelDownloadApi } from
|
|
25
|
-
import { createCustomModelApi } from
|
|
26
|
-
import { createRagApi } from
|
|
27
|
-
import { createSyncApi } from
|
|
28
|
-
import { createToolActivityApi } from
|
|
29
|
-
import { createToolConfigsApi } from
|
|
30
|
-
import { effectiveCtxSize } from
|
|
1
|
+
import { toAsyncIterable } from '../core/async-iterable.js';
|
|
2
|
+
import { normalizeImageForModel } from '../core/image/normalize.js';
|
|
3
|
+
import { detectImageMime } from '../core/image/sniff.js';
|
|
4
|
+
import { createAgentsApi } from './agents.js';
|
|
5
|
+
import { createApprovalRulesApi } from './approval-rules.js';
|
|
6
|
+
import { createAttachmentsApi } from './attachments.js';
|
|
7
|
+
import { createChatApi } from './chat.js';
|
|
8
|
+
import { createChatGroupsApi } from './chat-groups.js';
|
|
9
|
+
import { createChunksApi } from './chunks.js';
|
|
10
|
+
import { createAppConfigApi } from './app-config.js';
|
|
11
|
+
import { createConfigApi } from './config.js';
|
|
12
|
+
import { createDevicesApi } from './devices.js';
|
|
13
|
+
import { createDiagnosticsApi } from './diagnostics.js';
|
|
14
|
+
import { createExecutionApi } from './execution.js';
|
|
15
|
+
import { createKnowledgeApi } from './knowledge.js';
|
|
16
|
+
import { createFilesApi } from './files.js';
|
|
17
|
+
import { createLogsApi } from './logs.js';
|
|
18
|
+
import { instrument } from './instrument.js';
|
|
19
|
+
import { watchable } from './watchable.js';
|
|
20
|
+
import { createMembersApi } from './members.js';
|
|
21
|
+
import { createMeshApi } from './mesh.js';
|
|
22
|
+
import { createNetworkApi } from './network.js';
|
|
23
|
+
import { createNotificationsApi } from './notifications.js';
|
|
24
|
+
import { createModelDownloadApi } from './model-download.js';
|
|
25
|
+
import { createCustomModelApi } from './custom-models.js';
|
|
26
|
+
import { createRagApi } from './rag.js';
|
|
27
|
+
import { createSyncApi } from './sync.js';
|
|
28
|
+
import { createToolActivityApi } from './tool-activity.js';
|
|
29
|
+
import { createToolConfigsApi } from './tool-configs.js';
|
|
30
|
+
import { effectiveCtxSize } from './effective-ctx-size.js';
|
|
31
31
|
export function createApi(deps = {}) {
|
|
32
32
|
const mesh = deps.mesh ?? null;
|
|
33
33
|
const retryModelDownload = deps.retryModelDownload;
|
|
@@ -37,13 +37,13 @@ export function createApi(deps = {}) {
|
|
|
37
37
|
...(state ? createAppConfigApi(state) : null),
|
|
38
38
|
...(state ? createModelDownloadApi(state) : null),
|
|
39
39
|
...(state ? createCustomModelApi(state) : null),
|
|
40
|
-
...(mesh ? createAgentsApi(mesh, deps.deviceId ?? null) : null),
|
|
40
|
+
...(mesh ? createAgentsApi(mesh, deps.deviceId ?? null, deps.computeLender ?? null) : null),
|
|
41
41
|
...(mesh ? createChatApi(mesh, deps.deviceId ?? null) : null),
|
|
42
42
|
...(mesh ? createChatGroupsApi(mesh) : null),
|
|
43
43
|
...(mesh ? createApprovalRulesApi(mesh) : null),
|
|
44
44
|
...(mesh ? createChunksApi(mesh) : null),
|
|
45
45
|
...(mesh && deps.deviceId && deps.deviceHost
|
|
46
|
-
? createDevicesApi(mesh, deps.deviceId, deps.deviceHost.removeWriter, deps.deviceHost.renameLocal, deps.deviceHost.saveProfileLocal, deps.deviceHost.readLocalProfile)
|
|
46
|
+
? createDevicesApi(mesh, deps.deviceId, deps.deviceHost.removeWriter, deps.deviceHost.renameLocal, deps.deviceHost.saveProfileLocal, deps.deviceHost.readLocalProfile, deps.computeLender ?? null)
|
|
47
47
|
: null),
|
|
48
48
|
...(mesh ? createAttachmentsApi(mesh, { deviceId: deps.deviceId }) : null),
|
|
49
49
|
...(mesh ? createKnowledgeApi(mesh, { deviceId: deps.deviceId }) : null),
|
|
@@ -65,7 +65,7 @@ export function createApi(deps = {}) {
|
|
|
65
65
|
})
|
|
66
66
|
: null),
|
|
67
67
|
...(deps.meshStatus ? createMeshApi(deps.meshStatus) : null),
|
|
68
|
-
...(mesh ? createMembersApi(mesh) : null),
|
|
68
|
+
...(mesh ? createMembersApi(mesh, state) : null),
|
|
69
69
|
...(deps.network ? createNetworkApi(deps.network) : null),
|
|
70
70
|
...(deps.diagnostics ? createDiagnosticsApi(deps.diagnostics) : null),
|
|
71
71
|
...(deps.logs ? createLogsApi(deps.logs) : null),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { requireMesh } from
|
|
2
|
-
import { watchable } from
|
|
3
|
-
export { MAX_KNOWLEDGE_BYTES } from
|
|
1
|
+
import { requireMesh } from './current-mesh.js';
|
|
2
|
+
import { watchable } from './watchable.js';
|
|
3
|
+
export { MAX_KNOWLEDGE_BYTES } from '../core/files/knowledge.js';
|
|
4
4
|
export function createKnowledgeApi(current, options = {}) {
|
|
5
5
|
return {
|
|
6
6
|
async *uploadKnowledge(frames) {
|
|
@@ -20,7 +20,7 @@ export function createKnowledgeApi(current, options = {}) {
|
|
|
20
20
|
},
|
|
21
21
|
knowledgeWatch: watchable('knowledgeWatch', () => requireMesh(current), async (request, mesh) => mesh.files.knowledge(options).listKnowledge(request)),
|
|
22
22
|
indexingWatch: watchable('indexingWatch', async () => (await requireMesh(current)).files, ({ chatId }, files) => files.listIndexing(chatId)),
|
|
23
|
-
fileStatusWatch: watchable('fileStatusWatch', async () => (await requireMesh(current)).files, ({ chatId }, files) => files.status(chatId)),
|
|
23
|
+
fileStatusWatch: watchable('fileStatusWatch', async (request) => (await requireMesh(current, request?.meshId)).files, ({ chatId }, files) => files.status(chatId)),
|
|
24
24
|
indexingProgressWatch: watchable('indexingProgressWatch', async () => (await requireMesh(current)).files, ({ chatId }, files) => Promise.resolve({ entries: files.progress(chatId) }))
|
|
25
25
|
};
|
|
26
26
|
}
|
package/dist-lib/lib/api/logs.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import type { openLocalStore } from '../core/local/index.ts';
|
|
1
2
|
import { type CurrentMesh } from './current-mesh.ts';
|
|
2
3
|
import type { CapabilityHandlers } from '../../spec/capabilities.d.ts';
|
|
3
|
-
|
|
4
|
+
type LocalStore = Awaited<ReturnType<typeof openLocalStore>>;
|
|
5
|
+
export declare function createMembersApi(current: CurrentMesh, state?: LocalStore | null): Pick<CapabilityHandlers, 'listMembers' | 'membersWatch' | 'updateMember' | 'removeMember'>;
|
|
6
|
+
export {};
|
|
@@ -1,23 +1,93 @@
|
|
|
1
|
-
import { requireMesh } from
|
|
1
|
+
import { requireMesh } from './current-mesh.js';
|
|
2
|
+
import { watchable } from './watchable.js';
|
|
2
3
|
const MEMBERS = '@qvac/members';
|
|
3
|
-
|
|
4
|
+
const DEVICES = '@qvac/devices';
|
|
5
|
+
const RESOLVE_MEMBER_MS = 10_000;
|
|
6
|
+
async function resolveOurMember(mesh) {
|
|
7
|
+
let timer = null;
|
|
8
|
+
try {
|
|
9
|
+
await Promise.race([
|
|
10
|
+
mesh.refreshOurMember(),
|
|
11
|
+
new Promise((_, reject) => {
|
|
12
|
+
timer = setTimeout(() => reject(new Error('resolving our member in this mesh timed out')), RESOLVE_MEMBER_MS);
|
|
13
|
+
})
|
|
14
|
+
]);
|
|
15
|
+
}
|
|
16
|
+
finally {
|
|
17
|
+
if (timer)
|
|
18
|
+
clearTimeout(timer);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function toEngineMember(member, removed) {
|
|
22
|
+
return { id: member.id, name: member.name, joinedAt: member.joinedAt, removed };
|
|
23
|
+
}
|
|
24
|
+
async function liveMemberIds(snap) {
|
|
25
|
+
const live = new Set();
|
|
26
|
+
for await (const device of snap.find(DEVICES)) {
|
|
27
|
+
const owner = device.revoked ? null : (device.memberId ?? device.claimedMemberId);
|
|
28
|
+
if (owner)
|
|
29
|
+
live.add(owner.toString('hex'));
|
|
30
|
+
}
|
|
31
|
+
return live;
|
|
32
|
+
}
|
|
33
|
+
export function createMembersApi(current, state = null) {
|
|
34
|
+
const mustGetMember = async (reader, id) => {
|
|
35
|
+
const member = await reader.get(MEMBERS, { id });
|
|
36
|
+
if (!member)
|
|
37
|
+
throw new Error(`member not found: ${id.toString('hex')}`);
|
|
38
|
+
return member;
|
|
39
|
+
};
|
|
40
|
+
const list = async (mesh) => {
|
|
41
|
+
const snap = mesh.view.snapshot();
|
|
42
|
+
try {
|
|
43
|
+
const live = await liveMemberIds(snap);
|
|
44
|
+
const members = await snap.find(MEMBERS).toArray();
|
|
45
|
+
return {
|
|
46
|
+
members: members.map((member) => toEngineMember(member, !live.has(member.id.toString('hex'))))
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
finally {
|
|
50
|
+
await snap.close();
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
const readMember = async (mesh, id) => {
|
|
54
|
+
const snap = mesh.view.snapshot();
|
|
55
|
+
try {
|
|
56
|
+
const member = await mustGetMember(snap, id);
|
|
57
|
+
return toEngineMember(member, !(await liveMemberIds(snap)).has(id.toString('hex')));
|
|
58
|
+
}
|
|
59
|
+
finally {
|
|
60
|
+
await snap.close();
|
|
61
|
+
}
|
|
62
|
+
};
|
|
4
63
|
return {
|
|
5
|
-
listMembers: async () =>
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
64
|
+
listMembers: async (request) => list(await requireMesh(current, request?.meshId)),
|
|
65
|
+
membersWatch: watchable('membersWatch', (request) => requireMesh(current, request?.meshId), (_request, mesh) => list(mesh)),
|
|
66
|
+
updateMember: async ({ id, name, meshId }) => {
|
|
67
|
+
const mesh = await requireMesh(current, meshId);
|
|
68
|
+
const trimmed = name.trim();
|
|
69
|
+
if (!trimmed)
|
|
70
|
+
throw new Error('member name must not be empty');
|
|
71
|
+
const member = await mustGetMember(mesh.view, id);
|
|
72
|
+
if (!mesh.ourMemberId)
|
|
73
|
+
await mesh.refreshOurMember();
|
|
74
|
+
if (mesh.ourMemberId?.equals(id))
|
|
75
|
+
await state?.saveDisplayName(trimmed);
|
|
76
|
+
await mesh.dispatch('update-member', {
|
|
77
|
+
member: { ...member, name: trimmed, updatedAt: Date.now() }
|
|
78
|
+
});
|
|
79
|
+
return readMember(mesh, id);
|
|
80
|
+
},
|
|
81
|
+
removeMember: async ({ id, meshId }) => {
|
|
82
|
+
const mesh = await requireMesh(current, meshId);
|
|
83
|
+
if (!mesh.ourMemberId)
|
|
84
|
+
await resolveOurMember(mesh);
|
|
85
|
+
if (!mesh.ourMemberId)
|
|
86
|
+
throw new Error('this device is in no member of this mesh');
|
|
87
|
+
if (mesh.ourMemberId.equals(id))
|
|
88
|
+
throw new Error('cannot remove own member, use leaveMesh');
|
|
89
|
+
await mesh.dispatch('remove-member', { memberId: id, revokedAt: Date.now() });
|
|
90
|
+
return { ok: true };
|
|
21
91
|
}
|
|
22
92
|
};
|
|
23
93
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AssistantMeshList, AssistantMeshStatus } from '../../spec/hyperschema/types.d.ts';
|
|
1
|
+
import type { AssistantArchivedMeshContents, AssistantArchivedMeshList, AssistantArchivedMeshMigration, AssistantMeshList, AssistantMeshStatus } from '../../spec/hyperschema/types.d.ts';
|
|
2
2
|
import type { CapabilityHandlers } from '../../spec/capabilities.d.ts';
|
|
3
3
|
export interface MeshInviteResult {
|
|
4
4
|
readonly invite?: string;
|
|
@@ -19,6 +19,16 @@ export interface MeshStatusSource {
|
|
|
19
19
|
select(meshId: string): Promise<void>;
|
|
20
20
|
close(meshId: string): Promise<void>;
|
|
21
21
|
label(meshId: string, label: string): Promise<void>;
|
|
22
|
-
createRoom(
|
|
22
|
+
createRoom(opts?: {
|
|
23
|
+
compute?: boolean;
|
|
24
|
+
}): Promise<string>;
|
|
25
|
+
listArchived(): Promise<AssistantArchivedMeshList>;
|
|
26
|
+
archivedContents(meshId: string): Promise<AssistantArchivedMeshContents>;
|
|
27
|
+
migrateArchived(meshId: string): Promise<AssistantArchivedMeshMigration>;
|
|
28
|
+
recoverable(): Promise<boolean>;
|
|
29
|
+
publishRecovery(phrase: string): Promise<void>;
|
|
30
|
+
recover(phrase: string, timeout?: number): Promise<void>;
|
|
31
|
+
displayName(): Promise<string | null>;
|
|
32
|
+
setDisplayName(name: string): Promise<void>;
|
|
23
33
|
}
|
|
24
|
-
export declare function createMeshApi(status: MeshStatusSource): Pick<CapabilityHandlers, 'meshStatusWatch' | 'listMeshes' | 'meshesWatch' | 'openMesh' | 'selectMesh' | 'closeMesh' | 'leaveMesh' | 'acknowledgeKicked' | 'joinMesh' | 'cancelMeshJoin' | 'meshInvite' | 'setMeshLabel' | 'createRoom'>;
|
|
34
|
+
export declare function createMeshApi(status: MeshStatusSource): Pick<CapabilityHandlers, 'meshStatusWatch' | 'listMeshes' | 'meshesWatch' | 'openMesh' | 'selectMesh' | 'closeMesh' | 'leaveMesh' | 'acknowledgeKicked' | 'joinMesh' | 'cancelMeshJoin' | 'meshInvite' | 'setMeshLabel' | 'createRoom' | 'listArchivedMeshes' | 'archivedMeshContents' | 'migrateArchivedMesh' | 'accountRecoverable' | 'recoveryPublish' | 'recoverAccount' | 'displayName' | 'setDisplayName'>;
|
package/dist-lib/lib/api/mesh.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { watchable } from
|
|
1
|
+
import { watchable } from './watchable.js';
|
|
2
2
|
export function createMeshApi(status) {
|
|
3
3
|
return {
|
|
4
4
|
meshStatusWatch: watchable('meshStatusWatch', () => status, async () => status.snapshot()),
|
|
@@ -37,6 +37,29 @@ export function createMeshApi(status) {
|
|
|
37
37
|
await status.label(meshId, label ?? '');
|
|
38
38
|
return { ok: true };
|
|
39
39
|
},
|
|
40
|
-
createRoom: async () => ({
|
|
40
|
+
createRoom: async (request) => ({
|
|
41
|
+
meshId: await status.createRoom({ compute: request?.compute })
|
|
42
|
+
}),
|
|
43
|
+
listArchivedMeshes: () => status.listArchived(),
|
|
44
|
+
archivedMeshContents: ({ meshId }) => status.archivedContents(meshId),
|
|
45
|
+
migrateArchivedMesh: ({ meshId }) => status.migrateArchived(meshId),
|
|
46
|
+
accountRecoverable: async () => ({
|
|
47
|
+
recoverable: await status.recoverable()
|
|
48
|
+
}),
|
|
49
|
+
recoveryPublish: async ({ phrase }) => {
|
|
50
|
+
await status.publishRecovery(phrase);
|
|
51
|
+
return { recoverable: await status.recoverable() };
|
|
52
|
+
},
|
|
53
|
+
recoverAccount: async ({ phrase, timeout }) => {
|
|
54
|
+
await status.recover(phrase, timeout || undefined);
|
|
55
|
+
return { ok: true };
|
|
56
|
+
},
|
|
57
|
+
displayName: async () => ({
|
|
58
|
+
name: await status.displayName()
|
|
59
|
+
}),
|
|
60
|
+
setDisplayName: async ({ name }) => {
|
|
61
|
+
await status.setDisplayName(name ?? '');
|
|
62
|
+
return { ok: true };
|
|
63
|
+
}
|
|
41
64
|
};
|
|
42
65
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { deriveNotifications } from
|
|
2
|
-
import { requireMesh } from
|
|
3
|
-
import { watchable } from
|
|
1
|
+
import { deriveNotifications } from '../core/notification.js';
|
|
2
|
+
import { requireMesh } from './current-mesh.js';
|
|
3
|
+
import { watchable } from './watchable.js';
|
|
4
4
|
export function createNotificationsApi(current, local, options = {}) {
|
|
5
5
|
return {
|
|
6
6
|
notificationsWatch: watchable('notificationsWatch', () => notificationSource(current, local, options), (request) => notificationSnapshot(current, local, request?.limit, options.deviceId)),
|
package/dist-lib/lib/api/rag.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import '../logger.js';
|
|
2
2
|
import { toolsetEnabled } from '@qvac/harness/lib/tools/toolsets.ts';
|
|
3
|
-
import { getAgent } from
|
|
4
|
-
import { getChat } from
|
|
5
|
-
import { isKnowledgeRoutedAttachment, fullTextBudgetChars, fullTextHits, retrieveRagKnowledge, searchRagChunks, referencesPendingFile, referencedDocuments } from
|
|
6
|
-
import { requireMesh } from
|
|
3
|
+
import { getAgent } from '../core/agent.js';
|
|
4
|
+
import { getChat } from '../core/chat.js';
|
|
5
|
+
import { isKnowledgeRoutedAttachment, fullTextBudgetChars, fullTextHits, retrieveRagKnowledge, searchRagChunks, referencesPendingFile, referencedDocuments } from '../core/files/index.js';
|
|
6
|
+
import { requireMesh } from './current-mesh.js';
|
|
7
7
|
export const MAX_RAG_SEARCH_LIMIT = 20;
|
|
8
8
|
const DEFAULT_RAG_SEARCH_LIMIT = 5;
|
|
9
9
|
function clampLimit(limit) {
|
|
@@ -13,10 +13,10 @@ function clampLimit(limit) {
|
|
|
13
13
|
}
|
|
14
14
|
export function createRagApi(current, index, embedder, effectiveCtxSize = null) {
|
|
15
15
|
return {
|
|
16
|
-
ragSearch: async ({ chatId, query, mode, limit, attachmentIds }) => {
|
|
16
|
+
ragSearch: async ({ chatId, query, mode, limit, attachmentIds, meshId }) => {
|
|
17
17
|
let pendingFiles = [];
|
|
18
18
|
const respond = (overrides) => response({ pendingFiles, ...overrides });
|
|
19
|
-
const mesh = await requireMesh(current);
|
|
19
|
+
const mesh = await requireMesh(current, meshId);
|
|
20
20
|
const chat = await getChat(mesh, chatId);
|
|
21
21
|
const toolMode = mode === 'tool';
|
|
22
22
|
if (!chat)
|
package/dist-lib/lib/api/sync.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { watchable } from
|
|
1
|
+
import { watchable } from './watchable.js';
|
|
2
2
|
export function createSyncApi(current) {
|
|
3
3
|
return {
|
|
4
4
|
syncStatusWatch: watchable('syncStatusWatch', async () => (await current())?.syncActivity ?? null, (_request, activity) => activity.snapshot())
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { listToolActivity, recordToolActivity } from
|
|
2
|
-
import { requireMesh } from
|
|
3
|
-
import { watchable } from
|
|
1
|
+
import { listToolActivity, recordToolActivity } from '../core/tool-activity.js';
|
|
2
|
+
import { requireMesh } from './current-mesh.js';
|
|
3
|
+
import { watchable } from './watchable.js';
|
|
4
4
|
const DEFAULT_LIMIT = 200;
|
|
5
5
|
const MAX_LIMIT = 1000;
|
|
6
6
|
const DECISIONS = new Set(['auto', 'allowed', 'denied', 'skip-all', 'blocked']);
|
|
@@ -36,7 +36,7 @@ export function createToolActivityApi(current, deviceId) {
|
|
|
36
36
|
recordToolActivity: async (request) => {
|
|
37
37
|
if (!deviceId)
|
|
38
38
|
throw new Error('cannot record tool activity without a device id');
|
|
39
|
-
return recordToolActivity(await requireMesh(current), {
|
|
39
|
+
return recordToolActivity(await requireMesh(current, request.meshId), {
|
|
40
40
|
agentId: request.agentId,
|
|
41
41
|
originDeviceId: deviceId,
|
|
42
42
|
toolName: request.toolName,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { deleteToolConfigs, getToolConfigs, listToolConfigs, setToolConfigs } from
|
|
2
|
-
import { requireMesh } from
|
|
3
|
-
import { watchable } from
|
|
1
|
+
import { deleteToolConfigs, getToolConfigs, listToolConfigs, setToolConfigs } from '../core/tool-configs.js';
|
|
2
|
+
import { requireMesh } from './current-mesh.js';
|
|
3
|
+
import { watchable } from './watchable.js';
|
|
4
4
|
function isRecord(value) {
|
|
5
5
|
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
6
6
|
}
|
|
@@ -20,8 +20,8 @@ export function createToolConfigsApi(current) {
|
|
|
20
20
|
settings: ensureSettingsPayload(settings)
|
|
21
21
|
}),
|
|
22
22
|
deleteToolConfigs: async ({ agentId, toolName }) => deleteToolConfigs(await requireMesh(current), agentId, toolName),
|
|
23
|
-
listToolConfigs: async (request) => query(request, await requireMesh(current)),
|
|
24
|
-
toolConfigsWatch: watchable('toolConfigsWatch', () => requireMesh(current), query)
|
|
23
|
+
listToolConfigs: async (request) => query(request, await requireMesh(current, request.meshId)),
|
|
24
|
+
toolConfigsWatch: watchable('toolConfigsWatch', (request) => requireMesh(current, request?.meshId), query)
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
27
|
export { getToolConfigs };
|