@caplets/core 0.14.0 → 0.16.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/auth/store.d.ts +22 -0
- package/dist/auth.d.ts +77 -0
- package/dist/capability-description.d.ts +2 -0
- package/dist/caplet-files.d.ts +266 -0
- package/dist/caplet-sets.d.ts +33 -0
- package/dist/cli/add.d.ts +62 -0
- package/dist/cli/auth.d.ts +20 -0
- package/dist/cli/author.d.ts +11 -0
- package/dist/cli/init.d.ts +5 -0
- package/dist/cli/inspection.d.ts +30 -0
- package/dist/cli/install.d.ts +15 -0
- package/dist/cli-tools.d.ts +23 -0
- package/dist/cli.d.ts +15 -0
- package/dist/config/paths.d.ts +14 -0
- package/dist/config/validation.d.ts +16 -0
- package/dist/config.d.ts +227 -0
- package/dist/downstream.d.ts +41 -0
- package/dist/engine-Brwid_mq.js +58159 -0
- package/dist/engine.d.ts +52 -0
- package/dist/errors.d.ts +24 -0
- package/dist/field-selection.d.ts +4 -0
- package/dist/generated-tool-input-schema.d.ts +47 -0
- package/dist/generated-tool-input-schema.js +59 -0
- package/dist/graphql.d.ts +30 -0
- package/dist/http/utils.d.ts +7 -0
- package/dist/http-actions.d.ts +26 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +6390 -61147
- package/dist/native/options.d.ts +34 -0
- package/dist/native/process-cleanup.d.ts +2 -0
- package/dist/native/remote.d.ts +46 -0
- package/dist/native/service.d.ts +30 -0
- package/dist/native/tools.d.ts +5 -0
- package/dist/native.d.ts +7 -0
- package/dist/native.js +367 -0
- package/dist/openapi.d.ts +29 -0
- package/dist/registry.d.ts +68 -0
- package/dist/result-content.d.ts +14 -0
- package/dist/runtime.d.ts +25 -0
- package/dist/schema-hash.d.ts +1 -0
- package/dist/schema-utils.d.ts +2 -0
- package/dist/serve/http.d.ts +12 -0
- package/dist/serve/index.d.ts +14 -0
- package/dist/serve/options.d.ts +34 -0
- package/dist/serve/session.d.ts +21 -0
- package/dist/serve/stdio.d.ts +5 -0
- package/dist/tool-search.d.ts +2 -0
- package/dist/tools.d.ts +67 -0
- package/package.json +22 -9
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export type ServeTransport = "stdio" | "http";
|
|
2
|
+
export type RawServeOptions = {
|
|
3
|
+
transport?: string;
|
|
4
|
+
host?: string;
|
|
5
|
+
port?: string | number;
|
|
6
|
+
path?: string;
|
|
7
|
+
user?: string;
|
|
8
|
+
password?: string;
|
|
9
|
+
allowUnauthenticatedHttp?: boolean;
|
|
10
|
+
};
|
|
11
|
+
export type StdioServeOptions = {
|
|
12
|
+
transport: "stdio";
|
|
13
|
+
};
|
|
14
|
+
export type HttpServeOptions = {
|
|
15
|
+
transport: "http";
|
|
16
|
+
host: string;
|
|
17
|
+
port: number;
|
|
18
|
+
path: string;
|
|
19
|
+
auth: HttpBasicAuthOptions;
|
|
20
|
+
warnUnauthenticatedNetwork: boolean;
|
|
21
|
+
loopback: boolean;
|
|
22
|
+
};
|
|
23
|
+
export type HttpBasicAuthOptions = {
|
|
24
|
+
enabled: false;
|
|
25
|
+
user: string;
|
|
26
|
+
} | {
|
|
27
|
+
enabled: true;
|
|
28
|
+
user: string;
|
|
29
|
+
password: string;
|
|
30
|
+
};
|
|
31
|
+
export type ServeOptions = StdioServeOptions | HttpServeOptions;
|
|
32
|
+
export type ServeEnv = Partial<Record<"CAPLETS_SERVER_USER" | "CAPLETS_SERVER_PASSWORD", string>>;
|
|
33
|
+
export declare function resolveServeOptions(raw: RawServeOptions, env?: ServeEnv): ServeOptions;
|
|
34
|
+
export declare function isLoopbackHost(host: string): boolean;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import type { Transport } from "@modelcontextprotocol/sdk/shared/transport.js";
|
|
3
|
+
import type { CapletsEngine } from "../engine";
|
|
4
|
+
export type ToolServer = Pick<McpServer, "registerTool" | "connect" | "close">;
|
|
5
|
+
export type CapletsMcpSessionOptions = {
|
|
6
|
+
server?: ToolServer;
|
|
7
|
+
};
|
|
8
|
+
export declare class CapletsMcpSession {
|
|
9
|
+
private readonly engine;
|
|
10
|
+
readonly server: ToolServer;
|
|
11
|
+
private readonly tools;
|
|
12
|
+
private readonly unsubscribeReload;
|
|
13
|
+
private closed;
|
|
14
|
+
constructor(engine: CapletsEngine, options?: CapletsMcpSessionOptions);
|
|
15
|
+
connect(transport: Transport): Promise<void>;
|
|
16
|
+
registeredToolIds(): string[];
|
|
17
|
+
close(): Promise<void>;
|
|
18
|
+
private reconcileTools;
|
|
19
|
+
private registerCapletTool;
|
|
20
|
+
private handleTool;
|
|
21
|
+
}
|
package/dist/tools.d.ts
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
|
|
3
|
+
import type { CapletSetManager } from "./caplet-sets";
|
|
4
|
+
import type { CapletConfig } from "./config";
|
|
5
|
+
import type { CliToolsManager } from "./cli-tools";
|
|
6
|
+
import type { DownstreamManager } from "./downstream";
|
|
7
|
+
import type { GraphQLManager } from "./graphql";
|
|
8
|
+
import type { HttpActionManager } from "./http-actions";
|
|
9
|
+
import type { OpenApiManager } from "./openapi";
|
|
10
|
+
import type { ServerRegistry } from "./registry";
|
|
11
|
+
export declare const generatedToolInputSchema: z.ZodObject<{
|
|
12
|
+
operation: z.ZodEnum<{
|
|
13
|
+
get_caplet: "get_caplet";
|
|
14
|
+
check_backend: "check_backend";
|
|
15
|
+
list_tools: "list_tools";
|
|
16
|
+
search_tools: "search_tools";
|
|
17
|
+
get_tool: "get_tool";
|
|
18
|
+
call_tool: "call_tool";
|
|
19
|
+
}>;
|
|
20
|
+
query: z.ZodOptional<z.ZodString>;
|
|
21
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
22
|
+
tool: z.ZodOptional<z.ZodString>;
|
|
23
|
+
arguments: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
24
|
+
fields: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
25
|
+
}, z.core.$strict>;
|
|
26
|
+
export type GeneratedServerToolRequest = z.infer<typeof generatedToolInputSchema>;
|
|
27
|
+
export declare function handleServerTool(server: CapletConfig, request: unknown, registry: ServerRegistry, downstream: DownstreamManager, openapi?: OpenApiManager, graphql?: GraphQLManager, http?: HttpActionManager, cli?: CliToolsManager, caplets?: CapletSetManager): Promise<any>;
|
|
28
|
+
export declare function validateOperationRequest(request: unknown, maxSearchLimit: number): RequiredOperationRequest;
|
|
29
|
+
type RequiredOperationRequest = {
|
|
30
|
+
operation: "get_caplet" | "check_backend";
|
|
31
|
+
} | {
|
|
32
|
+
operation: "list_tools";
|
|
33
|
+
limit?: number;
|
|
34
|
+
} | {
|
|
35
|
+
operation: "search_tools";
|
|
36
|
+
query: string;
|
|
37
|
+
limit?: number;
|
|
38
|
+
} | {
|
|
39
|
+
operation: "get_tool";
|
|
40
|
+
tool: string;
|
|
41
|
+
} | {
|
|
42
|
+
operation: "call_tool";
|
|
43
|
+
tool: string;
|
|
44
|
+
arguments: Record<string, unknown>;
|
|
45
|
+
fields?: string[];
|
|
46
|
+
};
|
|
47
|
+
export type CapletArtifact = {
|
|
48
|
+
kind: "screenshot" | "snapshot" | "console-log" | "network-log" | "file";
|
|
49
|
+
displayPath: string;
|
|
50
|
+
pathResolution: "absolute" | "relative-to-mcp-server";
|
|
51
|
+
};
|
|
52
|
+
export type CapletResultMetadata = {
|
|
53
|
+
id: string;
|
|
54
|
+
name: string;
|
|
55
|
+
backend: string;
|
|
56
|
+
operation: RequiredOperationRequest["operation"];
|
|
57
|
+
tool?: string;
|
|
58
|
+
status: "ok" | "error";
|
|
59
|
+
elapsedMs?: number;
|
|
60
|
+
artifacts?: CapletArtifact[];
|
|
61
|
+
};
|
|
62
|
+
export declare function metadataFor(server: CapletConfig, operation: RequiredOperationRequest["operation"], tool?: string, startedAt?: number): CapletResultMetadata;
|
|
63
|
+
export declare function jsonResult(value: unknown, metadata?: CapletResultMetadata): CallToolResult;
|
|
64
|
+
export declare function annotateCallToolResult<T extends object>(result: T, metadata: CapletResultMetadata): T & CallToolResult;
|
|
65
|
+
export declare function projectCallToolResult<T extends object>(result: T, outputSchema: unknown, fields: string[]): T & CallToolResult;
|
|
66
|
+
export declare function extractArtifacts(result: unknown): CapletArtifact[];
|
|
67
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@caplets/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0",
|
|
4
4
|
"description": "Core runtime library for Caplets progressive disclosure gateways.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"caplets",
|
|
@@ -21,31 +21,44 @@
|
|
|
21
21
|
"directory": "packages/core"
|
|
22
22
|
},
|
|
23
23
|
"files": [
|
|
24
|
-
"dist"
|
|
24
|
+
"dist",
|
|
25
|
+
"README.md"
|
|
25
26
|
],
|
|
26
27
|
"type": "module",
|
|
27
28
|
"main": "dist/index.js",
|
|
28
29
|
"exports": {
|
|
29
|
-
".":
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
".": {
|
|
31
|
+
"types": "./dist/index.d.ts",
|
|
32
|
+
"default": "./dist/index.js"
|
|
33
|
+
},
|
|
34
|
+
"./generated-tool-input-schema": {
|
|
35
|
+
"types": "./dist/generated-tool-input-schema.d.ts",
|
|
36
|
+
"default": "./dist/generated-tool-input-schema.js"
|
|
37
|
+
},
|
|
38
|
+
"./native": {
|
|
39
|
+
"types": "./dist/native.d.ts",
|
|
40
|
+
"default": "./dist/native.js"
|
|
41
|
+
}
|
|
32
42
|
},
|
|
33
43
|
"publishConfig": {
|
|
34
44
|
"access": "public"
|
|
35
45
|
},
|
|
36
46
|
"dependencies": {
|
|
37
47
|
"@apidevtools/swagger-parser": "^12.1.0",
|
|
48
|
+
"@hono/mcp": "^0.3.0",
|
|
49
|
+
"@hono/node-server": "^1.19.14",
|
|
38
50
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
39
51
|
"commander": "^14.0.3",
|
|
40
52
|
"graphql": "^16.14.0",
|
|
53
|
+
"hono": "^4.12.19",
|
|
41
54
|
"vfile": "^6.0.3",
|
|
42
55
|
"vfile-matter": "^5.0.1",
|
|
43
56
|
"zod": "^4.4.3"
|
|
44
57
|
},
|
|
45
58
|
"devDependencies": {
|
|
46
|
-
"@types/node": "^25.
|
|
47
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
48
|
-
"rolldown": "^1.0.
|
|
59
|
+
"@types/node": "^25.9.0",
|
|
60
|
+
"@typescript/native-preview": "7.0.0-dev.20260518.1",
|
|
61
|
+
"rolldown": "^1.0.1",
|
|
49
62
|
"typescript": "^6.0.3",
|
|
50
63
|
"vitest": "^4.1.6"
|
|
51
64
|
},
|
|
@@ -53,7 +66,7 @@
|
|
|
53
66
|
"node": ">=22"
|
|
54
67
|
},
|
|
55
68
|
"scripts": {
|
|
56
|
-
"build": "rm -rf dist && rolldown -c",
|
|
69
|
+
"build": "rm -rf dist && rolldown -c && tsc -p tsconfig.build.json",
|
|
57
70
|
"build:watch": "rolldown -c --watch",
|
|
58
71
|
"typecheck": "tsgo --noEmit",
|
|
59
72
|
"test": "vitest run"
|