capable-kit 0.0.1-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai-sdk.d.mts +40 -0
- package/dist/ai-sdk.mjs +58 -0
- package/dist/ai-sdk.mjs.map +1 -0
- package/dist/app.d.mts +2 -0
- package/dist/app.mjs +2 -0
- package/dist/bin.d.mts +1 -0
- package/dist/bin.mjs +447 -0
- package/dist/bin.mjs.map +1 -0
- package/dist/cli.d.mts +45 -0
- package/dist/cli.mjs +2 -0
- package/dist/core.d.mts +3 -0
- package/dist/core.mjs +3 -0
- package/dist/eve.d.mts +28 -0
- package/dist/eve.mjs +61 -0
- package/dist/eve.mjs.map +1 -0
- package/dist/http.d.mts +2 -0
- package/dist/http.mjs +2 -0
- package/dist/index-BuXwkN8G.d.mts +42 -0
- package/dist/index-C9ZThFPN.d.mts +125 -0
- package/dist/index-DLcYNpfo.d.mts +252 -0
- package/dist/index-u9ZOETR5.d.mts +57 -0
- package/dist/index.d.mts +4 -0
- package/dist/index.mjs +4 -0
- package/dist/mcp.d.mts +36 -0
- package/dist/mcp.mjs +140 -0
- package/dist/mcp.mjs.map +1 -0
- package/dist/projection-Cgq2u0Wt.mjs +18 -0
- package/dist/projection-Cgq2u0Wt.mjs.map +1 -0
- package/dist/server.d.mts +2 -0
- package/dist/server.mjs +82 -0
- package/dist/server.mjs.map +1 -0
- package/dist/src-CT4fbWqb.mjs +455 -0
- package/dist/src-CT4fbWqb.mjs.map +1 -0
- package/dist/src-CvWOGyGW.mjs +438 -0
- package/dist/src-CvWOGyGW.mjs.map +1 -0
- package/dist/src-DX-_J6l2.mjs +539 -0
- package/dist/src-DX-_J6l2.mjs.map +1 -0
- package/dist/src-DlSJtEhv.mjs +441 -0
- package/dist/src-DlSJtEhv.mjs.map +1 -0
- package/dist/subscription-CBnnIU42.d.mts +18 -0
- package/package.json +35 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { N as LocatedCapability, O as AppDefinition, j as CapabilityTree } from "./index-DLcYNpfo.mjs";
|
|
2
|
+
import { f as ApplicationTransport, o as AnyApp, t as ApplicationSelection } from "./index-C9ZThFPN.mjs";
|
|
3
|
+
//#region packages/fetch/src/standard.d.ts
|
|
4
|
+
type FetchHandler = (request: Request) => Response | Promise<Response>;
|
|
5
|
+
declare function createProtocolHandler(application: AnyApp | ((request: Request) => AnyApp | Promise<AnyApp>), options?: {
|
|
6
|
+
readonly basePath?: string;
|
|
7
|
+
}): {
|
|
8
|
+
readonly fetch: FetchHandler;
|
|
9
|
+
};
|
|
10
|
+
type TransportHeaders = HeadersInit | (() => HeadersInit | Promise<HeadersInit>);
|
|
11
|
+
declare function createHttpTransport(options: {
|
|
12
|
+
readonly url: string | URL | (() => string | URL);
|
|
13
|
+
readonly fetch?: (request: Request) => Response | Promise<Response>;
|
|
14
|
+
readonly headers?: TransportHeaders;
|
|
15
|
+
}): ApplicationTransport;
|
|
16
|
+
//#endregion
|
|
17
|
+
//#region packages/fetch/src/http.d.ts
|
|
18
|
+
type HttpMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
19
|
+
type HttpCapabilityMeta = false | {
|
|
20
|
+
readonly method?: HttpMethod;
|
|
21
|
+
readonly route?: string;
|
|
22
|
+
readonly status?: number;
|
|
23
|
+
};
|
|
24
|
+
type HttpGroupMeta = {
|
|
25
|
+
readonly prefix?: string;
|
|
26
|
+
};
|
|
27
|
+
declare module "@capable/core" {
|
|
28
|
+
interface CapabilityMetaRegistry {
|
|
29
|
+
readonly http?: HttpCapabilityMeta;
|
|
30
|
+
}
|
|
31
|
+
interface GroupMetaRegistry {
|
|
32
|
+
readonly http?: HttpGroupMeta;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
type ContextProvider<TContext> = (args: {
|
|
36
|
+
readonly request: Request;
|
|
37
|
+
}) => TContext | Promise<TContext>;
|
|
38
|
+
type CapabilitySelection<TTree extends CapabilityTree = CapabilityTree> = ApplicationSelection<TTree>;
|
|
39
|
+
type CompiledHttpRoute = {
|
|
40
|
+
readonly method: HttpMethod;
|
|
41
|
+
readonly path: string;
|
|
42
|
+
readonly capability: LocatedCapability;
|
|
43
|
+
};
|
|
44
|
+
declare function createHttpHandler<const TCapabilities extends CapabilityTree, TContext>(app: AppDefinition<TCapabilities, TContext>, options?: {
|
|
45
|
+
readonly context?: ContextProvider<TContext>;
|
|
46
|
+
readonly basePath?: string;
|
|
47
|
+
readonly openapiPath?: string | false;
|
|
48
|
+
readonly requireExplicitRoutes?: boolean;
|
|
49
|
+
readonly selection?: CapabilitySelection<TCapabilities>;
|
|
50
|
+
}): {
|
|
51
|
+
readonly fetch: FetchHandler;
|
|
52
|
+
readonly routes: readonly CompiledHttpRoute[];
|
|
53
|
+
readonly openapi: Readonly<Record<string, unknown>>;
|
|
54
|
+
};
|
|
55
|
+
//#endregion
|
|
56
|
+
export { HttpGroupMeta as a, FetchHandler as c, createProtocolHandler as d, HttpCapabilityMeta as i, TransportHeaders as l, CompiledHttpRoute as n, HttpMethod as o, ContextProvider as r, createHttpHandler as s, CapabilitySelection as t, createHttpTransport as u };
|
|
57
|
+
//# sourceMappingURL=index-u9ZOETR5.d.mts.map
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { D as AppContext, F as group, G as DefinedErrors, O as AppDefinition, P as defineApp, R as md, a as CapabilityEffect, b as executeCapability, c as CapabilityInput, d as CapabilityMiddlewareArgs, f as CapabilityOutput, g as MarkdownRenderer, h as ExecuteCapabilityOptions, i as CapabilityDefinition, j as CapabilityTree, m as CapabilitySubscriberArgs, o as CapabilityFactory, p as CapabilitySubscriber, q as defineErrors, r as CapabilityContext, s as CapabilityHandlerArgs, u as CapabilityMiddleware, y as capability } from "./index-DLcYNpfo.mjs";
|
|
2
|
+
import { n as watchQuery, t as WatchQueryOptions } from "./subscription-CBnnIU42.mjs";
|
|
3
|
+
import { _ as createApp, d as AppContextProvider, l as AppCapabilityCall, n as mergeApps, r as selectApp, s as App, t as ApplicationSelection, v as createRemoteApp, x as subscribe } from "./index-C9ZThFPN.mjs";
|
|
4
|
+
export { type App, type AppCapabilityCall, type AppContext, type AppContextProvider, type AppDefinition, type ApplicationSelection, type CapabilityContext, type CapabilityDefinition, type CapabilityEffect, type CapabilityFactory, type CapabilityHandlerArgs, type CapabilityInput, type CapabilityMiddleware, type CapabilityMiddlewareArgs, type CapabilityOutput, type CapabilitySubscriber, type CapabilitySubscriberArgs, type CapabilityTree, type DefinedErrors, type ExecuteCapabilityOptions, type MarkdownRenderer, type WatchQueryOptions, capability, createApp, createRemoteApp, defineApp, defineErrors, executeCapability, group, md, mergeApps, selectApp, subscribe, watchQuery };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { c as executeCapability, g as watchQuery, i as group, r as defineApp, s as capability, y as defineErrors } from "./src-DX-_J6l2.mjs";
|
|
2
|
+
import { t as md } from "./projection-Cgq2u0Wt.mjs";
|
|
3
|
+
import { n as selectApp, o as createApp, s as createRemoteApp, t as mergeApps, u as subscribe } from "./src-CT4fbWqb.mjs";
|
|
4
|
+
export { capability, createApp, createRemoteApp, defineApp, defineErrors, executeCapability, group, md, mergeApps, selectApp, subscribe, watchQuery };
|
package/dist/mcp.d.mts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { C as JsonSchema, h as CapabilityResult, o as AnyApp } from "./index-C9ZThFPN.mjs";
|
|
2
|
+
import { i as ServerMount } from "./index-BuXwkN8G.mjs";
|
|
3
|
+
//#region packages/mcp/src/index.d.ts
|
|
4
|
+
type McpCapabilityMeta = false | {
|
|
5
|
+
readonly name?: string;
|
|
6
|
+
};
|
|
7
|
+
declare module "@capable/core" {
|
|
8
|
+
interface CapabilityMetaRegistry {
|
|
9
|
+
readonly mcp?: McpCapabilityMeta;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
type McpTool = {
|
|
13
|
+
readonly name: string;
|
|
14
|
+
readonly title?: string;
|
|
15
|
+
readonly description?: string;
|
|
16
|
+
readonly inputSchema: JsonSchema;
|
|
17
|
+
readonly outputSchema?: JsonSchema;
|
|
18
|
+
readonly annotations: {
|
|
19
|
+
readonly readOnlyHint: boolean;
|
|
20
|
+
readonly destructiveHint: boolean;
|
|
21
|
+
};
|
|
22
|
+
call(input: unknown, options?: {
|
|
23
|
+
readonly signal?: AbortSignal;
|
|
24
|
+
}): Promise<CapabilityResult>;
|
|
25
|
+
};
|
|
26
|
+
declare function createMcp(app: AnyApp): Promise<readonly McpTool[]>;
|
|
27
|
+
//#endregion
|
|
28
|
+
//#region packages/mcp/src/mount.d.ts
|
|
29
|
+
declare function mcp<TContext = any>(options?: {
|
|
30
|
+
readonly path?: string;
|
|
31
|
+
readonly name?: string;
|
|
32
|
+
readonly version?: string;
|
|
33
|
+
}): ServerMount<TContext>;
|
|
34
|
+
//#endregion
|
|
35
|
+
export { McpCapabilityMeta, McpTool, createMcp, mcp };
|
|
36
|
+
//# sourceMappingURL=mcp.d.mts.map
|
package/dist/mcp.mjs
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { a as TransportError, c as getAppRuntime, o as createApp } from "./src-CT4fbWqb.mjs";
|
|
2
|
+
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
3
|
+
import { WebStandardStreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js";
|
|
4
|
+
import { CallToolRequestSchema, ListToolsRequestSchema } from "@modelcontextprotocol/sdk/types.js";
|
|
5
|
+
//#region packages/mcp/src/index.ts
|
|
6
|
+
async function createMcp(app) {
|
|
7
|
+
const runtime = getAppRuntime(app);
|
|
8
|
+
const tools = flatten((await runtime.manifest()).capabilities).filter((capability) => capability.meta.mcp !== false).map((capability) => {
|
|
9
|
+
const meta = capability.meta.mcp;
|
|
10
|
+
return Object.freeze({
|
|
11
|
+
name: meta?.name ?? capability.path.join("__"),
|
|
12
|
+
...capability.title ? { title: capability.title } : {},
|
|
13
|
+
...capability.description ? { description: capability.description } : {},
|
|
14
|
+
inputSchema: capability.input ?? {
|
|
15
|
+
type: "object",
|
|
16
|
+
properties: {},
|
|
17
|
+
additionalProperties: false
|
|
18
|
+
},
|
|
19
|
+
...capability.output ? { outputSchema: mcpOutputSchema(capability.output) } : {},
|
|
20
|
+
annotations: {
|
|
21
|
+
readOnlyHint: capability.effect === "read",
|
|
22
|
+
destructiveHint: capability.effect === "destructive"
|
|
23
|
+
},
|
|
24
|
+
call(input, options) {
|
|
25
|
+
return runtime.call({
|
|
26
|
+
id: capability.id,
|
|
27
|
+
input,
|
|
28
|
+
...options?.signal ? { signal: options.signal } : {}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
const names = /* @__PURE__ */ new Set();
|
|
34
|
+
for (const tool of tools) {
|
|
35
|
+
if (names.has(tool.name)) throw new Error(`Duplicate MCP tool name "${tool.name}"`);
|
|
36
|
+
names.add(tool.name);
|
|
37
|
+
}
|
|
38
|
+
return tools;
|
|
39
|
+
}
|
|
40
|
+
function mcpOutputSchema(schema) {
|
|
41
|
+
if (schema.type === "object") return schema;
|
|
42
|
+
return {
|
|
43
|
+
type: "object",
|
|
44
|
+
properties: { value: schema },
|
|
45
|
+
required: ["value"],
|
|
46
|
+
additionalProperties: false
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
function flatten(nodes) {
|
|
50
|
+
return nodes.flatMap((node) => node.type === "capability" ? [node] : flatten(node.children));
|
|
51
|
+
}
|
|
52
|
+
//#endregion
|
|
53
|
+
//#region packages/mcp/src/mount.ts
|
|
54
|
+
function mcp(options = {}) {
|
|
55
|
+
const path = normalizePath(options.path ?? "/mcp");
|
|
56
|
+
return {
|
|
57
|
+
kind: "capable.server.mount",
|
|
58
|
+
compile(app, context) {
|
|
59
|
+
return {
|
|
60
|
+
name: "mcp",
|
|
61
|
+
async fetch(request) {
|
|
62
|
+
if (new URL(request.url).pathname !== path) return void 0;
|
|
63
|
+
const server = createMcpServer(await createMcp(createApp(app, context ? { context: () => context({ request }) } : void 0)), {
|
|
64
|
+
name: options.name ?? app.name ?? "capable",
|
|
65
|
+
version: options.version ?? app.version ?? "0.0.0"
|
|
66
|
+
});
|
|
67
|
+
const transport = new WebStandardStreamableHTTPServerTransport({ enableJsonResponse: true });
|
|
68
|
+
await server.connect(transport);
|
|
69
|
+
try {
|
|
70
|
+
return await transport.handleRequest(request);
|
|
71
|
+
} finally {
|
|
72
|
+
await transport.close();
|
|
73
|
+
await server.close();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
function createMcpServer(tools, info) {
|
|
81
|
+
const server = new Server(info, { capabilities: { tools: {} } });
|
|
82
|
+
server.setRequestHandler(ListToolsRequestSchema, () => ({ tools: tools.map(toProtocolTool) }));
|
|
83
|
+
server.setRequestHandler(CallToolRequestSchema, async (request, extra) => {
|
|
84
|
+
const tool = tools.find(({ name }) => name === request.params.name);
|
|
85
|
+
if (!tool) return toolError(`Unknown tool "${request.params.name}"`);
|
|
86
|
+
try {
|
|
87
|
+
const result = await tool.call(request.params.arguments ?? {}, { signal: extra.signal });
|
|
88
|
+
return {
|
|
89
|
+
content: [{
|
|
90
|
+
type: "text",
|
|
91
|
+
text: result.markdown ?? stringify(result.output)
|
|
92
|
+
}],
|
|
93
|
+
structuredContent: isRecord(result.output) ? result.output : { value: result.output }
|
|
94
|
+
};
|
|
95
|
+
} catch (error) {
|
|
96
|
+
if (!(error instanceof TransportError)) throw error;
|
|
97
|
+
return toolError(error.message, {
|
|
98
|
+
code: error.code,
|
|
99
|
+
status: error.status,
|
|
100
|
+
data: error.data
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
return server;
|
|
105
|
+
}
|
|
106
|
+
function toProtocolTool(tool) {
|
|
107
|
+
return {
|
|
108
|
+
name: tool.name,
|
|
109
|
+
...tool.title ? { title: tool.title } : {},
|
|
110
|
+
...tool.description ? { description: tool.description } : {},
|
|
111
|
+
inputSchema: tool.inputSchema,
|
|
112
|
+
...tool.outputSchema ? { outputSchema: tool.outputSchema } : {},
|
|
113
|
+
annotations: tool.annotations
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
function toolError(message, details) {
|
|
117
|
+
return {
|
|
118
|
+
isError: true,
|
|
119
|
+
content: [{
|
|
120
|
+
type: "text",
|
|
121
|
+
text: details ? JSON.stringify({
|
|
122
|
+
message,
|
|
123
|
+
...details
|
|
124
|
+
}) : message
|
|
125
|
+
}]
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
function stringify(value) {
|
|
129
|
+
return typeof value === "string" ? value : JSON.stringify(value) ?? String(value);
|
|
130
|
+
}
|
|
131
|
+
function normalizePath(value) {
|
|
132
|
+
return `/${value.split("/").filter(Boolean).join("/")}`;
|
|
133
|
+
}
|
|
134
|
+
function isRecord(value) {
|
|
135
|
+
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
136
|
+
}
|
|
137
|
+
//#endregion
|
|
138
|
+
export { createMcp, mcp };
|
|
139
|
+
|
|
140
|
+
//# sourceMappingURL=mcp.mjs.map
|
package/dist/mcp.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.mjs","names":[],"sources":["../../mcp/src/index.ts","../../mcp/src/mount.ts"],"sourcesContent":["import type { CapabilityMetaRegistry } from \"@capable/core\";\nimport {\n getAppRuntime,\n type AnyApp,\n type JsonSchema,\n type ManifestNode,\n type ManifestCapability,\n type CapabilityResult,\n} from \"@capable/app\";\n\nexport type McpCapabilityMeta =\n | false\n | {\n readonly name?: string;\n };\n\ndeclare module \"@capable/core\" {\n interface CapabilityMetaRegistry {\n readonly mcp?: McpCapabilityMeta;\n }\n}\n\nexport type McpTool = {\n readonly name: string;\n readonly title?: string;\n readonly description?: string;\n readonly inputSchema: JsonSchema;\n readonly outputSchema?: JsonSchema;\n readonly annotations: {\n readonly readOnlyHint: boolean;\n readonly destructiveHint: boolean;\n };\n call(\n input: unknown,\n options?: { readonly signal?: AbortSignal },\n ): Promise<CapabilityResult>;\n};\n\nexport async function createMcp(\n app: AnyApp,\n): Promise<readonly McpTool[]> {\n const runtime = getAppRuntime(app);\n const manifest = await runtime.manifest();\n const tools = flatten(manifest.capabilities)\n .filter((capability) => capability.meta.mcp !== false)\n .map((capability) => {\n const meta = capability.meta.mcp as Exclude<McpCapabilityMeta, false> | undefined;\n return Object.freeze({\n name: meta?.name ?? capability.path.join(\"__\"),\n ...(capability.title ? { title: capability.title } : {}),\n ...(capability.description ? { description: capability.description } : {}),\n inputSchema: capability.input ?? {\n type: \"object\",\n properties: {},\n additionalProperties: false,\n },\n ...(capability.output\n ? { outputSchema: mcpOutputSchema(capability.output) }\n : {}),\n annotations: {\n readOnlyHint: capability.effect === \"read\",\n destructiveHint: capability.effect === \"destructive\",\n },\n call(input: unknown, options?: { readonly signal?: AbortSignal }) {\n return runtime.call({\n id: capability.id,\n input,\n ...(options?.signal ? { signal: options.signal } : {}),\n });\n },\n });\n });\n const names = new Set<string>();\n for (const tool of tools) {\n if (names.has(tool.name)) {\n throw new Error(`Duplicate MCP tool name \"${tool.name}\"`);\n }\n names.add(tool.name);\n }\n return tools;\n}\n\nfunction mcpOutputSchema(schema: JsonSchema): JsonSchema {\n if (schema.type === \"object\") return schema;\n return {\n type: \"object\",\n properties: { value: schema },\n required: [\"value\"],\n additionalProperties: false,\n };\n}\n\nfunction flatten(nodes: readonly ManifestNode[]): readonly ManifestCapability[] {\n return nodes.flatMap((node) =>\n node.type === \"capability\" ? [node] : flatten(node.children)\n );\n}\n","import type { ServerMount } from \"@capable/server\";\nimport { createApp, TransportError } from \"@capable/app\";\nimport { Server } from \"@modelcontextprotocol/sdk/server/index.js\";\nimport { WebStandardStreamableHTTPServerTransport } from \"@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js\";\nimport {\n CallToolRequestSchema,\n type CallToolResult,\n ListToolsRequestSchema,\n type Tool,\n} from \"@modelcontextprotocol/sdk/types.js\";\nimport { createMcp, type McpTool } from \"./index.ts\";\n\nexport function mcp<TContext = any>(\n options: {\n readonly path?: string;\n readonly name?: string;\n readonly version?: string;\n } = {},\n): ServerMount<TContext> {\n const path = normalizePath(options.path ?? \"/mcp\");\n return {\n kind: \"capable.server.mount\",\n compile(app, context) {\n return {\n name: \"mcp\",\n async fetch(request) {\n if (new URL(request.url).pathname !== path) return undefined;\n const executable = createApp(\n app,\n context\n ? { context: () => context({ request }) }\n : undefined as never,\n );\n const tools = await createMcp(executable);\n const server = createMcpServer(tools, {\n name: options.name ?? app.name ?? \"capable\",\n version: options.version ?? app.version ?? \"0.0.0\",\n });\n const transport = new WebStandardStreamableHTTPServerTransport({\n enableJsonResponse: true,\n });\n await server.connect(transport);\n try {\n return await transport.handleRequest(request);\n } finally {\n await transport.close();\n await server.close();\n }\n },\n };\n },\n };\n}\n\nfunction createMcpServer(\n tools: readonly McpTool[],\n info: { readonly name: string; readonly version: string },\n): Server {\n const server = new Server(info, {\n capabilities: { tools: {} },\n });\n server.setRequestHandler(ListToolsRequestSchema, () => ({\n tools: tools.map(toProtocolTool),\n }));\n server.setRequestHandler(CallToolRequestSchema, async (request, extra) => {\n const tool = tools.find(({ name }) => name === request.params.name);\n if (!tool) {\n return toolError(`Unknown tool \"${request.params.name}\"`);\n }\n try {\n const result = await tool.call(request.params.arguments ?? {}, {\n signal: extra.signal,\n });\n return {\n content: [{\n type: \"text\",\n text: result.markdown ?? stringify(result.output),\n }],\n structuredContent: isRecord(result.output)\n ? result.output\n : { value: result.output },\n } satisfies CallToolResult;\n } catch (error) {\n if (!(error instanceof TransportError)) throw error;\n return toolError(error.message, {\n code: error.code,\n status: error.status,\n data: error.data,\n });\n }\n });\n return server;\n}\n\nfunction toProtocolTool(tool: McpTool): Tool {\n return {\n name: tool.name,\n ...(tool.title ? { title: tool.title } : {}),\n ...(tool.description ? { description: tool.description } : {}),\n inputSchema: tool.inputSchema as Tool[\"inputSchema\"],\n ...(tool.outputSchema\n ? { outputSchema: tool.outputSchema as Tool[\"outputSchema\"] }\n : {}),\n annotations: tool.annotations,\n };\n}\n\nfunction toolError(\n message: string,\n details?: Record<string, unknown>,\n): CallToolResult {\n return {\n isError: true,\n content: [{\n type: \"text\",\n text: details ? JSON.stringify({ message, ...details }) : message,\n }],\n };\n}\n\nfunction stringify(value: unknown): string {\n return typeof value === \"string\"\n ? value\n : JSON.stringify(value) ?? String(value);\n}\n\nfunction normalizePath(value: string): string {\n return `/${value.split(\"/\").filter(Boolean).join(\"/\")}`;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return Boolean(value && typeof value === \"object\" && !Array.isArray(value));\n}\n"],"mappings":";;;;;AAsCA,eAAsB,UACpB,KAC6B;CAC7B,MAAM,UAAU,cAAc,GAAG;CAEjC,MAAM,QAAQ,SAAQ,MADC,QAAQ,SAAS,EAAA,CACT,YAAY,CAAC,CACzC,QAAQ,eAAe,WAAW,KAAK,QAAQ,KAAK,CAAC,CACrD,KAAK,eAAe;EACnB,MAAM,OAAO,WAAW,KAAK;EAC7B,OAAO,OAAO,OAAO;GACnB,MAAM,MAAM,QAAQ,WAAW,KAAK,KAAK,IAAI;GAC7C,GAAI,WAAW,QAAQ,EAAE,OAAO,WAAW,MAAM,IAAI,CAAC;GACtD,GAAI,WAAW,cAAc,EAAE,aAAa,WAAW,YAAY,IAAI,CAAC;GACxE,aAAa,WAAW,SAAS;IAC/B,MAAM;IACN,YAAY,CAAC;IACb,sBAAsB;GACxB;GACA,GAAI,WAAW,SACX,EAAE,cAAc,gBAAgB,WAAW,MAAM,EAAE,IACnD,CAAC;GACL,aAAa;IACX,cAAc,WAAW,WAAW;IACpC,iBAAiB,WAAW,WAAW;GACzC;GACA,KAAK,OAAgB,SAA6C;IAChE,OAAO,QAAQ,KAAK;KAClB,IAAI,WAAW;KACf;KACA,GAAI,SAAS,SA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AM;GACN,MAAM,UAAU,KAAK,UAAU;IAAE;IAAS,GAAG;GAAQ,CAAC,IAAI;EAC5D,CAAC;CACH;AACF;AAEA,SAAS,UAAU,OAAwB;CACzC,OAAO,OAAO,UAAU,WACpB,QACA,KAAK,UAAU,KAAK,KAAK,OAAO,KAAK;AAC3C;AAEA,SAAS,cAAc,OAAuB;CAC5C,OAAO,IAAI,MAAM,MAAM,GAAG,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;AACtD;AAEA,SAAS,SAAS,OAAkD;CAClE,OAAO,QAAQ,SAAS,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK,CAAC;AAC5E"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//#region packages/core/src/projection.ts
|
|
2
|
+
function md(strings, ...values) {
|
|
3
|
+
return dedent(strings.reduce((result, part, index) => `${result}${part}${index < values.length ? renderValue(values[index]) : ""}`, "")).trim();
|
|
4
|
+
}
|
|
5
|
+
function renderValue(value) {
|
|
6
|
+
if (Array.isArray(value)) return value.map(renderValue).join("");
|
|
7
|
+
return value === null || value === void 0 ? "" : String(value);
|
|
8
|
+
}
|
|
9
|
+
function dedent(value) {
|
|
10
|
+
const lines = value.replace(/^\n/, "").split("\n");
|
|
11
|
+
const indents = lines.filter((line) => line.trim()).map((line) => line.match(/^\s*/)?.[0].length ?? 0);
|
|
12
|
+
const indent = indents.length ? Math.min(...indents) : 0;
|
|
13
|
+
return lines.map((line) => line.slice(indent)).join("\n");
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { md as t };
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=projection-Cgq2u0Wt.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projection-Cgq2u0Wt.mjs","names":[],"sources":["../../core/src/projection.ts"],"sourcesContent":["export type MaybePromise<T> = T | Promise<T>;\n\nexport function md(\n strings: TemplateStringsArray,\n ...values: readonly unknown[]\n): string {\n const rendered = strings.reduce(\n (result, part, index) => `${result}${part}${index < values.length ? renderValue(values[index]) : \"\"}`,\n \"\",\n );\n return dedent(rendered).trim();\n}\n\nfunction renderValue(value: unknown): string {\n if (Array.isArray(value)) return value.map(renderValue).join(\"\");\n return value === null || value === undefined ? \"\" : String(value);\n}\n\nfunction dedent(value: string): string {\n const lines = value.replace(/^\\n/, \"\").split(\"\\n\");\n const indents = lines\n .filter((line) => line.trim())\n .map((line) => line.match(/^\\s*/)?.[0].length ?? 0);\n const indent = indents.length ? Math.min(...indents) : 0;\n return lines.map((line) => line.slice(indent)).join(\"\\n\");\n}\n"],"mappings":";AAEA,SAAgB,GACd,SACA,GAAG,QACK;CAKR,OAAO,OAJU,QAAQ,QACtB,QAAQ,MAAM,UAAU,GAAG,SAAS,OAAO,QAAQ,OAAO,SAAS,YAAY,OAAO,MAAM,IAAI,MACjG,EAEmB,CAAC,CAAC,CAAC,KAAK;AAC/B;AAEA,SAAS,YAAY,OAAwB;CAC3C,IAAI,MAAM,QAAQ,KAAK,GAAG,OAAO,MAAM,IAAI,WAAW,CAAC,CAAC,KAAK,EAAE;CAC/D,OAAO,UAAU,QAAQ,UAAU,KAAA,IAAY,KAAK,OAAO,KAAK;AAClE;AAEA,SAAS,OAAO,OAAuB;CACrC,MAAM,QAAQ,MAAM,QAAQ,OAAO,EAAE,CAAC,CAAC,MAAM,IAAI;CACjD,MAAM,UAAU,MACb,QAAQ,SAAS,KAAK,KAAK,CAAC,CAAC,CAC7B,KAAK,SAAS,KAAK,MAAM,MAAM,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC;CACpD,MAAM,SAAS,QAAQ,SAAS,KAAK,IAAI,GAAG,OAAO,IAAI;CACvD,OAAO,MAAM,KAAK,SAAS,KAAK,MAAM,MAAM,CAAC,CAAC,CAAC,KAAK,IAAI;AAC1D"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as createServer, i as ServerMount, n as CompiledServerMount, o as http, r as ServerMiddleware, s as standard, t as CapableServer } from "./index-BuXwkN8G.mjs";
|
|
2
|
+
export { CapableServer, CompiledServerMount, ServerMiddleware, ServerMount, createServer, http, standard };
|
package/dist/server.mjs
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { n as selectApp, o as createApp } from "./src-CT4fbWqb.mjs";
|
|
2
|
+
import { r as createProtocolHandler, t as createHttpHandler } from "./src-DlSJtEhv.mjs";
|
|
3
|
+
//#region packages/server/src/index.ts
|
|
4
|
+
function standard(options = {}) {
|
|
5
|
+
return {
|
|
6
|
+
kind: "capable.server.mount",
|
|
7
|
+
compile(app, context) {
|
|
8
|
+
const protocol = createProtocolHandler((request) => {
|
|
9
|
+
const executable = createApp(app, context ? { context: () => context({ request }) } : void 0);
|
|
10
|
+
return options.selection ? selectApp(executable, options.selection) : executable;
|
|
11
|
+
}, { ...options.path ? { basePath: options.path } : {} });
|
|
12
|
+
const base = normalizePath(options.path ?? "/_capable");
|
|
13
|
+
return {
|
|
14
|
+
name: "standard",
|
|
15
|
+
async fetch(request) {
|
|
16
|
+
if (!new URL(request.url).pathname.startsWith(`${base}/`)) return;
|
|
17
|
+
return protocol.fetch(request);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
function http(options = {}) {
|
|
24
|
+
return {
|
|
25
|
+
kind: "capable.server.mount",
|
|
26
|
+
compile(app, context) {
|
|
27
|
+
const handler = createHttpHandler(app, {
|
|
28
|
+
...context ? { context } : {},
|
|
29
|
+
...options.path ? { basePath: options.path } : {},
|
|
30
|
+
...options.openapiPath !== void 0 ? { openapiPath: options.openapiPath } : {},
|
|
31
|
+
...options.requireExplicitRoutes !== void 0 ? { requireExplicitRoutes: options.requireExplicitRoutes } : {},
|
|
32
|
+
...options.selection ? { selection: options.selection } : {}
|
|
33
|
+
});
|
|
34
|
+
const base = normalizePath(options.path ?? "/api");
|
|
35
|
+
const openapiPath = options.openapiPath === false ? void 0 : normalizePath(options.openapiPath ?? "/openapi.json");
|
|
36
|
+
return {
|
|
37
|
+
name: "http",
|
|
38
|
+
async fetch(request) {
|
|
39
|
+
const pathname = new URL(request.url).pathname;
|
|
40
|
+
if (!pathname.startsWith(`${base}/`) && pathname !== base && pathname !== openapiPath) return;
|
|
41
|
+
return handler.fetch(request);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
function createServer(app, ...[providedOptions]) {
|
|
48
|
+
const options = providedOptions ?? {};
|
|
49
|
+
const mounts = (options.mounts ?? [standard(), http()]).map((mount) => mount.compile(app, options.context));
|
|
50
|
+
async function dispatch(request) {
|
|
51
|
+
for (const mount of mounts) {
|
|
52
|
+
const response = await mount.fetch(request);
|
|
53
|
+
if (response) return response;
|
|
54
|
+
}
|
|
55
|
+
return new Response("Not Found", { status: 404 });
|
|
56
|
+
}
|
|
57
|
+
return Object.freeze({ async fetch(request) {
|
|
58
|
+
try {
|
|
59
|
+
return options.middleware ? await options.middleware({
|
|
60
|
+
request,
|
|
61
|
+
next: (nextRequest = request) => dispatch(nextRequest)
|
|
62
|
+
}) : await dispatch(request);
|
|
63
|
+
} catch (error) {
|
|
64
|
+
options.onError?.(error);
|
|
65
|
+
return Response.json({
|
|
66
|
+
ok: false,
|
|
67
|
+
error: {
|
|
68
|
+
code: "INTERNAL_SERVER_ERROR",
|
|
69
|
+
message: "Internal Server Error",
|
|
70
|
+
status: 500
|
|
71
|
+
}
|
|
72
|
+
}, { status: 500 });
|
|
73
|
+
}
|
|
74
|
+
} });
|
|
75
|
+
}
|
|
76
|
+
function normalizePath(value) {
|
|
77
|
+
return `/${value.split("/").filter(Boolean).join("/")}`;
|
|
78
|
+
}
|
|
79
|
+
//#endregion
|
|
80
|
+
export { createServer, http, standard };
|
|
81
|
+
|
|
82
|
+
//# sourceMappingURL=server.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.mjs","names":[],"sources":["../../server/src/index.ts"],"sourcesContent":["import type {\n AppDefinition,\n MaybePromise,\n} from \"@capable/core\";\nimport {\n createHttpHandler,\n createProtocolHandler,\n type ContextProvider,\n type CapabilitySelection,\n} from \"@capable/fetch\";\nimport {\n createApp,\n selectApp,\n type ApplicationSelection,\n} from \"@capable/app\";\n\nexport type ServerMount<TContext> = {\n readonly kind: \"capable.server.mount\";\n compile(\n app: AppDefinition<any, TContext>,\n context: ContextProvider<TContext> | undefined,\n ): CompiledServerMount;\n};\n\nexport type CompiledServerMount = {\n readonly name: string;\n readonly fetch: (request: Request) => MaybePromise<Response | undefined>;\n};\n\nexport function standard<TContext = any>(\n options: {\n readonly path?: string;\n readonly selection?: ApplicationSelection;\n } = {},\n): ServerMount<TContext> {\n return {\n kind: \"capable.server.mount\",\n compile(app, context) {\n const protocol = createProtocolHandler(\n (request) => {\n const executable = createApp(\n app,\n context\n ? { context: () => context({ request }) }\n : undefined as never,\n );\n return options.selection\n ? selectApp(executable, options.selection)\n : executable;\n },\n {\n ...(options.path ? { basePath: options.path } : {}),\n },\n );\n const base = normalizePath(options.path ?? \"/_capable\");\n return {\n name: \"standard\",\n async fetch(request) {\n if (!new URL(request.url).pathname.startsWith(`${base}/`)) {\n return undefined;\n }\n return protocol.fetch(request);\n },\n };\n },\n };\n}\n\nexport function http<TContext = any>(\n options: {\n readonly path?: string;\n readonly openapiPath?: string | false;\n readonly requireExplicitRoutes?: boolean;\n readonly selection?: CapabilitySelection;\n } = {},\n): ServerMount<TContext> {\n return {\n kind: \"capable.server.mount\",\n compile(app, context) {\n const handler = createHttpHandler(app, {\n ...(context ? { context } : {}),\n ...(options.path ? { basePath: options.path } : {}),\n ...(options.openapiPath !== undefined\n ? { openapiPath: options.openapiPath }\n : {}),\n ...(options.requireExplicitRoutes !== undefined\n ? { requireExplicitRoutes: options.requireExplicitRoutes }\n : {}),\n ...(options.selection ? { selection: options.selection } : {}),\n });\n const base = normalizePath(options.path ?? \"/api\");\n const openapiPath = options.openapiPath === false\n ? undefined\n : normalizePath(options.openapiPath ?? \"/openapi.json\");\n return {\n name: \"http\",\n async fetch(request) {\n const pathname = new URL(request.url).pathname;\n if (\n !pathname.startsWith(`${base}/`) &&\n pathname !== base &&\n pathname !== openapiPath\n ) {\n return undefined;\n }\n return handler.fetch(request);\n },\n };\n },\n };\n}\n\nexport type CapableServer = {\n readonly fetch: (request: Request) => Promise<Response>;\n};\n\nexport type ServerMiddleware = (args: {\n readonly request: Request;\n readonly next: (request?: Request) => Promise<Response>;\n}) => MaybePromise<Response>;\n\ntype CreateServerOptions<TContext> = {\n readonly context?: ContextProvider<TContext>;\n readonly mounts?: readonly ServerMount<TContext>[];\n readonly middleware?: ServerMiddleware;\n readonly onError?: (error: unknown) => void;\n};\n\ntype CreateServerArgs<TContext> = [TContext] extends [undefined]\n ? [options?: CreateServerOptions<TContext>]\n : [options: CreateServerOptions<TContext> & {\n readonly context: ContextProvider<TContext>;\n }];\n\nexport function createServer<TContext>(\n app: AppDefinition<any, TContext>,\n ...[providedOptions]: CreateServerArgs<TContext>\n): CapableServer {\n const options = (providedOptions ?? {}) as CreateServerOptions<TContext>;\n const mounts = (options.mounts ?? [standard(), http()])\n .map((mount) => mount.compile(app, options.context));\n\n async function dispatch(request: Request): Promise<Response> {\n for (const mount of mounts) {\n const response = await mount.fetch(request);\n if (response) return response;\n }\n return new Response(\"Not Found\", { status: 404 });\n }\n\n return Object.freeze({\n async fetch(request: Request) {\n try {\n return options.middleware\n ? await options.middleware({\n request,\n next: (nextRequest = request) => dispatch(nextRequest),\n })\n : await dispatch(request);\n } catch (error) {\n options.onError?.(error);\n return Response.json({\n ok: false,\n error: {\n code: \"INTERNAL_SERVER_ERROR\",\n message: \"Internal Server Error\",\n status: 500,\n },\n }, { status: 500 });\n }\n },\n });\n}\n\nfunction normalizePath(value: string): string {\n return `/${value.split(\"/\").filter(Boolean).join(\"/\")}`;\n}\n"],"mappings":";;;AA6BA,SAAgB,SACd,UAGI,CAAC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