Skip to content

feat(miniapp): give marketplace agent runs web research - #1956

Merged
bobleer merged 1 commit into
GCWing:mainfrom
bobleer:feat/miniapp-market-agent-web-research
Aug 1, 2026
Merged

feat(miniapp): give marketplace agent runs web research#1956
bobleer merged 1 commit into
GCWing:mainfrom
bobleer:feat/miniapp-market-agent-web-research

Conversation

@bobleer

@bobleer bobleer commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator

问题

BitFun 目前有三个 Agentic MiniApp:PPT LiveMarket Lens循天问命。其中只有 PPT Live 的 Agent 能联网调研,另外两个完全没有 WebSearch / WebFetch。

根因在框架侧,不在小应用自己:useMiniAppBridge.tsruntime_profile = market_strict 的市场小应用在 agent.ensureSessionagent.run 两处硬编码了 enableTools: false。这个开关是全有或全无的,关掉整个工具循环的同时也一并关掉了只读的联网调研能力。PPT Live 走的是 compatibility 档位,所以不受影响——其会话记录里能看到真实的 WebSearch / WebFetch 调用,而另外两个小应用的每个会话 toolCallCount 都是 0。

改动

把安全边界从不可信的前端移到运行时后端:

  • 运行时档位随回合下发:MiniApp Agent 回合的 metadata 增加 marketStrict 标记,只在严格档位序列化,内置小应用的 metadata 与既有版本逐字节一致。
  • 市场小应用走只读调研白名单WebSearch / WebFetch / GetTime 加上 deferred 网关对,叠加在既有 headless 禁用项之上。文件系统、命令行、宿主控制面一律碰不到。用白名单(而不是更长的黑名单)保证新注册的工具默认关闭。执行闸门比对的是 effective tool name,所以 deferred 调用无法绕过白名单。
  • 内置 / compatibility 小应用不变:PPT Live 保留完整 headless 工具集。
  • 修复已有会话enable_tools 是写死在会话配置里的,旧版本创建的会话复用时会永远没有工具。复用 MiniApp Agent 会话时现在会重新同步工具开关。

验证

  • cargo test -p bitfun-agent-tools(103 passed)
  • cargo test -p bitfun-product-domains --all-features
  • cargo test -p bitfun-core --lib(1743 passed)
  • cargo check -p bitfun-desktopcargo clippy -p bitfun-core -p bitfun-desktop --all-targets(改动文件无新增告警)
  • pnpm run type-check:webpnpm vitest run src/app/scenes/miniapps(15 files / 52 tests passed)
  • pnpm run fmt:rspnpm run check:repo-hygiene

新增回归测试覆盖:严格档位的工具白名单与 headless 禁用项叠加、运行时档位选择、metadata 标记、以及前端不再强制关闭工具循环。

Marketplace MiniApps run under the strict runtime profile, and the host
bridge forced `enableTools: false` on their hidden agent sessions. That
switch is all-or-nothing, so it also removed WebSearch and WebFetch: the
two marketplace Agentic MiniApps (Market Lens, 循天问命) could never look
anything up, while the built-in PPT Live kept full tool access through
the compatibility profile.

Move the boundary from the frontend to the runtime. Agent turns now carry
the app's runtime profile as `marketStrict` metadata, and strict runs
resolve to a read-only research allowlist (WebSearch, WebFetch, the clock,
and the deferred gateway pair) layered on top of the existing headless
denials. The execution gate matches the effective tool name, so a deferred
invocation cannot smuggle a denied tool past the allowlist. Built-in and
compatibility MiniApps keep the wider headless tool set unchanged.

`enable_tools` is persisted in the session config, so sessions created by
earlier builds would stay tool-less on reuse. Reused MiniApp agent
sessions now have their tool enablement re-synced with the current run.
@bobleer
bobleer merged commit cabaa5d into GCWing:main Aug 1, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant