@botconnector/bccli 0.4.10 → 0.4.11
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/{acp-L4WGVJTY.js → acp-IPHWC6CO.js} +20 -5
- package/dist/acp.d.ts +17 -1
- package/dist/args-K5AJFDCZ.js +13 -0
- package/dist/budget.d.ts +4 -1
- package/dist/{chunk-7HDBPDAD.js → chunk-2DFY43RP.js} +2 -2
- package/dist/{chunk-5QCCV2JM.js → chunk-6BXW7DGQ.js} +47 -18
- package/dist/{chunk-4WI5ON64.js → chunk-6KZIOICR.js} +1 -1
- package/dist/{chunk-3K66L37W.js → chunk-6M5T7N7A.js} +3 -3
- package/dist/{chunk-USFXL5BS.js → chunk-C2FUGQJX.js} +6 -6
- package/dist/{chunk-24KDXQZT.js → chunk-F54FDJBD.js} +3 -3
- package/dist/{chunk-ED5TTYQU.js → chunk-G5TG43R4.js} +3 -0
- package/dist/{chunk-67REFMSY.js → chunk-IHQGXDSG.js} +1 -1
- package/dist/{chunk-PGDYPOQW.js → chunk-JFYQCPXL.js} +4 -4
- package/dist/{chunk-ZWXKBFKW.js → chunk-MBAMDCCV.js} +23 -9
- package/dist/{chunk-CBD52BYV.js → chunk-N6APAYSF.js} +1 -1
- package/dist/{chunk-6N2BBLIT.js → chunk-NT2G5FSX.js} +2 -2
- package/dist/{chunk-3PUWH62K.js → chunk-OAXD3X4R.js} +34 -50
- package/dist/{chunk-VXRW5SYP.js → chunk-OOOS5RCT.js} +25 -14
- package/dist/{chunk-CIEPLTGS.js → chunk-WSZF2CTU.js} +4 -4
- package/dist/{chunk-MPYSYTSO.js → chunk-X24APPXO.js} +1 -1
- package/dist/{chunk-6RVAPAE5.js → chunk-XZ2TI5HV.js} +1 -1
- package/dist/{chunk-SXRQ2Q7A.js → chunk-Y6AZGGH7.js} +4 -4
- package/dist/{chunk-WFZKJY3R.js → chunk-YYTFJUO2.js} +3 -2
- package/dist/cli.js +39 -39
- package/dist/{completion-GEFRIQWV.js → completion-QVDGAYUY.js} +1 -1
- package/dist/{config-JLOH5M6B.js → config-7TQ2KVVX.js} +3 -3
- package/dist/{config-JKMYKNAT.js → config-RZY3XQZJ.js} +2 -2
- package/dist/{ghBotCli-WEVS6S6O.js → ghBotCli-HHJ4ANTH.js} +18 -16
- package/dist/{integrationCli-PKMICTHC.js → integrationCli-LNNZDGZX.js} +40 -5
- package/dist/{login-2TZRODUL.js → login-MQEZGF2C.js} +6 -4
- package/dist/login.d.ts +2 -0
- package/dist/{mcpCli-TAPKYGHO.js → mcpCli-CUIOYJ2A.js} +6 -6
- package/dist/{modelsCli-6PK7V2QZ.js → modelsCli-AAFHFI4H.js} +6 -6
- package/dist/{oauthLogin-UI34LQZU.js → oauthLogin-YFL2N4QA.js} +1 -1
- package/dist/{pluginsCli-RCF33U5J.js → pluginsCli-2QXXFLQA.js} +2 -2
- package/dist/{prCli-24PMW7NS.js → prCli-KSA73RCS.js} +1 -1
- package/dist/providerCli-TXMVPSW5.js +15 -0
- package/dist/sdk.js +103 -72
- package/dist/{serve-XNJI67DU.js → serve-EIQHEUYD.js} +3 -3
- package/dist/{serve-7BFCIEPJ.js → serve-QYDBFTHC.js} +16 -16
- package/dist/session-CQCQ7KAP.js +12 -0
- package/dist/setup-DBSGMWHM.js +24 -0
- package/dist/setup.d.ts +5 -0
- package/dist/{statsCli-QDHE4TKB.js → statsCli-EHNJIQ2Z.js} +2 -2
- package/dist/tools/bash.d.ts +2 -0
- package/dist/{transferCli-7OKKYGG2.js → transferCli-IXJ2O74Q.js} +4 -4
- package/dist/{ui-SZAIIJC5.js → ui-A2LASWDK.js} +14 -14
- package/dist/{update-JSNVVXPS.js → update-TR62JV3A.js} +2 -2
- package/package.json +1 -1
- package/dist/args-EW7XJVQN.js +0 -13
- package/dist/providerCli-XA4LTWRD.js +0 -15
- package/dist/session-VAPIHHUG.js +0 -12
- package/dist/setup-GPIMZOWE.js +0 -24
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./chunk-PSO7R5AD.js";
|
|
5
5
|
import {
|
|
6
6
|
t
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-G5TG43R4.js";
|
|
8
8
|
|
|
9
9
|
// src/tools/bash.ts
|
|
10
10
|
import { spawn } from "child_process";
|
|
@@ -34,60 +34,39 @@ function darwinProfile(cwd, network) {
|
|
|
34
34
|
network ? "(allow network*)" : "(deny network*)"
|
|
35
35
|
].join("\n");
|
|
36
36
|
}
|
|
37
|
+
function bwrapArgv(cwd, network, command) {
|
|
38
|
+
return [
|
|
39
|
+
"bwrap",
|
|
40
|
+
"--ro-bind",
|
|
41
|
+
"/",
|
|
42
|
+
"/",
|
|
43
|
+
"--dev-bind",
|
|
44
|
+
"/dev",
|
|
45
|
+
"/dev",
|
|
46
|
+
"--proc",
|
|
47
|
+
"/proc",
|
|
48
|
+
"--bind",
|
|
49
|
+
cwd,
|
|
50
|
+
cwd,
|
|
51
|
+
"--tmpfs",
|
|
52
|
+
"/tmp",
|
|
53
|
+
"--die-with-parent",
|
|
54
|
+
...network ? [] : ["--unshare-net"],
|
|
55
|
+
"--",
|
|
56
|
+
"/bin/bash",
|
|
57
|
+
"-c",
|
|
58
|
+
command
|
|
59
|
+
];
|
|
60
|
+
}
|
|
37
61
|
function sandboxArgv(command, opts) {
|
|
38
62
|
if (opts.platform === "darwin") {
|
|
39
63
|
return ["sandbox-exec", "-p", darwinProfile(opts.cwd, opts.network), "/bin/bash", "-c", command];
|
|
40
64
|
}
|
|
41
65
|
if (opts.platform === "linux") {
|
|
42
|
-
return
|
|
43
|
-
"bwrap",
|
|
44
|
-
"--ro-bind",
|
|
45
|
-
"/",
|
|
46
|
-
"/",
|
|
47
|
-
"--dev-bind",
|
|
48
|
-
"/dev",
|
|
49
|
-
"/dev",
|
|
50
|
-
"--proc",
|
|
51
|
-
"/proc",
|
|
52
|
-
"--bind",
|
|
53
|
-
opts.cwd,
|
|
54
|
-
opts.cwd,
|
|
55
|
-
"--tmpfs",
|
|
56
|
-
"/tmp",
|
|
57
|
-
"--die-with-parent",
|
|
58
|
-
...opts.network ? [] : ["--unshare-net"],
|
|
59
|
-
"--",
|
|
60
|
-
"/bin/bash",
|
|
61
|
-
"-c",
|
|
62
|
-
command
|
|
63
|
-
];
|
|
66
|
+
return bwrapArgv(opts.cwd, opts.network, command);
|
|
64
67
|
}
|
|
65
68
|
if (opts.platform === "win32" && (opts.wslBwrap || process.env.BCCLI_WIN32_WSL_SANDBOX === "1")) {
|
|
66
|
-
|
|
67
|
-
return [
|
|
68
|
-
"wsl.exe",
|
|
69
|
-
"--",
|
|
70
|
-
"bwrap",
|
|
71
|
-
"--ro-bind",
|
|
72
|
-
"/",
|
|
73
|
-
"/",
|
|
74
|
-
"--dev-bind",
|
|
75
|
-
"/dev",
|
|
76
|
-
"/dev",
|
|
77
|
-
"--proc",
|
|
78
|
-
"/proc",
|
|
79
|
-
"--bind",
|
|
80
|
-
wslCwd,
|
|
81
|
-
wslCwd,
|
|
82
|
-
"--tmpfs",
|
|
83
|
-
"/tmp",
|
|
84
|
-
"--die-with-parent",
|
|
85
|
-
...opts.network ? [] : ["--unshare-net"],
|
|
86
|
-
"--",
|
|
87
|
-
"/bin/bash",
|
|
88
|
-
"-c",
|
|
89
|
-
command
|
|
90
|
-
];
|
|
69
|
+
return ["wsl.exe", "--", ...bwrapArgv(winPathToWsl(opts.cwd), opts.network, command)];
|
|
91
70
|
}
|
|
92
71
|
return void 0;
|
|
93
72
|
}
|
|
@@ -156,7 +135,7 @@ function killAllCommands() {
|
|
|
156
135
|
}
|
|
157
136
|
var backgrounds = /* @__PURE__ */ new Map();
|
|
158
137
|
var nextBackgroundId = 1;
|
|
159
|
-
function startBackground(command, cwd, env, shell) {
|
|
138
|
+
function startBackground(command, cwd, env, shell, maxRetained) {
|
|
160
139
|
const child = spawnChild(command, cwd, env, shell);
|
|
161
140
|
const task = {
|
|
162
141
|
id: nextBackgroundId++,
|
|
@@ -177,6 +156,10 @@ function startBackground(command, cwd, env, shell) {
|
|
|
177
156
|
if (child.pid !== void 0) killProcessTree(child.pid);
|
|
178
157
|
};
|
|
179
158
|
backgrounds.set(task.id, task);
|
|
159
|
+
for (const [id, other] of backgrounds) {
|
|
160
|
+
if (backgrounds.size <= maxRetained) break;
|
|
161
|
+
if (id !== task.id && other.status === "exited") backgrounds.delete(id);
|
|
162
|
+
}
|
|
180
163
|
const onData = (data) => {
|
|
181
164
|
let s = data;
|
|
182
165
|
if (task.head.length < HALF) {
|
|
@@ -385,6 +368,7 @@ var SHELL_NOTE = {
|
|
|
385
368
|
function createBashTool(options = {}) {
|
|
386
369
|
const offline = options.networkPolicy === "offline";
|
|
387
370
|
const sandbox = options.sandbox === true;
|
|
371
|
+
const maxRetained = options.maxRetainedTasks ?? 50;
|
|
388
372
|
const platform = options.platform ?? process.platform;
|
|
389
373
|
const shell = resolveShell({ platform, env: process.env, exists: existsSync2, ...options.shellDeps });
|
|
390
374
|
const childEnv = offline ? offlineEnv() : void 0;
|
|
@@ -431,7 +415,7 @@ Network access is off (networkPolicy "offline"): internet commands such as curl,
|
|
|
431
415
|
}
|
|
432
416
|
if (input.background) {
|
|
433
417
|
if (!input.command) return { output: 'The "command" argument is required to start a background task.', isError: true };
|
|
434
|
-
const task = startBackground(exec, ctx.cwd, childEnv, shell);
|
|
418
|
+
const task = startBackground(exec, ctx.cwd, childEnv, shell, maxRetained);
|
|
435
419
|
return {
|
|
436
420
|
output: `Background task #${task.id} started: ${input.command}
|
|
437
421
|
Poll it with {task_id: ${task.id}}; stop it with {task_id: ${task.id}, kill: true}.`
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
reasoningPayload
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-XZ2TI5HV.js";
|
|
5
5
|
import {
|
|
6
6
|
t
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-G5TG43R4.js";
|
|
8
8
|
|
|
9
9
|
// src/provider.ts
|
|
10
10
|
import OpenAI from "openai";
|
|
@@ -440,7 +440,7 @@ function hasPendingProgrammaticReplay(messages) {
|
|
|
440
440
|
}
|
|
441
441
|
return pending;
|
|
442
442
|
}
|
|
443
|
-
async function readResponsesStream(res, onText, onThinking) {
|
|
443
|
+
async function readResponsesStream(res, onText, onThinking, signal) {
|
|
444
444
|
let text = "";
|
|
445
445
|
let thinking = "";
|
|
446
446
|
let usage;
|
|
@@ -542,17 +542,28 @@ async function readResponsesStream(res, onText, onThinking) {
|
|
|
542
542
|
);
|
|
543
543
|
}
|
|
544
544
|
};
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
545
|
+
const iterator = res.body[Symbol.asyncIterator]();
|
|
546
|
+
const onAbort = () => void iterator.return?.();
|
|
547
|
+
if (signal?.aborted) onAbort();
|
|
548
|
+
else signal?.addEventListener("abort", onAbort);
|
|
549
|
+
try {
|
|
550
|
+
for (; ; ) {
|
|
551
|
+
const step = await iterator.next();
|
|
552
|
+
if (step.done) break;
|
|
553
|
+
buffer += decoder.decode(step.value, { stream: true });
|
|
554
|
+
let newline = buffer.indexOf("\n");
|
|
555
|
+
while (newline >= 0 && loopAt < 0) {
|
|
556
|
+
handle(buffer.slice(0, newline).trim());
|
|
557
|
+
buffer = buffer.slice(newline + 1);
|
|
558
|
+
newline = buffer.indexOf("\n");
|
|
559
|
+
}
|
|
560
|
+
if (loopAt >= 0) {
|
|
561
|
+
return { text: text.slice(0, loopAt), toolCalls: [], usage, finishReason: "repetition" };
|
|
562
|
+
}
|
|
555
563
|
}
|
|
564
|
+
} finally {
|
|
565
|
+
signal?.removeEventListener("abort", onAbort);
|
|
566
|
+
void iterator.return?.();
|
|
556
567
|
}
|
|
557
568
|
handle(buffer.trim());
|
|
558
569
|
return {
|
|
@@ -996,7 +1007,7 @@ function createProvider(options) {
|
|
|
996
1007
|
);
|
|
997
1008
|
if ((res2.headers.get("content-type") ?? "").includes("application/json")) return readResponsesJson(res2, onThinking);
|
|
998
1009
|
if (!res2.body) throw new ProviderError(t("Empty response from the provider"));
|
|
999
|
-
return readResponsesStream(res2, onText, onThinking);
|
|
1010
|
+
return readResponsesStream(res2, onText, onThinking, signal);
|
|
1000
1011
|
}
|
|
1001
1012
|
const res = await post(
|
|
1002
1013
|
"/chat/completions",
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
MODE_ORDER
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-YYTFJUO2.js";
|
|
5
5
|
import {
|
|
6
6
|
REASONING_LEVELS,
|
|
7
7
|
isReasoningLevel
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-XZ2TI5HV.js";
|
|
9
9
|
import {
|
|
10
10
|
ConfigError
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-C2FUGQJX.js";
|
|
12
12
|
import {
|
|
13
13
|
parseLang,
|
|
14
14
|
t
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-G5TG43R4.js";
|
|
16
16
|
|
|
17
17
|
// src/args.ts
|
|
18
18
|
import { parseArgs } from "util";
|
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
import {
|
|
3
3
|
hasKey,
|
|
4
4
|
providerName
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-X24APPXO.js";
|
|
6
6
|
import {
|
|
7
7
|
createProvider
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-OOOS5RCT.js";
|
|
9
9
|
import {
|
|
10
10
|
PRESETS,
|
|
11
11
|
readCredentials
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-C2FUGQJX.js";
|
|
13
13
|
import {
|
|
14
14
|
t
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-G5TG43R4.js";
|
|
16
16
|
|
|
17
17
|
// src/models.ts
|
|
18
18
|
function order(ids) {
|
|
@@ -94,7 +94,7 @@ var Permissions = class {
|
|
|
94
94
|
}
|
|
95
95
|
/** Rules that "[a] allow for this session" would add; undefined when it must always be asked. */
|
|
96
96
|
rulesFor(req) {
|
|
97
|
-
if (requiresSensitiveToolApproval(req) && (req.kind === "read" || process.env.BC_TOOL_POLICY_ENFORCE === "true"))
|
|
97
|
+
if (requiresSensitiveToolApproval(req) && (req.kind === "read" || req.kind === "edit" || process.env.BC_TOOL_POLICY_ENFORCE === "true"))
|
|
98
98
|
return void 0;
|
|
99
99
|
if (req.kind === "edit") return this.editInProject(req.target) ? ["edit(project)"] : void 0;
|
|
100
100
|
if (req.kind === "fetch") {
|
|
@@ -116,7 +116,8 @@ var Permissions = class {
|
|
|
116
116
|
}
|
|
117
117
|
check(req) {
|
|
118
118
|
if (this.mode === "plan" && req.kind !== "read") return "deny";
|
|
119
|
-
if (req.kind === "read" && this.mode !== "allowAll" && requiresSensitiveToolApproval(req))
|
|
119
|
+
if ((req.kind === "read" || req.kind === "edit") && this.mode !== "allowAll" && requiresSensitiveToolApproval(req))
|
|
120
|
+
return "ask";
|
|
120
121
|
if (process.env.BC_TOOL_POLICY_ENFORCE === "true" && requiresSensitiveToolApproval(req)) return "ask";
|
|
121
122
|
if (req.kind === "read") return "allow";
|
|
122
123
|
if (this.mode === "allowAll") return "allow";
|
package/dist/cli.js
CHANGED
|
@@ -3,47 +3,47 @@ import {
|
|
|
3
3
|
resolvePrintPrompt,
|
|
4
4
|
resolveWorktree,
|
|
5
5
|
runPrint
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-6M5T7N7A.js";
|
|
7
7
|
import {
|
|
8
8
|
createRuntime
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-6BXW7DGQ.js";
|
|
10
10
|
import "./chunk-OK2USAXX.js";
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-OAXD3X4R.js";
|
|
12
|
+
import "./chunk-6KZIOICR.js";
|
|
13
13
|
import "./chunk-PSO7R5AD.js";
|
|
14
14
|
import {
|
|
15
15
|
VERSION
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-N6APAYSF.js";
|
|
17
17
|
import {
|
|
18
18
|
helpText,
|
|
19
19
|
parseCliArgs
|
|
20
|
-
} from "./chunk-
|
|
21
|
-
import "./chunk-
|
|
22
|
-
import "./chunk-
|
|
23
|
-
import "./chunk-
|
|
20
|
+
} from "./chunk-WSZF2CTU.js";
|
|
21
|
+
import "./chunk-YYTFJUO2.js";
|
|
22
|
+
import "./chunk-JFYQCPXL.js";
|
|
23
|
+
import "./chunk-Y6AZGGH7.js";
|
|
24
24
|
import {
|
|
25
25
|
readGlobalConfigFile
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-X24APPXO.js";
|
|
27
27
|
import {
|
|
28
28
|
defaultLoginDeps,
|
|
29
29
|
runLogin
|
|
30
|
-
} from "./chunk-
|
|
31
|
-
import "./chunk-
|
|
30
|
+
} from "./chunk-MBAMDCCV.js";
|
|
31
|
+
import "./chunk-IHQGXDSG.js";
|
|
32
32
|
import {
|
|
33
33
|
pruneSessions
|
|
34
|
-
} from "./chunk-
|
|
35
|
-
import "./chunk-
|
|
36
|
-
import "./chunk-
|
|
37
|
-
import "./chunk-
|
|
34
|
+
} from "./chunk-F54FDJBD.js";
|
|
35
|
+
import "./chunk-OOOS5RCT.js";
|
|
36
|
+
import "./chunk-XZ2TI5HV.js";
|
|
37
|
+
import "./chunk-2DFY43RP.js";
|
|
38
38
|
import {
|
|
39
39
|
ConfigError,
|
|
40
40
|
setTheme
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-C2FUGQJX.js";
|
|
42
42
|
import {
|
|
43
43
|
resolveLanguage,
|
|
44
44
|
setLanguage,
|
|
45
45
|
t
|
|
46
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-G5TG43R4.js";
|
|
47
47
|
|
|
48
48
|
// src/exit.ts
|
|
49
49
|
var EXIT_GRACE_MS = 1e3;
|
|
@@ -85,17 +85,17 @@ async function main() {
|
|
|
85
85
|
if (args.worktree) cwd = (await resolveWorktree(cwd, args.worktree)).path;
|
|
86
86
|
if (args.command === "login") return runLogin(args.loginProvider ?? "bc-cloud", cwd, args, defaultLoginDeps());
|
|
87
87
|
if (args.command === "mcp") {
|
|
88
|
-
const { runMcpCommand } = await import("./mcpCli-
|
|
89
|
-
const { readSecret } = await import("./login-
|
|
88
|
+
const { runMcpCommand } = await import("./mcpCli-CUIOYJ2A.js");
|
|
89
|
+
const { readSecret } = await import("./login-MQEZGF2C.js");
|
|
90
90
|
return runMcpCommand(args, { env: process.env, cwd, out: (s) => console.log(s), err: (s) => console.error(s), readSecret });
|
|
91
91
|
}
|
|
92
92
|
if (args.command === "provider") {
|
|
93
|
-
const { runProviderCommand } = await import("./providerCli-
|
|
94
|
-
const { readSecret } = await import("./login-
|
|
93
|
+
const { runProviderCommand } = await import("./providerCli-TXMVPSW5.js");
|
|
94
|
+
const { readSecret } = await import("./login-MQEZGF2C.js");
|
|
95
95
|
return runProviderCommand(args, { env: process.env, cwd, out: (s) => console.log(s), err: (s) => console.error(s), readSecret });
|
|
96
96
|
}
|
|
97
97
|
if (args.command === "connect" || args.command === "disconnect" || args.command === "integrations") {
|
|
98
|
-
const { runIntegrationCommand } = await import("./integrationCli-
|
|
98
|
+
const { runIntegrationCommand } = await import("./integrationCli-LNNZDGZX.js");
|
|
99
99
|
return runIntegrationCommand(args, {
|
|
100
100
|
env: process.env,
|
|
101
101
|
cwd,
|
|
@@ -105,20 +105,20 @@ async function main() {
|
|
|
105
105
|
});
|
|
106
106
|
}
|
|
107
107
|
if (args.command === "models") {
|
|
108
|
-
const { runModelsCommand } = await import("./modelsCli-
|
|
108
|
+
const { runModelsCommand } = await import("./modelsCli-AAFHFI4H.js");
|
|
109
109
|
return runModelsCommand(args, { env: process.env, cwd, out: (s) => console.log(s), err: (s) => console.error(s), fetch: globalThis.fetch });
|
|
110
110
|
}
|
|
111
111
|
if (args.command === "update") {
|
|
112
|
-
const { runUpdateCommand } = await import("./update-
|
|
112
|
+
const { runUpdateCommand } = await import("./update-TR62JV3A.js");
|
|
113
113
|
return runUpdateCommand({ env: process.env });
|
|
114
114
|
}
|
|
115
115
|
if (args.command === "acp") {
|
|
116
|
-
const { runtimeAgent, runAcp } = await import("./acp-
|
|
116
|
+
const { runtimeAgent, runAcp } = await import("./acp-IPHWC6CO.js");
|
|
117
117
|
await runAcp(process.stdin, process.stdout, { cwd, newAgent: (c) => runtimeAgent(c, args.allowAll) });
|
|
118
118
|
return 0;
|
|
119
119
|
}
|
|
120
120
|
if (args.command === "serve") {
|
|
121
|
-
const { serveBanner, startServe } = await import("./serve-
|
|
121
|
+
const { serveBanner, startServe } = await import("./serve-QYDBFTHC.js");
|
|
122
122
|
const handle = await startServe({ port: args.port, host: args.host, token: args.token, cwd, env: process.env });
|
|
123
123
|
process.stderr.write(serveBanner(handle, { token: args.token }));
|
|
124
124
|
await new Promise((resolve) => {
|
|
@@ -131,8 +131,8 @@ async function main() {
|
|
|
131
131
|
return 0;
|
|
132
132
|
}
|
|
133
133
|
if (args.command === "plugins") {
|
|
134
|
-
const { runPluginsCommand } = await import("./pluginsCli-
|
|
135
|
-
const { readGlobalPlugins, updateGlobalConfig } = await import("./config-
|
|
134
|
+
const { runPluginsCommand } = await import("./pluginsCli-2QXXFLQA.js");
|
|
135
|
+
const { readGlobalPlugins, updateGlobalConfig } = await import("./config-RZY3XQZJ.js");
|
|
136
136
|
const { runNpmSync } = await import("./npmRunner-LU43GM3W.js");
|
|
137
137
|
return runPluginsCommand(args, {
|
|
138
138
|
out: (s) => console.log(s),
|
|
@@ -146,30 +146,30 @@ async function main() {
|
|
|
146
146
|
});
|
|
147
147
|
}
|
|
148
148
|
if (args.command === "gh-bot") {
|
|
149
|
-
const { runGhBotCommand } = await import("./ghBotCli-
|
|
149
|
+
const { runGhBotCommand } = await import("./ghBotCli-HHJ4ANTH.js");
|
|
150
150
|
return runGhBotCommand(args, { env: process.env, cwd, out: (s) => console.log(s), err: (s) => console.error(s) });
|
|
151
151
|
}
|
|
152
152
|
if (args.command === "completion") {
|
|
153
|
-
const { runCompletionCommand } = await import("./completion-
|
|
153
|
+
const { runCompletionCommand } = await import("./completion-QVDGAYUY.js");
|
|
154
154
|
return runCompletionCommand(args, { out: (s) => console.log(s), err: (s) => console.error(s) });
|
|
155
155
|
}
|
|
156
156
|
if (args.command === "stats") {
|
|
157
|
-
const { runStatsCommand } = await import("./statsCli-
|
|
158
|
-
const { bccliHome } = await import("./config-
|
|
157
|
+
const { runStatsCommand } = await import("./statsCli-EHNJIQ2Z.js");
|
|
158
|
+
const { bccliHome } = await import("./config-RZY3XQZJ.js");
|
|
159
159
|
return runStatsCommand(
|
|
160
160
|
{ subArgs: args.subArgs, home: bccliHome(process.env), cwd, days: args.days, tools: args.tools, models: args.models, project: args.project },
|
|
161
161
|
{ out: (s) => console.log(s), err: (s) => console.error(s) }
|
|
162
162
|
);
|
|
163
163
|
}
|
|
164
164
|
if (args.command === "export" || args.command === "import") {
|
|
165
|
-
const { runExportCommand, runImportCommand } = await import("./transferCli-
|
|
166
|
-
const { bccliHome } = await import("./config-
|
|
165
|
+
const { runExportCommand, runImportCommand } = await import("./transferCli-IXJ2O74Q.js");
|
|
166
|
+
const { bccliHome } = await import("./config-RZY3XQZJ.js");
|
|
167
167
|
const deps = { subArgs: args.subArgs, home: bccliHome(process.env), cwd };
|
|
168
168
|
const io = { out: (s) => console.log(s), err: (s) => console.error(s) };
|
|
169
169
|
return args.command === "export" ? runExportCommand(deps, io) : runImportCommand(deps, io);
|
|
170
170
|
}
|
|
171
171
|
if (args.command === "pr") {
|
|
172
|
-
const { runPrCommand } = await import("./prCli-
|
|
172
|
+
const { runPrCommand } = await import("./prCli-KSA73RCS.js");
|
|
173
173
|
return runPrCommand(
|
|
174
174
|
{
|
|
175
175
|
subArgs: args.subArgs,
|
|
@@ -199,7 +199,7 @@ async function main() {
|
|
|
199
199
|
}
|
|
200
200
|
const finalPrompt = resolvePrintPrompt(args.prompt, stdinText);
|
|
201
201
|
if (!finalPrompt) throw new ConfigError(t('-p mode needs a task, e.g. bccli -p "explain this repo"'));
|
|
202
|
-
const { serversToStart } = await import("./config-
|
|
202
|
+
const { serversToStart } = await import("./config-7TQ2KVVX.js");
|
|
203
203
|
const plan = serversToStart(rt.home, cwd);
|
|
204
204
|
for (const s of plan.needTrust) {
|
|
205
205
|
console.error(t('Project MCP server "{name}" skipped (not approved yet; run interactive bccli once to approve it).', { name: s.name }));
|
|
@@ -215,13 +215,13 @@ async function main() {
|
|
|
215
215
|
let updateMessage;
|
|
216
216
|
if (rt.config.updateCheck !== "off" && !process.env.BCCLI_NO_UPDATE_CHECK) {
|
|
217
217
|
try {
|
|
218
|
-
const { checkForUpdate } = await import("./update-
|
|
218
|
+
const { checkForUpdate } = await import("./update-TR62JV3A.js");
|
|
219
219
|
const update = await checkForUpdate({ home: rt.home, fetch: globalThis.fetch, now: /* @__PURE__ */ new Date() });
|
|
220
220
|
updateMessage = update;
|
|
221
221
|
} catch {
|
|
222
222
|
}
|
|
223
223
|
}
|
|
224
|
-
const { startInteractive } = await import("./ui-
|
|
224
|
+
const { startInteractive } = await import("./ui-A2LASWDK.js");
|
|
225
225
|
return startInteractive(rt, { initialPrompt: args.prompt, resume: args.resume, version: VERSION, updateMessage });
|
|
226
226
|
}
|
|
227
227
|
main().then(
|
|
@@ -9,9 +9,9 @@ import {
|
|
|
9
9
|
removeGlobalServer,
|
|
10
10
|
serversToStart,
|
|
11
11
|
setProjectTrust
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-2DFY43RP.js";
|
|
13
|
+
import "./chunk-C2FUGQJX.js";
|
|
14
|
+
import "./chunk-G5TG43R4.js";
|
|
15
15
|
export {
|
|
16
16
|
addGlobalServer,
|
|
17
17
|
expandEnvVars,
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
createRuntime
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-6BXW7DGQ.js";
|
|
5
5
|
import "./chunk-OK2USAXX.js";
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-OAXD3X4R.js";
|
|
7
|
+
import "./chunk-6KZIOICR.js";
|
|
8
8
|
import "./chunk-PSO7R5AD.js";
|
|
9
9
|
import {
|
|
10
10
|
LOOPBACK_BIND,
|
|
11
11
|
parseCliArgs
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-
|
|
20
|
-
import "./chunk-
|
|
21
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-WSZF2CTU.js";
|
|
13
|
+
import "./chunk-YYTFJUO2.js";
|
|
14
|
+
import "./chunk-JFYQCPXL.js";
|
|
15
|
+
import "./chunk-Y6AZGGH7.js";
|
|
16
|
+
import "./chunk-X24APPXO.js";
|
|
17
|
+
import "./chunk-IHQGXDSG.js";
|
|
18
|
+
import "./chunk-F54FDJBD.js";
|
|
19
|
+
import "./chunk-OOOS5RCT.js";
|
|
20
|
+
import "./chunk-XZ2TI5HV.js";
|
|
21
|
+
import "./chunk-2DFY43RP.js";
|
|
22
22
|
import {
|
|
23
23
|
ConfigError,
|
|
24
24
|
globalConfigPath,
|
|
25
25
|
readJsonConfig
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-C2FUGQJX.js";
|
|
27
27
|
import {
|
|
28
28
|
t
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-G5TG43R4.js";
|
|
30
30
|
|
|
31
31
|
// src/ghBotWebhook.ts
|
|
32
32
|
import { createHmac, timingSafeEqual } from "crypto";
|
|
@@ -531,8 +531,10 @@ function makeRunJob(o, cfg, gh) {
|
|
|
531
531
|
provider: o.provider,
|
|
532
532
|
fetch: o.fetch ?? globalThis.fetch,
|
|
533
533
|
// injectable (review #3)
|
|
534
|
-
maxSteps: cfg.stepLimit
|
|
534
|
+
maxSteps: cfg.stepLimit,
|
|
535
535
|
// the knob the Agent actually uses
|
|
536
|
+
// A draft is one-shot: no session log (and no file per webhook comment).
|
|
537
|
+
persistSession: false
|
|
536
538
|
});
|
|
537
539
|
rt.agent.setSystemPrompt(ghSystemPrompt());
|
|
538
540
|
rt.agent.setTools([]);
|
|
@@ -5,13 +5,14 @@ import {
|
|
|
5
5
|
loadConfig,
|
|
6
6
|
readCredentials,
|
|
7
7
|
resolveModel
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-C2FUGQJX.js";
|
|
9
9
|
import {
|
|
10
10
|
t
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-G5TG43R4.js";
|
|
12
12
|
|
|
13
13
|
// src/integrationCli.ts
|
|
14
14
|
import { chmodSync, copyFileSync, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "fs";
|
|
15
|
+
import { createHash } from "crypto";
|
|
15
16
|
import { dirname, join } from "path";
|
|
16
17
|
import { parseDocument } from "yaml";
|
|
17
18
|
var BASE_URL = "https://api.botconnector.id/v1";
|
|
@@ -67,9 +68,20 @@ function safeBackup(path, env) {
|
|
|
67
68
|
function writeState(target, state, env) {
|
|
68
69
|
const path = statePath(target, env);
|
|
69
70
|
mkdirSync(dirname(path), { recursive: true });
|
|
70
|
-
|
|
71
|
+
const files = state.files.map((file) => {
|
|
72
|
+
const hash = hashFile(file.path);
|
|
73
|
+
return hash ? { ...file, hash } : file;
|
|
74
|
+
});
|
|
75
|
+
writeFileSync(path, `${JSON.stringify({ ...state, files }, null, 2)}
|
|
71
76
|
`, { mode: 384 });
|
|
72
77
|
}
|
|
78
|
+
function hashFile(path) {
|
|
79
|
+
try {
|
|
80
|
+
return createHash("sha256").update(readFileSync(path)).digest("hex");
|
|
81
|
+
} catch {
|
|
82
|
+
return void 0;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
73
85
|
function readState(target, env) {
|
|
74
86
|
const path = statePath(target, env);
|
|
75
87
|
if (!existsSync(path)) return null;
|
|
@@ -622,7 +634,14 @@ async function connectHermes(deps) {
|
|
|
622
634
|
discover_models: true,
|
|
623
635
|
models: Object.fromEntries(models.map((id) => [id, {}]))
|
|
624
636
|
});
|
|
625
|
-
|
|
637
|
+
const providerRef = `custom:${HERMES_PROVIDER_ID}`;
|
|
638
|
+
const currentModel = doc.getIn(["model"]);
|
|
639
|
+
if (currentModel && typeof currentModel === "object" && !Array.isArray(currentModel)) {
|
|
640
|
+
doc.setIn(["model", "default"], model);
|
|
641
|
+
doc.setIn(["model", "provider"], providerRef);
|
|
642
|
+
} else {
|
|
643
|
+
doc.setIn(["model"], { default: model, provider: providerRef });
|
|
644
|
+
}
|
|
626
645
|
mkdirSync(hermesHome, { recursive: true });
|
|
627
646
|
writeFileSync(path, doc.toString());
|
|
628
647
|
writeState("hermes", {
|
|
@@ -640,7 +659,18 @@ function disconnect(target, deps) {
|
|
|
640
659
|
deps.out(t("{target}: not managed by BCCLI yet.", { target }));
|
|
641
660
|
return;
|
|
642
661
|
}
|
|
662
|
+
let leftBehind = 0;
|
|
643
663
|
for (const file of [...state.files].reverse()) {
|
|
664
|
+
if (file.hash !== void 0 && hashFile(file.path) !== file.hash) {
|
|
665
|
+
leftBehind++;
|
|
666
|
+
deps.err(
|
|
667
|
+
t(
|
|
668
|
+
'{target}: {path} changed after BCCLI connected it, so the old backup was not copied over it. Remove the BCCLI part (provider "botconnector" or the marked block) from that file by hand.',
|
|
669
|
+
{ target, path: file.path }
|
|
670
|
+
)
|
|
671
|
+
);
|
|
672
|
+
continue;
|
|
673
|
+
}
|
|
644
674
|
if (file.backup && existsSync(file.backup)) {
|
|
645
675
|
mkdirSync(dirname(file.path), { recursive: true });
|
|
646
676
|
copyFileSync(file.backup, file.path);
|
|
@@ -649,7 +679,12 @@ function disconnect(target, deps) {
|
|
|
649
679
|
}
|
|
650
680
|
}
|
|
651
681
|
rmSync(statePath(target, deps.env), { force: true });
|
|
652
|
-
deps.out(
|
|
682
|
+
deps.out(
|
|
683
|
+
leftBehind ? t(
|
|
684
|
+
"{target}: the BotConnector integration was removed. {n} file(s) were left untouched (see above); delete the BCCLI entries in them by hand for a clean removal.",
|
|
685
|
+
{ target, n: String(leftBehind) }
|
|
686
|
+
) : t("{target}: the BotConnector integration was removed and the config restored.", { target })
|
|
687
|
+
);
|
|
653
688
|
}
|
|
654
689
|
function listIntegrations(deps) {
|
|
655
690
|
for (const target of ["opencode", "aider", "cline", "deepseek-harness", "cursor", "openai-cli", "openai-sdk", "openai-compatible", "codex", "claude-code", "openclaw", "hermes"]) {
|