@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,32 +1,32 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  createRuntime
4
- } from "./chunk-PZRKU4UM.js";
5
- import "./chunk-QZKLZELZ.js";
6
- import "./chunk-BGXNR74O.js";
7
- import "./chunk-45SDLMTV.js";
4
+ } from "./chunk-QNUJHKEL.js";
5
+ import "./chunk-OK2USAXX.js";
6
+ import "./chunk-4W5SKQDC.js";
7
+ import "./chunk-JXM6REER.js";
8
8
  import "./chunk-PSO7R5AD.js";
9
9
  import {
10
10
  LOOPBACK_BIND,
11
11
  parseCliArgs
12
- } from "./chunk-XV7ZVL4J.js";
13
- import "./chunk-MHIYLXJC.js";
14
- import "./chunk-GN4W3T6E.js";
15
- import "./chunk-75BECX4F.js";
16
- import "./chunk-JHPGOAXU.js";
17
- import "./chunk-MFHCQQEN.js";
18
- import "./chunk-BC7UXFE4.js";
19
- import "./chunk-WNACAUDK.js";
20
- import "./chunk-BLOYFIAD.js";
21
- import "./chunk-24JN75FZ.js";
12
+ } from "./chunk-6UO5GX55.js";
13
+ import "./chunk-WFZKJY3R.js";
14
+ import "./chunk-GWVLPN4B.js";
15
+ import "./chunk-7I2ZGPUS.js";
16
+ import "./chunk-HQW4BROS.js";
17
+ import "./chunk-3I5BW3ZT.js";
18
+ import "./chunk-6AUROP2E.js";
19
+ import "./chunk-XTOATEI6.js";
20
+ import "./chunk-KPTML72Q.js";
21
+ import "./chunk-6M55UPES.js";
22
22
  import {
23
23
  ConfigError,
24
24
  globalConfigPath,
25
25
  readJsonConfig
26
- } from "./chunk-FLQPE4S5.js";
26
+ } from "./chunk-RX4UQX43.js";
27
27
  import {
28
28
  t
29
- } from "./chunk-UZWJQF67.js";
29
+ } from "./chunk-3WHI4LN3.js";
30
30
 
31
31
  // src/ghBotWebhook.ts
32
32
  import { createHmac, timingSafeEqual } from "crypto";
@@ -435,16 +435,17 @@ async function collectGhContext(d, deps) {
435
435
  ## diff (truncated)
436
436
  ${truncateHeadTailUtf8(diffRes.stdout, 1e5)}`;
437
437
  }
438
- const comment = truncateUtf8Bytes(d.body, 8192);
438
+ const sanitizeUntrusted = (s) => s.replace(/<\/untrusted-github>/gi, "&lt;/untrusted-github&gt;");
439
+ const comment = sanitizeUntrusted(truncateUtf8Bytes(d.body, 8192));
439
440
  const context = [
440
441
  "<untrusted-github>",
441
442
  `## Comment by ${d.author} (${d.repo}#${d.number})`,
442
443
  comment,
443
444
  "",
444
- `## Issue/PR title: ${title}`,
445
+ `## Issue/PR title: ${sanitizeUntrusted(title)}`,
445
446
  "## Issue/PR body",
446
- issueBody,
447
- diffBlock,
447
+ sanitizeUntrusted(issueBody),
448
+ sanitizeUntrusted(diffBlock),
448
449
  "</untrusted-github>",
449
450
  "",
450
451
  "Draft your reply to the comment above following your system rules."
@@ -5,10 +5,10 @@ import {
5
5
  loadConfig,
6
6
  readCredentials,
7
7
  resolveModel
8
- } from "./chunk-FLQPE4S5.js";
8
+ } from "./chunk-RX4UQX43.js";
9
9
  import {
10
10
  t
11
- } from "./chunk-UZWJQF67.js";
11
+ } from "./chunk-3WHI4LN3.js";
12
12
 
13
13
  // src/integrationCli.ts
