@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,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/config.ts
7
7
  import { chmodSync, existsSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "fs";
@@ -236,8 +236,11 @@ function loadConfig(cwd, env = process.env) {
236
236
  const project = readJsonConfig(join(cwd, ".bccli", "config.json"));
237
237
  const known = { ...DEFAULT_CONFIG.providers, ...global.providers };
238
238
  const fromProject = untrustedProviders(project, known);
239
+ const rawFallbacks = project.fallbackModels ?? global.fallbackModels;
240
+ const fallbackModels = Array.isArray(rawFallbacks) ? rawFallbacks.filter((m) => typeof m === "string" && m.includes("/")) : void 0;
239
241
  return {
240
242
  model: project.model ?? global.model ?? DEFAULT_CONFIG.model,
243
+ ...fallbackModels?.length ? { fallbackModels } : {},
241
244
  permissionMode: global.permissionMode ?? DEFAULT_CONFIG.permissionMode,
242
245
  reasoning: global.reasoning ?? DEFAULT_CONFIG.reasoning,
243
246
  thinkingVisible: global.thinkingVisible === true,
@@ -2,13 +2,13 @@
2
2
  import {
3
3
  runCommand,
4
4
  runHooks
5
- } from "./chunk-BGXNR74O.js";
5
+ } from "./chunk-4W5SKQDC.js";
6
6
  import {
7
7
  ConfigError
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/verify.ts
14
14
  var MAX_VERIFY_ROUNDS = 2;
@@ -40,10 +40,19 @@ function toolLabel(tool) {
40
40
  if (tool === "web_search") return "Search";
41
41
  return tool.charAt(0).toUpperCase() + tool.slice(1);
42
42
  }
43
+ function resolvePrintPrompt(prompt, stdinText) {
44
+ const cleanStdin = stdinText?.trim();
45
+ const cleanPrompt = prompt?.trim();
46
+ if (cleanStdin && cleanPrompt) return `${cleanStdin}
47
+
48
+ ${cleanPrompt}`;
49
+ return cleanPrompt || cleanStdin || void 0;
50
+ }
43
51
  async function runPrint(rt, prompt, io = { out: process.stdout, err: process.stderr }, opts = {}) {
44
52
  const format = opts.outputFormat ?? "text";
45
53
  const emit = (line) => io.out.write(`${JSON.stringify(line)}
46
54
  `);
55
+ const startedMs = Date.now();
47
56
  let result = "";
48
57
  const toolNames = /* @__PURE__ */ new Map();
49
58
  rt.interaction.approvePlan = async () => {
@@ -63,8 +72,15 @@ async function runPrint(rt, prompt, io = { out: process.stdout, err: process.std
63
72
  wroteText = true;
64
73
  } else {
65
74
  result += event.delta;
75
+ if (format === "stream-json") emit({ type: "text_delta", delta: event.delta });
66
76
  }
67
77
  break;
78
+ case "thinking":
79
+ if (format === "stream-json") emit({ type: "thinking_delta", delta: event.delta });
80
+ break;
81
+ case "textReplace":
82
+ result = event.text;
83
+ break;
68
84
  case "toolStart":
69
85
  toolNames.set(event.id, event.tool);
70
86
  io.err.write(`\u23BF ${toolLabel(event.tool)} ${event.target}
@@ -142,12 +158,29 @@ async function runPrint(rt, prompt, io = { out: process.stdout, err: process.std
142
158
  for (const warning of stop.warnings) io.err.write(`${warning}
143
159
  `);
144
160
  await rt.emitPlugins("Stop");
161
+ const durationMs = Math.max(0, Date.now() - startedMs);
145
162
  if (format === "json") {
146
- io.out.write(`${JSON.stringify({ status: failed ? "failed" : "ok", model: rt.modelRef, result })}
147
- `);
163
+ io.out.write(
164
+ `${JSON.stringify({
165
+ status: failed ? "failed" : "ok",
166
+ model: rt.modelRef,
167
+ session_id: rt.session.id,
168
+ usage: rt.agent.totalUsage,
169
+ duration_ms: durationMs,
170
+ result
171
+ })}
172
+ `
173
+ );
148
174
  } else if (format === "stream-json") {
149
175
  if (result) emit({ type: "message", text: result });
150
- emit({ type: "result", status: failed ? "failed" : "ok", model: rt.modelRef });
176
+ emit({
177
+ type: "result",
178
+ status: failed ? "failed" : "ok",
179
+ model: rt.modelRef,
180
+ session_id: rt.session.id,
181
+ usage: rt.agent.totalUsage,
182
+ duration_ms: durationMs
183
+ });
151
184
  } else if (wroteText) {
152
185
  io.out.write("\n");
153
186
  }
@@ -225,6 +258,7 @@ export {
225
258
  runVerify,
226
259
  verifyFollowup,
227
260
  toolLabel,
261
+ resolvePrintPrompt,
228
262
  runPrint,
229
263
  resolveWorktree,
230
264
  worktreeListText
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/permissions.ts
4
- import { isAbsolute, relative, resolve, sep } from "path";
4
+ import { isAbsolute, relative, resolve } from "path";
5
5
  var MODE_ORDER = ["default", "acceptEdits", "plan", "allowAll"];
6
6
  function nextMode(mode) {
7
7
  return MODE_ORDER[(MODE_ORDER.indexOf(mode) + 1) % MODE_ORDER.length];
@@ -62,7 +62,9 @@ function commandKey(segment) {
62
62
  function requiresSensitiveToolApproval(req) {
63
63
  const target = req.target.trim();
64
64
  if (req.kind === "read" || req.kind === "edit") {
65
- return /(?:^|[/\\])(?:\.env(?:\..*)?|\.ssh|\.aws|\.config\/gcloud|secrets?|credentials?)(?:[/\\]|$)/i.test(target) || /(?:id_rsa|id_ed25519|\.pem|\.p12|\.key)$/i.test(target);
65
+ return /(?:^|[\s/\\])(?:\.env(?:\.[^\s/\\]+)?|\.ssh|\.aws|\.config[/\\]gcloud|\.npmrc|\.netrc|\.git-credentials|(?:secrets?|credentials?)(?:\.[a-z0-9_-]+)?)(?:[\s/\\]|$)/i.test(
66
+ target
67
+ ) || /(?:id_rsa|id_ed25519|\.pem|\.p12|\.key)(?:\s|$)/i.test(target);
66
68
  }
67
69
  if (req.kind === "bash") {
68
70
  return /\b(?:rm\s+-[a-z]*r[a-z]*f[a-z]*\s|rm\s+-[a-z]*f[a-z]*r[a-z]*\s|mkfs(?:\.|\s)|wipefs\b|shred\s|git\s+push\s+(?:--force|-f)\b|docker\s+(?:system\s+prune|volume\s+rm)|kubectl\s+delete\b|drop\s+(?:database|table)|npm\s+publish\b)/i.test(target) || /\b(?:deploy-service\.sh|aws\s+secretsmanager|cat\s+[^;&|]*\.env\b)/i.test(target);
@@ -87,7 +89,8 @@ var Permissions = class {
87
89
  editInProject(target) {
88
90
  const rel = relative(this.cwd, resolve(this.cwd, target));
89
91
  if (!rel || rel.startsWith("..") || isAbsolute(rel)) return false;
90
- return !rel.split(sep).includes(".git") && !rel.split("/").includes(".git");
92
+ const parts = rel.split(/[/\\]/).map((p) => p.toLowerCase());
93
+ return !parts.includes(".git");
91
94
  }
92
95
  /** Rules that "[a] allow for this session" would add; undefined when it must always be asked. */
93
96
  rulesFor(req) {
@@ -105,7 +108,7 @@ var Permissions = class {
105
108
  if (/`|\$\(|[<>]|^\s*[({]/.test(req.target)) return void 0;
106
109
  const segments = req.target.split(/&&|\|\||[;&|\n]/).map((s) => s.trim()).filter(Boolean);
107
110
  if (!segments.length) return void 0;
108
- if (segments.some(isAlwaysAsk)) return void 0;
111
+ if (segments.some((s) => /^[({]/.test(s) || isAlwaysAsk(s))) return void 0;
109
112
  return [...new Set(segments.map((s) => `bash(${commandKey(s)})`))];
110
113
  }
111
114
  if (req.kind === "mcp") return [`mcp(${req.tool})`];
@@ -139,5 +142,6 @@ var Permissions = class {
139
142
  export {
140
143
  MODE_ORDER,
141
144
  nextMode,
145
+ requiresSensitiveToolApproval,
142
146
  Permissions
143
147
  };
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  reasoningPayload
4
- } from "./chunk-BLOYFIAD.js";
4
+ } from "./chunk-KPTML72Q.js";
5
5
  import {
6
6
  t
7
- } from "./chunk-UZWJQF67.js";
7
+ } from "./chunk-3WHI4LN3.js";
8
8
 
9
9
  // src/provider.ts
10
10
  import OpenAI from "openai";
@@ -171,7 +171,7 @@ async function readStream(res, onText, onThinking) {
171
171
  }
172
172
  current = target;
173
173
  if (tc.id) target.id = tc.id;
174
- if (tc.function?.name && !target.name) target.name = tc.function.name;
174
+ if (tc.function?.name && target.name !== tc.function.name) target.name += tc.function.name;
175
175
  if (tc.function?.arguments) target.arguments += tc.function.arguments;
176
176
  }
177
177
  };
@@ -378,7 +378,16 @@ function responsesFinishReason(items, toolCallCount, incompleteReason) {
378
378
  function hasPendingProgrammaticReplay(messages) {
379
379
  let pending = false;
380
380
  for (const message of messages) {
381
+ if (message.role === "user" && typeof message.content === "string") {
382
+ pending = false;
383
+ continue;
384
+ }
385
+ if (message.role === "tool" && message.content === "Cancelled by the user.") {
386
+ pending = false;
387
+ continue;
388
+ }
381
389
  if (message.role !== "assistant") continue;
390
+ if (message.content) pending = false;
382
391
  for (const item of message.responses_output_items ?? []) {
383
392
  if (item.type === "program") pending = true;
384
393
  else if (item.type === "message" && pending) pending = false;
@@ -452,7 +461,7 @@ async function readResponsesStream(res, onText, onThinking) {
452
461
  calls.set(index, {
453
462
  id: String(event.item.call_id || current?.id || event.item.id || `call_${index}`),
454
463
  name: String(event.item.name || current?.name || ""),
455
- arguments: String(event.item.arguments ?? current?.arguments ?? ""),
464
+ arguments: String(event.item.arguments || current?.arguments || ""),
456
465
  ...programCaller(event.item) ?? current?.caller ? { caller: programCaller(event.item) ?? current?.caller } : {}
457
466
  });
458
467
  }
@@ -688,7 +697,7 @@ async function readResponsesWebSocketTurn(events, ws, onText, onThinking, signal
688
697
  calls.set(index, {
689
698
  id: String(event.item.call_id || current?.id || event.item.id || `call_${index}`),
690
699
  name: String(event.item.name || current?.name || ""),
691
- arguments: String(event.item.arguments ?? current?.arguments ?? ""),
700
+ arguments: String(event.item.arguments || current?.arguments || ""),
692
701
  ...programCaller(event.item) ?? current?.caller ? { caller: programCaller(event.item) ?? current?.caller } : {}
693
702
  });
694
703
  }
@@ -749,7 +758,7 @@ function createProvider(options) {
749
758
  const isBotConnectorCloud = /^https:\/\/api\.botconnector\.id\/v1\/?$/.test(baseURL) && apiKey?.startsWith("bc_live_");
750
759
  if (isBotConnectorCloud) {
751
760
  headers["x-botconnector-client"] = "bccli";
752
- headers["x-botconnector-client-version"] = "0.4.1";
761
+ headers["x-botconnector-client-version"] = "0.4.3";
753
762
  }
754
763
  const useNativeResponses = isBotConnectorCloud && providerId === "bc-cloud" && model === "gpt-6-luna";
755
764
  const useResponsesWebSocket = useNativeResponses && Boolean(apiKey) && (fetchOverride === void 0 || responsesWebSocketFactory !== void 0);
@@ -780,7 +789,7 @@ function createProvider(options) {
780
789
  baseURL: baseURL.replace(/\/+$/, ""),
781
790
  defaultHeaders: {
782
791
  "x-botconnector-client": "bccli",
783
- "x-botconnector-client-version": "0.4.1"
792
+ "x-botconnector-client-version": "0.4.3"
784
793
  }
785
794
  });
786
795
  lunaWs = responsesWebSocketFactory ? responsesWebSocketFactory(client) : new ResponsesWS(client, { reconnect: null });
@@ -863,8 +872,13 @@ function createProvider(options) {
863
872
  }
864
873
  async function post(path, body, signal) {
865
874
  let lastError;
875
+ let retryAfterWaitMs;
866
876
  for (let attempt = 0; attempt < 4; attempt++) {
867
- if (attempt > 0) await sleep(retryDelayMs * 2 ** (attempt - 1), signal);
877
+ if (attempt > 0) {
878
+ const delay = retryAfterWaitMs ?? retryDelayMs * 2 ** (attempt - 1);
879
+ retryAfterWaitMs = void 0;
880
+ await sleep(delay, signal);
881
+ }
868
882
  let res;
869
883
  try {
870
884
  res = await doFetch(`${baseURL}${path}`, { method: "POST", headers, body: JSON.stringify(body), signal });
@@ -874,6 +888,11 @@ function createProvider(options) {
874
888
  continue;
875
889
  }
876
890
  if (res.ok) return res;
891
+ const retryHeader = res.headers.get("retry-after");
892
+ if (retryHeader) {
893
+ const secs = Number(retryHeader);
894
+ if (Number.isFinite(secs) && secs > 0 && secs <= 30) retryAfterWaitMs = Math.ceil(secs * 1e3);
895
+ }
877
896
  const text = await res.text().catch(() => "");
878
897
  lastError = new ProviderError(t("{status} from {url}: {message}", { status: res.status, url: baseURL, message: errorMessage(text) }), res.status);
879
898
  const deterministicQuota429 = res.status === 429 && /"code"\s*:\s*"(?:luna_monthly_quota_exhausted|plan_allowance_exhausted)"/i.test(text);
@@ -936,11 +955,49 @@ function createProvider(options) {
936
955
  }
937
956
  };
938
957
  }
958
+ function withFallbackProvider(primary, fallbacks) {
959
+ return {
960
+ async chat(req) {
961
+ let emitted = false;
962
+ const wrappedReq = {
963
+ ...req,
964
+ onText: req.onText ? (delta) => {
965
+ emitted = true;
966
+ req.onText?.(delta);
967
+ } : () => {
968
+ emitted = true;
969
+ }
970
+ };
971
+ try {
972
+ return await primary.chat(wrappedReq);
973
+ } catch (primaryError) {
974
+ if (emitted || req.signal?.aborted) throw primaryError;
975
+ const status = primaryError instanceof ProviderError ? primaryError.status : void 0;
976
+ const canFallback = status === void 0 || status === 429 || status === 408 || status >= 500;
977
+ if (!canFallback) throw primaryError;
978
+ const chain = fallbacks();
979
+ if (!chain.length) throw primaryError;
980
+ let lastError = primaryError;
981
+ for (const fb of chain) {
982
+ if (req.signal?.aborted) throw lastError;
983
+ try {
984
+ return await fb.chat(req);
985
+ } catch (fbError) {
986
+ lastError = fbError;
987
+ }
988
+ }
989
+ throw lastError;
990
+ }
991
+ },
992
+ listModels: () => primary.listModels()
993
+ };
994
+ }
939
995
 
940
996
  export {
941
997
  contentText,
942
998
  imageUserMessage,
943
999
  hasPendingProgrammaticReplay,
944
1000
  completionAssistantMessage,
945
- createProvider
1001
+ createProvider,
1002
+ withFallbackProvider
946
1003
  };
@@ -1,14 +1,14 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  defaultOpen
4
- } from "./chunk-MFHCQQEN.js";
4
+ } from "./chunk-3I5BW3ZT.js";
5
5
  import {
6
6
  removeCredential,
7
7
  saveCredential
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/login.ts
14
14
  function readSecret(prompt) {
@@ -91,8 +91,8 @@ function defaultLoginDeps() {
91
91
  fetch: globalThis.fetch,
92
92
  // Wiring NYATA jalur lama: persis runLogin lama (provider add + prompt key).
93
93
  legacyAdd: async (providerId, targetCwd) => {
94
- const { runProviderCommand } = await import("./providerCli-NMUFXAAS.js");
95
- const { parseCliArgs: parse } = await import("./args-W6BNKY7K.js");
94
+ const { runProviderCommand } = await import("./providerCli-V2576JXE.js");
95
+ const { parseCliArgs: parse } = await import("./args-NRTZWWEV.js");
96
96
  return runProviderCommand(parse(["provider", "add", providerId]), {
97
97
  env: process.env,
98
98
  cwd: targetCwd,
@@ -117,12 +117,12 @@ async function runLogin(providerId, cwd, args, deps) {
117
117
  );
118
118
  return 1;
119
119
  }
120
- const { runOauthLogout } = await import("./oauthLogin-6FWQABJ7.js");
120
+ const { runOauthLogout } = await import("./oauthLogin-XWY7OHCG.js");
121
121
  return runOauthLogout({ out: deps.out, err: deps.err, env: deps.env, removeCredential: deps.removeCredential });
122
122
  }
123
123
  if (args.key) return deps.legacyAdd(providerId, cwd);
124
124
  if (providerId === "openrouter") {
125
- const { runOauthLogin } = await import("./oauthLogin-6FWQABJ7.js");
125
+ const { runOauthLogin } = await import("./oauthLogin-XWY7OHCG.js");
126
126
  return runOauthLogin({
127
127
  out: deps.out,
128
128
  err: deps.err,
package/dist/cli.js CHANGED
@@ -1,48 +1,49 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
+ resolvePrintPrompt,
3
4
  resolveWorktree,
4
5
  runPrint
5
- } from "./chunk-R5RE46CW.js";
6
+ } from "./chunk-WDX62DFH.js";
6
7
  import {
7
8
  createRuntime
8
- } from "./chunk-PZRKU4UM.js";
9
- import "./chunk-QZKLZELZ.js";
10
- import "./chunk-BGXNR74O.js";
11
- import "./chunk-45SDLMTV.js";
9
+ } from "./chunk-QNUJHKEL.js";
10
+ import "./chunk-OK2USAXX.js";
11
+ import "./chunk-4W5SKQDC.js";
12
+ import "./chunk-JXM6REER.js";
12
13
  import "./chunk-PSO7R5AD.js";
13
14
  import {
14
15
  VERSION
15
- } from "./chunk-BKGFA2PT.js";
16
+ } from "./chunk-FUJGHCWN.js";
16
17
  import {
17
18
  helpText,
18
19
  parseCliArgs
19
- } from "./chunk-XV7ZVL4J.js";
20
- import "./chunk-MHIYLXJC.js";
21
- import "./chunk-GN4W3T6E.js";
22
- import "./chunk-75BECX4F.js";
20
+ } from "./chunk-6UO5GX55.js";
21
+ import "./chunk-WFZKJY3R.js";
22
+ import "./chunk-GWVLPN4B.js";
23
+ import "./chunk-7I2ZGPUS.js";
23
24
  import {
24
25
  readGlobalConfigFile
25
- } from "./chunk-JHPGOAXU.js";
26
+ } from "./chunk-HQW4BROS.js";
26
27
  import {
27
28
  defaultLoginDeps,
28
29
  runLogin
29
- } from "./chunk-BXQQCUAC.js";
30
- import "./chunk-MFHCQQEN.js";
30
+ } from "./chunk-Z5NI5FIK.js";
31
+ import "./chunk-3I5BW3ZT.js";
31
32
  import {
32
33
  pruneSessions
33
- } from "./chunk-BC7UXFE4.js";
34
- import "./chunk-WNACAUDK.js";
35
- import "./chunk-BLOYFIAD.js";
36
- import "./chunk-24JN75FZ.js";
34
+ } from "./chunk-6AUROP2E.js";
35
+ import "./chunk-XTOATEI6.js";
36
+ import "./chunk-KPTML72Q.js";
37
+ import "./chunk-6M55UPES.js";
37
38
  import {
38
39
  ConfigError,
39
40
  setTheme
40
- } from "./chunk-FLQPE4S5.js";
41
+ } from "./chunk-RX4UQX43.js";
41
42
  import {
42
43
  resolveLanguage,
43
44
  setLanguage,
44
45
  t
45
- } from "./chunk-UZWJQF67.js";
46
+ } from "./chunk-3WHI4LN3.js";
46
47
 
47
48
  // src/exit.ts
48
49
  var EXIT_GRACE_MS = 1e3;
@@ -84,17 +85,17 @@ async function main() {
84
85
  if (args.worktree) cwd = (await resolveWorktree(cwd, args.worktree)).path;
85
86
  if (args.command === "login") return runLogin(args.loginProvider ?? "bc-cloud", cwd, args, defaultLoginDeps());
86
87
  if (args.command === "mcp") {
87
- const { runMcpCommand } = await import("./mcpCli-SNBDUWJN.js");
88
- const { readSecret } = await import("./login-FP3BB44A.js");
88
+ const { runMcpCommand } = await import("./mcpCli-SETTCL3K.js");
89
+ const { readSecret } = await import("./login-YXSSB2HQ.js");
89
90
  return runMcpCommand(args, { env: process.env, cwd, out: (s) => console.log(s), err: (s) => console.error(s), readSecret });
90
91
  }
91
92
  if (args.command === "provider") {
92
- const { runProviderCommand } = await import("./providerCli-NMUFXAAS.js");
93
- const { readSecret } = await import("./login-FP3BB44A.js");
93
+ const { runProviderCommand } = await import("./providerCli-V2576JXE.js");
94
+ const { readSecret } = await import("./login-YXSSB2HQ.js");
94
95
  return runProviderCommand(args, { env: process.env, cwd, out: (s) => console.log(s), err: (s) => console.error(s), readSecret });
95
96
  }
96
97
  if (args.command === "connect" || args.command === "disconnect" || args.command === "integrations") {
97
- const { runIntegrationCommand } = await import("./integrationCli-Q2YPDTPG.js");
98
+ const { runIntegrationCommand } = await import("./integrationCli-HXCSEWH2.js");
98
99
  return runIntegrationCommand(args, {
99
100
  env: process.env,
100
101
  cwd,
@@ -104,20 +105,20 @@ async function main() {
104
105
  });
105
106
  }
106
107
  if (args.command === "models") {
107
- const { runModelsCommand } = await import("./modelsCli-CZ2HNGKR.js");
108
+ const { runModelsCommand } = await import("./modelsCli-656AKYZD.js");
108
109
  return runModelsCommand(args, { env: process.env, cwd, out: (s) => console.log(s), err: (s) => console.error(s), fetch: globalThis.fetch });
109
110
  }
110
111
  if (args.command === "update") {
111
- const { runUpdateCommand } = await import("./update-TZ2G6KQ3.js");
112
+ const { runUpdateCommand } = await import("./update-AVZO4XID.js");
112
113
  return runUpdateCommand({ env: process.env });
113
114
  }
114
115
  if (args.command === "acp") {
115
- const { runtimeAgent, runAcp } = await import("./acp-3PHBAI64.js");
116
+ const { runtimeAgent, runAcp } = await import("./acp-NU4HZHQO.js");
116
117
  await runAcp(process.stdin, process.stdout, { cwd, newAgent: (c) => runtimeAgent(c, args.allowAll) });
117
118
  return 0;
118
119
  }
119
120
  if (args.command === "serve") {
120
- const { serveBanner, startServe } = await import("./serve-X2ZV4S5U.js");
121
+ const { serveBanner, startServe } = await import("./serve-XPAGXIGS.js");
121
122
  const handle = await startServe({ port: args.port, host: args.host, token: args.token, cwd, env: process.env });
122
123
  process.stderr.write(serveBanner(handle, { token: args.token }));
123
124
  await new Promise((resolve) => {
@@ -130,8 +131,8 @@ async function main() {
130
131
  return 0;
131
132
  }
132
133
  if (args.command === "plugins") {
133
- const { runPluginsCommand } = await import("./pluginsCli-LPIUUDWB.js");
134
- const { readGlobalPlugins, updateGlobalConfig } = await import("./config-IU76CPK2.js");
134
+ const { runPluginsCommand } = await import("./pluginsCli-ZQNKWZHJ.js");
135
+ const { readGlobalPlugins, updateGlobalConfig } = await import("./config-LAINORU5.js");
135
136
  const { runNpmSync } = await import("./npmRunner-LU43GM3W.js");
136
137
  return runPluginsCommand(args, {
137
138
  out: (s) => console.log(s),
@@ -145,32 +146,41 @@ async function main() {
145
146
  });
146
147
  }
147
148
  if (args.command === "gh-bot") {
148
- const { runGhBotCommand } = await import("./ghBotCli-E3VPHNZY.js");
149
+ const { runGhBotCommand } = await import("./ghBotCli-GCIUUMKQ.js");
149
150
  return runGhBotCommand(args, { env: process.env, cwd, out: (s) => console.log(s), err: (s) => console.error(s) });
150
151
  }
151
152
  if (args.command === "completion") {
152
- const { runCompletionCommand } = await import("./completion-HPPFDAPB.js");
153
+ const { runCompletionCommand } = await import("./completion-D2BSBTQO.js");
153
154
  return runCompletionCommand(args, { out: (s) => console.log(s), err: (s) => console.error(s) });
154
155
  }
155
156
  if (args.command === "stats") {
156
- const { runStatsCommand } = await import("./statsCli-CF3R7ATL.js");
157
- const { bccliHome } = await import("./config-IU76CPK2.js");
157
+ const { runStatsCommand } = await import("./statsCli-XR6BEZQQ.js");
158
+ const { bccliHome } = await import("./config-LAINORU5.js");
158
159
  return runStatsCommand(
159
160
  { subArgs: args.subArgs, home: bccliHome(process.env), cwd, days: args.days, tools: args.tools, models: args.models, project: args.project },
160
161
  { out: (s) => console.log(s), err: (s) => console.error(s) }
161
162
  );
162
163
  }
163
164
  if (args.command === "export" || args.command === "import") {
164
- const { runExportCommand, runImportCommand } = await import("./transferCli-YUFPI6AH.js");
165
- const { bccliHome } = await import("./config-IU76CPK2.js");
165
+ const { runExportCommand, runImportCommand } = await import("./transferCli-C6XS6QYH.js");
166
+ const { bccliHome } = await import("./config-LAINORU5.js");
166
167
  const deps = { subArgs: args.subArgs, home: bccliHome(process.env), cwd };
167
168
  const io = { out: (s) => console.log(s), err: (s) => console.error(s) };
168
169
  return args.command === "export" ? runExportCommand(deps, io) : runImportCommand(deps, io);
169
170
  }
170
171
  if (args.command === "pr") {
171
- const { runPrCommand } = await import("./prCli-5IMV3VNQ.js");
172
+ const { runPrCommand } = await import("./prCli-6PUWTMTP.js");
172
173
  return runPrCommand(
173
- { subArgs: args.subArgs, cwd, allowAll: args.allowAll },
174
+ {
175
+ subArgs: args.subArgs,
176
+ cwd,
177
+ allowAll: args.allowAll,
178
+ repo: args.repo,
179
+ model: args.model,
180
+ reasoning: args.reasoning,
181
+ permissionMode: args.permissionMode,
182
+ allowedTools: args.allowedTools
183
+ },
174
184
  { out: (s) => console.log(s), err: (s) => console.error(s) }
175
185
  );
176
186
  }
@@ -181,15 +191,22 @@ async function main() {
181
191
  } catch {
182
192
  }
183
193
  if (args.print) {
184
- if (!args.prompt) throw new ConfigError(t('-p mode needs a task, e.g. bccli -p "explain this repo"'));
185
- const { serversToStart } = await import("./config-DIDLDONU.js");
194
+ let stdinText;
195
+ if (!process.stdin.isTTY) {
196
+ const chunks = [];
197
+ for await (const chunk of process.stdin) chunks.push(Buffer.from(chunk));
198
+ if (chunks.length) stdinText = Buffer.concat(chunks).toString("utf8");
199
+ }
200
+ const finalPrompt = resolvePrintPrompt(args.prompt, stdinText);
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-ENDRMOTP.js");
186
203
  const plan = serversToStart(rt.home, cwd);
187
204
  for (const s of plan.needTrust) {
188
205
  console.error(t('Project MCP server "{name}" skipped (not approved yet; run interactive bccli once to approve it).', { name: s.name }));
189
206
  }
190
207
  await rt.startMcp(plan.start);
191
208
  try {
192
- return await runPrint(rt, args.prompt, void 0, { allowAll: args.allowAll, outputFormat: args.outputFormat });
209
+ return await runPrint(rt, finalPrompt, void 0, { allowAll: args.allowAll, outputFormat: args.outputFormat });
193
210
  } finally {
194
211
  await rt.mcp.stop();
195
212
  }
@@ -198,13 +215,13 @@ async function main() {
198
215
  let updateMessage;
199
216
  if (rt.config.updateCheck !== "off" && !process.env.BCCLI_NO_UPDATE_CHECK) {
200
217
  try {
201
- const { checkForUpdate } = await import("./update-TZ2G6KQ3.js");
218
+ const { checkForUpdate } = await import("./update-AVZO4XID.js");
202
219
  const update = await checkForUpdate({ home: rt.home, fetch: globalThis.fetch, now: /* @__PURE__ */ new Date() });
203
220
  updateMessage = update;
204
221
  } catch {
205
222
  }
206
223
  }
207
- const { startInteractive } = await import("./ui-IVIFNUCC.js");
224
+ const { startInteractive } = await import("./ui-43C6Y57K.js");
208
225
  return startInteractive(rt, { initialPrompt: args.prompt, resume: args.resume, version: VERSION, updateMessage });
209
226
  }
210
227
  main().then(
@@ -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/completion.ts
7
7
  var SHELLS = ["bash", "zsh", "fish", "powershell"];
@@ -9,9 +9,9 @@ import {
9
9
  removeGlobalServer,
10
10
  serversToStart,
11
11
  setProjectTrust
12
- } from "./chunk-24JN75FZ.js";
13
- import "./chunk-FLQPE4S5.js";
14
- import "./chunk-UZWJQF67.js";
12
+ } from "./chunk-6M55UPES.js";
13
+ import "./chunk-RX4UQX43.js";
14
+ import "./chunk-3WHI4LN3.js";
15
15
  export {
16
16
  addGlobalServer,
17
17
  expandEnvVars,
@@ -14,8 +14,8 @@ import {
14
14
  saveCredential,
15
15
  updateGlobalConfig,
16
16
  writeFileAtomic
17
- } from "./chunk-FLQPE4S5.js";
18
- import "./chunk-UZWJQF67.js";
17
+ } from "./chunk-RX4UQX43.js";
18
+ import "./chunk-3WHI4LN3.js";
19
19
  export {
20
20
  ConfigError,
21
21
  DEFAULT_MAX_STEPS,
package/dist/config.d.ts CHANGED
@@ -12,6 +12,8 @@ export interface ProviderConfig {
12
12
  }
13
13
  export interface Config {
14
14
  model: string;
15
+ /** Optional list of fallback model refs tried in order on 429 / 5xx / connection errors. */
16
+ fallbackModels?: string[];
15
17
  permissionMode: PermissionMode;
16
18
  reasoning: ReasoningLevel;
17
19
  /** Show provider-supplied reasoning summaries in the TUI. Global setting only. */