@qverisai/mcp 0.10.0 → 0.12.0
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 +21 -1
- package/README.md +28 -4
- package/dist/api/client.d.ts +6 -1
- package/dist/api/client.d.ts.map +1 -1
- package/dist/api/client.js +53 -2
- package/dist/api/client.js.map +1 -1
- package/dist/index.d.ts +54 -83
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +27 -1
- package/dist/index.js.map +1 -1
- package/dist/output-schemas.d.ts.map +1 -1
- package/dist/output-schemas.js +11 -0
- package/dist/output-schemas.js.map +1 -1
- package/dist/server-card.d.ts +60 -1
- package/dist/server-card.d.ts.map +1 -1
- package/dist/server-card.js +78 -1
- package/dist/server-card.js.map +1 -1
- package/dist/tools/execute.d.ts +7 -0
- package/dist/tools/execute.d.ts.map +1 -1
- package/dist/tools/execute.js +6 -0
- package/dist/tools/execute.js.map +1 -1
- package/dist/tools/probe.d.ts +43 -0
- package/dist/tools/probe.d.ts.map +1 -0
- package/dist/tools/probe.js +38 -0
- package/dist/tools/probe.js.map +1 -0
- package/dist/tools/search.d.ts +14 -0
- package/dist/tools/search.d.ts.map +1 -1
- package/dist/tools/search.js +12 -0
- package/dist/tools/search.js.map +1 -1
- package/dist/types.d.ts +74 -9
- package/dist/types.d.ts.map +1 -1
- package/package.json +4 -3
package/dist/output-schemas.js
CHANGED
|
@@ -40,6 +40,16 @@ const executeResponseSchema = {
|
|
|
40
40
|
},
|
|
41
41
|
additionalProperties: true,
|
|
42
42
|
};
|
|
43
|
+
const probeResponseSchema = {
|
|
44
|
+
type: 'object',
|
|
45
|
+
properties: {
|
|
46
|
+
schema: { type: 'object', additionalProperties: true },
|
|
47
|
+
quote: { type: 'object', additionalProperties: true },
|
|
48
|
+
coverage: { type: 'object', additionalProperties: true },
|
|
49
|
+
sample: { type: 'object', additionalProperties: true },
|
|
50
|
+
},
|
|
51
|
+
additionalProperties: true,
|
|
52
|
+
};
|
|
43
53
|
const auditResponseSchema = {
|
|
44
54
|
type: 'object',
|
|
45
55
|
properties: {
|
|
@@ -54,6 +64,7 @@ const auditResponseSchema = {
|
|
|
54
64
|
export const TOOL_OUTPUT_SCHEMAS = {
|
|
55
65
|
discover: searchResponseSchema,
|
|
56
66
|
inspect: searchResponseSchema,
|
|
67
|
+
probe: probeResponseSchema,
|
|
57
68
|
call: executeResponseSchema,
|
|
58
69
|
usage_history: auditResponseSchema,
|
|
59
70
|
credits_ledger: auditResponseSchema,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output-schemas.js","sourceRoot":"","sources":["../src/output-schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,oBAAoB,GAAG;IAC3B,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,SAAS,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,yCAAyC,EAAE;QACrF,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QACzB,OAAO,EAAE;YACP,IAAI,EAAE,OAAO;YACb,KAAK,EAAE;gBACL,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;oBAC3B,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;oBACxB,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;oBAC/B,eAAe,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;oBACnC,aAAa,EAAE,EAAE;iBAClB;gBACD,oBAAoB,EAAE,IAAI;aAC3B;SACF;KACF;IACD,oBAAoB,EAAE,IAAI;CAClB,CAAC;AAEX,MAAM,qBAAqB,GAAG;IAC5B,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,YAAY,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,uCAAuC,EAAE;QACtF,OAAO,EAAE,EAAE,IAA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AI,EAAE,QAAQ,EAAE;QACjC,eAAe,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QACnC,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,oBAAoB,EAAE,IAAI,EAAE,EAAE;KAChF;IACD,oBAAoB,EAAE,IAAI;CAClB,CAAC;AAEX,4EAA4E;AAC5E,MAAM,CAAC,MAAM,mBAAmB,GAA2B;IACzD,QAAQ,EAAE,oBAAoB;IAC9B,OAAO,EAAE,oBAAoB;IAC7B,KAAK,EAAE,mBAAmB;IAC1B,IAAI,EAAE,qBAAqB;IAC3B,aAAa,EAAE,mBAAmB;IAClC,cAAc,EAAE,mBAAmB;CACpC,CAAC"}
|
package/dist/server-card.d.ts
CHANGED
|
@@ -37,10 +37,52 @@ export interface ServerCardInfo {
|
|
|
37
37
|
};
|
|
38
38
|
/** Protocol versions the server negotiates (from the MCP SDK). */
|
|
39
39
|
protocolVersions?: string[];
|
|
40
|
+
/**
|
|
41
|
+
* Header inputs advertised on the card's remote, e.g. a Bearer template
|
|
42
|
+
* built with {@link bearerAuthHeaderInput}. Only used when a remote URL is
|
|
43
|
+
* passed to {@link buildServerCard}; secret inputs must stay templated —
|
|
44
|
+
* {@link buildServerCard} rejects literal secret material.
|
|
45
|
+
*/
|
|
46
|
+
remoteHeaders?: ServerCardKeyValueInput[];
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* A user-supplied or pre-set input value, used for {@link ServerCardRemote}
|
|
50
|
+
* URL variables and header values (schema `$defs/Input`).
|
|
51
|
+
*/
|
|
52
|
+
export interface ServerCardInput {
|
|
53
|
+
/** Allowed values for the input. If provided, the user must select one. */
|
|
54
|
+
choices?: string[];
|
|
55
|
+
/** Default value. SHOULD be a valid value for the input. */
|
|
56
|
+
default?: string;
|
|
57
|
+
/** Human-readable explanation of the input. */
|
|
58
|
+
description?: string;
|
|
59
|
+
/** Input format hint. */
|
|
60
|
+
format?: 'boolean' | 'filepath' | 'number' | 'string';
|
|
61
|
+
/** Whether the input must be supplied for the connection to succeed. */
|
|
62
|
+
isRequired?: boolean;
|
|
63
|
+
/** Whether the input is a secret (clients must handle it securely). */
|
|
64
|
+
isSecret?: boolean;
|
|
65
|
+
/** Placeholder shown during configuration. */
|
|
66
|
+
placeholder?: string;
|
|
67
|
+
/** Pre-set value; `{curly_braces}` identifiers substitute from `variables`. */
|
|
68
|
+
value?: string;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* A named {@link ServerCardInput} — used for HTTP headers — whose `value` may
|
|
72
|
+
* reference `{variable}` placeholders (schema `$defs/KeyValueInput`).
|
|
73
|
+
*/
|
|
74
|
+
export interface ServerCardKeyValueInput extends ServerCardInput {
|
|
75
|
+
name: string;
|
|
76
|
+
/** Variables referenced as `{placeholders}` inside `value`. */
|
|
77
|
+
variables?: Record<string, ServerCardInput>;
|
|
40
78
|
}
|
|
41
79
|
export interface ServerCardRemote {
|
|
42
80
|
type: 'streamable-http';
|
|
43
81
|
url: string;
|
|
82
|
+
/** HTTP headers required or accepted when connecting to this remote. */
|
|
83
|
+
headers?: ServerCardKeyValueInput[];
|
|
84
|
+
/** Variables referenced as `{placeholders}` in `url`. */
|
|
85
|
+
variables?: Record<string, ServerCardInput>;
|
|
44
86
|
supportedProtocolVersions?: string[];
|
|
45
87
|
}
|
|
46
88
|
export interface ServerCard {
|
|
@@ -67,10 +109,27 @@ export interface McpCatalog {
|
|
|
67
109
|
specVersion: typeof CATALOG_SPEC_VERSION;
|
|
68
110
|
entries: McpCatalogEntry[];
|
|
69
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* Authorization header template for bearer-credential remotes.
|
|
114
|
+
*
|
|
115
|
+
* The credential itself never appears in the card: the header value is the
|
|
116
|
+
* template `Bearer {<variableName>}` and the variable is declared
|
|
117
|
+
* required + secret, so discovery clients prompt for it and store it securely.
|
|
118
|
+
*/
|
|
119
|
+
export declare function bearerAuthHeaderInput(options?: {
|
|
120
|
+
/** Template variable name (default `api_key`). */
|
|
121
|
+
variableName?: string;
|
|
122
|
+
/** Header description shown by configuration UIs. */
|
|
123
|
+
description?: string;
|
|
124
|
+
/** Description of the secret variable itself. */
|
|
125
|
+
variableDescription?: string;
|
|
126
|
+
}): ServerCardKeyValueInput;
|
|
70
127
|
/**
|
|
71
128
|
* Build the Server Card describing this server's identity and remote endpoint.
|
|
72
129
|
*
|
|
73
|
-
* @param info - Static metadata (name/version/description/...).
|
|
130
|
+
* @param info - Static metadata (name/version/description/...). When
|
|
131
|
+
* `info.remoteHeaders` is set, the headers are attached to the remote after
|
|
132
|
+
* the no-literal-secrets check.
|
|
74
133
|
* @param remoteUrl - The absolute Streamable HTTP endpoint URL clients connect
|
|
75
134
|
* to (e.g. `https://mcp.example.com/mcp`).
|
|
76
135
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-card.d.ts","sourceRoot":"","sources":["../src/server-card.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,eAAO,MAAM,sBAAsB,8EAA8E,CAAC;AAClH,eAAO,MAAM,sBAAsB,qCAAqC,CAAC;AACzE,eAAO,MAAM,YAAY,kCAAkC,CAAC;AAC5D,eAAO,MAAM,oBAAoB,UAAU,CAAC;AAE5C,gFAAgF;AAChF,MAAM,WAAW,cAAc;IAC7B,8DAA8D;IAC9D,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACjE,kEAAkE;IAClE,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;
|
|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ACtB,qDAAqD;IACrD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iDAAiD;IACjD,mBAAmB,CAAC,EAAE,MAAM,CAAC;CACzB,GACL,uBAAuB,CAmBzB;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,cAAc,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,UAAU,CAsBpF;AAcD;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,GAAG,UAAU,CAc9E"}
|
package/dist/server-card.js
CHANGED
|
@@ -22,10 +22,83 @@ export const SERVER_CARD_SCHEMA_URL = 'https://static.modelcontextprotocol.io/sc
|
|
|
22
22
|
export const SERVER_CARD_MEDIA_TYPE = 'application/mcp-server-card+json';
|
|
23
23
|
export const CATALOG_PATH = '/.well-known/mcp/catalog.json';
|
|
24
24
|
export const CATALOG_SPEC_VERSION = 'draft';
|
|
25
|
+
/** `{variable}` placeholder syntax accepted by the Server Card schema. */
|
|
26
|
+
const TEMPLATE_PLACEHOLDER = /\{[a-zA-Z_][a-zA-Z0-9_]*\}/;
|
|
27
|
+
const VARIABLE_NAME = /^[a-zA-Z_][a-zA-Z0-9_]*$/;
|
|
28
|
+
/**
|
|
29
|
+
* Reject header metadata that would publish secret material in the card.
|
|
30
|
+
*
|
|
31
|
+
* The card is a public, unauthenticated discovery document: a secret may only
|
|
32
|
+
* be *described* (name + required/secret flags), never carried. Secret header
|
|
33
|
+
* values must be templates referencing a `{variable}` — with nothing beyond a
|
|
34
|
+
* short alphabetic scheme prefix (e.g. `Bearer `) around the placeholders, so
|
|
35
|
+
* a literal credential can't ride alongside one — and secret variables must
|
|
36
|
+
* not embed a literal `value` or `default`.
|
|
37
|
+
*/
|
|
38
|
+
function assertHeadersCarryNoSecrets(headers) {
|
|
39
|
+
for (const header of headers) {
|
|
40
|
+
if (header.isSecret) {
|
|
41
|
+
if (header.default !== undefined) {
|
|
42
|
+
throw new Error(`Server Card header "${header.name}": secret headers must not declare a literal default.`);
|
|
43
|
+
}
|
|
44
|
+
if (header.value !== undefined) {
|
|
45
|
+
if (!TEMPLATE_PLACEHOLDER.test(header.value)) {
|
|
46
|
+
throw new Error(`Server Card header "${header.name}": secret header values must reference a {variable} placeholder, ` +
|
|
47
|
+
`never a literal credential.`);
|
|
48
|
+
}
|
|
49
|
+
// After stripping placeholders, only a single short alphabetic scheme
|
|
50
|
+
// token (e.g. "Bearer", "Basic") may remain: hyphens, digits, and
|
|
51
|
+
// multiple words are how literal credentials ride along a template.
|
|
52
|
+
const residue = header.value.replace(new RegExp(TEMPLATE_PLACEHOLDER, 'g'), ' ').trim();
|
|
53
|
+
if (!/^[A-Za-z]{0,16}$/.test(residue)) {
|
|
54
|
+
throw new Error(`Server Card header "${header.name}": secret header values must only contain {variable} placeholders ` +
|
|
55
|
+
`and an optional short alphabetic scheme prefix (e.g. "Bearer {api_key}").`);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
for (const [name, variable] of Object.entries(header.variables ?? {})) {
|
|
60
|
+
// Untyped embedder config can carry null entries; skip them here — the
|
|
61
|
+
// schema validation tests reject them as structurally invalid anyway.
|
|
62
|
+
if (variable && variable.isSecret && (variable.value !== undefined || variable.default !== undefined)) {
|
|
63
|
+
throw new Error(`Server Card header "${header.name}" variable "${name}": secret variables must not embed a ` +
|
|
64
|
+
`literal value or default.`);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Authorization header template for bearer-credential remotes.
|
|
71
|
+
*
|
|
72
|
+
* The credential itself never appears in the card: the header value is the
|
|
73
|
+
* template `Bearer {<variableName>}` and the variable is declared
|
|
74
|
+
* required + secret, so discovery clients prompt for it and store it securely.
|
|
75
|
+
*/
|
|
76
|
+
export function bearerAuthHeaderInput(options = {}) {
|
|
77
|
+
const variableName = options.variableName ?? 'api_key';
|
|
78
|
+
if (!VARIABLE_NAME.test(variableName)) {
|
|
79
|
+
throw new Error(`Invalid Server Card template variable name: "${variableName}".`);
|
|
80
|
+
}
|
|
81
|
+
return {
|
|
82
|
+
name: 'Authorization',
|
|
83
|
+
description: options.description ?? 'Bearer authentication for this remote endpoint.',
|
|
84
|
+
isRequired: true,
|
|
85
|
+
isSecret: true,
|
|
86
|
+
value: `Bearer {${variableName}}`,
|
|
87
|
+
variables: {
|
|
88
|
+
[variableName]: {
|
|
89
|
+
description: options.variableDescription ?? 'Secret credential for this remote endpoint.',
|
|
90
|
+
isRequired: true,
|
|
91
|
+
isSecret: true,
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
}
|
|
25
96
|
/**
|
|
26
97
|
* Build the Server Card describing this server's identity and remote endpoint.
|
|
27
98
|
*
|
|
28
|
-
* @param info - Static metadata (name/version/description/...).
|
|
99
|
+
* @param info - Static metadata (name/version/description/...). When
|
|
100
|
+
* `info.remoteHeaders` is set, the headers are attached to the remote after
|
|
101
|
+
* the no-literal-secrets check.
|
|
29
102
|
* @param remoteUrl - The absolute Streamable HTTP endpoint URL clients connect
|
|
30
103
|
* to (e.g. `https://mcp.example.com/mcp`).
|
|
31
104
|
*/
|
|
@@ -38,6 +111,10 @@ export function buildServerCard(info, remoteUrl) {
|
|
|
38
111
|
};
|
|
39
112
|
if (remoteUrl) {
|
|
40
113
|
const remote = { type: 'streamable-http', url: remoteUrl };
|
|
114
|
+
if (info.remoteHeaders && info.remoteHeaders.length > 0) {
|
|
115
|
+
assertHeadersCarryNoSecrets(info.remoteHeaders);
|
|
116
|
+
remote.headers = info.remoteHeaders;
|
|
117
|
+
}
|
|
41
118
|
if (info.protocolVersions && info.protocolVersions.length > 0) {
|
|
42
119
|
remote.supportedProtocolVersions = info.protocolVersions;
|
|
43
120
|
}
|
package/dist/server-card.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-card.js","sourceRoot":"","sources":["../src/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AG,IAAI,CAAC,UAAU,CAAC;IACvD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,gFAAgF;AAChF,SAAS,eAAe,CAAC,IAAoB;IAC3C,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;QACpB,IAAI,CAAC;YACH,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC;QACvC,CAAC;QAAC,MAAM,CAAC;YACP,kBAAkB;QACpB,CAAC;IACH,CAAC;IACD,OAAO,WAAW,CAAC;AACrB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,IAAoB,EAAE,OAAe;IAChE,gFAAgF;IAChF,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC;IAC3D,OAAO;QACL,WAAW,EAAE,oBAAoB;QACjC,OAAO,EAAE;YACP;gBACE,UAAU,EAAE,WAAW,eAAe,CAAC,IAAI,CAAC,IAAI,UAAU,EAAE;gBAC5D,WAAW,EAAE,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,IAAI;gBACpC,SAAS,EAAE,sBAAsB;gBACjC,GAAG,EAAE,OAAO;aACb;SACF;KACF,CAAC;AACJ,CAAC"}
|
package/dist/tools/execute.d.ts
CHANGED
|
@@ -44,6 +44,8 @@ export interface ExecuteToolInput {
|
|
|
44
44
|
* @minimum -1 (-1 means no limit)
|
|
45
45
|
*/
|
|
46
46
|
max_response_size?: number;
|
|
47
|
+
/** Server-side result projection. Omit for the legacy/full response. */
|
|
48
|
+
respond_with?: 'full' | 'summary' | `fields:${string}`;
|
|
47
49
|
}
|
|
48
50
|
/**
|
|
49
51
|
* JSON Schema for the call tool input.
|
|
@@ -73,6 +75,11 @@ export declare const executeToolSchema: {
|
|
|
73
75
|
description: string;
|
|
74
76
|
default: number;
|
|
75
77
|
};
|
|
78
|
+
respond_with: {
|
|
79
|
+
type: string;
|
|
80
|
+
pattern: string;
|
|
81
|
+
description: string;
|
|
82
|
+
};
|
|
76
83
|
};
|
|
77
84
|
required: string[];
|
|
78
85
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../src/tools/execute.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;;;;;OAMG;IACH,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAExC;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;;;;;OAOG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../src/tools/execute.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;;;;;OAMG;IACH,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAExC;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;;;;;OAOG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B,wEAAwE;IACxE,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,UAAU,MAAM,EAAE,CAAC;CACxD;AAED;;;GAGG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyC7B,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,gBAAgB,EACvB,gBAAgB,EAAE,MAAM,GACvB,OAAO,CAAC,eAAe,CAAC,CAc1B"}
|
package/dist/tools/execute.js
CHANGED
|
@@ -40,6 +40,11 @@ export const executeToolSchema = {
|
|
|
40
40
|
'Use -1 for no limit. Default is 20480 (20KB).',
|
|
41
41
|
default: 20480,
|
|
42
42
|
},
|
|
43
|
+
respond_with: {
|
|
44
|
+
type: 'string',
|
|
45
|
+
pattern: '^(full|summary|fields:.+)$',
|
|
46
|
+
description: 'Server-side result projection: "full", "summary", or "fields:<JSONPath,...>". Omit for full.',
|
|
47
|
+
},
|
|
43
48
|
},
|
|
44
49
|
required: ['tool_id', 'search_id', 'params_to_tool'],
|
|
45
50
|
};
|
|
@@ -61,6 +66,7 @@ export async function executeExecuteTool(client, input, defaultSessionId) {
|
|
|
61
66
|
session_id: input.session_id ?? defaultSessionId,
|
|
62
67
|
parameters: input.params_to_tool,
|
|
63
68
|
max_response_size: input.max_response_size,
|
|
69
|
+
...(input.respond_with !== undefined && { respond_with: input.respond_with }),
|
|
64
70
|
});
|
|
65
71
|
return response;
|
|
66
72
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execute.js","sourceRoot":"","sources":["../../src/tools/execute.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"execute.js","sourceRoot":"","sources":["../../src/tools/execute.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAkDH;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,IAAI,EAAE,QAAiB;IACvB,UAAU,EAAE;QACV,OAAO,EAAE;YACP,I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C;IAEH,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,SAAS,cAAc,CAAC,KAAc;IACpC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACxE,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IAC/C,OAAO,SAAS,KAAK,MAAM,CAAC,SAAS,IAAI,SAAS,KAAK,IAAI,CAAC;AAC9D,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { QverisClient } from '../api/client.js';
|
|
2
|
+
import type { ProbeCheck, ProbeLiveBudget, ProbeResponse } from '../types.js';
|
|
3
|
+
export interface ProbeToolInput {
|
|
4
|
+
tool_id: string;
|
|
5
|
+
parameters?: Record<string, unknown>;
|
|
6
|
+
checks?: ProbeCheck[];
|
|
7
|
+
live_budget?: ProbeLiveBudget;
|
|
8
|
+
}
|
|
9
|
+
export declare const probeToolSchema: {
|
|
10
|
+
type: "object";
|
|
11
|
+
properties: {
|
|
12
|
+
tool_id: {
|
|
13
|
+
type: string;
|
|
14
|
+
minLength: number;
|
|
15
|
+
description: string;
|
|
16
|
+
};
|
|
17
|
+
parameters: {
|
|
18
|
+
type: string;
|
|
19
|
+
additionalProperties: boolean;
|
|
20
|
+
default: {};
|
|
21
|
+
description: string;
|
|
22
|
+
};
|
|
23
|
+
checks: {
|
|
24
|
+
type: string;
|
|
25
|
+
items: {
|
|
26
|
+
type: string;
|
|
27
|
+
enum: string[];
|
|
28
|
+
};
|
|
29
|
+
minItems: number;
|
|
30
|
+
default: string[];
|
|
31
|
+
description: string;
|
|
32
|
+
};
|
|
33
|
+
live_budget: {
|
|
34
|
+
type: string;
|
|
35
|
+
enum: string[];
|
|
36
|
+
default: string;
|
|
37
|
+
description: string;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
required: string[];
|
|
41
|
+
};
|
|
42
|
+
export declare function executeProbeTool(client: QverisClient, input: ProbeToolInput): Promise<ProbeResponse>;
|
|
43
|
+
//# sourceMappingURL=probe.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"probe.d.ts","sourceRoot":"","sources":["../../src/tools/probe.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE9E,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,MAAM,CAAC,EAAE,UAAU,EAAE,CAAC;IACtB,WAAW,CAAC,EAAE,eAAe,CAAC;CAC/B;AAED,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6B3B,CAAC;AAEF,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC,CAM1G"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export const probeToolSchema = {
|
|
2
|
+
type: 'object',
|
|
3
|
+
properties: {
|
|
4
|
+
tool_id: {
|
|
5
|
+
type: 'string',
|
|
6
|
+
minLength: 1,
|
|
7
|
+
description: 'Capability ID to validate without executing it.',
|
|
8
|
+
},
|
|
9
|
+
parameters: {
|
|
10
|
+
type: 'object',
|
|
11
|
+
additionalProperties: true,
|
|
12
|
+
default: {},
|
|
13
|
+
description: 'Candidate parameters to validate.',
|
|
14
|
+
},
|
|
15
|
+
checks: {
|
|
16
|
+
type: 'array',
|
|
17
|
+
items: { type: 'string', enum: ['schema', 'quote', 'coverage', 'sample'] },
|
|
18
|
+
minItems: 1,
|
|
19
|
+
default: ['schema'],
|
|
20
|
+
description: 'Probe checks to request. Schema and quote are implemented; coverage and sample may be unknown.',
|
|
21
|
+
},
|
|
22
|
+
live_budget: {
|
|
23
|
+
type: 'string',
|
|
24
|
+
enum: ['none', 'metadata', 'sampled'],
|
|
25
|
+
default: 'none',
|
|
26
|
+
description: 'Probe budget. Probe does not execute the capability or consume credits.',
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
required: ['tool_id'],
|
|
30
|
+
};
|
|
31
|
+
export async function executeProbeTool(client, input) {
|
|
32
|
+
return client.probeTool(input.tool_id, {
|
|
33
|
+
parameters: input.parameters ?? {},
|
|
34
|
+
checks: input.checks ?? ['schema'],
|
|
35
|
+
live_budget: input.live_budget ?? 'none',
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=probe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"probe.js","sourceRoot":"","sources":["../../src/tools/probe.ts"],"names":[],"mappings":"AAUA,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,IAAI,EAAE,QAAiB;IACvB,UAAU,EAAE;QACV,OAAO,EAAE;YACP,IAAI,EAAE,QAAQ;YACd,SAAS,EAAE,CAAC;YACZ,WAAW,EAAE,iDAAiD;SAC/D;QACD,UAAU,EAAE;YACV,IAAI,EAAE,QAAQ;YACd,oBAAoB,EAAE,IAAI;YAC1B,OAAO,EAAE,EAAE;YACX,WAAW,EAAE,mCAAmC;SACjD;QACD,MAAM,EAAE;YACN,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,CAAC,EAAE;YAC1E,QAAQ,EAAE,CAAC;YACX,OAAO,EAAE,CAAC,QAAQ,CAAC;YACnB,WAAW,EAAE,gGAAgG;SAC9G;QACD,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,SAAS,CAAC;YACrC,OAAO,EAAE,MAAM;YACf,WAAW,EAAE,yEAAyE;SACvF;KACF;IACD,QAAQ,EAAE,CAAC,SAAS,CAAC;CACtB,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,MAAoB,EAAE,KAAqB;IAChF,OAAO,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,EAAE;QACrC,UAAU,EAAE,KAAK,CAAC,UAAU,IAAI,EAAE;QAClC,MAAM,EAAE,KAAK,CAAC,MAAM,IAAI,CAAC,QAAQ,CAAC;QAClC,WAAW,EAAE,KAAK,CAAC,WAAW,IAAI,MAAM;KACzC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/tools/search.d.ts
CHANGED
|
@@ -33,6 +33,10 @@ export interface SearchToolsInput {
|
|
|
33
33
|
* If not provided, the server will use an auto-generated session ID.
|
|
34
34
|
*/
|
|
35
35
|
session_id?: string;
|
|
36
|
+
/** Compact routing cards or the complete result shape. Omit for full. */
|
|
37
|
+
view?: 'routing' | 'full';
|
|
38
|
+
/** Response language. Omit to use server-side negotiation. */
|
|
39
|
+
lang?: 'zh' | 'en';
|
|
36
40
|
}
|
|
37
41
|
/**
|
|
38
42
|
* JSON Schema for the discover tool input.
|
|
@@ -56,6 +60,16 @@ export declare const searchToolsSchema: {
|
|
|
56
60
|
type: string;
|
|
57
61
|
description: string;
|
|
58
62
|
};
|
|
63
|
+
view: {
|
|
64
|
+
type: string;
|
|
65
|
+
enum: string[];
|
|
66
|
+
description: string;
|
|
67
|
+
};
|
|
68
|
+
lang: {
|
|
69
|
+
type: string;
|
|
70
|
+
enum: string[];
|
|
71
|
+
description: string;
|
|
72
|
+
};
|
|
59
73
|
};
|
|
60
74
|
required: string[];
|
|
61
75
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/tools/search.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;;;;;OAOG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/tools/search.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;;;;;OAOG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,yEAAyE;IACzE,IAAI,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;IAE1B,8DAA8D;IAC9D,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;CACpB;AAED;;;GAGG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoC7B,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,gBAAgB,EACvB,gBAAgB,EAAE,MAAM,GACvB,OAAO,CAAC,cAAc,CAAC,CAUzB"}
|
package/dist/tools/search.js
CHANGED
|
@@ -31,6 +31,16 @@ export const searchToolsSchema = {
|
|
|
31
31
|
description: 'Session identifier for tracking user sessions. ' +
|
|
32
32
|
'If not provided, an auto-generated session ID will be used.',
|
|
33
33
|
},
|
|
34
|
+
view: {
|
|
35
|
+
type: 'string',
|
|
36
|
+
enum: ['routing', 'full'],
|
|
37
|
+
description: 'Response projection. "routing" returns compact routing cards; "full" or omitted returns complete results.',
|
|
38
|
+
},
|
|
39
|
+
lang: {
|
|
40
|
+
type: 'string',
|
|
41
|
+
enum: ['zh', 'en'],
|
|
42
|
+
description: 'Response language. Omit to use server-side language negotiation.',
|
|
43
|
+
},
|
|
34
44
|
},
|
|
35
45
|
required: ['query'],
|
|
36
46
|
};
|
|
@@ -47,6 +57,8 @@ export async function executeSearchTools(client, input, defaultSessionId) {
|
|
|
47
57
|
query: input.query,
|
|
48
58
|
limit: input.limit ?? 20,
|
|
49
59
|
session_id: input.session_id ?? defaultSessionId,
|
|
60
|
+
...(input.view !== undefined && { view: input.view }),
|
|
61
|
+
...(input.lang !== undefined && { lang: input.lang }),
|
|
50
62
|
});
|
|
51
63
|
return response;
|
|
52
64
|
}
|
package/dist/tools/search.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../src/tools/search.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../src/tools/search.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAwCH;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,IAAI,EAAE,QAAiB;IACvB,UAAU,EAAE;QACV,KAAK,EAAE;YACL,IAAI,EAAE,QAAQ;YACd,WAAW,EACT,kEAAkE;gBAClE,gGAAgG;gBAChG,+DAA+D;SAClE;QACD,KAAK,EAAE;YACL,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,6CAA6C;YAC1D,OAAO,EAAE,EAAE;YACX,OAAO,EAAE,CAAC;YACV,OAAO,EAAE,GAAG;SACb;QACD,UAAU,EAAE;YACV,IAAI,EAAE,QAAQ;YACd,WAAW,EACT,iDAAiD;gBACjD,6DAA6D;SAChE;QACD,IAAI,EAAE;YACJ,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,CAAC,SAAS,EAAE,MAAM,CAAC;YACzB,WAAW,EACT,2GAA2G;SAC9G;QACD,IAAI,EAAE;YACJ,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC;YAClB,WAAW,EAAE,kEAAkE;SAChF;KACF;IACD,QAAQ,EAAE,CAAC,OAAO,CAAC;CACpB,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,MAAoB,EACpB,KAAuB,EACvB,gBAAwB;IAExB,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC;QACxC,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,KAAK,EAAE,KAAK,CAAC,KAAK,IAAI,EAAE;QACxB,UAAU,EAAE,KAAK,CAAC,UAAU,IAAI,gBAAgB;QAChD,GAAG,CAAC,KAAK,CAAC,IAAI,KAAK,SAAS,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC;QACrD,GAAG,CAAC,KAAK,CAAC,IAAI,KAAK,SAAS,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC;KACtD,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -16,13 +16,16 @@ export interface SearchRequest {
|
|
|
16
16
|
query: string;
|
|
17
17
|
/**
|
|
18
18
|
* Maximum number of results to return.
|
|
19
|
+
* Minimum: 1. Maximum: 100.
|
|
19
20
|
* @default 20
|
|
20
|
-
* @minimum 1
|
|
21
|
-
* @maximum 100
|
|
22
21
|
*/
|
|
23
22
|
limit?: number;
|
|
24
23
|
/** Session identifier for tracking user sessions. */
|
|
25
24
|
session_id?: string;
|
|
25
|
+
/** Response projection. Omit for the legacy/full response shape. */
|
|
26
|
+
view?: 'routing' | 'full';
|
|
27
|
+
/** Response language. Omit to use server-side language negotiation. */
|
|
28
|
+
lang?: 'zh' | 'en';
|
|
26
29
|
}
|
|
27
30
|
/**
|
|
28
31
|
* Parameter definition for a tool.
|
|
@@ -131,9 +134,17 @@ export interface ToolInfo {
|
|
|
131
134
|
/** Unique identifier for the tool (used in call) */
|
|
132
135
|
tool_id: string;
|
|
133
136
|
/** Human-readable display name */
|
|
134
|
-
name
|
|
137
|
+
name?: string;
|
|
135
138
|
/** Detailed description of what the tool does */
|
|
136
|
-
description
|
|
139
|
+
description?: string;
|
|
140
|
+
/** Compact capability label returned by the routing projection. */
|
|
141
|
+
capability?: string;
|
|
142
|
+
/** Compact cost class returned by the routing projection. */
|
|
143
|
+
cost_class?: string;
|
|
144
|
+
/** Compact reliability grade returned by the routing projection. */
|
|
145
|
+
reliability?: string;
|
|
146
|
+
/** Whether the capability supports point-in-time requests. */
|
|
147
|
+
as_of_support?: boolean;
|
|
137
148
|
/** Tool categories/tags: category objects, or plain strings in legacy responses */
|
|
138
149
|
categories?: Array<string | ToolCategory>;
|
|
139
150
|
/** Standardized capability descriptors with coverage tags */
|
|
@@ -240,10 +251,12 @@ export interface ExecuteRequest {
|
|
|
240
251
|
* Maximum size of response data in bytes.
|
|
241
252
|
* If the tool generates data longer than this, it will be truncated
|
|
242
253
|
* and a download URL will be provided for the full content.
|
|
254
|
+
* Minimum: -1 (`-1` means no limit).
|
|
243
255
|
* @default 20480 (20KB)
|
|
244
|
-
* @minimum -1 (-1 means no limit)
|
|
245
256
|
*/
|
|
246
257
|
max_response_size?: number;
|
|
258
|
+
/** Server-side result projection. Omit for the legacy/full response. */
|
|
259
|
+
respond_with?: 'full' | 'summary' | `fields:${string}`;
|
|
247
260
|
}
|
|
248
261
|
/**
|
|
249
262
|
* Result data when the response fits within max_response_size.
|
|
@@ -275,10 +288,28 @@ export interface ExecuteResultTruncated {
|
|
|
275
288
|
*/
|
|
276
289
|
content_schema?: Record<string, unknown>;
|
|
277
290
|
}
|
|
291
|
+
/** Compact result returned by `respond_with: "summary"`. */
|
|
292
|
+
export interface ExecuteResultSummary {
|
|
293
|
+
respond_with: 'summary';
|
|
294
|
+
content_schema?: Record<string, unknown>;
|
|
295
|
+
summary?: {
|
|
296
|
+
size_bytes?: number;
|
|
297
|
+
row_count?: number;
|
|
298
|
+
fields?: string[];
|
|
299
|
+
[key: string]: unknown;
|
|
300
|
+
};
|
|
301
|
+
full_content_file_url?: string;
|
|
302
|
+
message?: string;
|
|
303
|
+
}
|
|
304
|
+
/** Selected result fields returned by a `fields:<JSONPath,...>` projection. */
|
|
305
|
+
export interface ExecuteResultFields {
|
|
306
|
+
respond_with: `fields:${string}`;
|
|
307
|
+
data?: unknown;
|
|
308
|
+
}
|
|
278
309
|
/**
|
|
279
310
|
* Union type for execution results (either full data or truncated).
|
|
280
311
|
*/
|
|
281
|
-
export type ExecuteResult = ExecuteResultData | ExecuteResultTruncated;
|
|
312
|
+
export type ExecuteResult = ExecuteResultData | ExecuteResultTruncated | ExecuteResultSummary | ExecuteResultFields | unknown[] | string | number | boolean | null;
|
|
282
313
|
/**
|
|
283
314
|
* Response from the Execute Tool API.
|
|
284
315
|
*/
|
|
@@ -286,9 +317,9 @@ export interface ExecuteResponse {
|
|
|
286
317
|
/** Unique identifier for this execution record */
|
|
287
318
|
execution_id: string;
|
|
288
319
|
/** The tool that was executed */
|
|
289
|
-
tool_id
|
|
320
|
+
tool_id?: string;
|
|
290
321
|
/** The parameters that were passed to the tool */
|
|
291
|
-
parameters
|
|
322
|
+
parameters?: Record<string, unknown>;
|
|
292
323
|
/**
|
|
293
324
|
* The execution result.
|
|
294
325
|
* Contains either `data` (if within size limit) or truncation info.
|
|
@@ -316,6 +347,40 @@ export interface ExecuteResponse {
|
|
|
316
347
|
/** Timestamp of execution (ISO 8601 format) */
|
|
317
348
|
created_at?: string;
|
|
318
349
|
}
|
|
350
|
+
export type ProbeCheck = 'schema' | 'quote' | 'coverage' | 'sample';
|
|
351
|
+
export type ProbeLiveBudget = 'none' | 'metadata' | 'sampled';
|
|
352
|
+
export interface ProbeRequest {
|
|
353
|
+
parameters?: Record<string, unknown>;
|
|
354
|
+
checks?: ProbeCheck[];
|
|
355
|
+
live_budget?: ProbeLiveBudget;
|
|
356
|
+
}
|
|
357
|
+
export interface ProbeSchemaViolation {
|
|
358
|
+
param?: string | null;
|
|
359
|
+
type: string;
|
|
360
|
+
message: string;
|
|
361
|
+
}
|
|
362
|
+
export interface ProbeSchemaResult {
|
|
363
|
+
valid: boolean;
|
|
364
|
+
violations?: ProbeSchemaViolation[] | null;
|
|
365
|
+
note?: string | null;
|
|
366
|
+
}
|
|
367
|
+
export interface ProbeQuoteResult {
|
|
368
|
+
estimate_credits?: number | null;
|
|
369
|
+
currency: 'credits';
|
|
370
|
+
exact: boolean;
|
|
371
|
+
basis?: string | null;
|
|
372
|
+
detail?: Record<string, unknown> | null;
|
|
373
|
+
}
|
|
374
|
+
export interface ProbeUnknownResult {
|
|
375
|
+
verdict: 'unknown';
|
|
376
|
+
reason: string;
|
|
377
|
+
}
|
|
378
|
+
export interface ProbeResponse {
|
|
379
|
+
schema?: ProbeSchemaResult;
|
|
380
|
+
quote?: ProbeQuoteResult;
|
|
381
|
+
coverage?: ProbeUnknownResult;
|
|
382
|
+
sample?: ProbeUnknownResult;
|
|
383
|
+
}
|
|
319
384
|
export interface ApiEnvelope<T> {
|
|
320
385
|
status: string;
|
|
321
386
|
message?: string;
|
|
@@ -436,7 +501,7 @@ export interface QverisClientConfig {
|
|
|
436
501
|
/**
|
|
437
502
|
* Error response from the Qveris API.
|
|
438
503
|
*/
|
|
439
|
-
export type ApiOperation = 'discover' | 'inspect' | 'call' | 'credits' | 'usage_history' | 'credits_ledger';
|
|
504
|
+
export type ApiOperation = 'discover' | 'inspect' | 'probe' | 'call' | 'credits' | 'usage_history' | 'credits_ledger';
|
|
440
505
|
export type ApiErrorType = 'http_error' | 'invalid_json' | 'timeout' | 'network_error';
|
|
441
506
|
export interface ApiObservability {
|
|
442
507
|
source: 'qveris_api';
|