veryfront 0.1.945 → 0.1.947
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/esm/cli/commands/eval/command.d.ts +8 -1
- package/esm/cli/commands/eval/command.d.ts.map +1 -1
- package/esm/cli/commands/eval/command.js +18 -1
- package/esm/cli/commands/workflow/command.d.ts.map +1 -1
- package/esm/cli/commands/workflow/command.js +0 -7
- package/esm/cli/shared/project-source-context.d.ts +1 -0
- package/esm/cli/shared/project-source-context.d.ts.map +1 -1
- package/esm/cli/shared/project-source-context.js +8 -0
- package/esm/deno.js +1 -1
- package/esm/src/agent/runtime/index.d.ts.map +1 -1
- package/esm/src/agent/runtime/index.js +12 -10
- package/esm/src/eval/index.d.ts +2 -0
- package/esm/src/eval/index.d.ts.map +1 -1
- package/esm/src/eval/index.js +1 -0
- package/esm/src/eval/judges.d.ts +28 -0
- package/esm/src/eval/judges.d.ts.map +1 -0
- package/esm/src/eval/judges.js +194 -0
- package/esm/src/eval/metrics.d.ts.map +1 -1
- package/esm/src/eval/metrics.js +54 -4
- package/esm/src/integrations/schema.d.ts +4 -4
- package/esm/src/knowledge/index.d.ts +5 -3
- package/esm/src/knowledge/index.d.ts.map +1 -1
- package/esm/src/knowledge/index.js +62 -9
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AgentResponse } from "../../../src/agent/index.js";
|
|
2
|
+
import type { VeryfrontConfig } from "../../../src/config/index.js";
|
|
3
|
+
import type { DiscoveredEval, EvalReport, EvalReportComparison, EvalToolCall } from "../../../src/eval/index.js";
|
|
2
4
|
import type { EvalArgs } from "./handler.js";
|
|
3
5
|
export interface EvalOptions extends EvalArgs {
|
|
4
6
|
}
|
|
@@ -40,6 +42,11 @@ export declare function createResultsJsonl(report: EvalReport): string;
|
|
|
40
42
|
export declare function createJunitXml(report: EvalReport): string;
|
|
41
43
|
export declare function writeEvalArtifacts(report: EvalReport, paths: EvalArtifactPaths, baseline?: EvalReportComparison): Promise<void>;
|
|
42
44
|
export declare function createEvalExitCode(report: EvalReport, baseline?: EvalReportComparison): 0 | 1;
|
|
45
|
+
type EvalRuntimeAuthConfig = Pick<VeryfrontConfig, "projectSlug" | "fs"> & {
|
|
46
|
+
projectSlug?: string;
|
|
47
|
+
};
|
|
48
|
+
export declare function hydrateEvalRuntimeAuth(projectDir: string, config: EvalRuntimeAuthConfig | null | undefined): Promise<import("../../shared/runtime-auth.js").RuntimeAuthContext>;
|
|
49
|
+
export declare function normalizeToolCalls(response: AgentResponse): EvalToolCall[];
|
|
43
50
|
export declare function evalCommand(options: EvalOptions): Promise<void>;
|
|
44
51
|
export {};
|
|
45
52
|
//# sourceMappingURL=command.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/eval/command.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/eval/command.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAS,aAAa,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,KAAK,EACV,cAAc,EAId,UAAU,EACV,oBAAoB,EAEpB,YAAY,EACb,MAAM,4BAA4B,CAAC;AAYpC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE7C,MAAM,WAAW,WAAY,SAAQ,QAAQ;CAAG;AAEhD,KAAK,cAAc,GAAG;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC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GAAG,MAAM,CAG7D;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CA0CzD;AAQD,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,UAAU,EAClB,KAAK,EAAE,iBAAiB,EACxB,QAAQ,CAAC,EAAE,oBAAoB,GAC9B,OAAO,CAAC,IAAI,CAAC,CAOf;AAMD,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,UAAU,EAClB,QAAQ,CAAC,EAAE,oBAAoB,GAC9B,CAAC,GAAG,CAAC,CAEP;AAMD,KAAK,qBAAqB,GAAG,IAAI,CAAC,eAAe,EAAE,aAAa,GAAG,IAAI,CAAC,GAAG;IACzE,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAQF,wBAAsB,sBAAsB,CAC1C,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,qBAAqB,GAAG,IAAI,GAAG,SAAS,sEAMjD;AAYD,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,aAAa,GAAG,YAAY,EAAE,CAY1E;AAgID,wBAAsB,WAAW,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAiHrE"}
|
|
@@ -5,6 +5,7 @@ import * as dntShim from "../../../_dnt.shims.js";
|
|
|
5
5
|
import { dirname, join, relative } from "../../../deps/jsr.io/@std/path/1.1.4/mod.js";
|
|
6
6
|
import { createProjectDiscoveryConfig, discoverAll } from "../../../src/discovery/index.js";
|
|
7
7
|
import { compareEvalReports, discoverEvals, runEval } from "../../../src/eval/index.js";
|
|
8
|
+
import { applyRuntimeAuthContext } from "../../shared/runtime-auth.js";
|
|
8
9
|
import { cliLogger, exitProcess } from "../../utils/index.js";
|
|
9
10
|
import { createErrorEnvelope, createSuccessEnvelope, isJsonMode, outputJson, } from "../../shared/json-output.js";
|
|
10
11
|
import { withProjectSourceContext } from "../../shared/project-source-context.js";
|
|
@@ -164,6 +165,15 @@ export function createEvalExitCode(report, baseline) {
|
|
|
164
165
|
function resolveAgentTargetId(target) {
|
|
165
166
|
return target.startsWith("agent:") ? target.slice("agent:".length) : target;
|
|
166
167
|
}
|
|
168
|
+
function resolveEvalRuntimeProjectSlug(config) {
|
|
169
|
+
return config?.projectSlug ?? config?.fs?.veryfront?.projectSlug;
|
|
170
|
+
}
|
|
171
|
+
export async function hydrateEvalRuntimeAuth(projectDir, config) {
|
|
172
|
+
return await applyRuntimeAuthContext({
|
|
173
|
+
projectDir,
|
|
174
|
+
projectSlug: resolveEvalRuntimeProjectSlug(config),
|
|
175
|
+
});
|
|
176
|
+
}
|
|
167
177
|
function normalizeUsage(response) {
|
|
168
178
|
return response.usage
|
|
169
179
|
? {
|
|
@@ -173,11 +183,17 @@ function normalizeUsage(response) {
|
|
|
173
183
|
}
|
|
174
184
|
: {};
|
|
175
185
|
}
|
|
176
|
-
function normalizeToolCalls(response) {
|
|
186
|
+
export function normalizeToolCalls(response) {
|
|
177
187
|
return response.toolCalls.map((toolCall) => ({
|
|
188
|
+
id: toolCall.id,
|
|
178
189
|
name: toolCall.name,
|
|
179
190
|
status: toolCall.status === "error" ? "error" : "ok",
|
|
191
|
+
input: toolCall.args,
|
|
192
|
+
...(Object.hasOwn(toolCall, "result") ? { output: toolCall.result } : {}),
|
|
180
193
|
...(toolCall.error ? { error: toolCall.error } : {}),
|
|
194
|
+
...(toolCall.executionTime !== undefined
|
|
195
|
+
? { metadata: { executionTime: toolCall.executionTime } }
|
|
196
|
+
: {}),
|
|
181
197
|
}));
|
|
182
198
|
}
|
|
183
199
|
function createAgentAdapter(agent, options) {
|
|
@@ -288,6 +304,7 @@ async function outputAgentNotFound(agentId) {
|
|
|
288
304
|
export async function evalCommand(options) {
|
|
289
305
|
const projectDir = dntShim.Deno.cwd();
|
|
290
306
|
await withProjectSourceContext(projectDir, async ({ adapter, config }) => {
|
|
307
|
+
await hydrateEvalRuntimeAuth(projectDir, config);
|
|
291
308
|
const evalDiscovery = await discoverEvals({ projectDir, adapter, config });
|
|
292
309
|
if (options.debug) {
|
|
293
310
|
for (const error of evalDiscovery.errors) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/workflow/command.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/workflow/command.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,2BAA2B,EAAE,MAAM,6CAA6C,CAAC;AAO1F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAKjD,MAAM,WAAW,eAAgB,SAAQ,YAAY;IACnD,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,UAAU,2BAA2B;IACnC,2BAA2B,CAAC,EAAE,OAAO,2BAA2B,CAAC;CAClE;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,sBAAsB,EAAE,GAC/B,MAAM,EAAE,CAUV;AAuFD,wBAAsB,eAAe,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAE7E;AAED,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,eAAe,EACxB,YAAY,GAAE,2BAAgC,GAC7C,OAAO,CAAC,IAAI,CAAC,CA8Ff"}
|
|
@@ -2,7 +2,6 @@ import * as dntShim from "../../../_dnt.shims.js";
|
|
|
2
2
|
import { cliLogger } from "../../utils/index.js";
|
|
3
3
|
import { exitProcess } from "../../utils/index.js";
|
|
4
4
|
import { withProjectSourceContext } from "../../shared/project-source-context.js";
|
|
5
|
-
import { applyRuntimeAuthContext } from "../../shared/runtime-auth.js";
|
|
6
5
|
import { agentRegistry } from "../../../src/agent/composition/index.js";
|
|
7
6
|
import { discoverProjectAgentRuntime } from "../../../src/agent/project/agent-runtime.js";
|
|
8
7
|
import { toolRegistry } from "../../../src/tool/registry.js";
|
|
@@ -108,12 +107,6 @@ export async function runWorkflowCommand(options, dependencies = {}) {
|
|
|
108
107
|
}
|
|
109
108
|
}
|
|
110
109
|
const projectDir = options.projectDir ?? dntShim.Deno.cwd();
|
|
111
|
-
const { readConfigFile } = await import("../../shared/config.js");
|
|
112
|
-
const configFile = await readConfigFile(projectDir);
|
|
113
|
-
await applyRuntimeAuthContext({
|
|
114
|
-
projectDir,
|
|
115
|
-
projectSlug: configFile?.projectSlug,
|
|
116
|
-
});
|
|
117
110
|
const discoverRuntime = dependencies.discoverProjectAgentRuntime ??
|
|
118
111
|
discoverProjectAgentRuntime;
|
|
119
112
|
await withProjectSourceContext(projectDir, async ({ adapter, proxyContext }) => {
|
|
@@ -14,6 +14,7 @@ export interface ProjectSourceExecutionContext {
|
|
|
14
14
|
proxyContext?: ProxyProjectSourceContext;
|
|
15
15
|
}
|
|
16
16
|
export declare function getProxyProjectSourceContext(): ProxyProjectSourceContext | null;
|
|
17
|
+
export declare function applyProjectSourceRuntimeAuth(projectDir: string, config: VeryfrontConfig): Promise<import("./runtime-auth.js").RuntimeAuthContext>;
|
|
17
18
|
export declare function withProjectSourceContext<T>(projectDir: string, run: (context: ProjectSourceExecutionContext) => Promise<T>): Promise<T>;
|
|
18
19
|
export {};
|
|
19
20
|
//# sourceMappingURL=project-source-context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project-source-context.d.ts","sourceRoot":"","sources":["../../../src/cli/shared/project-source-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5E,OAAO,EAKL,KAAK,cAAc,EACpB,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"project-source-context.d.ts","sourceRoot":"","sources":["../../../src/cli/shared/project-source-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5E,OAAO,EAKL,KAAK,cAAc,EACpB,MAAM,6BAA6B,CAAC;AAGrC,UAAU,yBAAyB;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED,MAAM,WAAW,6BAA6B;IAC5C,OAAO,EAAE,cAAc,CAAC;IACxB,MAAM,EAAE,eAAe,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,yBAAyB,CAAC;CAC1C;AAED,wBAAgB,4BAA4B,IAAI,yBAAyB,GAAG,IAAI,CAkB/E;AAWD,wBAAsB,6BAA6B,CACjD,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,eAAe,2DAMxB;AAED,wBAAsB,wBAAwB,CAAC,CAAC,EAC9C,UAAU,EAAE,MAAM,EAClB,GAAG,EAAE,CAAC,OAAO,EAAE,6BAA6B,KAAK,OAAO,CAAC,CAAC,CAAC,GAC1D,OAAO,CAAC,CAAC,CAAC,CAyCZ"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getConfig } from "../../src/config/index.js";
|
|
2
2
|
import { enhanceAdapterWithFS, getEnv, isExtendedFSAdapter, runtime, } from "../../src/platform/index.js";
|
|
3
|
+
import { applyRuntimeAuthContext } from "./runtime-auth.js";
|
|
3
4
|
export function getProxyProjectSourceContext() {
|
|
4
5
|
const projectSlug = getEnv("VERYFRONT_PROJECT_SLUG")?.trim();
|
|
5
6
|
const token = getEnv("VERYFRONT_API_TOKEN")?.trim();
|
|
@@ -20,9 +21,16 @@ async function loadProjectConfig(projectDir, adapter, proxyContext) {
|
|
|
20
21
|
const cacheKey = proxyContext?.projectId ?? proxyContext?.projectSlug;
|
|
21
22
|
return await getConfig(projectDir, adapter, cacheKey ? { cacheKey } : undefined);
|
|
22
23
|
}
|
|
24
|
+
export async function applyProjectSourceRuntimeAuth(projectDir, config) {
|
|
25
|
+
return await applyRuntimeAuthContext({
|
|
26
|
+
projectDir,
|
|
27
|
+
projectSlug: config.projectSlug ?? config.fs?.veryfront?.projectSlug,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
23
30
|
export async function withProjectSourceContext(projectDir, run) {
|
|
24
31
|
const baseAdapter = await runtime.get();
|
|
25
32
|
const initialConfig = await getConfig(projectDir, baseAdapter);
|
|
33
|
+
await applyProjectSourceRuntimeAuth(projectDir, initialConfig);
|
|
26
34
|
const adapter = await enhanceAdapterWithFS(baseAdapter, initialConfig, projectDir);
|
|
27
35
|
const proxyContext = getProxyProjectSourceContext();
|
|
28
36
|
if (proxyContext &&
|
package/esm/deno.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EACL,KAAK,WAAW,EAEhB,KAAK,aAAa,EAGlB,KAAK,OAAO,EAGZ,KAAK,QAAQ,EAGd,MAAM,aAAa,CAAC;AAIrB,OAAO,EAAqB,KAAK,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAsDpE,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC5E,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EACjB,uBAAuB,EACvB,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACV,8BAA8B,EAC9B,gBAAgB,EAChB,wBAAwB,GACzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EACjB,aAAa,EACb,aAAa,GACd,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,EACL,sB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,EAAE,MAAM,EACtB,uBAAuB,CAAC,EAAE,MAAM,GAC/B,OAAO,CAAC,aAAa,CAAC;IAoDzB;;;OAGG;IACG,MAAM,CACV,QAAQ,EAAE,OAAO,EAAE,EACnB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACjC,SAAS,CAAC,EAAE;QACV,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,IAAI,CAAC;QAC1C,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;QAClC,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,aAAa,KAAK,IAAI,CAAC;KAC9C,EACD,aAAa,CAAC,EAAE,MAAM,EACtB,uBAAuB,CAAC,EAAE,MAAM,EAChC,WAAW,CAAC,EAAE,WAAW,GACxB,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;IAmJtC;;OAEG;YACW,gBAAgB;IA6T9B;;;;OAIG;YACW,yBAAyB;IA+evC;;OAEG;YACW,eAAe;IAgC7B;;OAEG;YACW,mBAAmB;IAOjC;;OAEG;IACH,OAAO,CAAC,eAAe;IAKvB,OAAO,CAAC,kBAAkB;IAO1B,OAAO,CAAC,sBAAsB;IAoB9B;;OAEG;IACH,SAAS,IAAI,MAAM,CAAC,OAAO,CAAC;IAI5B;;OAEG;IACG,cAAc,IAAI,OAAO,CAAC;QAC9B,aAAa,EAAE,MAAM,CAAC;QACtB,eAAe,EAAE,MAAM,CAAC;QACxB,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IAIF;;OAEG;IACG,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;CAGnC"}
|
|
@@ -51,7 +51,7 @@ import { supportsTemperatureParameter } from "./model-capabilities.js";
|
|
|
51
51
|
import { applySkillDelegationOverridesToToolInput, extractSkillDelegationOverrides, } from "./skill-delegation-overrides.js";
|
|
52
52
|
import { resolveAgentModelTransport } from "./model-transport.js";
|
|
53
53
|
const logger = serverLogger.component("agent");
|
|
54
|
-
function
|
|
54
|
+
function shouldHideProjectToolAfterAgentWriteSuccess(toolName) {
|
|
55
55
|
return toolName === "create_agent" || toolName === "update_agent";
|
|
56
56
|
}
|
|
57
57
|
function parseToolResultJson(result) {
|
|
@@ -583,7 +583,7 @@ export class AgentRuntime {
|
|
|
583
583
|
const remoteToolSources = getRuntimeRemoteToolSources(this.config);
|
|
584
584
|
let currentSystemPrompt = systemPrompt;
|
|
585
585
|
let currentRuntimeContext = runtimeContext;
|
|
586
|
-
let
|
|
586
|
+
let agentWriteFinalResponseToolGuardEnabled = false;
|
|
587
587
|
for (let step = 0; step < maxSteps; step++) {
|
|
588
588
|
throwIfAborted(abortSignal);
|
|
589
589
|
sendSSE(controller, encoder, { type: "step-start" });
|
|
@@ -611,8 +611,10 @@ export class AgentRuntime {
|
|
|
611
611
|
currentSystemPrompt = preparedStep.systemPrompt;
|
|
612
612
|
currentRuntimeContext = preparedStep.runtimeContext;
|
|
613
613
|
const toolContext = preparedStep.toolContext;
|
|
614
|
-
const tools =
|
|
615
|
-
|
|
614
|
+
const tools = agentWriteFinalResponseToolGuardEnabled
|
|
615
|
+
? preparedStep.tools.filter((tool) => !shouldHideProjectToolAfterAgentWriteSuccess(tool.name))
|
|
616
|
+
: preparedStep.tools;
|
|
617
|
+
const stepProviderTools = agentWriteFinalResponseToolGuardEnabled ? [] : providerTools;
|
|
616
618
|
const runtimeTools = convertToolsToRuntimeTools(tools, {
|
|
617
619
|
model: effectiveModel,
|
|
618
620
|
providerTools: stepProviderTools,
|
|
@@ -771,8 +773,8 @@ export class AgentRuntime {
|
|
|
771
773
|
: stringifyToolError(matchingResult.error);
|
|
772
774
|
toolCalls.push(toolCall);
|
|
773
775
|
if (matchingResult.error === undefined) {
|
|
774
|
-
if (
|
|
775
|
-
|
|
776
|
+
if (shouldHideProjectToolAfterAgentWriteSuccess(tc.name)) {
|
|
777
|
+
agentWriteFinalResponseToolGuardEnabled = true;
|
|
776
778
|
}
|
|
777
779
|
if (tc.name === LOAD_SKILL_TOOL_ID) {
|
|
778
780
|
activeSkillId = extractSkillId(matchingResult.output);
|
|
@@ -795,8 +797,8 @@ export class AgentRuntime {
|
|
|
795
797
|
toolCall.error = persistedError;
|
|
796
798
|
toolCalls.push(toolCall);
|
|
797
799
|
if (persistedError === undefined) {
|
|
798
|
-
if (
|
|
799
|
-
|
|
800
|
+
if (shouldHideProjectToolAfterAgentWriteSuccess(tc.name)) {
|
|
801
|
+
agentWriteFinalResponseToolGuardEnabled = true;
|
|
800
802
|
}
|
|
801
803
|
if (tc.name === LOAD_SKILL_TOOL_ID) {
|
|
802
804
|
activeSkillId = extractSkillId(persistedResult.result);
|
|
@@ -877,8 +879,8 @@ export class AgentRuntime {
|
|
|
877
879
|
hasSubmittedFormInputInLoop = true;
|
|
878
880
|
currentRuntimeContext = markSubmittedFormInputRuntimeContext(currentRuntimeContext);
|
|
879
881
|
}
|
|
880
|
-
if (
|
|
881
|
-
|
|
882
|
+
if (shouldHideProjectToolAfterAgentWriteSuccess(tc.name)) {
|
|
883
|
+
agentWriteFinalResponseToolGuardEnabled = true;
|
|
882
884
|
}
|
|
883
885
|
const dynamic = isDynamicTool(tc.name);
|
|
884
886
|
sendSSE(controller, encoder, {
|
package/esm/src/eval/index.d.ts
CHANGED
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
import "../../_dnt.polyfills.js";
|
|
46
46
|
export { datasets } from "./datasets.js";
|
|
47
47
|
export { evalAgent, isEvalDefinition } from "./factory.js";
|
|
48
|
+
export { judges } from "./judges.js";
|
|
48
49
|
export { metrics } from "./metrics.js";
|
|
49
50
|
export { createEvalReport, summarizeEvalRecords } from "./report.js";
|
|
50
51
|
export { compareEvalReports } from "./baseline.js";
|
|
@@ -52,6 +53,7 @@ export { runEval } from "./runner.js";
|
|
|
52
53
|
export { deriveEvalId, discoverEvals, findEvalById } from "./discovery.js";
|
|
53
54
|
export { createEvalSourceDocument, getEvalEditableFieldSchema, getEvalRunSchema, getEvalSourceDocumentSchema, getEvalSourcePatchSchema, getEvalSourceReferenceSchema, getEvalStudioCapabilitySchema, } from "./studio.js";
|
|
54
55
|
export type { DiscoveredEval, EvalDiscoveryOptions, EvalDiscoveryResult } from "./discovery.js";
|
|
56
|
+
export type { EvalLlmGroundednessJudgeOptions } from "./judges.js";
|
|
55
57
|
export type { EvalAgentAdapter, EvalAgentAdapterContext, EvalAgentAdapterResult, EvalAgentInput, EvalAnswerGroundednessMetricOptions, EvalCheckContext, EvalDataset, EvalDatasetLoadContext, EvalDefinition, EvalDurationSummary, EvalExample, EvalExampleInput, EvalExpect, EvalExpectation, EvalFailedExampleSummary, EvalFlakeSummary, EvalGateFailureSummary, EvalKnowledgeExpectedSource, EvalKnowledgeMrrMetricOptions, EvalKnowledgeRetrievalMetricOptions, EvalMetric, EvalMetricContext, EvalMetricDeltaSummary, EvalMetricFamily, EvalMetricResult, EvalMetricSummary, EvalMetricThreshold, EvalRecord, EvalReport, EvalReportComparison, EvalReportExportConfig, EvalReportSummary, EvalSeverity, EvalSource, EvalTargetKind, EvalToolCall, EvalToolCallCountOptions, EvalToolCallMatchOptions, EvalToolCallStatus, EvalToolInputMatchMode, EvalTrace, EvalUsage, EvalUsageSummary, RunEvalOptions, } from "./types.js";
|
|
56
58
|
export type { CreateEvalSourceDocumentOptions, EvalEditableField, EvalRun, EvalSourceDocument, EvalSourcePatch, EvalSourceReference, EvalStudioCapability, } from "./studio.js";
|
|
57
59
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/src/eval/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,OAAO,yBAAyB,CAAC;AAGjC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,cAAc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ACjB,sBAAsB,EACtB,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,UAAU,EACV,UAAU,EACV,oBAAoB,EACpB,sBAAsB,EACtB,iBAAiB,EACjB,YAAY,EACZ,UAAU,EACV,cAAc,EACd,YAAY,EACZ,wBAAwB,EACxB,wBAAwB,EACxB,kBAAkB,EAClB,sBAAsB,EACtB,SAAS,EACT,SAAS,EACT,gBAAgB,EAChB,cAAc,GACf,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,+BAA+B,EAC/B,iBAAiB,EACjB,OAAO,EACP,kBAAkB,EAClB,eAAe,EACf,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,aAAa,CAAC"}
|
package/esm/src/eval/index.js
CHANGED
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
import "../../_dnt.polyfills.js";
|
|
46
46
|
export { datasets } from "./datasets.js";
|
|
47
47
|
export { evalAgent, isEvalDefinition } from "./factory.js";
|
|
48
|
+
export { judges } from "./judges.js";
|
|
48
49
|
export { metrics } from "./metrics.js";
|
|
49
50
|
export { createEvalReport, summarizeEvalRecords } from "./report.js";
|
|
50
51
|
export { compareEvalReports } from "./baseline.js";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type ModelRuntime } from "../provider/index.js";
|
|
2
|
+
import type { EvalAnswerGroundednessMetricOptions } from "./types.js";
|
|
3
|
+
type GroundednessJudge = NonNullable<EvalAnswerGroundednessMetricOptions["judge"]>;
|
|
4
|
+
/** Options for the built-in LLM groundedness judge. */
|
|
5
|
+
export interface EvalLlmGroundednessJudgeOptions {
|
|
6
|
+
/** Model id or runtime used to judge answer grounding. Defaults to the runtime auto model. */
|
|
7
|
+
model?: string | ModelRuntime;
|
|
8
|
+
/** Minimum score required for the judge to pass. Defaults to 0.8. */
|
|
9
|
+
threshold?: number;
|
|
10
|
+
/** Maximum retrieved evidence characters included in the judge prompt. Defaults to 12000. */
|
|
11
|
+
maxEvidenceChars?: number;
|
|
12
|
+
/** Maximum judge response tokens. Defaults to 800. */
|
|
13
|
+
maxOutputTokens?: number;
|
|
14
|
+
/** Judge model temperature. Defaults to 0 for repeatability. */
|
|
15
|
+
temperature?: number;
|
|
16
|
+
/** Provider-specific options forwarded to the model runtime. */
|
|
17
|
+
providerOptions?: Record<string, unknown>;
|
|
18
|
+
}
|
|
19
|
+
declare function createLlmGroundednessJudge(options?: EvalLlmGroundednessJudgeOptions): GroundednessJudge;
|
|
20
|
+
/** Built-in judge factories for semantic eval metrics. */
|
|
21
|
+
export declare const judges: {
|
|
22
|
+
readonly llm: {
|
|
23
|
+
/** Create an LLM judge for `metrics.answer.groundedness`. */
|
|
24
|
+
readonly groundedness: typeof createLlmGroundednessJudge;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=judges.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"judges.d.ts","sourceRoot":"","sources":["../../../src/src/eval/judges.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,YAAY,EAAgB,MAAM,sBAAsB,CAAC;AAGvE,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,YAAY,CAAC;AAEtE,KAAK,iBAAiB,GAAG,WAAW,CAAC,mCAAmC,CAAC,OAAO,CAAC,CAAC,CAAC;AAEnF,uDAAuD;AACvD,MAAM,WAAW,+BAA+B;IAC9C,8FAA8F;IAC9F,KAAK,CAAC,EAAE,MAAM,GAAG,YAAY,CAAC;IAC9B,qEAAqE;IACrE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6FAA6F;IAC7F,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,sDAAsD;IACtD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gEAAgE;IAChE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gEAAgE;IAChE,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC3C;AAkLD,iBAAS,0BAA0B,CACjC,OAAO,GAAE,+BAAoC,GAC5C,iBAAiB,CAoBnB;AAED,0DAA0D;AAC1D,eAAO,MAAM,MAAM;;QAEf,6DAA6D;;;CAGvD,CAAC"}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { resolveRuntimeModel } from "../agent/runtime/model-resolution.js";
|
|
2
|
+
import { resolveModel } from "../provider/index.js";
|
|
3
|
+
import { generateText } from "../runtime/runtime-bridge.js";
|
|
4
|
+
const DEFAULT_JUDGE_MODEL = "auto";
|
|
5
|
+
const DEFAULT_THRESHOLD = 0.8;
|
|
6
|
+
const DEFAULT_MAX_EVIDENCE_CHARS = 12_000;
|
|
7
|
+
const DEFAULT_MAX_OUTPUT_TOKENS = 800;
|
|
8
|
+
function asJson(value) {
|
|
9
|
+
try {
|
|
10
|
+
return JSON.stringify(value, null, 2);
|
|
11
|
+
}
|
|
12
|
+
catch {
|
|
13
|
+
return String(value);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function clampScore(score) {
|
|
17
|
+
if (!Number.isFinite(score))
|
|
18
|
+
return 0;
|
|
19
|
+
return Math.max(0, Math.min(1, score));
|
|
20
|
+
}
|
|
21
|
+
function resolveJudgeModel(model) {
|
|
22
|
+
if (model && typeof model === "object")
|
|
23
|
+
return model;
|
|
24
|
+
return resolveModel(resolveRuntimeModel(model ?? DEFAULT_JUDGE_MODEL));
|
|
25
|
+
}
|
|
26
|
+
function truncate(value, maxChars) {
|
|
27
|
+
if (value.length <= maxChars)
|
|
28
|
+
return value;
|
|
29
|
+
return `${value.slice(0, Math.max(0, maxChars - 24))}\n[truncated]`;
|
|
30
|
+
}
|
|
31
|
+
function buildEvidenceBlock(evidence, sources, maxChars) {
|
|
32
|
+
const entries = evidence.length > 0 ? evidence : ["No retrieved evidence was provided."];
|
|
33
|
+
const block = entries.map((entry, index) => {
|
|
34
|
+
const source = sources[index] ?? `evidence-${index + 1}`;
|
|
35
|
+
return `[${index + 1}] ${source}\n${entry}`;
|
|
36
|
+
}).join("\n\n");
|
|
37
|
+
return truncate(block, maxChars);
|
|
38
|
+
}
|
|
39
|
+
function buildGroundednessPrompt(input, options) {
|
|
40
|
+
return `Evaluate whether an agent answer is grounded in retrieved evidence.
|
|
41
|
+
|
|
42
|
+
Rubric:
|
|
43
|
+
${input.rubric}
|
|
44
|
+
|
|
45
|
+
Rules:
|
|
46
|
+
- Grade only against the evidence and the reference.
|
|
47
|
+
- Treat unsupported factual claims, unsupported instructions, or missing required actions as failures.
|
|
48
|
+
- Do not reward keyword overlap by itself. Judge semantic support.
|
|
49
|
+
- Use score 1.0 only when all material claims are supported and the answer satisfies the reference.
|
|
50
|
+
- Use score 0.8 for mostly grounded answers with only minor omissions.
|
|
51
|
+
- Use score 0.5 for partially grounded answers with material omissions.
|
|
52
|
+
- Use score 0.0 for ungrounded, contradictory, or non-responsive answers.
|
|
53
|
+
- Pass only when score is at least ${options.threshold}.
|
|
54
|
+
|
|
55
|
+
Return only valid JSON with this shape:
|
|
56
|
+
{
|
|
57
|
+
"score": 0.0,
|
|
58
|
+
"pass": false,
|
|
59
|
+
"explanation": "Short reason.",
|
|
60
|
+
"unsupportedClaims": ["claim not supported by evidence"],
|
|
61
|
+
"missingEvidence": ["required point missing from the answer"]
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
Input:
|
|
65
|
+
${asJson(input.input)}
|
|
66
|
+
|
|
67
|
+
Reference:
|
|
68
|
+
${asJson(input.reference)}
|
|
69
|
+
|
|
70
|
+
Metadata:
|
|
71
|
+
${asJson(input.metadata)}
|
|
72
|
+
|
|
73
|
+
Answer:
|
|
74
|
+
${asJson(input.output)}
|
|
75
|
+
|
|
76
|
+
Evidence:
|
|
77
|
+
${buildEvidenceBlock(input.evidence, input.sources, options.maxEvidenceChars)}
|
|
78
|
+
`;
|
|
79
|
+
}
|
|
80
|
+
function stripJsonFence(value) {
|
|
81
|
+
const trimmed = value.trim();
|
|
82
|
+
if (!trimmed.startsWith("```"))
|
|
83
|
+
return trimmed;
|
|
84
|
+
return trimmed.replace(/^```(?:json)?\s*/i, "").replace(/\s*```$/, "").trim();
|
|
85
|
+
}
|
|
86
|
+
function extractJsonObject(value) {
|
|
87
|
+
const stripped = stripJsonFence(value);
|
|
88
|
+
try {
|
|
89
|
+
JSON.parse(stripped);
|
|
90
|
+
return stripped;
|
|
91
|
+
}
|
|
92
|
+
catch {
|
|
93
|
+
// Continue and extract the first balanced object from explanatory text.
|
|
94
|
+
}
|
|
95
|
+
const start = stripped.indexOf("{");
|
|
96
|
+
if (start === -1)
|
|
97
|
+
return null;
|
|
98
|
+
let depth = 0;
|
|
99
|
+
let inString = false;
|
|
100
|
+
let escaped = false;
|
|
101
|
+
for (let index = start; index < stripped.length; index++) {
|
|
102
|
+
const char = stripped[index];
|
|
103
|
+
if (escaped) {
|
|
104
|
+
escaped = false;
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
if (inString && char === "\\") {
|
|
108
|
+
escaped = true;
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
111
|
+
if (char === '"') {
|
|
112
|
+
inString = !inString;
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
if (inString)
|
|
116
|
+
continue;
|
|
117
|
+
if (char === "{")
|
|
118
|
+
depth += 1;
|
|
119
|
+
if (char === "}")
|
|
120
|
+
depth -= 1;
|
|
121
|
+
if (depth === 0)
|
|
122
|
+
return stripped.slice(start, index + 1);
|
|
123
|
+
}
|
|
124
|
+
return null;
|
|
125
|
+
}
|
|
126
|
+
function stringList(value) {
|
|
127
|
+
if (!Array.isArray(value))
|
|
128
|
+
return [];
|
|
129
|
+
return value.filter((item) => typeof item === "string" && item.trim() !== "");
|
|
130
|
+
}
|
|
131
|
+
function parseJudgeResponse(text, threshold) {
|
|
132
|
+
const json = extractJsonObject(text);
|
|
133
|
+
if (!json) {
|
|
134
|
+
return {
|
|
135
|
+
score: 0,
|
|
136
|
+
pass: false,
|
|
137
|
+
explanation: "LLM judge did not return valid JSON.",
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
try {
|
|
141
|
+
const parsed = JSON.parse(json);
|
|
142
|
+
const score = clampScore(typeof parsed.score === "number" ? parsed.score : 0);
|
|
143
|
+
const modelPass = typeof parsed.pass === "boolean" ? parsed.pass : true;
|
|
144
|
+
const unsupportedClaims = stringList(parsed.unsupportedClaims);
|
|
145
|
+
const missingEvidence = stringList(parsed.missingEvidence);
|
|
146
|
+
const details = [
|
|
147
|
+
typeof parsed.explanation === "string" && parsed.explanation.trim()
|
|
148
|
+
? parsed.explanation.trim()
|
|
149
|
+
: "LLM judge returned a structured groundedness score.",
|
|
150
|
+
...(unsupportedClaims.length > 0
|
|
151
|
+
? [`Unsupported claims: ${unsupportedClaims.join("; ")}`]
|
|
152
|
+
: []),
|
|
153
|
+
...(missingEvidence.length > 0 ? [`Missing evidence: ${missingEvidence.join("; ")}`] : []),
|
|
154
|
+
];
|
|
155
|
+
return {
|
|
156
|
+
score,
|
|
157
|
+
pass: modelPass && score >= threshold,
|
|
158
|
+
explanation: details.join(" "),
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
catch {
|
|
162
|
+
return {
|
|
163
|
+
score: 0,
|
|
164
|
+
pass: false,
|
|
165
|
+
explanation: "LLM judge returned malformed JSON.",
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
function createLlmGroundednessJudge(options = {}) {
|
|
170
|
+
const threshold = options.threshold ?? DEFAULT_THRESHOLD;
|
|
171
|
+
const maxEvidenceChars = options.maxEvidenceChars ?? DEFAULT_MAX_EVIDENCE_CHARS;
|
|
172
|
+
const maxOutputTokens = options.maxOutputTokens ?? DEFAULT_MAX_OUTPUT_TOKENS;
|
|
173
|
+
return async (input) => {
|
|
174
|
+
const model = resolveJudgeModel(options.model);
|
|
175
|
+
const response = await generateText({
|
|
176
|
+
model,
|
|
177
|
+
messages: [{
|
|
178
|
+
role: "user",
|
|
179
|
+
content: buildGroundednessPrompt(input, { threshold, maxEvidenceChars }),
|
|
180
|
+
}],
|
|
181
|
+
maxOutputTokens,
|
|
182
|
+
temperature: options.temperature ?? 0,
|
|
183
|
+
...(options.providerOptions ? { providerOptions: options.providerOptions } : {}),
|
|
184
|
+
});
|
|
185
|
+
return parseJudgeResponse(response.text, threshold);
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
/** Built-in judge factories for semantic eval metrics. */
|
|
189
|
+
export const judges = {
|
|
190
|
+
llm: {
|
|
191
|
+
/** Create an LLM judge for `metrics.answer.groundedness`. */
|
|
192
|
+
groundedness: createLlmGroundednessJudge,
|
|
193
|
+
},
|
|
194
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../../../src/src/eval/metrics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mCAAmC,EAEnC,6BAA6B,EAC7B,mCAAmC,EACnC,UAAU,EAMV,wBAAwB,EACxB,wBAAwB,EACzB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../../../src/src/eval/metrics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mCAAmC,EAEnC,6BAA6B,EAC7B,mCAAmC,EACnC,UAAU,EAMV,wBAAwB,EACxB,wBAAwB,EACzB,MAAM,YAAY,CAAC;AAkBpB,KAAK,gBAAgB,GAAG;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE;QACd,MAAM,EAAE,MAAM,CAAC;QACf,KAAK,EAAE,OAAO,CAAC;QACf,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAChC,SAAS,CAAC,EAAE,OAAO,CAAC;QACpB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACnC,KAAK,OAAO,CAAC;QAAE,KAAK,EA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|
26
26
|
"verification_quote",
|
|
27
27
|
"verificationQuote",
|
|
28
28
|
];
|
|
29
|
+
const KNOWLEDGE_MATCHED_FIELD_KEYS = ["matched_fields", "matchedFields"];
|
|
29
30
|
const KNOWLEDGE_STOP_WORDS = new Set([
|
|
30
31
|
"the",
|
|
31
32
|
"and",
|
|
@@ -112,19 +113,58 @@ function collectStringField(record, key) {
|
|
|
112
113
|
const value = record[key];
|
|
113
114
|
return typeof value === "string" && value.trim() ? [value] : [];
|
|
114
115
|
}
|
|
116
|
+
function collectLeafStrings(value) {
|
|
117
|
+
if (typeof value === "string")
|
|
118
|
+
return value.trim() ? [value] : [];
|
|
119
|
+
if (typeof value === "number" || typeof value === "boolean")
|
|
120
|
+
return [String(value)];
|
|
121
|
+
if (Array.isArray(value))
|
|
122
|
+
return value.flatMap(collectLeafStrings);
|
|
123
|
+
if (!isRecord(value))
|
|
124
|
+
return [];
|
|
125
|
+
return Object.values(value).flatMap(collectLeafStrings);
|
|
126
|
+
}
|
|
115
127
|
function collectFrontmatterValues(value) {
|
|
116
128
|
if (!Array.isArray(value))
|
|
117
|
-
return
|
|
129
|
+
return collectLeafStrings(value);
|
|
118
130
|
const values = [];
|
|
119
131
|
for (const entry of value) {
|
|
120
|
-
if (!isRecord(entry))
|
|
132
|
+
if (!isRecord(entry)) {
|
|
133
|
+
values.push(...collectLeafStrings(entry));
|
|
121
134
|
continue;
|
|
135
|
+
}
|
|
122
136
|
const fieldValue = entry.value;
|
|
123
137
|
if (typeof fieldValue === "string" && fieldValue.trim())
|
|
124
138
|
values.push(fieldValue);
|
|
125
139
|
}
|
|
126
140
|
return values;
|
|
127
141
|
}
|
|
142
|
+
function formatFrontmatterEvidence(value) {
|
|
143
|
+
if (!value)
|
|
144
|
+
return [];
|
|
145
|
+
if (Array.isArray(value)) {
|
|
146
|
+
const pairs = value.flatMap((entry) => {
|
|
147
|
+
if (!isRecord(entry))
|
|
148
|
+
return collectLeafStrings(entry);
|
|
149
|
+
const key = typeof entry.key === "string" && entry.key.trim() ? `${entry.key}: ` : "";
|
|
150
|
+
return collectLeafStrings(entry.value).map((fieldValue) => `${key}${fieldValue}`);
|
|
151
|
+
});
|
|
152
|
+
return pairs.length > 0 ? [`frontmatter: ${pairs.join("; ")}`] : [];
|
|
153
|
+
}
|
|
154
|
+
if (isRecord(value)) {
|
|
155
|
+
const pairs = Object.entries(value).flatMap(([key, fieldValue]) => collectLeafStrings(fieldValue).map((item) => `${key}: ${item}`));
|
|
156
|
+
return pairs.length > 0 ? [`frontmatter: ${pairs.join("; ")}`] : [];
|
|
157
|
+
}
|
|
158
|
+
const values = collectLeafStrings(value);
|
|
159
|
+
return values.length > 0 ? [`frontmatter: ${values.join("; ")}`] : [];
|
|
160
|
+
}
|
|
161
|
+
function collectCompactEvidence(item) {
|
|
162
|
+
const matchedFields = KNOWLEDGE_MATCHED_FIELD_KEYS.flatMap((key) => collectLeafStrings(item[key]));
|
|
163
|
+
return [
|
|
164
|
+
...(matchedFields.length > 0 ? [`matched_fields: ${matchedFields.join("; ")}`] : []),
|
|
165
|
+
...formatFrontmatterEvidence(item.frontmatter),
|
|
166
|
+
];
|
|
167
|
+
}
|
|
128
168
|
function extractKnowledgeItems(output) {
|
|
129
169
|
if (Array.isArray(output))
|
|
130
170
|
return output;
|
|
@@ -140,7 +180,12 @@ function extractKnowledgeItems(output) {
|
|
|
140
180
|
function createKnowledgeEntry(item) {
|
|
141
181
|
if (!isRecord(item)) {
|
|
142
182
|
if (typeof item === "string" && item.trim()) {
|
|
143
|
-
return {
|
|
183
|
+
return {
|
|
184
|
+
source: item,
|
|
185
|
+
sourceCandidates: [item],
|
|
186
|
+
contentCandidates: [item],
|
|
187
|
+
evidenceCandidates: [item],
|
|
188
|
+
};
|
|
144
189
|
}
|
|
145
190
|
return null;
|
|
146
191
|
}
|
|
@@ -150,10 +195,15 @@ function createKnowledgeEntry(item) {
|
|
|
150
195
|
]);
|
|
151
196
|
const contentCandidates = uniqueStrings(KNOWLEDGE_CONTENT_KEYS.flatMap((key) => collectStringField(item, key)));
|
|
152
197
|
const source = sourceCandidates[0] ?? contentCandidates[0] ?? stableStringify(item);
|
|
198
|
+
const evidenceCandidates = uniqueStrings([
|
|
199
|
+
...contentCandidates,
|
|
200
|
+
...collectCompactEvidence(item),
|
|
201
|
+
]);
|
|
153
202
|
return {
|
|
154
203
|
source,
|
|
155
204
|
sourceCandidates: sourceCandidates.length === 0 ? [source] : sourceCandidates,
|
|
156
205
|
contentCandidates,
|
|
206
|
+
evidenceCandidates: evidenceCandidates.length === 0 ? [source] : evidenceCandidates,
|
|
157
207
|
};
|
|
158
208
|
}
|
|
159
209
|
function getKnowledgeEntries(record, tool = DEFAULT_KNOWLEDGE_TOOL) {
|
|
@@ -364,7 +414,7 @@ export const metrics = {
|
|
|
364
414
|
return createMetric("answer.groundedness", "answer", async (record) => {
|
|
365
415
|
const tool = options.tool ?? DEFAULT_KNOWLEDGE_TOOL;
|
|
366
416
|
const entries = getKnowledgeEntries(record, tool);
|
|
367
|
-
const evidence = uniqueStrings(entries.flatMap((entry) => entry.
|
|
417
|
+
const evidence = uniqueStrings(entries.flatMap((entry) => entry.evidenceCandidates));
|
|
368
418
|
const sources = uniqueStrings(retrievedSources(entries));
|
|
369
419
|
if (!options.judge) {
|
|
370
420
|
return {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { InferSchema } from "../extensions/schema/index.js";
|
|
2
|
-
export declare const getIntegrationNameSchema: () => import("../internal-agents/schema.js").Schema<"close" | "render" | "openai" | "cohere" | "github" | "cloudflare" | "square" | "anthropic" | "linear" | "gmail" | "slack" | "calendar" | "jira" | "notion" | "servicenow" | "confluence" | "gitlab" | "outlook" | "teams" | "figma" | "sap" | "sheets" | "airtable" | "supabase" | "neon" | "sharepoint" | "stripe" | "salesforce" | "twitter" | "onedrive" | "bitbucket" | "sentry" | "posthog" | "persona" | "zendesk" | "asana" | "harvest" | "hubspot" | "monday" | "zoom" | "trello" | "box" | "shopify" | "clickup" | "intercom" | "pipedrive" | "mailchimp" | "webex" | "freshdesk" | "quickbooks" | "xero" | "drive" | "docs-google" | "snowflake" | "mixpanel" | "twilio" | "aws" | "todoist" | "calendly" | "google-analytics" | "klaviyo" | "datadog" | "paypal" | "activecampaign" | "algolia" | "amplitude" | "apollo" | "ashby" | "attio" | "basecamp" | "brevo" | "circleci" | "coda" | "dialpad" | "digitalocean" | "exa" | "fathom" | "firecrawl" | "fireflies" | "folk" | "gemini" | "gong" | "google-chat" | "gusto" | "jotform" | "lever" | "metabase" | "
|
|
2
|
+
export declare const getIntegrationNameSchema: () => import("../internal-agents/schema.js").Schema<"close" | "render" | "openai" | "cohere" | "github" | "cloudflare" | "square" | "anthropic" | "mistral" | "linear" | "gmail" | "slack" | "calendar" | "jira" | "notion" | "servicenow" | "confluence" | "gitlab" | "outlook" | "teams" | "figma" | "sap" | "sheets" | "airtable" | "supabase" | "neon" | "sharepoint" | "stripe" | "salesforce" | "twitter" | "onedrive" | "bitbucket" | "sentry" | "posthog" | "persona" | "zendesk" | "asana" | "harvest" | "hubspot" | "monday" | "zoom" | "trello" | "box" | "shopify" | "clickup" | "intercom" | "pipedrive" | "mailchimp" | "webex" | "freshdesk" | "quickbooks" | "xero" | "drive" | "docs-google" | "snowflake" | "mixpanel" | "twilio" | "aws" | "todoist" | "calendly" | "google-analytics" | "klaviyo" | "datadog" | "paypal" | "activecampaign" | "algolia" | "amplitude" | "apollo" | "ashby" | "attio" | "basecamp" | "brevo" | "circleci" | "coda" | "dialpad" | "digitalocean" | "exa" | "fathom" | "firecrawl" | "fireflies" | "folk" | "gemini" | "gong" | "google-chat" | "gusto" | "jotform" | "lever" | "metabase" | "pagerduty" | "perplexity" | "productboard" | "razorpay" | "resend" | "salesflare" | "segment" | "sendgrid" | "shortcut" | "tavily" | "typeform" | "apify" | "assemblyai" | "axiom" | "betterstack" | "browserbase" | "buildkite" | "checkly" | "clickhouse" | "deepgram" | "elevenlabs" | "fal" | "fireworks-ai" | "fly-io" | "grafana-cloud" | "groq" | "heroku" | "huggingface" | "langfuse" | "langsmith" | "launchdarkly" | "mongodb-atlas" | "netlify" | "new-relic" | "openrouter" | "pinecone" | "planetscale" | "qdrant" | "railway" | "redis-cloud" | "replicate" | "snyk" | "stability-ai" | "together-ai" | "vercel" | "weaviate" | "bamboohr" | "cal-com" | "customer-io" | "discord" | "docusign" | "gocardless" | "google-bigquery" | "google-contacts" | "help-scout" | "telegram" | "whatsapp" | "woocommerce" | "zoho-crm" | "adyen" | "azure-blob-storage" | "bigcommerce" | "brave-search" | "chargebee" | "databricks" | "deel" | "front" | "google-cloud-storage" | "google-forms" | "gorgias" | "greenhouse" | "guru" | "mollie" | "paddle" | "pandadoc" | "personio" | "portkey" | "power-bi" | "ramp" | "rippling" | "serpapi" | "shopware" | "surveymonkey" | "tally" | "wix" | "workable" | "azure" | "azure-document-intelligence" | "billbee" | "cleverreach" | "datev" | "factorial" | "finapi" | "gcp" | "hetzner" | "ionos" | "klarna" | "lexoffice" | "mindee" | "moss" | "neo4j" | "north-data" | "qonto" | "sendcloud" | "sevdesk" | "skribble" | "stackit" | "trusted-shops" | "unstructured" | "unzer" | "voyage-ai" | "xentral" | "alphavantage" | "daytona" | "e2b" | "polygon" | "sprites">;
|
|
3
3
|
/** Zod schema for integration name. */
|
|
4
|
-
export declare const IntegrationNameSchema: import("../internal-agents/schema.js").Schema<"close" | "render" | "openai" | "cohere" | "github" | "cloudflare" | "square" | "anthropic" | "linear" | "gmail" | "slack" | "calendar" | "jira" | "notion" | "servicenow" | "confluence" | "gitlab" | "outlook" | "teams" | "figma" | "sap" | "sheets" | "airtable" | "supabase" | "neon" | "sharepoint" | "stripe" | "salesforce" | "twitter" | "onedrive" | "bitbucket" | "sentry" | "posthog" | "persona" | "zendesk" | "asana" | "harvest" | "hubspot" | "monday" | "zoom" | "trello" | "box" | "shopify" | "clickup" | "intercom" | "pipedrive" | "mailchimp" | "webex" | "freshdesk" | "quickbooks" | "xero" | "drive" | "docs-google" | "snowflake" | "mixpanel" | "twilio" | "aws" | "todoist" | "calendly" | "google-analytics" | "klaviyo" | "datadog" | "paypal" | "activecampaign" | "algolia" | "amplitude" | "apollo" | "ashby" | "attio" | "basecamp" | "brevo" | "circleci" | "coda" | "dialpad" | "digitalocean" | "exa" | "fathom" | "firecrawl" | "fireflies" | "folk" | "gemini" | "gong" | "google-chat" | "gusto" | "jotform" | "lever" | "metabase" | "
|
|
4
|
+
export declare const IntegrationNameSchema: import("../internal-agents/schema.js").Schema<"close" | "render" | "openai" | "cohere" | "github" | "cloudflare" | "square" | "anthropic" | "mistral" | "linear" | "gmail" | "slack" | "calendar" | "jira" | "notion" | "servicenow" | "confluence" | "gitlab" | "outlook" | "teams" | "figma" | "sap" | "sheets" | "airtable" | "supabase" | "neon" | "sharepoint" | "stripe" | "salesforce" | "twitter" | "onedrive" | "bitbucket" | "sentry" | "posthog" | "persona" | "zendesk" | "asana" | "harvest" | "hubspot" | "monday" | "zoom" | "trello" | "box" | "shopify" | "clickup" | "intercom" | "pipedrive" | "mailchimp" | "webex" | "freshdesk" | "quickbooks" | "xero" | "drive" | "docs-google" | "snowflake" | "mixpanel" | "twilio" | "aws" | "todoist" | "calendly" | "google-analytics" | "klaviyo" | "datadog" | "paypal" | "activecampaign" | "algolia" | "amplitude" | "apollo" | "ashby" | "attio" | "basecamp" | "brevo" | "circleci" | "coda" | "dialpad" | "digitalocean" | "exa" | "fathom" | "firecrawl" | "fireflies" | "folk" | "gemini" | "gong" | "google-chat" | "gusto" | "jotform" | "lever" | "metabase" | "pagerduty" | "perplexity" | "productboard" | "razorpay" | "resend" | "salesflare" | "segment" | "sendgrid" | "shortcut" | "tavily" | "typeform" | "apify" | "assemblyai" | "axiom" | "betterstack" | "browserbase" | "buildkite" | "checkly" | "clickhouse" | "deepgram" | "elevenlabs" | "fal" | "fireworks-ai" | "fly-io" | "grafana-cloud" | "groq" | "heroku" | "huggingface" | "langfuse" | "langsmith" | "launchdarkly" | "mongodb-atlas" | "netlify" | "new-relic" | "openrouter" | "pinecone" | "planetscale" | "qdrant" | "railway" | "redis-cloud" | "replicate" | "snyk" | "stability-ai" | "together-ai" | "vercel" | "weaviate" | "bamboohr" | "cal-com" | "customer-io" | "discord" | "docusign" | "gocardless" | "google-bigquery" | "google-contacts" | "help-scout" | "telegram" | "whatsapp" | "woocommerce" | "zoho-crm" | "adyen" | "azure-blob-storage" | "bigcommerce" | "brave-search" | "chargebee" | "databricks" | "deel" | "front" | "google-cloud-storage" | "google-forms" | "gorgias" | "greenhouse" | "guru" | "mollie" | "paddle" | "pandadoc" | "personio" | "portkey" | "power-bi" | "ramp" | "rippling" | "serpapi" | "shopware" | "surveymonkey" | "tally" | "wix" | "workable" | "azure" | "azure-document-intelligence" | "billbee" | "cleverreach" | "datev" | "factorial" | "finapi" | "gcp" | "hetzner" | "ionos" | "klarna" | "lexoffice" | "mindee" | "moss" | "neo4j" | "north-data" | "qonto" | "sendcloud" | "sevdesk" | "skribble" | "stackit" | "trusted-shops" | "unstructured" | "unzer" | "voyage-ai" | "xentral" | "alphavantage" | "daytona" | "e2b" | "polygon" | "sprites">;
|
|
5
5
|
/**
|
|
6
6
|
* Every registered integration name. The single source of truth for catalog
|
|
7
7
|
* surfaces (CLI validation, MCP listings) — derive from this instead of
|
|
@@ -529,7 +529,7 @@ export declare const IntegrationPromptSchema: import("../internal-agents/schema.
|
|
|
529
529
|
icon: import("../internal-agents/schema.js").Schema<string | undefined>;
|
|
530
530
|
}>>;
|
|
531
531
|
export declare const getIntegrationConfigSchema: () => import("../internal-agents/schema.js").Schema<import("../extensions/schema/schema-validator.js").InferShape<{
|
|
532
|
-
name: import("../internal-agents/schema.js").Schema<"close" | "render" | "openai" | "cohere" | "github" | "cloudflare" | "square" | "anthropic" | "linear" | "gmail" | "slack" | "calendar" | "jira" | "notion" | "servicenow" | "confluence" | "gitlab" | "outlook" | "teams" | "figma" | "sap" | "sheets" | "airtable" | "supabase" | "neon" | "sharepoint" | "stripe" | "salesforce" | "twitter" | "onedrive" | "bitbucket" | "sentry" | "posthog" | "persona" | "zendesk" | "asana" | "harvest" | "hubspot" | "monday" | "zoom" | "trello" | "box" | "shopify" | "clickup" | "intercom" | "pipedrive" | "mailchimp" | "webex" | "freshdesk" | "quickbooks" | "xero" | "drive" | "docs-google" | "snowflake" | "mixpanel" | "twilio" | "aws" | "todoist" | "calendly" | "google-analytics" | "klaviyo" | "datadog" | "paypal" | "activecampaign" | "algolia" | "amplitude" | "apollo" | "ashby" | "attio" | "basecamp" | "brevo" | "circleci" | "coda" | "dialpad" | "digitalocean" | "exa" | "fathom" | "firecrawl" | "fireflies" | "folk" | "gemini" | "gong" | "google-chat" | "gusto" | "jotform" | "lever" | "metabase" | "
|
|
532
|
+
name: import("../internal-agents/schema.js").Schema<"close" | "render" | "openai" | "cohere" | "github" | "cloudflare" | "square" | "anthropic" | "mistral" | "linear" | "gmail" | "slack" | "calendar" | "jira" | "notion" | "servicenow" | "confluence" | "gitlab" | "outlook" | "teams" | "figma" | "sap" | "sheets" | "airtable" | "supabase" | "neon" | "sharepoint" | "stripe" | "salesforce" | "twitter" | "onedrive" | "bitbucket" | "sentry" | "posthog" | "persona" | "zendesk" | "asana" | "harvest" | "hubspot" | "monday" | "zoom" | "trello" | "box" | "shopify" | "clickup" | "intercom" | "pipedrive" | "mailchimp" | "webex" | "freshdesk" | "quickbooks" | "xero" | "drive" | "docs-google" | "snowflake" | "mixpanel" | "twilio" | "aws" | "todoist" | "calendly" | "google-analytics" | "klaviyo" | "datadog" | "paypal" | "activecampaign" | "algolia" | "amplitude" | "apollo" | "ashby" | "attio" | "basecamp" | "brevo" | "circleci" | "coda" | "dialpad" | "digitalocean" | "exa" | "fathom" | "firecrawl" | "fireflies" | "folk" | "gemini" | "gong" | "google-chat" | "gusto" | "jotform" | "lever" | "metabase" | "pagerduty" | "perplexity" | "productboard" | "razorpay" | "resend" | "salesflare" | "segment" | "sendgrid" | "shortcut" | "tavily" | "typeform" | "apify" | "assemblyai" | "axiom" | "betterstack" | "browserbase" | "buildkite" | "checkly" | "clickhouse" | "deepgram" | "elevenlabs" | "fal" | "fireworks-ai" | "fly-io" | "grafana-cloud" | "groq" | "heroku" | "huggingface" | "langfuse" | "langsmith" | "launchdarkly" | "mongodb-atlas" | "netlify" | "new-relic" | "openrouter" | "pinecone" | "planetscale" | "qdrant" | "railway" | "redis-cloud" | "replicate" | "snyk" | "stability-ai" | "together-ai" | "vercel" | "weaviate" | "bamboohr" | "cal-com" | "customer-io" | "discord" | "docusign" | "gocardless" | "google-bigquery" | "google-contacts" | "help-scout" | "telegram" | "whatsapp" | "woocommerce" | "zoho-crm" | "adyen" | "azure-blob-storage" | "bigcommerce" | "brave-search" | "chargebee" | "databricks" | "deel" | "front" | "google-cloud-storage" | "google-forms" | "gorgias" | "greenhouse" | "guru" | "mollie" | "paddle" | "pandadoc" | "personio" | "portkey" | "power-bi" | "ramp" | "rippling" | "serpapi" | "shopware" | "surveymonkey" | "tally" | "wix" | "workable" | "azure" | "azure-document-intelligence" | "billbee" | "cleverreach" | "datev" | "factorial" | "finapi" | "gcp" | "hetzner" | "ionos" | "klarna" | "lexoffice" | "mindee" | "moss" | "neo4j" | "north-data" | "qonto" | "sendcloud" | "sevdesk" | "skribble" | "stackit" | "trusted-shops" | "unstructured" | "unzer" | "voyage-ai" | "xentral" | "alphavantage" | "daytona" | "e2b" | "polygon" | "sprites">;
|
|
533
533
|
displayName: import("../internal-agents/schema.js").Schema<string>;
|
|
534
534
|
icon: import("../internal-agents/schema.js").Schema<string | undefined>;
|
|
535
535
|
description: import("../internal-agents/schema.js").Schema<string>;
|
|
@@ -693,7 +693,7 @@ export declare const getIntegrationConfigSchema: () => import("../internal-agent
|
|
|
693
693
|
}>>;
|
|
694
694
|
/** Zod schema for integration config. */
|
|
695
695
|
export declare const IntegrationConfigSchema: import("../internal-agents/schema.js").Schema<import("../extensions/schema/schema-validator.js").InferShape<{
|
|
696
|
-
name: import("../internal-agents/schema.js").Schema<"close" | "render" | "openai" | "cohere" | "github" | "cloudflare" | "square" | "anthropic" | "linear" | "gmail" | "slack" | "calendar" | "jira" | "notion" | "servicenow" | "confluence" | "gitlab" | "outlook" | "teams" | "figma" | "sap" | "sheets" | "airtable" | "supabase" | "neon" | "sharepoint" | "stripe" | "salesforce" | "twitter" | "onedrive" | "bitbucket" | "sentry" | "posthog" | "persona" | "zendesk" | "asana" | "harvest" | "hubspot" | "monday" | "zoom" | "trello" | "box" | "shopify" | "clickup" | "intercom" | "pipedrive" | "mailchimp" | "webex" | "freshdesk" | "quickbooks" | "xero" | "drive" | "docs-google" | "snowflake" | "mixpanel" | "twilio" | "aws" | "todoist" | "calendly" | "google-analytics" | "klaviyo" | "datadog" | "paypal" | "activecampaign" | "algolia" | "amplitude" | "apollo" | "ashby" | "attio" | "basecamp" | "brevo" | "circleci" | "coda" | "dialpad" | "digitalocean" | "exa" | "fathom" | "firecrawl" | "fireflies" | "folk" | "gemini" | "gong" | "google-chat" | "gusto" | "jotform" | "lever" | "metabase" | "
|
|
696
|
+
name: import("../internal-agents/schema.js").Schema<"close" | "render" | "openai" | "cohere" | "github" | "cloudflare" | "square" | "anthropic" | "mistral" | "linear" | "gmail" | "slack" | "calendar" | "jira" | "notion" | "servicenow" | "confluence" | "gitlab" | "outlook" | "teams" | "figma" | "sap" | "sheets" | "airtable" | "supabase" | "neon" | "sharepoint" | "stripe" | "salesforce" | "twitter" | "onedrive" | "bitbucket" | "sentry" | "posthog" | "persona" | "zendesk" | "asana" | "harvest" | "hubspot" | "monday" | "zoom" | "trello" | "box" | "shopify" | "clickup" | "intercom" | "pipedrive" | "mailchimp" | "webex" | "freshdesk" | "quickbooks" | "xero" | "drive" | "docs-google" | "snowflake" | "mixpanel" | "twilio" | "aws" | "todoist" | "calendly" | "google-analytics" | "klaviyo" | "datadog" | "paypal" | "activecampaign" | "algolia" | "amplitude" | "apollo" | "ashby" | "attio" | "basecamp" | "brevo" | "circleci" | "coda" | "dialpad" | "digitalocean" | "exa" | "fathom" | "firecrawl" | "fireflies" | "folk" | "gemini" | "gong" | "google-chat" | "gusto" | "jotform" | "lever" | "metabase" | "pagerduty" | "perplexity" | "productboard" | "razorpay" | "resend" | "salesflare" | "segment" | "sendgrid" | "shortcut" | "tavily" | "typeform" | "apify" | "assemblyai" | "axiom" | "betterstack" | "browserbase" | "buildkite" | "checkly" | "clickhouse" | "deepgram" | "elevenlabs" | "fal" | "fireworks-ai" | "fly-io" | "grafana-cloud" | "groq" | "heroku" | "huggingface" | "langfuse" | "langsmith" | "launchdarkly" | "mongodb-atlas" | "netlify" | "new-relic" | "openrouter" | "pinecone" | "planetscale" | "qdrant" | "railway" | "redis-cloud" | "replicate" | "snyk" | "stability-ai" | "together-ai" | "vercel" | "weaviate" | "bamboohr" | "cal-com" | "customer-io" | "discord" | "docusign" | "gocardless" | "google-bigquery" | "google-contacts" | "help-scout" | "telegram" | "whatsapp" | "woocommerce" | "zoho-crm" | "adyen" | "azure-blob-storage" | "bigcommerce" | "brave-search" | "chargebee" | "databricks" | "deel" | "front" | "google-cloud-storage" | "google-forms" | "gorgias" | "greenhouse" | "guru" | "mollie" | "paddle" | "pandadoc" | "personio" | "portkey" | "power-bi" | "ramp" | "rippling" | "serpapi" | "shopware" | "surveymonkey" | "tally" | "wix" | "workable" | "azure" | "azure-document-intelligence" | "billbee" | "cleverreach" | "datev" | "factorial" | "finapi" | "gcp" | "hetzner" | "ionos" | "klarna" | "lexoffice" | "mindee" | "moss" | "neo4j" | "north-data" | "qonto" | "sendcloud" | "sevdesk" | "skribble" | "stackit" | "trusted-shops" | "unstructured" | "unzer" | "voyage-ai" | "xentral" | "alphavantage" | "daytona" | "e2b" | "polygon" | "sprites">;
|
|
697
697
|
displayName: import("../internal-agents/schema.js").Schema<string>;
|
|
698
698
|
icon: import("../internal-agents/schema.js").Schema<string | undefined>;
|
|
699
699
|
description: import("../internal-agents/schema.js").Schema<string>;
|
|
@@ -72,6 +72,7 @@ export interface ProjectKnowledgeLookupItem {
|
|
|
72
72
|
path: string;
|
|
73
73
|
matched_fields: string[];
|
|
74
74
|
frontmatter: ProjectKnowledgeLookupFrontmatterField[];
|
|
75
|
+
content?: string;
|
|
75
76
|
}
|
|
76
77
|
export interface ProjectKnowledgeLookupPageInfo {
|
|
77
78
|
self: string | null;
|
|
@@ -108,9 +109,10 @@ export interface ProjectKnowledge {
|
|
|
108
109
|
*/
|
|
109
110
|
index(): Promise<void>;
|
|
110
111
|
/**
|
|
111
|
-
* Search the local OKF knowledge manifest using the same compact
|
|
112
|
-
*
|
|
113
|
-
*
|
|
112
|
+
* Search the local OKF knowledge manifest using the same compact response
|
|
113
|
+
* shape as Veryfront Cloud's `search_knowledge` tool. Explicit
|
|
114
|
+
* `lookup_target` calls include document content. This does not build or
|
|
115
|
+
* query the embedding index.
|
|
114
116
|
*/
|
|
115
117
|
lookup(input: ProjectKnowledgeLookupInput): Promise<ProjectKnowledgeLookupOutput>;
|
|
116
118
|
retrieve(query: string, options?: ProjectKnowledgeRetrieveOptions): Promise<ProjectKnowledgeResult>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/src/knowledge/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,yBAAyB,CAAC;AAIjC,OAAO,KAAK,EACV,gBAAgB,EAChB,eAAe,EAEf,eAAe,EAChB,MAAM,uBAAuB,CAAC;AAS/B,OAAO,KAAK,EAAE,IAAI,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAqBnE,kEAAkE;AAClE,MAAM,WAAW,sBAAsB;IACrC;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OA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DAAoD;AACpD,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,MAAM,EACb,QAAQ,GAAE,MAAgC,GACzC,MAAM,CAER;AAED,uEAAuE;AACvE,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,eAAe,EAAE,GAAG,MAAM,CAIzE;AAED;;;GAGG;AACH,wBAAsB,sBAAsB,CAC1C,KAAK,EAAE,2BAA2B,EAClC,MAAM,GAAE,sBAA2B,EACnC,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,4BAA4B,CAAC,CAGvC;AAED,4FAA4F;AAC5F,wBAAgB,yBAAyB,CACvC,OAAO,GAAE,gCAAqC,GAC7C,mBAAmB,CAWrB;AAED,4EAA4E;AAC5E,wBAAgB,gBAAgB,CAAC,MAAM,GAAE,sBAA2B,GAAG,gBAAgB,CAsDtF"}
|
|
@@ -57,7 +57,7 @@ const SEARCH_KNOWLEDGE_INPUT_SCHEMA = {
|
|
|
57
57
|
lookup_target: {
|
|
58
58
|
type: "object",
|
|
59
59
|
additionalProperties: true,
|
|
60
|
-
description: "
|
|
60
|
+
description: "Optional target such as { path } for retrieving a specific knowledge document.",
|
|
61
61
|
},
|
|
62
62
|
limit: {
|
|
63
63
|
type: "integer",
|
|
@@ -88,6 +88,9 @@ function stripTrailingSlash(path) {
|
|
|
88
88
|
function trimLeadingSlash(path) {
|
|
89
89
|
return toPosixPath(path).replace(/^\/+/, "");
|
|
90
90
|
}
|
|
91
|
+
function normalizeManifestPath(path) {
|
|
92
|
+
return trimLeadingSlash(path).replace(/^\.\//, "");
|
|
93
|
+
}
|
|
91
94
|
function buildHostedManifestPath(contentDir, filePath) {
|
|
92
95
|
const normalizedPath = trimLeadingSlash(filePath);
|
|
93
96
|
const normalizedContentDir = stripTrailingSlash(trimLeadingSlash(contentDir)).replace(/^\.\//, "");
|
|
@@ -229,6 +232,29 @@ function toSearchableEntry(entry) {
|
|
|
229
232
|
})),
|
|
230
233
|
};
|
|
231
234
|
}
|
|
235
|
+
function getLookupTargetPath(lookupTarget) {
|
|
236
|
+
if (typeof lookupTarget === "string" && lookupTarget.trim()) {
|
|
237
|
+
return normalizeManifestPath(lookupTarget);
|
|
238
|
+
}
|
|
239
|
+
if (!lookupTarget || typeof lookupTarget !== "object" || Array.isArray(lookupTarget)) {
|
|
240
|
+
return null;
|
|
241
|
+
}
|
|
242
|
+
const record = lookupTarget;
|
|
243
|
+
for (const key of ["path", "source", "id", "documentCode", "document_code"]) {
|
|
244
|
+
const value = record[key];
|
|
245
|
+
if (typeof value === "string" && value.trim())
|
|
246
|
+
return normalizeManifestPath(value);
|
|
247
|
+
}
|
|
248
|
+
return null;
|
|
249
|
+
}
|
|
250
|
+
function createLookupItem(entry, matchedFields, includeContent = false) {
|
|
251
|
+
return {
|
|
252
|
+
path: entry.path,
|
|
253
|
+
matched_fields: matchedFields,
|
|
254
|
+
frontmatter: entry.frontmatter,
|
|
255
|
+
...(includeContent && entry.content ? { content: entry.content } : {}),
|
|
256
|
+
};
|
|
257
|
+
}
|
|
232
258
|
function encodeCursor(state) {
|
|
233
259
|
const bytes = new TextEncoder().encode(JSON.stringify(state));
|
|
234
260
|
let binary = "";
|
|
@@ -320,7 +346,14 @@ async function getProjectKnowledgeManifest(config, context) {
|
|
|
320
346
|
for (const file of files) {
|
|
321
347
|
let parsedFrontmatter = {};
|
|
322
348
|
try {
|
|
323
|
-
|
|
349
|
+
const content = await readTextFile(file);
|
|
350
|
+
parsedFrontmatter = extract(content).attrs;
|
|
351
|
+
manifest.push({
|
|
352
|
+
path: buildManifestPath(config, file),
|
|
353
|
+
content,
|
|
354
|
+
...sanitizeFrontmatter(parsedFrontmatter),
|
|
355
|
+
});
|
|
356
|
+
continue;
|
|
324
357
|
}
|
|
325
358
|
catch {
|
|
326
359
|
parsedFrontmatter = {};
|
|
@@ -415,6 +448,7 @@ async function getHostedProjectKnowledgeManifest(config, context) {
|
|
|
415
448
|
}
|
|
416
449
|
manifest.push({
|
|
417
450
|
path: manifestPath,
|
|
451
|
+
content: file.content,
|
|
418
452
|
...sanitizeFrontmatter(parsedFrontmatter),
|
|
419
453
|
});
|
|
420
454
|
}
|
|
@@ -424,7 +458,8 @@ function lookupKnowledgeManifest(manifest, input) {
|
|
|
424
458
|
const cursorState = input.cursor ? decodeCursor(input.cursor) : null;
|
|
425
459
|
const providedQuery = input.query?.trim() ?? "";
|
|
426
460
|
const resolvedQuery = (cursorState?.query ?? providedQuery).trim();
|
|
427
|
-
|
|
461
|
+
const lookupTargetPath = cursorState ? null : getLookupTargetPath(input.lookup_target);
|
|
462
|
+
if (!resolvedQuery && !lookupTargetPath) {
|
|
428
463
|
throw new Error("search_knowledge requires a non-empty query");
|
|
429
464
|
}
|
|
430
465
|
if (cursorState && providedQuery && providedQuery !== cursorState.query) {
|
|
@@ -438,6 +473,28 @@ function lookupKnowledgeManifest(manifest, input) {
|
|
|
438
473
|
if (resolvedShardIndex < 0 || resolvedShardIndex >= resolvedShardCount) {
|
|
439
474
|
throw new Error("search_knowledge shard_index must be within shard_count");
|
|
440
475
|
}
|
|
476
|
+
if (lookupTargetPath) {
|
|
477
|
+
const entry = manifest.find((item) => normalizeManifestPath(item.path) === lookupTargetPath);
|
|
478
|
+
const data = entry ? [createLookupItem(entry, ["path"], true)] : [];
|
|
479
|
+
return {
|
|
480
|
+
query: resolvedQuery || lookupTargetPath,
|
|
481
|
+
mode: "search",
|
|
482
|
+
data,
|
|
483
|
+
page_info: {
|
|
484
|
+
self: null,
|
|
485
|
+
first: null,
|
|
486
|
+
next: null,
|
|
487
|
+
prev: null,
|
|
488
|
+
},
|
|
489
|
+
returned: data.length,
|
|
490
|
+
total_matches: data.length,
|
|
491
|
+
shard: {
|
|
492
|
+
shard_index: resolvedShardIndex,
|
|
493
|
+
shard_count: resolvedShardCount,
|
|
494
|
+
total_items: manifest.length,
|
|
495
|
+
},
|
|
496
|
+
};
|
|
497
|
+
}
|
|
441
498
|
const resolvedLimit = Math.min(Math.max(cursorState?.limit ?? input.limit ?? DEFAULT_LOOKUP_LIMIT, 1), MAX_LOOKUP_LIMIT);
|
|
442
499
|
const resolvedOffset = Math.max(cursorState?.offset ?? 0, 0);
|
|
443
500
|
const queryTokens = tokenize(resolvedQuery);
|
|
@@ -475,11 +532,7 @@ function lookupKnowledgeManifest(manifest, input) {
|
|
|
475
532
|
return {
|
|
476
533
|
query: resolvedQuery,
|
|
477
534
|
mode,
|
|
478
|
-
data: pageEntries.map(({ entry, matchedFields }) => (
|
|
479
|
-
path: entry.path,
|
|
480
|
-
matched_fields: matchedFields,
|
|
481
|
-
frontmatter: entry.frontmatter,
|
|
482
|
-
})),
|
|
535
|
+
data: pageEntries.map(({ entry, matchedFields }) => createLookupItem(entry, matchedFields)),
|
|
483
536
|
page_info: {
|
|
484
537
|
self: input.cursor ?? null,
|
|
485
538
|
first: null,
|
|
@@ -536,7 +589,7 @@ export function createSearchKnowledgeTool(options = {}) {
|
|
|
536
589
|
return tool({
|
|
537
590
|
id,
|
|
538
591
|
description: description ??
|
|
539
|
-
"Retrieve a compact, cursor-based slice of
|
|
592
|
+
"Retrieve a compact, cursor-based slice of project knowledge, or a specific document by lookup target.",
|
|
540
593
|
inputSchema: SEARCH_KNOWLEDGE_INPUT_SCHEMA,
|
|
541
594
|
execute: (input, context) => searchProjectKnowledge(coerceSearchKnowledgeInput(input), config, context),
|
|
542
595
|
});
|