@botconnector/bccli 0.4.0-beta.43 → 0.4.0-beta.45
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/{acp-U25MNDND.js → acp-QUDKQCTK.js} +2 -2
- package/dist/{args-MFTMBNRN.js → args-HXDHQUL2.js} +4 -4
- package/dist/{chunk-25DSN3Y3.js → chunk-4BQAIMAM.js} +4 -4
- package/dist/{chunk-DUSVS3XK.js → chunk-7BQQYDPU.js} +1 -1
- package/dist/{chunk-RMDW3OQ6.js → chunk-ERXWNEVU.js} +2 -2
- package/dist/{chunk-VO6MF6JJ.js → chunk-F4XYLKG5.js} +1 -1
- package/dist/{chunk-ZGH4B7OU.js → chunk-FNCDUDOB.js} +21 -12
- package/dist/{chunk-GIGWZFCY.js → chunk-FNGFR7R6.js} +1 -1
- package/dist/{chunk-BQHKN7JI.js → chunk-IA35YV5K.js} +4 -1
- package/dist/{chunk-Y3QKYORR.js → chunk-IU7PB6US.js} +6 -6
- package/dist/{chunk-NVRNFR4S.js → chunk-JKRSZHDV.js} +1 -1
- package/dist/{chunk-QHNWI3OT.js → chunk-JZ5XPSIA.js} +4 -2
- package/dist/{chunk-PSRNKKGA.js → chunk-NJ5YDSSP.js} +1 -1
- package/dist/{chunk-I7GXIJCY.js → chunk-O33VFLLL.js} +2 -2
- package/dist/{chunk-PZC2Q6MJ.js → chunk-Q7DFEWE7.js} +2 -2
- package/dist/chunk-QZKLZELZ.js +64 -0
- package/dist/{chunk-ZKMSTD6G.js → chunk-RFSNTLOW.js} +1 -1
- package/dist/{chunk-TW5HZOTB.js → chunk-VQ4FJ7R2.js} +3 -3
- package/dist/{chunk-CYTRCZXI.js → chunk-W2ME7AGN.js} +26 -5
- package/dist/{chunk-2ON3WIDP.js → chunk-X5ZJGTWY.js} +4 -4
- package/dist/cli.js +60 -41
- package/dist/{completion-6K4AXKK2.js → completion-5OLAKCX7.js} +1 -1
- package/dist/{config-LCY27K3L.js → config-2PLBQKNC.js} +2 -2
- package/dist/{config-Z4HSA435.js → config-LSB274W4.js} +3 -3
- package/dist/{ghBotCli-TJMKJU3E.js → ghBotCli-MB7KATUU.js} +14 -14
- package/dist/{integrationCli-33KU6GIK.js → integrationCli-L7OLA3DG.js} +2 -2
- package/dist/{login-LNF7ZV2S.js → login-4CIXDZZ7.js} +3 -3
- package/dist/{mcpCli-TXFS3AOJ.js → mcpCli-SAJTQGI7.js} +5 -5
- package/dist/{modelsCli-IZSMIYVB.js → modelsCli-L6VODTVW.js} +6 -6
- package/dist/{oauthLogin-QGDYTOW7.js → oauthLogin-6TP475PO.js} +1 -1
- package/dist/{pluginsCli-RD4QW3DX.js → pluginsCli-LE2IDSST.js} +2 -2
- package/dist/{prCli-NR3ZQMST.js → prCli-PQJDEF7H.js} +3 -4
- package/dist/providerCli-SEAZ5OLH.js +15 -0
- package/dist/sdk.js +78 -4
- package/dist/{serve-YNKE332Z.js → serve-QAVMAYEU.js} +3 -3
- package/dist/{serve-F7BYQ7X6.js → serve-ZBCAEE72.js} +15 -15
- package/dist/session-3I64N64B.js +12 -0
- package/dist/setup-N3PMYREM.js +24 -0
- package/dist/statsCli-AJG3IJTX.js +353 -0
- package/dist/{transferCli-RQBB6RVY.js → transferCli-HNJMZYLV.js} +4 -4
- package/dist/{ui-4ZTUMTYM.js → ui-ORZ5ZNIC.js} +12 -12
- package/dist/{update-7SSREI2O.js → update-REYFMT5X.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-U6PCNS4B.js +0 -20
- package/dist/providerCli-AA3CHCGV.js +0 -15
- package/dist/session-KRV2UP5C.js +0 -12
- package/dist/setup-L4OPF3XW.js +0 -24
- package/dist/statsCli-RPCIMT5R.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-
|
|
101
|
-
const { createRuntime } = await import("./setup-
|
|
100
|
+
const { parseCliArgs } = await import("./args-HXDHQUL2.js");
|
|
101
|
+
const { createRuntime } = await import("./setup-N3PMYREM.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-
|
|
5
|
+
} from "./chunk-W2ME7AGN.js";
|
|
6
6
|
import "./chunk-GAFJEQTJ.js";
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-RFSNTLOW.js";
|
|
8
|
+
import "./chunk-FNGFR7R6.js";
|
|
9
|
+
import "./chunk-JZ5XPSIA.js";
|
|
10
10
|
export {
|
|
11
11
|
helpText,
|
|
12
12
|
parseCliArgs
|
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
import {
|
|
3
3
|
hasKey,
|
|
4
4
|
providerName
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-F4XYLKG5.js";
|
|
6
6
|
import {
|
|
7
7
|
createProvider
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-ERXWNEVU.js";
|
|
9
9
|
import {
|
|
10
10
|
PRESETS,
|
|
11
11
|
readCredentials
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-FNGFR7R6.js";
|
|
13
13
|
import {
|
|
14
14
|
t
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-JZ5XPSIA.js";
|
|
16
16
|
|
|
17
17
|
// src/models.ts
|
|
18
18
|
function order(ids) {
|
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
import {
|
|
3
3
|
estimateMessages,
|
|
4
4
|
estimateTokens,
|
|
5
|
+
pruneOldToolOutputs,
|
|
6
|
+
splitKeepRecent,
|
|
5
7
|
trimToFit
|
|
6
|
-
} from "./chunk-
|
|
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-
|
|
23
|
+
} from "./chunk-NJ5YDSSP.js";
|
|
22
24
|
import {
|
|
23
25
|
createWebSearchTool,
|
|
24
26
|
fetchTool
|
|
25
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-JKRSZHDV.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-
|
|
36
|
+
} from "./chunk-X5ZJGTWY.js";
|
|
35
37
|
import {
|
|
36
38
|
listAllModels
|
|
37
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-4BQAIMAM.js";
|
|
38
40
|
import {
|
|
39
41
|
providerName
|
|
40
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-F4XYLKG5.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-
|
|
49
|
+
} from "./chunk-IA35YV5K.js";
|
|
48
50
|
import {
|
|
49
51
|
completionAssistantMessage,
|
|
50
52
|
createProvider,
|
|
51
53
|
hasPendingProgrammaticReplay,
|
|
52
54
|
imageUserMessage
|
|
53
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-ERXWNEVU.js";
|
|
54
56
|
import {
|
|
55
57
|
expandEnvVars
|
|
56
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-Q7DFEWE7.js";
|
|
57
59
|
import {
|
|
58
60
|
ConfigError,
|
|
59
61
|
bccliHome,
|
|
60
62
|
loadConfig,
|
|
61
63
|
resolveModel
|
|
62
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-FNGFR7R6.js";
|
|
63
65
|
import {
|
|
64
66
|
t
|
|
65
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-JZ5XPSIA.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
|
-
|
|
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--) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
contentText
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-ERXWNEVU.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
|
}
|
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
removeCredential,
|
|
7
7
|
saveCredential
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-FNGFR7R6.js";
|
|
9
9
|
import {
|
|
10
10
|
t
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-JZ5XPSIA.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-
|
|
95
|
-
const { parseCliArgs: parse } = await import("./args-
|
|
94
|
+
const { runProviderCommand } = await import("./providerCli-SEAZ5OLH.js");
|
|
95
|
+
const { parseCliArgs: parse } = await import("./args-HXDHQUL2.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-
|
|
120
|
+
const { runOauthLogout } = await import("./oauthLogin-6TP475PO.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-
|
|
125
|
+
const { runOauthLogin } = await import("./oauthLogin-6TP475PO.js");
|
|
126
126
|
return runOauthLogin({
|
|
127
127
|
out: deps.out,
|
|
128
128
|
err: deps.err,
|
|
@@ -113,7 +113,8 @@ Usage:
|
|
|
113
113
|
bccli provider list|add <id>|remove <id> manage providers (custom: --url <url> [--name N] [--key-env ENV])
|
|
114
114
|
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
115
|
bccli completion <shell> print a shell completion script (bash, zsh, fish, powershell)
|
|
116
|
-
bccli stats [--days N]
|
|
116
|
+
bccli stats [--days N] [--tools N] [--models [N|all]] [--project slug]
|
|
117
|
+
show token usage from local sessions (default: last 7 days)
|
|
117
118
|
bccli export [session] [file] copy a session JSONL to a file (default: last session here)
|
|
118
119
|
bccli import <file> import a session JSONL into the current project
|
|
119
120
|
bccli pr <number> [--repo owner/name] [task] check out a GitHub PR and run a task on it
|
|
@@ -441,11 +442,12 @@ Opsi:
|
|
|
441
442
|
"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
443
|
"usage: bccli completion <{shells}>": "pakai: bccli completion <{shells}>",
|
|
443
444
|
"--days must be a positive integer": "--days harus bilangan bulat positif",
|
|
445
|
+
"--tools must be a positive integer": "--tools harus bilangan bulat positif",
|
|
446
|
+
'--models must be a positive integer or "all"': '--models harus bilangan bulat positif atau "all"',
|
|
444
447
|
"no sessions in the last {days} day(s)": "tidak ada sesi dalam {days} hari terakhir",
|
|
445
448
|
"sessions (last {days} day(s)):": "sesi ({days} hari terakhir):",
|
|
446
449
|
"session(s)": "sesi",
|
|
447
450
|
"message(s)": "pesan",
|
|
448
|
-
"recorded": "tercatat",
|
|
449
451
|
"no session to export in this folder": "tidak ada sesi untuk diekspor di folder ini",
|
|
450
452
|
"exported {file}": "diekspor ke {file}",
|
|
451
453
|
"file not found: {file}": "file tidak ditemukan: {file}",
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/tokenBudget.ts
|
|
4
|
+
var estimateTokens = (text) => Math.ceil(text.length / 4);
|
|
5
|
+
var estimateMessages = (messages) => estimateTokens(JSON.stringify(messages));
|
|
6
|
+
function trimToFit(messages, maxTokens) {
|
|
7
|
+
let out = messages;
|
|
8
|
+
while (estimateMessages(out) > maxTokens) {
|
|
9
|
+
const boundary = out.findIndex((m, i) => i > 0 && m.role === "user");
|
|
10
|
+
if (boundary === -1) return out;
|
|
11
|
+
out = out.slice(boundary);
|
|
12
|
+
}
|
|
13
|
+
return out;
|
|
14
|
+
}
|
|
15
|
+
function splitKeepRecent(messages, keepTokens) {
|
|
16
|
+
if (messages.length === 0) return [[], []];
|
|
17
|
+
let start = messages.length;
|
|
18
|
+
for (let i = messages.length - 1; i >= 0; i--) {
|
|
19
|
+
if (i > 0 && messages[i].role !== "user") continue;
|
|
20
|
+
if (estimateMessages(messages.slice(i)) <= keepTokens) start = i;
|
|
21
|
+
else break;
|
|
22
|
+
}
|
|
23
|
+
if (start === messages.length) {
|
|
24
|
+
for (let i = messages.length - 1; i >= 0; i--) {
|
|
25
|
+
if (messages[i].role === "user") {
|
|
26
|
+
start = i;
|
|
27
|
+
break;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return [messages.slice(0, start), messages.slice(start)];
|
|
32
|
+
}
|
|
33
|
+
var TOOL_STUB = "[Old tool result content cleared]";
|
|
34
|
+
var TOOL_PRUNE_KEEP_TOKENS = 4e4;
|
|
35
|
+
var TOOL_PRUNE_MIN_TOKENS = 2e4;
|
|
36
|
+
var isToolStub = (content) => content.startsWith(TOOL_STUB);
|
|
37
|
+
function pruneOldToolOutputs(messages) {
|
|
38
|
+
let kept = 0;
|
|
39
|
+
let oldTokens = 0;
|
|
40
|
+
const old = [];
|
|
41
|
+
for (let i = messages.length - 1; i >= 0; i--) {
|
|
42
|
+
const m = messages[i];
|
|
43
|
+
if (m.role !== "tool" || isToolStub(m.content)) continue;
|
|
44
|
+
kept += estimateTokens(m.content);
|
|
45
|
+
if (kept > TOOL_PRUNE_KEEP_TOKENS) {
|
|
46
|
+
old.push(i);
|
|
47
|
+
oldTokens += estimateTokens(m.content);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
if (oldTokens <= TOOL_PRUNE_MIN_TOKENS) return false;
|
|
51
|
+
for (const i of old) {
|
|
52
|
+
const m = messages[i];
|
|
53
|
+
messages[i] = { ...m, content: TOOL_STUB };
|
|
54
|
+
}
|
|
55
|
+
return true;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export {
|
|
59
|
+
estimateTokens,
|
|
60
|
+
estimateMessages,
|
|
61
|
+
trimToFit,
|
|
62
|
+
splitKeepRecent,
|
|
63
|
+
pruneOldToolOutputs
|
|
64
|
+
};
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
import {
|
|
3
3
|
runCommand,
|
|
4
4
|
runHooks
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-NJ5YDSSP.js";
|
|
6
6
|
import {
|
|
7
7
|
ConfigError
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-FNGFR7R6.js";
|
|
9
9
|
import {
|
|
10
10
|
t
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-JZ5XPSIA.js";
|
|
12
12
|
|
|
13
13
|
// src/verify.ts
|
|
14
14
|
var MAX_VERIFY_ROUNDS = 2;
|
|
@@ -5,14 +5,14 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
REASONING_LEVELS,
|
|
7
7
|
isReasoningLevel
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-RFSNTLOW.js";
|
|
9
9
|
import {
|
|
10
10
|
ConfigError
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-FNGFR7R6.js";
|
|
12
12
|
import {
|
|
13
13
|
parseLang,
|
|
14
14
|
t
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-JZ5XPSIA.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]
|
|
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:
|
|
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
|
}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
listAllModels
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-4BQAIMAM.js";
|
|
5
5
|
import {
|
|
6
6
|
hasKey,
|
|
7
7
|
providerName,
|
|
8
8
|
removeGlobalProvider,
|
|
9
9
|
writeGlobalConfig
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-F4XYLKG5.js";
|
|
11
11
|
import {
|
|
12
12
|
PRESETS,
|
|
13
13
|
loadConfig,
|
|
14
14
|
saveCredential
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-FNGFR7R6.js";
|
|
16
16
|
import {
|
|
17
17
|
t
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-JZ5XPSIA.js";
|
|
19
19
|
|
|
20
20
|
// src/providerCli.ts
|
|
21
21
|
async function addProviderKey(providerId, key, deps) {
|