@botconnector/bccli 0.4.0-beta.25 → 0.4.0-beta.26

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.
@@ -238,7 +238,7 @@ var LUNA_TOOL_SEARCH_MIN_MCP_SCHEMA_CHARS = 32e3;
238
238
  var LUNA_PTC_SAFE_FUNCTIONS = /* @__PURE__ */ new Set(["read", "grep", "glob"]);
239
239
  var LUNA_PTC_TOOL_OUTPUT_TRIGGER_CHARS = 8e3;
240
240
  var LUNA_PTC_MULTI_WORK_CUE = /\b(both|all|multiple|several|compare|comparison|aggregate|aggregation|total|count|sum|average|filter|join|merge|dedupe|deduplicate|rank|scan|across|every|semua|keduanya|beberapa|bandingkan|perbandingan|agregasi|hitung|jumlah|rata[- ]?rata|gabung|deduplikasi|urutkan|pindai|seluruh)\b|\b(many|banyak)\s+(files?|file|records?|rows?|items?|dokumen|berkas)\b/i;
241
- function shouldEnableLunaPtc(messages, enabled) {
241
+ function shouldEnableLunaPtc(messages, enabled, programmaticToolNames = []) {
242
242
  if (!enabled) return false;
243
243
  let lastUser = -1;
244
244
  for (let i = messages.length - 1; i >= 0; i--) {
@@ -251,13 +251,14 @@ function shouldEnableLunaPtc(messages, enabled) {
251
251
  const latestUser = lastUser >= 0 ? messages[lastUser] : void 0;
252
252
  const prompt = latestUser?.role === "user" ? latestUser.content : "";
253
253
  if (LUNA_PTC_MULTI_WORK_CUE.test(prompt)) return true;
254
+ const safeToolNames = /* @__PURE__ */ new Set([...LUNA_PTC_SAFE_FUNCTIONS, ...programmaticToolNames]);
254
255
  const safeCalls = /* @__PURE__ */ new Set();
255
256
  let safeOutputChars = 0;
256
257
  for (const message of turn) {
257
258
  if (message.role === "assistant") {
258
259
  if (message.responses_output_items?.some((item) => item.type === "program")) return true;
259
260
  for (const call of message.tool_calls ?? []) {
260
- if (LUNA_PTC_SAFE_FUNCTIONS.has(call.function.name)) safeCalls.add(call.id);
261
+ if (safeToolNames.has(call.function.name)) safeCalls.add(call.id);
261
262
  }
262
263
  continue;
263
264
  }
@@ -268,7 +269,7 @@ function shouldEnableLunaPtc(messages, enabled) {
268
269
  }
269
270
  return false;
270
271
  }
271
- function lunaToolPlan(tools, enableProgrammaticToolCalling = false) {
272
+ function lunaToolPlan(tools, enableProgrammaticToolCalling = false, programmaticToolNames = []) {
272
273
  const native = (tools ?? []).map((tool) => ({
273
274
  type: "function",
274
275
  name: tool.function.name,
@@ -280,9 +281,10 @@ function lunaToolPlan(tools, enableProgrammaticToolCalling = false) {
280
281
  const deferredSchemaChars = mcpIndexes.reduce((sum, index) => sum + JSON.stringify(native[index]).length, 0);
281
282
  const useToolSearch = mcpIndexes.length >= LUNA_TOOL_SEARCH_MIN_MCP_TOOLS || deferredSchemaChars >= LUNA_TOOL_SEARCH_MIN_MCP_SCHEMA_CHARS;
282
283
  let programmaticToolCount = 0;
284
+ const safeToolNames = /* @__PURE__ */ new Set([...LUNA_PTC_SAFE_FUNCTIONS, ...programmaticToolNames]);
283
285
  if (enableProgrammaticToolCalling) {
284
286
  for (let index = 0; index < native.length; index++) {
285
- if (LUNA_PTC_SAFE_FUNCTIONS.has(String(native[index].name))) {
287
+ if (safeToolNames.has(String(native[index].name))) {
286
288
  native[index] = { ...native[index], allowed_callers: ["direct", "programmatic"] };
287
289
  programmaticToolCount++;
288
290
  }
@@ -312,8 +314,8 @@ function lunaToolPlan(tools, enableProgrammaticToolCalling = false) {
312
314
  deferredSchemaChars
313
315
  };
314
316
  }
315
- function responseTools(tools, enableProgrammaticToolCalling = false) {
316
- return lunaToolPlan(tools, enableProgrammaticToolCalling).tools;
317
+ function responseTools(tools, enableProgrammaticToolCalling = false, programmaticToolNames = []) {
318
+ return lunaToolPlan(tools, enableProgrammaticToolCalling, programmaticToolNames).tools;
317
319
  }
318
320
  function responseReasoning(level) {
319
321
  if (level === "auto") return {};
@@ -706,8 +708,9 @@ function createProvider(options) {
706
708
  lunaWsIdleTimer = setTimeout(() => resetLunaWebSocket(), 10 * 6e4);
707
709
  lunaWsIdleTimer.unref?.();
708
710
  };
709
- async function chatLunaWebSocket(messages, tools, reasoning, signal, onText) {
710
- const nativeTools = responseTools(tools, shouldEnableLunaPtc(messages, enableProgrammaticToolCalling));
711
+ async function chatLunaWebSocket(messages, tools, programmaticToolNames, reasoning, signal, onText) {
712
+ const ptcEnabled = shouldEnableLunaPtc(messages, enableProgrammaticToolCalling, programmaticToolNames);
713
+ const nativeTools = responseTools(tools, ptcEnabled, programmaticToolNames);
711
714
  const initialPlan = responseContinuationInput(messages, lunaContinuation);
712
715
  for (let attempt = 0; attempt < 2; attempt++) {
713
716
  if (signal?.aborted) throw signal.reason ?? new Error("Request aborted");
@@ -783,7 +786,7 @@ function createProvider(options) {
783
786
  throw lastError ?? new ProviderError(t("Request failed"));
784
787
  }
785
788
  return {
786
- async chat({ messages, tools, signal, onText, onThinking, reasoning = "auto" }) {
789
+ async chat({ messages, tools, programmaticToolNames = [], signal, onText, onThinking, reasoning = "auto" }) {
787
790
  let reasoningOverride;
788
791
  try {
789
792
  reasoningOverride = reasoningPayload(providerId, reasoning);
@@ -792,14 +795,15 @@ function createProvider(options) {
792
795
  }
793
796
  if (useResponsesWebSocket) {
794
797
  try {
795
- return await chatLunaWebSocket(messages, tools, reasoning, signal, onText);
798
+ return await chatLunaWebSocket(messages, tools, programmaticToolNames, reasoning, signal, onText);
796
799
  } catch (error) {
797
800
  const err = error instanceof ProviderError ? error : new ProviderError(error.message);
798
801
  if (err.code !== "bc_ws_http_fallback") throw err;
799
802
  }
800
803
  }
801
804
  if (useNativeResponses) {
802
- const nativeTools = responseTools(tools, shouldEnableLunaPtc(messages, enableProgrammaticToolCalling));
805
+ const ptcEnabled = shouldEnableLunaPtc(messages, enableProgrammaticToolCalling, programmaticToolNames);
806
+ const nativeTools = responseTools(tools, ptcEnabled, programmaticToolNames);
803
807
  const res2 = await post(
804
808
  "/responses",
805
809
  {
@@ -35,7 +35,7 @@ function readSecret(prompt) {
35
35
  });
36
36
  }
37
37
  async function runLogin(providerId, cwd) {
38
- const { runProviderCommand } = await import("./providerCli-ELUAGUNX.js");
38
+ const { runProviderCommand } = await import("./providerCli-RY6T7K6G.js");
39
39
  const { parseCliArgs } = await import("./args-XQYEBOKB.js");
40
40
  return runProviderCommand(parseCliArgs(["provider", "add", providerId]), {
41
41
  env: process.env,
package/dist/cli.js CHANGED
@@ -22,7 +22,7 @@ import {
22
22
  createProvider,
23
23
  hasPendingProgrammaticReplay,
24
24
  listAllModels
25
- } from "./chunk-Z4CIQZA5.js";
25
+ } from "./chunk-MGCXWN3E.js";
26
26
  import {
27
27
  providerName,
28
28
  readGlobalConfigFile
@@ -30,7 +30,7 @@ import {
30
30
  import "./chunk-SN3ODJZN.js";
31
31
  import {
32
32
  runLogin
33
- } from "./chunk-FRB3MUQY.js";
33
+ } from "./chunk-WJWECLSO.js";
34
34
  import {
35
35
  Session,
36
36
  pruneSessions
@@ -966,6 +966,7 @@ ${completion.text}` });
966
966
  let completion = await this.provider.chat({
967
967
  messages: [{ role: "system", content: this.systemPrompt }, ...this.messages],
968
968
  tools: this.turnDefinitions,
969
+ programmaticToolNames: this.turnTools.filter((tool) => tool.programmaticSafe).map((tool) => tool.name),
969
970
  signal,
970
971
  onText: (delta) => this.onEvent({ type: "text", delta }),
971
972
  onThinking: (delta) => this.onEvent({ type: "thinking", delta }),
@@ -1247,6 +1248,7 @@ var McpManager = class {
1247
1248
  schema: z9.record(z9.string(), z9.unknown()),
1248
1249
  jsonSchema: tool.inputSchema,
1249
1250
  kind: "mcp",
1251
+ programmaticSafe: tool.annotations?.readOnlyHint === true,
1250
1252
  target: (input) => {
1251
1253
  const text = JSON.stringify(input);
1252
1254
  return text.length > 80 ? `${text.slice(0, 77)}\u2026` : text;
@@ -1659,7 +1661,7 @@ function createRuntime(opts) {
1659
1661
  }
1660
1662
 
1661
1663
  // src/version.ts
1662
- var VERSION = true ? "0.4.0-beta.25" : "0.0.0-dev";
1664
+ var VERSION = true ? "0.4.0-beta.26" : "0.0.0-dev";
1663
1665
 
1664
1666
  // src/cli.ts
1665
1667
  function chooseLanguage(argv) {
@@ -1685,12 +1687,12 @@ async function main() {
1685
1687
  if (args.command === "login") return runLogin(args.loginProvider ?? "bc-cloud", cwd);
1686
1688
  if (args.command === "mcp") {
1687
1689
  const { runMcpCommand } = await import("./mcpCli-J43FHF2H.js");
1688
- const { readSecret } = await import("./login-LXPNZMD7.js");
1690
+ const { readSecret } = await import("./login-IUSX5CB3.js");
1689
1691
  return runMcpCommand(args, { env: process.env, cwd, out: (s) => console.log(s), err: (s) => console.error(s), readSecret });
1690
1692
  }
1691
1693
  if (args.command === "provider") {
1692
- const { runProviderCommand } = await import("./providerCli-ELUAGUNX.js");
1693
- const { readSecret } = await import("./login-LXPNZMD7.js");
1694
+ const { runProviderCommand } = await import("./providerCli-RY6T7K6G.js");
1695
+ const { readSecret } = await import("./login-IUSX5CB3.js");
1694
1696
  return runProviderCommand(args, { env: process.env, cwd, out: (s) => console.log(s), err: (s) => console.error(s), readSecret });
1695
1697
  }
1696
1698
  if (args.command === "connect" || args.command === "disconnect" || args.command === "integrations") {
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  readSecret,
4
4
  runLogin
5
- } from "./chunk-FRB3MUQY.js";
5
+ } from "./chunk-WJWECLSO.js";
6
6
  export {
7
7
  readSecret,
8
8
  runLogin
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  addProviderKey,
4
4
  runProviderCommand
5
- } from "./chunk-Z4CIQZA5.js";
5
+ } from "./chunk-MGCXWN3E.js";
6
6
  import "./chunk-K5JNR3HL.js";
7
7
  import "./chunk-SN3ODJZN.js";
8
8
  import "./chunk-EO7IVVX4.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botconnector/bccli",
3
- "version": "0.4.0-beta.25",
3
+ "version": "0.4.0-beta.26",
4
4
  "description": "BCCLI — BotConnector AI coding agent for the terminal",
5
5
  "type": "module",
6
6
  "bin": {