@botconnector/bccli 0.4.16 → 0.5.0-rc.4
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/LICENSE +203 -21
- package/THIRD_PARTY_NOTICES.md +9 -0
- package/branding.mjs +347 -0
- package/cli.mjs +120 -0
- package/core.mjs +260 -0
- package/credentials.mjs +52 -0
- package/gateway.mjs +2 -0
- package/model-command.mjs +61 -0
- package/package.json +35 -59
- package/provider-cli.mjs +77 -0
- package/providers.mjs +166 -0
- package/proxy.mjs +242 -0
- package/startup-menu.mjs +120 -0
- package/README.en.md +0 -253
- package/README.md +0 -250
- package/dist/abort.d.ts +0 -5
- package/dist/acp-JZW3XHE5.js +0 -221
- package/dist/acp.d.ts +0 -44
- package/dist/agent.d.ts +0 -147
- package/dist/agents.d.ts +0 -4
- package/dist/args-XVO7TB4C.js +0 -13
- package/dist/args.d.ts +0 -59
- package/dist/budget.d.ts +0 -26
- package/dist/checkpoints.d.ts +0 -35
- package/dist/chunk-3CYQYHPK.js +0 -202
- package/dist/chunk-6JK4IBGK.js +0 -1075
- package/dist/chunk-6SDRWEPN.js +0 -50
- package/dist/chunk-7GM6NN5E.js +0 -341
- package/dist/chunk-7XD47KN5.js +0 -71
- package/dist/chunk-INMSTUB2.js +0 -56
- package/dist/chunk-ISOKH5WB.js +0 -256
- package/dist/chunk-JUC3ZOCV.js +0 -50
- package/dist/chunk-KDVL2NP6.js +0 -861
- package/dist/chunk-KEKDRROL.js +0 -216
- package/dist/chunk-KJIXA6MP.js +0 -159
- package/dist/chunk-OK2USAXX.js +0 -88
- package/dist/chunk-PSO7R5AD.js +0 -10
- package/dist/chunk-Q42ZGVAQ.js +0 -91
- package/dist/chunk-R754XIBJ.js +0 -523
- package/dist/chunk-S3QEZDKB.js +0 -270
- package/dist/chunk-SWNRA3EW.js +0 -78
- package/dist/chunk-TLCL6DC7.js +0 -378
- package/dist/chunk-V5D6PJQN.js +0 -8
- package/dist/chunk-YYTFJUO2.js +0 -148
- package/dist/chunk-ZJRZTMJF.js +0 -2669
- package/dist/cli.d.ts +0 -1
- package/dist/cli.js +0 -233
- package/dist/clipboardImage.d.ts +0 -17
- package/dist/commands.d.ts +0 -16
- package/dist/completion-Q7VHOPPV.js +0 -125
- package/dist/completion.d.ts +0 -14
- package/dist/config-T7MKGJVG.js +0 -34
- package/dist/config-YYEAEN2C.js +0 -25
- package/dist/config.d.ts +0 -99
- package/dist/context.d.ts +0 -13
- package/dist/contextWindow.d.ts +0 -3
- package/dist/diff.d.ts +0 -7
- package/dist/exit.d.ts +0 -9
- package/dist/extensions.d.ts +0 -34
- package/dist/ghBotCli-7VUGI63S.js +0 -680
- package/dist/ghBotCli.d.ts +0 -9
- package/dist/ghBotDispatch.d.ts +0 -68
- package/dist/ghBotRunner.d.ts +0 -82
- package/dist/ghBotServe.d.ts +0 -21
- package/dist/ghBotWebhook.d.ts +0 -45
- package/dist/hooks.d.ts +0 -27
- package/dist/i18n/id.d.ts +0 -1
- package/dist/i18n.d.ts +0 -16
- package/dist/integrationCli-FBRSTF5F.js +0 -876
- package/dist/integrationCli.d.ts +0 -9
- package/dist/keybinds.d.ts +0 -22
- package/dist/login-BSMUGW7L.js +0 -18
- package/dist/login.d.ts +0 -21
- package/dist/lsp.d.ts +0 -73
- package/dist/mcp/catalog.d.ts +0 -14
- package/dist/mcp/config.d.ts +0 -36
- package/dist/mcp/manager.d.ts +0 -52
- package/dist/mcp/oauth.d.ts +0 -82
- package/dist/mcpCli-ZT7CRYMP.js +0 -113
- package/dist/mcpCli.d.ts +0 -3
- package/dist/mcpServer/serve.d.ts +0 -8
- package/dist/mcpServer/server.d.ts +0 -19
- package/dist/models.d.ts +0 -13
- package/dist/modelsCli-2ZRW4CC4.js +0 -36
- package/dist/modelsCli.d.ts +0 -15
- package/dist/npmRunner-LU43GM3W.js +0 -46
- package/dist/npmRunner.d.ts +0 -21
- package/dist/oauthLogin-THSM6FE7.js +0 -210
- package/dist/oauthLogin.d.ts +0 -47
- package/dist/permissions.d.ts +0 -30
- package/dist/pluginSpec.d.ts +0 -25
- package/dist/plugins.d.ts +0 -45
- package/dist/pluginsCli-EKQI4CJW.js +0 -288
- package/dist/pluginsCli.d.ts +0 -16
- package/dist/prCli-FMQTOBIV.js +0 -94
- package/dist/prCli.d.ts +0 -46
- package/dist/presets.d.ts +0 -8
- package/dist/print.d.ts +0 -17
- package/dist/provider.d.ts +0 -145
- package/dist/providerCli-3TFEKV4C.js +0 -15
- package/dist/providerCli.d.ts +0 -17
- package/dist/providers.d.ts +0 -6
- package/dist/reasoning.d.ts +0 -12
- package/dist/repomap.d.ts +0 -10
- package/dist/sdk.d.ts +0 -61
- package/dist/sdk.js +0 -6494
- package/dist/serve-3BODPEPR.js +0 -532
- package/dist/serve-V6YVZTNR.js +0 -178
- package/dist/serve.d.ts +0 -37
- package/dist/serveHeartbeat.d.ts +0 -14
- package/dist/serveProtocol.d.ts +0 -47
- package/dist/session-LX4UNPCD.js +0 -12
- package/dist/session.d.ts +0 -33
- package/dist/setup-MFG3BWEU.js +0 -24
- package/dist/setup.d.ts +0 -79
- package/dist/slash/copy.d.ts +0 -1
- package/dist/slash/diff.d.ts +0 -1
- package/dist/slash/doctor.d.ts +0 -18
- package/dist/slash/export.d.ts +0 -2
- package/dist/slash/info.d.ts +0 -46
- package/dist/slash/memory.d.ts +0 -10
- package/dist/statsCli-7MIQHLVW.js +0 -353
- package/dist/statsCli.d.ts +0 -62
- package/dist/textToolCalls.d.ts +0 -6
- package/dist/thinking.d.ts +0 -17
- package/dist/tokenBudget.d.ts +0 -22
- package/dist/tools/bash.d.ts +0 -54
- package/dist/tools/diagnostics.d.ts +0 -13
- package/dist/tools/edit.d.ts +0 -12
- package/dist/tools/fetch.d.ts +0 -41
- package/dist/tools/glob.d.ts +0 -5
- package/dist/tools/globSafety.d.ts +0 -7
- package/dist/tools/grep.d.ts +0 -25
- package/dist/tools/ignore.d.ts +0 -2
- package/dist/tools/index.d.ts +0 -12
- package/dist/tools/memory.d.ts +0 -13
- package/dist/tools/paths.d.ts +0 -4
- package/dist/tools/plan.d.ts +0 -10
- package/dist/tools/read.d.ts +0 -16
- package/dist/tools/repomap.d.ts +0 -2
- package/dist/tools/sandbox.d.ts +0 -15
- package/dist/tools/shell.d.ts +0 -18
- package/dist/tools/skill.d.ts +0 -3
- package/dist/tools/task.d.ts +0 -28
- package/dist/tools/todo.d.ts +0 -13
- package/dist/tools/types.d.ts +0 -52
- package/dist/tools/websearch.d.ts +0 -9
- package/dist/tools/write.d.ts +0 -5
- package/dist/transferCli-SRSYQLSJ.js +0 -73
- package/dist/transferCli.d.ts +0 -23
- package/dist/ui/App.d.ts +0 -7
- package/dist/ui/DiffView.d.ts +0 -3
- package/dist/ui/EditableText.d.ts +0 -7
- package/dist/ui/LinePrompt.d.ts +0 -6
- package/dist/ui/ListPicker.d.ts +0 -11
- package/dist/ui/Markdown.d.ts +0 -8
- package/dist/ui/McpMenu.d.ts +0 -11
- package/dist/ui/ModelPicker.d.ts +0 -6
- package/dist/ui/PermissionPrompt.d.ts +0 -5
- package/dist/ui/PlanApproval.d.ts +0 -5
- package/dist/ui/PromptInput.d.ts +0 -20
- package/dist/ui/ProviderMenu.d.ts +0 -10
- package/dist/ui/Spinner.d.ts +0 -4
- package/dist/ui/StatusBar.d.ts +0 -9
- package/dist/ui/TodoList.d.ts +0 -4
- package/dist/ui/ToolBlock.d.ts +0 -14
- package/dist/ui/complete.d.ts +0 -8
- package/dist/ui/index.d.ts +0 -7
- package/dist/ui/lineEdit.d.ts +0 -42
- package/dist/ui/liveCap.d.ts +0 -9
- package/dist/ui/replay.d.ts +0 -4
- package/dist/ui/stdinFilter.d.ts +0 -18
- package/dist/ui/table.d.ts +0 -20
- package/dist/ui/theme.d.ts +0 -5
- package/dist/ui/thinkingMouse.d.ts +0 -38
- package/dist/ui/transcript.d.ts +0 -55
- package/dist/ui/tty.d.ts +0 -11
- package/dist/ui/vim.d.ts +0 -26
- package/dist/ui-LZ4JGF2V.js +0 -2913
- package/dist/update-P7MU4ZM7.js +0 -145
- package/dist/update.d.ts +0 -30
- package/dist/verify.d.ts +0 -16
- package/dist/version.d.ts +0 -1
- package/dist/webBudget.d.ts +0 -25
- package/dist/worktree.d.ts +0 -12
package/dist/integrationCli.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { CliArgs } from './args';
|
|
2
|
-
export interface IntegrationDeps {
|
|
3
|
-
env: NodeJS.ProcessEnv;
|
|
4
|
-
cwd: string;
|
|
5
|
-
out: (s: string) => void;
|
|
6
|
-
err: (s: string) => void;
|
|
7
|
-
fetch: typeof globalThis.fetch;
|
|
8
|
-
}
|
|
9
|
-
export declare function runIntegrationCommand(args: CliArgs, deps: IntegrationDeps): Promise<number>;
|
package/dist/keybinds.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export type KeybindAction = 'thinking' | 'toolOutput' | 'pasteImage';
|
|
2
|
-
export declare const KEYBIND_ACTIONS: KeybindAction[];
|
|
3
|
-
export declare const DEFAULT_KEYBINDS: Record<KeybindAction, string>;
|
|
4
|
-
export declare function defaultKeybinds(): Record<KeybindAction, Keybind>;
|
|
5
|
-
export interface Keybind {
|
|
6
|
-
/** The normalized spec, for display in notices and /help. */
|
|
7
|
-
spec: string;
|
|
8
|
-
ctrl: boolean;
|
|
9
|
-
meta: boolean;
|
|
10
|
-
/** Lowercase single letter. */
|
|
11
|
-
key: string;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Parses "ctrl+t" / "alt+x" / "ctrl+alt+o". A modifier is required: a bare letter
|
|
15
|
-
* would fire while the user types. Returns undefined for anything else so the
|
|
16
|
-
* caller can produce a localized ConfigError.
|
|
17
|
-
*/
|
|
18
|
-
export declare function parseKeybind(raw: string): Keybind | undefined;
|
|
19
|
-
export declare function matchKeybind(kb: Keybind, input: string, key: {
|
|
20
|
-
ctrl?: boolean;
|
|
21
|
-
meta?: boolean;
|
|
22
|
-
}): boolean;
|
package/dist/login-BSMUGW7L.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
defaultLoginDeps,
|
|
4
|
-
echoFor,
|
|
5
|
-
readLine,
|
|
6
|
-
readSecret,
|
|
7
|
-
runLogin
|
|
8
|
-
} from "./chunk-KJIXA6MP.js";
|
|
9
|
-
import "./chunk-3CYQYHPK.js";
|
|
10
|
-
import "./chunk-TLCL6DC7.js";
|
|
11
|
-
import "./chunk-R754XIBJ.js";
|
|
12
|
-
export {
|
|
13
|
-
defaultLoginDeps,
|
|
14
|
-
echoFor,
|
|
15
|
-
readLine,
|
|
16
|
-
readSecret,
|
|
17
|
-
runLogin
|
|
18
|
-
};
|
package/dist/login.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export declare function readSecret(prompt: string): Promise<string>;
|
|
2
|
-
/** What readLine writes back to the terminal: printable input is visible, control keys are not. */
|
|
3
|
-
export declare function echoFor(ch: string): string | undefined;
|
|
4
|
-
/** Prompt TANPA masking (kode otorisasi harus terlihat saat di-paste). Ctrl+C -> exit 130. */
|
|
5
|
-
export declare function readLine(prompt: string): Promise<string>;
|
|
6
|
-
import type { CliArgs } from './args';
|
|
7
|
-
import type { ABORT } from './oauthLogin';
|
|
8
|
-
export interface LoginDeps {
|
|
9
|
-
out(s: string): void;
|
|
10
|
-
err(s: string): void;
|
|
11
|
-
env: NodeJS.ProcessEnv;
|
|
12
|
-
isTTY: boolean;
|
|
13
|
-
open(url: string): void;
|
|
14
|
-
readLine(prompt: string): Promise<string | typeof ABORT>;
|
|
15
|
-
saveCredential(id: string, key: string): void;
|
|
16
|
-
removeCredential(id: string): boolean;
|
|
17
|
-
fetch: typeof fetch;
|
|
18
|
-
legacyAdd(providerId: string, cwd: string): Promise<number>;
|
|
19
|
-
}
|
|
20
|
-
export declare function defaultLoginDeps(): LoginDeps;
|
|
21
|
-
export declare function runLogin(providerId: string, cwd: string, args: CliArgs, deps: LoginDeps): Promise<number>;
|
package/dist/lsp.d.ts
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
export declare function languageIdFor(file: string): string;
|
|
2
|
-
export declare function useShellForLsp(command: string, platform?: NodeJS.Platform): boolean;
|
|
3
|
-
export interface LspServer {
|
|
4
|
-
extensions: string[];
|
|
5
|
-
command: string;
|
|
6
|
-
args?: string[];
|
|
7
|
-
}
|
|
8
|
-
export interface LspDiagnostic {
|
|
9
|
-
line: number;
|
|
10
|
-
character: number;
|
|
11
|
-
severity: number;
|
|
12
|
-
message: string;
|
|
13
|
-
}
|
|
14
|
-
export interface LspLocation {
|
|
15
|
-
uri: string;
|
|
16
|
-
path: string;
|
|
17
|
-
line: number;
|
|
18
|
-
character: number;
|
|
19
|
-
}
|
|
20
|
-
export interface WarmLspClient {
|
|
21
|
-
diagnostics(file: string, timeoutMs?: number): Promise<LspDiagnostic[]>;
|
|
22
|
-
hover(file: string, line: number, character: number, timeoutMs?: number): Promise<string>;
|
|
23
|
-
definition(file: string, line: number, character: number, timeoutMs?: number): Promise<LspLocation[]>;
|
|
24
|
-
references(file: string, line: number, character: number, timeoutMs?: number): Promise<LspLocation[]>;
|
|
25
|
-
close(): Promise<void>;
|
|
26
|
-
}
|
|
27
|
-
interface LspRawDiagnostic {
|
|
28
|
-
range?: {
|
|
29
|
-
start?: {
|
|
30
|
-
line?: number;
|
|
31
|
-
character?: number;
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
severity?: number;
|
|
35
|
-
message?: string;
|
|
36
|
-
}
|
|
37
|
-
/** The JSON-RPC messages this one-shot client cares about. */
|
|
38
|
-
export interface LspMessage {
|
|
39
|
-
id?: number;
|
|
40
|
-
method?: string;
|
|
41
|
-
result?: unknown;
|
|
42
|
-
params?: {
|
|
43
|
-
uri?: string;
|
|
44
|
-
diagnostics?: LspRawDiagnostic[];
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
export declare function encodeLsp(msg: unknown): Buffer;
|
|
48
|
-
/** Content-Length framed JSON-RPC reader; survives messages split across chunks. */
|
|
49
|
-
export declare function createLspParser(onMessage: (msg: LspMessage) => void): {
|
|
50
|
-
push(chunk: Buffer): void;
|
|
51
|
-
};
|
|
52
|
-
/**
|
|
53
|
-
* Open one file with one LSP server, wait for its first publishDiagnostics (or the timeout),
|
|
54
|
-
* then shut it down. A one-shot client on purpose: no long-lived servers to manage yet.
|
|
55
|
-
*/
|
|
56
|
-
export declare function getDiagnostics(opts: {
|
|
57
|
-
server: LspServer;
|
|
58
|
-
cwd: string;
|
|
59
|
-
file: string;
|
|
60
|
-
timeoutMs?: number;
|
|
61
|
-
signal?: AbortSignal;
|
|
62
|
-
}): Promise<LspDiagnostic[]>;
|
|
63
|
-
/**
|
|
64
|
-
* Persistent warm LSP client: spawns the language server once, sends `didOpen` on first
|
|
65
|
-
* touch of a file and `didChange` on subsequent touches, and serves `diagnostics`,
|
|
66
|
-
* `hover`, `definition`, and `references` over the same warm process.
|
|
67
|
-
*/
|
|
68
|
-
export declare function createWarmLspClient(opts: {
|
|
69
|
-
server: LspServer;
|
|
70
|
-
cwd: string;
|
|
71
|
-
timeoutMs?: number;
|
|
72
|
-
}): WarmLspClient;
|
|
73
|
-
export {};
|
package/dist/mcp/catalog.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { McpServerConfig } from './config';
|
|
2
|
-
export interface CatalogInput {
|
|
3
|
-
key: string;
|
|
4
|
-
label: string;
|
|
5
|
-
secret?: boolean;
|
|
6
|
-
}
|
|
7
|
-
export interface CatalogEntry {
|
|
8
|
-
name: string;
|
|
9
|
-
description: string;
|
|
10
|
-
config: McpServerConfig;
|
|
11
|
-
inputs?: CatalogInput[];
|
|
12
|
-
}
|
|
13
|
-
export declare const CATALOG: CatalogEntry[];
|
|
14
|
-
export declare function fillTemplate(config: McpServerConfig, values: Record<string, string>): McpServerConfig;
|
package/dist/mcp/config.d.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
export type McpServerConfig = {
|
|
2
|
-
type?: 'stdio';
|
|
3
|
-
command: string;
|
|
4
|
-
args?: string[];
|
|
5
|
-
env?: Record<string, string>;
|
|
6
|
-
} | {
|
|
7
|
-
type: 'http';
|
|
8
|
-
url: string;
|
|
9
|
-
headers?: Record<string, string>;
|
|
10
|
-
auth?: 'oauth';
|
|
11
|
-
};
|
|
12
|
-
export interface McpServerSpec {
|
|
13
|
-
name: string;
|
|
14
|
-
config: McpServerConfig;
|
|
15
|
-
source: 'global' | 'project';
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Claude Code-style environment expansion at connect time: ${VAR} reads from the
|
|
19
|
-
* parent environment, ${VAR:-default} falls back when unset, and an unset variable
|
|
20
|
-
* without a default stays literal. This lets a server pull a secret from the parent
|
|
21
|
-
* env ("API_KEY": "${MY_KEY}") without pasting the value into mcp.json, while the
|
|
22
|
-
* stdio child still only receives the whitelist plus the resolved config env.
|
|
23
|
-
*/
|
|
24
|
-
export declare function expandEnvVars(config: McpServerConfig, env: NodeJS.ProcessEnv): McpServerConfig;
|
|
25
|
-
export declare const globalMcpPath: (home: string) => string;
|
|
26
|
-
export declare const projectMcpPath: (cwd: string) => string;
|
|
27
|
-
export declare function readMcpFile(path: string): Record<string, McpServerConfig>;
|
|
28
|
-
export declare function addGlobalServer(home: string, name: string, config: McpServerConfig): void;
|
|
29
|
-
export declare function removeGlobalServer(home: string, name: string): void;
|
|
30
|
-
export declare function projectTrust(home: string, cwd: string, name: string, config: McpServerConfig): boolean | undefined;
|
|
31
|
-
export declare function setProjectTrust(home: string, cwd: string, name: string, allowed: boolean, config: McpServerConfig): void;
|
|
32
|
-
/** Global servers always; project servers only after a recorded yes. A project server never shadows a global one. */
|
|
33
|
-
export declare function serversToStart(home: string, cwd: string): {
|
|
34
|
-
start: McpServerSpec[];
|
|
35
|
-
needTrust: McpServerSpec[];
|
|
36
|
-
};
|
package/dist/mcp/manager.d.ts
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import type { Tool } from '../tools/types';
|
|
2
|
-
import type { McpServerSpec } from './config';
|
|
3
|
-
export interface McpContentItem {
|
|
4
|
-
type: string;
|
|
5
|
-
text?: string;
|
|
6
|
-
data?: string;
|
|
7
|
-
mimeType?: string;
|
|
8
|
-
resource?: {
|
|
9
|
-
uri?: string;
|
|
10
|
-
text?: string;
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
export declare function formatMcpContent(content: McpContentItem[] | undefined): {
|
|
14
|
-
output: string;
|
|
15
|
-
images?: {
|
|
16
|
-
mediaType: string;
|
|
17
|
-
data: string;
|
|
18
|
-
path: string;
|
|
19
|
-
}[];
|
|
20
|
-
};
|
|
21
|
-
/** Safe env for spawned MCP servers: whitelist from the parent + the server's own config.env. */
|
|
22
|
-
export declare function mcpChildEnv(extra?: Record<string, string>): Record<string, string>;
|
|
23
|
-
export interface McpServerState {
|
|
24
|
-
name: string;
|
|
25
|
-
source: 'global' | 'project';
|
|
26
|
-
status: 'starting' | 'ready' | 'error';
|
|
27
|
-
error?: string;
|
|
28
|
-
tools: number;
|
|
29
|
-
}
|
|
30
|
-
/** OpenAI function names: [A-Za-z0-9_-], max 64 chars, unique. */
|
|
31
|
-
export declare function mcpToolName(server: string, tool: string, taken: Set<string>): string;
|
|
32
|
-
export declare class McpManager {
|
|
33
|
-
private readonly opts;
|
|
34
|
-
private readonly servers;
|
|
35
|
-
private readonly taken;
|
|
36
|
-
constructor(opts?: {
|
|
37
|
-
connectTimeoutMs?: number;
|
|
38
|
-
onChange?: () => void;
|
|
39
|
-
onToolsRemoved?: (names: string[]) => void;
|
|
40
|
-
/** Config home for the OAuth token store; enables authProvider on http servers. */
|
|
41
|
-
home?: string;
|
|
42
|
-
/** Overrides how the OAuth consent page is opened (tests inject a fake browser). */
|
|
43
|
-
open?: (url: URL) => void | Promise<void>;
|
|
44
|
-
});
|
|
45
|
-
start(specs: McpServerSpec[]): Promise<void>;
|
|
46
|
-
add(spec: McpServerSpec): Promise<void>;
|
|
47
|
-
private wrap;
|
|
48
|
-
remove(name: string): Promise<void>;
|
|
49
|
-
tools(): Tool[];
|
|
50
|
-
states(): McpServerState[];
|
|
51
|
-
stop(): Promise<void>;
|
|
52
|
-
}
|
package/dist/mcp/oauth.d.ts
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { spawn } from 'node:child_process';
|
|
2
|
-
import { type OAuthClientProvider, type OAuthDiscoveryState } from '@modelcontextprotocol/sdk/client/auth.js';
|
|
3
|
-
import type { OAuthClientInformationMixed, OAuthClientMetadata, OAuthTokens } from '@modelcontextprotocol/sdk/shared/auth.js';
|
|
4
|
-
import type { FetchLike } from '@modelcontextprotocol/sdk/shared/transport.js';
|
|
5
|
-
import type { McpServerConfig } from './config';
|
|
6
|
-
export interface OAuthStorage {
|
|
7
|
-
client?: OAuthClientInformationMixed;
|
|
8
|
-
tokens?: OAuthTokens;
|
|
9
|
-
codeVerifier?: string;
|
|
10
|
-
discovery?: OAuthDiscoveryState;
|
|
11
|
-
}
|
|
12
|
-
export type OAuthStore = Record<string, OAuthStorage>;
|
|
13
|
-
export declare const oauthStorePath: (home: string) => string;
|
|
14
|
-
export declare function hasStoredTokens(home: string, serverUrl: string): boolean;
|
|
15
|
-
export declare function clearTokens(home: string, serverUrl: string): boolean;
|
|
16
|
-
/**
|
|
17
|
-
* The browser is opened through a direct argv hand-off: on Windows `cmd /c start` re-parses
|
|
18
|
-
* its own command line, so an authorization URL from the MCP server could smuggle a second
|
|
19
|
-
* command with `&`. rundll32 plus `shell: false` never gives the URL to a shell, and only
|
|
20
|
-
* http(s) is ever opened (no `file:`/custom protocol handlers).
|
|
21
|
-
*/
|
|
22
|
-
export declare function openCommand(url: URL, platform: NodeJS.Platform): {
|
|
23
|
-
command: string;
|
|
24
|
-
args: string[];
|
|
25
|
-
} | undefined;
|
|
26
|
-
/** Opens a URL in the user's browser (best effort; callers should also print the URL). */
|
|
27
|
-
export declare function defaultOpen(url: URL, deps?: {
|
|
28
|
-
platform?: NodeJS.Platform;
|
|
29
|
-
spawn?: typeof spawn;
|
|
30
|
-
}): void;
|
|
31
|
-
export interface FileOAuthProviderOptions {
|
|
32
|
-
home: string;
|
|
33
|
-
serverUrl: string;
|
|
34
|
-
redirectUrl?: string | URL;
|
|
35
|
-
open?: (url: URL) => void | Promise<void>;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* File-backed OAuthClientProvider: client registration, tokens, PKCE verifier and
|
|
39
|
-
* discovery state per MCP server URL, stored in ~/.bccli/mcp-oauth.json (mode 600).
|
|
40
|
-
*/
|
|
41
|
-
export declare class FileOAuthProvider implements OAuthClientProvider {
|
|
42
|
-
private readonly opts;
|
|
43
|
-
constructor(opts: FileOAuthProviderOptions);
|
|
44
|
-
/**
|
|
45
|
-
* Always defined: MCP SDK treats a missing redirectUrl as a non-interactive
|
|
46
|
-
* (client_credentials) flow and would try a token exchange without a code.
|
|
47
|
-
*/
|
|
48
|
-
get redirectUrl(): string | URL;
|
|
49
|
-
get clientMetadata(): OAuthClientMetadata;
|
|
50
|
-
private entry;
|
|
51
|
-
private patch;
|
|
52
|
-
clientInformation(): OAuthClientInformationMixed | undefined;
|
|
53
|
-
saveClientInformation(clientInformation: OAuthClientInformationMixed): void;
|
|
54
|
-
tokens(): OAuthTokens | undefined;
|
|
55
|
-
saveTokens(tokens: OAuthTokens): void;
|
|
56
|
-
saveCodeVerifier(codeVerifier: string): void;
|
|
57
|
-
codeVerifier(): string;
|
|
58
|
-
redirectToAuthorization(authorizationUrl: URL): void | Promise<void>;
|
|
59
|
-
saveDiscoveryState(state: OAuthDiscoveryState): void;
|
|
60
|
-
discoveryState(): OAuthDiscoveryState | undefined;
|
|
61
|
-
invalidateCredentials(scope: 'all' | 'client' | 'tokens' | 'verifier' | 'discovery'): void;
|
|
62
|
-
}
|
|
63
|
-
/** Parses the loopback callback URL; an OAuth error response throws. */
|
|
64
|
-
export declare function parseCallback(input: string | URL): {
|
|
65
|
-
code: string;
|
|
66
|
-
state?: string;
|
|
67
|
-
};
|
|
68
|
-
/**
|
|
69
|
-
* Runs the MCP OAuth 2.1 (PKCE) flow for one http server: starts a loopback callback
|
|
70
|
-
* server, hands the SDK auth() orchestrator the FileOAuthProvider, opens the browser,
|
|
71
|
-
* waits for the code, exchanges it, and stores the tokens. Throws on deny/failure.
|
|
72
|
-
*/
|
|
73
|
-
export declare function authorizeMcpServer(spec: {
|
|
74
|
-
name: string;
|
|
75
|
-
config: Extract<McpServerConfig, {
|
|
76
|
-
type?: 'http';
|
|
77
|
-
}>;
|
|
78
|
-
}, deps: {
|
|
79
|
-
home: string;
|
|
80
|
-
open?: (url: URL) => void | Promise<void>;
|
|
81
|
-
fetchFn?: FetchLike;
|
|
82
|
-
}): Promise<void>;
|
package/dist/mcpCli-ZT7CRYMP.js
DELETED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
CATALOG,
|
|
4
|
-
fillTemplate
|
|
5
|
-
} from "./chunk-JUC3ZOCV.js";
|
|
6
|
-
import {
|
|
7
|
-
authorizeMcpServer,
|
|
8
|
-
clearTokens
|
|
9
|
-
} from "./chunk-3CYQYHPK.js";
|
|
10
|
-
import {
|
|
11
|
-
addGlobalServer,
|
|
12
|
-
globalMcpPath,
|
|
13
|
-
readMcpFile,
|
|
14
|
-
removeGlobalServer
|
|
15
|
-
} from "./chunk-Q42ZGVAQ.js";
|
|
16
|
-
import {
|
|
17
|
-
bccliHome
|
|
18
|
-
} from "./chunk-TLCL6DC7.js";
|
|
19
|
-
import {
|
|
20
|
-
t
|
|
21
|
-
} from "./chunk-R754XIBJ.js";
|
|
22
|
-
|
|
23
|
-
// src/mcpCli.ts
|
|
24
|
-
async function runMcpCommand(args, deps) {
|
|
25
|
-
const home = bccliHome(deps.env);
|
|
26
|
-
const [action = "list", name] = args.subArgs;
|
|
27
|
-
if (action === "serve") {
|
|
28
|
-
const { runMcpServe } = await import("./serve-V6YVZTNR.js");
|
|
29
|
-
return runMcpServe(args, deps);
|
|
30
|
-
}
|
|
31
|
-
const installed = readMcpFile(globalMcpPath(home));
|
|
32
|
-
if (action === "list") {
|
|
33
|
-
for (const entry2 of CATALOG) deps.out(`${installed[entry2.name] ? "\u2713" : "\u25CB"} ${entry2.name.padEnd(12)} ${entry2.description}`);
|
|
34
|
-
for (const other of Object.keys(installed).filter((n) => !CATALOG.some((c) => c.name === n))) deps.out(`\u2713 ${other.padEnd(12)} (custom)`);
|
|
35
|
-
return 0;
|
|
36
|
-
}
|
|
37
|
-
if (!name) {
|
|
38
|
-
deps.err(t("Usage: bccli mcp {action} <name>", { action }));
|
|
39
|
-
return 1;
|
|
40
|
-
}
|
|
41
|
-
if (action === "remove") {
|
|
42
|
-
removeGlobalServer(home, name);
|
|
43
|
-
deps.out(t("{name} removed.", { name }));
|
|
44
|
-
return 0;
|
|
45
|
-
}
|
|
46
|
-
if (action === "auth" || action === "logout") {
|
|
47
|
-
const config = installed[name];
|
|
48
|
-
if (config?.type !== "http") {
|
|
49
|
-
deps.err(
|
|
50
|
-
t("{name} is not an installed HTTP MCP server. Add it first with: bccli mcp add {name} --url <url>", { name })
|
|
51
|
-
);
|
|
52
|
-
return 1;
|
|
53
|
-
}
|
|
54
|
-
if (action === "logout") {
|
|
55
|
-
const removed = clearTokens(home, config.url);
|
|
56
|
-
deps.out(removed ? t("{name} logged out.", { name }) : t("{name} has no stored OAuth tokens.", { name }));
|
|
57
|
-
return 0;
|
|
58
|
-
}
|
|
59
|
-
try {
|
|
60
|
-
await authorizeMcpServer({ name, config }, { home });
|
|
61
|
-
deps.out(t("{name} authorized. Active in the next bccli session.", { name }));
|
|
62
|
-
return 0;
|
|
63
|
-
} catch (error) {
|
|
64
|
-
deps.err(t("OAuth login failed for {name}: {reason}", { name, reason: error.message }));
|
|
65
|
-
return 1;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
if (action !== "add") {
|
|
69
|
-
deps.err(t("Unknown action: {action}. Use list, add, remove, auth, logout, or serve.", { action }));
|
|
70
|
-
return 1;
|
|
71
|
-
}
|
|
72
|
-
if (args.url) {
|
|
73
|
-
addGlobalServer(home, name, { type: "http", url: args.url });
|
|
74
|
-
deps.out(t("{name} installed ({url}).", { name, url: args.url }));
|
|
75
|
-
return 0;
|
|
76
|
-
}
|
|
77
|
-
if (args.stdioCommand) {
|
|
78
|
-
const env = Object.fromEntries(
|
|
79
|
-
args.values.filter((v) => v.includes("=")).map((v) => [v.slice(0, v.indexOf("=")), v.slice(v.indexOf("=") + 1)])
|
|
80
|
-
);
|
|
81
|
-
const serverArgs = (args.stdioArgs ?? "").split(/\s+/).filter(Boolean);
|
|
82
|
-
addGlobalServer(home, name, {
|
|
83
|
-
command: args.stdioCommand,
|
|
84
|
-
...serverArgs.length ? { args: serverArgs } : {},
|
|
85
|
-
...Object.keys(env).length ? { env } : {}
|
|
86
|
-
});
|
|
87
|
-
deps.out(t("{name} installed (stdio: {command}).", { name, command: args.stdioCommand }));
|
|
88
|
-
return 0;
|
|
89
|
-
}
|
|
90
|
-
const entry = CATALOG.find((c) => c.name === name);
|
|
91
|
-
if (!entry) {
|
|
92
|
-
deps.err(
|
|
93
|
-
t("{name} is not in the catalog. For another server use: bccli mcp add {name} --url <url> (HTTP) or bccli mcp add {name} --command <cmd> (stdio).", { name })
|
|
94
|
-
);
|
|
95
|
-
return 1;
|
|
96
|
-
}
|
|
97
|
-
const values = Object.fromEntries(args.values.map((v) => [v.slice(0, v.indexOf("=")), v.slice(v.indexOf("=") + 1)]));
|
|
98
|
-
for (const input of entry.inputs ?? []) {
|
|
99
|
-
if (!values[input.key] && input.secret) values[input.key] = await deps.readSecret(`${input.label}: `);
|
|
100
|
-
}
|
|
101
|
-
try {
|
|
102
|
-
addGlobalServer(home, name, fillTemplate(entry.config, values));
|
|
103
|
-
} catch (error) {
|
|
104
|
-
const hint = (entry.inputs ?? []).filter((i) => !i.secret).map((i) => `--value ${i.key}=\u2026`).join(" ");
|
|
105
|
-
deps.err(`${error.message}${hint ? `. Contoh: bccli mcp add ${name} ${hint}` : ""}`);
|
|
106
|
-
return 1;
|
|
107
|
-
}
|
|
108
|
-
deps.out(t("{name} installed. Active in the next bccli session.", { name }));
|
|
109
|
-
return 0;
|
|
110
|
-
}
|
|
111
|
-
export {
|
|
112
|
-
runMcpCommand
|
|
113
|
-
};
|
package/dist/mcpCli.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { Transport } from '@modelcontextprotocol/sdk/shared/transport.js';
|
|
2
|
-
import type { CliArgs } from '../args';
|
|
3
|
-
import type { CliDeps } from '../providerCli';
|
|
4
|
-
export interface McpServeDeps extends CliDeps {
|
|
5
|
-
/** Test seam: replaces the stdio transport (pass an InMemoryTransport half). */
|
|
6
|
-
transport?: Transport;
|
|
7
|
-
}
|
|
8
|
-
export declare function runMcpServe(args: CliArgs, deps: McpServeDeps): Promise<number>;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
-
import { type FetchToolOptions } from '../tools/fetch';
|
|
3
|
-
export interface McpServerDeps {
|
|
4
|
-
/** BotConnector API base, e.g. https://api.botconnector.id/v1 (no trailing slash). */
|
|
5
|
-
baseUrl: string;
|
|
6
|
-
/** Bearer key for paid endpoints (bc_chat); never logged or echoed. */
|
|
7
|
-
apiKey: string;
|
|
8
|
-
/** Default model id for bc_chat (provider prefix already stripped). */
|
|
9
|
-
defaultModel: string;
|
|
10
|
-
/** Injectable for tests; defaults to global fetch. */
|
|
11
|
-
fetchFn?: typeof fetch;
|
|
12
|
-
/** Injectable clock for the catalog cache; defaults to Date.now. */
|
|
13
|
-
now?: () => number;
|
|
14
|
-
/** Keenable endpoint for bc_search fallback; undefined = the public keyless endpoint. */
|
|
15
|
-
keenableURL?: string;
|
|
16
|
-
/** Passed to createFetchTool (DNS lookup / page fetch injection for tests). */
|
|
17
|
-
fetchTool?: FetchToolOptions;
|
|
18
|
-
}
|
|
19
|
-
export declare function createMcpServer(deps: McpServerDeps): McpServer;
|
package/dist/models.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { type Config } from './config';
|
|
2
|
-
export interface ModelGroup {
|
|
3
|
-
providerId: string;
|
|
4
|
-
providerName: string;
|
|
5
|
-
models: string[];
|
|
6
|
-
error?: string;
|
|
7
|
-
}
|
|
8
|
-
export declare function listAllModels(config: Config, env?: NodeJS.ProcessEnv, opts?: {
|
|
9
|
-
fetch?: typeof fetch;
|
|
10
|
-
timeoutMs?: number;
|
|
11
|
-
only?: string;
|
|
12
|
-
keyOverride?: string;
|
|
13
|
-
}): Promise<ModelGroup[]>;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
listAllModels
|
|
4
|
-
} from "./chunk-INMSTUB2.js";
|
|
5
|
-
import "./chunk-6SDRWEPN.js";
|
|
6
|
-
import "./chunk-6JK4IBGK.js";
|
|
7
|
-
import "./chunk-7XD47KN5.js";
|
|
8
|
-
import {
|
|
9
|
-
loadConfig,
|
|
10
|
-
resolveModel
|
|
11
|
-
} from "./chunk-TLCL6DC7.js";
|
|
12
|
-
import {
|
|
13
|
-
t
|
|
14
|
-
} from "./chunk-R754XIBJ.js";
|
|
15
|
-
|
|
16
|
-
// src/modelsCli.ts
|
|
17
|
-
async function runModelsCommand(args, deps) {
|
|
18
|
-
const config = loadConfig(deps.cwd, deps.env);
|
|
19
|
-
const arg = (args.subArgs[0] ?? "").trim();
|
|
20
|
-
const providerId = arg ? arg.split("/")[0] : resolveModel(config, args.model ?? config.model, deps.env).providerId;
|
|
21
|
-
if (!Object.hasOwn(config.providers, providerId)) {
|
|
22
|
-
deps.err(t('Provider "{id}" is not in the config. Available: {list}', { id: providerId, list: Object.keys(config.providers).join(", ") }));
|
|
23
|
-
return 1;
|
|
24
|
-
}
|
|
25
|
-
const groups = await listAllModels(config, deps.env, { fetch: deps.fetch, only: providerId });
|
|
26
|
-
const group = groups.find((g) => g.providerId === providerId);
|
|
27
|
-
if (!group || group.error) {
|
|
28
|
-
deps.err(`${providerId}: ${group?.error ?? t("could not be reached")}`);
|
|
29
|
-
return 1;
|
|
30
|
-
}
|
|
31
|
-
deps.out(group.models.map((m) => `${providerId}/${m}`).join("\n"));
|
|
32
|
-
return 0;
|
|
33
|
-
}
|
|
34
|
-
export {
|
|
35
|
-
runModelsCommand
|
|
36
|
-
};
|
package/dist/modelsCli.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { CliArgs } from './args';
|
|
2
|
-
export interface ModelsDeps {
|
|
3
|
-
env: NodeJS.ProcessEnv;
|
|
4
|
-
cwd: string;
|
|
5
|
-
out(line: string): void;
|
|
6
|
-
err(line: string): void;
|
|
7
|
-
fetch?: typeof fetch;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* `bccli models [provider|provider/model]`.
|
|
11
|
-
* No argument keeps the old behavior: list the models of the active provider.
|
|
12
|
-
* A provider id (or a full model ref, whose provider part is used) lists exactly
|
|
13
|
-
* that provider, even when it is keyless or comes from the project config.
|
|
14
|
-
*/
|
|
15
|
-
export declare function runModelsCommand(args: CliArgs, deps: ModelsDeps): Promise<number>;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
// src/npmRunner.ts
|
|
4
|
-
import { spawnSync } from "child_process";
|
|
5
|
-
import { existsSync } from "fs";
|
|
6
|
-
import { delimiter, posix, win32 } from "path";
|
|
7
|
-
function findNpmCli(platform, env, exists, execPath) {
|
|
8
|
-
const path = platform === "win32" ? win32 : posix;
|
|
9
|
-
const sibling = path.join(path.dirname(execPath), "node_modules", "npm", "bin", "npm-cli.js");
|
|
10
|
-
if (exists(sibling)) return sibling;
|
|
11
|
-
const sep = platform === "win32" ? ";" : delimiter;
|
|
12
|
-
for (const dir of (env.PATH ?? "").split(sep)) {
|
|
13
|
-
if (!dir) continue;
|
|
14
|
-
const shim = path.join(dir, platform === "win32" ? "npm.cmd" : "npm");
|
|
15
|
-
if (!exists(shim)) continue;
|
|
16
|
-
const cli = path.join(dir, "node_modules", "npm", "bin", "npm-cli.js");
|
|
17
|
-
if (exists(cli)) return cli;
|
|
18
|
-
}
|
|
19
|
-
return null;
|
|
20
|
-
}
|
|
21
|
-
var text = (v) => typeof v === "string" ? v : v ? v.toString() : "";
|
|
22
|
-
function toResult(r) {
|
|
23
|
-
return {
|
|
24
|
-
code: r.status ?? 1,
|
|
25
|
-
stderr: text(r.stderr) || (r.error ? r.error.message : ""),
|
|
26
|
-
stdout: text(r.stdout)
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
function runNpmSync(prefix, argv, opts = {}) {
|
|
30
|
-
const platform = opts.platform ?? process.platform;
|
|
31
|
-
const spawn = opts.spawn ?? spawnSync;
|
|
32
|
-
const env = opts.env ?? process.env;
|
|
33
|
-
const exists = opts.exists ?? existsSync;
|
|
34
|
-
const execPath = opts.execPath ?? process.execPath;
|
|
35
|
-
if (platform !== "win32") {
|
|
36
|
-
return toResult(spawn("npm", ["--prefix", prefix, ...argv], { encoding: "utf8", env }));
|
|
37
|
-
}
|
|
38
|
-
const cli = findNpmCli(platform, env, exists, execPath);
|
|
39
|
-
if (!cli) {
|
|
40
|
-
return { code: 1, stderr: "npm CLI not found (looked beside the node executable and on PATH)" };
|
|
41
|
-
}
|
|
42
|
-
return toResult(spawn(execPath, [cli, "--prefix", prefix, ...argv], { encoding: "utf8", env }));
|
|
43
|
-
}
|
|
44
|
-
export {
|
|
45
|
-
runNpmSync
|
|
46
|
-
};
|
package/dist/npmRunner.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { spawnSync } from 'node:child_process';
|
|
2
|
-
/**
|
|
3
|
-
* Synchronous npm runner. On Windows it NEVER goes through cmd.exe: npm's own
|
|
4
|
-
* npm.cmd is just a shim around `node …\node_modules\npm\bin\npm-cli.js`, so we
|
|
5
|
-
* invoke that script with process.execPath and pass every argument as plain
|
|
6
|
-
* argv. Shell metacharacters in the prefix path (& % ( ) spaces, …) therefore
|
|
7
|
-
* need no quoting at all — nothing is ever joined into a command line.
|
|
8
|
-
*/
|
|
9
|
-
export interface NpmRunResult {
|
|
10
|
-
code: number;
|
|
11
|
-
stderr: string;
|
|
12
|
-
stdout?: string;
|
|
13
|
-
}
|
|
14
|
-
export interface RunNpmOptions {
|
|
15
|
-
platform?: NodeJS.Platform;
|
|
16
|
-
spawn?: typeof spawnSync;
|
|
17
|
-
env?: NodeJS.ProcessEnv;
|
|
18
|
-
exists?: (path: string) => boolean;
|
|
19
|
-
execPath?: string;
|
|
20
|
-
}
|
|
21
|
-
export declare function runNpmSync(prefix: string, argv: string[], opts?: RunNpmOptions): NpmRunResult;
|