@botconnector/bccli 0.4.0-beta.44 → 0.4.0-beta.46

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 (48) hide show
  1. package/dist/{acp-U25MNDND.js → acp-YXBMSWYP.js} +2 -2
  2. package/dist/{args-MFTMBNRN.js → args-6MWRODGH.js} +4 -4
  3. package/dist/{chunk-ZGH4B7OU.js → chunk-2QNYWBDG.js} +21 -12
  4. package/dist/{chunk-TW5HZOTB.js → chunk-33OBF43H.js} +3 -3
  5. package/dist/{chunk-VO6MF6JJ.js → chunk-65OGHOGS.js} +1 -1
  6. package/dist/{chunk-Y3QKYORR.js → chunk-6RML6SN7.js} +6 -6
  7. package/dist/{chunk-PSRNKKGA.js → chunk-7PRH5NDO.js} +1 -1
  8. package/dist/{chunk-RMDW3OQ6.js → chunk-ASJRO2WF.js} +68 -12
  9. package/dist/{chunk-ZKMSTD6G.js → chunk-FIY424O5.js} +1 -1
  10. package/dist/{chunk-NVRNFR4S.js → chunk-GF6CRNT3.js} +1 -1
  11. package/dist/{chunk-QHNWI3OT.js → chunk-GI5GVU2L.js} +8 -2
  12. package/dist/{chunk-BQHKN7JI.js → chunk-IA5PRX4Z.js} +4 -1
  13. package/dist/{chunk-LTAQXU5Z.js → chunk-IHYNME3G.js} +1 -1
  14. package/dist/{chunk-I7GXIJCY.js → chunk-K3SWFB5S.js} +2 -2
  15. package/dist/{chunk-2ON3WIDP.js → chunk-KDVKD3QA.js} +4 -4
  16. package/dist/{chunk-GIGWZFCY.js → chunk-NGHOZRIM.js} +2 -1
  17. package/dist/{chunk-CYTRCZXI.js → chunk-OZPSNMUD.js} +26 -5
  18. package/dist/{chunk-25DSN3Y3.js → chunk-PBBD37E7.js} +4 -4
  19. package/dist/{chunk-PZC2Q6MJ.js → chunk-PQB4CGSL.js} +2 -2
  20. package/dist/chunk-QZKLZELZ.js +64 -0
  21. package/dist/cli.js +42 -39
  22. package/dist/{completion-6K4AXKK2.js → completion-D3HXSAQY.js} +1 -1
  23. package/dist/{config-Z4HSA435.js → config-BAAESXVB.js} +3 -3
  24. package/dist/{config-LCY27K3L.js → config-CJGPM5MJ.js} +2 -2
  25. package/dist/{ghBotCli-TJMKJU3E.js → ghBotCli-DCCFACAA.js} +14 -14
  26. package/dist/{integrationCli-33KU6GIK.js → integrationCli-EYAHT6VL.js} +2 -2
  27. package/dist/{login-LNF7ZV2S.js → login-FXTMDCCC.js} +3 -3
  28. package/dist/{mcpCli-TXFS3AOJ.js → mcpCli-57JTECJY.js} +5 -5
  29. package/dist/{modelsCli-IZSMIYVB.js → modelsCli-NH7W6MAZ.js} +6 -6
  30. package/dist/{oauthLogin-QGDYTOW7.js → oauthLogin-FTOPZW7X.js} +1 -1
  31. package/dist/{pluginsCli-RD4QW3DX.js → pluginsCli-UUPFG2CF.js} +2 -2
  32. package/dist/{prCli-PE7KIPMK.js → prCli-6OQ5ZUBO.js} +1 -1
  33. package/dist/providerCli-L6SQHIRK.js +15 -0
  34. package/dist/sdk.js +149 -14
  35. package/dist/{serve-HW5XZ5LF.js → serve-HPQ2K7UE.js} +15 -15
  36. package/dist/{serve-YNKE332Z.js → serve-HZZYEI3J.js} +3 -3
  37. package/dist/session-QIZKAZK3.js +12 -0
  38. package/dist/setup-4I5FXW37.js +24 -0
  39. package/dist/statsCli-G7GYLCPM.js +353 -0
  40. package/dist/{transferCli-RQBB6RVY.js → transferCli-7FW2SJY4.js} +4 -4
  41. package/dist/{ui-4ZTUMTYM.js → ui-KHNDA2RT.js} +120 -32
  42. package/dist/{update-34FDI6H3.js → update-UG7GWBXT.js} +2 -2
  43. package/package.json +1 -1
  44. package/dist/chunk-U6PCNS4B.js +0 -20
  45. package/dist/providerCli-AA3CHCGV.js +0 -15
  46. package/dist/session-KRV2UP5C.js +0 -12
  47. package/dist/setup-L4OPF3XW.js +0 -24
  48. package/dist/statsCli-4KYPVYCN.js +0 -109
