Skip to content

feat(miniapp): add builtin bitfun-loopx console MiniApp - #2382

Open
xielixing wants to merge 9 commits into
GCWing:mainfrom
xielixing:builtin/bitfun-loopx-miniapp
Open

feat(miniapp): add builtin bitfun-loopx console MiniApp#2382
xielixing wants to merge 9 commits into
GCWing:mainfrom
xielixing:builtin/bitfun-loopx-miniapp

Conversation

@xielixing

@xielixing xielixing commented Aug 19, 2026

Copy link
Copy Markdown

Summary

新增内置 MiniApp bitfun-loopx(品牌统一为 bitfun-loopx,assets/bitfun-loopx/ 即权威源码,不依赖任何外部仓库快照):粘贴 GitHub Issue 链接,由 BitFun 宿主 Agent 驱动本机 loopx 持续修复,心跳调度、人工审批、中途插话。

本分支共 6 个提交(初始内置版 + sidecar 打包 + 后续打磨):

  1. 内置 miniappbuiltin/assets/bitfun-loopx/ 五件套 + meta + README;BUILTIN_APPS 注册 builtin-bitfun-loopx;原名 LoopX 控制台已统一品牌为 bitfun-loopx(标题、会话名、PR 标记、User-Agent);数据目录前向改名(新装 ~/.bitfun/bitfun-loopx/,旧 loopx-console 继续沿用,不搬动用户数据);探测自愈(worker 无条件把本应用 vendor 目录纳入候选)。
  2. loopx 随安装包内置(方案 A)scripts/build-loopx.mjs 构建期拉取 pin v0.2.13 源码 → venv + PyInstaller 编译单文件二进制 → 输出 LICENSE / TRADEMARKS.md / manifest.json(版本、commit、sha256、构建工具链)到 src/apps/desktop/resources/loopx/(gitignore,二进制不进仓库,每次打包构建重新拉取+编译);desktop-tauri-build.mjs 在 bundle 构建时动态注入 sidecar 资源(dev --no-bundle 跳过);desktop 解析资源目录 → 经 worker pool 以 BITFUN_RESOURCE_DIR 注入 JS worker → 内置二进制最高优先级(用户机器零 Python/git/网络),vendor/pip 兜底;CI 增加 setup-python@v5(3.13)。
  3. 移除非功能顶栏:bitfun-loopx 顶栏只放品牌名、无任何按钮,纯属浪费纵向空间,整行移除(.topbar/.brand 相关 CSS 一并清理)。
  4. gh 登录体验:流式展示登录步骤可见进度,放宽 worker 调用超时。
  5. 版本策略:内置包 version 采用按 release 提升策略(当前 1,未发布;dev 迭代靠内容哈希 reseed),新增契约测试:每个 meta.json 可解析为 MiniAppMeta、id 匹配、zh-CN/en-US i18n 完整、esm_dependencies.json 可解析;README 补充 reseed 覆盖/本地覆盖通知/storage.json 保留语义与 loopx pin 升级 runbook。
  6. 非桌面降级 + 可复现构建:MiniApp 场景在非桌面表面大声降级;BitFun-Installer 锁文件入库。

Fixes #

Type and Areas

Type: Feature

Areas: Rust core(product-domains 内置 MiniApp 资产)、MiniApp runtime、Desktop(资源解析/打包)、CI、Docs、Installer

Motivation / Impact

loopx(huangruiteng/loopx,MIT)是给长任务 Agent 记账的控制面 CLI:目标、待办、门禁、额度都记,但自己没有调度器和执行器。bitfun-loopx 补上这两样:心跳当闹钟,BitFun 宿主 Agent 当手。市场版受 marketStrict 运行时档限制跑不动修复循环,内置版不受此限。

此前 loopx 依赖运行时拉取(用户机器需要 Python 3.11+、git、网络)且探测失败率高(本机实测「未检测到 loopx CLI」)。现在构建期编译 + 安装包 sidecar 内置,打开即用;MIT 再分发义务随包履行(LICENSE/TRADEMARKS/manifest 随包 + THIRD_PARTY_NOTICES 收录)。

Verification

  • cargo test -p bitfun-product-domains --features product-full builtin_miniapp2 passed, 0 failed(id 顺序断言 + meta/deps 契约测试)
  • pnpm run check:github-config → 14/14;node --check 通过 worker.js / build-loopx.mjs / desktop-tauri-build.mjs
  • 本机端到端:pnpm run build:loopx 产出 loopx.exe(15.1 MiB,loopx v0.2.13 @ 7232dca…),--version 输出 loopx 0.2.13;应用启动日志确认 seeded builtin miniapp 'builtin-bitfun-loopx' + Resolved bundled loopx CLI resource dir: …\resources
  • 权限逐项说明:shell.allow=[loopx, python, py, git]net.allowapi.github.com / github.com;GitHub 凭据只存本机应用存储(gh CLI 或粘贴的 PAT),不写入 git config;发布 PR 必须人工批准。

