@botconnector/bccli 0.4.0-beta.42 → 0.4.0-beta.44
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-PP7ZONVQ.js → acp-U25MNDND.js} +2 -2
- package/dist/{args-3DGIMRTG.js → args-MFTMBNRN.js} +4 -4
- package/dist/{chunk-LYFN6AEV.js → chunk-25DSN3Y3.js} +4 -4
- package/dist/{chunk-A2XKKKKU.js → chunk-2ON3WIDP.js} +4 -4
- package/dist/{chunk-HVGXCPDG.js → chunk-BQHKN7JI.js} +1 -1
- package/dist/{chunk-ADS5FDWL.js → chunk-CYTRCZXI.js} +20 -7
- package/dist/{chunk-AGIZBZ64.js → chunk-GIGWZFCY.js} +1 -1
- package/dist/{chunk-3P5N6UPF.js → chunk-I7GXIJCY.js} +2 -2
- package/dist/{chunk-Q2ZBR4OU.js → chunk-LTAQXU5Z.js} +1 -1
- package/dist/{chunk-QZM66F3A.js → chunk-NVRNFR4S.js} +1 -1
- package/dist/{chunk-DRK3XTVZ.js → chunk-PSRNKKGA.js} +1 -1
- package/dist/{chunk-NFJPKNHL.js → chunk-PZC2Q6MJ.js} +2 -2
- package/dist/{chunk-VBEX5YHF.js → chunk-QHNWI3OT.js} +22 -1
- package/dist/{chunk-LYQHLA43.js → chunk-RMDW3OQ6.js} +2 -2
- package/dist/{chunk-O74EQFYI.js → chunk-TW5HZOTB.js} +3 -3
- package/dist/chunk-U6PCNS4B.js +20 -0
- package/dist/{chunk-I422TPGX.js → chunk-VO6MF6JJ.js} +1 -1
- package/dist/{chunk-I4THUZRD.js → chunk-Y3QKYORR.js} +6 -6
- package/dist/{chunk-HQB227LD.js → chunk-ZGH4B7OU.js} +15 -23
- package/dist/{chunk-AWNQDAOY.js → chunk-ZKMSTD6G.js} +1 -1
- package/dist/cli.js +70 -33
- package/dist/completion-6K4AXKK2.js +125 -0
- package/dist/{config-UKEKWMCG.js → config-LCY27K3L.js} +2 -2
- package/dist/{config-LFT2FNSE.js → config-Z4HSA435.js} +3 -3
- package/dist/{ghBotCli-DWQXAIKE.js → ghBotCli-TJMKJU3E.js} +14 -13
- package/dist/{integrationCli-RSJCJ3NW.js → integrationCli-33KU6GIK.js} +2 -2
- package/dist/{login-L3SUO4H4.js → login-LNF7ZV2S.js} +3 -3
- package/dist/{mcpCli-RSLEDQQ7.js → mcpCli-TXFS3AOJ.js} +5 -5
- package/dist/{modelsCli-IKZLORLH.js → modelsCli-IZSMIYVB.js} +6 -6
- package/dist/{oauthLogin-XHEMYL6L.js → oauthLogin-QGDYTOW7.js} +1 -1
- package/dist/{pluginsCli-MRS547WG.js → pluginsCli-RD4QW3DX.js} +2 -2
- package/dist/prCli-PE7KIPMK.js +72 -0
- package/dist/providerCli-AA3CHCGV.js +15 -0
- package/dist/sdk.js +34 -5
- package/dist/{serve-GFNJ5PSL.js → serve-HW5XZ5LF.js} +15 -14
- package/dist/{serve-A4E67R5E.js → serve-YNKE332Z.js} +3 -3
- package/dist/session-KRV2UP5C.js +12 -0
- package/dist/setup-L4OPF3XW.js +24 -0
- package/dist/statsCli-4KYPVYCN.js +109 -0
- package/dist/transferCli-RQBB6RVY.js +71 -0
- package/dist/{ui-STI6HSOR.js → ui-4ZTUMTYM.js} +12 -12
- package/dist/{update-KMWE2P2I.js → update-34FDI6H3.js} +2 -2
- package/package.json +1 -1
- package/dist/providerCli-7GRUL3BS.js +0 -15
- package/dist/session-VKVBMGCC.js +0 -12
- package/dist/setup-XWX64X5Q.js +0 -23
|
@@ -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-MFTMBNRN.js");
|
|
101
|
+
const { createRuntime } = await import("./setup-L4OPF3XW.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-CYTRCZXI.js";
|
|
6
6
|
import "./chunk-GAFJEQTJ.js";
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-ZKMSTD6G.js";
|
|
8
|
+
import "./chunk-GIGWZFCY.js";
|
|
9
|
+
import "./chunk-QHNWI3OT.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-VO6MF6JJ.js";
|
|
6
6
|
import {
|
|
7
7
|
createProvider
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-RMDW3OQ6.js";
|
|
9
9
|
import {
|
|
10
10
|
PRESETS,
|
|
11
11
|
readCredentials
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-GIGWZFCY.js";
|
|
13
13
|
import {
|
|
14
14
|
t
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-QHNWI3OT.js";
|
|
16
16
|
|
|
17
17
|
// src/models.ts
|
|
18
18
|
function order(ids) {
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
listAllModels
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-25DSN3Y3.js";
|
|
5
5
|
import {
|
|
6
6
|
hasKey,
|
|
7
7
|
providerName,
|
|
8
8
|
removeGlobalProvider,
|
|
9
9
|
writeGlobalConfig
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-VO6MF6JJ.js";
|
|
11
11
|
import {
|
|
12
12
|
PRESETS,
|
|
13
13
|
loadConfig,
|
|
14
14
|
saveCredential
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-GIGWZFCY.js";
|
|
16
16
|
import {
|
|
17
17
|
t
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-QHNWI3OT.js";
|
|
19
19
|
|
|
20
20
|
// src/providerCli.ts
|
|
21
21
|
async function addProviderKey(providerId, key, deps) {
|
|
@@ -5,14 +5,14 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
REASONING_LEVELS,
|
|
7
7
|
isReasoningLevel
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-ZKMSTD6G.js";
|
|
9
9
|
import {
|
|
10
10
|
ConfigError
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-GIGWZFCY.js";
|
|
12
12
|
import {
|
|
13
13
|
parseLang,
|
|
14
14
|
t
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-QHNWI3OT.js";
|
|
16
16
|
|
|
17
17
|
// src/args.ts
|
|
18
18
|
import { parseArgs } from "util";
|
|
@@ -86,6 +86,11 @@ Usage:
|
|
|
86
86
|
bccli gh-bot [serve] GitHub comment bot (off-by-default; needs config)
|
|
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
|
+
bccli completion <shell> print a shell completion script (bash, zsh, fish, powershell)
|
|
90
|
+
bccli stats [--days N] show token usage from local sessions (default: last 7 days)
|
|
91
|
+
bccli export [session] [file] copy a session JSONL to a file (default: last session here)
|
|
92
|
+
bccli import <file> import a session JSONL into the current project
|
|
93
|
+
bccli pr <number> [--repo owner/name] [task] check out a GitHub PR and run a task on it
|
|
89
94
|
bccli integrations show the status of external agent integrations
|
|
90
95
|
bccli connect <agent> opencode, aider, cline, dsh, codex, claude-code, cursor, openai-cli, openai-sdk, openai-compatible, openclaw, hermes
|
|
91
96
|
bccli disconnect <agent> remove an integration and restore the previous config
|
|
@@ -131,7 +136,9 @@ function parseCliArgs(argv) {
|
|
|
131
136
|
port: { type: "string" },
|
|
132
137
|
host: { type: "string" },
|
|
133
138
|
token: { type: "string" },
|
|
134
|
-
"base-url": { type: "string" }
|
|
139
|
+
"base-url": { type: "string" },
|
|
140
|
+
days: { type: "string" },
|
|
141
|
+
repo: { type: "string" }
|
|
135
142
|
}
|
|
136
143
|
});
|
|
137
144
|
const reasoning = values.reasoning;
|
|
@@ -148,13 +155,17 @@ function parseCliArgs(argv) {
|
|
|
148
155
|
throw new ConfigError(t("--output-format must be one of: {formats}", { formats: "text, json, stream-json" }));
|
|
149
156
|
}
|
|
150
157
|
const [first, ...rest] = positionals;
|
|
151
|
-
const SUBCOMMANDS = ["login", "models", "update", "acp", "serve", "plugins", "gh-bot", "provider", "mcp", "connect", "disconnect", "integrations"];
|
|
158
|
+
const SUBCOMMANDS = ["login", "models", "update", "acp", "serve", "plugins", "gh-bot", "provider", "mcp", "connect", "disconnect", "integrations", "completion", "stats", "export", "import", "pr"];
|
|
152
159
|
const command = SUBCOMMANDS.includes(first) ? first : "run";
|
|
153
160
|
const words = command === "run" ? positionals : rest;
|
|
154
161
|
const port = values.port !== void 0 ? Number(values.port) : void 0;
|
|
155
162
|
if (port !== void 0 && (!Number.isInteger(port) || port < 0 || port > 65535)) {
|
|
156
163
|
throw new ConfigError(t("--port must be a number between 0 and 65535"));
|
|
157
164
|
}
|
|
165
|
+
const days = values.days !== void 0 ? Number(values.days) : void 0;
|
|
166
|
+
if (days !== void 0 && (!Number.isInteger(days) || days < 1)) {
|
|
167
|
+
throw new ConfigError(t("--days must be a positive integer"));
|
|
168
|
+
}
|
|
158
169
|
if (values.host !== void 0 && !LOOPBACK_BIND.has(values.host)) {
|
|
159
170
|
throw new ConfigError(t("serve only accepts loopback --host (127.0.0.1, localhost, ::1)"));
|
|
160
171
|
}
|
|
@@ -177,7 +188,7 @@ function parseCliArgs(argv) {
|
|
|
177
188
|
loginProvider: command === "login" ? rest[0] ?? "bc-cloud" : void 0,
|
|
178
189
|
key: !!values.key,
|
|
179
190
|
logout: !!values.logout,
|
|
180
|
-
subArgs: ["models", "plugins", "gh-bot", "provider", "mcp", "connect", "disconnect", "integrations"].includes(command) ? rest : [],
|
|
191
|
+
subArgs: ["models", "plugins", "gh-bot", "provider", "mcp", "connect", "disconnect", "integrations", "completion", "stats", "export", "import", "pr"].includes(command) ? rest : [],
|
|
181
192
|
url: values.url,
|
|
182
193
|
name: values.name,
|
|
183
194
|
keyEnv: values["key-env"],
|
|
@@ -185,7 +196,9 @@ function parseCliArgs(argv) {
|
|
|
185
196
|
port,
|
|
186
197
|
host: values.host,
|
|
187
198
|
token: values.token,
|
|
188
|
-
baseUrl: values["base-url"]
|
|
199
|
+
baseUrl: values["base-url"],
|
|
200
|
+
days,
|
|
201
|
+
repo: values.repo
|
|
189
202
|
};
|
|
190
203
|
}
|
|
191
204
|
|
|
@@ -112,6 +112,11 @@ Usage:
|
|
|
112
112
|
bccli gh-bot [serve] GitHub comment bot (off-by-default; needs config)
|
|
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
|
+
bccli completion <shell> print a shell completion script (bash, zsh, fish, powershell)
|
|
116
|
+
bccli stats [--days N] show token usage from local sessions (default: last 7 days)
|
|
117
|
+
bccli export [session] [file] copy a session JSONL to a file (default: last session here)
|
|
118
|
+
bccli import <file> import a session JSONL into the current project
|
|
119
|
+
bccli pr <number> [--repo owner/name] [task] check out a GitHub PR and run a task on it
|
|
115
120
|
bccli integrations show the status of external agent integrations
|
|
116
121
|
bccli connect <agent> opencode, aider, cline, dsh, codex, claude-code, cursor, openai-cli, openai-sdk, openai-compatible, openclaw, hermes
|
|
117
122
|
bccli disconnect <agent> remove an integration and restore the previous config
|
|
@@ -433,7 +438,23 @@ Opsi:
|
|
|
433
438
|
"Run: dsh web": "Jalankan: dsh web",
|
|
434
439
|
"timeout after {n} seconds": "timeout {n} detik",
|
|
435
440
|
"Could not start MCP servers: {error}": "Tidak bisa menjalankan server MCP: {error}",
|
|
436
|
-
"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."
|
|
441
|
+
"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
|
+
"usage: bccli completion <{shells}>": "pakai: bccli completion <{shells}>",
|
|
443
|
+
"--days must be a positive integer": "--days harus bilangan bulat positif",
|
|
444
|
+
"no sessions in the last {days} day(s)": "tidak ada sesi dalam {days} hari terakhir",
|
|
445
|
+
"sessions (last {days} day(s)):": "sesi ({days} hari terakhir):",
|
|
446
|
+
"session(s)": "sesi",
|
|
447
|
+
"message(s)": "pesan",
|
|
448
|
+
"recorded": "tercatat",
|
|
449
|
+
"no session to export in this folder": "tidak ada sesi untuk diekspor di folder ini",
|
|
450
|
+
"exported {file}": "diekspor ke {file}",
|
|
451
|
+
"file not found: {file}": "file tidak ditemukan: {file}",
|
|
452
|
+
"invalid session file (non-JSON line): {file}": "file sesi tidak valid (baris bukan JSON): {file}",
|
|
453
|
+
"imported {n} record(s) into {file}": "impor {n} rekaman ke {file}",
|
|
454
|
+
"usage: bccli pr <number> [--repo owner/name] [task]": "pakai: bccli pr <nomor> [--repo owner/name] [tugas]",
|
|
455
|
+
"gh is not available ({error}); install GitHub CLI first": "gh tidak tersedia ({error}); pasang GitHub CLI dulu",
|
|
456
|
+
"gh pr checkout {n} failed (exit {code})": "gh pr checkout {n} gagal (exit {code})",
|
|
457
|
+
"checked out PR #{n}": "checkout PR #{n} selesai"
|
|
437
458
|
};
|
|
438
459
|
|
|
439
460
|
// src/i18n.ts
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
import {
|
|
3
3
|
runCommand,
|
|
4
4
|
runHooks
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-PSRNKKGA.js";
|
|
6
6
|
import {
|
|
7
7
|
ConfigError
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-GIGWZFCY.js";
|
|
9
9
|
import {
|
|
10
10
|
t
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-QHNWI3OT.js";
|
|
12
12
|
|
|
13
13
|
// src/verify.ts
|
|
14
14
|
var MAX_VERIFY_ROUNDS = 2;
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
|
|
16
|
+
export {
|
|
17
|
+
estimateTokens,
|
|
18
|
+
estimateMessages,
|
|
19
|
+
trimToFit
|
|
20
|
+
};
|
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
removeCredential,
|
|
7
7
|
saveCredential
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-GIGWZFCY.js";
|
|
9
9
|
import {
|
|
10
10
|
t
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-QHNWI3OT.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-AA3CHCGV.js");
|
|
95
|
+
const { parseCliArgs: parse } = await import("./args-MFTMBNRN.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-QGDYTOW7.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-QGDYTOW7.js");
|
|
126
126
|
return runOauthLogin({
|
|
127
127
|
out: deps.out,
|
|
128
128
|
err: deps.err,
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
estimateMessages,
|
|
4
|
+
estimateTokens,
|
|
5
|
+
trimToFit
|
|
6
|
+
} from "./chunk-U6PCNS4B.js";
|
|
2
7
|
import {
|
|
3
8
|
BUILTIN_AGENTS,
|
|
4
9
|
appendMemory,
|
|
@@ -13,11 +18,11 @@ import {
|
|
|
13
18
|
parseFrontmatter,
|
|
14
19
|
runHooks,
|
|
15
20
|
validateGlobPattern
|
|
16
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-PSRNKKGA.js";
|
|
17
22
|
import {
|
|
18
23
|
createWebSearchTool,
|
|
19
24
|
fetchTool
|
|
20
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-NVRNFR4S.js";
|
|
21
26
|
import {
|
|
22
27
|
defineTool
|
|
23
28
|
} from "./chunk-PSO7R5AD.js";
|
|
@@ -26,38 +31,38 @@ import {
|
|
|
26
31
|
} from "./chunk-GAFJEQTJ.js";
|
|
27
32
|
import {
|
|
28
33
|
addProviderKey
|
|
29
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-2ON3WIDP.js";
|
|
30
35
|
import {
|
|
31
36
|
listAllModels
|
|
32
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-25DSN3Y3.js";
|
|
33
38
|
import {
|
|
34
39
|
providerName
|
|
35
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-VO6MF6JJ.js";
|
|
36
41
|
import {
|
|
37
42
|
FileOAuthProvider,
|
|
38
43
|
hasStoredTokens
|
|
39
44
|
} from "./chunk-7F3IWBPQ.js";
|
|
40
45
|
import {
|
|
41
46
|
Session
|
|
42
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-BQHKN7JI.js";
|
|
43
48
|
import {
|
|
44
49
|
completionAssistantMessage,
|
|
45
50
|
createProvider,
|
|
46
51
|
hasPendingProgrammaticReplay,
|
|
47
52
|
imageUserMessage
|
|
48
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-RMDW3OQ6.js";
|
|
49
54
|
import {
|
|
50
55
|
expandEnvVars
|
|
51
|
-
} from "./chunk-
|
|
56
|
+
} from "./chunk-PZC2Q6MJ.js";
|
|
52
57
|
import {
|
|
53
58
|
ConfigError,
|
|
54
59
|
bccliHome,
|
|
55
60
|
loadConfig,
|
|
56
61
|
resolveModel
|
|
57
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-GIGWZFCY.js";
|
|
58
63
|
import {
|
|
59
64
|
t
|
|
60
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-QHNWI3OT.js";
|
|
61
66
|
|
|
62
67
|
// src/textToolCalls.ts
|
|
63
68
|
var PAIR = /(?:<arg_key>\s*|`)?([A-Za-z_]\w*)(?:\s*<\/arg_key>)?`?\s*(?:=\s*`|<arg_value>)([\s\S]*?)<\/arg_value>/g;
|
|
@@ -661,19 +666,6 @@ function budgetStatus(usage, cap, model) {
|
|
|
661
666
|
return void 0;
|
|
662
667
|
}
|
|
663
668
|
|
|
664
|
-
// src/tokenBudget.ts
|
|
665
|
-
var estimateTokens = (text) => Math.ceil(text.length / 4);
|
|
666
|
-
var estimateMessages = (messages) => estimateTokens(JSON.stringify(messages));
|
|
667
|
-
function trimToFit(messages, maxTokens) {
|
|
668
|
-
let out = messages;
|
|
669
|
-
while (estimateMessages(out) > maxTokens) {
|
|
670
|
-
const boundary = out.findIndex((m, i) => i > 0 && m.role === "user");
|
|
671
|
-
if (boundary === -1) return out;
|
|
672
|
-
out = out.slice(boundary);
|
|
673
|
-
}
|
|
674
|
-
return out;
|
|
675
|
-
}
|
|
676
|
-
|
|
677
669
|
// src/agent.ts
|
|
678
670
|
var CANCELLED = "Cancelled by the user.";
|
|
679
671
|
var COMPACT_PROMPT = "Summarize the conversation so far for yourself so you can continue the work with no other context. Include: the user goals, decisions made, files touched and their current state, commands run and results, the task in progress and the next step. Be concise but complete.";
|