@botconnector/bccli 0.4.1 → 0.4.3
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-3PHBAI64.js → acp-NU4HZHQO.js} +30 -6
- package/dist/acp.d.ts +1 -0
- package/dist/agent.d.ts +5 -1
- package/dist/args-NRTZWWEV.js +13 -0
- package/dist/args.d.ts +2 -0
- package/dist/checkpoints.d.ts +1 -0
- package/dist/{chunk-MFHCQQEN.js → chunk-3I5BW3ZT.js} +3 -2
- package/dist/{chunk-UZWJQF67.js → chunk-3WHI4LN3.js} +2 -1
- package/dist/{chunk-BGXNR74O.js → chunk-4W5SKQDC.js} +152 -31
- package/dist/{chunk-BC7UXFE4.js → chunk-6AUROP2E.js} +64 -3
- package/dist/{chunk-24JN75FZ.js → chunk-6M55UPES.js} +2 -2
- package/dist/{chunk-XV7ZVL4J.js → chunk-6UO5GX55.js} +26 -12
- package/dist/{chunk-75BECX4F.js → chunk-7I2ZGPUS.js} +4 -4
- package/dist/{chunk-BKGFA2PT.js → chunk-FUJGHCWN.js} +1 -1
- package/dist/{chunk-GN4W3T6E.js → chunk-GWVLPN4B.js} +4 -4
- package/dist/{chunk-JHPGOAXU.js → chunk-HQW4BROS.js} +4 -5
- package/dist/{chunk-45SDLMTV.js → chunk-JXM6REER.js} +1 -1
- package/dist/{chunk-BLOYFIAD.js → chunk-KPTML72Q.js} +1 -1
- package/dist/{chunk-WI22M2ID.js → chunk-NQOGVP3I.js} +2 -2
- package/dist/{chunk-QZKLZELZ.js → chunk-OK2USAXX.js} +28 -4
- package/dist/{chunk-PZRKU4UM.js → chunk-QNUJHKEL.js} +659 -162
- package/dist/{chunk-FLQPE4S5.js → chunk-RX4UQX43.js} +4 -1
- package/dist/{chunk-R5RE46CW.js → chunk-WDX62DFH.js} +40 -6
- package/dist/{chunk-MHIYLXJC.js → chunk-WFZKJY3R.js} +8 -4
- package/dist/{chunk-WNACAUDK.js → chunk-XTOATEI6.js} +66 -9
- package/dist/{chunk-BXQQCUAC.js → chunk-Z5NI5FIK.js} +7 -7
- package/dist/cli.js +60 -43
- package/dist/{completion-HPPFDAPB.js → completion-D2BSBTQO.js} +1 -1
- package/dist/{config-DIDLDONU.js → config-ENDRMOTP.js} +3 -3
- package/dist/{config-IU76CPK2.js → config-LAINORU5.js} +2 -2
- package/dist/config.d.ts +2 -0
- package/dist/{ghBotCli-E3VPHNZY.js → ghBotCli-GCIUUMKQ.js} +21 -20
- package/dist/{integrationCli-Q2YPDTPG.js → integrationCli-HXCSEWH2.js} +2 -2
- package/dist/{login-FP3BB44A.js → login-YXSSB2HQ.js} +4 -4
- package/dist/lsp.d.ts +26 -0
- package/dist/mcp/manager.d.ts +18 -0
- package/dist/{mcpCli-SNBDUWJN.js → mcpCli-SETTCL3K.js} +6 -6
- package/dist/{modelsCli-CZ2HNGKR.js → modelsCli-656AKYZD.js} +6 -6
- package/dist/{oauthLogin-6FWQABJ7.js → oauthLogin-XWY7OHCG.js} +1 -1
- package/dist/{pluginsCli-LPIUUDWB.js → pluginsCli-ZQNKWZHJ.js} +2 -2
- package/dist/{prCli-5IMV3VNQ.js → prCli-6PUWTMTP.js} +20 -4
- package/dist/prCli.d.ts +13 -0
- package/dist/print.d.ts +2 -0
- package/dist/provider.d.ts +5 -0
- package/dist/providerCli-V2576JXE.js +15 -0
- package/dist/sdk.d.ts +5 -1
- package/dist/sdk.js +1003 -230
- package/dist/{serve-KWOECK5W.js → serve-K5AH4MGO.js} +3 -3
- package/dist/{serve-X2ZV4S5U.js → serve-XPAGXIGS.js} +17 -17
- package/dist/session-V2VCAF7E.js +12 -0
- package/dist/session.d.ts +3 -0
- package/dist/setup-HVVHOIL4.js +24 -0
- package/dist/slash/info.d.ts +1 -0
- package/dist/{statsCli-CF3R7ATL.js → statsCli-XR6BEZQQ.js} +2 -2
- package/dist/tokenBudget.d.ts +1 -1
- package/dist/tools/diagnostics.d.ts +8 -0
- package/dist/tools/edit.d.ts +7 -2
- package/dist/tools/grep.d.ts +14 -2
- package/dist/tools/ignore.d.ts +2 -2
- package/dist/tools/paths.d.ts +2 -0
- package/dist/tools/sandbox.d.ts +3 -0
- package/dist/{transferCli-YUFPI6AH.js → transferCli-C6XS6QYH.js} +8 -6
- package/dist/ui/complete.d.ts +5 -0
- package/dist/ui/vim.d.ts +1 -1
- package/dist/{ui-IVIFNUCC.js → ui-43C6Y57K.js} +199 -54
- package/dist/{update-TZ2G6KQ3.js → update-AVZO4XID.js} +2 -2
- package/package.json +1 -1
- package/dist/args-W6BNKY7K.js +0 -13
- package/dist/providerCli-NMUFXAAS.js +0 -15
- package/dist/session-GKEXDJKZ.js +0 -12
- package/dist/setup-OV3NWQN5.js +0 -24
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
MODE_ORDER
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-WFZKJY3R.js";
|
|
5
5
|
import {
|
|
6
6
|
REASONING_LEVELS,
|
|
7
7
|
isReasoningLevel
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-KPTML72Q.js";
|
|
9
9
|
import {
|
|
10
10
|
ConfigError
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-RX4UQX43.js";
|
|
12
12
|
import {
|
|
13
13
|
parseLang,
|
|
14
14
|
t
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-3WHI4LN3.js";
|
|
16
16
|
|
|
17
17
|
// src/args.ts
|
|
18
18
|
import { parseArgs } from "util";
|
|
@@ -41,9 +41,18 @@ var LOOPBACK_BIND = /* @__PURE__ */ new Set(["127.0.0.1", "localhost", "::1"]);
|
|
|
41
41
|
function trustFence(headers, port) {
|
|
42
42
|
const host = headers.host;
|
|
43
43
|
if (!host) return "missing Host header";
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
let hostname;
|
|
45
|
+
let hostPort;
|
|
46
|
+
if (host.startsWith("[")) {
|
|
47
|
+
const close = host.indexOf("]");
|
|
48
|
+
if (close === -1) return `non-loopback Host: ${host}`;
|
|
49
|
+
hostname = host.slice(0, close + 1);
|
|
50
|
+
hostPort = host[close + 1] === ":" ? Number(host.slice(close + 2)) : 80;
|
|
51
|
+
} else {
|
|
52
|
+
const sep = host.lastIndexOf(":");
|
|
53
|
+
hostname = sep > -1 ? host.slice(0, sep) : host;
|
|
54
|
+
hostPort = sep > -1 ? Number(host.slice(sep + 1)) : 80;
|
|
55
|
+
}
|
|
47
56
|
if (!LOOPBACK_HOSTS.has(hostname)) return `non-loopback Host: ${hostname}`;
|
|
48
57
|
if (hostPort !== port) return `Host port ${hostPort} does not match listener ${port}`;
|
|
49
58
|
if (headers.origin) {
|
|
@@ -111,9 +120,12 @@ Options:
|
|
|
111
120
|
-h, --help this help`;
|
|
112
121
|
var helpText = () => t(HELP);
|
|
113
122
|
function parseCliArgs(argv) {
|
|
114
|
-
const expanded = argv.map(
|
|
115
|
-
|
|
116
|
-
|
|
123
|
+
const expanded = argv.map((a, i) => {
|
|
124
|
+
const nextIsFlagOrEnd = i + 1 >= argv.length || argv[i + 1].startsWith("-");
|
|
125
|
+
if (a === "--models" && nextIsFlagOrEnd) return "--models=all";
|
|
126
|
+
if (a === "--project" && nextIsFlagOrEnd) return "--project=";
|
|
127
|
+
return a;
|
|
128
|
+
});
|
|
117
129
|
const { values, positionals } = parseArgs({
|
|
118
130
|
args: expanded,
|
|
119
131
|
allowPositionals: true,
|
|
@@ -145,7 +157,8 @@ function parseCliArgs(argv) {
|
|
|
145
157
|
tools: { type: "string" },
|
|
146
158
|
models: { type: "string" },
|
|
147
159
|
project: { type: "string" },
|
|
148
|
-
repo: { type: "string" }
|
|
160
|
+
repo: { type: "string" },
|
|
161
|
+
"fallback-model": { type: "string" }
|
|
149
162
|
}
|
|
150
163
|
});
|
|
151
164
|
const reasoning = values.reasoning;
|
|
@@ -219,7 +232,8 @@ function parseCliArgs(argv) {
|
|
|
219
232
|
tools,
|
|
220
233
|
models,
|
|
221
234
|
project: values.project,
|
|
222
|
-
repo: values.repo
|
|
235
|
+
repo: values.repo,
|
|
236
|
+
fallbackModel: values["fallback-model"]
|
|
223
237
|
};
|
|
224
238
|
}
|
|
225
239
|
|
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
import {
|
|
3
3
|
hasKey,
|
|
4
4
|
providerName
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-HQW4BROS.js";
|
|
6
6
|
import {
|
|
7
7
|
createProvider
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-XTOATEI6.js";
|
|
9
9
|
import {
|
|
10
10
|
PRESETS,
|
|
11
11
|
readCredentials
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-RX4UQX43.js";
|
|
13
13
|
import {
|
|
14
14
|
t
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-3WHI4LN3.js";
|
|
16
16
|
|
|
17
17
|
// src/models.ts
|
|
18
18
|
function order(ids) {
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
listAllModels
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-7I2ZGPUS.js";
|
|
5
5
|
import {
|
|
6
6
|
hasKey,
|
|
7
7
|
providerName,
|
|
8
8
|
removeGlobalProvider,
|
|
9
9
|
writeGlobalConfig
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-HQW4BROS.js";
|
|
11
11
|
import {
|
|
12
12
|
PRESETS,
|
|
13
13
|
loadConfig,
|
|
14
14
|
saveCredential
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-RX4UQX43.js";
|
|
16
16
|
import {
|
|
17
17
|
t
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-3WHI4LN3.js";
|
|
19
19
|
|
|
20
20
|
// src/providerCli.ts
|
|
21
21
|
async function addProviderKey(providerId, key, deps) {
|
|
@@ -4,11 +4,11 @@ import {
|
|
|
4
4
|
bccliHome,
|
|
5
5
|
readCredentials,
|
|
6
6
|
readJsonConfig,
|
|
7
|
-
removeCredential
|
|
8
|
-
|
|
7
|
+
removeCredential,
|
|
8
|
+
writeFileAtomic
|
|
9
|
+
} from "./chunk-RX4UQX43.js";
|
|
9
10
|
|
|
10
11
|
// src/providers.ts
|
|
11
|
-
import { mkdirSync, writeFileSync } from "fs";
|
|
12
12
|
import { join } from "path";
|
|
13
13
|
function providerName(config, id) {
|
|
14
14
|
return PRESETS.find((p) => p.id === id)?.name ?? config.providers[id]?.name ?? id;
|
|
@@ -24,8 +24,7 @@ function readGlobalConfigFile(env = process.env) {
|
|
|
24
24
|
return readJsonConfig(globalPath(env));
|
|
25
25
|
}
|
|
26
26
|
function save(data, env) {
|
|
27
|
-
|
|
28
|
-
writeFileSync(globalPath(env), `${JSON.stringify(data, null, 2)}
|
|
27
|
+
writeFileAtomic(globalPath(env), `${JSON.stringify(data, null, 2)}
|
|
29
28
|
`);
|
|
30
29
|
}
|
|
31
30
|
function writeGlobalConfig(patch, env = process.env) {
|
|
@@ -1,12 +1,36 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/tokenBudget.ts
|
|
4
|
+
var IMAGE_TOKEN_COST = 1e3;
|
|
4
5
|
var estimateTokens = (text) => Math.ceil(text.length / 4);
|
|
5
|
-
|
|
6
|
+
function isImageAttachmentMessage(m) {
|
|
7
|
+
if (m.role !== "user" || !Array.isArray(m.content)) return false;
|
|
8
|
+
const hasImage = m.content.some((p) => p.type === "image_url");
|
|
9
|
+
const firstText = m.content.find((p) => p.type === "text");
|
|
10
|
+
return hasImage && !!firstText && firstText.type === "text" && firstText.text.startsWith("Image read from ");
|
|
11
|
+
}
|
|
12
|
+
function isUserTurnBoundary(m) {
|
|
13
|
+
return m.role === "user" && !isImageAttachmentMessage(m);
|
|
14
|
+
}
|
|
15
|
+
function estimateMessages(messages) {
|
|
16
|
+
let total = 0;
|
|
17
|
+
for (const m of messages) {
|
|
18
|
+
if (m.role === "user" && Array.isArray(m.content)) {
|
|
19
|
+
for (const part of m.content) {
|
|
20
|
+
if (part.type === "image_url") total += IMAGE_TOKEN_COST;
|
|
21
|
+
else total += estimateTokens(part.text);
|
|
22
|
+
}
|
|
23
|
+
total += 8;
|
|
24
|
+
} else {
|
|
25
|
+
total += estimateTokens(JSON.stringify(m));
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return total;
|
|
29
|
+
}
|
|
6
30
|
function trimToFit(messages, maxTokens) {
|
|
7
31
|
let out = messages;
|
|
8
32
|
while (estimateMessages(out) > maxTokens) {
|
|
9
|
-
const boundary = out.findIndex((m, i) => i > 0 && m
|
|
33
|
+
const boundary = out.findIndex((m, i) => i > 0 && isUserTurnBoundary(m));
|
|
10
34
|
if (boundary === -1) return out;
|
|
11
35
|
out = out.slice(boundary);
|
|
12
36
|
}
|
|
@@ -16,13 +40,13 @@ function splitKeepRecent(messages, keepTokens) {
|
|
|
16
40
|
if (messages.length === 0) return [[], []];
|
|
17
41
|
let start = messages.length;
|
|
18
42
|
for (let i = messages.length - 1; i >= 0; i--) {
|
|
19
|
-
if (i > 0 && messages[i]
|
|
43
|
+
if (i > 0 && !isUserTurnBoundary(messages[i])) continue;
|
|
20
44
|
if (estimateMessages(messages.slice(i)) <= keepTokens) start = i;
|
|
21
45
|
else break;
|
|
22
46
|
}
|
|
23
47
|
if (start === messages.length) {
|
|
24
48
|
for (let i = messages.length - 1; i >= 0; i--) {
|
|
25
|
-
if (messages[i]
|
|
49
|
+
if (isUserTurnBoundary(messages[i])) {
|
|
26
50
|
start = i;
|
|
27
51
|
break;
|
|
28
52
|
}
|