@@ -97,8 +97,8 @@ function runAcp(input, output, opts) {
97
97
  function runtimeAgent(cwd) {
98
98
  return {
99
99
  async run(text, onChunk, signal) {
100
- const { parseCliArgs } = await import("./args-MFTMBNRN.js");
101
- const { createRuntime } = await import("./setup-L4OPF3XW.js");
100
+ const { parseCliArgs } = await import("./args-6MWRODGH.js");
101
+ const { createRuntime } = await import("./setup-4I5FXW37.js");
102
102
  const rt = createRuntime({ cwd, args: { ...parseCliArgs([]), allowAll: true } });
103
103
  rt.agent.onEvent = (event) => {
104
104
  if (event.type === "text") onChunk(event.delta);
@@ -2,11 +2,11 @@
2
2
  import {
3
3
  helpText,
4
4
  parseCliArgs
5
- } from "./chunk-CYTRCZXI.js";
5
+ } from "./chunk-OZPSNMUD.js";
6
6
  import "./chunk-GAFJEQTJ.js";
7
- import "./chunk-ZKMSTD6G.js";
8
- import "./chunk-GIGWZFCY.js";
9
- import "./chunk-QHNWI3OT.js";
7
+ import "./chunk-FIY424O5.js";
8
+ import "./chunk-NGHOZRIM.js";
9
+ import "./chunk-GI5GVU2L.js";
10
10
  export {
11
11
  helpText,
12
12
  parseCliArgs
@@ -2,8 +2,10 @@
2
2
  import {
3
3
  estimateMessages,
4
4
  estimateTokens,
5
+ pruneOldToolOutputs,
6
+ splitKeepRecent,
5
7
  trimToFit
6
- } from "./chunk-U6PCNS4B.js";
8
+ } from "./chunk-QZKLZELZ.js";
7
9
  import {
8
10
  BUILTIN_AGENTS,
9
11
  appendMemory,
@@ -18,11 +20,11 @@ import {
18
20
  parseFrontmatter,
19
21
  runHooks,
20
22
  validateGlobPattern
21
- } from "./chunk-PSRNKKGA.js";
23
+ } from "./chunk-7PRH5NDO.js";
22
24
  import {
23
25
  createWebSearchTool,
24
26
  fetchTool
25
- } from "./chunk-NVRNFR4S.js";
27
+ } from "./chunk-GF6CRNT3.js";
26
28
  import {
27
29
  defineTool
28
30
  } from "./chunk-PSO7R5AD.js";
@@ -31,38 +33,38 @@ import {
31
33
  } from "./chunk-GAFJEQTJ.js";
32
34
  import {
33
35
  addProviderKey
34
- } from "./chunk-2ON3WIDP.js";
36
+ } from "./chunk-KDVKD3QA.js";
35
37
  import {
36
38
  listAllModels
37
- } from "./chunk-25DSN3Y3.js";
39
+ } from "./chunk-PBBD37E7.js";
38
40
  import {
39
41
  providerName
40
- } from "./chunk-VO6MF6JJ.js";
42
+ } from "./chunk-65OGHOGS.js";
41
43
  import {
42
44
  FileOAuthProvider,
43
45
  hasStoredTokens
44
46
  } from "./chunk-7F3IWBPQ.js";
45
47
  import {
46
48
  Session
47
- } from "./chunk-BQHKN7JI.js";
49
+ } from "./chunk-IA5PRX4Z.js";
48
50
  import {
49
51
  completionAssistantMessage,
50
52
  createProvider,
51
53
  hasPendingProgrammaticReplay,
52
54
  imageUserMessage
53
- } from "./chunk-RMDW3OQ6.js";
55
+ } from "./chunk-ASJRO2WF.js";
54
56
  import {
55
57
  expandEnvVars
56
- } from "./chunk-PZC2Q6MJ.js";
58
+ } from "./chunk-PQB4CGSL.js";
57
59
  import {
58
60
  ConfigError,
59
61
  bccliHome,
60
62
  loadConfig,
61
63
  resolveModel
62
- } from "./chunk-GIGWZFCY.js";
64
+ } from "./chunk-NGHOZRIM.js";
63
65
  import {
64
66
  t
65
- } from "./chunk-QHNWI3OT.js";
67
+ } from "./chunk-GI5GVU2L.js";
66
68
 
67
69
  // src/textToolCalls.ts
