@botconnector/bccli 0.4.0-beta.44 → 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-LTAQXU5Z.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 +42 -39
- 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-PE7KIPMK.js → prCli-PQJDEF7H.js} +1 -1
- 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-HW5XZ5LF.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-34FDI6H3.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-4KYPVYCN.js +0 -109
package/dist/cli.js
CHANGED
|
@@ -2,47 +2,47 @@
|
|
|
2
2
|
import {
|
|
3
3
|
resolveWorktree,
|
|
4
4
|
runPrint
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-VQ4FJ7R2.js";
|
|
6
6
|
import {
|
|
7
7
|
createRuntime
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-FNCDUDOB.js";
|
|
9
|
+
import "./chunk-QZKLZELZ.js";
|
|
10
|
+
import "./chunk-NJ5YDSSP.js";
|
|
11
|
+
import "./chunk-JKRSZHDV.js";
|
|
12
12
|
import "./chunk-PSO7R5AD.js";
|
|
13
13
|
import {
|
|
14
14
|
VERSION
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-7BQQYDPU.js";
|
|
16
16
|
import {
|
|
17
17
|
helpText,
|
|
18
18
|
parseCliArgs
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-W2ME7AGN.js";
|
|
20
20
|
import "./chunk-GAFJEQTJ.js";
|
|
21
|
-
import "./chunk-
|
|
22
|
-
import "./chunk-
|
|
21
|
+
import "./chunk-X5ZJGTWY.js";
|
|
22
|
+
import "./chunk-4BQAIMAM.js";
|
|
23
23
|
import {
|
|
24
24
|
readGlobalConfigFile
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-F4XYLKG5.js";
|
|
26
26
|
import {
|
|
27
27
|
defaultLoginDeps,
|
|
28
28
|
runLogin
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-IU7PB6US.js";
|
|
30
30
|
import "./chunk-7F3IWBPQ.js";
|
|
31
31
|
import {
|
|
32
32
|
pruneSessions
|
|
33
|
-
} from "./chunk-
|
|
34
|
-
import "./chunk-
|
|
35
|
-
import "./chunk-
|
|
36
|
-
import "./chunk-
|
|
33
|
+
} from "./chunk-IA35YV5K.js";
|
|
34
|
+
import "./chunk-ERXWNEVU.js";
|
|
35
|
+
import "./chunk-RFSNTLOW.js";
|
|
36
|
+
import "./chunk-Q7DFEWE7.js";
|
|
37
37
|
import {
|
|
38
38
|
ConfigError,
|
|
39
39
|
setTheme
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-FNGFR7R6.js";
|
|
41
41
|
import {
|
|
42
42
|
resolveLanguage,
|
|
43
43
|
setLanguage,
|
|
44
44
|
t
|
|
45
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-JZ5XPSIA.js";
|
|
46
46
|
|
|
47
47
|
// src/exit.ts
|
|
48
48
|
var EXIT_GRACE_MS = 1e3;
|
|
@@ -84,17 +84,17 @@ async function main() {
|
|
|
84
84
|
if (args.worktree) cwd = (await resolveWorktree(cwd, args.worktree)).path;
|
|
85
85
|
if (args.command === "login") return runLogin(args.loginProvider ?? "bc-cloud", cwd, args, defaultLoginDeps());
|
|
86
86
|
if (args.command === "mcp") {
|
|
87
|
-
const { runMcpCommand } = await import("./mcpCli-
|
|
88
|
-
const { readSecret } = await import("./login-
|
|
87
|
+
const { runMcpCommand } = await import("./mcpCli-SAJTQGI7.js");
|
|
88
|
+
const { readSecret } = await import("./login-4CIXDZZ7.js");
|
|
89
89
|
return runMcpCommand(args, { env: process.env, cwd, out: (s) => console.log(s), err: (s) => console.error(s), readSecret });
|
|
90
90
|
}
|
|
91
91
|
if (args.command === "provider") {
|
|
92
|
-
const { runProviderCommand } = await import("./providerCli-
|
|
93
|
-
const { readSecret } = await import("./login-
|
|
92
|
+
const { runProviderCommand } = await import("./providerCli-SEAZ5OLH.js");
|
|
93
|
+
const { readSecret } = await import("./login-4CIXDZZ7.js");
|
|
94
94
|
return runProviderCommand(args, { env: process.env, cwd, out: (s) => console.log(s), err: (s) => console.error(s), readSecret });
|
|
95
95
|
}
|
|
96
96
|
if (args.command === "connect" || args.command === "disconnect" || args.command === "integrations") {
|
|
97
|
-
const { runIntegrationCommand } = await import("./integrationCli-
|
|
97
|
+
const { runIntegrationCommand } = await import("./integrationCli-L7OLA3DG.js");
|
|
98
98
|
return runIntegrationCommand(args, {
|
|
99
99
|
env: process.env,
|
|
100
100
|
cwd,
|
|
@@ -104,20 +104,20 @@ async function main() {
|
|
|
104
104
|
});
|
|
105
105
|
}
|
|
106
106
|
if (args.command === "models") {
|
|
107
|
-
const { runModelsCommand } = await import("./modelsCli-
|
|
107
|
+
const { runModelsCommand } = await import("./modelsCli-L6VODTVW.js");
|
|
108
108
|
return runModelsCommand(args, { env: process.env, cwd, out: (s) => console.log(s), err: (s) => console.error(s), fetch: globalThis.fetch });
|
|
109
109
|
}
|
|
110
110
|
if (args.command === "update") {
|
|
111
|
-
const { runUpdateCommand } = await import("./update-
|
|
111
|
+
const { runUpdateCommand } = await import("./update-REYFMT5X.js");
|
|
112
112
|
return runUpdateCommand({ env: process.env });
|
|
113
113
|
}
|
|
114
114
|
if (args.command === "acp") {
|
|
115
|
-
const { runtimeAgent, runAcp } = await import("./acp-
|
|
115
|
+
const { runtimeAgent, runAcp } = await import("./acp-QUDKQCTK.js");
|
|
116
116
|
await runAcp(process.stdin, process.stdout, { cwd, newAgent: (c) => runtimeAgent(c) });
|
|
117
117
|
return 0;
|
|
118
118
|
}
|
|
119
119
|
if (args.command === "serve") {
|
|
120
|
-
const { startServe } = await import("./serve-
|
|
120
|
+
const { startServe } = await import("./serve-ZBCAEE72.js");
|
|
121
121
|
const handle = await startServe({ port: args.port, host: args.host, token: args.token, cwd, env: process.env });
|
|
122
122
|
process.stderr.write(`bccli serve ${handle.url} \u2014 Authorization: Bearer ${handle.token}
|
|
123
123
|
`);
|
|
@@ -131,8 +131,8 @@ async function main() {
|
|
|
131
131
|
return 0;
|
|
132
132
|
}
|
|
133
133
|
if (args.command === "plugins") {
|
|
134
|
-
const { runPluginsCommand } = await import("./pluginsCli-
|
|
135
|
-
const { readGlobalPlugins, updateGlobalConfig } = await import("./config-
|
|
134
|
+
const { runPluginsCommand } = await import("./pluginsCli-LE2IDSST.js");
|
|
135
|
+
const { readGlobalPlugins, updateGlobalConfig } = await import("./config-2PLBQKNC.js");
|
|
136
136
|
const { runNpmSync } = await import("./npmRunner-LU43GM3W.js");
|
|
137
137
|
return runPluginsCommand(args, {
|
|
138
138
|
out: (s) => console.log(s),
|
|
@@ -146,27 +146,30 @@ async function main() {
|
|
|
146
146
|
});
|
|
147
147
|
}
|
|
148
148
|
if (args.command === "gh-bot") {
|
|
149
|
-
const { runGhBotCommand } = await import("./ghBotCli-
|
|
149
|
+
const { runGhBotCommand } = await import("./ghBotCli-MB7KATUU.js");
|
|
150
150
|
return runGhBotCommand(args, { env: process.env, cwd, out: (s) => console.log(s), err: (s) => console.error(s) });
|
|
151
151
|
}
|
|
152
152
|
if (args.command === "completion") {
|
|
153
|
-
const { runCompletionCommand } = await import("./completion-
|
|
153
|
+
const { runCompletionCommand } = await import("./completion-5OLAKCX7.js");
|
|
154
154
|
return runCompletionCommand(args, { out: (s) => console.log(s), err: (s) => console.error(s) });
|
|
155
155
|
}
|
|
156
156
|
if (args.command === "stats") {
|
|
157
|
-
const { runStatsCommand } = await import("./statsCli-
|
|
158
|
-
const { bccliHome } = await import("./config-
|
|
159
|
-
return runStatsCommand(
|
|
157
|
+
const { runStatsCommand } = await import("./statsCli-AJG3IJTX.js");
|
|
158
|
+
const { bccliHome } = await import("./config-2PLBQKNC.js");
|
|
159
|
+
return runStatsCommand(
|
|
160
|
+
{ subArgs: args.subArgs, home: bccliHome(process.env), cwd, days: args.days, tools: args.tools, models: args.models, project: args.project },
|
|
161
|
+
{ out: (s) => console.log(s), err: (s) => console.error(s) }
|
|
162
|
+
);
|
|
160
163
|
}
|
|
161
164
|
if (args.command === "export" || args.command === "import") {
|
|
162
|
-
const { runExportCommand, runImportCommand } = await import("./transferCli-
|
|
163
|
-
const { bccliHome } = await import("./config-
|
|
165
|
+
const { runExportCommand, runImportCommand } = await import("./transferCli-HNJMZYLV.js");
|
|
166
|
+
const { bccliHome } = await import("./config-2PLBQKNC.js");
|
|
164
167
|
const deps = { subArgs: args.subArgs, home: bccliHome(process.env), cwd };
|
|
165
168
|
const io = { out: (s) => console.log(s), err: (s) => console.error(s) };
|
|
166
169
|
return args.command === "export" ? runExportCommand(deps, io) : runImportCommand(deps, io);
|
|
167
170
|
}
|
|
168
171
|
if (args.command === "pr") {
|
|
169
|
-
const { runPrCommand } = await import("./prCli-
|
|
172
|
+
const { runPrCommand } = await import("./prCli-PQJDEF7H.js");
|
|
170
173
|
return runPrCommand({ subArgs: args.subArgs, cwd }, { out: (s) => console.log(s), err: (s) => console.error(s) });
|
|
171
174
|
}
|
|
172
175
|
const rt = createRuntime({ cwd, args });
|
|
@@ -177,7 +180,7 @@ async function main() {
|
|
|
177
180
|
}
|
|
178
181
|
if (args.print) {
|
|
179
182
|
if (!args.prompt) throw new ConfigError(t('-p mode needs a task, e.g. bccli -p "explain this repo"'));
|
|
180
|
-
const { serversToStart } = await import("./config-
|
|
183
|
+
const { serversToStart } = await import("./config-LSB274W4.js");
|
|
181
184
|
const plan = serversToStart(rt.home, cwd);
|
|
182
185
|
for (const s of plan.needTrust) {
|
|
183
186
|
console.error(t('Project MCP server "{name}" skipped (not approved yet; run interactive bccli once to approve it).', { name: s.name }));
|
|
@@ -192,13 +195,13 @@ async function main() {
|
|
|
192
195
|
if (!process.stdin.isTTY) throw new ConfigError(t('Interactive mode needs a terminal. For scripts/CI use: bccli -p "task"'));
|
|
193
196
|
if (rt.config.updateCheck !== "off" && !process.env.BCCLI_NO_UPDATE_CHECK) {
|
|
194
197
|
try {
|
|
195
|
-
const { checkForUpdate } = await import("./update-
|
|
198
|
+
const { checkForUpdate } = await import("./update-REYFMT5X.js");
|
|
196
199
|
const update = await checkForUpdate({ home: rt.home, fetch: globalThis.fetch, now: /* @__PURE__ */ new Date() });
|
|
197
200
|
if (update) console.error(update);
|
|
198
201
|
} catch {
|
|
199
202
|
}
|
|
200
203
|
}
|
|
201
|
-
const { startInteractive } = await import("./ui-
|
|
204
|
+
const { startInteractive } = await import("./ui-ORZ5ZNIC.js");
|
|
202
205
|
return startInteractive(rt, { initialPrompt: args.prompt, resume: args.resume, version: VERSION });
|
|
203
206
|
}
|
|
204
207
|
main().then(
|
|
@@ -9,9 +9,9 @@ import {
|
|
|
9
9
|
removeGlobalServer,
|
|
10
10
|
serversToStart,
|
|
11
11
|
setProjectTrust
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-Q7DFEWE7.js";
|
|
13
|
+
import "./chunk-FNGFR7R6.js";
|
|
14
|
+
import "./chunk-JZ5XPSIA.js";
|
|
15
15
|
export {
|
|
16
16
|
addGlobalServer,
|
|
17
17
|
expandEnvVars,
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
createRuntime
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-FNCDUDOB.js";
|
|
5
|
+
import "./chunk-QZKLZELZ.js";
|
|
6
|
+
import "./chunk-NJ5YDSSP.js";
|
|
7
|
+
import "./chunk-JKRSZHDV.js";
|
|
8
8
|
import "./chunk-PSO7R5AD.js";
|
|
9
9
|
import {
|
|
10
10
|
LOOPBACK_BIND,
|
|
11
11
|
parseCliArgs
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-W2ME7AGN.js";
|
|
13
13
|
import "./chunk-GAFJEQTJ.js";
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
14
|
+
import "./chunk-X5ZJGTWY.js";
|
|
15
|
+
import "./chunk-4BQAIMAM.js";
|
|
16
|
+
import "./chunk-F4XYLKG5.js";
|
|
17
17
|
import "./chunk-7F3IWBPQ.js";
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-
|
|
20
|
-
import "./chunk-
|
|
21
|
-
import "./chunk-
|
|
18
|
+
import "./chunk-IA35YV5K.js";
|
|
19
|
+
import "./chunk-ERXWNEVU.js";
|
|
20
|
+
import "./chunk-RFSNTLOW.js";
|
|
21
|
+
import "./chunk-Q7DFEWE7.js";
|
|
22
22
|
import {
|
|
23
23
|
ConfigError,
|
|
24
24
|
globalConfigPath,
|
|
25
25
|
readJsonConfig
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-FNGFR7R6.js";
|
|
27
27
|
import {
|
|
28
28
|
t
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-JZ5XPSIA.js";
|
|
30
30
|
|
|
31
31
|
// src/ghBotWebhook.ts
|
|
32
32
|
import { createHmac, timingSafeEqual } from "crypto";
|
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
loadConfig,
|
|
6
6
|
readCredentials,
|
|
7
7
|
resolveModel
|
|
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/integrationCli.ts
|
|
14
14
|
import { chmodSync, copyFileSync, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "fs";
|
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
readLine,
|
|
5
5
|
readSecret,
|
|
6
6
|
runLogin
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-IU7PB6US.js";
|
|
8
8
|
import "./chunk-7F3IWBPQ.js";
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-FNGFR7R6.js";
|
|
10
|
+
import "./chunk-JZ5XPSIA.js";
|
|
11
11
|
export {
|
|
12
12
|
defaultLoginDeps,
|
|
13
13
|
readLine,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
CATALOG,
|
|
4
4
|
fillTemplate
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-O33VFLLL.js";
|
|
6
6
|
import {
|
|
7
7
|
authorizeMcpServer,
|
|
8
8
|
clearTokens
|
|
@@ -12,20 +12,20 @@ import {
|
|
|
12
12
|
globalMcpPath,
|
|
13
13
|
readMcpFile,
|
|
14
14
|
removeGlobalServer
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-Q7DFEWE7.js";
|
|
16
16
|
import {
|
|
17
17
|
bccliHome
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-FNGFR7R6.js";
|
|
19
19
|
import {
|
|
20
20
|
t
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-JZ5XPSIA.js";
|
|
22
22
|
|
|
23
23
|
// src/mcpCli.ts
|
|
24
24
|
async function runMcpCommand(args, deps) {
|
|
25
25
|
const home = bccliHome(deps.env);
|
|
26
26
|
const [action = "list", name] = args.subArgs;
|
|
27
27
|
if (action === "serve") {
|
|
28
|
-
const { runMcpServe } = await import("./serve-
|
|
28
|
+
const { runMcpServe } = await import("./serve-QAVMAYEU.js");
|
|
29
29
|
return runMcpServe(args, deps);
|
|
30
30
|
}
|
|
31
31
|
const installed = readMcpFile(globalMcpPath(home));
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
listAllModels
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-4BQAIMAM.js";
|
|
5
|
+
import "./chunk-F4XYLKG5.js";
|
|
6
|
+
import "./chunk-ERXWNEVU.js";
|
|
7
|
+
import "./chunk-RFSNTLOW.js";
|
|
8
8
|
import {
|
|
9
9
|
loadConfig,
|
|
10
10
|
resolveModel
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-FNGFR7R6.js";
|
|
12
12
|
import {
|
|
13
13
|
t
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-JZ5XPSIA.js";
|
|
15
15
|
|
|
16
16
|
// src/modelsCli.ts
|
|
17
17
|
async function runModelsCommand(args, deps) {
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import {
|
|
3
3
|
bccliHome,
|
|
4
4
|
globalConfigPath
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-FNGFR7R6.js";
|
|
6
6
|
import {
|
|
7
7
|
t
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-JZ5XPSIA.js";
|
|
9
9
|
|
|
10
10
|
// src/pluginsCli.ts
|
|
11
11
|
import { existsSync, mkdirSync, readFileSync, statSync, writeFileSync } from "fs";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
addProviderKey,
|
|
4
|
+
runProviderCommand
|
|
5
|
+
} from "./chunk-X5ZJGTWY.js";
|
|
6
|
+
import "./chunk-4BQAIMAM.js";
|
|
7
|
+
import "./chunk-F4XYLKG5.js";
|
|
8
|
+
import "./chunk-ERXWNEVU.js";
|
|
9
|
+
import "./chunk-RFSNTLOW.js";
|
|
10
|
+
import "./chunk-FNGFR7R6.js";
|
|
11
|
+
import "./chunk-JZ5XPSIA.js";
|
|
12
|
+
export {
|
|
13
|
+
addProviderKey,
|
|
14
|
+
runProviderCommand
|
|
15
|
+
};
|
package/dist/sdk.js
CHANGED
|
@@ -155,7 +155,8 @@ Usage:
|
|
|
155
155
|
bccli provider list|add <id>|remove <id> manage providers (custom: --url <url> [--name N] [--key-env ENV])
|
|
156
156
|
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
|
|
157
157
|
bccli completion <shell> print a shell completion script (bash, zsh, fish, powershell)
|
|
158
|
-
bccli stats [--days N]
|
|
158
|
+
bccli stats [--days N] [--tools N] [--models [N|all]] [--project slug]
|
|
159
|
+
show token usage from local sessions (default: last 7 days)
|
|
159
160
|
bccli export [session] [file] copy a session JSONL to a file (default: last session here)
|
|
160
161
|
bccli import <file> import a session JSONL into the current project
|
|
161
162
|
bccli pr <number> [--repo owner/name] [task] check out a GitHub PR and run a task on it
|
|
@@ -483,11 +484,12 @@ Opsi:
|
|
|
483
484
|
"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.",
|
|
484
485
|
"usage: bccli completion <{shells}>": "pakai: bccli completion <{shells}>",
|
|
485
486
|
"--days must be a positive integer": "--days harus bilangan bulat positif",
|
|
487
|
+
"--tools must be a positive integer": "--tools harus bilangan bulat positif",
|
|
488
|
+
'--models must be a positive integer or "all"': '--models harus bilangan bulat positif atau "all"',
|
|
486
489
|
"no sessions in the last {days} day(s)": "tidak ada sesi dalam {days} hari terakhir",
|
|
487
490
|
"sessions (last {days} day(s)):": "sesi ({days} hari terakhir):",
|
|
488
491
|
"session(s)": "sesi",
|
|
489
492
|
"message(s)": "pesan",
|
|
490
|
-
"recorded": "tercatat",
|
|
491
493
|
"no session to export in this folder": "tidak ada sesi untuk diekspor di folder ini",
|
|
492
494
|
"exported {file}": "diekspor ke {file}",
|
|
493
495
|
"file not found: {file}": "file tidak ditemukan: {file}",
|
|
@@ -876,8 +878,11 @@ var LOOPBACK_BIND = /* @__PURE__ */ new Set(["127.0.0.1", "localhost", "::1"]);
|
|
|
876
878
|
|
|
877
879
|
// src/args.ts
|
|
878
880
|
function parseCliArgs(argv) {
|
|
881
|
+
const expanded = argv.map(
|
|
882
|
+
(a, i) => a === "--models" && (i + 1 >= argv.length || argv[i + 1].startsWith("-")) ? "--models=all" : a
|
|
883
|
+
);
|
|
879
884
|
const { values, positionals } = parseArgs({
|
|
880
|
-
args:
|
|
885
|
+
args: expanded,
|
|
881
886
|
allowPositionals: true,
|
|
882
887
|
options: {
|
|
883
888
|
print: { type: "boolean", short: "p" },
|
|
@@ -904,6 +909,9 @@ function parseCliArgs(argv) {
|
|
|
904
909
|
token: { type: "string" },
|
|
905
910
|
"base-url": { type: "string" },
|
|
906
911
|
days: { type: "string" },
|
|
912
|
+
tools: { type: "string" },
|
|
913
|
+
models: { type: "string" },
|
|
914
|
+
project: { type: "string" },
|
|
907
915
|
repo: { type: "string" }
|
|
908
916
|
}
|
|
909
917
|
});
|
|
@@ -932,6 +940,17 @@ function parseCliArgs(argv) {
|
|
|
932
940
|
if (days !== void 0 && (!Number.isInteger(days) || days < 1)) {
|
|
933
941
|
throw new ConfigError(t("--days must be a positive integer"));
|
|
934
942
|
}
|
|
943
|
+
const tools = values.tools !== void 0 ? Number(values.tools) : void 0;
|
|
944
|
+
if (tools !== void 0 && (!Number.isInteger(tools) || tools < 1)) {
|
|
945
|
+
throw new ConfigError(t("--tools must be a positive integer"));
|
|
946
|
+
}
|
|
947
|
+
let models;
|
|
948
|
+
if (values.models !== void 0) {
|
|
949
|
+
models = values.models === "" || values.models === "all" ? "all" : values.models;
|
|
950
|
+
if (models !== "all" && (!Number.isInteger(Number(models)) || Number(models) < 1)) {
|
|
951
|
+
throw new ConfigError(t('--models must be a positive integer or "all"'));
|
|
952
|
+
}
|
|
953
|
+
}
|
|
935
954
|
if (values.host !== void 0 && !LOOPBACK_BIND.has(values.host)) {
|
|
936
955
|
throw new ConfigError(t("serve only accepts loopback --host (127.0.0.1, localhost, ::1)"));
|
|
937
956
|
}
|
|
@@ -964,6 +983,9 @@ function parseCliArgs(argv) {
|
|
|
964
983
|
token: values.token,
|
|
965
984
|
baseUrl: values["base-url"],
|
|
966
985
|
days,
|
|
986
|
+
tools,
|
|
987
|
+
models,
|
|
988
|
+
project: values.project,
|
|
967
989
|
repo: values.repo
|
|
968
990
|
};
|
|
969
991
|
}
|
|
@@ -3231,6 +3253,48 @@ function trimToFit(messages, maxTokens) {
|
|
|
3231
3253
|
}
|
|
3232
3254
|
return out;
|
|
3233
3255
|
}
|
|
3256
|
+
function splitKeepRecent(messages, keepTokens) {
|
|
3257
|
+
if (messages.length === 0) return [[], []];
|
|
3258
|
+
let start = messages.length;
|
|
3259
|
+
for (let i = messages.length - 1; i >= 0; i--) {
|
|
3260
|
+
if (i > 0 && messages[i].role !== "user") continue;
|
|
3261
|
+
if (estimateMessages(messages.slice(i)) <= keepTokens) start = i;
|
|
3262
|
+
else break;
|
|
3263
|
+
}
|
|
3264
|
+
if (start === messages.length) {
|
|
3265
|
+
for (let i = messages.length - 1; i >= 0; i--) {
|
|
3266
|
+
if (messages[i].role === "user") {
|
|
3267
|
+
start = i;
|
|
3268
|
+
break;
|
|
3269
|
+
}
|
|
3270
|
+
}
|
|
3271
|
+
}
|
|
3272
|
+
return [messages.slice(0, start), messages.slice(start)];
|
|
3273
|
+
}
|
|
3274
|
+
var TOOL_STUB = "[Old tool result content cleared]";
|
|
3275
|
+
var TOOL_PRUNE_KEEP_TOKENS = 4e4;
|
|
3276
|
+
var TOOL_PRUNE_MIN_TOKENS = 2e4;
|
|
3277
|
+
var isToolStub = (content) => content.startsWith(TOOL_STUB);
|
|
3278
|
+
function pruneOldToolOutputs(messages) {
|
|
3279
|
+
let kept = 0;
|
|
3280
|
+
let oldTokens = 0;
|
|
3281
|
+
const old = [];
|
|
3282
|
+
for (let i = messages.length - 1; i >= 0; i--) {
|
|
3283
|
+
const m = messages[i];
|
|
3284
|
+
if (m.role !== "tool" || isToolStub(m.content)) continue;
|
|
3285
|
+
kept += estimateTokens(m.content);
|
|
3286
|
+
if (kept > TOOL_PRUNE_KEEP_TOKENS) {
|
|
3287
|
+
old.push(i);
|
|
3288
|
+
oldTokens += estimateTokens(m.content);
|
|
3289
|
+
}
|
|
3290
|
+
}
|
|
3291
|
+
if (oldTokens <= TOOL_PRUNE_MIN_TOKENS) return false;
|
|
3292
|
+
for (const i of old) {
|
|
3293
|
+
const m = messages[i];
|
|
3294
|
+
messages[i] = { ...m, content: TOOL_STUB };
|
|
3295
|
+
}
|
|
3296
|
+
return true;
|
|
3297
|
+
}
|
|
3234
3298
|
|
|
3235
3299
|
// src/agent.ts
|
|
3236
3300
|
var CANCELLED = "Cancelled by the user.";
|
|
@@ -3310,7 +3374,10 @@ var Agent2 = class {
|
|
|
3310
3374
|
this.opts.onReset?.();
|
|
3311
3375
|
}
|
|
3312
3376
|
async compact(signal) {
|
|
3313
|
-
|
|
3377
|
+
pruneOldToolOutputs(this.messages);
|
|
3378
|
+
const keepTokens = Math.min(15e3, Math.floor(this.contextWindow * 0.1));
|
|
3379
|
+
const [older, keep] = splitKeepRecent(this.messages, keepTokens);
|
|
3380
|
+
const history = trimToFit(older, Math.floor(this.contextWindow * 0.8));
|
|
3314
3381
|
const completion = await this.provider.chat({
|
|
3315
3382
|
messages: [{ role: "system", content: this.systemPrompt }, ...history, { role: "user", content: COMPACT_PROMPT }],
|
|
3316
3383
|
// Some gateways reject tool_calls in history when no tools are declared.
|
|
@@ -3322,6 +3389,7 @@ var Agent2 = class {
|
|
|
3322
3389
|
this.push({ role: "user", content: `Summary of the previous conversation:
|
|
3323
3390
|
${completion.text}` });
|
|
3324
3391
|
this.push({ role: "assistant", content: "OK, I will continue from this summary." });
|
|
3392
|
+
for (const m of keep) this.push(m);
|
|
3325
3393
|
this.onEvent({ type: "compacted" });
|
|
3326
3394
|
}
|
|
3327
3395
|
/**
|
|
@@ -3384,6 +3452,7 @@ ${completion.text}` });
|
|
|
3384
3452
|
this.totalUsage.cacheWriteTokens = (this.totalUsage.cacheWriteTokens ?? 0) + (usage.cacheWriteTokens ?? 0);
|
|
3385
3453
|
this.lastInputTokens = usage.inputTokens;
|
|
3386
3454
|
this.onEvent({ type: "usage", ...this.totalUsage });
|
|
3455
|
+
this.opts.onUsage?.(usage);
|
|
3387
3456
|
this.push(completionAssistantMessage(completion));
|
|
3388
3457
|
if (completion.finishReason === "repetition") {
|
|
3389
3458
|
this.onEvent({ type: "textReplace", text: completion.text });
|
|
@@ -3531,6 +3600,7 @@ ${t("This model may not support tool calling. Try another model with /model.")}`
|
|
|
3531
3600
|
this.totalUsage.cachedInputTokens = (this.totalUsage.cachedInputTokens ?? 0) + (u.cachedInputTokens ?? 0);
|
|
3532
3601
|
this.totalUsage.cacheWriteTokens = (this.totalUsage.cacheWriteTokens ?? 0) + (u.cacheWriteTokens ?? 0);
|
|
3533
3602
|
this.onEvent({ type: "usage", ...this.totalUsage });
|
|
3603
|
+
this.opts.onUsage?.(u);
|
|
3534
3604
|
}
|
|
3535
3605
|
};
|
|
3536
3606
|
emit({ type: "toolStart", id: call.id, tool: tool.name, target });
|
|
@@ -4299,6 +4369,9 @@ var Session = class _Session {
|
|
|
4299
4369
|
append(message) {
|
|
4300
4370
|
this.write({ t: "msg", m: message });
|
|
4301
4371
|
}
|
|
4372
|
+
appendUsage(usage) {
|
|
4373
|
+
this.write({ t: "usage", ...usage });
|
|
4374
|
+
}
|
|
4302
4375
|
reset() {
|
|
4303
4376
|
this.write({ t: "reset" });
|
|
4304
4377
|
}
|
|
@@ -5066,6 +5139,7 @@ function createRuntime(opts) {
|
|
|
5066
5139
|
budgetModel: modelRef,
|
|
5067
5140
|
contextWindow: contextWindowFor(modelRef, env),
|
|
5068
5141
|
onMessage: (m) => session.append(m),
|
|
5142
|
+
onUsage: (u) => session.appendUsage({ ...u, model: modelRef }),
|
|
5069
5143
|
onReset: () => session.reset(),
|
|
5070
5144
|
onTurnStart: () => {
|
|
5071
5145
|
for (let i = turnMarks.length - 1; i >= 0 && turnMarks[i] > agent.messages.length; i--) {
|
|
@@ -3,15 +3,15 @@ import {
|
|
|
3
3
|
createFetchTool,
|
|
4
4
|
createWebSearchTool,
|
|
5
5
|
isPrivateHost
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-JKRSZHDV.js";
|
|
7
7
|
import "./chunk-PSO7R5AD.js";
|
|
8
8
|
import {
|
|
9
9
|
loadConfig,
|
|
10
10
|
readCredentials
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-FNGFR7R6.js";
|
|
12
12
|
import {
|
|
13
13
|
t
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-JZ5XPSIA.js";
|
|
15
15
|
|
|
16
16
|
// src/mcpServer/serve.ts
|
|
17
17
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
createRuntime
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-FNCDUDOB.js";
|
|
5
|
+
import "./chunk-QZKLZELZ.js";
|
|
6
|
+
import "./chunk-NJ5YDSSP.js";
|
|
7
|
+
import "./chunk-JKRSZHDV.js";
|
|
8
8
|
import "./chunk-PSO7R5AD.js";
|
|
9
9
|
import {
|
|
10
10
|
VERSION
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-7BQQYDPU.js";
|
|
12
12
|
import {
|
|
13
13
|
LOOPBACK_BIND,
|
|
14
14
|
MAX_FRAME_BYTES,
|
|
@@ -17,25 +17,25 @@ import {
|
|
|
17
17
|
parseClientFrame,
|
|
18
18
|
randomToken,
|
|
19
19
|
trustFence
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-W2ME7AGN.js";
|
|
21
21
|
import "./chunk-GAFJEQTJ.js";
|
|
22
|
-
import "./chunk-
|
|
22
|
+
import "./chunk-X5ZJGTWY.js";
|
|
23
23
|
import {
|
|
24
24
|
listAllModels
|
|
25
|
-
} from "./chunk-
|
|
26
|
-
import "./chunk-
|
|
25
|
+
} from "./chunk-4BQAIMAM.js";
|
|
26
|
+
import "./chunk-F4XYLKG5.js";
|
|
27
27
|
import "./chunk-7F3IWBPQ.js";
|
|
28
28
|
import {
|
|
29
29
|
Session
|
|
30
|
-
} from "./chunk-
|
|
31
|
-
import "./chunk-
|
|
32
|
-
import "./chunk-
|
|
33
|
-
import "./chunk-
|
|
30
|
+
} from "./chunk-IA35YV5K.js";
|
|
31
|
+
import "./chunk-ERXWNEVU.js";
|
|
32
|
+
import "./chunk-RFSNTLOW.js";
|
|
33
|
+
import "./chunk-Q7DFEWE7.js";
|
|
34
34
|
import {
|
|
35
35
|
bccliHome,
|
|
36
36
|
loadConfig
|
|
37
|
-
} from "./chunk-
|
|
38
|
-
import "./chunk-
|
|
37
|
+
} from "./chunk-FNGFR7R6.js";
|
|
38
|
+
import "./chunk-JZ5XPSIA.js";
|
|
39
39
|
|
|
40
40
|
// src/serve.ts
|
|
41
41
|
import { randomBytes } from "crypto";
|