14
14
  import { chmodSync, copyFileSync, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "fs";
@@ -4,10 +4,10 @@ import {
4
4
  readLine,
5
5
  readSecret,
6
6
  runLogin
7
- } from "./chunk-BXQQCUAC.js";
8
- import "./chunk-MFHCQQEN.js";
9
- import "./chunk-FLQPE4S5.js";
10
- import "./chunk-UZWJQF67.js";
7
+ } from "./chunk-Z5NI5FIK.js";
8
+ import "./chunk-3I5BW3ZT.js";
9
+ import "./chunk-RX4UQX43.js";
10
+ import "./chunk-3WHI4LN3.js";
11
11
  export {
12
12
  defaultLoginDeps,
13
13
  readLine,
package/dist/lsp.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ export declare function languageIdFor(file: string): string;
2
+ export declare function useShellForLsp(command: string, platform?: NodeJS.Platform): boolean;
1
3
  export interface LspServer {
2
4
  extensions: string[];
3
5
  command: string;
@@ -9,6 +11,19 @@ export interface LspDiagnostic {
9
11
  severity: number;
10
12
  message: string;
11
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
+ }
12
27
  interface LspRawDiagnostic {
13
28
  range?: {
14
29
  start?: {
@@ -43,5 +58,16 @@ export declare function getDiagnostics(opts: {
43
58
  cwd: string;
44
59
  file: string;
45
60
  timeoutMs?: number;
61
+ signal?: AbortSignal;
46
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;
47
73
  export {};
@@ -1,5 +1,23 @@
1
1
  import type { Tool } from '../tools/types';
2
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
+ };
3
21
  /** Safe env for spawned MCP servers: whitelist from the parent + the server's own config.env. */
4
22
  export declare function mcpChildEnv(extra?: Record<string, string>): Record<string, string>;
5
23
  export interface McpServerState {
@@ -2,30 +2,30 @@
2
2
  import {
3
3
  CATALOG,
4
4
  fillTemplate
5
- } from "./chunk-WI22M2ID.js";
5
+ } from "./chunk-NQOGVP3I.js";
6
6
  import {
7
7
  authorizeMcpServer,
8
8
  clearTokens
9
- } from "./chunk-MFHCQQEN.js";
9
+ } from "./chunk-3I5BW3ZT.js";
10
10
  import {
11
11
  addGlobalServer,
12
12
  globalMcpPath,
13
13
  readMcpFile,
14
14
  removeGlobalServer
15
- } from "./chunk-24JN75FZ.js";
15
+ } from "./chunk-6M55UPES.js";
16
16
  import {
17
17
  bccliHome
18
- } from "./chunk-FLQPE4S5.js";
18
+ } from "./chunk-RX4UQX43.js";
19
19
  import {
20
20
  t
21
- } from "./chunk-UZWJQF67.js";
21
+ } from "./chunk-3WHI4LN3.js";
22
22
 
23
23
  // src/mcpCli.ts
24
24
  async function runMcpCommand(args, deps) {
25
25
  const home = bccliHome(deps.env);
26
26
  const [action = "list", name] = args.subArgs;
27
27
  if (action === "serve") {
28
- const { runMcpServe } = await import("./serve-KWOECK5W.js");
28
+ const { runMcpServe } = await import("./serve-K5AH4MGO.js");
29
29
  return runMcpServe(args, deps);
30
30
  }
31
31
  const installed = readMcpFile(globalMcpPath(home));
@@ -1,17 +1,17 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  listAllModels
4
- } from "./chunk-75BECX4F.js";
5
- import "./chunk-JHPGOAXU.js";
6
- import "./chunk-WNACAUDK.js";
7
- import "./chunk-BLOYFIAD.js";
4
+ } from "./chunk-7I2ZGPUS.js";
5
+ import "./chunk-HQW4BROS.js";
6
+ import "./chunk-XTOATEI6.js";
7
+ import "./chunk-KPTML72Q.js";
8
8
  import {
9
9
  loadConfig,
10
10
  resolveModel
11
- } from "./chunk-FLQPE4S5.js";
11
+ } from "./chunk-RX4UQX43.js";
12
12
  import {
13
13
  t
14
- } from "./chunk-UZWJQF67.js";
14
+ } from "./chunk-3WHI4LN3.js";
15
15
 
16
16
  // src/modelsCli.ts
17
17
  async function runModelsCommand(args, deps) {
@@ -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/oauthLogin.ts
7
7
  import { createHash, randomBytes } from "crypto";
@@ -2,10 +2,10 @@
2
2
  import {
3
3
  bccliHome,
4
4
  globalConfigPath
5
- } from "./chunk-FLQPE4S5.js";
5
+ } from "./chunk-RX4UQX43.js";
6
6
  import {
7
7
  t
8
- } from "./chunk-UZWJQF67.js";
8
+ } from "./chunk-3WHI4LN3.js";
9
9
 
10
10
  // src/pluginsCli.ts
11
11
  import { existsSync, mkdirSync, readFileSync, statSync, writeFileSync } from "fs";
@@ -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/prCli.ts
7
7
  import { spawn } from "child_process";
@@ -21,7 +21,15 @@ function defaultGh(argv) {
21
21
  });
22
22
  }
23
23
  function prTaskArgv(entry, opts) {
24
- return [entry, ...opts.prompt ? ["-p", opts.prompt] : [], ...opts.allowAll ? ["--allow-all"] : []];
24
+ return [
25
+ entry,
26
+ ...opts.prompt ? ["-p", opts.prompt] : [],
27
+ ...opts.model ? ["-m", opts.model] : [],
28
+ ...opts.reasoning ? ["--reasoning", opts.reasoning] : [],
29
+ ...opts.permissionMode ? ["--permission-mode", opts.permissionMode] : [],
30
+ ...opts.allowedTools?.length ? ["--allowed-tools", opts.allowedTools.join(",")] : [],
31
+ ...opts.allowAll ? ["--allow-all"] : []
32
+ ];
25
33
  }
