@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.
Files changed (71) hide show
  1. package/dist/{acp-3PHBAI64.js → acp-NU4HZHQO.js} +30 -6
  2. package/dist/acp.d.ts +1 -0
  3. package/dist/agent.d.ts +5 -1
  4. package/dist/args-NRTZWWEV.js +13 -0
  5. package/dist/args.d.ts +2 -0
  6. package/dist/checkpoints.d.ts +1 -0
  7. package/dist/{chunk-MFHCQQEN.js → chunk-3I5BW3ZT.js} +3 -2
  8. package/dist/{chunk-UZWJQF67.js → chunk-3WHI4LN3.js} +2 -1
  9. package/dist/{chunk-BGXNR74O.js → chunk-4W5SKQDC.js} +152 -31
  10. package/dist/{chunk-BC7UXFE4.js → chunk-6AUROP2E.js} +64 -3
  11. package/dist/{chunk-24JN75FZ.js → chunk-6M55UPES.js} +2 -2
  12. package/dist/{chunk-XV7ZVL4J.js → chunk-6UO5GX55.js} +26 -12
  13. package/dist/{chunk-75BECX4F.js → chunk-7I2ZGPUS.js} +4 -4
  14. package/dist/{chunk-BKGFA2PT.js → chunk-FUJGHCWN.js} +1 -1
  15. package/dist/{chunk-GN4W3T6E.js → chunk-GWVLPN4B.js} +4 -4
  16. package/dist/{chunk-JHPGOAXU.js → chunk-HQW4BROS.js} +4 -5
  17. package/dist/{chunk-45SDLMTV.js → chunk-JXM6REER.js} +1 -1
  18. package/dist/{chunk-BLOYFIAD.js → chunk-KPTML72Q.js} +1 -1
  19. package/dist/{chunk-WI22M2ID.js → chunk-NQOGVP3I.js} +2 -2
  20. package/dist/{chunk-QZKLZELZ.js → chunk-OK2USAXX.js} +28 -4
  21. package/dist/{chunk-PZRKU4UM.js → chunk-QNUJHKEL.js} +659 -162
  22. package/dist/{chunk-FLQPE4S5.js → chunk-RX4UQX43.js} +4 -1
  23. package/dist/{chunk-R5RE46CW.js → chunk-WDX62DFH.js} +40 -6
  24. package/dist/{chunk-MHIYLXJC.js → chunk-WFZKJY3R.js} +8 -4
  25. package/dist/{chunk-WNACAUDK.js → chunk-XTOATEI6.js} +66 -9
  26. package/dist/{chunk-BXQQCUAC.js → chunk-Z5NI5FIK.js} +7 -7
  27. package/dist/cli.js +60 -43
  28. package/dist/{completion-HPPFDAPB.js → completion-D2BSBTQO.js} +1 -1
  29. package/dist/{config-DIDLDONU.js → config-ENDRMOTP.js} +3 -3
  30. package/dist/{config-IU76CPK2.js → config-LAINORU5.js} +2 -2
  31. package/dist/config.d.ts +2 -0
  32. package/dist/{ghBotCli-E3VPHNZY.js → ghBotCli-GCIUUMKQ.js} +21 -20
  33. package/dist/{integrationCli-Q2YPDTPG.js → integrationCli-HXCSEWH2.js} +2 -2
  34. package/dist/{login-FP3BB44A.js → login-YXSSB2HQ.js} +4 -4
  35. package/dist/lsp.d.ts +26 -0
  36. package/dist/mcp/manager.d.ts +18 -0
  37. package/dist/{mcpCli-SNBDUWJN.js → mcpCli-SETTCL3K.js} +6 -6
  38. package/dist/{modelsCli-CZ2HNGKR.js → modelsCli-656AKYZD.js} +6 -6
  39. package/dist/{oauthLogin-6FWQABJ7.js → oauthLogin-XWY7OHCG.js} +1 -1
  40. package/dist/{pluginsCli-LPIUUDWB.js → pluginsCli-ZQNKWZHJ.js} +2 -2
  41. package/dist/{prCli-5IMV3VNQ.js → prCli-6PUWTMTP.js} +20 -4
  42. package/dist/prCli.d.ts +13 -0
  43. package/dist/print.d.ts +2 -0
  44. package/dist/provider.d.ts +5 -0
  45. package/dist/providerCli-V2576JXE.js +15 -0
  46. package/dist/sdk.d.ts +5 -1
  47. package/dist/sdk.js +1003 -230
  48. package/dist/{serve-KWOECK5W.js → serve-K5AH4MGO.js} +3 -3
  49. package/dist/{serve-X2ZV4S5U.js → serve-XPAGXIGS.js} +17 -17
  50. package/dist/session-V2VCAF7E.js +12 -0
  51. package/dist/session.d.ts +3 -0
  52. package/dist/setup-HVVHOIL4.js +24 -0
  53. package/dist/slash/info.d.ts +1 -0
  54. package/dist/{statsCli-CF3R7ATL.js → statsCli-XR6BEZQQ.js} +2 -2
  55. package/dist/tokenBudget.d.ts +1 -1
  56. package/dist/tools/diagnostics.d.ts +8 -0
  57. package/dist/tools/edit.d.ts +7 -2
  58. package/dist/tools/grep.d.ts +14 -2
  59. package/dist/tools/ignore.d.ts +2 -2
  60. package/dist/tools/paths.d.ts +2 -0
  61. package/dist/tools/sandbox.d.ts +3 -0
  62. package/dist/{transferCli-YUFPI6AH.js → transferCli-C6XS6QYH.js} +8 -6
  63. package/dist/ui/complete.d.ts +5 -0
  64. package/dist/ui/vim.d.ts +1 -1
  65. package/dist/{ui-IVIFNUCC.js → ui-43C6Y57K.js} +199 -54
  66. package/dist/{update-TZ2G6KQ3.js → update-AVZO4XID.js} +2 -2
  67. package/package.json +1 -1
  68. package/dist/args-W6BNKY7K.js +0 -13
  69. package/dist/providerCli-NMUFXAAS.js +0 -15
  70. package/dist/session-GKEXDJKZ.js +0 -12
  71. 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-MHIYLXJC.js";
