@qvac/core 1.0.0-rc.5 → 1.0.0-rc.7
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 +43 -2
- package/README.md +55 -4
- package/dist-lib/lib/api/agents.d.ts +2 -1
- package/dist-lib/lib/api/agents.js +10 -3
- package/dist-lib/lib/api/app-config.d.ts +3 -0
- package/dist-lib/lib/api/app-config.js +20 -0
- package/dist-lib/lib/api/approval-rules.js +8 -5
- package/dist-lib/lib/api/chat.d.ts +1 -2
- package/dist-lib/lib/api/chat.js +4 -18
- package/dist-lib/lib/api/device-routes.d.ts +1 -1
- package/dist-lib/lib/api/device-routes.js +3 -1
- package/dist-lib/lib/api/index.d.ts +0 -1
- package/dist-lib/lib/api/index.js +3 -3
- package/dist-lib/lib/api/mesh.d.ts +1 -1
- package/dist-lib/lib/api/mesh.js +1 -1
- package/dist-lib/lib/api/projects.js +3 -4
- package/dist-lib/lib/api/served.d.ts +2 -2
- package/dist-lib/lib/api/served.js +24 -1
- package/dist-lib/lib/api/sync.js +12 -2
- package/dist-lib/lib/assistant/harness.d.ts +3 -0
- package/dist-lib/lib/assistant/history.js +14 -2
- package/dist-lib/lib/assistant/message.d.ts +1 -0
- package/dist-lib/lib/assistant/model-round.d.ts +3 -0
- package/dist-lib/lib/assistant/model-round.js +16 -2
- package/dist-lib/lib/assistant/round-host.d.ts +2 -0
- package/dist-lib/lib/assistant/round-host.js +8 -0
- package/dist-lib/lib/assistant-tree.d.ts +2 -0
- package/dist-lib/lib/assistant-tree.js +4 -2
- package/dist-lib/lib/assistant.d.ts +11 -2
- package/dist-lib/lib/assistant.js +124 -20
- package/dist-lib/lib/client.js +4 -1
- package/dist-lib/lib/core/agent-copies.js +2 -1
- package/dist-lib/lib/core/agent-hosting.js +9 -4
- package/dist-lib/lib/core/agent.js +2 -1
- package/dist-lib/lib/core/archived-mesh.d.ts +1 -0
- package/dist-lib/lib/core/archived-mesh.js +11 -14
- package/dist-lib/lib/core/chat-copy.d.ts +1 -1
- package/dist-lib/lib/core/chat-copy.js +14 -4
- package/dist-lib/lib/core/chat-move.d.ts +3 -1
- package/dist-lib/lib/core/chat-move.js +5 -2
- package/dist-lib/lib/core/chat.d.ts +0 -1
- package/dist-lib/lib/core/chat.js +0 -3
- package/dist-lib/lib/core/collections.d.ts +7 -7
- package/dist-lib/lib/core/collections.js +7 -7
- package/dist-lib/lib/core/contract/joined-meshes.js +2 -1
- package/dist-lib/lib/core/contract/project-device-keys.d.ts +4 -2
- package/dist-lib/lib/core/contract/project-device-keys.js +12 -12
- package/dist-lib/lib/core/contract/project-host-keys.d.ts +5 -3
- package/dist-lib/lib/core/contract/project-host-keys.js +22 -11
- package/dist-lib/lib/core/contract/projects.d.ts +4 -2
- package/dist-lib/lib/core/contract/projects.js +29 -17
- package/dist-lib/lib/core/deleted-agent-runs.d.ts +1 -0
- package/dist-lib/lib/core/deleted-agent-runs.js +22 -11
- package/dist-lib/lib/core/helpers/index.d.ts +1 -1
- package/dist-lib/lib/core/helpers/index.js +2 -2
- package/dist-lib/lib/core/local/index.d.ts +2 -1
- package/dist-lib/lib/core/local/index.js +3 -2
- package/dist-lib/lib/core/mesh.d.ts +1 -0
- package/dist-lib/lib/core/mesh.js +4 -4
- package/dist-lib/lib/core/project-keys.d.ts +5 -2
- package/dist-lib/lib/core/project-keys.js +15 -6
- package/dist-lib/lib/core/public-mesh.d.ts +6 -8
- package/dist-lib/lib/core/public-mesh.js +19 -29
- package/dist-lib/lib/core/sync/index.js +6 -6
- package/dist-lib/lib/core.d.ts +17 -8
- package/dist-lib/lib/core.js +317 -224
- package/dist-lib/lib/errors.d.ts +4 -12
- package/dist-lib/lib/errors.js +4 -12
- package/dist-lib/lib/kv-cache-ledger.d.ts +22 -0
- package/dist-lib/lib/kv-cache-ledger.js +72 -0
- package/dist-lib/lib/kv-cache-retention.d.ts +1 -0
- package/dist-lib/lib/kv-cache-retention.js +5 -2
- package/dist-lib/lib/model-memory-cap.d.ts +3 -0
- package/dist-lib/lib/model-memory-cap.js +15 -6
- package/dist-lib/lib/run-replay.d.ts +3 -2
- package/dist-lib/lib/run-replay.js +16 -5
- package/dist-lib/lib/run-transcript.js +1 -1
- package/dist-lib/schema/engine.js +64 -4
- package/dist-lib/schema/local.js +4 -2
- package/dist-lib/schema/qvac.js +64 -2
- package/dist-lib/spec/bind.js +3 -0
- package/dist-lib/spec/calls.js +1 -0
- package/dist-lib/spec/capabilities.d.ts +4 -2
- package/dist-lib/spec/hrpc/hrpc.json +14 -1
- package/dist-lib/spec/hrpc/index.js +16 -4
- package/dist-lib/spec/hrpc/messages.js +508 -235
- package/dist-lib/spec/hyperschema/index.js +508 -235
- package/dist-lib/spec/hyperschema/schema.json +214 -6
- package/dist-lib/spec/hyperschema/types.d.ts +40 -1
- package/dist-lib/spec/local/hyperdb/messages.js +26 -12
- package/dist-lib/spec/local/hyperschema/index.js +13 -6
- package/dist-lib/spec/local/hyperschema/schema.json +10 -0
- package/dist-lib/spec/local/hyperschema/types.d.ts +2 -0
- package/dist-lib/spec/mesh/hyperdb/db.json +110 -0
- package/dist-lib/spec/mesh/hyperdb/index.js +498 -2
- package/dist-lib/spec/mesh/hyperdb/messages.js +895 -416
- package/dist-lib/spec/mesh/hyperdispatch/messages.js +259 -6
- package/dist-lib/spec/mesh/hyperschema/index.js +259 -6
- package/dist-lib/spec/mesh/hyperschema/schema.json +160 -0
- package/dist-lib/spec/mesh/hyperschema/types.d.ts +38 -0
- package/package.json +27 -11
- package/tui/README.md +190 -0
- package/tui/app.mjs +8282 -0
- package/tui/boot.mjs +159 -0
- package/tui/index.mjs +89 -0
- package/tui/lib/boot-timing.mjs +41 -0
- package/tui/lib/busy-words.mjs +116 -0
- package/tui/lib/connect-sheet.mjs +350 -0
- package/tui/lib/device-target.mjs +64 -0
- package/tui/lib/export.mjs +194 -0
- package/tui/lib/folders-command.mjs +84 -0
- package/tui/lib/fork-command.mjs +43 -0
- package/tui/lib/knowledge-command.mjs +190 -0
- package/tui/lib/knowledge-import.mjs +153 -0
- package/tui/lib/local-path.mjs +21 -0
- package/tui/lib/move-command.mjs +17 -0
- package/tui/lib/render.mjs +225 -0
- package/tui/lib/save-file.mjs +88 -0
- package/tui/lib/select.mjs +81 -0
- package/tui/lib/selection.mjs +18 -0
- package/tui/lib/setup.mjs +135 -0
- package/tui/lib/sidebar.mjs +63 -0
- package/tui/lib/skill-connect.mjs +145 -0
- package/tui/lib/splash-art.mjs +107 -0
- package/tui/lib/splash.mjs +18 -0
- package/tui/lib/upload-frames.mjs +9 -0
- package/tui/lib/usage.mjs +59 -0
- package/tui/lib/wrap.mjs +143 -0
- package/tui/main.mjs +279 -0
- package/tui/plugins.mjs +158 -0
- package/worker/assistant-sidecar.mjs +1 -0
package/dist-lib/lib/errors.d.ts
CHANGED
|
@@ -131,18 +131,14 @@ declare const DEFINITIONS: {
|
|
|
131
131
|
readonly code: 100127;
|
|
132
132
|
readonly message: (max: number) => string;
|
|
133
133
|
};
|
|
134
|
-
readonly OWN_WORKSPACE_INVITE_REFUSED: {
|
|
135
|
-
readonly code: 100128;
|
|
136
|
-
readonly message: () => string;
|
|
137
|
-
};
|
|
138
|
-
readonly OWN_WORKSPACE_LEAVE_REFUSED: {
|
|
139
|
-
readonly code: 100129;
|
|
140
|
-
readonly message: () => string;
|
|
141
|
-
};
|
|
142
134
|
readonly COMPUTE_MESH_RETIRED: {
|
|
143
135
|
readonly code: 100130;
|
|
144
136
|
readonly message: () => string;
|
|
145
137
|
};
|
|
138
|
+
readonly ROUTE_NEEDS_WORKSPACE: {
|
|
139
|
+
readonly code: 100131;
|
|
140
|
+
readonly message: (route: string) => string;
|
|
141
|
+
};
|
|
146
142
|
readonly INVITE_INVALID: {
|
|
147
143
|
readonly code: 100201;
|
|
148
144
|
readonly message: () => string;
|
|
@@ -487,10 +483,6 @@ declare const DEFINITIONS: {
|
|
|
487
483
|
readonly code: 100726;
|
|
488
484
|
readonly message: (chunkId: string) => string;
|
|
489
485
|
};
|
|
490
|
-
readonly CHAT_PROJECT_OTHER_WORKSPACE: {
|
|
491
|
-
readonly code: 100727;
|
|
492
|
-
readonly message: () => string;
|
|
493
|
-
};
|
|
494
486
|
readonly CHAT_AGENT_SWITCH_NO_DEVICE: {
|
|
495
487
|
readonly code: 100728;
|
|
496
488
|
readonly message: () => string;
|
package/dist-lib/lib/errors.js
CHANGED
|
@@ -105,18 +105,14 @@ const DEFINITIONS = {
|
|
|
105
105
|
code: 100127,
|
|
106
106
|
message: (max) => `A project order holds at most ${max} projects`
|
|
107
107
|
},
|
|
108
|
-
OWN_WORKSPACE_INVITE_REFUSED: {
|
|
109
|
-
code: 100128,
|
|
110
|
-
message: () => 'Your own workspace is yours alone: invite people into another workspace'
|
|
111
|
-
},
|
|
112
|
-
OWN_WORKSPACE_LEAVE_REFUSED: {
|
|
113
|
-
code: 100129,
|
|
114
|
-
message: () => 'Your own workspace cannot be left'
|
|
115
|
-
},
|
|
116
108
|
COMPUTE_MESH_RETIRED: {
|
|
117
109
|
code: 100130,
|
|
118
110
|
message: () => 'Compute meshes are retired: a model runs on the device that asks'
|
|
119
111
|
},
|
|
112
|
+
ROUTE_NEEDS_WORKSPACE: {
|
|
113
|
+
code: 100131,
|
|
114
|
+
message: (route) => `${route} reads and writes a workspace: name a workspace's meshId, not the account's`
|
|
115
|
+
},
|
|
120
116
|
INVITE_INVALID: { code: 100201, message: () => 'Invalid mesh invite' },
|
|
121
117
|
MESH_JOIN_CANCELED: { code: 100202, message: () => 'Mesh join canceled' },
|
|
122
118
|
JOIN_NOT_PERMITTED: {
|
|
@@ -401,10 +397,6 @@ const DEFINITIONS = {
|
|
|
401
397
|
code: 100726,
|
|
402
398
|
message: (chunkId) => `model-request ${chunkId} has already ended`
|
|
403
399
|
},
|
|
404
|
-
CHAT_PROJECT_OTHER_WORKSPACE: {
|
|
405
|
-
code: 100727,
|
|
406
|
-
message: () => "a chat links only projects of its own workspace: start one in the project's"
|
|
407
|
-
},
|
|
408
400
|
CHAT_AGENT_SWITCH_NO_DEVICE: {
|
|
409
401
|
code: 100728,
|
|
410
402
|
message: () => "this device has no identity yet, so it cannot switch a chat's agent"
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface LedgerEntry {
|
|
2
|
+
readonly chatId: string;
|
|
3
|
+
readonly meshId: string;
|
|
4
|
+
readonly served?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export interface KnownChats {
|
|
7
|
+
readonly live: ReadonlySet<string>;
|
|
8
|
+
readonly read: ReadonlySet<string>;
|
|
9
|
+
readonly closed: ReadonlySet<string>;
|
|
10
|
+
readonly gone: ReadonlySet<string>;
|
|
11
|
+
}
|
|
12
|
+
export declare function orphanedChats(entries: ReadonlyArray<LedgerEntry>, { live, read, closed, gone }: KnownChats): string[];
|
|
13
|
+
export declare class KvCacheLedger {
|
|
14
|
+
private readonly _dir;
|
|
15
|
+
private readonly _recorded;
|
|
16
|
+
constructor(dir: string);
|
|
17
|
+
record({ chatId, meshId, served }: LedgerEntry): Promise<void>;
|
|
18
|
+
forget(chatId: string): Promise<void>;
|
|
19
|
+
clear(): Promise<void>;
|
|
20
|
+
entries(): Promise<LedgerEntry[]>;
|
|
21
|
+
private _file;
|
|
22
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import { join } from 'path';
|
|
3
|
+
import { isRecord, safeName } from './guards.js';
|
|
4
|
+
export function orphanedChats(entries, { live, read, closed, gone }) {
|
|
5
|
+
return entries
|
|
6
|
+
.filter(({ chatId, meshId, served }) => {
|
|
7
|
+
if (live.has(chatId) || closed.has(meshId))
|
|
8
|
+
return false;
|
|
9
|
+
return !served || read.has(meshId) || gone.has(meshId);
|
|
10
|
+
})
|
|
11
|
+
.map(({ chatId }) => chatId);
|
|
12
|
+
}
|
|
13
|
+
export class KvCacheLedger {
|
|
14
|
+
_dir;
|
|
15
|
+
_recorded = new Map();
|
|
16
|
+
constructor(dir) {
|
|
17
|
+
this._dir = dir;
|
|
18
|
+
}
|
|
19
|
+
async record({ chatId, meshId, served = false }) {
|
|
20
|
+
const held = `${meshId}/${served}`;
|
|
21
|
+
if (this._recorded.get(chatId) === held) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
await fs.promises.mkdir(this._dir, { recursive: true });
|
|
25
|
+
await fs.promises.writeFile(this._file(chatId), JSON.stringify({ chatId, meshId, served }));
|
|
26
|
+
this._recorded.set(chatId, held);
|
|
27
|
+
}
|
|
28
|
+
async forget(chatId) {
|
|
29
|
+
this._recorded.delete(chatId);
|
|
30
|
+
await fs.promises.rm(this._file(chatId), { force: true });
|
|
31
|
+
}
|
|
32
|
+
async clear() {
|
|
33
|
+
this._recorded.clear();
|
|
34
|
+
await fs.promises.rm(this._dir, { recursive: true, force: true });
|
|
35
|
+
}
|
|
36
|
+
async entries() {
|
|
37
|
+
let names;
|
|
38
|
+
try {
|
|
39
|
+
names = await fs.promises.readdir(this._dir);
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
return [];
|
|
43
|
+
}
|
|
44
|
+
const entries = [];
|
|
45
|
+
for (const name of names) {
|
|
46
|
+
if (!name.endsWith('.json'))
|
|
47
|
+
continue;
|
|
48
|
+
const parsed = await readJson(join(this._dir, name));
|
|
49
|
+
if (isRecord(parsed) &&
|
|
50
|
+
typeof parsed.chatId === 'string' &&
|
|
51
|
+
typeof parsed.meshId === 'string') {
|
|
52
|
+
entries.push({
|
|
53
|
+
chatId: parsed.chatId,
|
|
54
|
+
meshId: parsed.meshId,
|
|
55
|
+
served: parsed.served === true
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return entries;
|
|
60
|
+
}
|
|
61
|
+
_file(chatId) {
|
|
62
|
+
return join(this._dir, `${safeName(chatId)}.json`);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
async function readJson(file) {
|
|
66
|
+
try {
|
|
67
|
+
return JSON.parse(await fs.promises.readFile(file, 'utf8'));
|
|
68
|
+
}
|
|
69
|
+
catch {
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -64,9 +64,12 @@ export class KvCacheRetention {
|
|
|
64
64
|
}
|
|
65
65
|
this._timer = null;
|
|
66
66
|
}
|
|
67
|
-
async
|
|
67
|
+
async retentionMs() {
|
|
68
68
|
const retention = await this._engine.configGet({ key: KV_CACHE_RETENTION_KEY });
|
|
69
|
-
|
|
69
|
+
return kvCacheRetentionMs(retention.value, this._opts.defaultMs);
|
|
70
|
+
}
|
|
71
|
+
async _sweep(meshId) {
|
|
72
|
+
const retentionMs = await this.retentionMs();
|
|
70
73
|
if (retentionMs === null || !this._opts.active()) {
|
|
71
74
|
return;
|
|
72
75
|
}
|
|
@@ -8,6 +8,9 @@ export interface ModelMemorySummary {
|
|
|
8
8
|
readonly usableBytes: number;
|
|
9
9
|
readonly capPercent: number;
|
|
10
10
|
readonly capBytes: number;
|
|
11
|
+
readonly totalBytes?: number;
|
|
12
|
+
readonly source?: string;
|
|
13
|
+
readonly gpuClass?: string;
|
|
11
14
|
}
|
|
12
15
|
export interface ModelMemoryUse extends ModelMemorySummary {
|
|
13
16
|
readonly usedBytes: number;
|
|
@@ -5,14 +5,14 @@ export function startModelMemoryCap(harness, state, { logger, onPushed } = {}) {
|
|
|
5
5
|
const lock = new ScopeLock({ debounce: true });
|
|
6
6
|
let disposed = false;
|
|
7
7
|
let pushed = null;
|
|
8
|
-
let
|
|
8
|
+
let budget = null;
|
|
9
9
|
const push = async () => {
|
|
10
10
|
const percent = memoryCapPercent(await state.get(MODEL_MEMORY_CAP_KEY));
|
|
11
11
|
if (disposed || percent === pushed || !harness.setModelMemoryCap) {
|
|
12
12
|
return;
|
|
13
13
|
}
|
|
14
14
|
await harness.setModelMemoryCap(percent === MODEL_MEMORY_CAP_MIN ? 0 : percent);
|
|
15
|
-
|
|
15
|
+
budget ??= (await harness.capability?.())?.memoryBudget ?? null;
|
|
16
16
|
pushed = percent;
|
|
17
17
|
onPushed?.();
|
|
18
18
|
};
|
|
@@ -35,16 +35,15 @@ export function startModelMemoryCap(harness, state, { logger, onPushed } = {}) {
|
|
|
35
35
|
return {
|
|
36
36
|
summary: async () => {
|
|
37
37
|
const capPercent = pushed;
|
|
38
|
-
|
|
39
|
-
if (capPercent === null || usable === null || !harness.memoryUsage) {
|
|
38
|
+
if (capPercent === null || budget === null || !harness.memoryUsage) {
|
|
40
39
|
return null;
|
|
41
40
|
}
|
|
42
41
|
const usage = await harness.memoryUsage().catch((err) => {
|
|
43
42
|
logger?.warn('model-memory-cap', 'usage read failed', errorMessage(err));
|
|
44
43
|
return null;
|
|
45
44
|
});
|
|
46
|
-
const capBytes = Math.round((capPercent / 100) *
|
|
47
|
-
return usage && withUsage(
|
|
45
|
+
const capBytes = Math.round((capPercent / 100) * budget.availableBytes);
|
|
46
|
+
return usage && withUsage(capSummary(budget, capPercent, capBytes), usage.usedBytes);
|
|
48
47
|
},
|
|
49
48
|
stop: async () => {
|
|
50
49
|
disposed = true;
|
|
@@ -54,6 +53,16 @@ export function startModelMemoryCap(harness, state, { logger, onPushed } = {}) {
|
|
|
54
53
|
}
|
|
55
54
|
};
|
|
56
55
|
}
|
|
56
|
+
function capSummary({ availableBytes, totalBytes, source, gpuClass }, capPercent, capBytes) {
|
|
57
|
+
return {
|
|
58
|
+
usableBytes: availableBytes,
|
|
59
|
+
capPercent,
|
|
60
|
+
capBytes,
|
|
61
|
+
totalBytes,
|
|
62
|
+
source,
|
|
63
|
+
gpuClass
|
|
64
|
+
};
|
|
65
|
+
}
|
|
57
66
|
export function withUsage(cap, usedBytes) {
|
|
58
67
|
return {
|
|
59
68
|
...cap,
|
|
@@ -33,12 +33,13 @@ export declare class RunReplayStore {
|
|
|
33
33
|
private _chatDir;
|
|
34
34
|
private _holders;
|
|
35
35
|
}
|
|
36
|
+
export type ImageIdOf = (file: string) => string | undefined;
|
|
36
37
|
export interface SentRunTracker {
|
|
37
38
|
readonly used: boolean;
|
|
38
39
|
readonly onKey: boolean;
|
|
39
40
|
observe(call: Record<string, unknown>): void;
|
|
40
41
|
turns(inputLength: number): ChatMessage[] | null;
|
|
41
42
|
}
|
|
42
|
-
export declare function trackSentRun(cacheKey: string | undefined): SentRunTracker;
|
|
43
|
-
export declare function appendedTurns(sent: unknown, inputLength: number): ChatMessage[] | null;
|
|
43
|
+
export declare function trackSentRun(cacheKey: string | undefined, imageIdOf?: ImageIdOf): SentRunTracker;
|
|
44
|
+
export declare function appendedTurns(sent: unknown, inputLength: number, imageIdOf?: ImageIdOf): ChatMessage[] | null;
|
|
44
45
|
export declare function isChatMessage(value: unknown): value is ChatMessage;
|
|
@@ -99,7 +99,7 @@ export class RunReplayStore {
|
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
|
-
export function trackSentRun(cacheKey) {
|
|
102
|
+
export function trackSentRun(cacheKey, imageIdOf) {
|
|
103
103
|
let used = false;
|
|
104
104
|
let onKey = false;
|
|
105
105
|
let last = null;
|
|
@@ -120,10 +120,10 @@ export function trackSentRun(cacheKey) {
|
|
|
120
120
|
last = null;
|
|
121
121
|
}
|
|
122
122
|
},
|
|
123
|
-
turns: (inputLength) => appendedTurns(last, inputLength)
|
|
123
|
+
turns: (inputLength) => appendedTurns(last, inputLength, imageIdOf)
|
|
124
124
|
};
|
|
125
125
|
}
|
|
126
|
-
export function appendedTurns(sent, inputLength) {
|
|
126
|
+
export function appendedTurns(sent, inputLength, imageIdOf = () => undefined) {
|
|
127
127
|
if (!Array.isArray(sent))
|
|
128
128
|
return null;
|
|
129
129
|
const offset = (isRecord(sent[0]) && sent[0].role === 'system' ? 1 : 0) + inputLength;
|
|
@@ -132,9 +132,18 @@ export function appendedTurns(sent, inputLength) {
|
|
|
132
132
|
}
|
|
133
133
|
const turns = sent
|
|
134
134
|
.slice(offset)
|
|
135
|
-
.map((turn) => (isRecord(turn) ?
|
|
135
|
+
.map((turn) => (isRecord(turn) ? sentTurn(turn, imageIdOf) : null));
|
|
136
136
|
return turns.every(isChatMessage) ? turns : null;
|
|
137
137
|
}
|
|
138
|
+
function sentTurn(turn, imageIdOf) {
|
|
139
|
+
const sent = { role: turn.role, content: turn.content };
|
|
140
|
+
const files = Array.isArray(turn.attachments) ? turn.attachments : [];
|
|
141
|
+
if (!files.length) {
|
|
142
|
+
return sent;
|
|
143
|
+
}
|
|
144
|
+
const imageIds = files.map((file) => isRecord(file) && typeof file.path === 'string' ? imageIdOf(file.path) : undefined);
|
|
145
|
+
return imageIds.every((id) => id !== undefined) ? { ...sent, imageIds } : null;
|
|
146
|
+
}
|
|
138
147
|
function mark(chatDir, reason) {
|
|
139
148
|
return fs.promises
|
|
140
149
|
.mkdir(chatDir, { recursive: true })
|
|
@@ -153,6 +162,8 @@ async function exists(path) {
|
|
|
153
162
|
export function isChatMessage(value) {
|
|
154
163
|
return (isRecord(value) &&
|
|
155
164
|
(value.role === 'user' || value.role === 'assistant' || value.role === 'tool') &&
|
|
156
|
-
typeof value.content === 'string'
|
|
165
|
+
typeof value.content === 'string' &&
|
|
166
|
+
(value.imageIds === undefined ||
|
|
167
|
+
(Array.isArray(value.imageIds) && value.imageIds.every((id) => typeof id === 'string'))));
|
|
157
168
|
}
|
|
158
169
|
function noop() { }
|
|
@@ -2015,8 +2015,7 @@ export function registerEngineTypes(ns) {
|
|
|
2015
2015
|
fields: [
|
|
2016
2016
|
{ name: 'meshId', type: 'string' },
|
|
2017
2017
|
{ name: 'writable', type: 'bool', required: true },
|
|
2018
|
-
{ name: 'displayName', type: 'string' }
|
|
2019
|
-
{ name: 'ownWorkspace', type: 'string' }
|
|
2018
|
+
{ name: 'displayName', type: 'string' }
|
|
2020
2019
|
]
|
|
2021
2020
|
});
|
|
2022
2021
|
ns.register({
|
|
@@ -2100,10 +2099,18 @@ export function registerEngineTypes(ns) {
|
|
|
2100
2099
|
{ name: 'knowledge', type: 'uint', required: true }
|
|
2101
2100
|
]
|
|
2102
2101
|
});
|
|
2102
|
+
ns.register({
|
|
2103
|
+
name: 'migrate-archived-mesh-request',
|
|
2104
|
+
fields: [
|
|
2105
|
+
{ name: 'meshId', type: 'string', required: true },
|
|
2106
|
+
{ name: 'workspaceId', type: 'string', required: true }
|
|
2107
|
+
]
|
|
2108
|
+
});
|
|
2103
2109
|
ns.register({
|
|
2104
2110
|
name: 'archived-mesh-migration',
|
|
2105
2111
|
fields: [
|
|
2106
2112
|
{ name: 'meshId', type: 'string', required: true },
|
|
2113
|
+
{ name: 'workspaceId', type: 'string', required: true },
|
|
2107
2114
|
{ name: 'migrated', type: 'bool', required: true },
|
|
2108
2115
|
{ name: 'migratedAt', type: 'uint', required: true },
|
|
2109
2116
|
{ name: 'chats', type: 'uint', required: true },
|
|
@@ -2284,7 +2291,10 @@ export function registerEngineTypes(ns) {
|
|
|
2284
2291
|
{ name: 'capPercent', type: 'uint', required: true },
|
|
2285
2292
|
{ name: 'capBytes', type: 'uint', required: true },
|
|
2286
2293
|
{ name: 'usedBytes', type: 'uint', required: true },
|
|
2287
|
-
{ name: 'overCap', type: 'bool', required: true }
|
|
2294
|
+
{ name: 'overCap', type: 'bool', required: true },
|
|
2295
|
+
{ name: 'totalBytes', type: 'uint' },
|
|
2296
|
+
{ name: 'source', type: 'string' },
|
|
2297
|
+
{ name: 'gpuClass', type: 'string' }
|
|
2288
2298
|
]
|
|
2289
2299
|
});
|
|
2290
2300
|
ns.register({ name: 'device-scope', fields: [{ name: 'deviceId', type: 'fixed32' }] });
|
|
@@ -2514,6 +2524,51 @@ export function registerEngineTypes(ns) {
|
|
|
2514
2524
|
name: 'quarantined-skill-keys',
|
|
2515
2525
|
fields: [{ name: 'keys', type: 'string', array: true, required: true }]
|
|
2516
2526
|
});
|
|
2527
|
+
ns.register({
|
|
2528
|
+
name: 'skill-oauth-operation',
|
|
2529
|
+
enum: ['target', 'config', 'connect', 'callback', 'cancel', 'disconnect'],
|
|
2530
|
+
strings: true
|
|
2531
|
+
});
|
|
2532
|
+
ns.register({
|
|
2533
|
+
name: 'skill-oauth-phase',
|
|
2534
|
+
enum: [
|
|
2535
|
+
'unavailable',
|
|
2536
|
+
'local',
|
|
2537
|
+
'ready',
|
|
2538
|
+
'authorize',
|
|
2539
|
+
'connected',
|
|
2540
|
+
'needs-config',
|
|
2541
|
+
'refused',
|
|
2542
|
+
'error'
|
|
2543
|
+
],
|
|
2544
|
+
strings: true
|
|
2545
|
+
});
|
|
2546
|
+
ns.register({
|
|
2547
|
+
name: 'skill-oauth-request',
|
|
2548
|
+
fields: [
|
|
2549
|
+
{ name: 'operation', type: '@assistant/skill-oauth-operation', required: true },
|
|
2550
|
+
{ name: 'agentId', type: 'string', required: true },
|
|
2551
|
+
{ name: 'credentialKey', type: 'string', required: true },
|
|
2552
|
+
{ name: 'deviceId', type: 'fixed32' },
|
|
2553
|
+
{ name: 'attemptId', type: 'string' },
|
|
2554
|
+
{ name: 'clientId', type: 'string' },
|
|
2555
|
+
{ name: 'clientSecret', type: 'string' },
|
|
2556
|
+
{ name: 'address', type: 'string' },
|
|
2557
|
+
{ name: 'meshId', type: 'string' }
|
|
2558
|
+
]
|
|
2559
|
+
});
|
|
2560
|
+
ns.register({
|
|
2561
|
+
name: 'skill-oauth-response',
|
|
2562
|
+
fields: [
|
|
2563
|
+
{ name: 'phase', type: '@assistant/skill-oauth-phase', required: true },
|
|
2564
|
+
{ name: 'deviceId', type: 'fixed32' },
|
|
2565
|
+
{ name: 'url', type: 'string' },
|
|
2566
|
+
{ name: 'clientId', type: 'bool' },
|
|
2567
|
+
{ name: 'clientSecret', type: 'bool' },
|
|
2568
|
+
{ name: 'savedClientId', type: 'string' },
|
|
2569
|
+
{ name: 'error', type: 'string' }
|
|
2570
|
+
]
|
|
2571
|
+
});
|
|
2517
2572
|
}
|
|
2518
2573
|
export function registerEngineApi(api) {
|
|
2519
2574
|
api.register({
|
|
@@ -3178,7 +3233,7 @@ export function registerEngineApi(api) {
|
|
|
3178
3233
|
});
|
|
3179
3234
|
api.register({
|
|
3180
3235
|
name: 'migrate-archived-mesh',
|
|
3181
|
-
request: { name: '@assistant/mesh-
|
|
3236
|
+
request: { name: '@assistant/migrate-archived-mesh-request', stream: false },
|
|
3182
3237
|
response: { name: '@assistant/archived-mesh-migration', stream: false }
|
|
3183
3238
|
});
|
|
3184
3239
|
api.register({
|
|
@@ -3526,4 +3581,9 @@ export function registerEngineApi(api) {
|
|
|
3526
3581
|
request: { name: '@assistant/quarantined-skill-keys', stream: false },
|
|
3527
3582
|
response: { name: '@assistant/quarantined-skill-keys', stream: false }
|
|
3528
3583
|
});
|
|
3584
|
+
api.register({
|
|
3585
|
+
name: 'skill-oauth',
|
|
3586
|
+
request: { name: '@assistant/skill-oauth-request', stream: false },
|
|
3587
|
+
response: { name: '@assistant/skill-oauth-response', stream: false }
|
|
3588
|
+
});
|
|
3529
3589
|
}
|
package/dist-lib/schema/local.js
CHANGED
|
@@ -126,7 +126,8 @@ export function registerLocalTypes(ns) {
|
|
|
126
126
|
{ name: 'workspaceKey', type: 'fixed32' },
|
|
127
127
|
{ name: 'joinedAt', type: 'uint' },
|
|
128
128
|
{ name: 'kicked', type: 'bool' },
|
|
129
|
-
{ name: 'retiredUnder', type: 'fixed32' }
|
|
129
|
+
{ name: 'retiredUnder', type: 'fixed32' },
|
|
130
|
+
{ name: 'initial', type: 'bool' }
|
|
130
131
|
]);
|
|
131
132
|
versioned('member-proof', [
|
|
132
133
|
{ name: 'meshKey', type: 'fixed32', required: true },
|
|
@@ -169,7 +170,8 @@ export function registerLocalTypes(ns) {
|
|
|
169
170
|
{ name: 'restartRunId', type: 'string' },
|
|
170
171
|
{ name: 'startedAt', type: 'uint', required: true },
|
|
171
172
|
{ name: 'completedAt', type: 'uint' },
|
|
172
|
-
{ name: 'failure', type: 'string' }
|
|
173
|
+
{ name: 'failure', type: 'string' },
|
|
174
|
+
{ name: 'targetMeshId', type: 'string' }
|
|
173
175
|
]);
|
|
174
176
|
ns.register({ name: 'capability-profile', enum: CAPABILITY_PROFILES, strings: true });
|
|
175
177
|
versioned('mesh-update', [
|
package/dist-lib/schema/qvac.js
CHANGED
|
@@ -556,7 +556,8 @@ export function registerQvacTypes(ns) {
|
|
|
556
556
|
{ name: 'shared', type: 'bool' },
|
|
557
557
|
{ name: 'sharedAt', type: 'uint' },
|
|
558
558
|
{ name: 'workspace', type: 'bool' },
|
|
559
|
-
{ name: 'kicked', type: 'bool' }
|
|
559
|
+
{ name: 'kicked', type: 'bool' },
|
|
560
|
+
{ name: 'initial', type: 'bool' }
|
|
560
561
|
]);
|
|
561
562
|
versioned('put-joined-mesh-operation', [
|
|
562
563
|
{ name: 'room', type: '@qvac/joined-mesh', required: true }
|
|
@@ -689,7 +690,8 @@ export function registerQvacTypes(ns) {
|
|
|
689
690
|
{ name: 'updatedAt', type: 'uint', required: true },
|
|
690
691
|
{ name: 'createdBy', type: 'fixed32' },
|
|
691
692
|
{ name: 'deletedAt', type: 'uint' },
|
|
692
|
-
{ name: 'groupId', type: 'string' }
|
|
693
|
+
{ name: 'groupId', type: 'string' },
|
|
694
|
+
{ name: 'seedFingerprint', type: 'fixed32' }
|
|
693
695
|
]);
|
|
694
696
|
versioned('put-project-operation', [{ name: 'project', type: '@qvac/project', required: true }]);
|
|
695
697
|
versioned('set-project-listing-operation', [
|
|
@@ -800,6 +802,27 @@ export function registerQvacTypes(ns) {
|
|
|
800
802
|
{ name: 'memberId', type: 'fixed32', required: true },
|
|
801
803
|
{ name: 'sealedSeed', type: 'buffer', required: true }
|
|
802
804
|
]);
|
|
805
|
+
versioned('project-host-seal', [
|
|
806
|
+
{ name: 'projectId', type: 'fixed32', required: true },
|
|
807
|
+
{ name: 'deviceId', type: 'fixed32', required: true },
|
|
808
|
+
{ name: 'sealedBy', type: 'fixed32', required: true },
|
|
809
|
+
{ name: 'agentId', type: 'string', required: true },
|
|
810
|
+
{ name: 'sealedSeed', type: 'buffer', required: true }
|
|
811
|
+
]);
|
|
812
|
+
versioned('project-member-seal', [
|
|
813
|
+
{ name: 'projectId', type: 'fixed32', required: true },
|
|
814
|
+
{ name: 'memberId', type: 'fixed32', required: true },
|
|
815
|
+
{ name: 'sealedBy', type: 'fixed32', required: true },
|
|
816
|
+
{ name: 'boxKey', type: 'fixed32', required: true },
|
|
817
|
+
{ name: 'sealedSeed', type: 'buffer', required: true }
|
|
818
|
+
]);
|
|
819
|
+
versioned('project-device-seal', [
|
|
820
|
+
{ name: 'projectId', type: 'fixed32', required: true },
|
|
821
|
+
{ name: 'deviceId', type: 'fixed32', required: true },
|
|
822
|
+
{ name: 'sealedBy', type: 'fixed32', required: true },
|
|
823
|
+
{ name: 'memberId', type: 'fixed32', required: true },
|
|
824
|
+
{ name: 'sealedSeed', type: 'buffer', required: true }
|
|
825
|
+
]);
|
|
803
826
|
}
|
|
804
827
|
export function registerQvacCollections(dbns, helpersPath) {
|
|
805
828
|
dbns.require(helpersPath);
|
|
@@ -1306,6 +1329,45 @@ export function registerQvacCollections(dbns, helpersPath) {
|
|
|
1306
1329
|
map: 'terminalRunStatusesMap'
|
|
1307
1330
|
}
|
|
1308
1331
|
});
|
|
1332
|
+
dbns.collections.register({
|
|
1333
|
+
name: 'project-host-seals',
|
|
1334
|
+
schema: '@qvac/project-host-seal',
|
|
1335
|
+
key: ['projectId', 'deviceId', 'sealedBy']
|
|
1336
|
+
});
|
|
1337
|
+
dbns.indexes.register({
|
|
1338
|
+
name: 'project-host-seals-by-device',
|
|
1339
|
+
collection: '@qvac/project-host-seals',
|
|
1340
|
+
unique: false,
|
|
1341
|
+
key: ['deviceId']
|
|
1342
|
+
});
|
|
1343
|
+
dbns.collections.register({
|
|
1344
|
+
name: 'project-member-seals',
|
|
1345
|
+
schema: '@qvac/project-member-seal',
|
|
1346
|
+
key: ['projectId', 'memberId', 'sealedBy']
|
|
1347
|
+
});
|
|
1348
|
+
dbns.indexes.register({
|
|
1349
|
+
name: 'project-member-seals-by-member',
|
|
1350
|
+
collection: '@qvac/project-member-seals',
|
|
1351
|
+
unique: false,
|
|
1352
|
+
key: ['memberId']
|
|
1353
|
+
});
|
|
1354
|
+
dbns.collections.register({
|
|
1355
|
+
name: 'project-device-seals',
|
|
1356
|
+
schema: '@qvac/project-device-seal',
|
|
1357
|
+
key: ['projectId', 'deviceId', 'sealedBy']
|
|
1358
|
+
});
|
|
1359
|
+
dbns.indexes.register({
|
|
1360
|
+
name: 'project-device-seals-by-device',
|
|
1361
|
+
collection: '@qvac/project-device-seals',
|
|
1362
|
+
unique: false,
|
|
1363
|
+
key: ['deviceId']
|
|
1364
|
+
});
|
|
1365
|
+
dbns.indexes.register({
|
|
1366
|
+
name: 'project-device-seals-by-member',
|
|
1367
|
+
collection: '@qvac/project-device-seals',
|
|
1368
|
+
unique: false,
|
|
1369
|
+
key: ['memberId']
|
|
1370
|
+
});
|
|
1309
1371
|
}
|
|
1310
1372
|
export function registerQvacDispatch(ds) {
|
|
1311
1373
|
ds.register({ name: 'append-chunk', requestType: '@qvac/append-chunk-operation' });
|
package/dist-lib/spec/bind.js
CHANGED
package/dist-lib/spec/calls.js
CHANGED
|
@@ -212,5 +212,6 @@ export function engineClient(rpc) {
|
|
|
212
212
|
listQuarantinedSkills: (input) => rpc.listQuarantinedSkills(input ?? {}),
|
|
213
213
|
retryQuarantinedSkills: (input) => rpc.retryQuarantinedSkills(input ?? {}),
|
|
214
214
|
discardQuarantinedSkills: (input) => rpc.discardQuarantinedSkills(input),
|
|
215
|
+
skillOauth: (input) => rpc.skillOauth(input),
|
|
215
216
|
};
|
|
216
217
|
}
|
|
@@ -160,7 +160,7 @@ export interface Capabilities {
|
|
|
160
160
|
updateMember(input: T.AssistantUpdateMemberRequest): Promise<T.AssistantMember>
|
|
161
161
|
removeMember(input: T.AssistantRemoveMemberRequest): Promise<T.AssistantOkResponse>
|
|
162
162
|
archivedMeshContents(input: T.AssistantMeshTarget): Promise<T.AssistantArchivedMeshContents>
|
|
163
|
-
migrateArchivedMesh(input: T.
|
|
163
|
+
migrateArchivedMesh(input: T.AssistantMigrateArchivedMeshRequest): Promise<T.AssistantArchivedMeshMigration>
|
|
164
164
|
listArchivedMeshes(input?: T.AssistantEmpty): Promise<T.AssistantArchivedMeshList>
|
|
165
165
|
accountRecoverable(input?: T.AssistantEmpty): Promise<T.AssistantAccountRecoveryState>
|
|
166
166
|
recoveryPublish(input: T.AssistantIdentityPhrase): Promise<T.AssistantAccountRecoveryState>
|
|
@@ -230,6 +230,7 @@ export interface Capabilities {
|
|
|
230
230
|
listQuarantinedSkills(input?: T.AssistantEmpty): Promise<T.AssistantQuarantinedSkillKeys>
|
|
231
231
|
retryQuarantinedSkills(input?: T.AssistantEmpty): Promise<T.AssistantQuarantinedSkillKeys>
|
|
232
232
|
discardQuarantinedSkills(input: T.AssistantQuarantinedSkillKeys): Promise<T.AssistantQuarantinedSkillKeys>
|
|
233
|
+
skillOauth(input: T.AssistantSkillOauthRequest): Promise<T.AssistantSkillOauthResponse>
|
|
233
234
|
}
|
|
234
235
|
|
|
235
236
|
export interface CapabilityHandlers {
|
|
@@ -365,7 +366,7 @@ export interface CapabilityHandlers {
|
|
|
365
366
|
updateMember(input: T.AssistantUpdateMemberRequest): T.AssistantMember | Promise<T.AssistantMember>
|
|
366
367
|
removeMember(input: T.AssistantRemoveMemberRequest): T.AssistantOkResponse | Promise<T.AssistantOkResponse>
|
|
367
368
|
archivedMeshContents(input: T.AssistantMeshTarget): T.AssistantArchivedMeshContents | Promise<T.AssistantArchivedMeshContents>
|
|
368
|
-
migrateArchivedMesh(input: T.
|
|
369
|
+
migrateArchivedMesh(input: T.AssistantMigrateArchivedMeshRequest): T.AssistantArchivedMeshMigration | Promise<T.AssistantArchivedMeshMigration>
|
|
369
370
|
listArchivedMeshes(input?: T.AssistantEmpty): T.AssistantArchivedMeshList | Promise<T.AssistantArchivedMeshList>
|
|
370
371
|
accountRecoverable(input?: T.AssistantEmpty): T.AssistantAccountRecoveryState | Promise<T.AssistantAccountRecoveryState>
|
|
371
372
|
recoveryPublish(input: T.AssistantIdentityPhrase): T.AssistantAccountRecoveryState | Promise<T.AssistantAccountRecoveryState>
|
|
@@ -435,4 +436,5 @@ export interface CapabilityHandlers {
|
|
|
435
436
|
listQuarantinedSkills(input?: T.AssistantEmpty): T.AssistantQuarantinedSkillKeys | Promise<T.AssistantQuarantinedSkillKeys>
|
|
436
437
|
retryQuarantinedSkills(input?: T.AssistantEmpty): T.AssistantQuarantinedSkillKeys | Promise<T.AssistantQuarantinedSkillKeys>
|
|
437
438
|
discardQuarantinedSkills(input: T.AssistantQuarantinedSkillKeys): T.AssistantQuarantinedSkillKeys | Promise<T.AssistantQuarantinedSkillKeys>
|
|
439
|
+
skillOauth(input: T.AssistantSkillOauthRequest): T.AssistantSkillOauthResponse | Promise<T.AssistantSkillOauthResponse>
|
|
438
440
|
}
|
|
@@ -1721,7 +1721,7 @@
|
|
|
1721
1721
|
"id": 132,
|
|
1722
1722
|
"name": "@assistant/migrate-archived-mesh",
|
|
1723
1723
|
"request": {
|
|
1724
|
-
"name": "@assistant/mesh-
|
|
1724
|
+
"name": "@assistant/migrate-archived-mesh-request",
|
|
1725
1725
|
"stream": false
|
|
1726
1726
|
},
|
|
1727
1727
|
"response": {
|
|
@@ -2626,6 +2626,19 @@
|
|
|
2626
2626
|
"stream": false
|
|
2627
2627
|
},
|
|
2628
2628
|
"version": 1
|
|
2629
|
+
},
|
|
2630
|
+
{
|
|
2631
|
+
"id": 202,
|
|
2632
|
+
"name": "@assistant/skill-oauth",
|
|
2633
|
+
"request": {
|
|
2634
|
+
"name": "@assistant/skill-oauth-request",
|
|
2635
|
+
"stream": false
|
|
2636
|
+
},
|
|
2637
|
+
"response": {
|
|
2638
|
+
"name": "@assistant/skill-oauth-response",
|
|
2639
|
+
"stream": false
|
|
2640
|
+
},
|
|
2641
|
+
"version": 1
|
|
2629
2642
|
}
|
|
2630
2643
|
]
|
|
2631
2644
|
}
|