68
70
  var PAIR = /(?:<arg_key>\s*|`)?([A-Za-z_]\w*)(?:\s*<\/arg_key>)?`?\s*(?:=\s*`|<arg_value>)([\s\S]*?)<\/arg_value>/g;
@@ -744,7 +746,10 @@ var Agent = class {
744
746
  this.opts.onReset?.();
745
747
  }
746
748
  async compact(signal) {
747
- const history = trimToFit(this.messages, Math.floor(this.contextWindow * 0.8));
749
+ pruneOldToolOutputs(this.messages);
750
+ const keepTokens = Math.min(15e3, Math.floor(this.contextWindow * 0.1));
751
+ const [older, keep] = splitKeepRecent(this.messages, keepTokens);
752
+ const history = trimToFit(older, Math.floor(this.contextWindow * 0.8));
748
753
  const completion = await this.provider.chat({
749
754
  messages: [{ role: "system", content: this.systemPrompt }, ...history, { role: "user", content: COMPACT_PROMPT }],
750
755
  // Some gateways reject tool_calls in history when no tools are declared.
@@ -756,6 +761,7 @@ var Agent = class {
756
761
  this.push({ role: "user", content: `Summary of the previous conversation:
757
762
  ${completion.text}` });
758
763
  this.push({ role: "assistant", content: "OK, I will continue from this summary." });
764
+ for (const m of keep) this.push(m);
759
765
  this.onEvent({ type: "compacted" });
760
766
  }
761
767
  /**
@@ -818,6 +824,7 @@ ${completion.text}` });
818
824
  this.totalUsage.cacheWriteTokens = (this.totalUsage.cacheWriteTokens ?? 0) + (usage.cacheWriteTokens ?? 0);
819
825
  this.lastInputTokens = usage.inputTokens;
820
826
  this.onEvent({ type: "usage", ...this.totalUsage });
827
+ this.opts.onUsage?.(usage);
821
828
  this.push(completionAssistantMessage(completion));
