@bolloon/bolloon-agent 0.3.21 → 0.3.23
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/agents/deny-pipeline.js +116 -0
- package/dist/agents/parse-tool-call.js +26 -4
- package/dist/agents/pi-sdk.js +247 -64
- package/dist/agents/session-store.js +87 -2
- package/dist/bootstrap/snip-collapse.js +135 -0
- package/dist/cli/loading-tui.js +64 -10
- package/dist/electron/config.js +14 -9
- package/dist/electron/dialogs.js +53 -16
- package/dist/electron/first-run.js +65 -24
- package/dist/electron/ipc.js +14 -10
- package/dist/electron/logger.js +44 -7
- package/dist/electron/main.js +45 -42
- package/dist/electron/menu.js +18 -13
- package/dist/electron/paths.js +54 -12
- package/dist/electron/server.js +57 -18
- package/dist/electron/tray.js +53 -15
- package/dist/electron/window.js +61 -22
- package/dist/electron-preload.js +19 -16
- package/dist/electron.js +4 -1
- package/dist/external-engines/delegate.js +19 -0
- package/dist/hooks/hooks-engine.js +329 -0
- package/dist/index.js +49 -23
- package/dist/llm/pi-ai.js +5 -17
- package/dist/security/tool-gate.js +8 -1
- package/dist/social/dunbar-tier.js +409 -0
- package/dist/utils/auto-update.js +51 -12
- package/dist/web/client.js +1 -1
- package/dist/web/server.js +17 -3
- package/dist/web/style.css +2 -2
- package/dist/web/ui/step-timeline.js +1 -1
- package/package.json +24 -24
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/**
|
|
2
3
|
* npm 自动更新检查器
|
|
3
4
|
*
|
|
@@ -13,11 +14,48 @@
|
|
|
13
14
|
* 开发态下若 cwd 的 package.json 就是本包则回退到 cwd,不受任意工作目录影响。
|
|
14
15
|
* - 检查频率受节流缓存约束(默认 24h 一次),不会每次启动都打 npm。
|
|
15
16
|
*/
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
18
|
+
if (k2 === undefined) k2 = k;
|
|
19
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
20
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
21
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
22
|
+
}
|
|
23
|
+
Object.defineProperty(o, k2, desc);
|
|
24
|
+
}) : (function(o, m, k, k2) {
|
|
25
|
+
if (k2 === undefined) k2 = k;
|
|
26
|
+
o[k2] = m[k];
|
|
27
|
+
}));
|
|
28
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
29
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
30
|
+
}) : function(o, v) {
|
|
31
|
+
o["default"] = v;
|
|
32
|
+
});
|
|
33
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
34
|
+
var ownKeys = function(o) {
|
|
35
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
36
|
+
var ar = [];
|
|
37
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
38
|
+
return ar;
|
|
39
|
+
};
|
|
40
|
+
return ownKeys(o);
|
|
41
|
+
};
|
|
42
|
+
return function (mod) {
|
|
43
|
+
if (mod && mod.__esModule) return mod;
|
|
44
|
+
var result = {};
|
|
45
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
46
|
+
__setModuleDefault(result, mod);
|
|
47
|
+
return result;
|
|
48
|
+
};
|
|
49
|
+
})();
|
|
50
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
51
|
+
exports.checkAndUpdate = checkAndUpdate;
|
|
52
|
+
exports.checkForUpdates = checkForUpdates;
|
|
53
|
+
exports.performUpdate = performUpdate;
|
|
54
|
+
const child_process_1 = require("child_process");
|
|
55
|
+
const fs = __importStar(require("fs"));
|
|
56
|
+
const path = __importStar(require("path"));
|
|
57
|
+
const https = __importStar(require("https"));
|
|
58
|
+
const http = __importStar(require("http"));
|
|
21
59
|
// ANSI 颜色
|
|
22
60
|
const RESET = '\x1b[0m';
|
|
23
61
|
const BOLD = '\x1b[1m';
|
|
@@ -75,7 +113,7 @@ function getGlobalBolloonDir() {
|
|
|
75
113
|
const candidates = [];
|
|
76
114
|
// 1. npm root -g(最可靠)
|
|
77
115
|
try {
|
|
78
|
-
const npmRoot = execSync('npm root -g', { encoding: 'utf-8', timeout: 8000 }).trim();
|
|
116
|
+
const npmRoot = (0, child_process_1.execSync)('npm root -g', { encoding: 'utf-8', timeout: 8000 }).trim();
|
|
79
117
|
if (npmRoot)
|
|
80
118
|
candidates.push(path.join(npmRoot, '@bolloon', 'bolloon-agent'));
|
|
81
119
|
}
|
|
@@ -84,7 +122,7 @@ function getGlobalBolloonDir() {
|
|
|
84
122
|
}
|
|
85
123
|
// 2. npm prefix -g
|
|
86
124
|
try {
|
|
87
|
-
const npmPrefix = execSync('npm prefix -g', { encoding: 'utf-8', timeout: 8000 }).trim();
|
|
125
|
+
const npmPrefix = (0, child_process_1.execSync)('npm prefix -g', { encoding: 'utf-8', timeout: 8000 }).trim();
|
|
88
126
|
if (npmPrefix)
|
|
89
127
|
candidates.push(path.join(npmPrefix, 'lib', 'node_modules', '@bolloon', 'bolloon-agent'));
|
|
90
128
|
}
|
|
@@ -242,7 +280,7 @@ async function checkBolloonUpdates() {
|
|
|
242
280
|
*/
|
|
243
281
|
function checkNpmOutdated() {
|
|
244
282
|
try {
|
|
245
|
-
const output = execSync('npm outdated --json', {
|
|
283
|
+
const output = (0, child_process_1.execSync)('npm outdated --json', {
|
|
246
284
|
encoding: 'utf-8',
|
|
247
285
|
timeout: 30000,
|
|
248
286
|
maxBuffer: 10 * 1024 * 1024,
|
|
@@ -306,7 +344,7 @@ async function updatePackagesWithVersion(packagesWithVersion) {
|
|
|
306
344
|
const args = ['npm', 'install', '-g', ...packagesWithVersion];
|
|
307
345
|
notify(`\n${CYAN}📦 正在更新包...${RESET}\n`, RESET);
|
|
308
346
|
try {
|
|
309
|
-
execSync(args.join(' '), {
|
|
347
|
+
(0, child_process_1.execSync)(args.join(' '), {
|
|
310
348
|
encoding: 'utf-8',
|
|
311
349
|
timeout: 300000,
|
|
312
350
|
stdio: 'inherit',
|
|
@@ -424,7 +462,7 @@ function resolveAutoUpdatePolicy() {
|
|
|
424
462
|
* 例如 Electron 用 app.relaunch(),Node 用 detached 重新 spawn)。
|
|
425
463
|
* 若未提供或 autoRestart=false,则仅提示用户手动重启。
|
|
426
464
|
*/
|
|
427
|
-
|
|
465
|
+
async function checkAndUpdate(opts = {}) {
|
|
428
466
|
const policy = resolveAutoUpdatePolicy();
|
|
429
467
|
if (policy.blocked) {
|
|
430
468
|
return { hasUpdate: false, info: null, updated: false, message: '跳过更新检查(已显式禁用)' };
|
|
@@ -528,13 +566,13 @@ export async function checkAndUpdate(opts = {}) {
|
|
|
528
566
|
/**
|
|
529
567
|
* 仅检查更新,不自动安装
|
|
530
568
|
*/
|
|
531
|
-
|
|
569
|
+
async function checkForUpdates() {
|
|
532
570
|
return await checkBolloonUpdates();
|
|
533
571
|
}
|
|
534
572
|
/**
|
|
535
573
|
* 手动触发更新
|
|
536
574
|
*/
|
|
537
|
-
|
|
575
|
+
async function performUpdate(packages) {
|
|
538
576
|
return await updatePackages(packages);
|
|
539
577
|
}
|
|
540
578
|
// CLI 入口
|
|
@@ -557,3 +595,4 @@ if (process.argv[1]?.includes('auto-update')) {
|
|
|
557
595
|
}
|
|
558
596
|
})();
|
|
559
597
|
}
|
|
598
|
+
//# sourceMappingURL=auto-update.js.map
|
package/dist/web/client.js
CHANGED
|
@@ -318,7 +318,7 @@
|
|
|
318
318
|
var init_step_timeline = __esm({
|
|
319
319
|
"src/web/ui/step-timeline.ts"() {
|
|
320
320
|
"use strict";
|
|
321
|
-
MAX_VISIBLE_NODES =
|
|
321
|
+
MAX_VISIBLE_NODES = 20;
|
|
322
322
|
STORAGE_PREFIX = "bolloon.stepTimeline.expanded.";
|
|
323
323
|
stateMap = /* @__PURE__ */ new WeakMap();
|
|
324
324
|
}
|
package/dist/web/server.js
CHANGED
|
@@ -9,11 +9,11 @@ import * as os from 'os';
|
|
|
9
9
|
import * as crypto from 'crypto';
|
|
10
10
|
import { validateMessageInput, validateChannelInput, healthCheck, } from './input-validator.js';
|
|
11
11
|
import { segmentChatReply } from '../agents/chat-segmenter.js';
|
|
12
|
-
import { listTools } from '../llm/tool-manifest/index.js';
|
|
13
12
|
import { registerJudgmentsRoutes } from './routes-judgments.js';
|
|
14
13
|
import { registerLlmConfigRoutes } from './routes-llm-config.js';
|
|
15
14
|
import { registerExternalEngineRoutes } from './routes-external-engines.js';
|
|
16
15
|
import { registerTaskRoutes } from './routes-tasks.js';
|
|
16
|
+
import { loadPeerTier, recordInteraction, tierLabel } from '../social/dunbar-tier.js';
|
|
17
17
|
import { registerHearthRoutes } from './routes-hearth.js';
|
|
18
18
|
import { loadOrCreateAgentIdentity } from '../agents/agent-identity.js';
|
|
19
19
|
// 2026-07-06: 类型抽到 ./server-types.ts (channel / session / task / sse client / iroh info / paths)
|
|
@@ -465,7 +465,19 @@ async function handleV3P2PMessage(parsed, conn, comm) {
|
|
|
465
465
|
return;
|
|
466
466
|
}
|
|
467
467
|
const senderKey = fromPublicKey || peerKey;
|
|
468
|
-
|
|
468
|
+
// 2026-07-29: Dunbar Tier 检查 — 远端 agent 不能触发禁区工具
|
|
469
|
+
const tierState = await loadPeerTier(senderKey);
|
|
470
|
+
if (tierState.tier === 'blocked') {
|
|
471
|
+
const reply = JSON.stringify({
|
|
472
|
+
v: 3, op: 'agent.chat.reply',
|
|
473
|
+
payload: { channelId, fromPublicKey: v3P2PRef?.getPublicKey() || '', error: 'blocked', text: '❌ 您已被本地系统加入通信黑名单。如需解除请联系系统管理员。' }
|
|
474
|
+
});
|
|
475
|
+
await comm.sendToConnection(conn.id, reply);
|
|
476
|
+
return;
|
|
477
|
+
}
|
|
478
|
+
// 2026-07-29: 语义分析 — 分析远端聊天内容, 隐式滑动 trustScore
|
|
479
|
+
recordInteraction(senderKey, text).catch(() => { });
|
|
480
|
+
console.log(`[v3] 收到 ${senderKey.substring(0, 12)}... (${tierLabel(tierState.tier)}) 对 channel ${channelId} 的 chat: "${text.substring(0, 40)}..."`);
|
|
469
481
|
try {
|
|
470
482
|
// 1. 找到 channel
|
|
471
483
|
const channels = await loadChannels();
|
|
@@ -1486,6 +1498,8 @@ export async function createWebServer(port = 3000, options = {}) {
|
|
|
1486
1498
|
// 2026-07-21: 社交心跳 beacon — 远端智能体宣告存活/能力, 更新本地 liveness
|
|
1487
1499
|
if (parsed.op === 'agent.heartbeat') {
|
|
1488
1500
|
agentHeartbeat?.handleIncoming('agent.heartbeat', parsed.payload, evt.fromPublicKey);
|
|
1501
|
+
// 2026-07-29: 收到心跳也记录交互 (Dunbar 自动归类)
|
|
1502
|
+
recordInteraction(evt.fromPublicKey).catch(() => { });
|
|
1489
1503
|
return;
|
|
1490
1504
|
}
|
|
1491
1505
|
// v3 新增: B 端收到 A 的 thinking (开始 + 流式 token)
|
|
@@ -2218,7 +2232,7 @@ ${goalDesc}
|
|
|
2218
2232
|
res.json(healthCheck(getPackageVersion()));
|
|
2219
2233
|
});
|
|
2220
2234
|
app.get('/api/tools', (_req, res) => {
|
|
2221
|
-
res.json(
|
|
2235
|
+
res.json([]); // tool-manifest 已废弃, 工具列表由 pi-sdk.ts this.tools 维护
|
|
2222
2236
|
});
|
|
2223
2237
|
// 2026-07-28: 用户 DID 身份端点 — 静默生成/加载, 持久化到 ~/.bolloon/identity/user.json
|
|
2224
2238
|
let userIdentityCache = null;
|
package/dist/web/style.css
CHANGED
|
@@ -4793,8 +4793,8 @@ body:has(> .api-config-page) {
|
|
|
4793
4793
|
border-top: 1px solid transparent;
|
|
4794
4794
|
}
|
|
4795
4795
|
.step-timeline:not([data-empty]) .step-timeline-body {
|
|
4796
|
-
/* 内容存在时给 body 一个合理上限, 避免长任务撑爆 */
|
|
4797
|
-
max-height:
|
|
4796
|
+
/* 内容存在时给 body 一个合理上限, 避免长任务撑爆 — 2026-07-29: 从 320px 增大到 520px */
|
|
4797
|
+
max-height: 520px;
|
|
4798
4798
|
overflow-y: auto;
|
|
4799
4799
|
border-top-color: var(--border);
|
|
4800
4800
|
}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bolloon/bolloon-agent",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.23",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "P2P AI Document Agent - 全局安装后执行 `bolloon` 启动产品",
|
|
6
6
|
"main": "dist/cli-entry.js",
|
|
7
|
-
"author": "
|
|
7
|
+
"author": "yuanjie liu",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
10
|
"url": "https://github.com/logos-42/bolloon.git"
|
|
@@ -48,14 +48,14 @@
|
|
|
48
48
|
"src/constraint-runtime"
|
|
49
49
|
],
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@bolloon/bolloon-agent": "^0.3.
|
|
51
|
+
"@bolloon/bolloon-agent": "^0.3.22",
|
|
52
52
|
"@bolloon/constraint-runtime": "0.1.0",
|
|
53
53
|
"@capacitor/core": "^8.4.1",
|
|
54
|
-
"@capacitor/ios": "^8.4.
|
|
54
|
+
"@capacitor/ios": "^8.4.2",
|
|
55
55
|
"@chainsafe/libp2p-noise": "^17.0.0",
|
|
56
56
|
"@chainsafe/libp2p-yamux": "^8.0.1",
|
|
57
|
-
"@diap/sdk": "^0.2.
|
|
58
|
-
"@libp2p/autonat": "^3.0.
|
|
57
|
+
"@diap/sdk": "^0.2.1",
|
|
58
|
+
"@libp2p/autonat": "^3.0.25",
|
|
59
59
|
"@libp2p/circuit-relay-v2": "^4.2.9",
|
|
60
60
|
"@libp2p/dcutr": "^3.0.20",
|
|
61
61
|
"@libp2p/identify": "^4.1.6",
|
|
@@ -65,24 +65,24 @@
|
|
|
65
65
|
"@multiformats/multiaddr": "^13.0.3",
|
|
66
66
|
"@noble/hashes": "^1.3.0",
|
|
67
67
|
"@rayhanadev/iroh": "^0.1.1",
|
|
68
|
-
"@x402/aptos": "^2.
|
|
69
|
-
"@x402/avm": "^2.
|
|
70
|
-
"@x402/axios": "^2.
|
|
71
|
-
"@x402/core": "^2.
|
|
72
|
-
"@x402/evm": "^2.
|
|
73
|
-
"@x402/express": "^2.
|
|
74
|
-
"@x402/extensions": "^2.
|
|
75
|
-
"@x402/fastify": "^2.
|
|
76
|
-
"@x402/fetch": "^2.
|
|
77
|
-
"@x402/hedera": "^2.
|
|
78
|
-
"@x402/hono": "^2.
|
|
79
|
-
"@x402/keeta": "^2.
|
|
80
|
-
"@x402/mcp": "^2.
|
|
81
|
-
"@x402/next": "^2.
|
|
82
|
-
"@x402/paywall": "^2.
|
|
83
|
-
"@x402/stellar": "^2.
|
|
84
|
-
"@x402/svm": "^2.
|
|
85
|
-
"@x402/tvm": "^2.
|
|
68
|
+
"@x402/aptos": "^2.20.0",
|
|
69
|
+
"@x402/avm": "^2.20.0",
|
|
70
|
+
"@x402/axios": "^2.20.0",
|
|
71
|
+
"@x402/core": "^2.20.0",
|
|
72
|
+
"@x402/evm": "^2.20.0",
|
|
73
|
+
"@x402/express": "^2.20.0",
|
|
74
|
+
"@x402/extensions": "^2.20.0",
|
|
75
|
+
"@x402/fastify": "^2.20.0",
|
|
76
|
+
"@x402/fetch": "^2.20.0",
|
|
77
|
+
"@x402/hedera": "^2.20.0",
|
|
78
|
+
"@x402/hono": "^2.20.0",
|
|
79
|
+
"@x402/keeta": "^2.20.0",
|
|
80
|
+
"@x402/mcp": "^2.20.0",
|
|
81
|
+
"@x402/next": "^2.20.0",
|
|
82
|
+
"@x402/paywall": "^2.20.0",
|
|
83
|
+
"@x402/stellar": "^2.20.0",
|
|
84
|
+
"@x402/svm": "^2.20.0",
|
|
85
|
+
"@x402/tvm": "^2.20.0",
|
|
86
86
|
"b4a": "^1.8.1",
|
|
87
87
|
"dotenv": "^17.4.2",
|
|
88
88
|
"esbuild": "^0.24.0",
|