@qvac/core 0.9.0 → 0.10.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 +112 -1
- package/README.md +4 -4
- package/dist-lib/index.d.ts +0 -1
- package/dist-lib/index.js +0 -1
- package/dist-lib/lib/api/agents.d.ts +7 -1
- package/dist-lib/lib/api/agents.js +2 -2
- package/dist-lib/lib/api/app-config.d.ts +2 -1
- package/dist-lib/lib/api/app-config.js +2 -2
- package/dist-lib/lib/api/attachments.js +3 -2
- package/dist-lib/lib/api/chat-move.d.ts +2 -1
- package/dist-lib/lib/api/chat-move.js +2 -2
- package/dist-lib/lib/api/chat.d.ts +3 -1
- package/dist-lib/lib/api/chat.js +5 -5
- package/dist-lib/lib/api/chunks.d.ts +2 -1
- package/dist-lib/lib/api/chunks.js +3 -3
- package/dist-lib/lib/api/config.d.ts +2 -1
- package/dist-lib/lib/api/config.js +2 -2
- package/dist-lib/lib/api/current-mesh.d.ts +1 -3
- package/dist-lib/lib/api/current-mesh.js +4 -10
- package/dist-lib/lib/api/custom-models.d.ts +7 -1
- package/dist-lib/lib/api/custom-models.js +10 -8
- package/dist-lib/lib/api/device-routes.d.ts +0 -2
- package/dist-lib/lib/api/device-routes.js +4 -5
- package/dist-lib/lib/api/devices.d.ts +3 -1
- package/dist-lib/lib/api/devices.js +9 -8
- package/dist-lib/lib/api/diagnostics.d.ts +2 -1
- package/dist-lib/lib/api/diagnostics.js +2 -2
- package/dist-lib/lib/api/index.d.ts +2 -0
- package/dist-lib/lib/api/index.js +39 -21
- package/dist-lib/lib/api/instrument.d.ts +2 -2
- package/dist-lib/lib/api/instrument.js +10 -11
- package/dist-lib/lib/api/knowledge.d.ts +3 -1
- package/dist-lib/lib/api/knowledge.js +9 -7
- package/dist-lib/lib/api/logs.js +3 -3
- package/dist-lib/lib/api/members.d.ts +6 -1
- package/dist-lib/lib/api/members.js +11 -10
- package/dist-lib/lib/api/mesh.d.ts +2 -2
- package/dist-lib/lib/api/mesh.js +6 -6
- package/dist-lib/lib/api/model-download.d.ts +2 -1
- package/dist-lib/lib/api/model-download.js +2 -2
- package/dist-lib/lib/api/network.d.ts +3 -2
- package/dist-lib/lib/api/network.js +4 -4
- package/dist-lib/lib/api/notifications.d.ts +3 -1
- package/dist-lib/lib/api/notifications.js +5 -4
- package/dist-lib/lib/api/rag.d.ts +0 -1
- package/dist-lib/lib/api/rag.js +3 -4
- package/dist-lib/lib/api/sync.d.ts +2 -1
- package/dist-lib/lib/api/sync.js +2 -2
- package/dist-lib/lib/api/tool-activity.d.ts +2 -1
- package/dist-lib/lib/api/tool-activity.js +4 -3
- package/dist-lib/lib/api/tool-configs.d.ts +2 -1
- package/dist-lib/lib/api/tool-configs.js +4 -3
- package/dist-lib/lib/api/upload-frames.d.ts +0 -1
- package/dist-lib/lib/api/upload-frames.js +0 -1
- package/dist-lib/lib/api/watchable.d.ts +3 -2
- package/dist-lib/lib/api/watchable.js +2 -3
- package/dist-lib/lib/assistant/fake-models.d.ts +2 -4
- package/dist-lib/lib/assistant/harness.js +8 -6
- package/dist-lib/lib/assistant-client.d.ts +2 -0
- package/dist-lib/lib/assistant-client.js +4 -3
- package/dist-lib/lib/assistant-tree.d.ts +3 -3
- package/dist-lib/lib/assistant.d.ts +5 -3
- package/dist-lib/lib/assistant.js +50 -13
- package/dist-lib/lib/client.d.ts +2 -2
- package/dist-lib/lib/core/agent.js +5 -4
- package/dist-lib/lib/core/archived-mesh.d.ts +2 -3
- package/dist-lib/lib/core/archived-mesh.js +3 -3
- package/dist-lib/lib/core/chat-activity.js +5 -3
- package/dist-lib/lib/core/chat-copy.d.ts +0 -1
- package/dist-lib/lib/core/chat-copy.js +2 -2
- package/dist-lib/lib/core/chat-fork.d.ts +0 -6
- package/dist-lib/lib/core/chat-fork.js +11 -17
- package/dist-lib/lib/core/chat-group.js +8 -7
- package/dist-lib/lib/core/chat-move.d.ts +4 -6
- package/dist-lib/lib/core/chat-move.js +14 -15
- package/dist-lib/lib/core/chat-order.d.ts +2 -1
- package/dist-lib/lib/core/chat-order.js +15 -2
- package/dist-lib/lib/core/chat.js +8 -7
- package/dist-lib/lib/core/chunk.js +13 -8
- package/dist-lib/lib/core/collections.d.ts +1 -0
- package/dist-lib/lib/core/collections.js +1 -0
- package/dist-lib/lib/core/contract/compute.d.ts +0 -4
- package/dist-lib/lib/core/contract/compute.js +2 -9
- package/dist-lib/lib/core/contract/types.d.ts +2 -2
- package/dist-lib/lib/core/departures.d.ts +2 -2
- package/dist-lib/lib/core/device-control.d.ts +0 -2
- package/dist-lib/lib/core/device-control.js +5 -6
- package/dist-lib/lib/core/files/attachments.js +5 -4
- package/dist-lib/lib/core/files/index.d.ts +2 -1
- package/dist-lib/lib/core/files/index.js +20 -8
- package/dist-lib/lib/core/files/processing/claims.js +3 -3
- package/dist-lib/lib/core/files/processing/document.d.ts +2 -0
- package/dist-lib/lib/core/files/processing/document.js +3 -0
- package/dist-lib/lib/core/files/processing/index.js +4 -2
- package/dist-lib/lib/core/files/processing/source.d.ts +3 -0
- package/dist-lib/lib/core/files/processing/source.js +5 -3
- package/dist-lib/lib/core/files/processing/state.js +1 -0
- package/dist-lib/lib/core/files/rag/index.d.ts +3 -0
- package/dist-lib/lib/core/files/rag/index.js +3 -1
- package/dist-lib/lib/core/files/rag/load.js +6 -3
- package/dist-lib/lib/core/files/rag/produce.js +3 -3
- package/dist-lib/lib/core/files/rag/retrieval/full-text.js +1 -1
- package/dist-lib/lib/core/files/rag/similarity.d.ts +2 -2
- package/dist-lib/lib/core/files/rag/similarity.js +2 -3
- package/dist-lib/lib/core/files/records/chunks.js +1 -1
- package/dist-lib/lib/core/files/records/knowledge.js +2 -1
- package/dist-lib/lib/core/files/records/purge.js +9 -5
- package/dist-lib/lib/core/files/records/reclaim.js +20 -48
- package/dist-lib/lib/core/files/records/sweep.d.ts +3 -0
- package/dist-lib/lib/core/files/records/sweep.js +9 -3
- package/dist-lib/lib/core/files/store/blob.d.ts +2 -0
- package/dist-lib/lib/core/files/store/blob.js +2 -2
- package/dist-lib/lib/core/files/store/index.d.ts +1 -0
- package/dist-lib/lib/core/files/store/index.js +2 -0
- package/dist-lib/lib/core/files/store/reference.js +4 -2
- package/dist-lib/lib/core/files/upload.d.ts +1 -1
- package/dist-lib/lib/core/files/upload.js +10 -9
- package/dist-lib/lib/core/handoff-channel.d.ts +6 -4
- package/dist-lib/lib/core/handoff-channel.js +8 -9
- package/dist-lib/lib/core/harness-loan.d.ts +0 -2
- package/dist-lib/lib/core/harness-loan.js +3 -4
- package/dist-lib/lib/core/hosted-agents.d.ts +2 -2
- package/dist-lib/lib/core/inference-calls-handoff.d.ts +2 -2
- package/dist-lib/lib/core/inference-calls-handoff.js +6 -5
- package/dist-lib/lib/core/inference-calls-receiver.d.ts +0 -2
- package/dist-lib/lib/core/inference-calls-receiver.js +5 -7
- package/dist-lib/lib/core/local/index.d.ts +4 -1
- package/dist-lib/lib/core/local/index.js +23 -2
- package/dist-lib/lib/core/membership.d.ts +2 -2
- package/dist-lib/lib/core/mesh.d.ts +13 -7
- package/dist-lib/lib/core/mesh.js +55 -47
- package/dist-lib/lib/core/migrations/file-index.js +2 -4
- package/dist-lib/lib/core/next-frame.js +2 -1
- package/dist-lib/lib/core/pdf/rasterize.d.ts +2 -1
- package/dist-lib/lib/core/pdf/rasterize.js +5 -5
- package/dist-lib/lib/core/peer-duplex.d.ts +3 -3
- package/dist-lib/lib/core/peer-duplex.js +4 -4
- package/dist-lib/lib/core/secret-handoff.d.ts +2 -2
- package/dist-lib/lib/core/secret-handoff.js +7 -4
- package/dist-lib/lib/core/send.js +3 -2
- package/dist-lib/lib/core/skill-overlay-handoff.d.ts +2 -2
- package/dist-lib/lib/core/skill-overlay-handoff.js +6 -5
- package/dist-lib/lib/core/skill-overlay-receiver.js +5 -5
- package/dist-lib/lib/core/skill-secrets.d.ts +0 -5
- package/dist-lib/lib/core/skill-secrets.js +5 -9
- package/dist-lib/lib/core/sync/changed.d.ts +20 -0
- package/dist-lib/lib/core/sync/changed.js +7 -0
- package/dist-lib/lib/core/sync/devices.js +1 -1
- package/dist-lib/lib/core/sync/files.d.ts +1 -0
- package/dist-lib/lib/core/sync/files.js +50 -72
- package/dist-lib/lib/core/sync/index.d.ts +1 -2
- package/dist-lib/lib/core/sync/index.js +40 -62
- package/dist-lib/lib/core/sync/view-updates.d.ts +33 -0
- package/dist-lib/lib/core/sync/view-updates.js +133 -0
- package/dist-lib/lib/core/system-info.d.ts +2 -2
- package/dist-lib/lib/core/system-info.js +10 -11
- package/dist-lib/lib/core/tool-configs.js +6 -6
- package/dist-lib/lib/core.d.ts +1 -7
- package/dist-lib/lib/core.js +147 -131
- package/dist-lib/lib/custom-model-pusher.d.ts +2 -4
- package/dist-lib/lib/custom-model-task.d.ts +2 -1
- package/dist-lib/lib/custom-model-task.js +2 -2
- package/dist-lib/lib/downloads-allowed-pusher.d.ts +2 -4
- package/dist-lib/lib/errors.d.ts +603 -0
- package/dist-lib/lib/errors.js +552 -0
- package/dist-lib/lib/log.d.ts +7 -6
- package/dist-lib/lib/log.js +10 -6
- package/dist-lib/lib/logger-type.d.ts +2 -5
- package/dist-lib/lib/model-download-status.d.ts +2 -2
- package/dist-lib/lib/model-download.d.ts +2 -2
- package/dist-lib/lib/model-download.js +3 -2
- package/dist-lib/lib/model-idle-pusher.d.ts +2 -4
- package/dist-lib/lib/model-memory-cap.d.ts +2 -4
- package/dist-lib/lib/oauth/browser-connect.js +3 -2
- package/dist-lib/lib/oauth/flow-core.js +3 -3
- package/dist-lib/lib/oauth/loopback.js +10 -9
- package/dist-lib/lib/oauth/providers.js +4 -2
- package/dist-lib/lib/oauth/register.js +3 -2
- package/dist-lib/lib/oauth/token-exchange-core.js +5 -4
- package/dist-lib/lib/run-notices.d.ts +2 -0
- package/dist-lib/lib/run-notices.js +7 -2
- package/dist-lib/lib/run-transcript.d.ts +2 -2
- package/dist-lib/lib/task.js +2 -1
- package/dist-lib/schema/engine.js +6 -3
- package/dist-lib/schema/field-order.js +1 -3
- package/dist-lib/schema/local.js +11 -0
- package/dist-lib/spec/hrpc/messages.js +20 -9
- package/dist-lib/spec/hyperschema/index.js +20 -9
- package/dist-lib/spec/hyperschema/schema.json +15 -0
- package/dist-lib/spec/hyperschema/types.d.ts +3 -0
- package/dist-lib/spec/local/hyperdb/db.json +16 -1
- package/dist-lib/spec/local/hyperdb/index.js +71 -2
- package/dist-lib/spec/local/hyperdb/messages.js +300 -143
- package/dist-lib/spec/local/hyperschema/index.js +82 -2
- package/dist-lib/spec/local/hyperschema/schema.json +43 -1
- package/dist-lib/spec/local/hyperschema/types.d.ts +12 -1
- package/package.json +10 -3
- package/tui/app.mjs +1 -1
- package/worker/assistant-sidecar.mjs +7 -0
- package/dist-lib/lib/log-levels.d.ts +0 -7
- package/dist-lib/lib/log-levels.js +0 -1
- package/dist-lib/lib/logger.d.ts +0 -5
- package/dist-lib/lib/logger.js +0 -18
|
@@ -8,6 +8,7 @@ import { RetryBudget } from './retry-budget.js';
|
|
|
8
8
|
import { unref } from './unref.js';
|
|
9
9
|
import b4a from 'b4a';
|
|
10
10
|
import { errorMessage } from './guards.js';
|
|
11
|
+
import { CoreError } from './errors.js';
|
|
11
12
|
const WATCH_RETRY_MS = 30_000;
|
|
12
13
|
const LOCAL_PROGRESS_INTERVAL_MS = 750;
|
|
13
14
|
const LOCAL_PROGRESS_PERCENTAGE_STEP = 1;
|
|
@@ -220,7 +221,7 @@ export class ModelDownloadReconciler {
|
|
|
220
221
|
}
|
|
221
222
|
async retry(name) {
|
|
222
223
|
if (this._closed)
|
|
223
|
-
throw new
|
|
224
|
+
throw new CoreError('MODEL_DOWNLOAD_CLOSED');
|
|
224
225
|
this._requestedModels.add(name);
|
|
225
226
|
this._attemptGenerations.set(name, this._attemptGeneration(name) + 1);
|
|
226
227
|
const demand = this._demands.get(name);
|
|
@@ -236,7 +237,7 @@ export class ModelDownloadReconciler {
|
|
|
236
237
|
}
|
|
237
238
|
async release(name, removeFiles) {
|
|
238
239
|
if (this._closed)
|
|
239
|
-
throw new
|
|
240
|
+
throw new CoreError('MODEL_DOWNLOAD_CLOSED');
|
|
240
241
|
this._releasing.add(name);
|
|
241
242
|
this._requestedModels.delete(name);
|
|
242
243
|
this._handled.delete(name);
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import type { Harness } from './assistant.ts';
|
|
2
|
+
import type { LoggerInterface } from '@qvac/logging';
|
|
2
3
|
import type { openLocalStore } from './core/local/index.ts';
|
|
3
4
|
type LocalStore = Awaited<ReturnType<typeof openLocalStore>>;
|
|
4
|
-
interface Logger {
|
|
5
|
-
warn(...args: unknown[]): void;
|
|
6
|
-
}
|
|
7
5
|
export type ModelIdleTarget = Pick<Harness, 'setModelIdleTimeout'>;
|
|
8
6
|
export type ModelIdleSource = Pick<LocalStore, 'get' | 'watch' | 'unwatch'>;
|
|
9
|
-
export declare function startModelIdlePusher(harness: ModelIdleTarget, state: ModelIdleSource, logger?:
|
|
7
|
+
export declare function startModelIdlePusher(harness: ModelIdleTarget, state: ModelIdleSource, logger?: LoggerInterface | null): () => Promise<void>;
|
|
10
8
|
export {};
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import type { Harness } from './assistant.ts';
|
|
2
|
+
import type { LoggerInterface } from '@qvac/logging';
|
|
2
3
|
import type { openLocalStore } from './core/local/index.ts';
|
|
3
4
|
type LocalStore = Awaited<ReturnType<typeof openLocalStore>>;
|
|
4
|
-
interface Logger {
|
|
5
|
-
warn(...args: unknown[]): void;
|
|
6
|
-
}
|
|
7
5
|
export type ModelMemoryTarget = Pick<Harness, 'setModelMemoryCap' | 'capability' | 'memoryUsage'>;
|
|
8
6
|
export type ModelMemorySource = Pick<LocalStore, 'get' | 'watch' | 'unwatch'>;
|
|
9
7
|
export interface ModelMemorySummary {
|
|
@@ -20,7 +18,7 @@ export interface ModelMemoryCap {
|
|
|
20
18
|
stop(): Promise<void>;
|
|
21
19
|
}
|
|
22
20
|
export interface ModelMemoryCapOptions {
|
|
23
|
-
logger?:
|
|
21
|
+
logger?: LoggerInterface | null;
|
|
24
22
|
onPushed?: () => void;
|
|
25
23
|
}
|
|
26
24
|
export declare function startModelMemoryCap(harness: ModelMemoryTarget, state: ModelMemorySource, { logger, onPushed }?: ModelMemoryCapOptions): ModelMemoryCap;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createServer } from 'http';
|
|
2
2
|
import { URL } from 'url';
|
|
3
3
|
import { OAUTH_CALLBACK_PATH, OAUTH_WAIT_FOR_CODE_TIMEOUT_MS } from './keys.js';
|
|
4
|
+
import { CoreError } from '../errors.js';
|
|
4
5
|
export function waitForOAuthCallback(opts) {
|
|
5
6
|
const { port, state, timeoutMs = OAUTH_WAIT_FOR_CODE_TIMEOUT_MS, onListening } = opts;
|
|
6
7
|
return new Promise((resolve, reject) => {
|
|
@@ -51,7 +52,7 @@ export function waitForOAuthCallback(opts) {
|
|
|
51
52
|
body: '<html><body><p>Authorization failed. You can close this tab.</p></body></html>',
|
|
52
53
|
close: true
|
|
53
54
|
});
|
|
54
|
-
settle({ error: new
|
|
55
|
+
settle({ error: new CoreError('OAUTH_PROVIDER_ERROR', [error]) }, res);
|
|
55
56
|
}
|
|
56
57
|
else if (code) {
|
|
57
58
|
respond(res, 200, {
|
|
@@ -64,7 +65,7 @@ export function waitForOAuthCallback(opts) {
|
|
|
64
65
|
respond(res, 204);
|
|
65
66
|
}
|
|
66
67
|
});
|
|
67
|
-
const timer = setTimeout(() => settle({ error: new
|
|
68
|
+
const timer = setTimeout(() => settle({ error: new CoreError('OAUTH_CALLBACK_TIMEOUT') }), timeoutMs);
|
|
68
69
|
server.once('error', (err) => settle({ error: err }));
|
|
69
70
|
server.listen(port, '127.0.0.1', () => onListening?.());
|
|
70
71
|
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CoreError } from '../errors.js';
|
|
1
2
|
import { generateRuntimePkceChallenge } from './pkce-runtime.js';
|
|
2
3
|
import { resolveDynamicClientId } from './register.js';
|
|
3
4
|
import { exchangeCodeWithFetch } from './token-exchange-core.js';
|
|
@@ -17,8 +18,7 @@ function buildAuthParams(config, { clientId, redirectUri, state, pkce }) {
|
|
|
17
18
|
return params;
|
|
18
19
|
}
|
|
19
20
|
export async function runOAuthFlowWithRuntime(config, deps, runtime) {
|
|
20
|
-
const openUrl = deps.openUrl ??
|
|
21
|
-
(() => Promise.reject(new Error('OAuth browser launcher is unavailable; inject openUrl or createRedirect')));
|
|
21
|
+
const openUrl = deps.openUrl ?? (() => Promise.reject(new CoreError('OAUTH_LAUNCHER_UNAVAILABLE')));
|
|
22
22
|
const pkce = await generateRuntimePkceChallenge(runtime);
|
|
23
23
|
const state = runtime.randomBase64Url(16);
|
|
24
24
|
const redirect = await deps.createRedirect({ port: config.port, credentialKey: config.credentialKey, state }, { openUrl });
|
|
@@ -34,7 +34,7 @@ export async function runOAuthFlowWithRuntime(config, deps, runtime) {
|
|
|
34
34
|
});
|
|
35
35
|
const callback = await redirect.authorize(`${config.authUrl}?${authParams.toString()}`, deps.timeoutMs, state);
|
|
36
36
|
if (callback.state !== state) {
|
|
37
|
-
throw new
|
|
37
|
+
throw new CoreError('OAUTH_STATE_MISMATCH');
|
|
38
38
|
}
|
|
39
39
|
return exchangeCodeWithFetch(config, {
|
|
40
40
|
clientId,
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { createServer } from 'http';
|
|
2
2
|
import { OAUTH_CALLBACK_PATH, OAUTH_WAIT_FOR_CODE_TIMEOUT_MS, oauthRedirectUri } from './keys.js';
|
|
3
|
+
import { CoreError } from '../errors.js';
|
|
3
4
|
const DONE_PAGE = '<html><body><p>Authorization complete. You may close this tab.</p>' +
|
|
4
5
|
'<script>window.close();</script></body></html>';
|
|
5
6
|
const STALE_PAGE = '<html><body><p>This sign-in link is from an earlier attempt. ' +
|
|
6
7
|
'You can close this tab.</p></body></html>';
|
|
7
8
|
const loopbacks = new Set();
|
|
8
9
|
export async function abortOAuthLoopback(credentialKey) {
|
|
9
|
-
return abortFor(credentialKey, new
|
|
10
|
+
return abortFor(credentialKey, new CoreError('OAUTH_CANCELLED'));
|
|
10
11
|
}
|
|
11
12
|
function abortFor(credentialKey, reason) {
|
|
12
13
|
const pending = [...loopbacks]
|
|
@@ -19,12 +20,12 @@ function abortFor(credentialKey, reason) {
|
|
|
19
20
|
}
|
|
20
21
|
export async function openOAuthLoopback(port, target) {
|
|
21
22
|
if (!Number.isInteger(port) || port < 0 || port > 65535) {
|
|
22
|
-
throw new
|
|
23
|
+
throw new CoreError('OAUTH_LOOPBACK_PORT_INVALID', [port]);
|
|
23
24
|
}
|
|
24
|
-
abortFor(target.credentialKey, new
|
|
25
|
+
abortFor(target.credentialKey, new CoreError('OAUTH_SUPERSEDED'));
|
|
25
26
|
const loopback = acquire(port);
|
|
26
27
|
if (loopback.waiters.has(target.state)) {
|
|
27
|
-
throw new
|
|
28
|
+
throw new CoreError('OAUTH_LOOPBACK_BUSY', [port, target.state]);
|
|
28
29
|
}
|
|
29
30
|
const waiter = {
|
|
30
31
|
credentialKey: target.credentialKey,
|
|
@@ -52,7 +53,7 @@ export async function openOAuthLoopback(port, target) {
|
|
|
52
53
|
throw new Error('OAuth loopback is already waiting for this code');
|
|
53
54
|
}
|
|
54
55
|
return new Promise((resolve, reject) => {
|
|
55
|
-
const timer = globalThis.setTimeout(() => settle(waiter, { ok: false, error: new
|
|
56
|
+
const timer = globalThis.setTimeout(() => settle(waiter, { ok: false, error: new CoreError('OAUTH_CALLBACK_TIMEOUT') }), timeoutMs);
|
|
56
57
|
waiter.deliver = (settlement) => {
|
|
57
58
|
globalThis.clearTimeout(timer);
|
|
58
59
|
if (settlement.ok) {
|
|
@@ -68,7 +69,7 @@ export async function openOAuthLoopback(port, target) {
|
|
|
68
69
|
if (released)
|
|
69
70
|
return;
|
|
70
71
|
released = true;
|
|
71
|
-
settle(waiter, { ok: false, error: new
|
|
72
|
+
settle(waiter, { ok: false, error: new CoreError('OAUTH_LOOPBACK_CLOSED') });
|
|
72
73
|
release(loopback, target.state);
|
|
73
74
|
}
|
|
74
75
|
};
|
|
@@ -138,7 +139,7 @@ function listen(port, waiters) {
|
|
|
138
139
|
if (listening)
|
|
139
140
|
return;
|
|
140
141
|
reject('code' in error && error.code === 'EADDRINUSE'
|
|
141
|
-
? new
|
|
142
|
+
? new CoreError('OAUTH_LOOPBACK_PORT_IN_USE', [port])
|
|
142
143
|
: error);
|
|
143
144
|
});
|
|
144
145
|
server.once('listening', () => {
|
|
@@ -157,11 +158,11 @@ function listen(port, waiters) {
|
|
|
157
158
|
function callbackSettlement(params, state) {
|
|
158
159
|
const error = params.get('error');
|
|
159
160
|
if (error) {
|
|
160
|
-
return { ok: false, error: new
|
|
161
|
+
return { ok: false, error: new CoreError('OAUTH_PROVIDER_ERROR', [error]) };
|
|
161
162
|
}
|
|
162
163
|
const code = params.get('code');
|
|
163
164
|
if (!code) {
|
|
164
|
-
return { ok: false, error: new
|
|
165
|
+
return { ok: false, error: new CoreError('OAUTH_CALLBACK_INVALID') };
|
|
165
166
|
}
|
|
166
167
|
return { ok: true, result: { code, state } };
|
|
167
168
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CoreError } from '../errors.js';
|
|
1
2
|
export function buildProviderConfig(spec, credentials) {
|
|
2
3
|
const base = {
|
|
3
4
|
clientId: credentials.clientId,
|
|
@@ -20,7 +21,8 @@ export function buildProviderConfig(spec, credentials) {
|
|
|
20
21
|
};
|
|
21
22
|
}
|
|
22
23
|
function requireSecret(secret, provider) {
|
|
23
|
-
if (!secret)
|
|
24
|
-
throw new
|
|
24
|
+
if (!secret) {
|
|
25
|
+
throw new CoreError('OAUTH_CLIENT_SECRET_MISSING', [provider]);
|
|
26
|
+
}
|
|
25
27
|
return secret;
|
|
26
28
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import * as z from 'zod';
|
|
2
|
+
import { CoreError } from '../errors.js';
|
|
2
3
|
const RegistrationResponseSchema = z.object({
|
|
3
4
|
client_id: z.string().min(1)
|
|
4
5
|
});
|
|
5
6
|
export async function registerOAuthClient(config, redirectUri, fetchImpl = globalThis.fetch) {
|
|
6
7
|
if (!config.registrationEndpoint) {
|
|
7
|
-
throw new
|
|
8
|
+
throw new CoreError('OAUTH_REGISTRATION_UNAVAILABLE');
|
|
8
9
|
}
|
|
9
10
|
const response = await fetchImpl(config.registrationEndpoint, {
|
|
10
11
|
method: 'POST',
|
|
@@ -20,7 +21,7 @@ export async function registerOAuthClient(config, redirectUri, fetchImpl = globa
|
|
|
20
21
|
});
|
|
21
22
|
if (!response.ok) {
|
|
22
23
|
const text = await response.text().catch(() => '');
|
|
23
|
-
throw new
|
|
24
|
+
throw new CoreError('OAUTH_REGISTRATION_FAILED', [response.status, text]);
|
|
24
25
|
}
|
|
25
26
|
return RegistrationResponseSchema.parse(await response.json()).client_id;
|
|
26
27
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AbortController as BareAbortController } from 'bare-abort-controller';
|
|
2
2
|
import * as z from 'zod';
|
|
3
|
+
import { CoreError } from '../errors.js';
|
|
3
4
|
const TOKEN_REQUEST_TIMEOUT_MS = 30_000;
|
|
4
5
|
const AbortController = globalThis.AbortController ?? BareAbortController;
|
|
5
6
|
const TokenResponseSchema = z.object({
|
|
@@ -17,7 +18,7 @@ function parseTokenResponse(raw) {
|
|
|
17
18
|
const failure = TokenErrorSchema.safeParse(raw);
|
|
18
19
|
if (failure.success) {
|
|
19
20
|
const detail = failure.data.error_description;
|
|
20
|
-
throw new
|
|
21
|
+
throw new CoreError('OAUTH_TOKEN_ERROR', [failure.data.error, detail]);
|
|
21
22
|
}
|
|
22
23
|
return TokenResponseSchema.parse(raw);
|
|
23
24
|
}
|
|
@@ -60,7 +61,7 @@ export async function exchangeCodeWithFetch(config, { clientId, redirectUri, cod
|
|
|
60
61
|
if (config.dynamicRegistration && /invalid_client/i.test(text)) {
|
|
61
62
|
await deps.clearClientId?.();
|
|
62
63
|
}
|
|
63
|
-
throw new
|
|
64
|
+
throw new CoreError('OAUTH_TOKEN_EXCHANGE_FAILED', [response.status, text]);
|
|
64
65
|
}
|
|
65
66
|
return toTokens(parseTokenResponse(await response.json()));
|
|
66
67
|
}
|
|
@@ -76,7 +77,7 @@ export async function refreshOAuthTokensWithFetch(config, refreshToken, fetchImp
|
|
|
76
77
|
};
|
|
77
78
|
applyClientSecret(config, body, headers);
|
|
78
79
|
const controller = new AbortController();
|
|
79
|
-
const timeout = globalThis.setTimeout(() => controller.abort(new
|
|
80
|
+
const timeout = globalThis.setTimeout(() => controller.abort(new CoreError('OAUTH_TOKEN_REFRESH_TIMEOUT')), TOKEN_REQUEST_TIMEOUT_MS);
|
|
80
81
|
try {
|
|
81
82
|
const response = await fetchImpl(config.tokenUrl, {
|
|
82
83
|
method: 'POST',
|
|
@@ -86,7 +87,7 @@ export async function refreshOAuthTokensWithFetch(config, refreshToken, fetchImp
|
|
|
86
87
|
});
|
|
87
88
|
if (!response.ok) {
|
|
88
89
|
const text = await response.text().catch(() => '');
|
|
89
|
-
throw new
|
|
90
|
+
throw new CoreError('OAUTH_TOKEN_REFRESH_FAILED', [response.status, text]);
|
|
90
91
|
}
|
|
91
92
|
return toTokens(parseTokenResponse(await response.json()), refreshToken);
|
|
92
93
|
}
|
|
@@ -5,12 +5,14 @@ export declare const RUN_ABORT_REASONS: {
|
|
|
5
5
|
readonly runnerDied: 'runner-died';
|
|
6
6
|
readonly runnerClosed: 'runner-closed';
|
|
7
7
|
readonly modelUnloaded: 'model-unloaded';
|
|
8
|
+
readonly stalled: 'stalled';
|
|
8
9
|
};
|
|
9
10
|
export type RunAbortReason = (typeof RUN_ABORT_REASONS)[keyof typeof RUN_ABORT_REASONS];
|
|
10
11
|
export declare const RUN_FAILURE_REASONS: {
|
|
11
12
|
readonly harnessDied: 'the model runtime died';
|
|
12
13
|
readonly runtimeEndedTurn: 'the model runtime ended this turn';
|
|
13
14
|
readonly capabilityUnavailable: 'this device cannot run a capability without a model';
|
|
15
|
+
readonly stalled: 'the agent stopped responding';
|
|
14
16
|
};
|
|
15
17
|
export type AbortOutcome = {
|
|
16
18
|
readonly kind: 'replay';
|
|
@@ -4,12 +4,14 @@ export const RUN_ABORT_REASONS = {
|
|
|
4
4
|
runSettled: 'run-settled',
|
|
5
5
|
runnerDied: 'runner-died',
|
|
6
6
|
runnerClosed: 'runner-closed',
|
|
7
|
-
modelUnloaded: 'model-unloaded'
|
|
7
|
+
modelUnloaded: 'model-unloaded',
|
|
8
|
+
stalled: 'stalled'
|
|
8
9
|
};
|
|
9
10
|
export const RUN_FAILURE_REASONS = {
|
|
10
11
|
harnessDied: 'the model runtime died',
|
|
11
12
|
runtimeEndedTurn: 'the model runtime ended this turn',
|
|
12
|
-
capabilityUnavailable: 'this device cannot run a capability without a model'
|
|
13
|
+
capabilityUnavailable: 'this device cannot run a capability without a model',
|
|
14
|
+
stalled: 'the agent stopped responding'
|
|
13
15
|
};
|
|
14
16
|
export function knownAbortOutcome(reason) {
|
|
15
17
|
if (reason === RUN_ABORT_REASONS.suspended ||
|
|
@@ -23,6 +25,9 @@ export function knownAbortOutcome(reason) {
|
|
|
23
25
|
if (reason === RUN_ABORT_REASONS.runnerDied) {
|
|
24
26
|
return { kind: 'failed', reason: RUN_FAILURE_REASONS.harnessDied };
|
|
25
27
|
}
|
|
28
|
+
if (reason === RUN_ABORT_REASONS.stalled) {
|
|
29
|
+
return { kind: 'failed', reason: RUN_FAILURE_REASONS.stalled };
|
|
30
|
+
}
|
|
26
31
|
return null;
|
|
27
32
|
}
|
|
28
33
|
export function isLifecycleTeardown(reason) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AssistantAppendChunkRequest, AssistantChunkId, AssistantChunkContentRunStatus } from '../spec/hyperschema/types.d.ts';
|
|
2
2
|
import type { ScopedCapabilities } from './mesh-scoped-engine.ts';
|
|
3
|
-
import type {
|
|
3
|
+
import type { LoggerInterface } from '@qvac/logging';
|
|
4
4
|
import { type PendingScope } from './write-queue.ts';
|
|
5
5
|
export type TranscriptChunk = Pick<AssistantAppendChunkRequest, 'type' | 'toolCall' | 'toolResult' | 'sources' | 'effect' | 'display' | 'rawCall'>;
|
|
6
6
|
export interface RunTranscriptOptions {
|
|
@@ -8,7 +8,7 @@ export interface RunTranscriptOptions {
|
|
|
8
8
|
runId: string;
|
|
9
9
|
deviceId: Buffer;
|
|
10
10
|
model: string;
|
|
11
|
-
log?:
|
|
11
|
+
log?: LoggerInterface | null;
|
|
12
12
|
}
|
|
13
13
|
export declare class RunTranscript {
|
|
14
14
|
private readonly _engine;
|
package/dist-lib/lib/task.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CoreError } from './errors.js';
|
|
1
2
|
const TERMINAL_STATES = new Set(['completed', 'failed', 'canceled']);
|
|
2
3
|
const TITLE_CHARS = 60;
|
|
3
4
|
export async function runTask(engine, request) {
|
|
@@ -20,7 +21,7 @@ export async function runTask(engine, request) {
|
|
|
20
21
|
return collect(chunks, { chatId, runId, state });
|
|
21
22
|
}
|
|
22
23
|
}
|
|
23
|
-
throw new
|
|
24
|
+
throw new CoreError('RUN_STREAM_ENDED', [chatId]);
|
|
24
25
|
}
|
|
25
26
|
function terminalState(chunks, runId) {
|
|
26
27
|
for (const chunk of chunks) {
|
|
@@ -1550,7 +1550,8 @@ export function registerEngineTypes(ns) {
|
|
|
1550
1550
|
name: 'skill-secret-handoff-ack',
|
|
1551
1551
|
fields: [
|
|
1552
1552
|
{ name: 'id', type: 'uint', required: true },
|
|
1553
|
-
{ name: 'error', type: 'string' }
|
|
1553
|
+
{ name: 'error', type: 'string' },
|
|
1554
|
+
{ name: 'code', type: 'uint' }
|
|
1554
1555
|
]
|
|
1555
1556
|
});
|
|
1556
1557
|
ns.register({
|
|
@@ -1676,7 +1677,8 @@ export function registerEngineTypes(ns) {
|
|
|
1676
1677
|
{ name: 'origin', type: 'string' },
|
|
1677
1678
|
{ name: 'ok', type: 'bool' },
|
|
1678
1679
|
{ name: 'copied', type: 'bool' },
|
|
1679
|
-
{ name: 'removed', type: 'bool' }
|
|
1680
|
+
{ name: 'removed', type: 'bool' },
|
|
1681
|
+
{ name: 'code', type: 'uint' }
|
|
1680
1682
|
]
|
|
1681
1683
|
});
|
|
1682
1684
|
ns.register({
|
|
@@ -2064,7 +2066,8 @@ export function registerEngineTypes(ns) {
|
|
|
2064
2066
|
{ name: 'id', type: 'uint', required: true },
|
|
2065
2067
|
{ name: 'error', type: 'string' },
|
|
2066
2068
|
{ name: 'calls', type: '@assistant/inference-call-entry', array: true },
|
|
2067
|
-
{ name: 'truncated', type: 'bool' }
|
|
2069
|
+
{ name: 'truncated', type: 'bool' },
|
|
2070
|
+
{ name: 'code', type: 'uint' }
|
|
2068
2071
|
]
|
|
2069
2072
|
});
|
|
2070
2073
|
ns.register({
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import fs from 'bare-fs';
|
|
2
2
|
import { spawnSync } from 'bare-subprocess';
|
|
3
|
-
const EXEMPT = {
|
|
4
|
-
'@qvac/seed-defaults-operation-v1.chat': 'seedableChat (lib/core/helpers/index.ts) allowlists the seed chat and leaves readThrough and forkedFrom off it'
|
|
5
|
-
};
|
|
3
|
+
const EXEMPT = {};
|
|
6
4
|
export function assertFieldOrder(root, schemaFile, tags) {
|
|
7
5
|
const current = index(JSON.parse(fs.readFileSync(schemaFile, 'utf8')).schema);
|
|
8
6
|
const seen = new Set();
|
package/dist-lib/schema/local.js
CHANGED
|
@@ -162,6 +162,12 @@ export function registerLocalTypes(ns) {
|
|
|
162
162
|
{ name: 'failure', type: 'string' }
|
|
163
163
|
]);
|
|
164
164
|
ns.register({ name: 'capability-profile', enum: CAPABILITY_PROFILES, strings: true });
|
|
165
|
+
versioned('mesh-update', [
|
|
166
|
+
{ name: 'meshKey', type: 'fixed32', required: true },
|
|
167
|
+
{ name: 'fromKey', type: 'fixed32' },
|
|
168
|
+
{ name: 'fromLength', type: 'uint' },
|
|
169
|
+
{ name: 'incremental', type: 'bool', required: true }
|
|
170
|
+
]);
|
|
165
171
|
}
|
|
166
172
|
export function registerLocalCollections(dbns, helpersPath) {
|
|
167
173
|
dbns.require(helpersPath);
|
|
@@ -268,4 +274,9 @@ export function registerLocalCollections(dbns, helpersPath) {
|
|
|
268
274
|
schema: '@local/chat-move',
|
|
269
275
|
key: ['meshKey', 'chatId']
|
|
270
276
|
});
|
|
277
|
+
dbns.collections.register({
|
|
278
|
+
name: 'mesh-updates',
|
|
279
|
+
schema: '@local/mesh-update',
|
|
280
|
+
key: ['meshKey']
|
|
281
|
+
});
|
|
271
282
|
}
|
|
@@ -8107,17 +8107,19 @@ const encoding220 = {
|
|
|
8107
8107
|
const encoding221 = {
|
|
8108
8108
|
preencode(state, m) {
|
|
8109
8109
|
c.uint.preencode(state, m.id)
|
|
8110
|
-
state.end++ // max flag is
|
|
8110
|
+
state.end++ // max flag is 2 so always one byte
|
|
8111
8111
|
|
|
8112
8112
|
if (m.error) c.string.preencode(state, m.error)
|
|
8113
|
+
if (m.code) c.uint.preencode(state, m.code)
|
|
8113
8114
|
},
|
|
8114
8115
|
encode(state, m) {
|
|
8115
|
-
const flags = m.error ? 1 : 0
|
|
8116
|
+
const flags = (m.error ? 1 : 0) | (m.code ? 2 : 0)
|
|
8116
8117
|
|
|
8117
8118
|
c.uint.encode(state, m.id)
|
|
8118
8119
|
c.uint.encode(state, flags)
|
|
8119
8120
|
|
|
8120
8121
|
if (m.error) c.string.encode(state, m.error)
|
|
8122
|
+
if (m.code) c.uint.encode(state, m.code)
|
|
8121
8123
|
},
|
|
8122
8124
|
decode(state) {
|
|
8123
8125
|
const r0 = c.uint.decode(state)
|
|
@@ -8125,7 +8127,8 @@ const encoding221 = {
|
|
|
8125
8127
|
|
|
8126
8128
|
return {
|
|
8127
8129
|
id: r0,
|
|
8128
|
-
error: (flags & 1) !== 0 ? c.string.decode(state) : null
|
|
8130
|
+
error: (flags & 1) !== 0 ? c.string.decode(state) : null,
|
|
8131
|
+
code: (flags & 2) !== 0 ? c.uint.decode(state) : 0
|
|
8129
8132
|
}
|
|
8130
8133
|
}
|
|
8131
8134
|
}
|
|
@@ -8594,7 +8597,8 @@ const encoding237 = {
|
|
|
8594
8597
|
(m.origin ? 16 : 0) |
|
|
8595
8598
|
(m.ok ? 32 : 0) |
|
|
8596
8599
|
(m.copied ? 64 : 0) |
|
|
8597
|
-
(m.removed ? 128 : 0)
|
|
8600
|
+
(m.removed ? 128 : 0) |
|
|
8601
|
+
(m.code ? 256 : 0)
|
|
8598
8602
|
|
|
8599
8603
|
c.uint.preencode(state, m.id)
|
|
8600
8604
|
c.uint.preencode(state, flags)
|
|
@@ -8603,6 +8607,7 @@ const encoding237 = {
|
|
|
8603
8607
|
if (m.skills) encoding237_2.preencode(state, m.skills)
|
|
8604
8608
|
if (m.content) c.string.preencode(state, m.content)
|
|
8605
8609
|
if (m.origin) c.string.preencode(state, m.origin)
|
|
8610
|
+
if (m.code) c.uint.preencode(state, m.code)
|
|
8606
8611
|
},
|
|
8607
8612
|
encode(state, m) {
|
|
8608
8613
|
const flags =
|
|
@@ -8613,7 +8618,8 @@ const encoding237 = {
|
|
|
8613
8618
|
(m.origin ? 16 : 0) |
|
|
8614
8619
|
(m.ok ? 32 : 0) |
|
|
8615
8620
|
(m.copied ? 64 : 0) |
|
|
8616
|
-
(m.removed ? 128 : 0)
|
|
8621
|
+
(m.removed ? 128 : 0) |
|
|
8622
|
+
(m.code ? 256 : 0)
|
|
8617
8623
|
|
|
8618
8624
|
c.uint.encode(state, m.id)
|
|
8619
8625
|
c.uint.encode(state, flags)
|
|
@@ -8622,6 +8628,7 @@ const encoding237 = {
|
|
|
8622
8628
|
if (m.skills) encoding237_2.encode(state, m.skills)
|
|
8623
8629
|
if (m.content) c.string.encode(state, m.content)
|
|
8624
8630
|
if (m.origin) c.string.encode(state, m.origin)
|
|
8631
|
+
if (m.code) c.uint.encode(state, m.code)
|
|
8625
8632
|
},
|
|
8626
8633
|
decode(state) {
|
|
8627
8634
|
const r0 = c.uint.decode(state)
|
|
@@ -8636,7 +8643,8 @@ const encoding237 = {
|
|
|
8636
8643
|
origin: (flags & 16) !== 0 ? c.string.decode(state) : null,
|
|
8637
8644
|
ok: (flags & 32) !== 0,
|
|
8638
8645
|
copied: (flags & 64) !== 0,
|
|
8639
|
-
removed: (flags & 128) !== 0
|
|
8646
|
+
removed: (flags & 128) !== 0,
|
|
8647
|
+
code: (flags & 256) !== 0 ? c.uint.decode(state) : 0
|
|
8640
8648
|
}
|
|
8641
8649
|
}
|
|
8642
8650
|
}
|
|
@@ -10159,19 +10167,21 @@ const encoding288_2 = encoding284_0
|
|
|
10159
10167
|
const encoding288 = {
|
|
10160
10168
|
preencode(state, m) {
|
|
10161
10169
|
c.uint.preencode(state, m.id)
|
|
10162
|
-
state.end++ // max flag is
|
|
10170
|
+
state.end++ // max flag is 8 so always one byte
|
|
10163
10171
|
|
|
10164
10172
|
if (m.error) c.string.preencode(state, m.error)
|
|
10165
10173
|
if (m.calls) encoding288_2.preencode(state, m.calls)
|
|
10174
|
+
if (m.code) c.uint.preencode(state, m.code)
|
|
10166
10175
|
},
|
|
10167
10176
|
encode(state, m) {
|
|
10168
|
-
const flags = (m.error ? 1 : 0) | (m.calls ? 2 : 0) | (m.truncated ? 4 : 0)
|
|
10177
|
+
const flags = (m.error ? 1 : 0) | (m.calls ? 2 : 0) | (m.truncated ? 4 : 0) | (m.code ? 8 : 0)
|
|
10169
10178
|
|
|
10170
10179
|
c.uint.encode(state, m.id)
|
|
10171
10180
|
c.uint.encode(state, flags)
|
|
10172
10181
|
|
|
10173
10182
|
if (m.error) c.string.encode(state, m.error)
|
|
10174
10183
|
if (m.calls) encoding288_2.encode(state, m.calls)
|
|
10184
|
+
if (m.code) c.uint.encode(state, m.code)
|
|
10175
10185
|
},
|
|
10176
10186
|
decode(state) {
|
|
10177
10187
|
const r0 = c.uint.decode(state)
|
|
@@ -10181,7 +10191,8 @@ const encoding288 = {
|
|
|
10181
10191
|
id: r0,
|
|
10182
10192
|
error: (flags & 1) !== 0 ? c.string.decode(state) : null,
|
|
10183
10193
|
calls: (flags & 2) !== 0 ? encoding288_2.decode(state) : null,
|
|
10184
|
-
truncated: (flags & 4) !== 0
|
|
10194
|
+
truncated: (flags & 4) !== 0,
|
|
10195
|
+
code: (flags & 8) !== 0 ? c.uint.decode(state) : 0
|
|
10185
10196
|
}
|
|
10186
10197
|
}
|
|
10187
10198
|
}
|
|
@@ -8107,17 +8107,19 @@ const encoding220 = {
|
|
|
8107
8107
|
const encoding221 = {
|
|
8108
8108
|
preencode(state, m) {
|
|
8109
8109
|
c.uint.preencode(state, m.id)
|
|
8110
|
-
state.end++ // max flag is
|
|
8110
|
+
state.end++ // max flag is 2 so always one byte
|
|
8111
8111
|
|
|
8112
8112
|
if (m.error) c.string.preencode(state, m.error)
|
|
8113
|
+
if (m.code) c.uint.preencode(state, m.code)
|
|
8113
8114
|
},
|
|
8114
8115
|
encode(state, m) {
|
|
8115
|
-
const flags = m.error ? 1 : 0
|
|
8116
|
+
const flags = (m.error ? 1 : 0) | (m.code ? 2 : 0)
|
|
8116
8117
|
|
|
8117
8118
|
c.uint.encode(state, m.id)
|
|
8118
8119
|
c.uint.encode(state, flags)
|
|
8119
8120
|
|
|
8120
8121
|
if (m.error) c.string.encode(state, m.error)
|
|
8122
|
+
if (m.code) c.uint.encode(state, m.code)
|
|
8121
8123
|
},
|
|
8122
8124
|
decode(state) {
|
|
8123
8125
|
const r0 = c.uint.decode(state)
|
|
@@ -8125,7 +8127,8 @@ const encoding221 = {
|
|
|
8125
8127
|
|
|
8126
8128
|
return {
|
|
8127
8129
|
id: r0,
|
|
8128
|
-
error: (flags & 1) !== 0 ? c.string.decode(state) : null
|
|
8130
|
+
error: (flags & 1) !== 0 ? c.string.decode(state) : null,
|
|
8131
|
+
code: (flags & 2) !== 0 ? c.uint.decode(state) : 0
|
|
8129
8132
|
}
|
|
8130
8133
|
}
|
|
8131
8134
|
}
|
|
@@ -8594,7 +8597,8 @@ const encoding237 = {
|
|
|
8594
8597
|
(m.origin ? 16 : 0) |
|
|
8595
8598
|
(m.ok ? 32 : 0) |
|
|
8596
8599
|
(m.copied ? 64 : 0) |
|
|
8597
|
-
(m.removed ? 128 : 0)
|
|
8600
|
+
(m.removed ? 128 : 0) |
|
|
8601
|
+
(m.code ? 256 : 0)
|
|
8598
8602
|
|
|
8599
8603
|
c.uint.preencode(state, m.id)
|
|
8600
8604
|
c.uint.preencode(state, flags)
|
|
@@ -8603,6 +8607,7 @@ const encoding237 = {
|
|
|
8603
8607
|
if (m.skills) encoding237_2.preencode(state, m.skills)
|
|
8604
8608
|
if (m.content) c.string.preencode(state, m.content)
|
|
8605
8609
|
if (m.origin) c.string.preencode(state, m.origin)
|
|
8610
|
+
if (m.code) c.uint.preencode(state, m.code)
|
|
8606
8611
|
},
|
|
8607
8612
|
encode(state, m) {
|
|
8608
8613
|
const flags =
|
|
@@ -8613,7 +8618,8 @@ const encoding237 = {
|
|
|
8613
8618
|
(m.origin ? 16 : 0) |
|
|
8614
8619
|
(m.ok ? 32 : 0) |
|
|
8615
8620
|
(m.copied ? 64 : 0) |
|
|
8616
|
-
(m.removed ? 128 : 0)
|
|
8621
|
+
(m.removed ? 128 : 0) |
|
|
8622
|
+
(m.code ? 256 : 0)
|
|
8617
8623
|
|
|
8618
8624
|
c.uint.encode(state, m.id)
|
|
8619
8625
|
c.uint.encode(state, flags)
|
|
@@ -8622,6 +8628,7 @@ const encoding237 = {
|
|
|
8622
8628
|
if (m.skills) encoding237_2.encode(state, m.skills)
|
|
8623
8629
|
if (m.content) c.string.encode(state, m.content)
|
|
8624
8630
|
if (m.origin) c.string.encode(state, m.origin)
|
|
8631
|
+
if (m.code) c.uint.encode(state, m.code)
|
|
8625
8632
|
},
|
|
8626
8633
|
decode(state) {
|
|
8627
8634
|
const r0 = c.uint.decode(state)
|
|
@@ -8636,7 +8643,8 @@ const encoding237 = {
|
|
|
8636
8643
|
origin: (flags & 16) !== 0 ? c.string.decode(state) : null,
|
|
8637
8644
|
ok: (flags & 32) !== 0,
|
|
8638
8645
|
copied: (flags & 64) !== 0,
|
|
8639
|
-
removed: (flags & 128) !== 0
|
|
8646
|
+
removed: (flags & 128) !== 0,
|
|
8647
|
+
code: (flags & 256) !== 0 ? c.uint.decode(state) : 0
|
|
8640
8648
|
}
|
|
8641
8649
|
}
|
|
8642
8650
|
}
|
|
@@ -10159,19 +10167,21 @@ const encoding288_2 = encoding284_0
|
|
|
10159
10167
|
const encoding288 = {
|
|
10160
10168
|
preencode(state, m) {
|
|
10161
10169
|
c.uint.preencode(state, m.id)
|
|
10162
|
-
state.end++ // max flag is
|
|
10170
|
+
state.end++ // max flag is 8 so always one byte
|
|
10163
10171
|
|
|
10164
10172
|
if (m.error) c.string.preencode(state, m.error)
|
|
10165
10173
|
if (m.calls) encoding288_2.preencode(state, m.calls)
|
|
10174
|
+
if (m.code) c.uint.preencode(state, m.code)
|
|
10166
10175
|
},
|
|
10167
10176
|
encode(state, m) {
|
|
10168
|
-
const flags = (m.error ? 1 : 0) | (m.calls ? 2 : 0) | (m.truncated ? 4 : 0)
|
|
10177
|
+
const flags = (m.error ? 1 : 0) | (m.calls ? 2 : 0) | (m.truncated ? 4 : 0) | (m.code ? 8 : 0)
|
|
10169
10178
|
|
|
10170
10179
|
c.uint.encode(state, m.id)
|
|
10171
10180
|
c.uint.encode(state, flags)
|
|
10172
10181
|
|
|
10173
10182
|
if (m.error) c.string.encode(state, m.error)
|
|
10174
10183
|
if (m.calls) encoding288_2.encode(state, m.calls)
|
|
10184
|
+
if (m.code) c.uint.encode(state, m.code)
|
|
10175
10185
|
},
|
|
10176
10186
|
decode(state) {
|
|
10177
10187
|
const r0 = c.uint.decode(state)
|
|
@@ -10181,7 +10191,8 @@ const encoding288 = {
|
|
|
10181
10191
|
id: r0,
|
|
10182
10192
|
error: (flags & 1) !== 0 ? c.string.decode(state) : null,
|
|
10183
10193
|
calls: (flags & 2) !== 0 ? encoding288_2.decode(state) : null,
|
|
10184
|
-
truncated: (flags & 4) !== 0
|
|
10194
|
+
truncated: (flags & 4) !== 0,
|
|
10195
|
+
code: (flags & 8) !== 0 ? c.uint.decode(state) : 0
|
|
10185
10196
|
}
|
|
10186
10197
|
}
|
|
10187
10198
|
}
|
|
@@ -6610,6 +6610,11 @@
|
|
|
6610
6610
|
"name": "error",
|
|
6611
6611
|
"type": "string",
|
|
6612
6612
|
"version": 1
|
|
6613
|
+
},
|
|
6614
|
+
{
|
|
6615
|
+
"name": "code",
|
|
6616
|
+
"type": "uint",
|
|
6617
|
+
"version": 1
|
|
6613
6618
|
}
|
|
6614
6619
|
]
|
|
6615
6620
|
},
|
|
@@ -7075,6 +7080,11 @@
|
|
|
7075
7080
|
"name": "removed",
|
|
7076
7081
|
"type": "bool",
|
|
7077
7082
|
"version": 1
|
|
7083
|
+
},
|
|
7084
|
+
{
|
|
7085
|
+
"name": "code",
|
|
7086
|
+
"type": "uint",
|
|
7087
|
+
"version": 1
|
|
7078
7088
|
}
|
|
7079
7089
|
]
|
|
7080
7090
|
},
|
|
@@ -8433,6 +8443,11 @@
|
|
|
8433
8443
|
"name": "truncated",
|
|
8434
8444
|
"type": "bool",
|
|
8435
8445
|
"version": 1
|
|
8446
|
+
},
|
|
8447
|
+
{
|
|
8448
|
+
"name": "code",
|
|
8449
|
+
"type": "uint",
|
|
8450
|
+
"version": 1
|
|
8436
8451
|
}
|
|
8437
8452
|
]
|
|
8438
8453
|
},
|