@agentv/core 3.11.0 → 3.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/dist/{chunk-HMXZ2AX4.js → chunk-3G2KXH7N.js} +31 -23
- package/dist/chunk-3G2KXH7N.js.map +1 -0
- package/dist/{chunk-AVTN5AB7.js → chunk-4XWPXNQM.js} +62 -24
- package/dist/chunk-4XWPXNQM.js.map +1 -0
- package/dist/evaluation/validation/index.cjs +1 -1
- package/dist/evaluation/validation/index.cjs.map +1 -1
- package/dist/evaluation/validation/index.js +1 -1
- package/dist/index.cjs +1120 -800
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +29 -8
- package/dist/index.d.ts +29 -8
- package/dist/index.js +956 -682
- package/dist/index.js.map +1 -1
- package/dist/simple-trace-file-exporter-CRIO5HDZ.js +7 -0
- package/package.json +9 -3
- package/dist/chunk-AVTN5AB7.js.map +0 -1
- package/dist/chunk-HMXZ2AX4.js.map +0 -1
- package/dist/simple-trace-file-exporter-S76DMABU.js +0 -7
- /package/dist/{simple-trace-file-exporter-S76DMABU.js.map → simple-trace-file-exporter-CRIO5HDZ.js.map} +0 -0
|
@@ -8,6 +8,7 @@ var SimpleTraceFileExporter = class {
|
|
|
8
8
|
streamReady = null;
|
|
9
9
|
pendingWrites = [];
|
|
10
10
|
_shuttingDown = false;
|
|
11
|
+
spansByTraceId = /* @__PURE__ */ new Map();
|
|
11
12
|
constructor(filePath) {
|
|
12
13
|
this.filePath = filePath;
|
|
13
14
|
}
|
|
@@ -26,25 +27,27 @@ var SimpleTraceFileExporter = class {
|
|
|
26
27
|
resultCallback({ code: 0 });
|
|
27
28
|
return;
|
|
28
29
|
}
|
|
29
|
-
const
|
|
30
|
-
const childMap = /* @__PURE__ */ new Map();
|
|
30
|
+
const rootSpans = [];
|
|
31
31
|
for (const span of spans) {
|
|
32
|
-
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
const traceId = span.spanContext().traceId;
|
|
33
|
+
const existing = this.spansByTraceId.get(traceId) ?? [];
|
|
34
|
+
existing.push(span);
|
|
35
|
+
this.spansByTraceId.set(traceId, existing);
|
|
36
|
+
if (span.name === "agentv.eval") {
|
|
37
|
+
rootSpans.push(span);
|
|
37
38
|
}
|
|
38
39
|
}
|
|
39
|
-
const rootSpans = spans.filter(
|
|
40
|
-
(s) => !s.parentSpanId || !spanMap.has(s.parentSpanId)
|
|
41
|
-
);
|
|
42
40
|
const writePromise = this.ensureStream().then((stream) => {
|
|
43
41
|
for (const root of rootSpans) {
|
|
44
|
-
const
|
|
42
|
+
const traceId = root.spanContext().traceId;
|
|
43
|
+
const traceSpans = this.spansByTraceId.get(traceId) ?? [root];
|
|
44
|
+
const children = traceSpans.filter(
|
|
45
|
+
(span) => span.spanContext().spanId !== root.spanContext().spanId
|
|
46
|
+
);
|
|
45
47
|
const record = this.buildSimpleRecord(root, children);
|
|
46
48
|
stream.write(`${JSON.stringify(record)}
|
|
47
49
|
`);
|
|
50
|
+
this.spansByTraceId.delete(traceId);
|
|
48
51
|
}
|
|
49
52
|
});
|
|
50
53
|
this.pendingWrites.push(writePromise);
|
|
@@ -54,6 +57,7 @@ var SimpleTraceFileExporter = class {
|
|
|
54
57
|
this._shuttingDown = true;
|
|
55
58
|
await Promise.all(this.pendingWrites);
|
|
56
59
|
this.pendingWrites = [];
|
|
60
|
+
this.spansByTraceId.clear();
|
|
57
61
|
return new Promise((resolve) => {
|
|
58
62
|
if (this.stream) {
|
|
59
63
|
this.stream.end(() => resolve());
|
|
@@ -66,17 +70,9 @@ var SimpleTraceFileExporter = class {
|
|
|
66
70
|
await Promise.all(this.pendingWrites);
|
|
67
71
|
this.pendingWrites = [];
|
|
68
72
|
}
|
|
69
|
-
collectChildren(spanId, childMap) {
|
|
70
|
-
const direct = childMap.get(spanId) || [];
|
|
71
|
-
const all = [...direct];
|
|
72
|
-
for (const child of direct) {
|
|
73
|
-
all.push(...this.collectChildren(child.spanContext().spanId, childMap));
|
|
74
|
-
}
|
|
75
|
-
return all;
|
|
76
|
-
}
|
|
77
73
|
buildSimpleRecord(root, children) {
|
|
78
74
|
const attrs = root.attributes || {};
|
|
79
|
-
const durationMs = hrTimeDiffMs(root.startTime, root.endTime);
|
|
75
|
+
const durationMs = typeof attrs["agentv.trace.duration_ms"] === "number" ? attrs["agentv.trace.duration_ms"] : hrTimeDiffMs(root.startTime, root.endTime);
|
|
80
76
|
let inputTokens = 0;
|
|
81
77
|
let outputTokens = 0;
|
|
82
78
|
for (const child of children) {
|
|
@@ -84,6 +80,14 @@ var SimpleTraceFileExporter = class {
|
|
|
84
80
|
if (ca["gen_ai.usage.input_tokens"]) inputTokens += ca["gen_ai.usage.input_tokens"];
|
|
85
81
|
if (ca["gen_ai.usage.output_tokens"]) outputTokens += ca["gen_ai.usage.output_tokens"];
|
|
86
82
|
}
|
|
83
|
+
const rootInputTokens = typeof attrs["agentv.trace.token_input"] === "number" ? attrs["agentv.trace.token_input"] : 0;
|
|
84
|
+
const rootOutputTokens = typeof attrs["agentv.trace.token_output"] === "number" ? attrs["agentv.trace.token_output"] : 0;
|
|
85
|
+
const rootCachedTokens = typeof attrs["agentv.trace.token_cached"] === "number" ? attrs["agentv.trace.token_cached"] : void 0;
|
|
86
|
+
const llmSpans = children.filter((s) => s.attributes?.["gen_ai.operation.name"] === "chat").map((s) => ({
|
|
87
|
+
type: "llm",
|
|
88
|
+
name: s.name,
|
|
89
|
+
duration_ms: hrTimeDiffMs(s.startTime, s.endTime)
|
|
90
|
+
}));
|
|
87
91
|
const toolSpans = children.filter((s) => s.attributes?.["gen_ai.tool.name"]).map((s) => ({
|
|
88
92
|
type: "tool",
|
|
89
93
|
name: s.attributes["gen_ai.tool.name"],
|
|
@@ -95,8 +99,12 @@ var SimpleTraceFileExporter = class {
|
|
|
95
99
|
score: attrs["agentv.score"],
|
|
96
100
|
duration_ms: durationMs,
|
|
97
101
|
cost_usd: attrs["agentv.trace.cost_usd"],
|
|
98
|
-
token_usage: inputTokens || outputTokens
|
|
99
|
-
|
|
102
|
+
token_usage: inputTokens || outputTokens || rootInputTokens || rootOutputTokens || rootCachedTokens ? {
|
|
103
|
+
input: inputTokens || rootInputTokens,
|
|
104
|
+
output: outputTokens || rootOutputTokens,
|
|
105
|
+
...rootCachedTokens ? { cached: rootCachedTokens } : {}
|
|
106
|
+
} : void 0,
|
|
107
|
+
spans: [...llmSpans, ...toolSpans].length > 0 ? [...llmSpans, ...toolSpans] : void 0
|
|
100
108
|
};
|
|
101
109
|
}
|
|
102
110
|
};
|
|
@@ -109,4 +117,4 @@ function hrTimeDiffMs(start, end) {
|
|
|
109
117
|
export {
|
|
110
118
|
SimpleTraceFileExporter
|
|
111
119
|
};
|
|
112
|
-
//# sourceMappingURL=chunk-
|
|
120
|
+
//# sourceMappingURL=chunk-3G2KXH7N.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/observability/simple-trace-file-exporter.ts"],"sourcesContent":["import { type WriteStream, createWriteStream } from 'node:fs';\nimport { mkdir } from 'node:fs/promises';\nimport { dirname } from 'node:path';\n\n// biome-ignore lint/suspicious/noExplicitAny: OTel ReadableSpan loaded dynamically\ntype ReadableSpan = any;\n\n/**\n * SpanExporter that writes human-readable JSONL (one line per root span).\n * Designed for quick debugging and analysis without OTel tooling.\n */\nexport class SimpleTraceFileExporter {\n private stream: WriteStream | null = null;\n private filePath: string;\n private streamReady: Promise<WriteStream> | null = null;\n private pendingWrites: Promise<void>[] = [];\n private _shuttingDown = false;\n private spansByTraceId = new Map<string, ReadableSpan[]>();\n\n constructor(filePath: string) {\n this.filePath = filePath;\n }\n\n private async ensureStream(): Promise<WriteStream> {\n if (!this.streamReady) {\n this.streamReady = (async () => {\n await mkdir(dirname(this.filePath), { recursive: true });\n this.stream = createWriteStream(this.filePath, { flags: 'w' });\n return this.stream;\n })();\n }\n return this.streamReady;\n }\n\n export(spans: ReadableSpan[], resultCallback: (result: { code: number }) => void): void {\n if (this._shuttingDown) {\n resultCallback({ code: 0 });\n return;\n }\n const rootSpans: ReadableSpan[] = [];\n for (const span of spans) {\n const traceId = span.spanContext().traceId;\n const existing = this.spansByTraceId.get(traceId) ?? [];\n existing.push(span);\n this.spansByTraceId.set(traceId, existing);\n if (span.name === 'agentv.eval') {\n rootSpans.push(span);\n }\n }\n\n const writePromise = this.ensureStream().then((stream) => {\n for (const root of rootSpans) {\n const traceId = root.spanContext().traceId;\n const traceSpans = this.spansByTraceId.get(traceId) ?? [root];\n const children = traceSpans.filter(\n (span) => span.spanContext().spanId !== root.spanContext().spanId,\n );\n const record = this.buildSimpleRecord(root, children);\n stream.write(`${JSON.stringify(record)}\\n`);\n this.spansByTraceId.delete(traceId);\n }\n });\n this.pendingWrites.push(writePromise);\n\n resultCallback({ code: 0 });\n }\n\n async shutdown(): Promise<void> {\n this._shuttingDown = true;\n await Promise.all(this.pendingWrites);\n this.pendingWrites = [];\n this.spansByTraceId.clear();\n return new Promise((resolve) => {\n if (this.stream) {\n this.stream.end(() => resolve());\n } else {\n resolve();\n }\n });\n }\n\n async forceFlush(): Promise<void> {\n await Promise.all(this.pendingWrites);\n this.pendingWrites = [];\n }\n\n private buildSimpleRecord(root: ReadableSpan, children: ReadableSpan[]): Record<string, unknown> {\n const attrs = root.attributes || {};\n const durationMs =\n typeof attrs['agentv.trace.duration_ms'] === 'number'\n ? attrs['agentv.trace.duration_ms']\n : hrTimeDiffMs(root.startTime, root.endTime);\n\n let inputTokens = 0;\n let outputTokens = 0;\n for (const child of children) {\n const ca = child.attributes || {};\n if (ca['gen_ai.usage.input_tokens']) inputTokens += ca['gen_ai.usage.input_tokens'];\n if (ca['gen_ai.usage.output_tokens']) outputTokens += ca['gen_ai.usage.output_tokens'];\n }\n const rootInputTokens =\n typeof attrs['agentv.trace.token_input'] === 'number' ? attrs['agentv.trace.token_input'] : 0;\n const rootOutputTokens =\n typeof attrs['agentv.trace.token_output'] === 'number'\n ? attrs['agentv.trace.token_output']\n : 0;\n const rootCachedTokens =\n typeof attrs['agentv.trace.token_cached'] === 'number'\n ? attrs['agentv.trace.token_cached']\n : undefined;\n\n const llmSpans = children\n .filter((s: ReadableSpan) => s.attributes?.['gen_ai.operation.name'] === 'chat')\n .map((s: ReadableSpan) => ({\n type: 'llm' as const,\n name: s.name,\n duration_ms: hrTimeDiffMs(s.startTime, s.endTime),\n }));\n\n const toolSpans = children\n .filter((s: ReadableSpan) => s.attributes?.['gen_ai.tool.name'])\n .map((s: ReadableSpan) => ({\n type: 'tool' as const,\n name: s.attributes['gen_ai.tool.name'],\n duration_ms: hrTimeDiffMs(s.startTime, s.endTime),\n }));\n\n return {\n test_id: attrs['agentv.test_id'],\n target: attrs['agentv.target'],\n score: attrs['agentv.score'],\n duration_ms: durationMs,\n cost_usd: attrs['agentv.trace.cost_usd'],\n token_usage:\n inputTokens || outputTokens || rootInputTokens || rootOutputTokens || rootCachedTokens\n ? {\n input: inputTokens || rootInputTokens,\n output: outputTokens || rootOutputTokens,\n ...(rootCachedTokens ? { cached: rootCachedTokens } : {}),\n }\n : undefined,\n spans: [...llmSpans, ...toolSpans].length > 0 ? [...llmSpans, ...toolSpans] : undefined,\n };\n }\n}\n\nfunction hrTimeDiffMs(start: [number, number], end: [number, number]): number {\n const diffSec = end[0] - start[0];\n const diffNano = end[1] - start[1];\n return Math.round(diffSec * 1000 + diffNano / 1_000_000);\n}\n"],"mappings":";AAAA,SAA2B,yBAAyB;AACpD,SAAS,aAAa;AACtB,SAAS,eAAe;AASjB,IAAM,0BAAN,MAA8B;AAAA,EAC3B,SAA6B;AAAA,EAC7B;AAAA,EACA,cAA2C;AAAA,EAC3C,gBAAiC,CAAC;AAAA,EAClC,gBAAgB;AAAA,EAChB,iBAAiB,oBAAI,IAA4B;AAAA,EAEzD,YAAY,UAAkB;AAC5B,SAAK,WAAW;AAAA,EAClB;AAAA,EAEA,MAAc,eAAqC;AACjD,QAAI,CAAC,KAAK,aAAa;AACrB,WAAK,eAA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qB;AAAA,MACzB,MAAM;AAAA,MACN,MAAM,EAAE,WAAW,kBAAkB;AAAA,MACrC,aAAa,aAAa,EAAE,WAAW,EAAE,OAAO;AAAA,IAClD,EAAE;AAEJ,WAAO;AAAA,MACL,SAAS,MAAM,gBAAgB;AAAA,MAC/B,QAAQ,MAAM,eAAe;AAAA,MAC7B,OAAO,MAAM,cAAc;AAAA,MAC3B,aAAa;AAAA,MACb,UAAU,MAAM,uBAAuB;AAAA,MACvC,aACE,eAAe,gBAAgB,mBAAmB,oBAAoB,mBAClE;AAAA,QACE,OAAO,eAAe;AAAA,QACtB,QAAQ,gBAAgB;AAAA,QACxB,GAAI,mBAAmB,EAAE,QAAQ,iBAAiB,IAAI,CAAC;AAAA,MACzD,IACA;AAAA,MACN,OAAO,CAAC,GAAG,UAAU,GAAG,SAAS,EAAE,SAAS,IAAI,CAAC,GAAG,UAAU,GAAG,SAAS,IAAI;AAAA,IAChF;AAAA,EACF;AACF;AAEA,SAAS,aAAa,OAAyB,KAA+B;AAC5E,QAAM,UAAU,IAAI,CAAC,IAAI,MAAM,CAAC;AAChC,QAAM,WAAW,IAAI,CAAC,IAAI,MAAM,CAAC;AACjC,SAAO,KAAK,MAAM,UAAU,MAAO,WAAW,GAAS;AACzD;","names":[]}
|
|
@@ -522,14 +522,14 @@ function resolveTargetDefinition(definition, env = process.env, evalFilePath) {
|
|
|
522
522
|
providerBatching,
|
|
523
523
|
config: resolvePiCodingAgentConfig(parsed, env, evalFilePath)
|
|
524
524
|
};
|
|
525
|
-
case "pi-
|
|
525
|
+
case "pi-cli":
|
|
526
526
|
return {
|
|
527
|
-
kind: "pi-
|
|
527
|
+
kind: "pi-cli",
|
|
528
528
|
name: parsed.name,
|
|
529
529
|
graderTarget: parsed.grader_target ?? parsed.judge_target,
|
|
530
530
|
workers: parsed.workers,
|
|
531
531
|
providerBatching,
|
|
532
|
-
config:
|
|
532
|
+
config: resolvePiCliConfig(parsed, env, evalFilePath)
|
|
533
533
|
};
|
|
534
534
|
case "claude":
|
|
535
535
|
case "claude-code":
|
|
@@ -946,23 +946,17 @@ function normalizeCopilotLogFormat(value) {
|
|
|
946
946
|
throw new Error("copilot log format must be 'summary' or 'json'");
|
|
947
947
|
}
|
|
948
948
|
function resolvePiCodingAgentConfig(target, env, evalFilePath) {
|
|
949
|
-
const executableSource = target.executable ?? target.command ?? target.binary;
|
|
950
949
|
const subproviderSource = target.subprovider;
|
|
951
950
|
const modelSource = target.model ?? target.pi_model ?? target.piModel;
|
|
952
951
|
const apiKeySource = target.api_key ?? target.apiKey;
|
|
953
952
|
const toolsSource = target.tools ?? target.pi_tools ?? target.piTools;
|
|
954
953
|
const thinkingSource = target.thinking ?? target.pi_thinking ?? target.piThinking;
|
|
955
|
-
const argsSource = target.args ?? target.arguments;
|
|
956
954
|
const cwdSource = target.cwd;
|
|
957
955
|
const workspaceTemplateSource = target.workspace_template ?? target.workspaceTemplate;
|
|
958
956
|
const timeoutSource = target.timeout_seconds ?? target.timeoutSeconds;
|
|
959
957
|
const logDirSource = target.log_dir ?? target.logDir ?? target.log_directory ?? target.logDirectory;
|
|
960
958
|
const logFormatSource = target.log_format ?? target.logFormat;
|
|
961
959
|
const systemPromptSource = target.system_prompt ?? target.systemPrompt;
|
|
962
|
-
const executable = resolveOptionalString(executableSource, env, `${target.name} pi executable`, {
|
|
963
|
-
allowLiteral: true,
|
|
964
|
-
optionalEnv: true
|
|
965
|
-
}) ?? "pi";
|
|
966
960
|
const subprovider = resolveOptionalString(
|
|
967
961
|
subproviderSource,
|
|
968
962
|
env,
|
|
@@ -988,7 +982,6 @@ function resolvePiCodingAgentConfig(target, env, evalFilePath) {
|
|
|
988
982
|
allowLiteral: true,
|
|
989
983
|
optionalEnv: true
|
|
990
984
|
});
|
|
991
|
-
const args = resolveOptionalStringArray(argsSource, env, `${target.name} pi args`);
|
|
992
985
|
const cwd = resolveOptionalString(cwdSource, env, `${target.name} pi cwd`, {
|
|
993
986
|
allowLiteral: true,
|
|
994
987
|
optionalEnv: true
|
|
@@ -1018,13 +1011,11 @@ function resolvePiCodingAgentConfig(target, env, evalFilePath) {
|
|
|
1018
1011
|
const logFormat = logFormatSource === "json" || logFormatSource === "summary" ? logFormatSource : void 0;
|
|
1019
1012
|
const systemPrompt = typeof systemPromptSource === "string" && systemPromptSource.trim().length > 0 ? systemPromptSource.trim() : void 0;
|
|
1020
1013
|
return {
|
|
1021
|
-
executable,
|
|
1022
1014
|
subprovider,
|
|
1023
1015
|
model,
|
|
1024
1016
|
apiKey,
|
|
1025
1017
|
tools,
|
|
1026
1018
|
thinking,
|
|
1027
|
-
args,
|
|
1028
1019
|
cwd,
|
|
1029
1020
|
workspaceTemplate,
|
|
1030
1021
|
timeoutMs,
|
|
@@ -1033,36 +1024,83 @@ function resolvePiCodingAgentConfig(target, env, evalFilePath) {
|
|
|
1033
1024
|
systemPrompt
|
|
1034
1025
|
};
|
|
1035
1026
|
}
|
|
1036
|
-
function
|
|
1027
|
+
function resolvePiCliConfig(target, env, evalFilePath) {
|
|
1028
|
+
const executableSource = target.executable ?? target.command ?? target.binary;
|
|
1037
1029
|
const subproviderSource = target.subprovider;
|
|
1038
1030
|
const modelSource = target.model ?? target.pi_model ?? target.piModel;
|
|
1039
1031
|
const apiKeySource = target.api_key ?? target.apiKey;
|
|
1032
|
+
const toolsSource = target.tools ?? target.pi_tools ?? target.piTools;
|
|
1033
|
+
const thinkingSource = target.thinking ?? target.pi_thinking ?? target.piThinking;
|
|
1034
|
+
const cwdSource = target.cwd;
|
|
1035
|
+
const workspaceTemplateSource = target.workspace_template ?? target.workspaceTemplate;
|
|
1040
1036
|
const timeoutSource = target.timeout_seconds ?? target.timeoutSeconds;
|
|
1037
|
+
const logDirSource = target.log_dir ?? target.logDir ?? target.log_directory ?? target.logDirectory;
|
|
1038
|
+
const logFormatSource = target.log_format ?? target.logFormat;
|
|
1041
1039
|
const systemPromptSource = target.system_prompt ?? target.systemPrompt;
|
|
1040
|
+
const executable = resolveOptionalString(executableSource, env, `${target.name} pi-cli executable`, {
|
|
1041
|
+
allowLiteral: true,
|
|
1042
|
+
optionalEnv: true
|
|
1043
|
+
}) ?? "pi";
|
|
1042
1044
|
const subprovider = resolveOptionalString(
|
|
1043
1045
|
subproviderSource,
|
|
1044
1046
|
env,
|
|
1045
|
-
`${target.name} pi-
|
|
1046
|
-
{
|
|
1047
|
-
allowLiteral: true,
|
|
1048
|
-
optionalEnv: true
|
|
1049
|
-
}
|
|
1047
|
+
`${target.name} pi-cli subprovider`,
|
|
1048
|
+
{ allowLiteral: true, optionalEnv: true }
|
|
1050
1049
|
);
|
|
1051
|
-
const model = resolveOptionalString(modelSource, env, `${target.name} pi-
|
|
1050
|
+
const model = resolveOptionalString(modelSource, env, `${target.name} pi-cli model`, {
|
|
1052
1051
|
allowLiteral: true,
|
|
1053
1052
|
optionalEnv: true
|
|
1054
1053
|
});
|
|
1055
|
-
const apiKey = resolveOptionalString(apiKeySource, env, `${target.name} pi-
|
|
1054
|
+
const apiKey = resolveOptionalString(apiKeySource, env, `${target.name} pi-cli api key`, {
|
|
1056
1055
|
allowLiteral: false,
|
|
1057
1056
|
optionalEnv: true
|
|
1058
1057
|
});
|
|
1059
|
-
const
|
|
1058
|
+
const tools = resolveOptionalString(toolsSource, env, `${target.name} pi-cli tools`, {
|
|
1059
|
+
allowLiteral: true,
|
|
1060
|
+
optionalEnv: true
|
|
1061
|
+
});
|
|
1062
|
+
const thinking = resolveOptionalString(thinkingSource, env, `${target.name} pi-cli thinking`, {
|
|
1063
|
+
allowLiteral: true,
|
|
1064
|
+
optionalEnv: true
|
|
1065
|
+
});
|
|
1066
|
+
const rawArgs = target.args ?? target.arguments;
|
|
1067
|
+
const args = resolveOptionalStringArray(rawArgs, env, `${target.name} pi-cli args`);
|
|
1068
|
+
const cwd = resolveOptionalString(cwdSource, env, `${target.name} pi-cli cwd`, {
|
|
1069
|
+
allowLiteral: true,
|
|
1070
|
+
optionalEnv: true
|
|
1071
|
+
});
|
|
1072
|
+
let workspaceTemplate = resolveOptionalString(
|
|
1073
|
+
workspaceTemplateSource,
|
|
1074
|
+
env,
|
|
1075
|
+
`${target.name} pi-cli workspace template`,
|
|
1076
|
+
{ allowLiteral: true, optionalEnv: true }
|
|
1077
|
+
);
|
|
1078
|
+
if (workspaceTemplate && evalFilePath && !path2.isAbsolute(workspaceTemplate)) {
|
|
1079
|
+
workspaceTemplate = path2.resolve(path2.dirname(path2.resolve(evalFilePath)), workspaceTemplate);
|
|
1080
|
+
}
|
|
1081
|
+
if (cwd && workspaceTemplate) {
|
|
1082
|
+
throw new Error(`${target.name}: 'cwd' and 'workspace_template' are mutually exclusive.`);
|
|
1083
|
+
}
|
|
1084
|
+
const timeoutMs = resolveTimeoutMs(timeoutSource, `${target.name} pi-cli timeout`);
|
|
1085
|
+
const logDir = resolveOptionalString(logDirSource, env, `${target.name} pi-cli log directory`, {
|
|
1086
|
+
allowLiteral: true,
|
|
1087
|
+
optionalEnv: true
|
|
1088
|
+
});
|
|
1089
|
+
const logFormat = logFormatSource === "json" || logFormatSource === "summary" ? logFormatSource : void 0;
|
|
1060
1090
|
const systemPrompt = typeof systemPromptSource === "string" && systemPromptSource.trim().length > 0 ? systemPromptSource.trim() : void 0;
|
|
1061
1091
|
return {
|
|
1092
|
+
executable,
|
|
1062
1093
|
subprovider,
|
|
1063
1094
|
model,
|
|
1064
1095
|
apiKey,
|
|
1096
|
+
tools,
|
|
1097
|
+
thinking,
|
|
1098
|
+
args,
|
|
1099
|
+
cwd,
|
|
1100
|
+
workspaceTemplate,
|
|
1065
1101
|
timeoutMs,
|
|
1102
|
+
logDir,
|
|
1103
|
+
logFormat,
|
|
1066
1104
|
systemPrompt
|
|
1067
1105
|
};
|
|
1068
1106
|
}
|
|
@@ -1543,7 +1581,7 @@ var AGENT_PROVIDER_KINDS = [
|
|
|
1543
1581
|
"copilot-sdk",
|
|
1544
1582
|
"copilot-cli",
|
|
1545
1583
|
"pi-coding-agent",
|
|
1546
|
-
"pi-
|
|
1584
|
+
"pi-cli",
|
|
1547
1585
|
"claude",
|
|
1548
1586
|
"claude-cli",
|
|
1549
1587
|
"claude-sdk",
|
|
@@ -1560,7 +1598,7 @@ var KNOWN_PROVIDERS = [
|
|
|
1560
1598
|
"copilot-sdk",
|
|
1561
1599
|
"copilot-cli",
|
|
1562
1600
|
"pi-coding-agent",
|
|
1563
|
-
"pi-
|
|
1601
|
+
"pi-cli",
|
|
1564
1602
|
"claude",
|
|
1565
1603
|
"claude-cli",
|
|
1566
1604
|
"claude-sdk",
|
|
@@ -1636,4 +1674,4 @@ export {
|
|
|
1636
1674
|
extractLastAssistantContent,
|
|
1637
1675
|
isAgentProvider
|
|
1638
1676
|
};
|
|
1639
|
-
//# sourceMappingURL=chunk-
|
|
1677
|
+
//# sourceMappingURL=chunk-4XWPXNQM.js.map
|