@caplets/core 0.16.0 → 0.18.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.d.ts +14 -0
- package/dist/cli/auth.d.ts +24 -0
- package/dist/cli/commands.d.ts +37 -0
- package/dist/cli/completion-cache.d.ts +30 -0
- package/dist/cli/completion-discovery.d.ts +30 -0
- package/dist/cli/completion.d.ts +15 -0
- package/dist/cli.d.ts +2 -0
- package/dist/completion-CxGG6ae3.js +560 -0
- package/dist/config/paths.d.ts +3 -0
- package/dist/config.d.ts +14 -1
- package/dist/downstream.d.ts +169 -1
- package/dist/engine.d.ts +2 -0
- package/dist/errors.d.ts +1 -1
- package/dist/generated-tool-input-schema-B6rce396.js +4720 -0
- package/dist/generated-tool-input-schema.d.ts +222 -9
- package/dist/generated-tool-input-schema.js +2 -59
- package/dist/index.js +1063 -207
- package/dist/native/options.d.ts +4 -5
- package/dist/native/remote.d.ts +1 -0
- package/dist/native/service.d.ts +3 -0
- package/dist/native.js +38 -64
- package/dist/{engine-Brwid_mq.js → options-DM1cMRcp.js} +888 -4851
- package/dist/remote-control/auth-flow.d.ts +22 -0
- package/dist/remote-control/client.d.ts +11 -0
- package/dist/remote-control/dispatch.d.ts +9 -0
- package/dist/remote-control/types.d.ts +17 -0
- package/dist/serve/http.d.ts +11 -0
- package/dist/serve/options.d.ts +3 -1
- package/dist/server/options.d.ts +41 -0
- package/dist/tools.d.ts +38 -20
- package/package.json +1 -1
package/dist/auth.d.ts
CHANGED
|
@@ -53,6 +53,15 @@ export declare class FileOAuthProvider implements OAuthClientProvider {
|
|
|
53
53
|
codeVerifier(): string;
|
|
54
54
|
addClientAuthentication: (headers: Headers, params: URLSearchParams) => Promise<void>;
|
|
55
55
|
}
|
|
56
|
+
export type StartedOAuthFlow = {
|
|
57
|
+
authorizationUrl: string;
|
|
58
|
+
complete(callbackUrl: string): Promise<void>;
|
|
59
|
+
};
|
|
60
|
+
export declare function startOAuthFlow(server: CapletServerConfig, options: {
|
|
61
|
+
redirectUri: string;
|
|
62
|
+
authDir?: string;
|
|
63
|
+
print?: (line: string) => void;
|
|
64
|
+
}): Promise<StartedOAuthFlow>;
|
|
56
65
|
export declare function runOAuthFlow(server: CapletServerConfig, options?: {
|
|
57
66
|
noOpen?: boolean;
|
|
58
67
|
authDir?: string;
|
|
@@ -61,6 +70,11 @@ export declare function runOAuthFlow(server: CapletServerConfig, options?: {
|
|
|
61
70
|
open?: (url: string) => Promise<void>;
|
|
62
71
|
print?: (line: string) => void;
|
|
63
72
|
}): Promise<AuthResult>;
|
|
73
|
+
export declare function startGenericOAuthFlow(target: GenericAuthTarget, options: {
|
|
74
|
+
redirectUri: string;
|
|
75
|
+
authDir?: string;
|
|
76
|
+
print?: (line: string) => void;
|
|
77
|
+
}): Promise<StartedOAuthFlow>;
|
|
64
78
|
export declare function runGenericOAuthFlow(target: GenericAuthTarget, options?: {
|
|
65
79
|
noOpen?: boolean;
|
|
66
80
|
authDir?: string;
|
package/dist/cli/auth.d.ts
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
|
+
import { type GenericAuthTarget } from "../auth";
|
|
2
|
+
import { loadConfig, type GraphQlEndpointConfig, type HttpApiConfig } from "../config";
|
|
3
|
+
type AuthTarget = ReturnType<typeof authTargets>[number];
|
|
1
4
|
type AuthListFormat = "plain" | "markdown" | "json";
|
|
5
|
+
export type AuthStatusRow = {
|
|
6
|
+
server: string;
|
|
7
|
+
status: "missing" | "expired" | "authenticated";
|
|
8
|
+
expiresAt?: string;
|
|
9
|
+
scope?: string;
|
|
10
|
+
};
|
|
2
11
|
export declare function loginAuth(serverId: string, options: {
|
|
3
12
|
configPath?: string;
|
|
4
13
|
noOpen: boolean;
|
|
@@ -11,10 +20,25 @@ export declare function logoutAuth(serverId: string, options: {
|
|
|
11
20
|
configPath?: string;
|
|
12
21
|
writeOut: (value: string) => void;
|
|
13
22
|
}): void;
|
|
23
|
+
export declare function logoutAuthResult(serverId: string, options: {
|
|
24
|
+
authDir?: string;
|
|
25
|
+
configPath?: string;
|
|
26
|
+
}): {
|
|
27
|
+
server: string;
|
|
28
|
+
deleted: boolean;
|
|
29
|
+
};
|
|
14
30
|
export declare function listAuth(options: {
|
|
15
31
|
authDir?: string;
|
|
16
32
|
configPath?: string;
|
|
17
33
|
writeOut: (value: string) => void;
|
|
18
34
|
format?: AuthListFormat;
|
|
19
35
|
}): void;
|
|
36
|
+
export declare function listAuthRows(options: {
|
|
37
|
+
authDir?: string;
|
|
38
|
+
configPath?: string;
|
|
39
|
+
}): AuthStatusRow[];
|
|
40
|
+
export declare function formatAuthRows(rows: AuthStatusRow[], format: Exclude<AuthListFormat, "json">): string;
|
|
41
|
+
export declare function findAuthTarget(serverId: string, config?: import("../config").CapletsConfig): AuthTarget | undefined;
|
|
42
|
+
declare function authTargets(config: ReturnType<typeof loadConfig>): (import("../config").CapletServerConfig | import("../config").OpenApiEndpointConfig | (GraphQlEndpointConfig & GenericAuthTarget) | (HttpApiConfig & GenericAuthTarget))[];
|
|
43
|
+
export declare function assertLoginTarget(target: AuthTarget | undefined, serverId: string): asserts target is AuthTarget;
|
|
20
44
|
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export declare const completionShells: readonly ["bash", "zsh", "fish", "powershell", "cmd"];
|
|
2
|
+
export type CompletionShell = (typeof completionShells)[number];
|
|
3
|
+
export declare const cliCommands: {
|
|
4
|
+
readonly completion: "completion";
|
|
5
|
+
readonly completeHidden: "__complete";
|
|
6
|
+
readonly serve: "serve";
|
|
7
|
+
readonly init: "init";
|
|
8
|
+
readonly list: "list";
|
|
9
|
+
readonly install: "install";
|
|
10
|
+
readonly add: "add";
|
|
11
|
+
readonly getCaplet: "get-caplet";
|
|
12
|
+
readonly checkBackend: "check-backend";
|
|
13
|
+
readonly listTools: "list-tools";
|
|
14
|
+
readonly searchTools: "search-tools";
|
|
15
|
+
readonly getTool: "get-tool";
|
|
16
|
+
readonly callTool: "call-tool";
|
|
17
|
+
readonly listResources: "list-resources";
|
|
18
|
+
readonly searchResources: "search-resources";
|
|
19
|
+
readonly listResourceTemplates: "list-resource-templates";
|
|
20
|
+
readonly readResource: "read-resource";
|
|
21
|
+
readonly listPrompts: "list-prompts";
|
|
22
|
+
readonly searchPrompts: "search-prompts";
|
|
23
|
+
readonly getPrompt: "get-prompt";
|
|
24
|
+
readonly complete: "complete";
|
|
25
|
+
readonly config: "config";
|
|
26
|
+
readonly auth: "auth";
|
|
27
|
+
};
|
|
28
|
+
export declare const topLevelCommandNames: readonly ["serve", "init", "list", "install", "add", "get-caplet", "check-backend", "list-tools", "search-tools", "get-tool", "call-tool", "list-resources", "search-resources", "list-resource-templates", "read-resource", "list-prompts", "search-prompts", "get-prompt", "complete", "config", "auth", "completion"];
|
|
29
|
+
export declare const cliSubcommands: {
|
|
30
|
+
readonly add: readonly ["cli", "mcp", "openapi", "graphql", "http"];
|
|
31
|
+
readonly auth: readonly ["login", "logout", "list"];
|
|
32
|
+
readonly completion: readonly ["bash", "zsh", "fish", "powershell", "cmd"];
|
|
33
|
+
readonly config: readonly ["path", "paths"];
|
|
34
|
+
};
|
|
35
|
+
export declare const capletIdCommands: Set<string>;
|
|
36
|
+
export declare const qualifiedToolCommands: Set<string>;
|
|
37
|
+
export declare const qualifiedPromptCommands: Set<string>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export type CompletionDiscoveryKind = "tools" | "prompts" | "resources" | "resourceTemplates";
|
|
2
|
+
export type CompletionCandidate = {
|
|
3
|
+
value: string;
|
|
4
|
+
label?: string | undefined;
|
|
5
|
+
description?: string | undefined;
|
|
6
|
+
};
|
|
7
|
+
export type CompletionCacheKeyInput = {
|
|
8
|
+
server: string;
|
|
9
|
+
backend: string;
|
|
10
|
+
kind: CompletionDiscoveryKind;
|
|
11
|
+
fingerprint: string;
|
|
12
|
+
};
|
|
13
|
+
export type CompletionCacheEntry = {
|
|
14
|
+
status: "positive";
|
|
15
|
+
fetchedAt: number;
|
|
16
|
+
expiresAt: number;
|
|
17
|
+
candidates: CompletionCandidate[];
|
|
18
|
+
} | {
|
|
19
|
+
status: "negative";
|
|
20
|
+
fetchedAt: number;
|
|
21
|
+
expiresAt: number;
|
|
22
|
+
reason: "auth_required" | "timeout" | "unavailable" | "unsupported" | "error";
|
|
23
|
+
candidates?: CompletionCandidate[];
|
|
24
|
+
};
|
|
25
|
+
export type ReadCompletionCacheEntry = CompletionCacheEntry & {
|
|
26
|
+
fresh: boolean;
|
|
27
|
+
};
|
|
28
|
+
export declare function completionCacheKey(input: CompletionCacheKeyInput): string;
|
|
29
|
+
export declare function readCompletionCacheEntry(cacheDir: string, key: string, now?: number): ReadCompletionCacheEntry | undefined;
|
|
30
|
+
export declare function writeCompletionCacheEntry(cacheDir: string, key: string, entry: CompletionCacheEntry): void;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type CapletConfig, type CapletsConfig, type CompletionConfig } from "../config";
|
|
2
|
+
import { type CompletionCandidate, type CompletionDiscoveryKind } from "./completion-cache";
|
|
3
|
+
export type CompletionDiscoveryManagers = {
|
|
4
|
+
listTools?: (server: CapletConfig) => Promise<Array<{
|
|
5
|
+
name: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
}>>;
|
|
8
|
+
listPrompts?: (server: CapletConfig) => Promise<Array<{
|
|
9
|
+
name: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
}>>;
|
|
12
|
+
listResources?: (server: CapletConfig) => Promise<Array<{
|
|
13
|
+
uri: string;
|
|
14
|
+
name?: string;
|
|
15
|
+
description?: string;
|
|
16
|
+
}>>;
|
|
17
|
+
listResourceTemplates?: (server: CapletConfig) => Promise<Array<{
|
|
18
|
+
uriTemplate: string;
|
|
19
|
+
name?: string;
|
|
20
|
+
description?: string;
|
|
21
|
+
}>>;
|
|
22
|
+
};
|
|
23
|
+
export type CompletionDiscoveryOptions = {
|
|
24
|
+
config: CapletsConfig;
|
|
25
|
+
completion?: CompletionConfig | undefined;
|
|
26
|
+
cacheDir?: string | undefined;
|
|
27
|
+
managers?: CompletionDiscoveryManagers | undefined;
|
|
28
|
+
now?: number | undefined;
|
|
29
|
+
};
|
|
30
|
+
export declare function discoverCompletionCandidates(serverId: string, kind: CompletionDiscoveryKind, options: CompletionDiscoveryOptions): Promise<CompletionCandidate[]>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type CapletsConfig, type CompletionConfig } from "../config";
|
|
2
|
+
import { type CompletionShell } from "./commands";
|
|
3
|
+
import { type CompletionDiscoveryManagers } from "./completion-discovery";
|
|
4
|
+
export { completionShells, type CompletionShell } from "./commands";
|
|
5
|
+
export declare const trailingSpaceCompletionToken = "__CAPLETS_TRAILING_SPACE__";
|
|
6
|
+
export type CompletionOptions = {
|
|
7
|
+
configPath?: string;
|
|
8
|
+
projectConfigPath?: string;
|
|
9
|
+
config?: CapletsConfig;
|
|
10
|
+
completion?: CompletionConfig;
|
|
11
|
+
cacheDir?: string;
|
|
12
|
+
managers?: CompletionDiscoveryManagers;
|
|
13
|
+
};
|
|
14
|
+
export declare function completionScript(shell: CompletionShell): string;
|
|
15
|
+
export declare function completeCliWords(words: string[], options?: CompletionOptions): Promise<string[]>;
|
package/dist/cli.d.ts
CHANGED
|
@@ -6,6 +6,8 @@ export { addCliCaplet, addGraphqlCaplet, addHttpCaplet, addMcpCaplet, addOpenApi
|
|
|
6
6
|
type CliIO = {
|
|
7
7
|
writeOut?: (value: string) => void;
|
|
8
8
|
writeErr?: (value: string) => void;
|
|
9
|
+
env?: NodeJS.ProcessEnv | Record<string, string | undefined>;
|
|
10
|
+
fetch?: typeof fetch;
|
|
9
11
|
authDir?: string;
|
|
10
12
|
version?: string;
|
|
11
13
|
setExitCode?: (code: number) => void;
|