@vurb/core 3.6.0 → 3.6.1
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/README.md +726 -726
- package/dist/cli/constants.js +59 -59
- package/dist/cli/templates/config.js +26 -26
- package/dist/cli/templates/constants.d.ts +1 -1
- package/dist/cli/templates/constants.js +1 -1
- package/dist/cli/templates/core.js +95 -95
- package/dist/cli/templates/middleware.js +25 -25
- package/dist/cli/templates/readme.js +144 -144
- package/dist/cli/templates/testing.js +84 -84
- package/dist/cli/templates/tools.js +46 -46
- package/dist/cli/templates/vectors/database.js +69 -69
- package/dist/cli/templates/vectors/oauth.js +63 -63
- package/dist/cli/templates/vectors/openapi.js +97 -97
- package/dist/introspection/SemanticProbe.js +49 -49
- package/dist/prompt/FluentPromptBuilder.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -4,79 +4,79 @@
|
|
|
4
4
|
*/
|
|
5
5
|
/** Generate `prisma/schema.prisma` */
|
|
6
6
|
export function prismaSchema() {
|
|
7
|
-
return `// Prisma Schema — Database-Driven MCP Server
|
|
8
|
-
//
|
|
9
|
-
// The @vurb/prisma-gen generator reads annotations
|
|
10
|
-
// and auto-generates Presenters + ToolBuilders with:
|
|
11
|
-
// - Field-level security (/// @vurb.hide)
|
|
12
|
-
// - Tenant isolation
|
|
13
|
-
// - OOM protection
|
|
14
|
-
|
|
15
|
-
generator client {
|
|
16
|
-
provider = "prisma-client-js"
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
generator vurb {
|
|
20
|
-
provider = "@vurb/prisma-gen"
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
datasource db {
|
|
24
|
-
provider = "postgresql"
|
|
25
|
-
url = env("DATABASE_URL")
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
model User {
|
|
29
|
-
id String @id @default(cuid())
|
|
30
|
-
email String @unique
|
|
31
|
-
name String
|
|
32
|
-
|
|
33
|
-
/// @vurb.hide — Stripped by the Egress Firewall before reaching the LLM
|
|
34
|
-
password String
|
|
35
|
-
|
|
36
|
-
role String @default("USER")
|
|
37
|
-
createdAt DateTime @default(now())
|
|
38
|
-
updatedAt DateTime @updatedAt
|
|
39
|
-
|
|
40
|
-
posts Post[]
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
model Post {
|
|
44
|
-
id String @id @default(cuid())
|
|
45
|
-
title String
|
|
46
|
-
content String?
|
|
47
|
-
published Boolean @default(false)
|
|
48
|
-
createdAt DateTime @default(now())
|
|
49
|
-
|
|
50
|
-
author User @relation(fields: [authorId], references: [id])
|
|
51
|
-
authorId String
|
|
52
|
-
}
|
|
7
|
+
return `// Prisma Schema — Database-Driven MCP Server
|
|
8
|
+
//
|
|
9
|
+
// The @vurb/prisma-gen generator reads annotations
|
|
10
|
+
// and auto-generates Presenters + ToolBuilders with:
|
|
11
|
+
// - Field-level security (/// @vurb.hide)
|
|
12
|
+
// - Tenant isolation
|
|
13
|
+
// - OOM protection
|
|
14
|
+
|
|
15
|
+
generator client {
|
|
16
|
+
provider = "prisma-client-js"
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
generator vurb {
|
|
20
|
+
provider = "@vurb/prisma-gen"
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
datasource db {
|
|
24
|
+
provider = "postgresql"
|
|
25
|
+
url = env("DATABASE_URL")
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
model User {
|
|
29
|
+
id String @id @default(cuid())
|
|
30
|
+
email String @unique
|
|
31
|
+
name String
|
|
32
|
+
|
|
33
|
+
/// @vurb.hide — Stripped by the Egress Firewall before reaching the LLM
|
|
34
|
+
password String
|
|
35
|
+
|
|
36
|
+
role String @default("USER")
|
|
37
|
+
createdAt DateTime @default(now())
|
|
38
|
+
updatedAt DateTime @updatedAt
|
|
39
|
+
|
|
40
|
+
posts Post[]
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
model Post {
|
|
44
|
+
id String @id @default(cuid())
|
|
45
|
+
title String
|
|
46
|
+
content String?
|
|
47
|
+
published Boolean @default(false)
|
|
48
|
+
createdAt DateTime @default(now())
|
|
49
|
+
|
|
50
|
+
author User @relation(fields: [authorId], references: [id])
|
|
51
|
+
authorId String
|
|
52
|
+
}
|
|
53
53
|
`;
|
|
54
54
|
}
|
|
55
55
|
/** Generate `src/tools/db/users.ts` */
|
|
56
56
|
export function dbUsersToolTs() {
|
|
57
|
-
return `/**
|
|
58
|
-
* Database Users Tool — Prisma-Driven CRUD (Fluent API)
|
|
59
|
-
*
|
|
60
|
-
* Demonstrates:
|
|
61
|
-
* - f.query() with .withOptionalNumber() typed parameter
|
|
62
|
-
* - .handle(input, ctx) — input.take is typed as number | undefined
|
|
63
|
-
* - Implicit success() wrapping
|
|
64
|
-
*/
|
|
65
|
-
import { f } from '../../vurb.js';
|
|
66
|
-
|
|
67
|
-
export default f.query('db.list_users')
|
|
68
|
-
.describe('List users from the database')
|
|
69
|
-
.withOptionalNumber('take', 'Max results (1-50)')
|
|
70
|
-
.handle(async (input, ctx) => {
|
|
71
|
-
// TODO: Replace with your Prisma client
|
|
72
|
-
// const users = await ctx.db.user.findMany({ take: input.take ?? 10 });
|
|
73
|
-
// return users;
|
|
74
|
-
|
|
75
|
-
return {
|
|
76
|
-
hint: 'Connect your Prisma client in src/context.ts to enable database queries.',
|
|
77
|
-
example: 'const users = await ctx.db.user.findMany({ take: 10 })',
|
|
78
|
-
};
|
|
79
|
-
});
|
|
57
|
+
return `/**
|
|
58
|
+
* Database Users Tool — Prisma-Driven CRUD (Fluent API)
|
|
59
|
+
*
|
|
60
|
+
* Demonstrates:
|
|
61
|
+
* - f.query() with .withOptionalNumber() typed parameter
|
|
62
|
+
* - .handle(input, ctx) — input.take is typed as number | undefined
|
|
63
|
+
* - Implicit success() wrapping
|
|
64
|
+
*/
|
|
65
|
+
import { f } from '../../vurb.js';
|
|
66
|
+
|
|
67
|
+
export default f.query('db.list_users')
|
|
68
|
+
.describe('List users from the database')
|
|
69
|
+
.withOptionalNumber('take', 'Max results (1-50)')
|
|
70
|
+
.handle(async (input, ctx) => {
|
|
71
|
+
// TODO: Replace with your Prisma client
|
|
72
|
+
// const users = await ctx.db.user.findMany({ take: input.take ?? 10 });
|
|
73
|
+
// return users;
|
|
74
|
+
|
|
75
|
+
return {
|
|
76
|
+
hint: 'Connect your Prisma client in src/context.ts to enable database queries.',
|
|
77
|
+
example: 'const users = await ctx.db.user.findMany({ take: 10 })',
|
|
78
|
+
};
|
|
79
|
+
});
|
|
80
80
|
`;
|
|
81
81
|
}
|
|
82
82
|
//# sourceMappingURL=database.js.map
|
|
@@ -4,73 +4,73 @@
|
|
|
4
4
|
*/
|
|
5
5
|
/** Generate `src/auth.ts` — OAuth Device Flow setup */
|
|
6
6
|
export function oauthSetupTs(config) {
|
|
7
|
-
return `/**
|
|
8
|
-
* OAuth Setup — Device Flow Authentication (RFC 8628)
|
|
9
|
-
*
|
|
10
|
-
* Pre-configured \`createAuthTool()\` with login, complete, status, logout actions.
|
|
11
|
-
* The \`requireAuth()\` middleware protects any tool with one line.
|
|
12
|
-
*
|
|
13
|
-
* 1. Set CLIENT_ID and AUTH endpoints in .env
|
|
14
|
-
* 2. Register the auth tool in server.ts
|
|
15
|
-
* 3. Use \`requireAuth()\` on protected tools
|
|
16
|
-
*/
|
|
17
|
-
import { createAuthTool, TokenManager } from '@vurb/oauth';
|
|
18
|
-
import type { ToolRegistry } from '@vurb/core';
|
|
19
|
-
|
|
20
|
-
export function registerAuth<TContext>(registry: ToolRegistry<TContext>): void {
|
|
21
|
-
const clientId = process.env['OAUTH_CLIENT_ID'];
|
|
22
|
-
const authEndpoint = process.env['OAUTH_AUTH_ENDPOINT'];
|
|
23
|
-
const tokenEndpoint = process.env['OAUTH_TOKEN_ENDPOINT'];
|
|
24
|
-
|
|
25
|
-
if (!clientId || !authEndpoint || !tokenEndpoint) {
|
|
26
|
-
console.error('⚠️ OAUTH_CLIENT_ID, OAUTH_AUTH_ENDPOINT, OAUTH_TOKEN_ENDPOINT are required in .env');
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const auth = createAuthTool({
|
|
31
|
-
clientId,
|
|
32
|
-
authorizationEndpoint: authEndpoint,
|
|
33
|
-
tokenEndpoint,
|
|
34
|
-
tokenManager: {
|
|
35
|
-
configDir: '.${config.name}',
|
|
36
|
-
envVar: '${config.name.toUpperCase().replace(/-/g, '_')}_TOKEN',
|
|
37
|
-
},
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
registry.register(auth);
|
|
41
|
-
console.error('🔐 OAuth Device Flow registered (auth.login → auth.complete → auth.status)');
|
|
42
|
-
}
|
|
7
|
+
return `/**
|
|
8
|
+
* OAuth Setup — Device Flow Authentication (RFC 8628)
|
|
9
|
+
*
|
|
10
|
+
* Pre-configured \`createAuthTool()\` with login, complete, status, logout actions.
|
|
11
|
+
* The \`requireAuth()\` middleware protects any tool with one line.
|
|
12
|
+
*
|
|
13
|
+
* 1. Set CLIENT_ID and AUTH endpoints in .env
|
|
14
|
+
* 2. Register the auth tool in server.ts
|
|
15
|
+
* 3. Use \`requireAuth()\` on protected tools
|
|
16
|
+
*/
|
|
17
|
+
import { createAuthTool, TokenManager } from '@vurb/oauth';
|
|
18
|
+
import type { ToolRegistry } from '@vurb/core';
|
|
19
|
+
|
|
20
|
+
export function registerAuth<TContext>(registry: ToolRegistry<TContext>): void {
|
|
21
|
+
const clientId = process.env['OAUTH_CLIENT_ID'];
|
|
22
|
+
const authEndpoint = process.env['OAUTH_AUTH_ENDPOINT'];
|
|
23
|
+
const tokenEndpoint = process.env['OAUTH_TOKEN_ENDPOINT'];
|
|
24
|
+
|
|
25
|
+
if (!clientId || !authEndpoint || !tokenEndpoint) {
|
|
26
|
+
console.error('⚠️ OAUTH_CLIENT_ID, OAUTH_AUTH_ENDPOINT, OAUTH_TOKEN_ENDPOINT are required in .env');
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const auth = createAuthTool({
|
|
31
|
+
clientId,
|
|
32
|
+
authorizationEndpoint: authEndpoint,
|
|
33
|
+
tokenEndpoint,
|
|
34
|
+
tokenManager: {
|
|
35
|
+
configDir: '.${config.name}',
|
|
36
|
+
envVar: '${config.name.toUpperCase().replace(/-/g, '_')}_TOKEN',
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
registry.register(auth);
|
|
41
|
+
console.error('🔐 OAuth Device Flow registered (auth.login → auth.complete → auth.status)');
|
|
42
|
+
}
|
|
43
43
|
`;
|
|
44
44
|
}
|
|
45
45
|
/** Generate `src/middleware/auth.ts` — requireAuth middleware */
|
|
46
46
|
export function oauthMiddlewareTs() {
|
|
47
|
-
return `/**
|
|
48
|
-
* Auth Middleware — Protect tools with requireAuth()
|
|
49
|
-
*
|
|
50
|
-
* @example
|
|
51
|
-
* \`\`\`ts
|
|
52
|
-
* import { withAuth } from '../middleware/auth.js';
|
|
53
|
-
*
|
|
54
|
-
* export default f.query('projects.list')
|
|
55
|
-
* .describe('List all projects')
|
|
56
|
-
* .use(withAuth)
|
|
57
|
-
* .handle(async (input, ctx) => { /* authenticated */ });
|
|
58
|
-
* \`\`\`
|
|
59
|
-
*/
|
|
60
|
-
import { requireAuth } from '@vurb/oauth';
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Pre-configured auth middleware.
|
|
64
|
-
* Rejects unauthenticated requests with \`AUTH_REQUIRED\` + self-healing hints.
|
|
65
|
-
*/
|
|
66
|
-
export const withAuth = requireAuth({
|
|
67
|
-
extractToken: (ctx: unknown) => {
|
|
68
|
-
const obj = ctx as Record<string, unknown>;
|
|
69
|
-
return typeof obj['token'] === 'string' ? obj['token'] : null;
|
|
70
|
-
},
|
|
71
|
-
recoveryHint: 'Call auth action=login to authenticate via browser',
|
|
72
|
-
recoveryAction: 'auth',
|
|
73
|
-
});
|
|
47
|
+
return `/**
|
|
48
|
+
* Auth Middleware — Protect tools with requireAuth()
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* \`\`\`ts
|
|
52
|
+
* import { withAuth } from '../middleware/auth.js';
|
|
53
|
+
*
|
|
54
|
+
* export default f.query('projects.list')
|
|
55
|
+
* .describe('List all projects')
|
|
56
|
+
* .use(withAuth)
|
|
57
|
+
* .handle(async (input, ctx) => { /* authenticated */ });
|
|
58
|
+
* \`\`\`
|
|
59
|
+
*/
|
|
60
|
+
import { requireAuth } from '@vurb/oauth';
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Pre-configured auth middleware.
|
|
64
|
+
* Rejects unauthenticated requests with \`AUTH_REQUIRED\` + self-healing hints.
|
|
65
|
+
*/
|
|
66
|
+
export const withAuth = requireAuth({
|
|
67
|
+
extractToken: (ctx: unknown) => {
|
|
68
|
+
const obj = ctx as Record<string, unknown>;
|
|
69
|
+
return typeof obj['token'] === 'string' ? obj['token'] : null;
|
|
70
|
+
},
|
|
71
|
+
recoveryHint: 'Call auth action=login to authenticate via browser',
|
|
72
|
+
recoveryAction: 'auth',
|
|
73
|
+
});
|
|
74
74
|
`;
|
|
75
75
|
}
|
|
76
76
|
//# sourceMappingURL=oauth.js.map
|
|
@@ -1,106 +1,106 @@
|
|
|
1
1
|
/** Generate `openapi.yaml` — Sample OpenAPI spec */
|
|
2
2
|
export function openapiYaml(config) {
|
|
3
|
-
return `# OpenAPI 3.0 Specification — Sample
|
|
4
|
-
#
|
|
5
|
-
# Replace this with your actual API spec, then run:
|
|
6
|
-
# npx @vurb/openapi-gen ./openapi.yaml --outDir ./src/generated
|
|
7
|
-
#
|
|
8
|
-
# The generator creates Presenters, Tools, Registry, and server
|
|
9
|
-
# bootstrap — all configurable via YAML annotations.
|
|
10
|
-
|
|
11
|
-
openapi: '3.0.3'
|
|
12
|
-
info:
|
|
13
|
-
title: '${config.name} API'
|
|
14
|
-
version: '0.1.0'
|
|
15
|
-
description: Sample API for Vurb OpenAPI generation
|
|
16
|
-
|
|
17
|
-
servers:
|
|
18
|
-
- url: http://localhost:3000/api
|
|
19
|
-
|
|
20
|
-
paths:
|
|
21
|
-
/health:
|
|
22
|
-
get:
|
|
23
|
-
operationId: getHealth
|
|
24
|
-
summary: Health check endpoint
|
|
25
|
-
responses:
|
|
26
|
-
'200':
|
|
27
|
-
description: Server health status
|
|
28
|
-
content:
|
|
29
|
-
application/json:
|
|
30
|
-
schema:
|
|
31
|
-
type: object
|
|
32
|
-
properties:
|
|
33
|
-
status:
|
|
34
|
-
type: string
|
|
35
|
-
example: healthy
|
|
36
|
-
uptime:
|
|
37
|
-
type: number
|
|
38
|
-
example: 12345.67
|
|
39
|
-
|
|
40
|
-
/users:
|
|
41
|
-
get:
|
|
42
|
-
operationId: listUsers
|
|
43
|
-
summary: List all users
|
|
44
|
-
parameters:
|
|
45
|
-
- name: limit
|
|
46
|
-
in: query
|
|
47
|
-
schema:
|
|
48
|
-
type: integer
|
|
49
|
-
minimum: 1
|
|
50
|
-
maximum: 100
|
|
51
|
-
default: 10
|
|
52
|
-
responses:
|
|
53
|
-
'200':
|
|
54
|
-
description: List of users
|
|
55
|
-
content:
|
|
56
|
-
application/json:
|
|
57
|
-
schema:
|
|
58
|
-
type: array
|
|
59
|
-
items:
|
|
60
|
-
$ref: '#/components/schemas/User'
|
|
61
|
-
|
|
62
|
-
components:
|
|
63
|
-
schemas:
|
|
64
|
-
User:
|
|
65
|
-
type: object
|
|
66
|
-
properties:
|
|
67
|
-
id:
|
|
68
|
-
type: string
|
|
69
|
-
name:
|
|
70
|
-
type: string
|
|
71
|
-
email:
|
|
72
|
-
type: string
|
|
3
|
+
return `# OpenAPI 3.0 Specification — Sample
|
|
4
|
+
#
|
|
5
|
+
# Replace this with your actual API spec, then run:
|
|
6
|
+
# npx @vurb/openapi-gen ./openapi.yaml --outDir ./src/generated
|
|
7
|
+
#
|
|
8
|
+
# The generator creates Presenters, Tools, Registry, and server
|
|
9
|
+
# bootstrap — all configurable via YAML annotations.
|
|
10
|
+
|
|
11
|
+
openapi: '3.0.3'
|
|
12
|
+
info:
|
|
13
|
+
title: '${config.name} API'
|
|
14
|
+
version: '0.1.0'
|
|
15
|
+
description: Sample API for Vurb OpenAPI generation
|
|
16
|
+
|
|
17
|
+
servers:
|
|
18
|
+
- url: http://localhost:3000/api
|
|
19
|
+
|
|
20
|
+
paths:
|
|
21
|
+
/health:
|
|
22
|
+
get:
|
|
23
|
+
operationId: getHealth
|
|
24
|
+
summary: Health check endpoint
|
|
25
|
+
responses:
|
|
26
|
+
'200':
|
|
27
|
+
description: Server health status
|
|
28
|
+
content:
|
|
29
|
+
application/json:
|
|
30
|
+
schema:
|
|
31
|
+
type: object
|
|
32
|
+
properties:
|
|
33
|
+
status:
|
|
34
|
+
type: string
|
|
35
|
+
example: healthy
|
|
36
|
+
uptime:
|
|
37
|
+
type: number
|
|
38
|
+
example: 12345.67
|
|
39
|
+
|
|
40
|
+
/users:
|
|
41
|
+
get:
|
|
42
|
+
operationId: listUsers
|
|
43
|
+
summary: List all users
|
|
44
|
+
parameters:
|
|
45
|
+
- name: limit
|
|
46
|
+
in: query
|
|
47
|
+
schema:
|
|
48
|
+
type: integer
|
|
49
|
+
minimum: 1
|
|
50
|
+
maximum: 100
|
|
51
|
+
default: 10
|
|
52
|
+
responses:
|
|
53
|
+
'200':
|
|
54
|
+
description: List of users
|
|
55
|
+
content:
|
|
56
|
+
application/json:
|
|
57
|
+
schema:
|
|
58
|
+
type: array
|
|
59
|
+
items:
|
|
60
|
+
$ref: '#/components/schemas/User'
|
|
61
|
+
|
|
62
|
+
components:
|
|
63
|
+
schemas:
|
|
64
|
+
User:
|
|
65
|
+
type: object
|
|
66
|
+
properties:
|
|
67
|
+
id:
|
|
68
|
+
type: string
|
|
69
|
+
name:
|
|
70
|
+
type: string
|
|
71
|
+
email:
|
|
72
|
+
type: string
|
|
73
73
|
`;
|
|
74
74
|
}
|
|
75
75
|
/** Generate `SETUP.md` — OpenAPI generation instructions */
|
|
76
76
|
export function openapiSetupMd() {
|
|
77
|
-
return `# OpenAPI Generator Setup
|
|
78
|
-
|
|
79
|
-
This project is configured for the **Legacy API Proxy** ingestion vector.
|
|
80
|
-
|
|
81
|
-
## Steps
|
|
82
|
-
|
|
83
|
-
1. Replace \`openapi.yaml\` with your actual OpenAPI 3.x spec
|
|
84
|
-
|
|
85
|
-
2. Generate the MCP server from the spec:
|
|
86
|
-
\`\`\`bash
|
|
87
|
-
npx @vurb/openapi-gen ./openapi.yaml --outDir ./src/generated
|
|
88
|
-
\`\`\`
|
|
89
|
-
|
|
90
|
-
3. The generator creates:
|
|
91
|
-
- Presenters with Zod schemas (Egress Firewall)
|
|
92
|
-
- Tool builders with typed handlers
|
|
93
|
-
- Registry setup with all endpoints
|
|
94
|
-
|
|
95
|
-
4. Import and register in \`src/server.ts\`:
|
|
96
|
-
\`\`\`typescript
|
|
97
|
-
import { generatedTools } from './generated/registry.js';
|
|
98
|
-
registry.registerAll(...generatedTools);
|
|
99
|
-
\`\`\`
|
|
100
|
-
|
|
101
|
-
## Documentation
|
|
102
|
-
|
|
103
|
-
See: [OpenAPI Generator](https://vurb.vinkius.com/openapi-gen)
|
|
77
|
+
return `# OpenAPI Generator Setup
|
|
78
|
+
|
|
79
|
+
This project is configured for the **Legacy API Proxy** ingestion vector.
|
|
80
|
+
|
|
81
|
+
## Steps
|
|
82
|
+
|
|
83
|
+
1. Replace \`openapi.yaml\` with your actual OpenAPI 3.x spec
|
|
84
|
+
|
|
85
|
+
2. Generate the MCP server from the spec:
|
|
86
|
+
\`\`\`bash
|
|
87
|
+
npx @vurb/openapi-gen ./openapi.yaml --outDir ./src/generated
|
|
88
|
+
\`\`\`
|
|
89
|
+
|
|
90
|
+
3. The generator creates:
|
|
91
|
+
- Presenters with Zod schemas (Egress Firewall)
|
|
92
|
+
- Tool builders with typed handlers
|
|
93
|
+
- Registry setup with all endpoints
|
|
94
|
+
|
|
95
|
+
4. Import and register in \`src/server.ts\`:
|
|
96
|
+
\`\`\`typescript
|
|
97
|
+
import { generatedTools } from './generated/registry.js';
|
|
98
|
+
registry.registerAll(...generatedTools);
|
|
99
|
+
\`\`\`
|
|
100
|
+
|
|
101
|
+
## Documentation
|
|
102
|
+
|
|
103
|
+
See: [OpenAPI Generator](https://vurb.vinkius.com/openapi-gen)
|
|
104
104
|
`;
|
|
105
105
|
}
|
|
106
106
|
//# sourceMappingURL=openapi.js.map
|
|
@@ -62,57 +62,57 @@ export function createProbe(toolName, actionKey, input, expectedOutput, actualOu
|
|
|
62
62
|
* @returns Complete evaluation prompt
|
|
63
63
|
*/
|
|
64
64
|
export function buildJudgePrompt(probe) {
|
|
65
|
-
return `You are a semantic evaluation judge for an MCP (Model Context Protocol) tool.
|
|
66
|
-
|
|
67
|
-
Your task is to compare two outputs from the same tool handler and determine:
|
|
68
|
-
1. Whether they are semantically equivalent
|
|
69
|
-
2. Whether the current output violates the tool's behavioral contract
|
|
70
|
-
|
|
71
|
-
## Tool Information
|
|
72
|
-
- **Tool**: ${probe.toolName}
|
|
73
|
-
- **Action**: ${probe.actionKey}
|
|
74
|
-
- **Description**: ${probe.contractContext.description ?? 'No description'}
|
|
75
|
-
- **Read-Only**: ${probe.contractContext.readOnly}
|
|
76
|
-
- **Destructive**: ${probe.contractContext.destructive}
|
|
77
|
-
|
|
78
|
-
## Behavioral Contract
|
|
65
|
+
return `You are a semantic evaluation judge for an MCP (Model Context Protocol) tool.
|
|
66
|
+
|
|
67
|
+
Your task is to compare two outputs from the same tool handler and determine:
|
|
68
|
+
1. Whether they are semantically equivalent
|
|
69
|
+
2. Whether the current output violates the tool's behavioral contract
|
|
70
|
+
|
|
71
|
+
## Tool Information
|
|
72
|
+
- **Tool**: ${probe.toolName}
|
|
73
|
+
- **Action**: ${probe.actionKey}
|
|
74
|
+
- **Description**: ${probe.contractContext.description ?? 'No description'}
|
|
75
|
+
- **Read-Only**: ${probe.contractContext.readOnly}
|
|
76
|
+
- **Destructive**: ${probe.contractContext.destructive}
|
|
77
|
+
|
|
78
|
+
## Behavioral Contract
|
|
79
79
|
${probe.contractContext.systemRules.length > 0
|
|
80
80
|
? `### System Rules\n${probe.contractContext.systemRules.map((r, i) => `${i + 1}. ${r}`).join('\n')}`
|
|
81
|
-
: 'No system rules declared.'}
|
|
82
|
-
|
|
83
|
-
### Expected Output Schema Fields
|
|
84
|
-
${probe.contractContext.schemaKeys.join(', ') || 'No schema declared'}
|
|
85
|
-
|
|
86
|
-
## Input Arguments
|
|
87
|
-
\`\`\`json
|
|
88
|
-
${JSON.stringify(probe.input, null, 2)}
|
|
89
|
-
\`\`\`
|
|
90
|
-
|
|
91
|
-
## Expected Output (Baseline)
|
|
92
|
-
\`\`\`json
|
|
93
|
-
${JSON.stringify(probe.expectedOutput, null, 2)}
|
|
94
|
-
\`\`\`
|
|
95
|
-
|
|
96
|
-
## Actual Output (Current)
|
|
97
|
-
\`\`\`json
|
|
98
|
-
${JSON.stringify(probe.actualOutput, null, 2)}
|
|
99
|
-
\`\`\`
|
|
100
|
-
|
|
101
|
-
## Evaluation Instructions
|
|
102
|
-
Compare the Expected Output with the Actual Output. Consider:
|
|
103
|
-
- Are the outputs semantically equivalent (same meaning, even if format differs)?
|
|
104
|
-
- Does the Actual Output violate any system rules?
|
|
105
|
-
- Does the Actual Output return fields not in the expected schema?
|
|
106
|
-
- Has the behavior meaningfully changed from the baseline?
|
|
107
|
-
|
|
108
|
-
Respond with ONLY a JSON object in this exact format:
|
|
109
|
-
\`\`\`json
|
|
110
|
-
{
|
|
111
|
-
"similarityScore": <number 0.0-1.0>,
|
|
112
|
-
"contractViolated": <boolean>,
|
|
113
|
-
"violations": [<string descriptions of violations>],
|
|
114
|
-
"reasoning": "<brief explanation of your assessment>"
|
|
115
|
-
}
|
|
81
|
+
: 'No system rules declared.'}
|
|
82
|
+
|
|
83
|
+
### Expected Output Schema Fields
|
|
84
|
+
${probe.contractContext.schemaKeys.join(', ') || 'No schema declared'}
|
|
85
|
+
|
|
86
|
+
## Input Arguments
|
|
87
|
+
\`\`\`json
|
|
88
|
+
${JSON.stringify(probe.input, null, 2)}
|
|
89
|
+
\`\`\`
|
|
90
|
+
|
|
91
|
+
## Expected Output (Baseline)
|
|
92
|
+
\`\`\`json
|
|
93
|
+
${JSON.stringify(probe.expectedOutput, null, 2)}
|
|
94
|
+
\`\`\`
|
|
95
|
+
|
|
96
|
+
## Actual Output (Current)
|
|
97
|
+
\`\`\`json
|
|
98
|
+
${JSON.stringify(probe.actualOutput, null, 2)}
|
|
99
|
+
\`\`\`
|
|
100
|
+
|
|
101
|
+
## Evaluation Instructions
|
|
102
|
+
Compare the Expected Output with the Actual Output. Consider:
|
|
103
|
+
- Are the outputs semantically equivalent (same meaning, even if format differs)?
|
|
104
|
+
- Does the Actual Output violate any system rules?
|
|
105
|
+
- Does the Actual Output return fields not in the expected schema?
|
|
106
|
+
- Has the behavior meaningfully changed from the baseline?
|
|
107
|
+
|
|
108
|
+
Respond with ONLY a JSON object in this exact format:
|
|
109
|
+
\`\`\`json
|
|
110
|
+
{
|
|
111
|
+
"similarityScore": <number 0.0-1.0>,
|
|
112
|
+
"contractViolated": <boolean>,
|
|
113
|
+
"violations": [<string descriptions of violations>],
|
|
114
|
+
"reasoning": "<brief explanation of your assessment>"
|
|
115
|
+
}
|
|
116
116
|
\`\`\``;
|
|
117
117
|
}
|
|
118
118
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FluentPromptBuilder.d.ts","sourceRoot":"","sources":["../../src/prompt/FluentPromptBuilder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,WAAW,EAAE,MAAM,KAAK,CAAC;AACvD,OAAO,EACH,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,eAAe,EACvB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAOrD;;;;;;;;;GASG;AACH,qBAAa,mBAAmB,CAA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AAM,GAAG,SAAS;IAIpC,OAAO,IAAI,MAAM,EAAE;IAInB,aAAa,IAAI,OAAO;IAIxB,mBAAmB,IAAI,MAAM,GAAG,SAAS;IAIzC,qBAAqB;;;;;uBAQihK,CAAC;oBAA+B,CAAC;;;IAJvkK,OAAO,CAAC,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC;CAG9E"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vurb/core",
|
|
3
|
-
"version": "3.6.
|
|
3
|
+
"version": "3.6.1",
|
|
4
4
|
"description": "MVA (Model-View-Agent) framework for the Model Context Protocol. Structured perception packages with Presenters, cognitive guardrails, self-healing errors, action consolidation, and tRPC-style type safety — so AI agents perceive and act on your data deterministically.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|