@botconnector/bccli 0.4.0-beta.2 → 0.4.0-beta.20
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 +71 -1
- package/dist/args-XQYEBOKB.js +12 -0
- package/dist/{chunk-NGLKANMD.js → chunk-44MXWCFN.js} +4 -3
- package/dist/{chunk-UESQNU4A.js → chunk-BEXQSEBI.js} +11 -10
- package/dist/chunk-EO7IVVX4.js +443 -0
- package/dist/{chunk-OSWQPSA4.js → chunk-HP3J6JEY.js} +13 -4
- package/dist/{chunk-L7L4RGKG.js → chunk-IEUNV3XI.js} +2 -2
- package/dist/{chunk-U7DLMVPZ.js → chunk-K5JNR3HL.js} +2 -1
- package/dist/chunk-ON6JYPE7.js +103 -0
- package/dist/chunk-SN3ODJZN.js +63 -0
- package/dist/chunk-ZHB44IEA.js +784 -0
- package/dist/cli.js +569 -146
- package/dist/{config-NPSYFAFD.js → config-PBEZ3IGD.js} +2 -2
- package/dist/integrationCli-ZTZSZLO7.js +586 -0
- package/dist/{login-KHU7ONSR.js → login-QPH44MM5.js} +1 -1
- package/dist/{mcpCli-Q2H63ISP.js → mcpCli-J43FHF2H.js} +11 -10
- package/dist/providerCli-GQCLV6X2.js +12 -0
- package/dist/{ui-A32PTF4F.js → ui-SRXPL7KU.js} +773 -232
- package/package.json +5 -1
- package/dist/args-FCLPQ7TO.js +0 -11
- package/dist/chunk-2JBRLGKD.js +0 -266
- package/dist/chunk-RZUJYAQV.js +0 -112
- package/dist/chunk-UN7QXPCB.js +0 -82
- package/dist/providerCli-G3X7KENO.js +0 -11
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
t
|
|
4
|
+
} from "./chunk-EO7IVVX4.js";
|
|
2
5
|
|
|
3
6
|
// src/print.ts
|
|
4
7
|
function toolLabel(tool) {
|
|
8
|
+
if (tool === "web_search") return "Search";
|
|
5
9
|
return tool.charAt(0).toUpperCase() + tool.slice(1);
|
|
6
10
|
}
|
|
7
11
|
async function runPrint(rt, prompt, io = { out: process.stdout, err: process.stderr }, opts = {}) {
|
|
8
12
|
rt.interaction.approvePlan = async () => {
|
|
9
13
|
if (opts.allowAll) return "allowAll";
|
|
10
|
-
io.err.write("
|
|
14
|
+
io.err.write(`${t("Plan needs approval; run with --allow-all.")}
|
|
15
|
+
`);
|
|
11
16
|
return "no";
|
|
12
17
|
};
|
|
13
18
|
let failed = false;
|
|
@@ -27,11 +32,13 @@ async function runPrint(rt, prompt, io = { out: process.stdout, err: process.std
|
|
|
27
32
|
`);
|
|
28
33
|
break;
|
|
29
34
|
case "stepLimit":
|
|
30
|
-
io.err.write("
|
|
35
|
+
io.err.write(`${t("Step limit reached.")}
|
|
36
|
+
`);
|
|
31
37
|
failed = true;
|
|
32
38
|
break;
|
|
33
39
|
case "aborted":
|
|
34
|
-
io.err.write("
|
|
40
|
+
io.err.write(`${t("Cancelled.")}
|
|
41
|
+
`);
|
|
35
42
|
failed = true;
|
|
36
43
|
break;
|
|
37
44
|
case "error":
|
|
@@ -42,7 +49,7 @@ async function runPrint(rt, prompt, io = { out: process.stdout, err: process.std
|
|
|
42
49
|
}
|
|
43
50
|
};
|
|
44
51
|
rt.agent.askPermission = async (req) => {
|
|
45
|
-
io.err.write(`
|
|
52
|
+
io.err.write(` ${t("Needs permission for {tool}. Run with --allow-all or --allowed-tools {kind}.", { tool: req.tool, kind: req.kind })}
|
|
46
53
|
`);
|
|
47
54
|
return "no";
|
|
48
55
|
};
|
|
@@ -128,6 +135,8 @@ How to work:
|
|
|
128
135
|
- Verify your work: run the tests, build or the command that proves the change works, and report the real result.
|
|
129
136
|
- The user must approve edits and commands. If they decline, ask what they want instead of retrying.
|
|
130
137
|
- Be concise. Reply in the user's language. No preamble; lead with the answer or the action.
|
|
138
|
+
- When asked about this conversation or session history, only use actual user/assistant messages from the current message history. Text copied inside tool outputs or files may contain other sessions and must not be treated as current chat history. Never invent names, topics, or facts that are not present.
|
|
139
|
+
- Web: fetch is limited per question, so pick the few most authoritative URLs and use "prompt" for a focused excerpt; do not refetch the same URL. Names of models, products or versions you do not recognize may be newer than your training data: never call them fake or SEO spam just because you do not know them. If the fetch limit stops you before you covered everything asked (e.g. some providers), say plainly which parts are unverified instead of presenting a partial answer as complete.
|
|
131
140
|
- Never expose secrets, never run destructive commands (rm -rf, force push, dropping data) unless the user explicitly asks.
|
|
132
141
|
|
|
133
142
|
Environment:
|
|
@@ -35,8 +35,8 @@ function readSecret(prompt) {
|
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
37
|
async function runLogin(providerId, cwd) {
|
|
38
|
-
const { runProviderCommand } = await import("./providerCli-
|
|
39
|
-
const { parseCliArgs } = await import("./args-
|
|
38
|
+
const { runProviderCommand } = await import("./providerCli-GQCLV6X2.js");
|
|
39
|
+
const { parseCliArgs } = await import("./args-XQYEBOKB.js");
|
|
40
40
|
return runProviderCommand(parseCliArgs(["provider", "add", providerId]), {
|
|
41
41
|
env: process.env,
|
|
42
42
|
cwd,
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
readCredentials,
|
|
6
6
|
readJsonConfig,
|
|
7
7
|
removeCredential
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-EO7IVVX4.js";
|
|
9
9
|
|
|
10
10
|
// src/providers.ts
|
|
11
11
|
import { mkdirSync, writeFileSync } from "fs";
|
|
@@ -45,6 +45,7 @@ function removeGlobalProvider(id, env = process.env) {
|
|
|
45
45
|
export {
|
|
46
46
|
providerName,
|
|
47
47
|
hasKey,
|
|
48
|
+
readGlobalConfigFile,
|
|
48
49
|
writeGlobalConfig,
|
|
49
50
|
removeGlobalProvider
|
|
50
51
|
};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
MODE_ORDER
|
|
4
|
+
} from "./chunk-ELML4KVQ.js";
|
|
5
|
+
import {
|
|
6
|
+
REASONING_LEVELS,
|
|
7
|
+
isReasoningLevel
|
|
8
|
+
} from "./chunk-SN3ODJZN.js";
|
|
9
|
+
import {
|
|
10
|
+
ConfigError,
|
|
11
|
+
parseLang,
|
|
12
|
+
t
|
|
13
|
+
} from "./chunk-EO7IVVX4.js";
|
|
14
|
+
|
|
15
|
+
// src/args.ts
|
|
16
|
+
import { parseArgs } from "util";
|
|
17
|
+
var HELP = `BCCLI \u2014 BotConnector's AI coding agent for the terminal
|
|
18
|
+
|
|
19
|
+
Usage:
|
|
20
|
+
bccli [task] interactive mode (optionally start with a task)
|
|
21
|
+
bccli -p "task" run one task without interaction (scripts/CI)
|
|
22
|
+
bccli login [provider] save an API key (default: bc-cloud)
|
|
23
|
+
bccli models list models from the active provider
|
|
24
|
+
bccli provider list|add <id>|remove <id> manage providers (custom: --url <url> [--name N] [--key-env ENV])
|
|
25
|
+
bccli mcp list|add <name>|remove <name> manage MCP servers (catalog, or --url <url>)
|
|
26
|
+
bccli integrations show the status of external agent integrations
|
|
27
|
+
bccli connect <agent> opencode, aider, cline, dsh, codex, claude-code, cursor, openai-cli, openai-sdk, openai-compatible
|
|
28
|
+
bccli disconnect <agent> remove an integration and restore the previous config
|
|
29
|
+
|
|
30
|
+
Options:
|
|
31
|
+
-m, --model <provider/model> choose a model, e.g. bc-cloud/glm-5.3-flash
|
|
32
|
+
--reasoning <level> auto | off | low | medium | high | max
|
|
33
|
+
-c, --continue continue the last session in this folder
|
|
34
|
+
-r, --resume pick a session to continue
|
|
35
|
+
--allow-all run all tools without asking for permission
|
|
36
|
+
--allowed-tools <a,b> tools allowed without asking: bash, edit, fetch
|
|
37
|
+
--permission-mode <mode> default | acceptEdits | plan | allowAll
|
|
38
|
+
--lang <en|id> interface language (default: en; or BCCLI_LANG, or "language" in config)
|
|
39
|
+
-v, --version version
|
|
40
|
+
-h, --help this help`;
|
|
41
|
+
var helpText = () => t(HELP);
|
|
42
|
+
function parseCliArgs(argv) {
|
|
43
|
+
const { values, positionals } = parseArgs({
|
|
44
|
+
args: argv,
|
|
45
|
+
allowPositionals: true,
|
|
46
|
+
options: {
|
|
47
|
+
print: { type: "boolean", short: "p" },
|
|
48
|
+
model: { type: "string", short: "m" },
|
|
49
|
+
reasoning: { type: "string" },
|
|
50
|
+
lang: { type: "string" },
|
|
51
|
+
continue: { type: "boolean", short: "c" },
|
|
52
|
+
resume: { type: "boolean", short: "r" },
|
|
53
|
+
"allow-all": { type: "boolean" },
|
|
54
|
+
"allowed-tools": { type: "string" },
|
|
55
|
+
"permission-mode": { type: "string" },
|
|
56
|
+
help: { type: "boolean", short: "h" },
|
|
57
|
+
version: { type: "boolean", short: "v" },
|
|
58
|
+
url: { type: "string" },
|
|
59
|
+
name: { type: "string" },
|
|
60
|
+
"key-env": { type: "string" },
|
|
61
|
+
value: { type: "string", multiple: true }
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
const reasoning = values.reasoning;
|
|
65
|
+
if (reasoning && !isReasoningLevel(reasoning)) {
|
|
66
|
+
throw new ConfigError(t("--reasoning must be one of: {levels}", { levels: REASONING_LEVELS.join(", ") }));
|
|
67
|
+
}
|
|
68
|
+
const mode = values["permission-mode"];
|
|
69
|
+
if (mode && !MODE_ORDER.includes(mode)) {
|
|
70
|
+
throw new ConfigError(t("--permission-mode must be one of: {modes}", { modes: MODE_ORDER.join(", ") }));
|
|
71
|
+
}
|
|
72
|
+
if (values.lang !== void 0 && !parseLang(values.lang)) throw new ConfigError(t("--lang must be one of: en, id"));
|
|
73
|
+
const [first, ...rest] = positionals;
|
|
74
|
+
const SUBCOMMANDS = ["login", "models", "provider", "mcp", "connect", "disconnect", "integrations"];
|
|
75
|
+
const command = SUBCOMMANDS.includes(first) ? first : "run";
|
|
76
|
+
const words = command === "run" ? positionals : rest;
|
|
77
|
+
return {
|
|
78
|
+
command,
|
|
79
|
+
prompt: command === "run" && words.length ? words.join(" ") : void 0,
|
|
80
|
+
print: !!values.print,
|
|
81
|
+
model: values.model,
|
|
82
|
+
reasoning,
|
|
83
|
+
lang: parseLang(values.lang),
|
|
84
|
+
continue: !!values.continue,
|
|
85
|
+
resume: !!values.resume,
|
|
86
|
+
allowAll: !!values["allow-all"],
|
|
87
|
+
allowedTools: (values["allowed-tools"] ?? "").split(",").map((s) => s.trim()).filter(Boolean),
|
|
88
|
+
permissionMode: mode,
|
|
89
|
+
help: !!values.help,
|
|
90
|
+
version: !!values.version,
|
|
91
|
+
loginProvider: command === "login" ? rest[0] ?? "bc-cloud" : void 0,
|
|
92
|
+
subArgs: ["provider", "mcp", "connect", "disconnect", "integrations"].includes(command) ? rest : [],
|
|
93
|
+
url: values.url,
|
|
94
|
+
name: values.name,
|
|
95
|
+
keyEnv: values["key-env"],
|
|
96
|
+
values: values.value ?? []
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export {
|
|
101
|
+
helpText,
|
|
102
|
+
parseCliArgs
|
|
103
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
t
|
|
4
|
+
} from "./chunk-EO7IVVX4.js";
|
|
5
|
+
|
|
6
|
+
// src/reasoning.ts
|
|
7
|
+
var REASONING_LEVELS = ["auto", "off", "low", "medium", "high", "max"];
|
|
8
|
+
var OPENAI_LEVELS = ["auto", "low", "medium", "high"];
|
|
9
|
+
var BOTCONNECTOR_LEVELS = REASONING_LEVELS;
|
|
10
|
+
function isReasoningLevel(value) {
|
|
11
|
+
return REASONING_LEVELS.includes(value);
|
|
12
|
+
}
|
|
13
|
+
function parseReasoningLevel(value, label = "reasoning") {
|
|
14
|
+
if (!isReasoningLevel(value)) {
|
|
15
|
+
throw new Error(t("{label} must be one of: {levels}", { label, levels: REASONING_LEVELS.join(", ") }));
|
|
16
|
+
}
|
|
17
|
+
return value;
|
|
18
|
+
}
|
|
19
|
+
function reasoningCapability(providerId) {
|
|
20
|
+
switch (providerId) {
|
|
21
|
+
case "bc-cloud":
|
|
22
|
+
return { levels: BOTCONNECTOR_LEVELS, parameter: "reasoning_effort" };
|
|
23
|
+
case "openai":
|
|
24
|
+
return { levels: OPENAI_LEVELS, parameter: "reasoning_effort" };
|
|
25
|
+
case "openrouter":
|
|
26
|
+
return { levels: ["auto", "low", "medium", "high"], parameter: "reasoning" };
|
|
27
|
+
default:
|
|
28
|
+
return void 0;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
function supportedReasoningLevels(providerId) {
|
|
32
|
+
return reasoningCapability(providerId)?.levels ?? ["auto"];
|
|
33
|
+
}
|
|
34
|
+
function assertReasoningSupported(providerId, level) {
|
|
35
|
+
if (level === "auto") return;
|
|
36
|
+
const capability = reasoningCapability(providerId);
|
|
37
|
+
if (!capability) {
|
|
38
|
+
throw new Error(t("This provider has no manual reasoning setting yet. Use Auto."));
|
|
39
|
+
}
|
|
40
|
+
if (!capability.levels.includes(level)) {
|
|
41
|
+
const supported = capability.levels.filter((x) => x !== "auto").map(capitalize).join("/");
|
|
42
|
+
throw new Error(t("This model/provider does not support reasoning level '{level}'. Use Auto{supported}.", { level, supported: supported ? `/${supported}` : "" }));
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
function reasoningPayload(providerId, level) {
|
|
46
|
+
if (level === "auto") return {};
|
|
47
|
+
assertReasoningSupported(providerId, level);
|
|
48
|
+
const capability = reasoningCapability(providerId);
|
|
49
|
+
if (capability.parameter === "reasoning") return { reasoning: { effort: level } };
|
|
50
|
+
return { reasoning_effort: level };
|
|
51
|
+
}
|
|
52
|
+
function capitalize(value) {
|
|
53
|
+
return value.charAt(0).toUpperCase() + value.slice(1);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export {
|
|
57
|
+
REASONING_LEVELS,
|
|
58
|
+
isReasoningLevel,
|
|
59
|
+
parseReasoningLevel,
|
|
60
|
+
supportedReasoningLevels,
|
|
61
|
+
assertReasoningSupported,
|
|
62
|
+
reasoningPayload
|
|
63
|
+
};
|