@botconnector/bccli 0.4.0-beta.23 → 0.4.0-beta.25
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.
- package/dist/{chunk-XUJKRRPO.js → chunk-FRB3MUQY.js} +1 -1
- package/dist/{chunk-TUSJXGMP.js → chunk-Z4CIQZA5.js} +40 -5
- package/dist/cli.js +11 -7
- package/dist/{login-KHHIC6QQ.js → login-LXPNZMD7.js} +1 -1
- package/dist/{providerCli-Q3FWHOKL.js → providerCli-ELUAGUNX.js} +1 -1
- package/package.json +1 -1
|
@@ -35,7 +35,7 @@ function readSecret(prompt) {
|
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
37
|
async function runLogin(providerId, cwd) {
|
|
38
|
-
const { runProviderCommand } = await import("./providerCli-
|
|
38
|
+
const { runProviderCommand } = await import("./providerCli-ELUAGUNX.js");
|
|
39
39
|
const { parseCliArgs } = await import("./args-XQYEBOKB.js");
|
|
40
40
|
return runProviderCommand(parseCliArgs(["provider", "add", providerId]), {
|
|
41
41
|
env: process.env,
|
|
@@ -236,6 +236,38 @@ function responseInputFromMessages(messages) {
|
|
|
236
236
|
var LUNA_TOOL_SEARCH_MIN_MCP_TOOLS = 20;
|
|
237
237
|
var LUNA_TOOL_SEARCH_MIN_MCP_SCHEMA_CHARS = 32e3;
|
|
238
238
|
var LUNA_PTC_SAFE_FUNCTIONS = /* @__PURE__ */ new Set(["read", "grep", "glob"]);
|
|
239
|
+
var LUNA_PTC_TOOL_OUTPUT_TRIGGER_CHARS = 8e3;
|
|
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) {
|
|
242
|
+
if (!enabled) return false;
|
|
243
|
+
let lastUser = -1;
|
|
244
|
+
for (let i = messages.length - 1; i >= 0; i--) {
|
|
245
|
+
if (messages[i].role === "user") {
|
|
246
|
+
lastUser = i;
|
|
247
|
+
break;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
const turn = messages.slice(Math.max(0, lastUser));
|
|
251
|
+
const latestUser = lastUser >= 0 ? messages[lastUser] : void 0;
|
|
252
|
+
const prompt = latestUser?.role === "user" ? latestUser.content : "";
|
|
253
|
+
if (LUNA_PTC_MULTI_WORK_CUE.test(prompt)) return true;
|
|
254
|
+
const safeCalls = /* @__PURE__ */ new Set();
|
|
255
|
+
let safeOutputChars = 0;
|
|
256
|
+
for (const message of turn) {
|
|
257
|
+
if (message.role === "assistant") {
|
|
258
|
+
if (message.responses_output_items?.some((item) => item.type === "program")) return true;
|
|
259
|
+
for (const call of message.tool_calls ?? []) {
|
|
260
|
+
if (LUNA_PTC_SAFE_FUNCTIONS.has(call.function.name)) safeCalls.add(call.id);
|
|
261
|
+
}
|
|
262
|
+
continue;
|
|
263
|
+
}
|
|
264
|
+
if (message.role === "tool" && safeCalls.has(message.tool_call_id)) {
|
|
265
|
+
safeOutputChars += message.content.length;
|
|
266
|
+
if (safeOutputChars >= LUNA_PTC_TOOL_OUTPUT_TRIGGER_CHARS) return true;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
return false;
|
|
270
|
+
}
|
|
239
271
|
function lunaToolPlan(tools, enableProgrammaticToolCalling = false) {
|
|
240
272
|
const native = (tools ?? []).map((tool) => ({
|
|
241
273
|
type: "function",
|
|
@@ -247,19 +279,22 @@ function lunaToolPlan(tools, enableProgrammaticToolCalling = false) {
|
|
|
247
279
|
const mcpIndexes = native.map((tool, index) => String(tool.name).startsWith("mcp__") ? index : -1).filter((index) => index >= 0);
|
|
248
280
|
const deferredSchemaChars = mcpIndexes.reduce((sum, index) => sum + JSON.stringify(native[index]).length, 0);
|
|
249
281
|
const useToolSearch = mcpIndexes.length >= LUNA_TOOL_SEARCH_MIN_MCP_TOOLS || deferredSchemaChars >= LUNA_TOOL_SEARCH_MIN_MCP_SCHEMA_CHARS;
|
|
282
|
+
let programmaticToolCount = 0;
|
|
250
283
|
if (enableProgrammaticToolCalling) {
|
|
251
284
|
for (let index = 0; index < native.length; index++) {
|
|
252
285
|
if (LUNA_PTC_SAFE_FUNCTIONS.has(String(native[index].name))) {
|
|
253
286
|
native[index] = { ...native[index], allowed_callers: ["direct", "programmatic"] };
|
|
287
|
+
programmaticToolCount++;
|
|
254
288
|
}
|
|
255
289
|
}
|
|
256
|
-
native.push({ type: "programmatic_tool_calling" });
|
|
290
|
+
if (programmaticToolCount > 0) native.push({ type: "programmatic_tool_calling" });
|
|
257
291
|
}
|
|
292
|
+
const useProgrammaticToolCalling = programmaticToolCount > 0;
|
|
258
293
|
if (!useToolSearch) {
|
|
259
294
|
return {
|
|
260
295
|
tools: native,
|
|
261
296
|
useToolSearch: false,
|
|
262
|
-
useProgrammaticToolCalling
|
|
297
|
+
useProgrammaticToolCalling,
|
|
263
298
|
deferredToolCount: 0,
|
|
264
299
|
deferredSchemaChars
|
|
265
300
|
};
|
|
@@ -272,7 +307,7 @@ function lunaToolPlan(tools, enableProgrammaticToolCalling = false) {
|
|
|
272
307
|
return {
|
|
273
308
|
tools: native,
|
|
274
309
|
useToolSearch: true,
|
|
275
|
-
useProgrammaticToolCalling
|
|
310
|
+
useProgrammaticToolCalling,
|
|
276
311
|
deferredToolCount: mcpIndexes.length,
|
|
277
312
|
deferredSchemaChars
|
|
278
313
|
};
|
|
@@ -672,7 +707,7 @@ function createProvider(options) {
|
|
|
672
707
|
lunaWsIdleTimer.unref?.();
|
|
673
708
|
};
|
|
674
709
|
async function chatLunaWebSocket(messages, tools, reasoning, signal, onText) {
|
|
675
|
-
const nativeTools = responseTools(tools, enableProgrammaticToolCalling);
|
|
710
|
+
const nativeTools = responseTools(tools, shouldEnableLunaPtc(messages, enableProgrammaticToolCalling));
|
|
676
711
|
const initialPlan = responseContinuationInput(messages, lunaContinuation);
|
|
677
712
|
for (let attempt = 0; attempt < 2; attempt++) {
|
|
678
713
|
if (signal?.aborted) throw signal.reason ?? new Error("Request aborted");
|
|
@@ -764,7 +799,7 @@ function createProvider(options) {
|
|
|
764
799
|
}
|
|
765
800
|
}
|
|
766
801
|
if (useNativeResponses) {
|
|
767
|
-
const nativeTools = responseTools(tools, enableProgrammaticToolCalling);
|
|
802
|
+
const nativeTools = responseTools(tools, shouldEnableLunaPtc(messages, enableProgrammaticToolCalling));
|
|
768
803
|
const res2 = await post(
|
|
769
804
|
"/responses",
|
|
770
805
|
{
|
package/dist/cli.js
CHANGED
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
createProvider,
|
|
23
23
|
hasPendingProgrammaticReplay,
|
|
24
24
|
listAllModels
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-Z4CIQZA5.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-
|
|
33
|
+
} from "./chunk-FRB3MUQY.js";
|
|
34
34
|
import {
|
|
35
35
|
Session,
|
|
36
36
|
pruneSessions
|
|
@@ -1505,6 +1505,10 @@ function createTodoTool(store) {
|
|
|
1505
1505
|
|
|
1506
1506
|
// src/setup.ts
|
|
1507
1507
|
var TOOL_RULES = { bash: "bash", edit: "edit", write: "edit", fetch: "fetch" };
|
|
1508
|
+
function lunaPtcAutoEnabled(env) {
|
|
1509
|
+
const value = String(env.BCCLI_LUNA_PTC ?? "").trim().toLowerCase();
|
|
1510
|
+
return !["0", "false", "off", "no"].includes(value);
|
|
1511
|
+
}
|
|
1508
1512
|
function createRuntime(opts) {
|
|
1509
1513
|
const env = opts.env ?? process.env;
|
|
1510
1514
|
const home = bccliHome(env);
|
|
@@ -1518,7 +1522,7 @@ function createRuntime(opts) {
|
|
|
1518
1522
|
apiKey: resolved.apiKey,
|
|
1519
1523
|
model: resolved.model,
|
|
1520
1524
|
providerId: resolved.providerId,
|
|
1521
|
-
enableProgrammaticToolCalling: env
|
|
1525
|
+
enableProgrammaticToolCalling: lunaPtcAutoEnabled(env)
|
|
1522
1526
|
});
|
|
1523
1527
|
};
|
|
1524
1528
|
const provider = makeProvider(modelRef);
|
|
@@ -1655,7 +1659,7 @@ function createRuntime(opts) {
|
|
|
1655
1659
|
}
|
|
1656
1660
|
|
|
1657
1661
|
// src/version.ts
|
|
1658
|
-
var VERSION = true ? "0.4.0-beta.
|
|
1662
|
+
var VERSION = true ? "0.4.0-beta.25" : "0.0.0-dev";
|
|
1659
1663
|
|
|
1660
1664
|
// src/cli.ts
|
|
1661
1665
|
function chooseLanguage(argv) {
|
|
@@ -1681,12 +1685,12 @@ async function main() {
|
|
|
1681
1685
|
if (args.command === "login") return runLogin(args.loginProvider ?? "bc-cloud", cwd);
|
|
1682
1686
|
if (args.command === "mcp") {
|
|
1683
1687
|
const { runMcpCommand } = await import("./mcpCli-J43FHF2H.js");
|
|
1684
|
-
const { readSecret } = await import("./login-
|
|
1688
|
+
const { readSecret } = await import("./login-LXPNZMD7.js");
|
|
1685
1689
|
return runMcpCommand(args, { env: process.env, cwd, out: (s) => console.log(s), err: (s) => console.error(s), readSecret });
|
|
1686
1690
|
}
|
|
1687
1691
|
if (args.command === "provider") {
|
|
1688
|
-
const { runProviderCommand } = await import("./providerCli-
|
|
1689
|
-
const { readSecret } = await import("./login-
|
|
1692
|
+
const { runProviderCommand } = await import("./providerCli-ELUAGUNX.js");
|
|
1693
|
+
const { readSecret } = await import("./login-LXPNZMD7.js");
|
|
1690
1694
|
return runProviderCommand(args, { env: process.env, cwd, out: (s) => console.log(s), err: (s) => console.error(s), readSecret });
|
|
1691
1695
|
}
|
|
1692
1696
|
if (args.command === "connect" || args.command === "disconnect" || args.command === "integrations") {
|