822
829
  if (completion.finishReason === "repetition") {
823
830
  this.onEvent({ type: "textReplace", text: completion.text });
@@ -965,6 +972,7 @@ ${t("This model may not support tool calling. Try another model with /model.")}`
965
972
  this.totalUsage.cachedInputTokens = (this.totalUsage.cachedInputTokens ?? 0) + (u.cachedInputTokens ?? 0);
966
973
  this.totalUsage.cacheWriteTokens = (this.totalUsage.cacheWriteTokens ?? 0) + (u.cacheWriteTokens ?? 0);
967
974
  this.onEvent({ type: "usage", ...this.totalUsage });
975
+ this.opts.onUsage?.(u);
968
976
  }
969
977
  };
970
978
  emit({ type: "toolStart", id: call.id, tool: tool.name, target });
@@ -1995,6 +2003,7 @@ function createRuntime(opts) {
1995
2003
  budgetModel: modelRef,
1996
2004
  contextWindow: contextWindowFor(modelRef, env),
1997
2005
  onMessage: (m) => session.append(m),
2006
+ onUsage: (u) => session.appendUsage({ ...u, model: modelRef }),
1998
2007
  onReset: () => session.reset(),
1999
2008
  onTurnStart: () => {
2000
2009
  for (let i = turnMarks.length - 1; i >= 0 && turnMarks[i] > agent.messages.length; i--) {
@@ -2,13 +2,13 @@
2
2
  import {
3
3
  runCommand,
4
4
  runHooks
5
- } from "./chunk-PSRNKKGA.js";
5
+ } from "./chunk-7PRH5NDO.js";
6
6
  import {
7
7
  ConfigError
8
- } from "./chunk-GIGWZFCY.js";
8
+ } from "./chunk-NGHOZRIM.js";
9
9
  import {
10
10
  t
11
- } from "./chunk-QHNWI3OT.js";
11
+ } from "./chunk-GI5GVU2L.js";
12
12
 
13
13
  // src/verify.ts
14
14
  var MAX_VERIFY_ROUNDS = 2;
@@ -5,7 +5,7 @@ import {
5
5
  readCredentials,
6
6
  readJsonConfig,
7
7
  removeCredential
8
- } from "./chunk-GIGWZFCY.js";
8
+ } from "./chunk-NGHOZRIM.js";
9
9
 
10
10
  // src/providers.ts
11
11
  import { mkdirSync, writeFileSync } from "fs";
@@ -5,10 +5,10 @@ import {
5
5
  import {
6
6
  removeCredential,
7
7
  saveCredential
8
- } from "./chunk-GIGWZFCY.js";
8
+ } from "./chunk-NGHOZRIM.js";
9
9
  import {
10
10
  t
11
- } from "./chunk-QHNWI3OT.js";
11
+ } from "./chunk-GI5GVU2L.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-AA3CHCGV.js");
95
- const { parseCliArgs: parse } = await import("./args-MFTMBNRN.js");
94
+ const { runProviderCommand } = await import("./providerCli-L6SQHIRK.js");
95
+ const { parseCliArgs: parse } = await import("./args-6MWRODGH.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-QGDYTOW7.js");
120
+ const { runOauthLogout } = await import("./oauthLogin-FTOPZW7X.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-QGDYTOW7.js");
125
+ const { runOauthLogin } = await import("./oauthLogin-FTOPZW7X.js");
126
126
  return runOauthLogin({
127
127
  out: deps.out,
128
128
  err: deps.err,
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-PSO7R5AD.js";
5
5
  import {
6
6
  t
7
- } from "./chunk-QHNWI3OT.js";
7
+ } from "./chunk-GI5GVU2L.js";
8
8
 
9
9
  // src/tools/bash.ts
10
10
  import { spawn } from "child_process";
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  reasoningPayload
4
- } from "./chunk-ZKMSTD6G.js";
4
+ } from "./chunk-FIY424O5.js";
5
5
  import {
6
6
  t
7
- } from "./chunk-QHNWI3OT.js";
7
+ } from "./chunk-GI5GVU2L.js";
8
8
 
9
9
  // src/provider.ts
10
10
  import OpenAI from "openai";
@@ -70,6 +70,13 @@ var ProviderError = class extends Error {
70
70
  status;
71
71
  code;
72
72
  };
73
+ function outputReasoningSummary(items) {
74
+ return (items ?? []).flatMap((item) => {
75
+ if (!item || typeof item !== "object" || !("type" in item) || item.type !== "reasoning") return [];
76
+ if (!("summary" in item) || !Array.isArray(item.summary)) return [];
77
+ return item.summary;
78
+ }).map((part) => part && typeof part === "object" && "text" in part && typeof part.text === "string" ? part.text : "").filter(Boolean).join("\n");
79
+ }
73
80
  var retryable = (status) => status === 429 || status >= 500;
74
81
  function detectRepetition(text) {
75
82
  const tail = text.slice(-600);
@@ -351,8 +358,8 @@ function responseTools(tools, enableProgrammaticToolCalling = false, programmati
351
358
  return lunaToolPlan(tools, enableProgrammaticToolCalling, programmaticToolNames, forceProgrammaticOnly).tools;
352
359
  }
353
360
  function responseReasoning(level) {
354
- if (level === "auto") return {};
355
- return { reasoning: { effort: level === "off" ? "none" : level } };
361
+ if (level === "off") return { reasoning: { effort: "none" } };
362
+ return { reasoning: { ...level === "auto" ? {} : { effort: level }, summary: "auto" } };
356
363
  }
357
364
  function toResponsesUsage(usage) {
358
365
  return usage ? { inputTokens: usage.input_tokens ?? 0, outputTokens: usage.output_tokens ?? 0 } : void 0;
@@ -379,8 +386,9 @@ function hasPendingProgrammaticReplay(messages) {
379
386
  }
380
387
  return pending;
381
388
  }
382
- async function readResponsesStream(res, onText) {
389
+ async function readResponsesStream(res, onText, onThinking) {
383
390
  let text = "";
391
+ let thinking = "";
384
392
  let usage;
385
393
  let finishReason;
386
394
  let loopAt = -1;
@@ -411,6 +419,12 @@ async function readResponsesStream(res, onText) {
411
419
  if (event.type === "response.failed") {
412
420
  throw new ProviderError(t("Error from the provider: {message}", { message: event.response?.error?.message ?? "Response failed" }));
413
421
  }
422
+ if (event.type === "response.reasoning_summary_text.delta" || event.type === "response.reasoning_summary.delta") {
423
+ const summary = String(event.delta ?? "");
424
+ thinking += summary;
425
+ if (summary) onThinking?.(summary);
426
+ return;
427
+ }
414
428
  if (event.type === "response.output_text.delta" || event.type === "response.refusal.delta") {
415
429
  emitText(String(event.delta ?? ""));
416
430
  return;
@@ -447,12 +461,26 @@ async function readResponsesStream(res, onText) {
447
461
  if (event.type === "response.completed") {
448
462
  usage = toResponsesUsage(event.response?.usage);
449
463
  responsesOutputItems = event.response?.output ?? [...outputItems.entries()].sort(([a], [b]) => a - b).map(([, item]) => item);
464
+ if (!thinking) {
465
+ const summary = outputReasoningSummary(responsesOutputItems);
466
+ if (summary) {
467
+ thinking = summary;
468
+ onThinking?.(summary);
469
+ }
470
+ }
450
471
  finishReason = responsesFinishReason(responsesOutputItems, calls.size);
451
472
  return;
452
473
  }
453
474
  if (event.type === "response.incomplete") {
454
475
  usage = toResponsesUsage(event.response?.usage);
455
476
  responsesOutputItems = event.response?.output ?? [...outputItems.entries()].sort(([a], [b]) => a - b).map(([, item]) => item);
477
+ if (!thinking) {
478
+ const summary = outputReasoningSummary(responsesOutputItems);
479
+ if (summary) {
480
+ thinking = summary;
481
+ onThinking?.(summary);
482
+ }
483
+ }
456
484
  finishReason = responsesFinishReason(
457
485
  responsesOutputItems,
458
486
  calls.size,
@@ -476,14 +504,16 @@ async function readResponsesStream(res, onText) {
476
504
  return {
477
505
  text,
478
506
  toolCalls: [...calls.entries()].sort(([a], [b]) => a - b).map(([, call]) => call),
507
+ thinking: thinking || void 0,
479
508
  usage,
480
509
  finishReason,
481
510
  responsesOutputItems
482
511
  };
483
512
  }
484
- async function readResponsesJson(res) {
513
+ async function readResponsesJson(res, onThinking) {
485
514
  const body = await res.json();
486
515
  let text = "";
516
+ let thinking = "";
487
517
  const toolCalls = [];
488
518
  for (const item of body.output ?? []) {
489
519
  if (item?.type === "message") {
@@ -491,6 +521,12 @@ async function readResponsesJson(res) {
491
521
  if (part?.type === "output_text" && typeof part.text === "string") text += part.text;
492
522
  else if (part?.type === "refusal" && typeof part.refusal === "string") text += part.refusal;
493
523
  }
524
+ } else if (item?.type === "reasoning" && Array.isArray(item.summary)) {
525
+ const summary = item.summary.filter((part) => typeof part === "object" && part !== null && typeof part.text === "string").map((part) => part.text).join("");
526
+ if (summary) {
527
+ thinking += summary;
528
+ onThinking?.(summary);
529
+ }
494
530
  } else if (item?.type === "function_call") {
495
531
  toolCalls.push({
496
532
  id: String(item.call_id || item.id || `call_${toolCalls.length}`),
@@ -503,6 +539,7 @@ async function readResponsesJson(res) {
503
539
  return {
504
540
  text,
505
541
  toolCalls,
542
+ thinking: thinking || void 0,
506
543
  usage: toResponsesUsage(body.usage),
507
544
  responsesOutputItems: body.output,
508
545
  finishReason: responsesFinishReason(
@@ -560,9 +597,10 @@ function responseContinuationInput(messages, continuation) {
560
597
  incremental: true
561
598
  };
562
599
  }
563
- async function readResponsesWebSocketTurn(events, ws, onText, signal) {
600
+ async function readResponsesWebSocketTurn(events, ws, onText, onThinking, signal) {
564
601
  let responseId = "";
565
602
  let text = "";
603
+ let thinking = "";
566
604
  let usage;
567
605
  let finishReason;
568
606
  let loopAt = -1;
@@ -609,6 +647,12 @@ async function readResponsesWebSocketTurn(events, ws, onText, signal) {
609
647
  responseId = String(event.response?.id || responseId);
610
648
  continue;
611
649
  }
650
+ if (event.type === "response.reasoning_summary_text.delta") {
651
+ const summary = String(event.delta ?? "");
652
+ thinking += summary;
653
+ if (summary) onThinking?.(summary);
654
+ continue;
655
+ }
612
656
  if (event.type === "response.output_text.delta" || event.type === "response.refusal.delta") {
613
657
  emitText(String(event.delta ?? ""));
614
658
  if (loopAt >= 0) {
@@ -659,6 +703,13 @@ async function readResponsesWebSocketTurn(events, ws, onText, signal) {
659
703
  responseId = String(event.response?.id || responseId);
660
704
  usage = toResponsesUsage(event.response?.usage);
661
705
  const responsesOutputItems = event.response?.output ?? [...outputItems.entries()].sort(([a], [b]) => a - b).map(([, item]) => item);
706
+ if (!thinking) {
707
+ const summary = outputReasoningSummary(responsesOutputItems);
708
+ if (summary) {
709
+ thinking = summary;
710
+ onThinking?.(summary);
711
+ }
712
+ }
662
713
  finishReason = responsesFinishReason(
663
714
  responsesOutputItems,
664
715
  calls.size,
@@ -669,6 +720,7 @@ async function readResponsesWebSocketTurn(events, ws, onText, signal) {
669
720
  completion: {
670
721
  text,
671
722
  toolCalls: [...calls.entries()].sort(([a], [b]) => a - b).map(([, call]) => call),
723
+ thinking: thinking || void 0,
672
724
  usage,
673
725
  finishReason,
674
726
  responsesOutputItems
@@ -741,7 +793,7 @@ function createProvider(options) {
741
793
  lunaWsIdleTimer = setTimeout(() => resetLunaWebSocket(), 10 * 6e4);
742
794
  lunaWsIdleTimer.unref?.();
743
795
  };
744
- async function chatLunaWebSocket(messages, tools, programmaticToolNames, reasoning, signal, onText) {
796
+ async function chatLunaWebSocket(messages, tools, programmaticToolNames, reasoning, signal, onText, onThinking) {
745
797
  const ptcEnabled = shouldEnableLunaPtc(messages, enableProgrammaticToolCalling, programmaticToolNames);
746
798
  const forcePtc = shouldForceLunaPtc(messages, ptcEnabled);
747
799
  const nativeTools = responseTools(tools, ptcEnabled, programmaticToolNames, forcePtc);
@@ -766,9 +818,13 @@ function createProvider(options) {
766
818
  if (delta) emittedText = true;
767
819
  onText?.(delta);
768
820
  };
821
+ const trackSummary = (delta) => {
822
+ if (delta) emittedText = true;
823
+ onThinking?.(delta);
824
+ };
769
825
  try {
770
826
  ws.send(createEvent);
771
- const result = await readResponsesWebSocketTurn(events, ws, trackText, signal);
827
+ const result = await readResponsesWebSocketTurn(events, ws, trackText, trackSummary, signal);
772
828
  if (result.completion.finishReason === "repetition") {
773
829
  resetLunaWebSocket();
774
830
  return result.completion;
@@ -829,7 +885,7 @@ function createProvider(options) {
829
885
  }
830
886
  if (useResponsesWebSocket) {
831
887
  try {
832
- return await chatLunaWebSocket(messages, tools, programmaticToolNames, reasoning, signal, onText);
888
+ return await chatLunaWebSocket(messages, tools, programmaticToolNames, reasoning, signal, onText, onThinking);
833
889
  } catch (error) {
834
890
  const err = error instanceof ProviderError ? error : new ProviderError(error.message);
835
891
  if (err.code !== "bc_ws_http_fallback") throw err;
@@ -852,9 +908,9 @@ function createProvider(options) {
852
908
  },
853
909
  signal
854
910
  );
855
- if ((res2.headers.get("content-type") ?? "").includes("application/json")) return readResponsesJson(res2);
911
+ if ((res2.headers.get("content-type") ?? "").includes("application/json")) return readResponsesJson(res2, onThinking);
856
912
  if (!res2.body) throw new ProviderError(t("Empty response from the provider"));
857
- return readResponsesStream(res2, onText);
913
+ return readResponsesStream(res2, onText, onThinking);
858
914
  }
859
915
  const res = await post(
860
916
  "/chat/completions",
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  t
4
- } from "./chunk-QHNWI3OT.js";
4
+ } from "./chunk-GI5GVU2L.js";
5
5
 
6
6
  // src/reasoning.ts
7
7
  var REASONING_LEVELS = ["auto", "off", "low", "medium", "high", "max"];
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-PSO7R5AD.js";
5
5
  import {
6
6
  t
7
- } from "./chunk-QHNWI3OT.js";
7
+ } from "./chunk-GI5GVU2L.js";
8
8
 
9
9
  // src/tools/websearch.ts
10
10
  import { z } from "zod";
@@ -26,6 +26,9 @@ var ID = {
26
26
  " enter save \xB7 esc cancel": " enter simpan \xB7 esc batal",
27
27
  "shift+tab switch mode": "shift+tab ganti mode",
28
28
  "{n} tokens": "{n} token",
29
+ "click to toggle": "klik untuk buka/tutup",
30
+ "Model: {model} \xB7 reasoning: {level}": "Model: {model} \xB7 penalaran: {level}",
31
+ "No reasoning summary received yet; tool activity remains visible above.": "Belum ada ringkasan penalaran dari model; aktivitas tool tetap terlihat di atas.",
29
32
  "esc to cancel": "esc batal",
30
33
  "/ for commands": "/ perintah",
31
34
  "\u2026 {n} earlier steps": "\u2026 {n} langkah sebelumnya",
@@ -113,7 +116,8 @@ Usage:
113
116
  bccli provider list|add <id>|remove <id> manage providers (custom: --url <url> [--name N] [--key-env ENV])
114
117
  bccli mcp list|add <name>|remove <name>|auth <name>|logout <name>|serve [--base-url <url>] manage MCP servers, or serve this account's tools over stdio
115
118
  bccli completion <shell> print a shell completion script (bash, zsh, fish, powershell)
116
- bccli stats [--days N] show token usage from local sessions (default: last 7 days)
119
+ bccli stats [--days N] [--tools N] [--models [N|all]] [--project slug]
120
+ show token usage from local sessions (default: last 7 days)
117
121
  bccli export [session] [file] copy a session JSONL to a file (default: last session here)
118
122
  bccli import <file> import a session JSONL into the current project
119
123
  bccli pr <number> [--repo owner/name] [task] check out a GitHub PR and run a task on it
@@ -241,6 +245,7 @@ Opsi:
241
245
  "Note: {env} is still set in the environment and will keep being used.": "Catatan: {env} masih ter-set di environment dan akan terus dipakai.",
242
246
  "To revoke keys on your account, open {dashboard}.": "Untuk mencabut key akun kamu, buka {dashboard}.",
243
247
  "Budget exceeded ({kind}): {used} of {limit}. Further model calls are blocked; raise usageCap in ~/.bccli/config.json.": "Anggaran terlampaui ({kind}): {used} dari {limit}. Panggilan model selanjutnya diblokir; naikkan usageCap di ~/.bccli/config.json.",
248
+ "Could not save thinking visibility: {error}": "Gagal menyimpan pengaturan tampilan Thinking: {error}",
244
249
  "Verifying edits: {cmds}": "Memverifikasi edit: {cmds}",
245
250
  "Verification passed.": "Verifikasi lulus.",
246
251
  "Verification still failing after {n} fix round(s). Run the commands manually to see why.": "Verifikasi masih gagal setelah {n} ronde perbaikan. Jalankan perintahnya secara manual untuk melihat penyebabnya.",
@@ -441,11 +446,12 @@ Opsi:
441
446
  "Blocked: {host} resolves to a private address ({addr}). Fetching an internal host through a public DNS name is not allowed.": "Diblokir: {host} mengarah ke alamat privat ({addr}). Mengambil host internal lewat nama DNS publik tidak diizinkan.",
442
447
  "usage: bccli completion <{shells}>": "pakai: bccli completion <{shells}>",
443
448
  "--days must be a positive integer": "--days harus bilangan bulat positif",
449
+ "--tools must be a positive integer": "--tools harus bilangan bulat positif",
450
+ '--models must be a positive integer or "all"': '--models harus bilangan bulat positif atau "all"',
444
451
  "no sessions in the last {days} day(s)": "tidak ada sesi dalam {days} hari terakhir",
445
452
  "sessions (last {days} day(s)):": "sesi ({days} hari terakhir):",
446
453
  "session(s)": "sesi",
447
454
  "message(s)": "pesan",
448
- "recorded": "tercatat",
449
455
  "no session to export in this folder": "tidak ada sesi untuk diekspor di folder ini",
450
456
  "exported {file}": "diekspor ke {file}",
451
457
  "file not found: {file}": "file tidak ditemukan: {file}",
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  contentText
4
- } from "./chunk-RMDW3OQ6.js";
4
+ } from "./chunk-ASJRO2WF.js";
5
5
 
6
6
  // src/session.ts
7
7
  import { randomBytes } from "crypto";
@@ -52,6 +52,9 @@ var Session = class _Session {
52
52
  append(message) {
53
53
  this.write({ t: "msg", m: message });
54
54
  }
55
+ appendUsage(usage) {
56
+ this.write({ t: "usage", ...usage });
57
+ }
55
58
  reset() {
56
59
  this.write({ t: "reset" });
57
60
  }
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/version.ts
4
- var VERSION = true ? "0.4.0-beta.44" : "0.0.0-dev";
4
+ var VERSION = true ? "0.4.0-beta.46" : "0.0.0-dev";
5
5
 
6
6
  export {
7
7
  VERSION
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  ConfigError
4
- } from "./chunk-GIGWZFCY.js";
4
+ } from "./chunk-NGHOZRIM.js";
5
5
  import {
6
6
  t
7
- } from "./chunk-QHNWI3OT.js";
7
+ } from "./chunk-GI5GVU2L.js";
8
8
 
9
9
  // src/mcp/catalog.ts
10
10
  var CATALOG = [
@@ -1,21 +1,21 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  listAllModels
4
- } from "./chunk-25DSN3Y3.js";
4
+ } from "./chunk-PBBD37E7.js";
5
5
  import {
6
6
  hasKey,
7
7
  providerName,
8
8
  removeGlobalProvider,
9
9
  writeGlobalConfig
10
- } from "./chunk-VO6MF6JJ.js";
10
+ } from "./chunk-65OGHOGS.js";
11
11
  import {
12
12
  PRESETS,
13
13
  loadConfig,
14
14
  saveCredential
15
- } from "./chunk-GIGWZFCY.js";
15
+ } from "./chunk-NGHOZRIM.js";
16
16
  import {
17
17
  t
18
- } from "./chunk-QHNWI3OT.js";
18
+ } from "./chunk-GI5GVU2L.js";
19
19
 
20
20
  // src/providerCli.ts
21
21
  async function addProviderKey(providerId, key, deps) {
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  t
4
- } from "./chunk-QHNWI3OT.js";
4
+ } from "./chunk-GI5GVU2L.js";
5
5
 
6
6
  // src/config.ts
7
7
  import { chmodSync, existsSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "fs";
@@ -232,6 +232,7 @@ function loadConfig(cwd, env = process.env) {
232
232
  model: project.model ?? global.model ?? DEFAULT_CONFIG.model,
233
233
  permissionMode: global.permissionMode ?? DEFAULT_CONFIG.permissionMode,
234
234
  reasoning: global.reasoning ?? DEFAULT_CONFIG.reasoning,
235
+ thinkingVisible: global.thinkingVisible === true,
235
236
  maxSteps: resolvedMaxSteps(global),
236
237
  hooks: global.hooks,
237
238
  vision: global.vision ?? DEFAULT_CONFIG.vision,
@@ -5,14 +5,14 @@ import {
5
5
  import {
6
6
  REASONING_LEVELS,
7
7
  isReasoningLevel
8
- } from "./chunk-ZKMSTD6G.js";
8
+ } from "./chunk-FIY424O5.js";
9
9
  import {
10
10
  ConfigError
11
- } from "./chunk-GIGWZFCY.js";
11
+ } from "./chunk-NGHOZRIM.js";
12
12
  import {
13
13
  parseLang,
14
14
  t
15
- } from "./chunk-QHNWI3OT.js";
15
+ } from "./chunk-GI5GVU2L.js";
16
16
 
17
17
  // src/args.ts
18
18
  import { parseArgs } from "util";
@@ -87,7 +87,8 @@ Usage:
87
87
  bccli provider list|add <id>|remove <id> manage providers (custom: --url <url> [--name N] [--key-env ENV])
88
88
  bccli mcp list|add <name>|remove <name>|auth <name>|logout <name>|serve [--base-url <url>] manage MCP servers, or serve this account's tools over stdio
89
89
  bccli completion <shell> print a shell completion script (bash, zsh, fish, powershell)
90
- bccli stats [--days N] show token usage from local sessions (default: last 7 days)
90
+ bccli stats [--days N] [--tools N] [--models [N|all]] [--project slug]
91
+ show token usage from local sessions (default: last 7 days)
91
92
  bccli export [session] [file] copy a session JSONL to a file (default: last session here)
92
93
  bccli import <file> import a session JSONL into the current project
93
94
  bccli pr <number> [--repo owner/name] [task] check out a GitHub PR and run a task on it
@@ -110,8 +111,11 @@ Options:
110
111
  -h, --help this help`;
111
112
  var helpText = () => t(HELP);
112
113
  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
+ );
113
117
  const { values, positionals } = parseArgs({
114
- args: argv,
118
+ args: expanded,
115
119
  allowPositionals: true,
116
120
  options: {
117
121
  print: { type: "boolean", short: "p" },
@@ -138,6 +142,9 @@ function parseCliArgs(argv) {
138
142
  token: { type: "string" },
139
143
  "base-url": { type: "string" },
140
144
  days: { type: "string" },
145
+ tools: { type: "string" },
146
+ models: { type: "string" },
147
+ project: { type: "string" },
141
148
  repo: { type: "string" }
142
149
  }
143
150
  });
@@ -166,6 +173,17 @@ function parseCliArgs(argv) {
166
173
  if (days !== void 0 && (!Number.isInteger(days) || days < 1)) {
167
174
  throw new ConfigError(t("--days must be a positive integer"));
168
175
  }
176
+ const tools = values.tools !== void 0 ? Number(values.tools) : void 0;
177
+ if (tools !== void 0 && (!Number.isInteger(tools) || tools < 1)) {
178
+ throw new ConfigError(t("--tools must be a positive integer"));
179
+ }
180
+ let models;
181
+ if (values.models !== void 0) {
182
+ models = values.models === "" || values.models === "all" ? "all" : values.models;
183
+ if (models !== "all" && (!Number.isInteger(Number(models)) || Number(models) < 1)) {
184
+ throw new ConfigError(t('--models must be a positive integer or "all"'));
185
+ }
186
+ }
169
187
  if (values.host !== void 0 && !LOOPBACK_BIND.has(values.host)) {
170
188
  throw new ConfigError(t("serve only accepts loopback --host (127.0.0.1, localhost, ::1)"));
171
189
  }
@@ -198,6 +216,9 @@ function parseCliArgs(argv) {
198
216
  token: values.token,
199
217
  baseUrl: values["base-url"],
200
218
  days,
219
+ tools,
220
+ models,
221
+ project: values.project,
201
222
  repo: values.repo
202
223
  };
203
224
  }