26
34
  async function defaultRunTask(opts) {
27
35
  const entry = process.argv[1];
@@ -38,7 +46,7 @@ async function defaultRunTask(opts) {
38
46
  }
39
47
  async function runPrCommand(args, deps) {
40
48
  const rest = [...args.subArgs];
41
- let repo;
49
+ let repo = args.repo;
42
50
  const words = [];
43
51
  for (let i = 0; i < rest.length; i++) {
44
52
  if (rest[i] === "--repo") {
@@ -70,7 +78,15 @@ async function runPrCommand(args, deps) {
70
78
  const runTask = deps.runTask ?? defaultRunTask;
71
79
  const allowAll = args.allowAll === true;
72
80
  if (allowAll) deps.err?.(t("--allow-all: the PR task runs every tool without asking"));
73
- return runTask({ prompt: task, allowAll, cwd: args.cwd });
81
+ return runTask({
82
+ prompt: task,
83
+ allowAll,
84
+ cwd: args.cwd,
85
+ ...args.model ? { model: args.model } : {},
86
+ ...args.reasoning ? { reasoning: args.reasoning } : {},
87
+ ...args.permissionMode ? { permissionMode: args.permissionMode } : {},
88
+ ...args.allowedTools?.length ? { allowedTools: args.allowedTools } : {}
89
+ });
74
90
  }
75
91
  export {
76
92
  prTaskArgv,
package/dist/prCli.d.ts CHANGED
@@ -3,6 +3,11 @@ export interface PrCliArgs {
3
3
  cwd: string;
4
4
  /** Set only when the user asked for `bccli pr … --allow-all`. */
5
5
  allowAll?: boolean;
6
+ repo?: string;
7
+ model?: string;
8
+ reasoning?: string;
9
+ permissionMode?: string;
10
+ allowedTools?: string[];
6
11
  }
7
12
  export interface PrDeps {
8
13
  out(line: string): void;
@@ -18,12 +23,20 @@ export interface PrDeps {
18
23
  prompt?: string;
19
24
  allowAll: boolean;
20
25
  cwd: string;
26
+ model?: string;
27
+ reasoning?: string;
28
+ permissionMode?: string;
29
+ allowedTools?: string[];
21
30
  }): Promise<number>;
22
31
  }
23
32
  /** argv for the child running the PR task; `--allow-all` only when the user asked for it. */
24
33
  export declare function prTaskArgv(entry: string, opts: {
25
34
  prompt?: string;
26
35
  allowAll?: boolean;
36
+ model?: string;
37
+ reasoning?: string;
38
+ permissionMode?: string;
39
+ allowedTools?: string[];
27
40
  }): string[];
28
41
  /**
29
42
  * `bccli pr <number> [--repo owner/name] [task]` — check out a GitHub PR
package/dist/print.d.ts CHANGED
@@ -4,6 +4,8 @@ interface Writer {
4
4
  }
5
5
  export declare function toolLabel(tool: string): string;
6
6
  export type OutputFormat = 'text' | 'json' | 'stream-json';
7
+ /** Combines an optional piped stdin payload with the `-p` prompt argument. */
8
+ export declare function resolvePrintPrompt(prompt: string | undefined, stdinText: string | undefined): string | undefined;
7
9
  export declare function runPrint(rt: Runtime, prompt: string, io?: {
8
10
  out: Writer;
9
11
  err: Writer;
@@ -137,4 +137,9 @@ export declare function responseContinuationInput(messages: ChatMessage[], conti
137
137
  incremental: boolean;
138
138
  };
139
139
  export declare function createProvider(options: ProviderOptions): Provider;
140
+ /**
141
+ * Wraps a primary provider with automatic fallback providers tried in order when the primary
142
+ * fails before emitting any text (e.g. HTTP 429 rate-limit/quota, 5xx, or connection failure).
143
+ */
144
+ export declare function withFallbackProvider(primary: Provider, fallbacks: () => Provider[]): Provider;
140
145
  export {};
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ addProviderKey,
4
+ runProviderCommand
5
+ } from "./chunk-GWVLPN4B.js";
6
+ import "./chunk-7I2ZGPUS.js";
7
+ import "./chunk-HQW4BROS.js";
8
+ import "./chunk-XTOATEI6.js";
9
+ import "./chunk-KPTML72Q.js";
10
+ import "./chunk-RX4UQX43.js";
11
+ import "./chunk-3WHI4LN3.js";
12
+ export {
13
+ addProviderKey,
14
+ runProviderCommand
15
+ };
package/dist/sdk.d.ts CHANGED
@@ -26,7 +26,8 @@ export interface SdkResult {
26
26
  inputTokens: number;
27
27
  outputTokens: number;
28
28
  };
29
- stopReason: 'done' | 'stepLimit' | 'aborted' | 'budgetExceeded';
29
+ stopReason: 'done' | 'stepLimit' | 'aborted' | 'budgetExceeded' | 'error';
30
+ error?: string;
30
31
  }
31
32
  export type SdkEvent = {
32
33
  type: 'text';
@@ -48,6 +49,9 @@ export type SdkEvent = {
48
49
  type: 'usage';
49
50
  inputTokens: number;
50
51
  outputTokens: number;
52
+ } | {
53
+ type: 'error';
54
+ message: string;
51
55
  } | {
52
56
  type: 'result';
53
57
  result: SdkResult;