Reviewer Notes

  • 合规:loopx 为 MIT(Copyright (c) 2026 LoopX contributors),二进制随包分发保留 LICENSE 与 TRADEMARKS.md;名称描述性使用,第三方集成、非官方出品;PyInstaller bootloader 有 GPL exception,产物不受 GPL 约束。
  • 构建期 vs 运行期:拉取+编译只发生在打包构建,绝不在用户机器执行;dev(--no-bundle)与内置二进制缺失时走 vendor/pip 兜底。
  • 升级纪律:loopx CLI 的 JSON 契约是本应用接口面,内置二进制 pin 与 LOOPX_VENDOR_REF 必须同步升级(当前均 v0.2.13)。
  • 生成的 src/apps/desktop/resources/loopx/.gitignore,不进仓库;macOS/Linux 的实际编译产物建议在 release/nightly 流水线观察一轮(Windows 已本机验证)。
  • 本分支在 fork(xielixing/BitFun)侧,fork 的 Actions 不自动挂到上游 PR checks,需合并侧留意。

Checklist

  • This PR is focused and does not include secrets, temporary prompts, generated scratch files, or unrelated artifacts.
  • Relevant verification is recorded above, or skipped checks are explained.
  • User-facing strings, docs, and locales are updated where applicable.

…ol acquisition

- use ~/.bitfun/bitfun-loopx unconditionally (feature is pre-release; no
  legacy loopx-console migration needed)
- probe python3 on POSIX, add common absolute interpreter locations
- gh acquisition: winget (Windows) / Homebrew (macOS) / direct release
  download via curl+unzip+tar to ~/.bitfun/bitfun-loopx/bin/gh
- launch gh auth login in a platform terminal (cmd start / osascript /
  x-terminal-emulator, gnome-terminal, konsole, xterm) and degrade loudly
  with manual guidance when none exists
- respect https_proxy environment on POSIX; kill loopx process groups on
  POSIX timeouts
- rebrand display name, titles, session names and reset copy to bitfun-loopx
- unify PR body marker wording across ui.js and worker.js
- swap emoji icon for the lucide rocket icon name
- bump BUILTIN_APPS version to 2 for the reseed
- README: this directory is the authoritative source, document the version
  bump workflow, the trusted-worker permission model, platform support and
  the single-instance desktop assumption
- scripts/build-loopx.mjs: build-time fetch of the pinned loopx release and
  a PyInstaller onefile build, staged with LICENSE/TRADEMARKS/provenance
  manifest under src/apps/desktop/resources/loopx (gitignored, rebuilt per
  packaging build)
- desktop-tauri-build.mjs: run the loopx build for bundle builds and inject
  the sidecar resource only when it exists (tauri-build validates resource
  paths at cargo-build time; dev --no-bundle builds skip both)
- desktop resolves the sidecar dir and exports BITFUN_RESOURCE_DIR to MiniApp
  JS workers via the worker pool (services/assembly pass-through)
- bitfun-loopx worker prefers the bundled binary (no Python/git/network on
  user machines), with vendor/pip acquisition as fallback
- CI: setup-python for desktop package + nightly jobs; THIRD_PARTY_NOTICES
  and the MiniApp README updated for the new acquisition order and MIT
  redistribution obligations
… the worker call timeout

- emit a heartbeat line every 30s while polling the browser login so the
  dialog always shows which step is running
- raise node.timeout_ms to 20 minutes: ghLogin (install + 8-minute poll) and
  installLoopx pip attempts previously outlived the 5.5-minute per-call
  timeout and were cut off mid-flight
…t loopx upgrades

- bump BUILTIN_APPS version and meta.json version together once per release
  only; dev iterations reseed via the content hash alone (version reset to 1
  since the app has not shipped)
- add a contract test that every builtin meta.json parses as MiniAppMeta,
  matches the bundle id, carries zh-CN/en-US i18n, and that
  esm_dependencies.json parses as an ESM dep list
- README: builtin update behavior (reseed overwrites local edits, local
  override gets an update notification, storage.json always preserved),
  the v1 no-budget assumption, and a loopx pin-upgrade runbook with the
  first-batch platform lessons
MiniApps run inside the desktop host (worker pool + built-in seeding live
there). On server/web the gallery now shows an explicit desktop-only notice
instead of an empty scene, telling users where MiniApps actually run.
…e builds

The workspace lockfile is already committed; the standalone installer
workspace gets the same treatment so its builds pin identical dependency
versions.
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