4
+ } from "./chunk-WFZKJY3R.js";
5
5
  import {
6
6
  REASONING_LEVELS,
7
7
  isReasoningLevel
8
- } from "./chunk-BLOYFIAD.js";
8
+ } from "./chunk-KPTML72Q.js";
9
9
  import {
10
10
  ConfigError
11
- } from "./chunk-FLQPE4S5.js";
11
+ } from "./chunk-RX4UQX43.js";
12
12
  import {
13
13
  parseLang,
14
14
  t
15
- } from "./chunk-UZWJQF67.js";
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
- const sep = host.lastIndexOf(":");
45
- const hostname = sep > -1 ? host.slice(0, sep) : host;
46
- const hostPort = sep > -1 ? Number(host.slice(sep + 1)) : 80;
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
- (a, i) => a === "--models" && (i + 1 >= argv.length || argv[i + 1].startsWith("-")) ? "--models=all" : a
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-JHPGOAXU.js";
5
+ } from "./chunk-HQW4BROS.js";
6
6
  import {
7
7
  createProvider
8
- } from "./chunk-WNACAUDK.js";
8
+ } from "./chunk-XTOATEI6.js";
9
9
  import {
10
10
  PRESETS,
11
11
  readCredentials
12
- } from "./chunk-FLQPE4S5.js";
12
+ } from "./chunk-RX4UQX43.js";
13
13
  import {
14
14
  t
15
- } from "./chunk-UZWJQF67.js";
15
+ } from "./chunk-3WHI4LN3.js";
16
16
 
17
17
  // src/models.ts
18
18
  function order(ids) {
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/version.ts
4
- var VERSION = true ? "0.4.1" : "0.0.0-dev";
4
+ var VERSION = true ? "0.4.3" : "0.0.0-dev";
5
5
 
6
6
  export {
7
7
  VERSION
@@ -1,21 +1,21 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  listAllModels
4
- } from "./chunk-75BECX4F.js";
4
+ } from "./chunk-7I2ZGPUS.js";
5
5
  import {
6
6
  hasKey,
7
7
  providerName,
8
8
  removeGlobalProvider,
9
9
  writeGlobalConfig
10
- } from "./chunk-JHPGOAXU.js";
10
+ } from "./chunk-HQW4BROS.js";
11
11
  import {
12
12
  PRESETS,
13
13
  loadConfig,
14
14
  saveCredential
15
- } from "./chunk-FLQPE4S5.js";
15
+ } from "./chunk-RX4UQX43.js";
16
16
  import {
17
17
  t
18
- } from "./chunk-UZWJQF67.js";
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
- } from "./chunk-FLQPE4S5.js";
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
- mkdirSync(bccliHome(env), { recursive: true });
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) {
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-PSO7R5AD.js";
5
5
  import {
6
6
  t
7
- } from "./chunk-UZWJQF67.js";
7
+ } from "./chunk-3WHI4LN3.js";
8
8
 
9
9
  // src/tools/websearch.ts
10
10
  import { z } from "zod";
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  t
4
- } from "./chunk-UZWJQF67.js";
4
+ } from "./chunk-3WHI4LN3.js";
5
5
 
6
6
  // src/reasoning.ts
7
7
  var REASONING_LEVELS = ["auto", "off", "low", "medium", "high", "max"];
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  ConfigError
4
- } from "./chunk-FLQPE4S5.js";
4
+ } from "./chunk-RX4UQX43.js";
5
5
  import {
6
6
  t
7
- } from "./chunk-UZWJQF67.js";
7
+ } from "./chunk-3WHI4LN3.js";
8
8
 
9
9
  // src/mcp/catalog.ts
10
10
  var CATALOG = [
@@ -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
- var estimateMessages = (messages) => estimateTokens(JSON.stringify(messages));
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.role === "user");
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].role !== "user") continue;
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].role === "user") {
49
+ if (isUserTurnBoundary(messages[i])) {
26
50
  start = i;
27
51
  break;
28
52
  }