@bolloon/bolloon-agent 0.3.51 → 0.4.0
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/README.md +135 -135
- package/bin/bolloon-cli.cjs +183 -183
- package/bin/bolloon.cjs +0 -0
- package/bin/bolloon.js +157 -0
- package/dist/agents/constraint-layer.js +19 -19
- package/dist/agents/judgment-protocol.js +14 -14
- package/dist/agents/loop-review.js +21 -0
- package/dist/agents/pi-sdk-tools.js +86 -2
- package/dist/agents/pi-sdk-types.js +12 -12
- package/dist/agents/pi-sdk.js +90 -90
- package/dist/agents/shell-guard.js +22 -1
- package/dist/agents/skill-organizer.js +19 -19
- package/dist/agents/verify-recipe.js +84 -0
- package/dist/agents/workflow-pivot-loop.js +101 -13
- package/dist/bollharness/src/scripts/deploy-guard.js +8 -8
- package/dist/bollharness-integration/context-router-judgment.js +4 -4
- package/dist/bollharness-integration/context-router.js +292 -292
- package/dist/bollharness-integration/gate-state-machine.js +13 -13
- package/dist/bollharness-integration/llm-judgment-engine.js +134 -134
- package/dist/bollharness-integration/skill-adapter.js +21 -21
- package/dist/bootstrap/chat-archiver.js +14 -14
- package/dist/bootstrap/context-os.js +50 -40
- package/dist/bootstrap/memory-compressor.js +13 -13
- package/dist/cli-entry.js +36 -36
- package/dist/context-compaction/auto-compact.js +7 -7
- package/dist/electron/first-run.js +54 -54
- package/dist/electron-build/electron/first-run.js +54 -54
- package/dist/electron-preload.js.map +1 -1
- package/dist/electron.js.map +1 -1
- package/dist/external-engines/delegate-handle.js +70 -0
- package/dist/external-engines/delegate.js +24 -3
- package/dist/index.js +112 -112
- package/dist/llm/error-lessons.js +53 -0
- package/dist/llm/llm-judgment-client.js +102 -102
- package/dist/llm/pi-ai.js +61 -48
- package/dist/llm/system-prompt/layers/channel/human-async.md +41 -41
- package/dist/llm/system-prompt/layers/channel/local.md +14 -14
- package/dist/llm/system-prompt/layers/channel/p2p-agent.md +18 -18
- package/dist/llm/system-prompt/layers/channel/p2p-peer-sync.md +51 -51
- package/dist/llm/system-prompt/layers/channel/p2p-proactive.md +43 -43
- package/dist/llm/system-prompt/layers/channel/p2p-visitor.md +19 -19
- package/dist/llm/system-prompt/layers/channel/session-handoff.md +61 -61
- package/dist/llm/system-prompt/layers/core/artifacts_storage.md +89 -89
- package/dist/llm/system-prompt/layers/core/evenhandedness.md +21 -21
- package/dist/llm/system-prompt/layers/core/external-engagement.md +73 -73
- package/dist/llm/system-prompt/layers/core/hibs_reminders.md +15 -15
- package/dist/llm/system-prompt/layers/core/identity.md +48 -48
- package/dist/llm/system-prompt/layers/core/knowledge.md +17 -17
- package/dist/llm/system-prompt/layers/core/memory_system.md +12 -12
- package/dist/llm/system-prompt/layers/core/network_filesystem.md +28 -28
- package/dist/llm/system-prompt/layers/core/refusal.md +37 -37
- package/dist/llm/system-prompt/layers/core/tone.md +31 -31
- package/dist/llm/system-prompt/layers/core/tools.thin.md +13 -13
- package/dist/llm/system-prompt/layers/core/wellbeing.md +41 -41
- package/dist/llm/system-prompt/layers/role/architect.md +20 -20
- package/dist/llm/system-prompt/layers/role/expert.md +19 -19
- package/dist/llm/system-prompt/layers/role/implementer.md +15 -15
- package/dist/llm/system-prompt/layers/role/security.md +15 -15
- package/dist/llm/system-prompt/layers/tool/artifacts.md +72 -72
- package/dist/llm/system-prompt/layers/tool/bash.md +25 -25
- package/dist/llm/system-prompt/layers/tool/goal_handoff.md +77 -77
- package/dist/llm/system-prompt/layers/tool/hibs_api.md +171 -171
- package/dist/llm/system-prompt/layers/tool/image_search.md +70 -70
- package/dist/llm/system-prompt/layers/tool/manifest.md +89 -89
- package/dist/llm/system-prompt/layers/tool/mcp_apps.md +53 -53
- package/dist/llm/system-prompt/layers/tool/p2p_request.md +61 -61
- package/dist/llm/system-prompt/layers/tool/web_search.md +83 -83
- package/dist/llm/system-prompt/registry.js +9 -1
- package/dist/llm/tool-manifest/ask_user_input.js +1 -1
- package/dist/llm/tool-manifest/bash.js +3 -3
- package/dist/llm/tool-manifest/create_file.js +4 -4
- package/dist/llm/tool-manifest/fetch_sports_data.js +3 -3
- package/dist/llm/tool-manifest/image_search.js +2 -2
- package/dist/llm/tool-manifest/index.js +0 -59
- package/dist/llm/tool-manifest/mcp.js +2 -2
- package/dist/llm/tool-manifest/message_compose.js +3 -3
- package/dist/llm/tool-manifest/places.js +2 -2
- package/dist/llm/tool-manifest/present_files.js +1 -1
- package/dist/llm/tool-manifest/recipe.js +2 -2
- package/dist/llm/tool-manifest/str_replace.js +5 -5
- package/dist/llm/tool-manifest/view.js +3 -3
- package/dist/llm/tool-manifest/weather.js +4 -4
- package/dist/llm/tool-manifest/web.js +4 -4
- package/dist/locales/en.js +28 -0
- package/dist/locales/zh.js +26 -0
- package/dist/pi-ecosystem-colony/index.js +365 -0
- package/dist/pi-ecosystem-judgment/causal-judge.js +51 -51
- package/dist/pi-ecosystem-judgment/distill-prompt.js +42 -42
- package/dist/pi-ecosystem-judgment/distillation.js +14 -14
- package/dist/pi-ecosystem-judgment/monitor-gate.js +28 -28
- package/dist/pi-ecosystem-judgment/value-injection.js +102 -102
- package/dist/security/context-router-tool.js +15 -15
- package/dist/social/ant-colony/AdaptiveHeartbeat.js +101 -0
- package/dist/social/ant-colony/PheromoneEngine.js +227 -0
- package/dist/social/ant-colony/index.js +6 -0
- package/dist/social/ant-colony/types.js +24 -0
- package/dist/storage/trajectory.js +101 -0
- package/dist/test/ai-judgment-test.js +80 -0
- package/dist/test/bollharness-integration.test.js +318 -0
- package/dist/test/channel-agent-multi-dialogue.js +205 -0
- package/dist/test/channel-heartbeat-agent-test.js +201 -0
- package/dist/test/constraint-layer.test.js +164 -0
- package/dist/test/diap-identity-test.js +172 -0
- package/dist/test/diap-quick-test.js +62 -0
- package/dist/test/global-shared-context.test.js +315 -0
- package/dist/test/harness-judgment-injection.test.js +246 -0
- package/dist/test/harness-workflow-integrator-test.js +228 -0
- package/dist/test/human-value-store.test.js +243 -0
- package/dist/test/hybrid-integration-test.js +118 -0
- package/dist/test/hybrid-messenger-verify.js +55 -0
- package/dist/test/iroh-bistream-debug.js +38 -0
- package/dist/test/iroh-communication.test.js +66 -0
- package/dist/test/iroh-debug-test.js +57 -0
- package/dist/test/iroh-diap-test.js +71 -0
- package/dist/test/iroh-direct-connect.js +55 -0
- package/dist/test/iroh-e2e-fixed.js +89 -0
- package/dist/test/iroh-e2e-same-process.js +63 -0
- package/dist/test/iroh-e2e.js +66 -0
- package/dist/test/iroh-final-e2e.js +72 -0
- package/dist/test/iroh-relay-test.js +37 -0
- package/dist/test/iroh-simple-test.js +41 -0
- package/dist/test/iroh-transport-verify.js +54 -0
- package/dist/test/iroh-transport.test.js +37 -0
- package/dist/test/iroh-two-nodes.js +70 -0
- package/dist/test/iroh-verify.js +44 -0
- package/dist/test/judgment-decision.test.js +219 -0
- package/dist/test/llm-judgment-integration.test.js +220 -0
- package/dist/test/p2p-agent-complex-dialogue.js +385 -0
- package/dist/test/p2p-agent-dialogue.js +341 -0
- package/dist/test/p2p-agent-full-bidirectional.js +510 -0
- package/dist/test/p2p-agent-harness-flow.js +437 -0
- package/dist/test/p2p-agent-harness-single.js +143 -0
- package/dist/test/p2p-ai-dialogue-test.js +318 -0
- package/dist/test/p2p-cid-connect-test.js +195 -0
- package/dist/test/p2p-connect-receiver.js +69 -0
- package/dist/test/p2p-doc-transfer.js +110 -0
- package/dist/test/p2p-identity-page-test.js +77 -0
- package/dist/test/p2p-iroh-test.js +171 -0
- package/dist/test/p2p-minimal-test.js +241 -0
- package/dist/test/p2p-node-1.js +148 -0
- package/dist/test/p2p-node-2.js +148 -0
- package/dist/test/p2p-server.js +281 -0
- package/dist/test/p2p-two-nodes-test.js +438 -0
- package/dist/test/pi-sdk.test.js +44 -0
- package/dist/test/set-persona.js +40 -0
- package/dist/test/simple.test.js +9 -0
- package/dist/test/storage-integration.test.js +150 -0
- package/dist/test/subagent-manager.test.js +276 -0
- package/dist/test/test-gate-flow.test.js +81 -0
- package/dist/test/workflow-engine.test.js +87 -0
- package/dist/test/workflow-pivot-loop.test.js +246 -0
- package/dist/web/api-config.html +779 -779
- package/dist/web/client-hearth.js +10 -10
- package/dist/web/client.js +54 -0
- package/dist/web/components/wallet-viem.mjs +118 -118
- package/dist/web/delivery-ledger.js +103 -0
- package/dist/web/i18n.js +104 -0
- package/dist/web/index.html +472 -472
- package/dist/web/manifest.json +20 -20
- package/dist/web/routes-tasks.js +242 -24
- package/dist/web/server-storage.js +111 -0
- package/dist/web/server.js +55 -26
- package/dist/web/style.css +4946 -4946
- package/dist/web/task-breaker.js +18 -0
- package/dist/web/task-cancel.js +35 -0
- package/dist/web/task-deps.js +36 -0
- package/dist/web/task-review.js +27 -0
- package/dist/web/task-verify.js +60 -0
- package/package.json +196 -193
- package/scripts/build-cli.js +215 -215
- package/scripts/build-web.ts +130 -130
- package/scripts/postinstall.js +152 -152
- package/bin/bolloon-daemon.sh +0 -207
- package/dist/constraint-runtime/reference_data/archive_surface_snapshot.json +0 -63
- package/dist/constraint-runtime/reference_data/commands_snapshot.json +0 -1037
- package/dist/constraint-runtime/reference_data/subsystems/assistant.json +0 -8
- package/dist/constraint-runtime/reference_data/subsystems/bootstrap.json +0 -8
- package/dist/constraint-runtime/reference_data/subsystems/bridge.json +0 -32
- package/dist/constraint-runtime/reference_data/subsystems/buddy.json +0 -13
- package/dist/constraint-runtime/reference_data/subsystems/cli.json +0 -26
- package/dist/constraint-runtime/reference_data/subsystems/components.json +0 -32
- package/dist/constraint-runtime/reference_data/subsystems/constants.json +0 -28
- package/dist/constraint-runtime/reference_data/subsystems/coordinator.json +0 -8
- package/dist/constraint-runtime/reference_data/subsystems/entrypoints.json +0 -15
- package/dist/constraint-runtime/reference_data/subsystems/hooks.json +0 -32
- package/dist/constraint-runtime/reference_data/subsystems/keybindings.json +0 -21
- package/dist/constraint-runtime/reference_data/subsystems/memdir.json +0 -15
- package/dist/constraint-runtime/reference_data/subsystems/migrations.json +0 -18
- package/dist/constraint-runtime/reference_data/subsystems/moreright.json +0 -8
- package/dist/constraint-runtime/reference_data/subsystems/native_ts.json +0 -11
- package/dist/constraint-runtime/reference_data/subsystems/outputStyles.json +0 -8
- package/dist/constraint-runtime/reference_data/subsystems/plugins.json +0 -9
- package/dist/constraint-runtime/reference_data/subsystems/remote.json +0 -11
- package/dist/constraint-runtime/reference_data/subsystems/schemas.json +0 -8
- package/dist/constraint-runtime/reference_data/subsystems/screens.json +0 -10
- package/dist/constraint-runtime/reference_data/subsystems/server.json +0 -10
- package/dist/constraint-runtime/reference_data/subsystems/services.json +0 -32
- package/dist/constraint-runtime/reference_data/subsystems/skills.json +0 -27
- package/dist/constraint-runtime/reference_data/subsystems/state.json +0 -13
- package/dist/constraint-runtime/reference_data/subsystems/types.json +0 -18
- package/dist/constraint-runtime/reference_data/subsystems/upstreamproxy.json +0 -9
- package/dist/constraint-runtime/reference_data/subsystems/utils.json +0 -32
- package/dist/constraint-runtime/reference_data/subsystems/vim.json +0 -12
- package/dist/constraint-runtime/reference_data/subsystems/voice.json +0 -8
- package/dist/constraint-runtime/reference_data/tools_snapshot.json +0 -922
- package/dist/electron/config.js.map +0 -1
- package/dist/electron/dialogs.js.map +0 -1
- package/dist/electron/first-run.js.map +0 -1
- package/dist/electron/ipc.js.map +0 -1
- package/dist/electron/logger.js.map +0 -1
- package/dist/electron/main.js.map +0 -1
- package/dist/electron/menu.js.map +0 -1
- package/dist/electron/paths.js.map +0 -1
- package/dist/electron/server.js.map +0 -1
- package/dist/electron/tray.js.map +0 -1
- package/dist/electron/window.js.map +0 -1
- package/dist/utils/auto-update.js.map +0 -1
- package/dist/web/client.js.map +0 -7
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* task-breaker.ts — 任务连续失败熔断器 (借鉴 Hermes kanban `consecutive_failures`:
|
|
3
|
+
* 失败递增, 成功清零, 超过 failure_limit 熔断 — 防无限重试循环)
|
|
4
|
+
*
|
|
5
|
+
* 纯函数, 可单测。
|
|
6
|
+
*/
|
|
7
|
+
/** 默认熔断阈值: 连续 3 次失败 (BOLLOON_FAILURE_LIMIT 可调) */
|
|
8
|
+
export const DEFAULT_FAILURE_LIMIT = 3;
|
|
9
|
+
/** 记录一次失败: 计数 +1, 判断是否熔断. 优先级: per-task failureLimit → env → DEFAULT. */
|
|
10
|
+
export function recordTaskFailure(task, envLimit) {
|
|
11
|
+
const limit = task.failureLimit ?? (envLimit && envLimit > 0 ? envLimit : DEFAULT_FAILURE_LIMIT);
|
|
12
|
+
const next = (task.consecutiveFailures ?? 0) + 1;
|
|
13
|
+
return { consecutiveFailures: next, tripped: next >= limit };
|
|
14
|
+
}
|
|
15
|
+
/** 成功完成: 计数清零 */
|
|
16
|
+
export function resetTaskFailures() {
|
|
17
|
+
return { consecutiveFailures: 0 };
|
|
18
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* task-cancel.ts — 任务取消两段式状态机 (借鉴 Hermes `SubagentState`:
|
|
3
|
+
* CANCEL_REQUESTED → CANCELLED, 区分"请求已受理"与"实际已停止")
|
|
4
|
+
*
|
|
5
|
+
* 纯函数, 无 express/io 依赖 — 路由和 executor 共用, 可单测。
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* 应用一次取消请求 (第一段)。
|
|
9
|
+
* - pending: 从未开始 → 直接 cancelled (请求即完成, 不会卡在中间态)
|
|
10
|
+
* - running: → cancel-requested (请求受理, 等 executor 观测后落 cancelled)
|
|
11
|
+
* - cancel-requested: 幂等返回 already-requested
|
|
12
|
+
* - 其余终态: terminal, 不可取消
|
|
13
|
+
*/
|
|
14
|
+
export function applyCancelRequest(status) {
|
|
15
|
+
switch (status) {
|
|
16
|
+
case 'pending':
|
|
17
|
+
return { status: 'cancelled', phase: 'direct' };
|
|
18
|
+
case 'running':
|
|
19
|
+
return { status: 'cancel-requested', phase: 'requested' };
|
|
20
|
+
case 'cancel-requested':
|
|
21
|
+
return { status: 'cancel-requested', phase: 'already-requested' };
|
|
22
|
+
default:
|
|
23
|
+
return { status: 'cancelled', phase: 'terminal' };
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* executor 完成/异常时调用 (第二段): 若任务处于 cancel-requested, 应落 cancelled 而非正常终态。
|
|
28
|
+
*/
|
|
29
|
+
export function shouldFinalizeAsCancelled(status) {
|
|
30
|
+
return status === 'cancel-requested';
|
|
31
|
+
}
|
|
32
|
+
/** 取消请求是否已受理 (running 任务的第一段) */
|
|
33
|
+
export function isCancelPending(status) {
|
|
34
|
+
return status === 'cancel-requested';
|
|
35
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* task-deps.ts — 任务父依赖校验 (借鉴 Hermes kanban 认领点父依赖不变式:
|
|
3
|
+
* claim 时强制检查所有父任务 done/archived, 否则 demote 回 todo)
|
|
4
|
+
*
|
|
5
|
+
* 纯函数。bolloon 终态语义: completed/cancelled 视为父已结束 (依赖解除);
|
|
6
|
+
* failed 视为父未成功 (子任务不满足前提, 阻塞等人工决策)。
|
|
7
|
+
*/
|
|
8
|
+
const PARENT_DONE_STATUSES = new Set(['completed', 'cancelled']);
|
|
9
|
+
/** 父依赖是否满足: 无父 / 父全部 completed|cancelled → true; 父 missing/failed/running/pending → false */
|
|
10
|
+
export function parentsSatisfied(task, allTasks) {
|
|
11
|
+
const parentIds = task?.parentIds;
|
|
12
|
+
if (!parentIds || parentIds.length === 0)
|
|
13
|
+
return true;
|
|
14
|
+
for (const pid of parentIds) {
|
|
15
|
+
const parent = allTasks.find((t) => t.id === pid);
|
|
16
|
+
// 父不存在 → 保守阻塞 (依赖悬空, 等人工修复)
|
|
17
|
+
if (!parent)
|
|
18
|
+
return false;
|
|
19
|
+
if (!PARENT_DONE_STATUSES.has(parent.status))
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
/** 列出未满足的父任务 id (诊断用) */
|
|
25
|
+
export function unsatisfiedParents(task, allTasks) {
|
|
26
|
+
const parentIds = task?.parentIds;
|
|
27
|
+
if (!parentIds || parentIds.length === 0)
|
|
28
|
+
return [];
|
|
29
|
+
const out = [];
|
|
30
|
+
for (const pid of parentIds) {
|
|
31
|
+
const parent = allTasks.find((t) => t.id === pid);
|
|
32
|
+
if (!parent || !PARENT_DONE_STATUSES.has(parent.status))
|
|
33
|
+
out.push(pid);
|
|
34
|
+
}
|
|
35
|
+
return out;
|
|
36
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* task-review.ts — 任务 review 审批通道状态机 (借鉴 Hermes kanban 9 态:
|
|
3
|
+
* request_review 把任务挂进 review 通道, complete_task 接受 review→done)
|
|
4
|
+
*
|
|
5
|
+
* 纯函数, 无 express/io 依赖 — 路由共用, 可单测。
|
|
6
|
+
*/
|
|
7
|
+
/** 请求审批: running/pending → review (挂起等人工/审查者放行) */
|
|
8
|
+
export function applyReviewRequest(status) {
|
|
9
|
+
if (status === 'running' || status === 'pending') {
|
|
10
|
+
return { status: 'review', phase: 'requested' };
|
|
11
|
+
}
|
|
12
|
+
return { status, phase: 'not-reviewable' };
|
|
13
|
+
}
|
|
14
|
+
/** 审批通过: review → completed (放行) */
|
|
15
|
+
export function applyReviewApprove(status) {
|
|
16
|
+
if (status === 'review') {
|
|
17
|
+
return { status: 'completed', phase: 'approved' };
|
|
18
|
+
}
|
|
19
|
+
return { status, phase: 'not-reviewable' };
|
|
20
|
+
}
|
|
21
|
+
/** 审批驳回: review → pending (退回队列, 可重新认领执行) */
|
|
22
|
+
export function applyReviewReject(status) {
|
|
23
|
+
if (status === 'review') {
|
|
24
|
+
return { status: 'pending', phase: 'rejected' };
|
|
25
|
+
}
|
|
26
|
+
return { status, phase: 'not-reviewable' };
|
|
27
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* task-verify.ts — 任务完成防幻觉校验 (借鉴 Hermes complete_task:
|
|
3
|
+
* created_cards 逐 id 验证 → 幽灵卡阻止完成; 散文引用不解析 → suspected_hallucinated_references 事件)
|
|
4
|
+
*
|
|
5
|
+
* Bolloon 版 (advisory 不阻塞): 完成时校验 result 里引用的任务 id 和本地文件路径,
|
|
6
|
+
* 不存在的 → warning 列表 (存 task.warnings + broadcast), 不阻止完成 (单次同步执行无法返工).
|
|
7
|
+
*/
|
|
8
|
+
import * as path from 'path';
|
|
9
|
+
/** 提取 result 里的任务 id 引用 (task_xxx 模式) — 校验是否幽灵引用 */
|
|
10
|
+
export function extractTaskReferences(text) {
|
|
11
|
+
const re = /\btask_[a-z0-9]+/gi;
|
|
12
|
+
const out = new Set();
|
|
13
|
+
for (const m of text.matchAll(re))
|
|
14
|
+
out.add(m[0].toLowerCase());
|
|
15
|
+
return [...out];
|
|
16
|
+
}
|
|
17
|
+
/** 提取 result 里的本地文件路径引用 (markdown 链接 + 反引号路径 + path:line), 不含 URL; cap 20 条 */
|
|
18
|
+
export function extractFileReferences(text) {
|
|
19
|
+
const out = new Set();
|
|
20
|
+
for (const m of text.matchAll(/\[[^\]]*\]\(([^)\s]+)\)/g)) {
|
|
21
|
+
const p = m[1];
|
|
22
|
+
if (!/^[a-z]+:\/\//i.test(p))
|
|
23
|
+
out.add(p);
|
|
24
|
+
}
|
|
25
|
+
for (const m of text.matchAll(/`([^`]+)`/g)) {
|
|
26
|
+
const p = m[1].trim();
|
|
27
|
+
if (p.includes('/') || p.includes('\\') || /\.(md|ts|tsx|js|jsx|json|py|txt)$/i.test(p))
|
|
28
|
+
out.add(p);
|
|
29
|
+
}
|
|
30
|
+
return [...out].slice(0, 20);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* 校验任务完成结果: 任务 id 引用必须在队列中存在; 文件路径引用必须存在 (相对 cwd 解析).
|
|
34
|
+
* 纯 IO 校验, 不修改任务状态 — 返回 warning 列表 (幽灵引用, advisory 不阻塞).
|
|
35
|
+
*/
|
|
36
|
+
export async function verifyTaskResult(result, opts) {
|
|
37
|
+
const warnings = [];
|
|
38
|
+
const known = new Set(opts.knownTaskIds);
|
|
39
|
+
const taskRefs = extractTaskReferences(result);
|
|
40
|
+
for (const ref of taskRefs) {
|
|
41
|
+
if (!known.has(ref)) {
|
|
42
|
+
warnings.push(`result 引用不存在的任务 ${ref} (疑似幻觉引用)`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
let checkedCount = taskRefs.length;
|
|
46
|
+
const fileRefs = extractFileReferences(result);
|
|
47
|
+
const fsMod = opts.fs ?? (await import('fs/promises'));
|
|
48
|
+
const base = opts.cwd ?? process.cwd();
|
|
49
|
+
for (const ref of fileRefs) {
|
|
50
|
+
checkedCount++;
|
|
51
|
+
const abs = ref.startsWith('/') || /^[a-zA-Z]:[\\/]/.test(ref) ? ref : path.resolve(base, ref);
|
|
52
|
+
try {
|
|
53
|
+
await fsMod.access(abs);
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
warnings.push(`result 引用不存在的文件 ${ref} (疑似幻觉引用)`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return { warnings, checkedCount };
|
|
60
|
+
}
|
package/package.json
CHANGED
|
@@ -1,193 +1,196 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@bolloon/bolloon-agent",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"type": "module",
|
|
5
|
-
"description": "P2P AI Document Agent - 全局安装后执行 `bolloon` 启动产品",
|
|
6
|
-
"main": "dist/cli-entry.js",
|
|
7
|
-
"author": "yuanjie liu",
|
|
8
|
-
"repository": {
|
|
9
|
-
"type": "git",
|
|
10
|
-
"url": "https://github.com/logos-42/bolloon.git"
|
|
11
|
-
},
|
|
12
|
-
"license": "MIT",
|
|
13
|
-
"files": [
|
|
14
|
-
"dist",
|
|
15
|
-
"bin/bolloon.cjs",
|
|
16
|
-
"bin/bolloon.js",
|
|
17
|
-
"bin/bolloon.cmd",
|
|
18
|
-
"bin/bolloon-cli.cjs",
|
|
19
|
-
"bin/bolloon-daemon.sh",
|
|
20
|
-
"scripts/postinstall.js",
|
|
21
|
-
"scripts/build-cli.js",
|
|
22
|
-
"scripts/build-web.ts"
|
|
23
|
-
],
|
|
24
|
-
"bin": {
|
|
25
|
-
"bolloon": "./dist/cli-entry.js"
|
|
26
|
-
},
|
|
27
|
-
"scripts": {
|
|
28
|
-
"build": "npm run build --workspaces --if-present",
|
|
29
|
-
"build:main": "tsc && node scripts/copy-constraint-runtime.mjs",
|
|
30
|
-
"build:cli": "node scripts/build-cli.js",
|
|
31
|
-
"build:web": "npx tsx scripts/build-web.ts",
|
|
32
|
-
"build:
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"dev
|
|
38
|
-
"
|
|
39
|
-
"electron
|
|
40
|
-
"electron:
|
|
41
|
-
"electron:
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"test
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
"@
|
|
59
|
-
"@
|
|
60
|
-
"@
|
|
61
|
-
"@
|
|
62
|
-
"@
|
|
63
|
-
"@libp2p
|
|
64
|
-
"@libp2p
|
|
65
|
-
"@
|
|
66
|
-
"@libp2p/
|
|
67
|
-
"@libp2p/
|
|
68
|
-
"@libp2p/
|
|
69
|
-
"@libp2p/
|
|
70
|
-
"@libp2p/
|
|
71
|
-
"@
|
|
72
|
-
"@
|
|
73
|
-
"@
|
|
74
|
-
"@
|
|
75
|
-
"@
|
|
76
|
-
"@
|
|
77
|
-
"@
|
|
78
|
-
"@
|
|
79
|
-
"@x402/
|
|
80
|
-
"@x402/
|
|
81
|
-
"@x402/
|
|
82
|
-
"@x402/
|
|
83
|
-
"@x402/
|
|
84
|
-
"@x402/
|
|
85
|
-
"@x402/
|
|
86
|
-
"@x402/
|
|
87
|
-
"@x402/
|
|
88
|
-
"@x402/
|
|
89
|
-
"@x402/
|
|
90
|
-
"@x402/
|
|
91
|
-
"@x402/
|
|
92
|
-
"@x402/
|
|
93
|
-
"@x402/
|
|
94
|
-
"
|
|
95
|
-
"
|
|
96
|
-
"
|
|
97
|
-
"
|
|
98
|
-
"
|
|
99
|
-
"
|
|
100
|
-
"
|
|
101
|
-
"
|
|
102
|
-
"
|
|
103
|
-
"
|
|
104
|
-
"
|
|
105
|
-
"
|
|
106
|
-
"
|
|
107
|
-
"
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
"
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
"@
|
|
114
|
-
"@
|
|
115
|
-
"@types/
|
|
116
|
-
"@types/
|
|
117
|
-
"
|
|
118
|
-
"
|
|
119
|
-
"
|
|
120
|
-
"
|
|
121
|
-
"
|
|
122
|
-
"
|
|
123
|
-
"
|
|
124
|
-
"
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
"
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
"
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
"dist
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
"
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
"
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
"
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
"
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
"
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
"
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
"
|
|
182
|
-
"
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
"node_modules
|
|
190
|
-
"node_modules/@
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@bolloon/bolloon-agent",
|
|
3
|
+
"version": "0.4.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "P2P AI Document Agent - 全局安装后执行 `bolloon` 启动产品",
|
|
6
|
+
"main": "dist/cli-entry.js",
|
|
7
|
+
"author": "yuanjie liu",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/logos-42/bolloon.git"
|
|
11
|
+
},
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"files": [
|
|
14
|
+
"dist",
|
|
15
|
+
"bin/bolloon.cjs",
|
|
16
|
+
"bin/bolloon.js",
|
|
17
|
+
"bin/bolloon.cmd",
|
|
18
|
+
"bin/bolloon-cli.cjs",
|
|
19
|
+
"bin/bolloon-daemon.sh",
|
|
20
|
+
"scripts/postinstall.js",
|
|
21
|
+
"scripts/build-cli.js",
|
|
22
|
+
"scripts/build-web.ts"
|
|
23
|
+
],
|
|
24
|
+
"bin": {
|
|
25
|
+
"bolloon": "./dist/cli-entry.js"
|
|
26
|
+
},
|
|
27
|
+
"scripts": {
|
|
28
|
+
"build": "npm run build --workspaces --if-present",
|
|
29
|
+
"build:main": "tsc && node scripts/copy-constraint-runtime.mjs",
|
|
30
|
+
"build:cli": "node scripts/build-cli.js",
|
|
31
|
+
"build:web": "npx tsx scripts/build-web.ts",
|
|
32
|
+
"build:rokid-sdk": "npm --prefix ../rokid run build",
|
|
33
|
+
"test:rokid-sdk": "npm --prefix ../rokid test",
|
|
34
|
+
"build:electron": "tsc -p tsconfig.electron.json",
|
|
35
|
+
"build:all": "npm run build:main && npm run build:web && npm run build:electron && npm run build:cli",
|
|
36
|
+
"start": "node dist/index.js",
|
|
37
|
+
"dev": "tsx -r dotenv/config src/index.ts",
|
|
38
|
+
"dev:web": "npm run build:web && tsx -r dotenv/config src/index.ts --web",
|
|
39
|
+
"dev:electron": "npm run build:electron && npm run electron:start",
|
|
40
|
+
"electron:start": "NODE_ENV=development electron dist/electron-build/electron.js",
|
|
41
|
+
"electron:dev": "concurrently \"npm run dev:web\" \"npm run electron:start\"",
|
|
42
|
+
"electron:build": "npm run build:electron && electron-builder",
|
|
43
|
+
"electron:pack": "electron-builder --dir",
|
|
44
|
+
"app:bundle": "node scripts/build-app-bundle.cjs",
|
|
45
|
+
"app:bundle:open": "node scripts/build-app-bundle.cjs && open \"release/mac-arm64/Bolloon Agent.app\"",
|
|
46
|
+
"smoke:esm": "node scripts/smoke-esm.mjs",
|
|
47
|
+
"prepublishOnly": "npm run build:all && npm run smoke:esm",
|
|
48
|
+
"test": "vitest run",
|
|
49
|
+
"test:watch": "vitest",
|
|
50
|
+
"test:pi-sdk": "tsx src/test/pi-sdk.test.ts",
|
|
51
|
+
"postinstall": "node scripts/postinstall.js",
|
|
52
|
+
"verify:ipns": "tsx scripts/verify-ipns-pipeline.ts"
|
|
53
|
+
},
|
|
54
|
+
"workspaces": [
|
|
55
|
+
"src/constraint-runtime"
|
|
56
|
+
],
|
|
57
|
+
"dependencies": {
|
|
58
|
+
"@bolloon/bolloon-agent": "^0.3.22",
|
|
59
|
+
"@bolloon/constraint-runtime": "0.1.0",
|
|
60
|
+
"@capacitor/android": "^8.4.1",
|
|
61
|
+
"@capacitor/core": "^8.4.1",
|
|
62
|
+
"@capacitor/ios": "^8.4.2",
|
|
63
|
+
"@chainsafe/libp2p-noise": "^17.0.0",
|
|
64
|
+
"@chainsafe/libp2p-yamux": "^8.0.1",
|
|
65
|
+
"@diap/sdk": "^0.2.4",
|
|
66
|
+
"@libp2p/autonat": "^3.0.25",
|
|
67
|
+
"@libp2p/circuit-relay-v2": "^4.2.9",
|
|
68
|
+
"@libp2p/dcutr": "^3.0.20",
|
|
69
|
+
"@libp2p/gossipsub": "^16.1.1",
|
|
70
|
+
"@libp2p/identify": "^4.1.6",
|
|
71
|
+
"@libp2p/kad-dht": "^16.2.6",
|
|
72
|
+
"@libp2p/tcp": "^11.0.20",
|
|
73
|
+
"@libp2p/upnp-nat": "^4.0.20",
|
|
74
|
+
"@multiformats/multiaddr": "^13.0.3",
|
|
75
|
+
"@noble/hashes": "^1.3.0",
|
|
76
|
+
"@orbitdb/core": "^4.0.0",
|
|
77
|
+
"@polymarket/client": "^0.2.0",
|
|
78
|
+
"@rayhanadev/iroh": "^0.1.1",
|
|
79
|
+
"@x402/aptos": "^2.20.0",
|
|
80
|
+
"@x402/avm": "^2.20.0",
|
|
81
|
+
"@x402/axios": "^2.20.0",
|
|
82
|
+
"@x402/core": "^2.20.0",
|
|
83
|
+
"@x402/evm": "^2.20.0",
|
|
84
|
+
"@x402/express": "^2.20.0",
|
|
85
|
+
"@x402/extensions": "^2.20.0",
|
|
86
|
+
"@x402/fastify": "^2.20.0",
|
|
87
|
+
"@x402/fetch": "^2.20.0",
|
|
88
|
+
"@x402/hedera": "^2.20.0",
|
|
89
|
+
"@x402/hono": "^2.20.0",
|
|
90
|
+
"@x402/keeta": "^2.20.0",
|
|
91
|
+
"@x402/mcp": "^2.20.0",
|
|
92
|
+
"@x402/next": "^2.20.0",
|
|
93
|
+
"@x402/paywall": "^2.20.0",
|
|
94
|
+
"@x402/stellar": "^2.20.0",
|
|
95
|
+
"@x402/svm": "^2.20.0",
|
|
96
|
+
"@x402/tvm": "^2.20.0",
|
|
97
|
+
"b4a": "^1.8.1",
|
|
98
|
+
"dotenv": "^17.4.2",
|
|
99
|
+
"esbuild": "^0.24.0",
|
|
100
|
+
"express": "^5.2.1",
|
|
101
|
+
"helia": "^7.1.3",
|
|
102
|
+
"ink": "^7.1.1",
|
|
103
|
+
"ink-text-input": "^6.0.0",
|
|
104
|
+
"libp2p": "^3.3.0",
|
|
105
|
+
"mammoth": "^1.6.0",
|
|
106
|
+
"pdf-parse": "^1.1.4",
|
|
107
|
+
"platform": "^1.3.6",
|
|
108
|
+
"react": "^19.2.8",
|
|
109
|
+
"react-dom": "^19.2.8",
|
|
110
|
+
"viem": "^2.52.0"
|
|
111
|
+
},
|
|
112
|
+
"devDependencies": {
|
|
113
|
+
"@capacitor/cli": "^8.4.1",
|
|
114
|
+
"@playwright/test": "^1.60.0",
|
|
115
|
+
"@types/express": "^5.0.6",
|
|
116
|
+
"@types/node": "^25.9.1",
|
|
117
|
+
"@types/pdf-parse": "^1.1.5",
|
|
118
|
+
"@types/react": "^19.2.18",
|
|
119
|
+
"@types/react-dom": "^19.2.4",
|
|
120
|
+
"concurrently": "^9.2.1",
|
|
121
|
+
"electron": "^42.3.0",
|
|
122
|
+
"electron-builder": "^26.15.5",
|
|
123
|
+
"lefthook": "^2.1.9",
|
|
124
|
+
"playwright": "^1.60.0",
|
|
125
|
+
"tsx": "^4.0.0",
|
|
126
|
+
"typescript": "^5.0.0",
|
|
127
|
+
"vitest": "^4.1.6"
|
|
128
|
+
},
|
|
129
|
+
"build": {
|
|
130
|
+
"appId": "com.bolloon.agent",
|
|
131
|
+
"productName": "Bolloon Agent",
|
|
132
|
+
"directories": {
|
|
133
|
+
"output": "release",
|
|
134
|
+
"buildResources": "build"
|
|
135
|
+
},
|
|
136
|
+
"files": [
|
|
137
|
+
"dist/**/*",
|
|
138
|
+
"bin/**/*",
|
|
139
|
+
"package.json",
|
|
140
|
+
"dist/electron-build/**/*"
|
|
141
|
+
],
|
|
142
|
+
"npmRebuild": false,
|
|
143
|
+
"buildDependenciesFromSource": false,
|
|
144
|
+
"extraResources": [
|
|
145
|
+
{
|
|
146
|
+
"from": "build",
|
|
147
|
+
"to": "build",
|
|
148
|
+
"filter": [
|
|
149
|
+
"**/*"
|
|
150
|
+
]
|
|
151
|
+
}
|
|
152
|
+
],
|
|
153
|
+
"extraMetadata": {
|
|
154
|
+
"main": "dist/electron-build/electron.js",
|
|
155
|
+
"type": "commonjs"
|
|
156
|
+
},
|
|
157
|
+
"win": {
|
|
158
|
+
"target": [
|
|
159
|
+
{
|
|
160
|
+
"target": "nsis",
|
|
161
|
+
"arch": [
|
|
162
|
+
"x64"
|
|
163
|
+
]
|
|
164
|
+
}
|
|
165
|
+
],
|
|
166
|
+
"icon": "build/icon.ico"
|
|
167
|
+
},
|
|
168
|
+
"mac": {
|
|
169
|
+
"target": [
|
|
170
|
+
"dmg"
|
|
171
|
+
],
|
|
172
|
+
"icon": "build/icon.icns"
|
|
173
|
+
},
|
|
174
|
+
"linux": {
|
|
175
|
+
"target": [
|
|
176
|
+
"AppImage"
|
|
177
|
+
],
|
|
178
|
+
"icon": "build/icon.png"
|
|
179
|
+
},
|
|
180
|
+
"nsis": {
|
|
181
|
+
"oneClick": false,
|
|
182
|
+
"perMachine": false,
|
|
183
|
+
"allowToChangeInstallationDirectory": true,
|
|
184
|
+
"createDesktopShortcut": true,
|
|
185
|
+
"createStartMenuShortcut": true
|
|
186
|
+
},
|
|
187
|
+
"asar": true,
|
|
188
|
+
"asarUnpack": [
|
|
189
|
+
"node_modules/@diap/**/*",
|
|
190
|
+
"node_modules/@rayhanadev/**/*",
|
|
191
|
+
"node_modules/@x402/**/*",
|
|
192
|
+
"node_modules/libp2p/**/*",
|
|
193
|
+
"node_modules/@libp2p/**/*"
|
|
194
|
+
]
|
|
195
|
+
}
|
|
196
|
+
}
|