waypoi 0.0.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/.github/instructions/ui.instructions.md +42 -0
- package/.github/workflows/ci.yml +35 -0
- package/.github/workflows/publish.yml +71 -0
- package/.github/workflows/release.yml +48 -0
- package/.playwright-mcp/console-2026-04-04T01-41-10-746Z.log +2 -0
- package/.playwright-mcp/console-2026-04-04T01-41-28-799Z.log +3 -0
- package/.playwright-mcp/console-2026-04-05T02-26-51-909Z.log +76 -0
- package/.playwright-mcp/page-2026-04-04T01-41-10-816Z.yml +1 -0
- package/.playwright-mcp/page-2026-04-04T01-41-29-141Z.yml +77 -0
- package/.playwright-mcp/page-2026-04-04T01-41-42-633Z.yml +190 -0
- package/.playwright-mcp/page-2026-04-04T01-42-03-929Z.yml +262 -0
- package/.playwright-mcp/page-2026-04-04T02-12-54-813Z.yml +6 -0
- package/.playwright-mcp/page-2026-04-04T02-14-58-600Z.yml +190 -0
- package/.playwright-mcp/page-2026-04-04T02-15-03-923Z.yml +190 -0
- package/.playwright-mcp/page-2026-04-04T02-15-07-426Z.yml +190 -0
- package/.playwright-mcp/page-2026-04-04T02-15-25-729Z.yml +262 -0
- package/.playwright-mcp/page-2026-04-04T02-16-22-984Z.yml +262 -0
- package/.playwright-mcp/page-2026-04-04T02-17-00-599Z.yml +190 -0
- package/.playwright-mcp/page-2026-04-04T02-17-50-874Z.yml +190 -0
- package/.playwright-mcp/page-2026-04-05T02-26-55-570Z.yml +6 -0
- package/AGENTS.md +48 -0
- package/CHANGELOG.md +131 -0
- package/README.md +552 -0
- package/assets/agent-mode.png +0 -0
- package/assets/categorize.png +0 -0
- package/assets/dashboard.png +0 -0
- package/assets/endpoint-proxy.png +0 -0
- package/assets/icon.png +0 -0
- package/assets/mcp-generate-image.png +0 -0
- package/assets/mcp-understand-image.png +0 -0
- package/assets/peek-token-flow.png +0 -0
- package/assets/playground.png +0 -0
- package/assets/sankey.png +0 -0
- package/cli/index.ts +2805 -0
- package/cli/legacyRewrite.ts +108 -0
- package/cli/modelRef.ts +24 -0
- package/dist/cli/index.js +2536 -0
- package/dist/cli/legacyRewrite.js +92 -0
- package/dist/cli/modelRef.js +20 -0
- package/dist/src/benchmark/artifacts.js +131 -0
- package/dist/src/benchmark/capabilityClassifier.js +81 -0
- package/dist/src/benchmark/capabilityStore.js +144 -0
- package/dist/src/benchmark/config.js +238 -0
- package/dist/src/benchmark/gates.js +118 -0
- package/dist/src/benchmark/jobs.js +252 -0
- package/dist/src/benchmark/runner.js +1847 -0
- package/dist/src/benchmark/schema.js +353 -0
- package/dist/src/benchmark/suites.js +314 -0
- package/dist/src/benchmark/tinyQaDataset.js +422 -0
- package/dist/src/benchmark/types.js +25 -0
- package/dist/src/config.js +47 -0
- package/dist/src/index.js +178 -0
- package/dist/src/mcp/client.js +215 -0
- package/dist/src/mcp/discovery.js +226 -0
- package/dist/src/mcp/policy.js +65 -0
- package/dist/src/mcp/registry.js +129 -0
- package/dist/src/mcp/service.js +460 -0
- package/dist/src/middleware/auth.js +179 -0
- package/dist/src/middleware/requestCapture.js +192 -0
- package/dist/src/middleware/requestStats.js +118 -0
- package/dist/src/pools/builder.js +132 -0
- package/dist/src/pools/repository.js +69 -0
- package/dist/src/pools/scheduler.js +360 -0
- package/dist/src/pools/types.js +2 -0
- package/dist/src/protocols/adapters/dashscope.js +267 -0
- package/dist/src/protocols/adapters/inferenceV2.js +346 -0
- package/dist/src/protocols/adapters/openai.js +27 -0
- package/dist/src/protocols/registry.js +99 -0
- package/dist/src/protocols/types.js +2 -0
- package/dist/src/providers/health.js +153 -0
- package/dist/src/providers/importer.js +289 -0
- package/dist/src/providers/modelRegistry.js +313 -0
- package/dist/src/providers/repository.js +361 -0
- package/dist/src/providers/types.js +2 -0
- package/dist/src/routes/admin.js +531 -0
- package/dist/src/routes/audio.js +295 -0
- package/dist/src/routes/chat.js +240 -0
- package/dist/src/routes/embeddings.js +157 -0
- package/dist/src/routes/images.js +288 -0
- package/dist/src/routes/mcp.js +256 -0
- package/dist/src/routes/mcpService.js +100 -0
- package/dist/src/routes/models.js +48 -0
- package/dist/src/routes/responses.js +711 -0
- package/dist/src/routes/sessions.js +450 -0
- package/dist/src/routes/stats.js +270 -0
- package/dist/src/routes/ui.js +97 -0
- package/dist/src/routes/videos.js +107 -0
- package/dist/src/routing/router.js +338 -0
- package/dist/src/services/imageGeneration.js +280 -0
- package/dist/src/services/imageUnderstanding.js +352 -0
- package/dist/src/services/videoGeneration.js +79 -0
- package/dist/src/storage/captureRepository.js +1591 -0
- package/dist/src/storage/files.js +157 -0
- package/dist/src/storage/imageCache.js +346 -0
- package/dist/src/storage/repositories.js +388 -0
- package/dist/src/storage/sessionRepository.js +370 -0
- package/dist/src/storage/statsRepository.js +204 -0
- package/dist/src/transport/httpClient.js +126 -0
- package/dist/src/types.js +2 -0
- package/dist/src/utils/messageMedia.js +285 -0
- package/dist/src/utils/modelCapabilities.js +108 -0
- package/dist/src/utils/modelDiscovery.js +170 -0
- package/dist/src/version.js +5 -0
- package/dist/src/workers/captureRetention.js +25 -0
- package/dist/src/workers/configWatcher.js +91 -0
- package/dist/src/workers/healthChecker.js +21 -0
- package/dist/src/workers/statsRotation.js +41 -0
- package/docs/LLM/output_schema.md +312 -0
- package/docs/benchmark.md +208 -0
- package/docs/mcp-guidelines.md +125 -0
- package/docs/mcp-service.md +178 -0
- package/docs/opencode.md +86 -0
- package/docs/providers.md +79 -0
- package/examples/benchmark.config.yaml +28 -0
- package/examples/providers/alibaba-dashscope.yaml +88 -0
- package/examples/providers/alibaba-llm.yaml +64 -0
- package/examples/providers/alibaba-registry.yaml +7 -0
- package/examples/providers/inference-v2-ray.yaml +29 -0
- package/examples/scenarios/assets/omni-call-sample.wav +0 -0
- package/examples/scenarios/custom.jsonl +5 -0
- package/examples/scenarios/custom.yaml +40 -0
- package/model-form-v2.png +0 -0
- package/package.json +66 -0
- package/provider-form-v2.png +0 -0
- package/provider-form.png +0 -0
- package/scripts/manual-test.sh +11 -0
- package/scripts/version-from-git.js +23 -0
- package/src/benchmark/artifacts.ts +149 -0
- package/src/benchmark/capabilityClassifier.ts +99 -0
- package/src/benchmark/capabilityStore.ts +174 -0
- package/src/benchmark/config.ts +337 -0
- package/src/benchmark/gates.ts +164 -0
- package/src/benchmark/jobs.ts +312 -0
- package/src/benchmark/runner.ts +2519 -0
- package/src/benchmark/schema.ts +443 -0
- package/src/benchmark/suites.ts +323 -0
- package/src/benchmark/tinyQaDataset.ts +428 -0
- package/src/benchmark/types.ts +442 -0
- package/src/config.ts +44 -0
- package/src/index.ts +195 -0
- package/src/mcp/client.ts +305 -0
- package/src/mcp/discovery.ts +266 -0
- package/src/mcp/policy.ts +105 -0
- package/src/mcp/registry.ts +164 -0
- package/src/mcp/service.ts +611 -0
- package/src/middleware/auth.ts +251 -0
- package/src/middleware/requestCapture.ts +245 -0
- package/src/middleware/requestStats.ts +163 -0
- package/src/pools/builder.ts +159 -0
- package/src/pools/repository.ts +71 -0
- package/src/pools/scheduler.ts +425 -0
- package/src/pools/types.ts +117 -0
- package/src/protocols/adapters/dashscope.ts +335 -0
- package/src/protocols/adapters/inferenceV2.ts +428 -0
- package/src/protocols/adapters/openai.ts +32 -0
- package/src/protocols/registry.ts +117 -0
- package/src/protocols/types.ts +81 -0
- package/src/providers/health.ts +207 -0
- package/src/providers/importer.ts +402 -0
- package/src/providers/modelRegistry.ts +415 -0
- package/src/providers/repository.ts +439 -0
- package/src/providers/types.ts +113 -0
- package/src/routes/admin.ts +666 -0
- package/src/routes/audio.ts +372 -0
- package/src/routes/chat.ts +301 -0
- package/src/routes/embeddings.ts +197 -0
- package/src/routes/images.ts +356 -0
- package/src/routes/mcp.ts +320 -0
- package/src/routes/mcpService.ts +114 -0
- package/src/routes/models.ts +50 -0
- package/src/routes/responses.ts +872 -0
- package/src/routes/sessions.ts +558 -0
- package/src/routes/stats.ts +312 -0
- package/src/routes/ui.ts +96 -0
- package/src/routes/videos.ts +132 -0
- package/src/routing/router.ts +501 -0
- package/src/services/imageGeneration.ts +396 -0
- package/src/services/imageUnderstanding.ts +449 -0
- package/src/services/videoGeneration.ts +127 -0
- package/src/storage/captureRepository.ts +1835 -0
- package/src/storage/files.ts +178 -0
- package/src/storage/imageCache.ts +405 -0
- package/src/storage/repositories.ts +494 -0
- package/src/storage/sessionRepository.ts +419 -0
- package/src/storage/statsRepository.ts +238 -0
- package/src/transport/httpClient.ts +145 -0
- package/src/types.ts +322 -0
- package/src/utils/messageMedia.ts +293 -0
- package/src/utils/modelCapabilities.ts +161 -0
- package/src/utils/modelDiscovery.ts +203 -0
- package/src/workers/captureRetention.ts +25 -0
- package/src/workers/configWatcher.ts +115 -0
- package/src/workers/healthChecker.ts +22 -0
- package/src/workers/statsRotation.ts +49 -0
- package/tests/benchmarkAdminRoutes.test.ts +82 -0
- package/tests/benchmarkBasics.test.ts +116 -0
- package/tests/captureAdminRoutes.test.ts +420 -0
- package/tests/captureRepository.test.ts +797 -0
- package/tests/cliLegacyRewrite.test.ts +45 -0
- package/tests/imageGeneration.service.test.ts +107 -0
- package/tests/imageUnderstanding.service.test.ts +123 -0
- package/tests/mcpPolicy.test.ts +105 -0
- package/tests/mcpService.test.ts +1245 -0
- package/tests/modelRef.test.ts +23 -0
- package/tests/modelsRoutes.test.ts +154 -0
- package/tests/sessionMediaCache.test.ts +167 -0
- package/tests/statsRoutes.test.ts +323 -0
- package/tsconfig.json +15 -0
- package/ui/index.html +16 -0
- package/ui/package-lock.json +8521 -0
- package/ui/package.json +52 -0
- package/ui/postcss.config.js +6 -0
- package/ui/public/assets/apple-touch-icon.png +0 -0
- package/ui/public/assets/favicon-16.png +0 -0
- package/ui/public/assets/favicon-32.png +0 -0
- package/ui/public/assets/icon-192.png +0 -0
- package/ui/public/assets/icon-512.png +0 -0
- package/ui/src/App.tsx +27 -0
- package/ui/src/api/client.ts +1503 -0
- package/ui/src/components/EndpointUsageGuide.tsx +361 -0
- package/ui/src/components/Layout.tsx +124 -0
- package/ui/src/components/MessageContent.tsx +365 -0
- package/ui/src/components/ToolCallMessage.tsx +179 -0
- package/ui/src/components/ToolPicker.tsx +442 -0
- package/ui/src/components/messageContentParser.test.ts +41 -0
- package/ui/src/components/messageContentParser.ts +73 -0
- package/ui/src/components/thinkingPreview.test.ts +27 -0
- package/ui/src/components/thinkingPreview.ts +15 -0
- package/ui/src/components/toMermaidSankey.test.ts +78 -0
- package/ui/src/components/toMermaidSankey.ts +56 -0
- package/ui/src/components/ui/button.tsx +58 -0
- package/ui/src/components/ui/input.tsx +21 -0
- package/ui/src/components/ui/textarea.tsx +21 -0
- package/ui/src/lib/utils.ts +6 -0
- package/ui/src/main.tsx +9 -0
- package/ui/src/pages/AgentPlayground.tsx +2010 -0
- package/ui/src/pages/Benchmark.tsx +988 -0
- package/ui/src/pages/Dashboard.tsx +581 -0
- package/ui/src/pages/Peek.tsx +962 -0
- package/ui/src/pages/Settings.tsx +2013 -0
- package/ui/src/pages/agentPlaygroundPayload.test.ts +109 -0
- package/ui/src/pages/agentPlaygroundPayload.ts +97 -0
- package/ui/src/pages/agentThinkingContent.test.ts +50 -0
- package/ui/src/pages/agentThinkingContent.ts +57 -0
- package/ui/src/pages/dashboardTokenUsage.test.ts +66 -0
- package/ui/src/pages/dashboardTokenUsage.ts +36 -0
- package/ui/src/pages/imageUpload.test.ts +39 -0
- package/ui/src/pages/imageUpload.ts +71 -0
- package/ui/src/pages/peekFilters.test.ts +29 -0
- package/ui/src/pages/peekFilters.ts +13 -0
- package/ui/src/pages/peekMedia.test.ts +58 -0
- package/ui/src/pages/peekMedia.ts +148 -0
- package/ui/src/pages/sessionAutoTitle.test.ts +128 -0
- package/ui/src/pages/sessionAutoTitle.ts +106 -0
- package/ui/src/stores/settings.ts +58 -0
- package/ui/src/styles/globals.css +223 -0
- package/ui/src/vite-env.d.ts +8 -0
- package/ui/tailwind.config.js +106 -0
- package/ui/tsconfig.json +32 -0
- package/ui/vite.config.ts +37 -0
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.rewriteLegacyArgv = rewriteLegacyArgv;
|
|
4
|
+
function hasPositional(value) {
|
|
5
|
+
return typeof value === "string" && value.length > 0 && !value.startsWith("-");
|
|
6
|
+
}
|
|
7
|
+
function joinModelRef(providerId, modelRef) {
|
|
8
|
+
if (modelRef.includes("/")) {
|
|
9
|
+
return modelRef;
|
|
10
|
+
}
|
|
11
|
+
return `${providerId}/${modelRef}`;
|
|
12
|
+
}
|
|
13
|
+
function rewriteLegacyArgv(argv) {
|
|
14
|
+
const args = [...argv];
|
|
15
|
+
const [a0, a1, a2, a3, a4] = args;
|
|
16
|
+
if (a0 === "provider" && a1 === "model" && (a2 === "ls" || a2 === "list") && hasPositional(a3)) {
|
|
17
|
+
return {
|
|
18
|
+
argv: ["models", a3, ...args.slice(4)],
|
|
19
|
+
legacyUsed: true,
|
|
20
|
+
ruleId: "provider-model-list",
|
|
21
|
+
oldCmd: args.join(" "),
|
|
22
|
+
newCmd: `models ${a3}`,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
if (a0 === "provider" && a1 === "models" && hasPositional(a2)) {
|
|
26
|
+
return {
|
|
27
|
+
argv: ["models", a2, ...args.slice(3)],
|
|
28
|
+
legacyUsed: true,
|
|
29
|
+
ruleId: "provider-models-list",
|
|
30
|
+
oldCmd: args.join(" "),
|
|
31
|
+
newCmd: `models ${a2}`,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
if (a0 === "provider" && (a1 === "ls" || a1 === "list")) {
|
|
35
|
+
return {
|
|
36
|
+
argv: ["providers", "list", ...args.slice(2)],
|
|
37
|
+
legacyUsed: true,
|
|
38
|
+
ruleId: "provider-list",
|
|
39
|
+
oldCmd: args.join(" "),
|
|
40
|
+
newCmd: "providers list",
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
if (a0 === "provider" && a1 === "show" && hasPositional(a2)) {
|
|
44
|
+
return {
|
|
45
|
+
argv: ["providers", "show", a2, ...args.slice(3)],
|
|
46
|
+
legacyUsed: true,
|
|
47
|
+
ruleId: "provider-show",
|
|
48
|
+
oldCmd: args.join(" "),
|
|
49
|
+
newCmd: `providers show ${a2}`,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
if (a0 === "provider" && (a1 === "enable" || a1 === "disable") && hasPositional(a2)) {
|
|
53
|
+
return {
|
|
54
|
+
argv: ["providers", a1, a2, ...args.slice(3)],
|
|
55
|
+
legacyUsed: true,
|
|
56
|
+
ruleId: `provider-${a1}`,
|
|
57
|
+
oldCmd: args.join(" "),
|
|
58
|
+
newCmd: `providers ${a1} ${a2}`,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
if (a0 === "provider" && a1 === "model" && a2 === "show" && hasPositional(a3) && hasPositional(a4)) {
|
|
62
|
+
const modelRef = joinModelRef(a3, a4);
|
|
63
|
+
return {
|
|
64
|
+
argv: ["models", "show", modelRef, ...args.slice(5)],
|
|
65
|
+
legacyUsed: true,
|
|
66
|
+
ruleId: "provider-model-show",
|
|
67
|
+
oldCmd: args.join(" "),
|
|
68
|
+
newCmd: `models show ${modelRef}`,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
if (a0 === "provider" && a1 === "model" && (a2 === "enable" || a2 === "disable") && hasPositional(a3) && hasPositional(a4)) {
|
|
72
|
+
const modelRef = joinModelRef(a3, a4);
|
|
73
|
+
return {
|
|
74
|
+
argv: ["models", a2, modelRef, ...args.slice(5)],
|
|
75
|
+
legacyUsed: true,
|
|
76
|
+
ruleId: `provider-model-${a2}`,
|
|
77
|
+
oldCmd: args.join(" "),
|
|
78
|
+
newCmd: `models ${a2} ${modelRef}`,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
if (a0 === "provider" && a1 === "model" && a2 === "set-key" && hasPositional(a3) && hasPositional(a4)) {
|
|
82
|
+
const modelRef = joinModelRef(a3, a4);
|
|
83
|
+
return {
|
|
84
|
+
argv: ["models", "set-key", modelRef, ...args.slice(5)],
|
|
85
|
+
legacyUsed: true,
|
|
86
|
+
ruleId: "provider-model-set-key",
|
|
87
|
+
oldCmd: args.join(" "),
|
|
88
|
+
newCmd: `models set-key ${modelRef}`,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
return { argv, legacyUsed: false };
|
|
92
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseModelRef = parseModelRef;
|
|
4
|
+
function parseModelRef(input) {
|
|
5
|
+
const trimmed = input.trim();
|
|
6
|
+
const slashIndex = trimmed.indexOf("/");
|
|
7
|
+
if (slashIndex <= 0 || slashIndex === trimmed.length - 1) {
|
|
8
|
+
return { modelId: trimmed };
|
|
9
|
+
}
|
|
10
|
+
const providerId = trimmed.slice(0, slashIndex).trim();
|
|
11
|
+
const modelId = trimmed.slice(slashIndex + 1).trim();
|
|
12
|
+
if (!providerId || !modelId) {
|
|
13
|
+
return { modelId: trimmed };
|
|
14
|
+
}
|
|
15
|
+
return {
|
|
16
|
+
providerId,
|
|
17
|
+
modelId,
|
|
18
|
+
canonical: `${providerId}/${modelId}`,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.writeBenchmarkArtifacts = writeBenchmarkArtifacts;
|
|
7
|
+
const fs_1 = require("fs");
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
async function writeBenchmarkArtifacts(paths, report, outPath) {
|
|
10
|
+
const timestamp = timestampForFileName();
|
|
11
|
+
const defaultDir = path_1.default.join(paths.baseDir, "benchmarks");
|
|
12
|
+
const destination = outPath && outPath.trim().length > 0 ? path_1.default.resolve(outPath) : defaultDir;
|
|
13
|
+
let jsonPath;
|
|
14
|
+
let textPath;
|
|
15
|
+
if (destination.endsWith(".json")) {
|
|
16
|
+
jsonPath = destination;
|
|
17
|
+
textPath = destination.replace(/\.json$/i, ".txt");
|
|
18
|
+
}
|
|
19
|
+
else if (destination.endsWith(".txt")) {
|
|
20
|
+
textPath = destination;
|
|
21
|
+
jsonPath = destination.replace(/\.txt$/i, ".json");
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
jsonPath = path_1.default.join(destination, `bench-${timestamp}.json`);
|
|
25
|
+
textPath = path_1.default.join(destination, `bench-${timestamp}.txt`);
|
|
26
|
+
}
|
|
27
|
+
await fs_1.promises.mkdir(path_1.default.dirname(jsonPath), { recursive: true });
|
|
28
|
+
await fs_1.promises.mkdir(path_1.default.dirname(textPath), { recursive: true });
|
|
29
|
+
await fs_1.promises.writeFile(jsonPath, JSON.stringify(report, null, 2), "utf8");
|
|
30
|
+
await fs_1.promises.writeFile(textPath, renderTextSummary(report), "utf8");
|
|
31
|
+
return { jsonPath, textPath };
|
|
32
|
+
}
|
|
33
|
+
function renderTextSummary(report) {
|
|
34
|
+
const lines = [];
|
|
35
|
+
lines.push("Waypoi Benchmark Report");
|
|
36
|
+
lines.push(`Run ID: ${report.id}`);
|
|
37
|
+
lines.push(`Created: ${report.createdAt}`);
|
|
38
|
+
lines.push(`Profile: ${report.profile}`);
|
|
39
|
+
lines.push(`Mode: ${report.executionMode}`);
|
|
40
|
+
if (report.suite)
|
|
41
|
+
lines.push(`Suite: ${report.suite}`);
|
|
42
|
+
if (report.exampleId)
|
|
43
|
+
lines.push(`Example: ${report.exampleId}`);
|
|
44
|
+
if (report.scenarioPath)
|
|
45
|
+
lines.push(`Scenario File: ${report.scenarioPath}`);
|
|
46
|
+
if (report.modelOverride)
|
|
47
|
+
lines.push(`Model Override: ${report.modelOverride}`);
|
|
48
|
+
lines.push("");
|
|
49
|
+
lines.push("Overall");
|
|
50
|
+
lines.push(`- Scenarios: ${report.total}`);
|
|
51
|
+
lines.push(`- Executed: ${report.executed}`);
|
|
52
|
+
lines.push(`- Skipped: ${report.skipped}`);
|
|
53
|
+
lines.push(`- Success: ${report.succeeded}`);
|
|
54
|
+
lines.push(`- Failed: ${report.failed}`);
|
|
55
|
+
lines.push(`- Success Rate: ${(report.successRate * 100).toFixed(1)}%`);
|
|
56
|
+
lines.push(`- Avg Latency: ${report.avgLatencyMs}ms`);
|
|
57
|
+
lines.push(`- P95 Latency: ${report.p95LatencyMs}ms`);
|
|
58
|
+
lines.push(`- Tokens: ${report.totalTokens}`);
|
|
59
|
+
lines.push(`- Tool Calls: ${report.totalToolCalls}`);
|
|
60
|
+
lines.push(`- Throughput: ${report.avgThroughputTokensPerSec.toFixed(2)} tokens/s`);
|
|
61
|
+
lines.push("");
|
|
62
|
+
lines.push("Gates");
|
|
63
|
+
lines.push(`- Hard: ${report.gateResults.hard.passed ? "PASS" : "FAIL"}`);
|
|
64
|
+
for (const message of report.gateResults.hard.messages) {
|
|
65
|
+
lines.push(` - ${message}`);
|
|
66
|
+
}
|
|
67
|
+
lines.push(`- Soft: ${report.gateResults.soft.passed ? "PASS" : "WARN"}`);
|
|
68
|
+
for (const message of report.gateResults.soft.messages) {
|
|
69
|
+
lines.push(` - ${message}`);
|
|
70
|
+
}
|
|
71
|
+
lines.push("");
|
|
72
|
+
lines.push("By Mode");
|
|
73
|
+
for (const [mode, summary] of Object.entries(report.modeSummary)) {
|
|
74
|
+
lines.push(`- ${mode}: total=${summary.total} executed=${summary.executed} skipped=${summary.skipped} passed=${summary.passed} failed=${summary.failed}`);
|
|
75
|
+
}
|
|
76
|
+
lines.push("");
|
|
77
|
+
lines.push("Scenario Results");
|
|
78
|
+
for (const scenario of report.results) {
|
|
79
|
+
if (scenario.status === "skipped") {
|
|
80
|
+
lines.push(`- ${scenario.id} [${scenario.mode}] SKIPPED: ${scenario.skippedReason ?? "not applicable"}`);
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
lines.push(`- ${scenario.id} [${scenario.mode}] ${scenario.status.toUpperCase()} passRate=${(scenario.passRate * 100).toFixed(1)}% p95=${scenario.p95LatencyMs}ms tokens=${scenario.totalTokens} tools=${scenario.totalToolCalls} attempts=${scenario.candidateAttempts} failovers=${scenario.failovers} rateLimitSwitches=${scenario.rateLimitSwitches}`);
|
|
84
|
+
for (const reason of scenario.errorReasons) {
|
|
85
|
+
lines.push(` - ${reason}`);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
if (report.scenarioDetails.length > 0) {
|
|
89
|
+
lines.push("");
|
|
90
|
+
lines.push("Showcase Details");
|
|
91
|
+
for (const detail of report.scenarioDetails) {
|
|
92
|
+
lines.push(`- ${detail.example?.title ?? detail.id} [${detail.status}]`);
|
|
93
|
+
lines.push(` model=${detail.model}`);
|
|
94
|
+
lines.push(` verdict=${detail.verdict}`);
|
|
95
|
+
if (detail.usedToolNames.length > 0) {
|
|
96
|
+
lines.push(` tools=${detail.usedToolNames.join(", ")}`);
|
|
97
|
+
}
|
|
98
|
+
if (detail.finalResponsePreview) {
|
|
99
|
+
lines.push(` final=${detail.finalResponsePreview}`);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
if (report.topFailureReasons.length > 0) {
|
|
104
|
+
lines.push("");
|
|
105
|
+
lines.push("Top Failure Reasons");
|
|
106
|
+
for (const item of report.topFailureReasons) {
|
|
107
|
+
lines.push(`- ${item.reason} (${item.count})`);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
if (report.warnings.length > 0) {
|
|
111
|
+
lines.push("");
|
|
112
|
+
lines.push("Warnings");
|
|
113
|
+
for (const warning of report.warnings) {
|
|
114
|
+
lines.push(`- ${warning}`);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
if (report.capabilityMatrix && report.capabilityMatrix.models.length > 0) {
|
|
118
|
+
lines.push("");
|
|
119
|
+
lines.push("Capability Matrix");
|
|
120
|
+
lines.push(`- TTL Days: ${report.capabilityMatrix.ttlDays}`);
|
|
121
|
+
for (const model of report.capabilityMatrix.models) {
|
|
122
|
+
lines.push(`- ${model.model} (${model.freshness}) verified=${model.lastVerifiedAt}`);
|
|
123
|
+
lines.push(` chat=${model.findings.chat_basic.status} tools=${model.findings.chat_tool_calls.status} embed=${model.findings.embeddings.status} image=${model.findings.images_generation.status} audio_in=${model.findings.audio_transcription.status} audio_out=${model.findings.audio_speech.status}`);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
lines.push("");
|
|
127
|
+
return `${lines.join("\n")}\n`;
|
|
128
|
+
}
|
|
129
|
+
function timestampForFileName() {
|
|
130
|
+
return new Date().toISOString().replace(/[:.]/g, "-");
|
|
131
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.classifyCapabilityStatus = classifyCapabilityStatus;
|
|
4
|
+
const UNSUPPORTED_SIGNAL_PATTERNS = [
|
|
5
|
+
/unsupported/i,
|
|
6
|
+
/not\s+supported/i,
|
|
7
|
+
/not\s+implemented/i,
|
|
8
|
+
/unknown\s+parameter/i,
|
|
9
|
+
/invalid\s+parameter/i,
|
|
10
|
+
/unrecognized\s+parameter/i,
|
|
11
|
+
/does\s+not\s+support/i,
|
|
12
|
+
/modality\s+not\s+supported/i,
|
|
13
|
+
/endpoint\s+not\s+found/i,
|
|
14
|
+
/route\s+not\s+found/i,
|
|
15
|
+
];
|
|
16
|
+
const MISCONFIGURED_SIGNAL_PATTERNS = [
|
|
17
|
+
/api\s*key/i,
|
|
18
|
+
/missing\s+api\s*key/i,
|
|
19
|
+
/authorization/i,
|
|
20
|
+
/unauthorized/i,
|
|
21
|
+
/forbidden/i,
|
|
22
|
+
/invalid\s+auth/i,
|
|
23
|
+
/invalid\s+api\s*key/i,
|
|
24
|
+
/model\s+not\s+found/i,
|
|
25
|
+
/unknown\s+model/i,
|
|
26
|
+
/no\s+such\s+model/i,
|
|
27
|
+
/credential/i,
|
|
28
|
+
/token/i,
|
|
29
|
+
];
|
|
30
|
+
const TRANSIENT_SIGNAL_PATTERNS = [
|
|
31
|
+
/timeout/i,
|
|
32
|
+
/timed\s*out/i,
|
|
33
|
+
/econnreset/i,
|
|
34
|
+
/econnrefused/i,
|
|
35
|
+
/enotfound/i,
|
|
36
|
+
/network/i,
|
|
37
|
+
/temporar/i,
|
|
38
|
+
/rate\s*limit/i,
|
|
39
|
+
/too\s+many\s+requests/i,
|
|
40
|
+
];
|
|
41
|
+
function classifyCapabilityStatus(input) {
|
|
42
|
+
if (input.success) {
|
|
43
|
+
return "supported";
|
|
44
|
+
}
|
|
45
|
+
const statusCode = Number.isFinite(input.statusCode) ? input.statusCode : undefined;
|
|
46
|
+
const error = (input.error ?? "").toLowerCase();
|
|
47
|
+
if (statusCode === 401 || statusCode === 403) {
|
|
48
|
+
return "misconfigured";
|
|
49
|
+
}
|
|
50
|
+
if (statusCode === 404) {
|
|
51
|
+
if (MISCONFIGURED_SIGNAL_PATTERNS.some((pattern) => pattern.test(error))) {
|
|
52
|
+
return "misconfigured";
|
|
53
|
+
}
|
|
54
|
+
return "unsupported";
|
|
55
|
+
}
|
|
56
|
+
if (statusCode === 429) {
|
|
57
|
+
return "unknown";
|
|
58
|
+
}
|
|
59
|
+
if (statusCode !== undefined && statusCode >= 500) {
|
|
60
|
+
return "unknown";
|
|
61
|
+
}
|
|
62
|
+
if (statusCode === 400) {
|
|
63
|
+
if (MISCONFIGURED_SIGNAL_PATTERNS.some((pattern) => pattern.test(error))) {
|
|
64
|
+
return "misconfigured";
|
|
65
|
+
}
|
|
66
|
+
if (UNSUPPORTED_SIGNAL_PATTERNS.some((pattern) => pattern.test(error))) {
|
|
67
|
+
return "unsupported";
|
|
68
|
+
}
|
|
69
|
+
return "unknown";
|
|
70
|
+
}
|
|
71
|
+
if (MISCONFIGURED_SIGNAL_PATTERNS.some((pattern) => pattern.test(error))) {
|
|
72
|
+
return "misconfigured";
|
|
73
|
+
}
|
|
74
|
+
if (UNSUPPORTED_SIGNAL_PATTERNS.some((pattern) => pattern.test(error))) {
|
|
75
|
+
return "unsupported";
|
|
76
|
+
}
|
|
77
|
+
if (TRANSIENT_SIGNAL_PATTERNS.some((pattern) => pattern.test(error))) {
|
|
78
|
+
return "unknown";
|
|
79
|
+
}
|
|
80
|
+
return "unknown";
|
|
81
|
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.capabilityCacheDir = capabilityCacheDir;
|
|
7
|
+
exports.computeConfigFingerprint = computeConfigFingerprint;
|
|
8
|
+
exports.writeCapabilitySnapshots = writeCapabilitySnapshots;
|
|
9
|
+
exports.listCapabilitySnapshots = listCapabilitySnapshots;
|
|
10
|
+
exports.getCapabilitySnapshotByModel = getCapabilitySnapshotByModel;
|
|
11
|
+
exports.statusRank = statusRank;
|
|
12
|
+
exports.toCapabilityMatrix = toCapabilityMatrix;
|
|
13
|
+
const crypto_1 = require("crypto");
|
|
14
|
+
const fs_1 = require("fs");
|
|
15
|
+
const path_1 = __importDefault(require("path"));
|
|
16
|
+
const DEFAULT_TTL_DAYS = 7;
|
|
17
|
+
function capabilityCacheDir(paths) {
|
|
18
|
+
return path_1.default.join(paths.baseDir, "capabilities");
|
|
19
|
+
}
|
|
20
|
+
function computeConfigFingerprint(input) {
|
|
21
|
+
const raw = JSON.stringify(input ?? {});
|
|
22
|
+
return (0, crypto_1.createHash)("sha256").update(raw).digest("hex").slice(0, 16);
|
|
23
|
+
}
|
|
24
|
+
async function writeCapabilitySnapshots(paths, snapshots) {
|
|
25
|
+
const dir = capabilityCacheDir(paths);
|
|
26
|
+
await fs_1.promises.mkdir(dir, { recursive: true });
|
|
27
|
+
for (const snapshot of snapshots) {
|
|
28
|
+
const filePath = path_1.default.join(dir, capabilityFileName(snapshot.providerId, snapshot.modelId));
|
|
29
|
+
await fs_1.promises.writeFile(filePath, JSON.stringify(snapshot, null, 2), "utf8");
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
async function listCapabilitySnapshots(paths, ttlDays = DEFAULT_TTL_DAYS) {
|
|
33
|
+
const dir = capabilityCacheDir(paths);
|
|
34
|
+
let files = [];
|
|
35
|
+
try {
|
|
36
|
+
files = await fs_1.promises.readdir(dir);
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
if (error.code === "ENOENT") {
|
|
40
|
+
return {
|
|
41
|
+
generatedAt: new Date().toISOString(),
|
|
42
|
+
ttlDays,
|
|
43
|
+
models: [],
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
throw error;
|
|
47
|
+
}
|
|
48
|
+
const snapshots = [];
|
|
49
|
+
for (const file of files) {
|
|
50
|
+
if (!file.endsWith(".json")) {
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
try {
|
|
54
|
+
const raw = await fs_1.promises.readFile(path_1.default.join(dir, file), "utf8");
|
|
55
|
+
const parsed = JSON.parse(raw);
|
|
56
|
+
const normalized = normalizeSnapshot(parsed, ttlDays);
|
|
57
|
+
if (normalized) {
|
|
58
|
+
snapshots.push(normalized);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
// Ignore malformed cache entries.
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
snapshots.sort((a, b) => `${a.providerId}/${a.modelId}`.localeCompare(`${b.providerId}/${b.modelId}`));
|
|
66
|
+
return {
|
|
67
|
+
generatedAt: new Date().toISOString(),
|
|
68
|
+
ttlDays,
|
|
69
|
+
models: snapshots,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
async function getCapabilitySnapshotByModel(paths, model, ttlDays = DEFAULT_TTL_DAYS) {
|
|
73
|
+
const all = await listCapabilitySnapshots(paths, ttlDays);
|
|
74
|
+
return all.models.find((item) => item.model === model || `${item.providerId}/${item.modelId}` === model) ?? null;
|
|
75
|
+
}
|
|
76
|
+
function capabilityFileName(providerId, modelId) {
|
|
77
|
+
return `${sanitizeSegment(providerId)}__${sanitizeSegment(modelId)}.json`;
|
|
78
|
+
}
|
|
79
|
+
function sanitizeSegment(value) {
|
|
80
|
+
return value.replace(/[^a-zA-Z0-9._-]/g, "_");
|
|
81
|
+
}
|
|
82
|
+
function normalizeSnapshot(input, ttlDays) {
|
|
83
|
+
if (!input || typeof input !== "object") {
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
if (!input.providerId || !input.modelId || !input.model || !input.lastVerifiedAt) {
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
const verifiedAtMs = Date.parse(input.lastVerifiedAt);
|
|
90
|
+
if (!Number.isFinite(verifiedAtMs)) {
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
const ttlMs = ttlDays * 24 * 60 * 60 * 1000;
|
|
94
|
+
const expiresAt = input.expiresAt && Number.isFinite(Date.parse(input.expiresAt))
|
|
95
|
+
? input.expiresAt
|
|
96
|
+
: new Date(verifiedAtMs + ttlMs).toISOString();
|
|
97
|
+
const freshness = computeFreshness(expiresAt);
|
|
98
|
+
return {
|
|
99
|
+
model: input.model,
|
|
100
|
+
providerId: input.providerId,
|
|
101
|
+
modelId: input.modelId,
|
|
102
|
+
configFingerprint: input.configFingerprint ?? "unknown",
|
|
103
|
+
confidence: clamp01(input.confidence ?? 0),
|
|
104
|
+
lastVerifiedAt: input.lastVerifiedAt,
|
|
105
|
+
expiresAt,
|
|
106
|
+
freshness,
|
|
107
|
+
findings: (input.findings ?? {}),
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
function computeFreshness(expiresAt) {
|
|
111
|
+
const expiryMs = Date.parse(expiresAt);
|
|
112
|
+
if (!Number.isFinite(expiryMs)) {
|
|
113
|
+
return "stale";
|
|
114
|
+
}
|
|
115
|
+
return Date.now() <= expiryMs ? "fresh" : "stale";
|
|
116
|
+
}
|
|
117
|
+
function clamp01(value) {
|
|
118
|
+
if (!Number.isFinite(value))
|
|
119
|
+
return 0;
|
|
120
|
+
if (value < 0)
|
|
121
|
+
return 0;
|
|
122
|
+
if (value > 1)
|
|
123
|
+
return 1;
|
|
124
|
+
return Number(value.toFixed(3));
|
|
125
|
+
}
|
|
126
|
+
function statusRank(status) {
|
|
127
|
+
switch (status) {
|
|
128
|
+
case "supported":
|
|
129
|
+
return 4;
|
|
130
|
+
case "unsupported":
|
|
131
|
+
return 3;
|
|
132
|
+
case "misconfigured":
|
|
133
|
+
return 2;
|
|
134
|
+
case "unknown":
|
|
135
|
+
return 1;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
function toCapabilityMatrix(result) {
|
|
139
|
+
return {
|
|
140
|
+
generatedAt: result.generatedAt,
|
|
141
|
+
ttlDays: result.ttlDays,
|
|
142
|
+
models: result.models,
|
|
143
|
+
};
|
|
144
|
+
}
|