@botconnector/bccli 0.4.0-beta.19 → 0.4.0-beta.20
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/{args-L555OESS.js → args-XQYEBOKB.js} +3 -3
- package/dist/{chunk-ERVDVPKJ.js → chunk-44MXWCFN.js} +1 -1
- package/dist/{chunk-RQGMYLVH.js → chunk-BEXQSEBI.js} +1 -1
- package/dist/{chunk-DDA5TJ7T.js → chunk-EO7IVVX4.js} +3 -0
- package/dist/{chunk-K5J2GGXT.js → chunk-HP3J6JEY.js} +1 -1
- package/dist/{chunk-BPWCF4EJ.js → chunk-IEUNV3XI.js} +2 -2
- package/dist/{chunk-D7CF42EW.js → chunk-K5JNR3HL.js} +1 -1
- package/dist/{chunk-6AVRFRFU.js → chunk-ON6JYPE7.js} +2 -2
- package/dist/{chunk-VEZFR7M7.js → chunk-SN3ODJZN.js} +1 -1
- package/dist/{chunk-DXRLNNM7.js → chunk-ZHB44IEA.js} +275 -5
- package/dist/cli.js +15 -15
- package/dist/{config-CGYYFECG.js → config-PBEZ3IGD.js} +2 -2
- package/dist/{integrationCli-RQO3HHQE.js → integrationCli-ZTZSZLO7.js} +1 -1
- package/dist/{login-W4A3EQ53.js → login-QPH44MM5.js} +1 -1
- package/dist/{mcpCli-QJE7P76I.js → mcpCli-J43FHF2H.js} +3 -3
- package/dist/providerCli-GQCLV6X2.js +12 -0
- package/dist/{ui-RNP272MP.js → ui-SRXPL7KU.js} +7 -7
- package/package.json +4 -1
- package/dist/providerCli-WBBIQEJ2.js +0 -12
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import {
|
|
3
3
|
helpText,
|
|
4
4
|
parseCliArgs
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-ON6JYPE7.js";
|
|
6
6
|
import "./chunk-ELML4KVQ.js";
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-SN3ODJZN.js";
|
|
8
|
+
import "./chunk-EO7IVVX4.js";
|
|
9
9
|
export {
|
|
10
10
|
helpText,
|
|
11
11
|
parseCliArgs
|
|
@@ -162,6 +162,9 @@ Opsi:
|
|
|
162
162
|
"Cannot connect to {url}: {error}": "Tidak bisa terhubung ke {url}: {error}",
|
|
163
163
|
"{status} from {url}: {message}": "{status} dari {url}: {message}",
|
|
164
164
|
"Request failed": "Permintaan gagal",
|
|
165
|
+
"Connection closed before the response finished.": "Koneksi ditutup sebelum respons selesai.",
|
|
166
|
+
"WebSocket connection failed.": "Koneksi WebSocket gagal.",
|
|
167
|
+
"WebSocket connection closed: {reason}": "Koneksi WebSocket ditutup: {reason}",
|
|
165
168
|
"Empty response from the provider": "Respons provider kosong",
|
|
166
169
|
"{status} while fetching the model list": "{status} saat mengambil daftar model",
|
|
167
170
|
"The API key was rejected or {provider} could not be reached.": "API key ditolak atau {provider} tidak bisa dihubungi.",
|
|
@@ -35,8 +35,8 @@ function readSecret(prompt) {
|
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
37
|
async function runLogin(providerId, cwd) {
|
|
38
|
-
const { runProviderCommand } = await import("./providerCli-
|
|
39
|
-
const { parseCliArgs } = await import("./args-
|
|
38
|
+
const { runProviderCommand } = await import("./providerCli-GQCLV6X2.js");
|
|
39
|
+
const { parseCliArgs } = await import("./args-XQYEBOKB.js");
|
|
40
40
|
return runProviderCommand(parseCliArgs(["provider", "add", providerId]), {
|
|
41
41
|
env: process.env,
|
|
42
42
|
cwd,
|
|
@@ -5,12 +5,12 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
REASONING_LEVELS,
|
|
7
7
|
isReasoningLevel
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-SN3ODJZN.js";
|
|
9
9
|
import {
|
|
10
10
|
ConfigError,
|
|
11
11
|
parseLang,
|
|
12
12
|
t
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-EO7IVVX4.js";
|
|
14
14
|
|
|
15
15
|
// src/args.ts
|
|
16
16
|
import { parseArgs } from "util";
|
|
@@ -4,17 +4,21 @@ import {
|
|
|
4
4
|
providerName,
|
|
5
5
|
removeGlobalProvider,
|
|
6
6
|
writeGlobalConfig
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-K5JNR3HL.js";
|
|
8
8
|
import {
|
|
9
9
|
reasoningPayload
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-SN3ODJZN.js";
|
|
11
11
|
import {
|
|
12
12
|
PRESETS,
|
|
13
13
|
loadConfig,
|
|
14
14
|
readCredentials,
|
|
15
15
|
saveCredential,
|
|
16
16
|
t
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-EO7IVVX4.js";
|
|
18
|
+
|
|
19
|
+
// src/provider.ts
|
|
20
|
+
import OpenAI from "openai";
|
|
21
|
+
import { ResponsesWS } from "openai/resources/responses/ws";
|
|
18
22
|
|
|
19
23
|
// src/thinking.ts
|
|
20
24
|
var OPEN = "<think>";
|
|
@@ -66,11 +70,13 @@ function splitThinking(text) {
|
|
|
66
70
|
|
|
67
71
|
// src/provider.ts
|
|
68
72
|
var ProviderError = class extends Error {
|
|
69
|
-
constructor(message, status) {
|
|
73
|
+
constructor(message, status, code) {
|
|
70
74
|
super(message);
|
|
71
75
|
this.status = status;
|
|
76
|
+
this.code = code;
|
|
72
77
|
}
|
|
73
78
|
status;
|
|
79
|
+
code;
|
|
74
80
|
};
|
|
75
81
|
var retryable = (status) => status === 429 || status >= 500;
|
|
76
82
|
function detectRepetition(text) {
|
|
@@ -344,7 +350,166 @@ async function readResponsesJson(res) {
|
|
|
344
350
|
finishReason: toolCalls.length ? "tool_calls" : body.status === "incomplete" ? String(body.incomplete_details?.reason || "incomplete") : "stop"
|
|
345
351
|
};
|
|
346
352
|
}
|
|
347
|
-
function
|
|
353
|
+
function cloneMessages(messages) {
|
|
354
|
+
return structuredClone(messages);
|
|
355
|
+
}
|
|
356
|
+
function sameMessage(a, b) {
|
|
357
|
+
return JSON.stringify(a) === JSON.stringify(b);
|
|
358
|
+
}
|
|
359
|
+
function completionAssistantMessage(completion) {
|
|
360
|
+
return {
|
|
361
|
+
role: "assistant",
|
|
362
|
+
content: completion.text || null,
|
|
363
|
+
...completion.toolCalls.length ? {
|
|
364
|
+
tool_calls: completion.toolCalls.map((call) => ({
|
|
365
|
+
id: call.id,
|
|
366
|
+
type: "function",
|
|
367
|
+
function: { name: call.name, arguments: call.arguments }
|
|
368
|
+
}))
|
|
369
|
+
} : {}
|
|
370
|
+
};
|
|
371
|
+
}
|
|
372
|
+
function responseContinuationInput(messages, continuation) {
|
|
373
|
+
if (!continuation || messages.length <= continuation.requestMessages.length) {
|
|
374
|
+
return { input: responseInputFromMessages(messages), incremental: false };
|
|
375
|
+
}
|
|
376
|
+
for (let i = 0; i < continuation.requestMessages.length; i++) {
|
|
377
|
+
if (!sameMessage(messages[i], continuation.requestMessages[i])) {
|
|
378
|
+
return { input: responseInputFromMessages(messages), incremental: false };
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
const expectedAssistant = completionAssistantMessage(continuation.completion);
|
|
382
|
+
const assistant = messages[continuation.requestMessages.length];
|
|
383
|
+
if (!assistant || !sameMessage(assistant, expectedAssistant)) {
|
|
384
|
+
return { input: responseInputFromMessages(messages), incremental: false };
|
|
385
|
+
}
|
|
386
|
+
const delta = messages.slice(continuation.requestMessages.length + 1);
|
|
387
|
+
if (!delta.length) return { input: responseInputFromMessages(messages), incremental: false };
|
|
388
|
+
return {
|
|
389
|
+
input: responseInputFromMessages(delta),
|
|
390
|
+
previousResponseId: continuation.responseId,
|
|
391
|
+
incremental: true
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
async function readResponsesWebSocketTurn(events, ws, onText, signal) {
|
|
395
|
+
let responseId = "";
|
|
396
|
+
let text = "";
|
|
397
|
+
let usage;
|
|
398
|
+
let finishReason;
|
|
399
|
+
let loopAt = -1;
|
|
400
|
+
const calls = /* @__PURE__ */ new Map();
|
|
401
|
+
const emitText = (delta) => {
|
|
402
|
+
if (!delta) return;
|
|
403
|
+
text += delta;
|
|
404
|
+
onText?.(delta);
|
|
405
|
+
if (loopAt < 0) loopAt = detectRepetition(text);
|
|
406
|
+
};
|
|
407
|
+
const abort = () => {
|
|
408
|
+
try {
|
|
409
|
+
ws.close({ code: 1e3, reason: "BCCLI request cancelled" });
|
|
410
|
+
} catch {
|
|
411
|
+
}
|
|
412
|
+
};
|
|
413
|
+
signal?.addEventListener("abort", abort, { once: true });
|
|
414
|
+
try {
|
|
415
|
+
while (true) {
|
|
416
|
+
if (signal?.aborted) throw signal.reason ?? new Error("Request aborted");
|
|
417
|
+
const next = await events.next();
|
|
418
|
+
if (next.done) throw new ProviderError(t("Connection closed before the response finished."));
|
|
419
|
+
const envelope = next.value;
|
|
420
|
+
if (envelope.type === "error") {
|
|
421
|
+
throw new ProviderError(envelope.error.message || t("WebSocket connection failed."));
|
|
422
|
+
}
|
|
423
|
+
if (envelope.type === "close") {
|
|
424
|
+
throw new ProviderError(
|
|
425
|
+
t("WebSocket connection closed: {reason}", { reason: envelope.reason || String(envelope.code) })
|
|
426
|
+
);
|
|
427
|
+
}
|
|
428
|
+
if (envelope.type !== "message") continue;
|
|
429
|
+
const event = envelope.message;
|
|
430
|
+
if (event.type === "error") {
|
|
431
|
+
const code = "code" in (event.error ?? {}) ? String(event.error.code || "") : void 0;
|
|
432
|
+
throw new ProviderError(
|
|
433
|
+
t("Error from the provider: {message}", { message: event.error?.message ?? event.message ?? JSON.stringify(event) }),
|
|
434
|
+
event.status,
|
|
435
|
+
code
|
|
436
|
+
);
|
|
437
|
+
}
|
|
438
|
+
if (event.type === "response.created") {
|
|
439
|
+
responseId = String(event.response?.id || responseId);
|
|
440
|
+
continue;
|
|
441
|
+
}
|
|
442
|
+
if (event.type === "response.output_text.delta" || event.type === "response.refusal.delta") {
|
|
443
|
+
emitText(String(event.delta ?? ""));
|
|
444
|
+
if (loopAt >= 0) {
|
|
445
|
+
abort();
|
|
446
|
+
return {
|
|
447
|
+
responseId,
|
|
448
|
+
completion: { text: text.slice(0, loopAt), toolCalls: [], usage, finishReason: "repetition" }
|
|
449
|
+
};
|
|
450
|
+
}
|
|
451
|
+
continue;
|
|
452
|
+
}
|
|
453
|
+
if (event.type === "response.output_item.added" && event.item?.type === "function_call") {
|
|
454
|
+
const index = Number(event.output_index ?? calls.size);
|
|
455
|
+
calls.set(index, {
|
|
456
|
+
id: String(event.item.call_id || event.item.id || `call_${index}`),
|
|
457
|
+
name: String(event.item.name || ""),
|
|
458
|
+
arguments: String(event.item.arguments || "")
|
|
459
|
+
});
|
|
460
|
+
continue;
|
|
461
|
+
}
|
|
462
|
+
if (event.type === "response.function_call_arguments.delta") {
|
|
463
|
+
const index = Number(event.output_index ?? 0);
|
|
464
|
+
const call = calls.get(index);
|
|
465
|
+
if (call) call.arguments += String(event.delta || "");
|
|
466
|
+
continue;
|
|
467
|
+
}
|
|
468
|
+
if (event.type === "response.output_item.done" && event.item?.type === "function_call") {
|
|
469
|
+
const index = Number(event.output_index ?? 0);
|
|
470
|
+
const current = calls.get(index);
|
|
471
|
+
calls.set(index, {
|
|
472
|
+
id: String(event.item.call_id || current?.id || event.item.id || `call_${index}`),
|
|
473
|
+
name: String(event.item.name || current?.name || ""),
|
|
474
|
+
arguments: String(event.item.arguments ?? current?.arguments ?? "")
|
|
475
|
+
});
|
|
476
|
+
continue;
|
|
477
|
+
}
|
|
478
|
+
if (event.type === "response.failed") {
|
|
479
|
+
throw new ProviderError(
|
|
480
|
+
t("Error from the provider: {message}", { message: event.response?.error?.message ?? "Response failed" })
|
|
481
|
+
);
|
|
482
|
+
}
|
|
483
|
+
if (event.type === "response.completed" || event.type === "response.incomplete") {
|
|
484
|
+
responseId = String(event.response?.id || responseId);
|
|
485
|
+
usage = toResponsesUsage(event.response?.usage);
|
|
486
|
+
finishReason = event.type === "response.incomplete" ? String(event.response?.incomplete_details?.reason || "incomplete") : calls.size ? "tool_calls" : "stop";
|
|
487
|
+
return {
|
|
488
|
+
responseId,
|
|
489
|
+
completion: {
|
|
490
|
+
text,
|
|
491
|
+
toolCalls: [...calls.entries()].sort(([a], [b]) => a - b).map(([, call]) => call),
|
|
492
|
+
usage,
|
|
493
|
+
finishReason
|
|
494
|
+
}
|
|
495
|
+
};
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
} finally {
|
|
499
|
+
signal?.removeEventListener("abort", abort);
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
function createProvider(options) {
|
|
503
|
+
const {
|
|
504
|
+
baseURL,
|
|
505
|
+
apiKey,
|
|
506
|
+
model,
|
|
507
|
+
providerId,
|
|
508
|
+
fetch: fetchOverride,
|
|
509
|
+
retryDelayMs = 1e3,
|
|
510
|
+
responsesWebSocketFactory
|
|
511
|
+
} = options;
|
|
512
|
+
const doFetch = fetchOverride ?? fetch;
|
|
348
513
|
const headers = { "content-type": "application/json" };
|
|
349
514
|
if (apiKey) headers.authorization = `Bearer ${apiKey}`;
|
|
350
515
|
const isBotConnectorCloud = /^https:\/\/api\.botconnector\.id\/v1\/?$/.test(baseURL) && apiKey?.startsWith("bc_live_");
|
|
@@ -353,6 +518,103 @@ function createProvider({ baseURL, apiKey, model, providerId, fetch: doFetch = f
|
|
|
353
518
|
headers["x-botconnector-client-version"] = "0.4.0";
|
|
354
519
|
}
|
|
355
520
|
const useNativeResponses = isBotConnectorCloud && providerId === "bc-cloud" && model === "gpt-6-luna";
|
|
521
|
+
const useResponsesWebSocket = useNativeResponses && Boolean(apiKey) && (fetchOverride === void 0 || responsesWebSocketFactory !== void 0);
|
|
522
|
+
let lunaWs;
|
|
523
|
+
let lunaWsEvents;
|
|
524
|
+
let lunaContinuation;
|
|
525
|
+
let lunaWsIdleTimer;
|
|
526
|
+
const resetLunaWebSocket = () => {
|
|
527
|
+
if (lunaWsIdleTimer) clearTimeout(lunaWsIdleTimer);
|
|
528
|
+
lunaWsIdleTimer = void 0;
|
|
529
|
+
const current = lunaWs;
|
|
530
|
+
lunaWs = void 0;
|
|
531
|
+
lunaWsEvents = void 0;
|
|
532
|
+
lunaContinuation = void 0;
|
|
533
|
+
if (current) {
|
|
534
|
+
try {
|
|
535
|
+
current.close({ code: 1e3, reason: "BCCLI reset" });
|
|
536
|
+
} catch {
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
};
|
|
540
|
+
const ensureLunaWebSocket = () => {
|
|
541
|
+
if (lunaWsIdleTimer) clearTimeout(lunaWsIdleTimer);
|
|
542
|
+
lunaWsIdleTimer = void 0;
|
|
543
|
+
if (!lunaWs || !lunaWsEvents) {
|
|
544
|
+
const client = new OpenAI({
|
|
545
|
+
apiKey,
|
|
546
|
+
baseURL: baseURL.replace(/\/+$/, ""),
|
|
547
|
+
defaultHeaders: {
|
|
548
|
+
"x-botconnector-client": "bccli",
|
|
549
|
+
"x-botconnector-client-version": "0.4.0"
|
|
550
|
+
}
|
|
551
|
+
});
|
|
552
|
+
lunaWs = responsesWebSocketFactory ? responsesWebSocketFactory(client) : new ResponsesWS(client, { reconnect: null });
|
|
553
|
+
lunaWsEvents = lunaWs.stream({ maxBufferedEvents: 4096 });
|
|
554
|
+
}
|
|
555
|
+
return { ws: lunaWs, events: lunaWsEvents };
|
|
556
|
+
};
|
|
557
|
+
const scheduleLunaWebSocketIdleReset = () => {
|
|
558
|
+
if (lunaWsIdleTimer) clearTimeout(lunaWsIdleTimer);
|
|
559
|
+
lunaWsIdleTimer = setTimeout(() => resetLunaWebSocket(), 10 * 6e4);
|
|
560
|
+
lunaWsIdleTimer.unref?.();
|
|
561
|
+
};
|
|
562
|
+
async function chatLunaWebSocket(messages, tools, reasoning, signal, onText) {
|
|
563
|
+
const nativeTools = responseTools(tools);
|
|
564
|
+
const initialPlan = responseContinuationInput(messages, lunaContinuation);
|
|
565
|
+
for (let attempt = 0; attempt < 2; attempt++) {
|
|
566
|
+
if (signal?.aborted) throw signal.reason ?? new Error("Request aborted");
|
|
567
|
+
const plan = attempt === 0 ? initialPlan : { input: responseInputFromMessages(messages), incremental: false, previousResponseId: void 0 };
|
|
568
|
+
const { ws, events } = ensureLunaWebSocket();
|
|
569
|
+
const createEvent = {
|
|
570
|
+
type: "response.create",
|
|
571
|
+
stream_id: "main",
|
|
572
|
+
model,
|
|
573
|
+
store: false,
|
|
574
|
+
input: plan.input,
|
|
575
|
+
...plan.previousResponseId ? { previous_response_id: plan.previousResponseId } : {},
|
|
576
|
+
...nativeTools.length ? { tools: nativeTools } : {},
|
|
577
|
+
...responseReasoning(reasoning)
|
|
578
|
+
};
|
|
579
|
+
let emittedText = false;
|
|
580
|
+
const trackText = (delta) => {
|
|
581
|
+
if (delta) emittedText = true;
|
|
582
|
+
onText?.(delta);
|
|
583
|
+
};
|
|
584
|
+
try {
|
|
585
|
+
ws.send(createEvent);
|
|
586
|
+
const result = await readResponsesWebSocketTurn(events, ws, trackText, signal);
|
|
587
|
+
if (result.completion.finishReason === "repetition") {
|
|
588
|
+
resetLunaWebSocket();
|
|
589
|
+
return result.completion;
|
|
590
|
+
}
|
|
591
|
+
if (!result.responseId) {
|
|
592
|
+
resetLunaWebSocket();
|
|
593
|
+
return result.completion;
|
|
594
|
+
}
|
|
595
|
+
lunaContinuation = {
|
|
596
|
+
responseId: result.responseId,
|
|
597
|
+
requestMessages: cloneMessages(messages),
|
|
598
|
+
completion: structuredClone(result.completion)
|
|
599
|
+
};
|
|
600
|
+
scheduleLunaWebSocketIdleReset();
|
|
601
|
+
return result.completion;
|
|
602
|
+
} catch (error) {
|
|
603
|
+
const err = error instanceof ProviderError ? error : new ProviderError(error.message);
|
|
604
|
+
const lostPrevious = err.code === "previous_response_not_found";
|
|
605
|
+
const connectionLost = /websocket|connection closed|socket|network/i.test(err.message) || err.code === "websocket_connection_limit_reached";
|
|
606
|
+
resetLunaWebSocket();
|
|
607
|
+
if (attempt === 0 && !emittedText && !signal?.aborted && (plan.incremental || lostPrevious || connectionLost)) {
|
|
608
|
+
continue;
|
|
609
|
+
}
|
|
610
|
+
if (!emittedText && !signal?.aborted && connectionLost) {
|
|
611
|
+
throw new ProviderError(err.message, err.status, "bc_ws_http_fallback");
|
|
612
|
+
}
|
|
613
|
+
throw err;
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
throw new ProviderError(t("Request failed"));
|
|
617
|
+
}
|
|
356
618
|
async function post(path, body, signal) {
|
|
357
619
|
let lastError;
|
|
358
620
|
for (let attempt = 0; attempt < 4; attempt++) {
|
|
@@ -380,6 +642,14 @@ function createProvider({ baseURL, apiKey, model, providerId, fetch: doFetch = f
|
|
|
380
642
|
} catch (error) {
|
|
381
643
|
throw new ProviderError(error.message);
|
|
382
644
|
}
|
|
645
|
+
if (useResponsesWebSocket) {
|
|
646
|
+
try {
|
|
647
|
+
return await chatLunaWebSocket(messages, tools, reasoning, signal, onText);
|
|
648
|
+
} catch (error) {
|
|
649
|
+
const err = error instanceof ProviderError ? error : new ProviderError(error.message);
|
|
650
|
+
if (err.code !== "bc_ws_http_fallback") throw err;
|
|
651
|
+
}
|
|
652
|
+
}
|
|
383
653
|
if (useNativeResponses) {
|
|
384
654
|
const nativeTools = responseTools(tools);
|
|
385
655
|
const res2 = await post(
|
package/dist/cli.js
CHANGED
|
@@ -8,11 +8,11 @@ import {
|
|
|
8
8
|
loadSkills,
|
|
9
9
|
parseFrontmatter,
|
|
10
10
|
runPrint
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-HP3J6JEY.js";
|
|
12
12
|
import {
|
|
13
13
|
helpText,
|
|
14
14
|
parseCliArgs
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-ON6JYPE7.js";
|
|
16
16
|
import {
|
|
17
17
|
Permissions
|
|
18
18
|
} from "./chunk-ELML4KVQ.js";
|
|
@@ -20,15 +20,15 @@ import {
|
|
|
20
20
|
addProviderKey,
|
|
21
21
|
createProvider,
|
|
22
22
|
listAllModels
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-ZHB44IEA.js";
|
|
24
24
|
import {
|
|
25
25
|
providerName,
|
|
26
26
|
readGlobalConfigFile
|
|
27
|
-
} from "./chunk-
|
|
28
|
-
import "./chunk-
|
|
27
|
+
} from "./chunk-K5JNR3HL.js";
|
|
28
|
+
import "./chunk-SN3ODJZN.js";
|
|
29
29
|
import {
|
|
30
30
|
runLogin
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-IEUNV3XI.js";
|
|
32
32
|
import {
|
|
33
33
|
Session,
|
|
34
34
|
pruneSessions
|
|
@@ -41,7 +41,7 @@ import {
|
|
|
41
41
|
resolveModel,
|
|
42
42
|
setLanguage,
|
|
43
43
|
t
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-EO7IVVX4.js";
|
|
45
45
|
|
|
46
46
|
// src/textToolCalls.ts
|
|
47
47
|
var PAIR = /(?:<arg_key>\s*|`)?([A-Za-z_]\w*)(?:\s*<\/arg_key>)?`?\s*(?:=\s*`|<arg_value>)([\s\S]*?)<\/arg_value>/g;
|
|
@@ -1604,7 +1604,7 @@ function createRuntime(opts) {
|
|
|
1604
1604
|
}
|
|
1605
1605
|
|
|
1606
1606
|
// src/version.ts
|
|
1607
|
-
var VERSION = true ? "0.4.0-beta.
|
|
1607
|
+
var VERSION = true ? "0.4.0-beta.20" : "0.0.0-dev";
|
|
1608
1608
|
|
|
1609
1609
|
// src/cli.ts
|
|
1610
1610
|
function chooseLanguage(argv) {
|
|
@@ -1629,17 +1629,17 @@ async function main() {
|
|
|
1629
1629
|
const cwd = process.cwd();
|
|
1630
1630
|
if (args.command === "login") return runLogin(args.loginProvider ?? "bc-cloud", cwd);
|
|
1631
1631
|
if (args.command === "mcp") {
|
|
1632
|
-
const { runMcpCommand } = await import("./mcpCli-
|
|
1633
|
-
const { readSecret } = await import("./login-
|
|
1632
|
+
const { runMcpCommand } = await import("./mcpCli-J43FHF2H.js");
|
|
1633
|
+
const { readSecret } = await import("./login-QPH44MM5.js");
|
|
1634
1634
|
return runMcpCommand(args, { env: process.env, cwd, out: (s) => console.log(s), err: (s) => console.error(s), readSecret });
|
|
1635
1635
|
}
|
|
1636
1636
|
if (args.command === "provider") {
|
|
1637
|
-
const { runProviderCommand } = await import("./providerCli-
|
|
1638
|
-
const { readSecret } = await import("./login-
|
|
1637
|
+
const { runProviderCommand } = await import("./providerCli-GQCLV6X2.js");
|
|
1638
|
+
const { readSecret } = await import("./login-QPH44MM5.js");
|
|
1639
1639
|
return runProviderCommand(args, { env: process.env, cwd, out: (s) => console.log(s), err: (s) => console.error(s), readSecret });
|
|
1640
1640
|
}
|
|
1641
1641
|
if (args.command === "connect" || args.command === "disconnect" || args.command === "integrations") {
|
|
1642
|
-
const { runIntegrationCommand } = await import("./integrationCli-
|
|
1642
|
+
const { runIntegrationCommand } = await import("./integrationCli-ZTZSZLO7.js");
|
|
1643
1643
|
return runIntegrationCommand(args, {
|
|
1644
1644
|
env: process.env,
|
|
1645
1645
|
cwd,
|
|
@@ -1662,7 +1662,7 @@ async function main() {
|
|
|
1662
1662
|
}
|
|
1663
1663
|
if (args.print) {
|
|
1664
1664
|
if (!args.prompt) throw new ConfigError(t('-p mode needs a task, e.g. bccli -p "explain this repo"'));
|
|
1665
|
-
const { serversToStart } = await import("./config-
|
|
1665
|
+
const { serversToStart } = await import("./config-PBEZ3IGD.js");
|
|
1666
1666
|
const plan = serversToStart(rt.home, cwd);
|
|
1667
1667
|
for (const s of plan.needTrust) {
|
|
1668
1668
|
console.error(t('Project MCP server "{name}" skipped (not approved yet; run interactive bccli once to approve it).', { name: s.name }));
|
|
@@ -1675,7 +1675,7 @@ async function main() {
|
|
|
1675
1675
|
}
|
|
1676
1676
|
}
|
|
1677
1677
|
if (!process.stdin.isTTY) throw new ConfigError(t('Interactive mode needs a terminal. For scripts/CI use: bccli -p "task"'));
|
|
1678
|
-
const { startInteractive } = await import("./ui-
|
|
1678
|
+
const { startInteractive } = await import("./ui-SRXPL7KU.js");
|
|
1679
1679
|
return startInteractive(rt, { initialPrompt: args.prompt, resume: args.resume, version: VERSION });
|
|
1680
1680
|
}
|
|
1681
1681
|
main().then(
|
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
import {
|
|
3
3
|
CATALOG,
|
|
4
4
|
fillTemplate
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-BEXQSEBI.js";
|
|
6
6
|
import {
|
|
7
7
|
addGlobalServer,
|
|
8
8
|
globalMcpPath,
|
|
9
9
|
readMcpFile,
|
|
10
10
|
removeGlobalServer
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-44MXWCFN.js";
|
|
12
12
|
import {
|
|
13
13
|
bccliHome,
|
|
14
14
|
t
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-EO7IVVX4.js";
|
|
16
16
|
|
|
17
17
|
// src/mcpCli.ts
|
|
18
18
|
async function runMcpCommand(args, deps) {
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
instructionPaths,
|
|
6
6
|
parseFrontmatter,
|
|
7
7
|
toolLabel
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-HP3J6JEY.js";
|
|
9
9
|
import {
|
|
10
10
|
nextMode
|
|
11
11
|
} from "./chunk-ELML4KVQ.js";
|
|
@@ -13,26 +13,26 @@ import {
|
|
|
13
13
|
hasKey,
|
|
14
14
|
providerName,
|
|
15
15
|
writeGlobalConfig
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-K5JNR3HL.js";
|
|
17
17
|
import {
|
|
18
18
|
REASONING_LEVELS,
|
|
19
19
|
assertReasoningSupported,
|
|
20
20
|
parseReasoningLevel,
|
|
21
21
|
supportedReasoningLevels
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-SN3ODJZN.js";
|
|
23
23
|
import {
|
|
24
24
|
Session
|
|
25
25
|
} from "./chunk-SJH3YLW4.js";
|
|
26
26
|
import {
|
|
27
27
|
CATALOG,
|
|
28
28
|
fillTemplate
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-BEXQSEBI.js";
|
|
30
30
|
import {
|
|
31
31
|
addGlobalServer,
|
|
32
32
|
globalMcpPath,
|
|
33
33
|
readMcpFile,
|
|
34
34
|
removeGlobalServer
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-44MXWCFN.js";
|
|
36
36
|
import {
|
|
37
37
|
PRESETS,
|
|
38
38
|
getLanguage,
|
|
@@ -41,7 +41,7 @@ import {
|
|
|
41
41
|
removeCredential,
|
|
42
42
|
setLanguage,
|
|
43
43
|
t
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-EO7IVVX4.js";
|
|
45
45
|
|
|
46
46
|
// src/ui/index.tsx
|
|
47
47
|
import { render } from "ink";
|
|
@@ -1797,7 +1797,7 @@ async function startInteractive(rt, opts) {
|
|
|
1797
1797
|
if (chosen) rt.resume(chosen.session);
|
|
1798
1798
|
}
|
|
1799
1799
|
}
|
|
1800
|
-
const { serversToStart, setProjectTrust } = await import("./config-
|
|
1800
|
+
const { serversToStart, setProjectTrust } = await import("./config-PBEZ3IGD.js");
|
|
1801
1801
|
const plan = serversToStart(rt.home, rt.cwd);
|
|
1802
1802
|
if (plan.needTrust.length) {
|
|
1803
1803
|
const { createInterface } = await import("readline/promises");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@botconnector/bccli",
|
|
3
|
-
"version": "0.4.0-beta.
|
|
3
|
+
"version": "0.4.0-beta.20",
|
|
4
4
|
"description": "BCCLI — BotConnector AI coding agent for the terminal",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -28,7 +28,9 @@
|
|
|
28
28
|
"diff": "^9.0.0",
|
|
29
29
|
"fast-glob": "^3.3.3",
|
|
30
30
|
"ink": "^7.1.1",
|
|
31
|
+
"openai": "^7.27.0",
|
|
31
32
|
"react": "^19.3.0",
|
|
33
|
+
"ws": "^8.22.0",
|
|
32
34
|
"yaml": "^2.9.1",
|
|
33
35
|
"zod": "^4.6.5"
|
|
34
36
|
},
|
|
@@ -36,6 +38,7 @@
|
|
|
36
38
|
"@biomejs/biome": "^2.5.14",
|
|
37
39
|
"@types/node": "^26.6.3",
|
|
38
40
|
"@types/react": "^19.3.0",
|
|
41
|
+
"@types/ws": "^8.18.2",
|
|
39
42
|
"ink-testing-library": "^4.0.0",
|
|
40
43
|
"tsup": "^8.5.1",
|
|
41
44
|
"typescript": "^7.0.2",
|