@vurb/core 3.3.4 → 3.6.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/README.md +726 -677
- package/dist/cli/constants.js +59 -59
- package/dist/cli/scaffold.js +2 -0
- package/dist/cli/scaffold.js.map +1 -1
- package/dist/cli/templates/config.js +27 -27
- package/dist/cli/templates/config.js.map +1 -1
- package/dist/cli/templates/core.js +95 -95
- package/dist/cli/templates/index.d.ts +1 -0
- package/dist/cli/templates/index.d.ts.map +1 -1
- package/dist/cli/templates/index.js +2 -0
- package/dist/cli/templates/index.js.map +1 -1
- package/dist/cli/templates/middleware.js +25 -25
- package/dist/cli/templates/model.d.ts +7 -0
- package/dist/cli/templates/model.d.ts.map +1 -0
- package/dist/cli/templates/model.js +31 -0
- package/dist/cli/templates/model.js.map +1 -0
- package/dist/cli/templates/presenter.d.ts.map +1 -1
- package/dist/cli/templates/presenter.js +4 -9
- package/dist/cli/templates/presenter.js.map +1 -1
- package/dist/cli/templates/readme.d.ts.map +1 -1
- package/dist/cli/templates/readme.js +144 -142
- package/dist/cli/templates/readme.js.map +1 -1
- 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/core/builder/BuildPipeline.d.ts +56 -0
- package/dist/core/builder/BuildPipeline.d.ts.map +1 -0
- package/dist/core/builder/BuildPipeline.js +139 -0
- package/dist/core/builder/BuildPipeline.js.map +1 -0
- package/dist/core/builder/FluentToolBuilder.d.ts +253 -19
- package/dist/core/builder/FluentToolBuilder.d.ts.map +1 -1
- package/dist/core/builder/FluentToolBuilder.js +354 -114
- package/dist/core/builder/FluentToolBuilder.js.map +1 -1
- package/dist/core/builder/ProxyHandler.d.ts +26 -0
- package/dist/core/builder/ProxyHandler.d.ts.map +1 -0
- package/dist/core/builder/ProxyHandler.js +65 -0
- package/dist/core/builder/ProxyHandler.js.map +1 -0
- package/dist/core/builder/SemanticDefaults.d.ts +25 -0
- package/dist/core/builder/SemanticDefaults.d.ts.map +1 -0
- package/dist/core/builder/SemanticDefaults.js +16 -0
- package/dist/core/builder/SemanticDefaults.js.map +1 -0
- package/dist/core/builder/index.d.ts +2 -1
- package/dist/core/builder/index.d.ts.map +1 -1
- package/dist/core/builder/index.js +1 -0
- package/dist/core/builder/index.js.map +1 -1
- package/dist/core/middleware/AuditTrail.d.ts.map +1 -1
- package/dist/core/middleware/AuditTrail.js +6 -2
- package/dist/core/middleware/AuditTrail.js.map +1 -1
- package/dist/core/middleware/RateLimiter.d.ts.map +1 -1
- package/dist/core/middleware/RateLimiter.js +3 -1
- package/dist/core/middleware/RateLimiter.js.map +1 -1
- package/dist/fsm/StateMachineGate.d.ts +3 -0
- package/dist/fsm/StateMachineGate.d.ts.map +1 -1
- package/dist/fsm/StateMachineGate.js +12 -0
- package/dist/fsm/StateMachineGate.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/introspection/SemanticProbe.js +49 -49
- package/dist/model/defineModel.d.ts +167 -0
- package/dist/model/defineModel.d.ts.map +1 -0
- package/dist/model/defineModel.js +345 -0
- package/dist/model/defineModel.js.map +1 -0
- package/dist/model/index.d.ts +8 -0
- package/dist/model/index.d.ts.map +1 -0
- package/dist/model/index.js +7 -0
- package/dist/model/index.js.map +1 -0
- package/dist/observability/TelemetryBus.d.ts.map +1 -1
- package/dist/observability/TelemetryBus.js +14 -13
- package/dist/observability/TelemetryBus.js.map +1 -1
- package/dist/presenter/Presenter.d.ts +21 -0
- package/dist/presenter/Presenter.d.ts.map +1 -1
- package/dist/presenter/Presenter.js +17 -8
- package/dist/presenter/Presenter.js.map +1 -1
- package/dist/presenter/PresenterPipeline.d.ts +2 -0
- package/dist/presenter/PresenterPipeline.d.ts.map +1 -1
- package/dist/presenter/PresenterPipeline.js +4 -0
- package/dist/presenter/PresenterPipeline.js.map +1 -1
- package/dist/presenter/definePresenter.d.ts.map +1 -1
- package/dist/presenter/definePresenter.js +13 -3
- package/dist/presenter/definePresenter.js.map +1 -1
- package/dist/prompt/FluentPromptBuilder.d.ts.map +1 -1
- package/dist/resource/ResourceRegistry.d.ts +3 -0
- package/dist/resource/ResourceRegistry.d.ts.map +1 -1
- package/dist/resource/ResourceRegistry.js +8 -2
- package/dist/resource/ResourceRegistry.js.map +1 -1
- package/dist/sandbox/SandboxGuard.js +7 -4
- package/dist/sandbox/SandboxGuard.js.map +1 -1
- package/dist/server/ServerAttachment.d.ts.map +1 -1
- package/dist/server/ServerAttachment.js +48 -9
- package/dist/server/ServerAttachment.js.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
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BuildPipeline — Compiles FluentToolBuilder state into a GroupedToolBuilder.
|
|
3
|
+
*
|
|
4
|
+
* Extracts the `_build()` pipeline from FluentToolBuilder into a
|
|
5
|
+
* standalone function for SRP compliance. Handles:
|
|
6
|
+
* - Name parsing (`domain.action`)
|
|
7
|
+
* - Description compilation (instructions + sandbox prompting)
|
|
8
|
+
* - Semantic defaults resolution
|
|
9
|
+
* - Handler wrapping (implicit `success()`)
|
|
10
|
+
* - GroupedToolBuilder assembly + middleware propagation
|
|
11
|
+
*
|
|
12
|
+
* @module
|
|
13
|
+
*/
|
|
14
|
+
import { type ZodObject, type ZodRawShape } from 'zod';
|
|
15
|
+
import { GroupedToolBuilder } from './GroupedToolBuilder.js';
|
|
16
|
+
import { type ToolResponse, type MiddlewareFn } from '../types.js';
|
|
17
|
+
import { type Presenter } from '../../presenter/Presenter.js';
|
|
18
|
+
import { type ConcurrencyConfig } from '../execution/ConcurrencyGuard.js';
|
|
19
|
+
import { type SandboxConfig } from '../../sandbox/SandboxEngine.js';
|
|
20
|
+
import { type SemanticDefaults } from './SemanticDefaults.js';
|
|
21
|
+
/**
|
|
22
|
+
* Configuration object assembled from FluentToolBuilder state.
|
|
23
|
+
* Passed to `buildToolFromFluent()` to produce a `GroupedToolBuilder`.
|
|
24
|
+
*/
|
|
25
|
+
export interface FluentBuildConfig<TContext, TCtx> {
|
|
26
|
+
name: string;
|
|
27
|
+
description: string | undefined;
|
|
28
|
+
instructions: string | undefined;
|
|
29
|
+
withParams: Record<string, import('zod').ZodType>;
|
|
30
|
+
inputSchema?: ZodObject<ZodRawShape>;
|
|
31
|
+
tags: string[];
|
|
32
|
+
middlewares: MiddlewareFn<TContext>[];
|
|
33
|
+
returns: Presenter<unknown> | undefined;
|
|
34
|
+
semanticDefaults: SemanticDefaults;
|
|
35
|
+
readOnly: boolean | undefined;
|
|
36
|
+
destructive: boolean | undefined;
|
|
37
|
+
idempotent: boolean | undefined;
|
|
38
|
+
toonMode: boolean;
|
|
39
|
+
annotations: Record<string, unknown> | undefined;
|
|
40
|
+
invalidatesPatterns: string[];
|
|
41
|
+
cacheControl: 'no-store' | 'immutable' | undefined;
|
|
42
|
+
concurrency: ConcurrencyConfig | undefined;
|
|
43
|
+
egressMaxBytes: number | undefined;
|
|
44
|
+
sandboxConfig: SandboxConfig | undefined;
|
|
45
|
+
fsmStates: string[] | undefined;
|
|
46
|
+
fsmTransition: string | undefined;
|
|
47
|
+
handler: (input: Record<string, unknown>, ctx: TCtx) => Promise<ToolResponse | unknown>;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Compile FluentToolBuilder state into a GroupedToolBuilder.
|
|
51
|
+
*
|
|
52
|
+
* @param config - Assembled configuration from builder state
|
|
53
|
+
* @returns A `GroupedToolBuilder` ready for registration
|
|
54
|
+
*/
|
|
55
|
+
export declare function buildToolFromFluent<TContext, TCtx>(config: FluentBuildConfig<TContext, TCtx>): GroupedToolBuilder<TContext>;
|
|
56
|
+
//# sourceMappingURL=BuildPipeline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BuildPipeline.d.ts","sourceRoot":"","sources":["../../../src/core/builder/BuildPipeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,WAAW,EAAE,MAAM,KAAK,CAAC;AAEvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAEnE,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAEpE,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE9D;;;GAGG;AACH,MAAM,WAAW,iBAAiB,CAAC,QAAQ,EAAE,IAAI;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,KAAK,EAAE,OAAO,CAAC,CAAC;IAClD,WAAW,CAAC,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;IACrC,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,WAAW,EAAE,YAAY,CAAC,QAAQ,CAAC,EAAE,CAAC;IACtC,OAAO,EAAE,SAAS,CAAC,OAAO,CAAC,GAAG,SAAS,CAAC;IACxC,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9B,WAAW,EAAE,OAAO,GAAG,SAAS,CAAC;IACjC,UAAU,EAAE,OAAO,GAAG,SAAS,CAAC;IAChC,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;IACjD,mBAAmB,EAAE,MAAM,EAAE,CAAC;IAC9B,YAAY,EAAE,UAAU,GAAG,WAAW,GAAG,SAAS,CAAC;IACnD,WAAW,EAAE,iBAAiB,GAAG,SAAS,CAAC;IAC3C,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,aAAa,EAAE,aAAa,GAAG,SAAS,CAAC;IACzC,SAAS,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IAChC,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,OAAO,EAAE,CACL,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,GAAG,EAAE,IAAI,KACR,OAAO,CAAC,YAAY,GAAG,OAAO,CAAC,CAAC;CACxC;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,IAAI,EAC9C,MAAM,EAAE,iBAAiB,CAAC,QAAQ,EAAE,IAAI,CAAC,GAC1C,kBAAkB,CAAC,QAAQ,CAAC,CA4H9B"}
|