@bolloon/bolloon-agent 0.3.11 → 0.3.12
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/index.js +18 -44
- package/dist/web/client.js +4657 -4134
- package/dist/web/components/p2p/index.js +234 -276
- package/dist/web/ui/message-renderer.js +396 -535
- package/dist/web/ui/step-timeline.js +272 -371
- package/package.json +3 -3
- package/dist/web/components/p2p/P2PModal.js +0 -188
- package/dist/web/components/p2p/p2p-modal.js +0 -664
- package/dist/web/components/p2p/p2p-tools.js +0 -248
package/dist/index.js
CHANGED
|
@@ -553,7 +553,7 @@ const AVAILABLE_TOOLS = [
|
|
|
553
553
|
{ name: 'update_check', description: '检查 npm 包更新', example: '--update-check' },
|
|
554
554
|
{ name: 'update_now', description: '立即更新到最新版本', example: '--update-now [package]' },
|
|
555
555
|
];
|
|
556
|
-
async function runToolCommand(tool, args, outputJson, comm, model) {
|
|
556
|
+
async function runToolCommand(tool, args, outputJson, comm, model, prompt) {
|
|
557
557
|
const a = await getAgent();
|
|
558
558
|
const startTime = Date.now();
|
|
559
559
|
let response;
|
|
@@ -1030,56 +1030,25 @@ async function runToolCommand(tool, args, outputJson, comm, model) {
|
|
|
1030
1030
|
}
|
|
1031
1031
|
case 'engine': {
|
|
1032
1032
|
const { delegateToEngine } = await import('./external-engines/delegate.js');
|
|
1033
|
-
const { prompt } = (() => {
|
|
1034
|
-
const p = process.argv.slice(2).reduce((acc, arg, idx, arr) => {
|
|
1035
|
-
if (arg === '-e' || arg === '--engine') {
|
|
1036
|
-
acc.skip = idx + 2;
|
|
1037
|
-
return acc;
|
|
1038
|
-
}
|
|
1039
|
-
if (idx < acc.skip)
|
|
1040
|
-
return acc;
|
|
1041
|
-
if (arg.startsWith('--model') || arg.startsWith('-m')) {
|
|
1042
|
-
acc.skip = idx + 2;
|
|
1043
|
-
return acc;
|
|
1044
|
-
}
|
|
1045
|
-
if (arg.startsWith('-') || idx < acc.skip)
|
|
1046
|
-
return acc;
|
|
1047
|
-
acc.parts.push(arg);
|
|
1048
|
-
return acc;
|
|
1049
|
-
}, { skip: 0, parts: [] });
|
|
1050
|
-
return { prompt: p.parts.join(' ') };
|
|
1051
|
-
})();
|
|
1052
1033
|
const engineId = args[0];
|
|
1053
1034
|
if (!engineId) {
|
|
1054
1035
|
response = '用法: --engine <engine-id> [--model <model>] <prompt>\n可用引擎: opencode, codex, claude-code, hermes';
|
|
1055
1036
|
error = response;
|
|
1056
1037
|
break;
|
|
1057
1038
|
}
|
|
1058
|
-
|
|
1059
|
-
response = '错误: 缺少 prompt 文本';
|
|
1060
|
-
error = response;
|
|
1061
|
-
break;
|
|
1062
|
-
}
|
|
1063
|
-
if (outputJson) {
|
|
1064
|
-
process.stdout.write(JSON.stringify({ tool: 'engine', id: engineId, model, prompt: prompt.slice(0, 60) }) + '\n');
|
|
1065
|
-
}
|
|
1066
|
-
const result = await delegateToEngine(engineId, prompt, {
|
|
1039
|
+
const result = await delegateToEngine(engineId, prompt || '', {
|
|
1067
1040
|
...(model ? { model } : {}),
|
|
1068
1041
|
});
|
|
1069
1042
|
const elapsed = Date.now() - startTime;
|
|
1070
|
-
if (
|
|
1071
|
-
|
|
1043
|
+
if (result.success) {
|
|
1044
|
+
response = result.output || '(无输出)';
|
|
1072
1045
|
}
|
|
1073
1046
|
else {
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
else {
|
|
1078
|
-
response = `❌ 委派失败: ${result.error}`;
|
|
1079
|
-
if (result.output)
|
|
1080
|
-
response += `\n[输出]\n${result.output.slice(0, 2000)}`;
|
|
1081
|
-
}
|
|
1047
|
+
response = `❌ 委派失败: ${result.error}`;
|
|
1048
|
+
if (result.output)
|
|
1049
|
+
response += `\n[输出]\n${result.output.slice(0, 2000)}`;
|
|
1082
1050
|
}
|
|
1051
|
+
metadata = { ...metadata, duration: elapsed };
|
|
1083
1052
|
break;
|
|
1084
1053
|
}
|
|
1085
1054
|
case 'context': {
|
|
@@ -1456,7 +1425,7 @@ async function runNonInteractive(args, comm) {
|
|
|
1456
1425
|
outputBuffer += params.join(' ') + '\n';
|
|
1457
1426
|
};
|
|
1458
1427
|
if (tool) {
|
|
1459
|
-
await runToolCommand(tool, toolArgs, false, comm);
|
|
1428
|
+
await runToolCommand(tool, toolArgs, false, comm, args.model, prompt);
|
|
1460
1429
|
}
|
|
1461
1430
|
else if (prompt) {
|
|
1462
1431
|
const a = await getAgent();
|
|
@@ -1496,7 +1465,7 @@ async function runNonInteractive(args, comm) {
|
|
|
1496
1465
|
return;
|
|
1497
1466
|
}
|
|
1498
1467
|
if (tool) {
|
|
1499
|
-
await runToolCommand(tool, toolArgs, !!json, comm);
|
|
1468
|
+
await runToolCommand(tool, toolArgs, !!json, comm, args.model, prompt);
|
|
1500
1469
|
}
|
|
1501
1470
|
else if (prompt) {
|
|
1502
1471
|
const startTime = Date.now();
|
|
@@ -1634,6 +1603,7 @@ function parseArgs() {
|
|
|
1634
1603
|
case '-e':
|
|
1635
1604
|
result.engine = args[++i];
|
|
1636
1605
|
result.tool = 'engine';
|
|
1606
|
+
result.toolArgs = [result.engine];
|
|
1637
1607
|
break;
|
|
1638
1608
|
case '--context':
|
|
1639
1609
|
result.context = true;
|
|
@@ -1784,6 +1754,7 @@ function parseArgs() {
|
|
|
1784
1754
|
result.tui = true;
|
|
1785
1755
|
break;
|
|
1786
1756
|
case '--model':
|
|
1757
|
+
case '-m':
|
|
1787
1758
|
result.model = args[++i];
|
|
1788
1759
|
break;
|
|
1789
1760
|
case '--output':
|
|
@@ -1869,9 +1840,9 @@ function printHelp() {
|
|
|
1869
1840
|
# 跨机 agent 协作 (对方 bolloon --web 起着才能处理, 走 P2P 不经 GitHub)
|
|
1870
1841
|
--collab <peer|publicKey> "<任务描述>" 派任务给对端 LLM 干活, 等回结果 (90s 超时)
|
|
1871
1842
|
|
|
1872
|
-
#
|
|
1873
|
-
--
|
|
1874
|
-
--model <name>
|
|
1843
|
+
# 外部编码智能体委派
|
|
1844
|
+
--engine, -e <id> [--model <m>] <prompt> 委派任务给外部引擎,如 opencode/codex
|
|
1845
|
+
--model <name> 指定委派时使用的模型
|
|
1875
1846
|
|
|
1876
1847
|
# 输出控制
|
|
1877
1848
|
--json, -j 输出 JSON 格式
|
|
@@ -1898,6 +1869,9 @@ function printHelp() {
|
|
|
1898
1869
|
# 交互模式
|
|
1899
1870
|
npx tsx src/index.ts
|
|
1900
1871
|
|
|
1872
|
+
# 外部引擎委派
|
|
1873
|
+
npx tsx src/index.ts --engine opencode --model opencode/deepseek-v4-flash-free "说你好"
|
|
1874
|
+
|
|
1901
1875
|
# Web 模式
|
|
1902
1876
|
npx tsx src/index.ts --web
|
|
1903
1877
|
|