@plasm_lang/vercel-agent 0.3.78 → 0.3.81
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/agent/instructions.md +1 -2
- package/bin/plasm-agent.mjs +5 -7
- package/package.json +26 -19
- package/scripts/plasm-cli.ts +4 -3
- package/scripts/run-plasm-cli.mjs +41 -0
- package/src/cli/init-scaffold.ts +198 -0
- package/src/cli/init.ts +16 -278
- package/src/cli/nitro-dev.ts +2 -6
- package/src/cli/node-dev-imports.ts +14 -0
- package/src/package-version.ts +14 -0
- package/src/project-info.ts +2 -1
- package/templates/mcp-radar/.vercelignore +3 -0
- package/templates/mcp-radar/README.md +139 -0
- package/templates/mcp-radar/agent/agent.ts +38 -0
- package/templates/mcp-radar/agent/catalogs/hackernews/README.md +23 -0
- package/templates/mcp-radar/agent/catalogs/hackernews/domain.yaml +329 -0
- package/templates/mcp-radar/agent/catalogs/hackernews/eval/cases.yaml +112 -0
- package/templates/mcp-radar/agent/catalogs/hackernews/mappings.yaml +129 -0
- package/templates/mcp-radar/agent/catalogs/tavily/README.md +218 -0
- package/templates/mcp-radar/agent/catalogs/tavily/domain.yaml +373 -0
- package/templates/mcp-radar/agent/catalogs/tavily/eval/cases.yaml +56 -0
- package/templates/mcp-radar/agent/catalogs/tavily/eval/google-gemma-3-4b-it.latest.human.txt +67 -0
- package/templates/mcp-radar/agent/catalogs/tavily/eval/google-gemma-3-4b-it.latest.json +363 -0
- package/templates/mcp-radar/agent/catalogs/tavily/mappings.yaml +171 -0
- package/templates/mcp-radar/agent/channels/mcp-radar.ts +85 -0
- package/templates/mcp-radar/agent/hooks/proof-audit.ts +10 -0
- package/templates/mcp-radar/agent/instructions.md +24 -0
- package/templates/mcp-radar/agent/research/mcp-innovations-proof.md +4 -0
- package/templates/mcp-radar/agent/schedules/mcp-radar-scan.ts +14 -0
- package/templates/mcp-radar/agent/skills/mcp-proof-format.md +19 -0
- package/templates/mcp-radar/api/[[...path]].ts +23 -0
- package/templates/mcp-radar/evals/mcp-radar-discover.eval.ts +14 -0
- package/templates/mcp-radar/lib/proof-store.ts +265 -0
- package/templates/mcp-radar/lib/run-radar.ts +214 -0
- package/templates/mcp-radar/nitro.config.ts +17 -0
- package/templates/mcp-radar/package.json +14 -0
- package/templates/mcp-radar/public/index.html +10 -0
- package/templates/mcp-radar/routes/[...path].ts +29 -0
- package/templates/mcp-radar/scripts/run-evals.ts +46 -0
- package/templates/mcp-radar/scripts/smoke-channel.ts +66 -0
- package/templates/mcp-radar/vercel.json +15 -0
- package/templates/scaffold/.vercelignore +3 -0
- package/templates/scaffold/api/[[...path]].ts +23 -0
- package/templates/scaffold/nitro.config.ts +17 -0
- package/templates/scaffold/public/index.html +10 -0
- package/templates/scaffold/public/index.mcp-radar.html +10 -0
- package/templates/scaffold/routes/[...path].ts +29 -0
- package/templates/scaffold/vercel.default.json +4 -0
- package/templates/scaffold/vercel.mcp-radar.json +15 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
|
|
5
|
+
import { createPlasmAgent } from "../agent/agent.js";
|
|
6
|
+
import {
|
|
7
|
+
requireLiveEvalGateway,
|
|
8
|
+
runAllEvals,
|
|
9
|
+
} from "@plasm_lang/vercel-agent";
|
|
10
|
+
|
|
11
|
+
const packageRoot = path.dirname(path.dirname(fileURLToPath(import.meta.url)));
|
|
12
|
+
const evalsDir = path.join(packageRoot, "evals");
|
|
13
|
+
|
|
14
|
+
async function main(): Promise<void> {
|
|
15
|
+
requireLiveEvalGateway();
|
|
16
|
+
|
|
17
|
+
const agent = await createPlasmAgent();
|
|
18
|
+
await agent.bootstrap();
|
|
19
|
+
|
|
20
|
+
const results = await runAllEvals(agent, evalsDir);
|
|
21
|
+
if (!results.length) {
|
|
22
|
+
console.warn("No evals found in", evalsDir);
|
|
23
|
+
process.exit(0);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
let failed = 0;
|
|
27
|
+
for (const result of results) {
|
|
28
|
+
if (result.ok) {
|
|
29
|
+
console.log(
|
|
30
|
+
`PASS ${result.name} steps=${result.stepCount} tools=[${result.recordedTools.join(", ")}]`,
|
|
31
|
+
);
|
|
32
|
+
} else {
|
|
33
|
+
failed += 1;
|
|
34
|
+
console.error(`FAIL ${result.name}: ${result.error ?? "unknown error"}`);
|
|
35
|
+
console.error(` tools=[${result.recordedTools.join(", ")}] steps=${result.stepCount}`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (failed > 0) process.exit(1);
|
|
40
|
+
console.log(`\nOK: ${results.length} live eval(s) passed`);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
main().catch((err: unknown) => {
|
|
44
|
+
console.error(err);
|
|
45
|
+
process.exit(1);
|
|
46
|
+
});
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Smoke: MCP Radar channel routes (status, proof, run with gateway check).
|
|
4
|
+
*/
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import { fileURLToPath } from "node:url";
|
|
7
|
+
|
|
8
|
+
import agentDefinition from "../agent/agent.js";
|
|
9
|
+
import { createDevServer } from "@plasm_lang/vercel-agent";
|
|
10
|
+
import { gatewayConfigured } from "../lib/proof-store.js";
|
|
11
|
+
|
|
12
|
+
const packageRoot = path.dirname(path.dirname(fileURLToPath(import.meta.url)));
|
|
13
|
+
const agentRoot = path.join(packageRoot, "agent");
|
|
14
|
+
const port = 4148 + Math.floor(Math.random() * 100);
|
|
15
|
+
|
|
16
|
+
async function main(): Promise<void> {
|
|
17
|
+
const handle = await createDevServer({
|
|
18
|
+
agentRoot,
|
|
19
|
+
definition: agentDefinition,
|
|
20
|
+
port,
|
|
21
|
+
host: "127.0.0.1",
|
|
22
|
+
telemetry: false,
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
try {
|
|
26
|
+
const statusRes = await fetch(`${handle.url}/channel/mcp-radar/status`);
|
|
27
|
+
if (!statusRes.ok) {
|
|
28
|
+
const body = await statusRes.text();
|
|
29
|
+
throw new Error(`status ${statusRes.status}: ${body}`);
|
|
30
|
+
}
|
|
31
|
+
const status = (await statusRes.json()) as { intent?: string };
|
|
32
|
+
if (!status.intent?.includes("MCP")) throw new Error("unexpected status payload");
|
|
33
|
+
|
|
34
|
+
const proofRes = await fetch(`${handle.url}/channel/mcp-radar/proof`);
|
|
35
|
+
if (!proofRes.ok) throw new Error(`proof ${proofRes.status}`);
|
|
36
|
+
const proof = await proofRes.text();
|
|
37
|
+
if (!proof.includes("MCP Innovations Proof Log")) {
|
|
38
|
+
throw new Error("proof markdown missing header");
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const runRes = await fetch(`${handle.url}/channel/mcp-radar/run`, {
|
|
42
|
+
method: "POST",
|
|
43
|
+
headers: { "content-type": "application/json" },
|
|
44
|
+
body: JSON.stringify({}),
|
|
45
|
+
});
|
|
46
|
+
const runBody = (await runRes.json()) as { ok?: boolean; skipped?: boolean; reason?: string };
|
|
47
|
+
if (!gatewayConfigured()) {
|
|
48
|
+
if (runBody.reason !== "ai_gateway_missing") {
|
|
49
|
+
throw new Error(`expected ai_gateway_missing without gateway, got ${JSON.stringify(runBody)}`);
|
|
50
|
+
}
|
|
51
|
+
console.log("OK: channel routes (run skipped without AI_GATEWAY_API_KEY)");
|
|
52
|
+
} else {
|
|
53
|
+
if (!runBody.ok && !runBody.skipped) {
|
|
54
|
+
throw new Error(`run failed: ${JSON.stringify(runBody)}`);
|
|
55
|
+
}
|
|
56
|
+
console.log("OK: channel routes including run");
|
|
57
|
+
}
|
|
58
|
+
} finally {
|
|
59
|
+
await handle.close();
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
main().catch((err: unknown) => {
|
|
64
|
+
console.error(err);
|
|
65
|
+
process.exit(1);
|
|
66
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"buildCommand": "npx tsx scripts/vercel-build.ts",
|
|
3
|
+
"rewrites": [{ "source": "/(.*)", "destination": "/api/$1" }],
|
|
4
|
+
"crons": [
|
|
5
|
+
{
|
|
6
|
+
"path": "/internal/cron/mcp-radar-scan",
|
|
7
|
+
"schedule": "0 */6 * * *"
|
|
8
|
+
}
|
|
9
|
+
],
|
|
10
|
+
"functions": {
|
|
11
|
+
"api/**": {
|
|
12
|
+
"maxDuration": 300
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
3
|
+
|
|
4
|
+
import agentDefinition from "../agent/agent.js";
|
|
5
|
+
import { createPlasmApp, vercelPlasmHandler } from "@plasm_lang/vercel-agent/server";
|
|
6
|
+
|
|
7
|
+
const packageRoot = path.dirname(path.dirname(fileURLToPath(import.meta.url)));
|
|
8
|
+
const agentRoot = path.join(packageRoot, "agent");
|
|
9
|
+
|
|
10
|
+
let app: Awaited<ReturnType<typeof createPlasmApp>> | undefined;
|
|
11
|
+
|
|
12
|
+
export default async function handler(
|
|
13
|
+
req: import("node:http").IncomingMessage,
|
|
14
|
+
res: import("node:http").ServerResponse,
|
|
15
|
+
): Promise<void> {
|
|
16
|
+
app ??= await createPlasmApp({
|
|
17
|
+
agentRoot,
|
|
18
|
+
definition: agentDefinition,
|
|
19
|
+
mode: "prod",
|
|
20
|
+
sessions: false,
|
|
21
|
+
});
|
|
22
|
+
await vercelPlasmHandler(app)(req, res);
|
|
23
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { defineNitroConfig } from "nitropack/config";
|
|
2
|
+
|
|
3
|
+
export default defineNitroConfig({
|
|
4
|
+
compatibilityDate: "2026-06-26",
|
|
5
|
+
srcDir: ".",
|
|
6
|
+
ignore: ["api/**"],
|
|
7
|
+
devServer: {
|
|
8
|
+
port: Number(process.env.PORT ?? 3000),
|
|
9
|
+
host: process.env.HOST ?? "127.0.0.1",
|
|
10
|
+
},
|
|
11
|
+
typescript: {
|
|
12
|
+
strict: false,
|
|
13
|
+
},
|
|
14
|
+
externals: {
|
|
15
|
+
inline: ["@plasm_lang/engine"],
|
|
16
|
+
},
|
|
17
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
|
|
3
|
+
import { fromNodeMiddleware } from "h3";
|
|
4
|
+
|
|
5
|
+
import agentDefinition from "../agent/agent.js";
|
|
6
|
+
import { createPlasmApp, vercelPlasmHandler } from "@plasm_lang/vercel-agent/server";
|
|
7
|
+
|
|
8
|
+
const agentRoot = path.join(process.cwd(), "agent");
|
|
9
|
+
|
|
10
|
+
let appPromise: ReturnType<typeof createPlasmApp> | undefined;
|
|
11
|
+
|
|
12
|
+
async function plasmApp() {
|
|
13
|
+
appPromise ??= createPlasmApp({
|
|
14
|
+
agentRoot,
|
|
15
|
+
definition: agentDefinition,
|
|
16
|
+
mode: "prod",
|
|
17
|
+
sessions: false,
|
|
18
|
+
});
|
|
19
|
+
return appPromise;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default fromNodeMiddleware(async (req, res) => {
|
|
23
|
+
const app = await plasmApp();
|
|
24
|
+
await new Promise<void>((resolve, reject) => {
|
|
25
|
+
res.once("finish", () => resolve());
|
|
26
|
+
res.once("error", reject);
|
|
27
|
+
void vercelPlasmHandler(app)(req, res).catch(reject);
|
|
28
|
+
});
|
|
29
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"buildCommand": "plasm-agent build",
|
|
3
|
+
"rewrites": [{ "source": "/(.*)", "destination": "/api/$1" }],
|
|
4
|
+
"crons": [
|
|
5
|
+
{
|
|
6
|
+
"path": "/internal/cron/mcp-radar-scan",
|
|
7
|
+
"schedule": "0 */6 * * *"
|
|
8
|
+
}
|
|
9
|
+
],
|
|
10
|
+
"functions": {
|
|
11
|
+
"api/**": {
|
|
12
|
+
"maxDuration": 300
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|