@qvac/harness 1.0.0-rc.12 → 1.0.0-rc.13
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 +29 -0
- package/README.md +3 -1
- package/dist-lib/index.js +0 -1
- package/dist-lib/lib/agent/follow.js +9 -2
- package/dist-lib/lib/capabilities/completion-engine/actors/executing.js +13 -3
- package/dist-lib/lib/capabilities/completion-engine/actors/preparing.js +11 -6
- package/dist-lib/lib/capabilities/completion-engine/actors/retrieving.d.ts +2 -1
- package/dist-lib/lib/capabilities/completion-engine/actors/retrieving.js +19 -11
- package/dist-lib/lib/capabilities/completion-engine/actors/stream.js +3 -0
- package/dist-lib/lib/capabilities/completion-engine/actors/streaming.js +10 -2
- package/dist-lib/lib/capabilities/completion-engine/actors/wrap-up.js +3 -0
- package/dist-lib/lib/capabilities/completion-engine/driver.js +2 -1
- package/dist-lib/lib/capabilities/completion-engine/engine.js +39 -23
- package/dist-lib/lib/capabilities/completion-engine/event-mailbox.d.ts +20 -0
- package/dist-lib/lib/capabilities/completion-engine/event-mailbox.js +110 -0
- package/dist-lib/lib/capabilities/completion-engine/loop.d.ts +1 -0
- package/dist-lib/lib/capabilities/completion-engine/model-round.d.ts +2 -0
- package/dist-lib/lib/capabilities/completion-engine/model-round.js +2 -0
- package/dist-lib/lib/capabilities/completion-engine/round.d.ts +3 -0
- package/dist-lib/lib/capabilities/completion-engine/round.js +38 -19
- package/dist-lib/lib/capabilities/completion-engine/turns.d.ts +3 -0
- package/dist-lib/lib/capabilities/completion-engine/turns.js +16 -0
- package/dist-lib/lib/capabilities/tool-turns.d.ts +1 -0
- package/dist-lib/lib/capabilities/tool-turns.js +1 -0
- package/dist-lib/lib/connect.js +4 -2
- package/dist-lib/lib/contract/completion.d.ts +2 -1
- package/dist-lib/lib/contract/knowledge.d.ts +10 -0
- package/dist-lib/lib/fold/index.d.ts +3 -2
- package/dist-lib/lib/fold/index.js +7 -6
- package/dist-lib/lib/helpers/goal-check.d.ts +12 -0
- package/dist-lib/lib/helpers/goal-check.js +89 -7
- package/dist-lib/lib/helpers/html-helpers.js +9 -6
- package/dist-lib/lib/helpers/input-budget.d.ts +8 -0
- package/dist-lib/lib/helpers/input-budget.js +9 -0
- package/dist-lib/lib/machine/completion/actions/completion.d.ts +1 -1
- package/dist-lib/lib/machine/completion/actions/completion.js +34 -14
- package/dist-lib/lib/machine/completion/actions/tools.js +19 -1
- package/dist-lib/lib/machine/completion/rules.d.ts +1 -0
- package/dist-lib/lib/machine/completion/rules.js +14 -5
- package/dist-lib/lib/machine/completion/types.d.ts +3 -0
- package/dist-lib/lib/plugins/registry.d.ts +1 -0
- package/dist-lib/lib/plugins/registry.js +49 -10
- package/dist-lib/lib/residency/index.js +2 -0
- package/dist-lib/lib/serve.js +56 -15
- package/dist-lib/lib/tools/files/glob.js +2 -2
- package/dist-lib/lib/tools/files/read-file.js +134 -15
- package/dist-lib/lib/tools/fs/walk.d.ts +1 -0
- package/dist-lib/lib/tools/fs/walk.js +2 -1
- package/dist-lib/lib/tools/http-request/truncate-response.js +11 -2
- package/dist-lib/lib/tools/http-request.js +28 -11
- package/dist-lib/lib/tools/office.d.ts +1 -1
- package/dist-lib/lib/tools/office.js +34 -12
- package/dist-lib/lib/wire.js +23 -3
- package/dist-lib/plugins/knowledge/index.js +1 -0
- package/dist-lib/plugins/knowledge/manifest.d.ts +29 -0
- package/dist-lib/plugins/knowledge/manifest.js +41 -0
- package/dist-lib/plugins/knowledge/search-tool.js +8 -8
- package/dist-lib/plugins/knowledge/store.d.ts +35 -7
- package/dist-lib/plugins/knowledge/store.js +335 -143
- package/dist-lib/plugins/mcp/call.js +10 -3
- package/dist-lib/plugins/mcp/protocol.d.ts +4 -1
- package/dist-lib/plugins/mcp/protocol.js +11 -10
- package/dist-lib/plugins/mcp/tool-listing.d.ts +6 -0
- package/dist-lib/plugins/mcp/tool-listing.js +97 -0
- package/dist-lib/plugins/music/generate-music.js +2 -2
- package/dist-lib/plugins/python/language.js +2 -2
- package/dist-lib/plugins/sandbox-windows/prebuilds/win32-arm64/qvac-sandbox.exe +0 -0
- package/dist-lib/plugins/sandbox-windows/prebuilds/win32-x64/qvac-sandbox.exe +0 -0
- package/dist-lib/schema/harness.js +4 -2
- package/dist-lib/spec/hrpc/messages.js +19 -4
- package/dist-lib/spec/hyperschema/index.js +19 -4
- package/dist-lib/spec/hyperschema/schema.json +12 -1
- package/dist-lib/spec/hyperschema/types.d.ts +2 -0
- package/package.json +5 -1
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { AbortSignal as BareAbortSignal } from 'bare-abort-controller';
|
|
2
2
|
import type { ToolExecuteContext, ToolFetch } from '../../lib/contract/index.ts';
|
|
3
|
+
import { type ToolListing } from './tool-listing.ts';
|
|
4
|
+
import { type ResponseCoverage } from '../../lib/tools/http-request/truncate-response.ts';
|
|
3
5
|
export declare const MCP_PROTOCOL_VERSION = "2025-03-26";
|
|
4
6
|
export declare const TIMEOUT_MS = 30000;
|
|
5
7
|
interface McpResponseBody {
|
|
@@ -19,8 +21,9 @@ export interface McpError {
|
|
|
19
21
|
}
|
|
20
22
|
export interface McpBody {
|
|
21
23
|
body: string;
|
|
24
|
+
truncated?: ResponseCoverage;
|
|
22
25
|
}
|
|
23
|
-
export declare function flattenMcpResponse(body: string): McpError | McpBody;
|
|
26
|
+
export declare function flattenMcpResponse(body: string, ctx: ToolExecuteContext | undefined, listing?: ToolListing): McpError | McpBody;
|
|
24
27
|
export declare function sessionKey(url: string, ctx: ToolExecuteContext | undefined, credentialKey?: string): string;
|
|
25
28
|
export declare function getSession(key: string): string;
|
|
26
29
|
export declare function deleteSession(key: string): void;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { isRecord } from '../../lib/guards.js';
|
|
2
2
|
import { METADATA_METHODS } from '../../lib/helpers/mcp-methods.js';
|
|
3
3
|
import { MAX_RESPONSE_CHARS } from '../../lib/tools/http-request/request.js';
|
|
4
|
+
import { listTools } from './tool-listing.js';
|
|
5
|
+
import { capResponseBody } from '../../lib/tools/http-request/truncate-response.js';
|
|
4
6
|
export const MCP_PROTOCOL_VERSION = '2025-03-26';
|
|
5
7
|
export const TIMEOUT_MS = 30_000;
|
|
6
8
|
const PROTOCOL_METHODS = new Set([...METADATA_METHODS, 'tools/call']);
|
|
@@ -60,12 +62,7 @@ function decodePayload(body, contentType) {
|
|
|
60
62
|
}
|
|
61
63
|
}
|
|
62
64
|
}
|
|
63
|
-
|
|
64
|
-
return JSON.stringify(JSON.parse(payload), null, 2);
|
|
65
|
-
}
|
|
66
|
-
catch {
|
|
67
|
-
return payload;
|
|
68
|
-
}
|
|
65
|
+
return payload;
|
|
69
66
|
}
|
|
70
67
|
function asRecord(value) {
|
|
71
68
|
return isRecord(value) && !Array.isArray(value) ? value : null;
|
|
@@ -88,28 +85,32 @@ function rpcErrorText(error) {
|
|
|
88
85
|
}
|
|
89
86
|
return `${message} ${JSON.stringify(error.data)}`.trim();
|
|
90
87
|
}
|
|
91
|
-
export function flattenMcpResponse(body) {
|
|
88
|
+
export function flattenMcpResponse(body, ctx, listing) {
|
|
92
89
|
let parsed;
|
|
93
90
|
try {
|
|
94
91
|
parsed = JSON.parse(body);
|
|
95
92
|
}
|
|
96
93
|
catch {
|
|
97
|
-
return
|
|
94
|
+
return capResponseBody(body, ctx);
|
|
98
95
|
}
|
|
99
96
|
const record = asRecord(parsed);
|
|
100
97
|
if (!record) {
|
|
101
|
-
return
|
|
98
|
+
return capResponseBody(body, ctx);
|
|
102
99
|
}
|
|
103
100
|
const rpcError = asRecord(record.error);
|
|
104
101
|
if (rpcError) {
|
|
105
102
|
return { error: truncate(rpcErrorText(rpcError) || body.trim()) };
|
|
106
103
|
}
|
|
107
104
|
const result = asRecord(record.result);
|
|
105
|
+
const tools = listing && result ? listTools(result, listing.names) : null;
|
|
106
|
+
if (tools !== null) {
|
|
107
|
+
return capResponseBody(tools, ctx);
|
|
108
|
+
}
|
|
108
109
|
const text = contentText(result)?.trim();
|
|
109
110
|
if (result?.isError === true) {
|
|
110
111
|
return { error: truncate(text || body.trim()) };
|
|
111
112
|
}
|
|
112
|
-
return
|
|
113
|
+
return capResponseBody(text || body, ctx);
|
|
113
114
|
}
|
|
114
115
|
function truncate(text) {
|
|
115
116
|
return text.length > MAX_RESPONSE_CHARS
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export interface ToolListing {
|
|
2
|
+
readonly names: readonly string[] | null;
|
|
3
|
+
readonly params: Record<string, unknown> | undefined;
|
|
4
|
+
}
|
|
5
|
+
export declare function toolListing(params: Record<string, unknown> | undefined): ToolListing;
|
|
6
|
+
export declare function listTools(result: Record<string, unknown>, names: readonly string[] | null): string | null;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { isRecord } from '../../lib/guards.js';
|
|
2
|
+
const SUMMARY_CHARS = 160;
|
|
3
|
+
const ENUM_VALUES = 12;
|
|
4
|
+
export function toolListing(params) {
|
|
5
|
+
if (!params || !('names' in params)) {
|
|
6
|
+
return { names: null, params };
|
|
7
|
+
}
|
|
8
|
+
const { names, ...rest } = params;
|
|
9
|
+
const list = (Array.isArray(names) ? names : [names]).filter((name) => typeof name === 'string');
|
|
10
|
+
return { names: list, params: Object.keys(rest).length > 0 ? rest : undefined };
|
|
11
|
+
}
|
|
12
|
+
export function listTools(result, names) {
|
|
13
|
+
const tools = Array.isArray(result.tools) ? result.tools.filter(isRecord) : null;
|
|
14
|
+
if (!tools) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
const cursor = typeof result.nextCursor === 'string' ? result.nextCursor : '';
|
|
18
|
+
return names ? describeTools(tools, names, cursor) : summarizeTools(tools, cursor);
|
|
19
|
+
}
|
|
20
|
+
function summarizeTools(tools, nextCursor) {
|
|
21
|
+
const lines = [
|
|
22
|
+
`${tools.length} tools. Call one with its name as \`method\` and its arguments as \`params\`; \`?\` marks an optional argument. For a tool's full description and schema, call tools/list with params {"names": ["<tool>"]}.`,
|
|
23
|
+
...tools.map(toolLine)
|
|
24
|
+
];
|
|
25
|
+
if (nextCursor) {
|
|
26
|
+
lines.push(`More tools: call tools/list with params {"cursor": ${JSON.stringify(nextCursor)}}.`);
|
|
27
|
+
}
|
|
28
|
+
return lines.join('\n');
|
|
29
|
+
}
|
|
30
|
+
function describeTools(tools, names, nextCursor) {
|
|
31
|
+
const listed = tools.map((tool) => String(tool.name));
|
|
32
|
+
const wanted = tools.filter((tool) => names.includes(String(tool.name)));
|
|
33
|
+
const missing = names.filter((name) => !listed.includes(name));
|
|
34
|
+
const described = wanted.map(({ name, description, inputSchema }) => ({
|
|
35
|
+
name,
|
|
36
|
+
description,
|
|
37
|
+
inputSchema: plainSchema(inputSchema)
|
|
38
|
+
}));
|
|
39
|
+
const lines = described.length > 0 ? [JSON.stringify(described)] : [];
|
|
40
|
+
if (missing.length > 0) {
|
|
41
|
+
lines.push(nextCursor
|
|
42
|
+
? `Not on this page: ${missing.join(', ')}. Call tools/list with params ${JSON.stringify({ names: missing, cursor: nextCursor })}.`
|
|
43
|
+
: `No tool named ${missing.join(', ')}. The server lists: ${listed.join(', ')}.`);
|
|
44
|
+
}
|
|
45
|
+
return lines.join('\n');
|
|
46
|
+
}
|
|
47
|
+
function plainSchema(schema) {
|
|
48
|
+
if (!isRecord(schema)) {
|
|
49
|
+
return schema;
|
|
50
|
+
}
|
|
51
|
+
const { $schema, ...rest } = schema;
|
|
52
|
+
return rest;
|
|
53
|
+
}
|
|
54
|
+
function toolLine(tool) {
|
|
55
|
+
const schema = isRecord(tool.inputSchema) ? tool.inputSchema : {};
|
|
56
|
+
const required = new Set(Array.isArray(schema.required) ? schema.required : []);
|
|
57
|
+
const properties = isRecord(schema.properties) ? schema.properties : {};
|
|
58
|
+
const args = Object.entries(properties).map(([name, property]) => `${name}${required.has(name) ? '' : '?'}: ${typeOf(property)}`);
|
|
59
|
+
const about = summary(tool.description);
|
|
60
|
+
return `- ${String(tool.name)}(${args.join(', ')})${about ? `: ${about}` : ''}`;
|
|
61
|
+
}
|
|
62
|
+
function typeOf(property) {
|
|
63
|
+
if (!isRecord(property)) {
|
|
64
|
+
return 'any';
|
|
65
|
+
}
|
|
66
|
+
if (Array.isArray(property.enum)) {
|
|
67
|
+
const values = property.enum.slice(0, ENUM_VALUES).map((value) => JSON.stringify(value));
|
|
68
|
+
return [...values, ...(property.enum.length > ENUM_VALUES ? ['…'] : [])].join('|');
|
|
69
|
+
}
|
|
70
|
+
if (property.type === 'array') {
|
|
71
|
+
return `${typeOf(property.items)}[]`;
|
|
72
|
+
}
|
|
73
|
+
if (typeof property.type === 'string') {
|
|
74
|
+
return property.type;
|
|
75
|
+
}
|
|
76
|
+
if (Array.isArray(property.type)) {
|
|
77
|
+
return property.type.join('|');
|
|
78
|
+
}
|
|
79
|
+
const union = property.anyOf ?? property.oneOf;
|
|
80
|
+
return Array.isArray(union) ? union.map(typeOf).join('|') : 'any';
|
|
81
|
+
}
|
|
82
|
+
function summary(description) {
|
|
83
|
+
const text = typeof description === 'string' ? description.replace(/\s+/g, ' ').trim() : '';
|
|
84
|
+
if (!text) {
|
|
85
|
+
return '';
|
|
86
|
+
}
|
|
87
|
+
const sentences = text.split(/(?<=[.!?])\s+/);
|
|
88
|
+
let kept = '';
|
|
89
|
+
for (const sentence of sentences) {
|
|
90
|
+
const next = `${kept} ${sentence.trim()}`.trim();
|
|
91
|
+
if (next.length > SUMMARY_CHARS) {
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
kept = next;
|
|
95
|
+
}
|
|
96
|
+
return kept || `${text.slice(0, SUMMARY_CHARS - 1)}…`;
|
|
97
|
+
}
|
|
@@ -366,9 +366,9 @@ function fileNameBase(value) {
|
|
|
366
366
|
?.toLowerCase()
|
|
367
367
|
.replace(/\.wav$/i, '')
|
|
368
368
|
.replace(/[^\p{L}\p{N}]+/gu, '-')
|
|
369
|
-
.replace(
|
|
369
|
+
.replace(/^-|-$/g, '')
|
|
370
370
|
.slice(0, MAX_TITLE_CHARS)
|
|
371
|
-
.replace(
|
|
371
|
+
.replace(/-$/, '');
|
|
372
372
|
return stem || undefined;
|
|
373
373
|
}
|
|
374
374
|
function musicMeta(value) {
|
|
@@ -76,7 +76,7 @@ const TEXT = {
|
|
|
76
76
|
}
|
|
77
77
|
};
|
|
78
78
|
function isPresent(value) {
|
|
79
|
-
return value !== undefined && value !== null;
|
|
79
|
+
return value !== undefined && value !== null && !(Array.isArray(value) && value.length === 0);
|
|
80
80
|
}
|
|
81
81
|
function stringList(value) {
|
|
82
82
|
if (!Array.isArray(value))
|
|
@@ -368,7 +368,7 @@ export function createPythonLanguage({ loadPyodide, network = pythonReachesNetwo
|
|
|
368
368
|
if (packages && 'error' in packages) {
|
|
369
369
|
return packages.error;
|
|
370
370
|
}
|
|
371
|
-
if (packages) {
|
|
371
|
+
if (packages?.length) {
|
|
372
372
|
return PACKAGES_NEED_PYTHON_ERROR;
|
|
373
373
|
}
|
|
374
374
|
return isPresent(args.inputs) || isPresent(args.outputs) ? FILES_NEED_PYTHON_ERROR : null;
|
|
Binary file
|
|
Binary file
|
|
@@ -881,7 +881,8 @@ export function registerHarnessTypes(ns) {
|
|
|
881
881
|
fields: [
|
|
882
882
|
{ name: 'text', type: 'string', required: true },
|
|
883
883
|
{ name: 'scopes', type: 'string', array: true, required: true },
|
|
884
|
-
{ name: 'k', type: 'uint' }
|
|
884
|
+
{ name: 'k', type: 'uint' },
|
|
885
|
+
{ name: 'focus', type: 'string', array: true }
|
|
885
886
|
]
|
|
886
887
|
});
|
|
887
888
|
ns.register({
|
|
@@ -919,7 +920,8 @@ export function registerHarnessTypes(ns) {
|
|
|
919
920
|
type: '@harness/knowledge-artifact-status',
|
|
920
921
|
array: true,
|
|
921
922
|
required: true
|
|
922
|
-
}
|
|
923
|
+
},
|
|
924
|
+
{ name: 'pending', type: 'uint' }
|
|
923
925
|
]
|
|
924
926
|
});
|
|
925
927
|
}
|
|
@@ -4049,24 +4049,28 @@ const encoding103 = {
|
|
|
4049
4049
|
|
|
4050
4050
|
// @harness/knowledge-search-request.scopes
|
|
4051
4051
|
const encoding104_1 = encoding4_4
|
|
4052
|
+
// @harness/knowledge-search-request.focus
|
|
4053
|
+
const encoding104_3 = encoding4_4
|
|
4052
4054
|
|
|
4053
4055
|
// @harness/knowledge-search-request
|
|
4054
4056
|
const encoding104 = {
|
|
4055
4057
|
preencode(state, m) {
|
|
4056
4058
|
c.string.preencode(state, m.text)
|
|
4057
4059
|
encoding104_1.preencode(state, m.scopes)
|
|
4058
|
-
state.end++ // max flag is
|
|
4060
|
+
state.end++ // max flag is 2 so always one byte
|
|
4059
4061
|
|
|
4060
4062
|
if (version >= 23 && m.k) c.uint.preencode(state, m.k)
|
|
4063
|
+
if (version >= 23 && m.focus) encoding104_3.preencode(state, m.focus)
|
|
4061
4064
|
},
|
|
4062
4065
|
encode(state, m) {
|
|
4063
|
-
const flags = (version >= 23 && m.k) ? 1 : 0
|
|
4066
|
+
const flags = ((version >= 23 && m.k) ? 1 : 0) | ((version >= 23 && m.focus) ? 2 : 0)
|
|
4064
4067
|
|
|
4065
4068
|
c.string.encode(state, m.text)
|
|
4066
4069
|
encoding104_1.encode(state, m.scopes)
|
|
4067
4070
|
c.uint.encode(state, flags)
|
|
4068
4071
|
|
|
4069
4072
|
if (version >= 23 && m.k) c.uint.encode(state, m.k)
|
|
4073
|
+
if (version >= 23 && m.focus) encoding104_3.encode(state, m.focus)
|
|
4070
4074
|
},
|
|
4071
4075
|
decode(state) {
|
|
4072
4076
|
const r0 = c.string.decode(state)
|
|
@@ -4076,7 +4080,8 @@ const encoding104 = {
|
|
|
4076
4080
|
return {
|
|
4077
4081
|
text: r0,
|
|
4078
4082
|
scopes: r1,
|
|
4079
|
-
k: (version >= 23 && (flags & 1) !== 0) ? c.uint.decode(state) : 0
|
|
4083
|
+
k: (version >= 23 && (flags & 1) !== 0) ? c.uint.decode(state) : 0,
|
|
4084
|
+
focus: (version >= 23 && (flags & 2) !== 0) ? encoding104_3.decode(state) : null
|
|
4080
4085
|
}
|
|
4081
4086
|
}
|
|
4082
4087
|
}
|
|
@@ -4187,24 +4192,34 @@ const encoding108 = {
|
|
|
4187
4192
|
c.uint.preencode(state, m.dimensions)
|
|
4188
4193
|
c.uint.preencode(state, m.chunks)
|
|
4189
4194
|
encoding108_3.preencode(state, m.artifacts)
|
|
4195
|
+
state.end++ // max flag is 1 so always one byte
|
|
4196
|
+
|
|
4197
|
+
if (version >= 23 && m.pending) c.uint.preencode(state, m.pending)
|
|
4190
4198
|
},
|
|
4191
4199
|
encode(state, m) {
|
|
4200
|
+
const flags = (version >= 23 && m.pending) ? 1 : 0
|
|
4201
|
+
|
|
4192
4202
|
c.string.encode(state, m.model)
|
|
4193
4203
|
c.uint.encode(state, m.dimensions)
|
|
4194
4204
|
c.uint.encode(state, m.chunks)
|
|
4195
4205
|
encoding108_3.encode(state, m.artifacts)
|
|
4206
|
+
c.uint.encode(state, flags)
|
|
4207
|
+
|
|
4208
|
+
if (version >= 23 && m.pending) c.uint.encode(state, m.pending)
|
|
4196
4209
|
},
|
|
4197
4210
|
decode(state) {
|
|
4198
4211
|
const r0 = c.string.decode(state)
|
|
4199
4212
|
const r1 = c.uint.decode(state)
|
|
4200
4213
|
const r2 = c.uint.decode(state)
|
|
4201
4214
|
const r3 = encoding108_3.decode(state)
|
|
4215
|
+
const flags = c.uint.decode(state)
|
|
4202
4216
|
|
|
4203
4217
|
return {
|
|
4204
4218
|
model: r0,
|
|
4205
4219
|
dimensions: r1,
|
|
4206
4220
|
chunks: r2,
|
|
4207
|
-
artifacts: r3
|
|
4221
|
+
artifacts: r3,
|
|
4222
|
+
pending: (version >= 23 && (flags & 1) !== 0) ? c.uint.decode(state) : 0
|
|
4208
4223
|
}
|
|
4209
4224
|
}
|
|
4210
4225
|
}
|
|
@@ -4049,24 +4049,28 @@ const encoding103 = {
|
|
|
4049
4049
|
|
|
4050
4050
|
// @harness/knowledge-search-request.scopes
|
|
4051
4051
|
const encoding104_1 = encoding4_4
|
|
4052
|
+
// @harness/knowledge-search-request.focus
|
|
4053
|
+
const encoding104_3 = encoding4_4
|
|
4052
4054
|
|
|
4053
4055
|
// @harness/knowledge-search-request
|
|
4054
4056
|
const encoding104 = {
|
|
4055
4057
|
preencode(state, m) {
|
|
4056
4058
|
c.string.preencode(state, m.text)
|
|
4057
4059
|
encoding104_1.preencode(state, m.scopes)
|
|
4058
|
-
state.end++ // max flag is
|
|
4060
|
+
state.end++ // max flag is 2 so always one byte
|
|
4059
4061
|
|
|
4060
4062
|
if (version >= 23 && m.k) c.uint.preencode(state, m.k)
|
|
4063
|
+
if (version >= 23 && m.focus) encoding104_3.preencode(state, m.focus)
|
|
4061
4064
|
},
|
|
4062
4065
|
encode(state, m) {
|
|
4063
|
-
const flags = (version >= 23 && m.k) ? 1 : 0
|
|
4066
|
+
const flags = ((version >= 23 && m.k) ? 1 : 0) | ((version >= 23 && m.focus) ? 2 : 0)
|
|
4064
4067
|
|
|
4065
4068
|
c.string.encode(state, m.text)
|
|
4066
4069
|
encoding104_1.encode(state, m.scopes)
|
|
4067
4070
|
c.uint.encode(state, flags)
|
|
4068
4071
|
|
|
4069
4072
|
if (version >= 23 && m.k) c.uint.encode(state, m.k)
|
|
4073
|
+
if (version >= 23 && m.focus) encoding104_3.encode(state, m.focus)
|
|
4070
4074
|
},
|
|
4071
4075
|
decode(state) {
|
|
4072
4076
|
const r0 = c.string.decode(state)
|
|
@@ -4076,7 +4080,8 @@ const encoding104 = {
|
|
|
4076
4080
|
return {
|
|
4077
4081
|
text: r0,
|
|
4078
4082
|
scopes: r1,
|
|
4079
|
-
k: (version >= 23 && (flags & 1) !== 0) ? c.uint.decode(state) : 0
|
|
4083
|
+
k: (version >= 23 && (flags & 1) !== 0) ? c.uint.decode(state) : 0,
|
|
4084
|
+
focus: (version >= 23 && (flags & 2) !== 0) ? encoding104_3.decode(state) : null
|
|
4080
4085
|
}
|
|
4081
4086
|
}
|
|
4082
4087
|
}
|
|
@@ -4187,24 +4192,34 @@ const encoding108 = {
|
|
|
4187
4192
|
c.uint.preencode(state, m.dimensions)
|
|
4188
4193
|
c.uint.preencode(state, m.chunks)
|
|
4189
4194
|
encoding108_3.preencode(state, m.artifacts)
|
|
4195
|
+
state.end++ // max flag is 1 so always one byte
|
|
4196
|
+
|
|
4197
|
+
if (version >= 23 && m.pending) c.uint.preencode(state, m.pending)
|
|
4190
4198
|
},
|
|
4191
4199
|
encode(state, m) {
|
|
4200
|
+
const flags = (version >= 23 && m.pending) ? 1 : 0
|
|
4201
|
+
|
|
4192
4202
|
c.string.encode(state, m.model)
|
|
4193
4203
|
c.uint.encode(state, m.dimensions)
|
|
4194
4204
|
c.uint.encode(state, m.chunks)
|
|
4195
4205
|
encoding108_3.encode(state, m.artifacts)
|
|
4206
|
+
c.uint.encode(state, flags)
|
|
4207
|
+
|
|
4208
|
+
if (version >= 23 && m.pending) c.uint.encode(state, m.pending)
|
|
4196
4209
|
},
|
|
4197
4210
|
decode(state) {
|
|
4198
4211
|
const r0 = c.string.decode(state)
|
|
4199
4212
|
const r1 = c.uint.decode(state)
|
|
4200
4213
|
const r2 = c.uint.decode(state)
|
|
4201
4214
|
const r3 = encoding108_3.decode(state)
|
|
4215
|
+
const flags = c.uint.decode(state)
|
|
4202
4216
|
|
|
4203
4217
|
return {
|
|
4204
4218
|
model: r0,
|
|
4205
4219
|
dimensions: r1,
|
|
4206
4220
|
chunks: r2,
|
|
4207
|
-
artifacts: r3
|
|
4221
|
+
artifacts: r3,
|
|
4222
|
+
pending: (version >= 23 && (flags & 1) !== 0) ? c.uint.decode(state) : 0
|
|
4208
4223
|
}
|
|
4209
4224
|
}
|
|
4210
4225
|
}
|
|
@@ -3302,6 +3302,12 @@
|
|
|
3302
3302
|
"name": "k",
|
|
3303
3303
|
"type": "uint",
|
|
3304
3304
|
"version": 23
|
|
3305
|
+
},
|
|
3306
|
+
{
|
|
3307
|
+
"name": "focus",
|
|
3308
|
+
"array": true,
|
|
3309
|
+
"type": "string",
|
|
3310
|
+
"version": 23
|
|
3305
3311
|
}
|
|
3306
3312
|
]
|
|
3307
3313
|
},
|
|
@@ -3398,7 +3404,7 @@
|
|
|
3398
3404
|
"name": "knowledge-status-response",
|
|
3399
3405
|
"namespace": "harness",
|
|
3400
3406
|
"compact": false,
|
|
3401
|
-
"flagsPosition":
|
|
3407
|
+
"flagsPosition": 4,
|
|
3402
3408
|
"fields": [
|
|
3403
3409
|
{
|
|
3404
3410
|
"name": "model",
|
|
@@ -3424,6 +3430,11 @@
|
|
|
3424
3430
|
"array": true,
|
|
3425
3431
|
"type": "@harness/knowledge-artifact-status",
|
|
3426
3432
|
"version": 23
|
|
3433
|
+
},
|
|
3434
|
+
{
|
|
3435
|
+
"name": "pending",
|
|
3436
|
+
"type": "uint",
|
|
3437
|
+
"version": 23
|
|
3427
3438
|
}
|
|
3428
3439
|
]
|
|
3429
3440
|
}
|
|
@@ -677,6 +677,7 @@ export interface HarnessKnowledgeSearchRequest {
|
|
|
677
677
|
text: string
|
|
678
678
|
scopes: string[]
|
|
679
679
|
k?: number
|
|
680
|
+
focus?: string[] | null
|
|
680
681
|
}
|
|
681
682
|
|
|
682
683
|
export interface HarnessKnowledgeHit {
|
|
@@ -704,6 +705,7 @@ export interface HarnessKnowledgeStatusResponse {
|
|
|
704
705
|
dimensions: number
|
|
705
706
|
chunks: number
|
|
706
707
|
artifacts: HarnessKnowledgeArtifactStatus[]
|
|
708
|
+
pending?: number
|
|
707
709
|
}
|
|
708
710
|
|
|
709
711
|
export interface SchemaTypes {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qvac/harness",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.13",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"engines": {
|
|
6
6
|
"bare": ">=1.34.0",
|
|
@@ -184,6 +184,10 @@
|
|
|
184
184
|
"types": "./dist-lib/lib/tools/http-request/request.d.ts",
|
|
185
185
|
"default": "./dist-lib/lib/tools/http-request/request.js"
|
|
186
186
|
},
|
|
187
|
+
"./lib/tools/http-request/truncate-response.ts": {
|
|
188
|
+
"types": "./dist-lib/lib/tools/http-request/truncate-response.d.ts",
|
|
189
|
+
"default": "./dist-lib/lib/tools/http-request/truncate-response.js"
|
|
190
|
+
},
|
|
187
191
|
"./lib/tools/skills/mention.ts": {
|
|
188
192
|
"types": "./dist-lib/lib/tools/skills/mention.d.ts",
|
|
189
193
|
"default": "./dist-lib/lib/tools/skills/mention.js"
|