feat(miniapp): add builtin bitfun-loopx console MiniApp - #2382
Open
xielixing wants to merge 10 commits into
Open
feat(miniapp): add builtin bitfun-loopx console MiniApp#2382xielixing wants to merge 10 commits into
xielixing wants to merge 10 commits into
Conversation
…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.
The JS worker crashed on startup with "JSON Parse error: Unterminated string" because the permission policy JSON was passed as an argv argument and Windows/Bun argv parsing truncates multi-line JSON. Deliver the policy through BITFUN_WORKER_POLICY instead. - Rename worker_host.js to worker_host.cjs so the CommonJS host is not treated as ESM under the repo "type": "module" package.json. - Wait for the worker __ready handshake with a bounded timeout so a broken spawn fails fast instead of hanging every RPC. - On Windows, retry runtime detection with .exe/.cmd/.bat/.com suffixes so an extensionless npm shim (e.g. bun vs bun.cmd) cannot shadow the real launcher. - Sync worker_host doc references across the miniapp-dev skill materials.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
新增内置 MiniApp bitfun-loopx(品牌统一为 bitfun-loopx,
assets/bitfun-loopx/即权威源码,不依赖任何外部仓库快照):粘贴 GitHub Issue 链接,由 BitFun 宿主 Agent 驱动本机 loopx 持续修复,心跳调度、人工审批、中途插话。本分支共 6 个提交(初始内置版 + sidecar 打包 + 后续打磨):
builtin/assets/bitfun-loopx/五件套 + meta + README;BUILTIN_APPS注册builtin-bitfun-loopx;原名 LoopX 控制台已统一品牌为 bitfun-loopx(标题、会话名、PR 标记、User-Agent);数据目录前向改名(新装~/.bitfun/bitfun-loopx/,旧loopx-console继续沿用,不搬动用户数据);探测自愈(worker 无条件把本应用 vendor 目录纳入候选)。scripts/build-loopx.mjs构建期拉取 pinv0.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)。.topbar/.brand相关 CSS 一并清理)。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_miniapp→ 2 passed, 0 failed(id 顺序断言 + meta/deps 契约测试)pnpm run check:github-config→ 14/14;node --check通过 worker.js / build-loopx.mjs / desktop-tauri-build.mjspnpm 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: …\resourcesshell.allow=[loopx, python, py, git]、net.allow仅api.github.com/github.com;GitHub 凭据只存本机应用存储(gh CLI 或粘贴的 PAT),不写入 git config;发布 PR 必须人工批准。Reviewer Notes
--no-bundle)与内置二进制缺失时走 vendor/pip 兜底。LOOPX_VENDOR_REF必须同步升级(当前均v0.2.13)。src/apps/desktop/resources/loopx/在.gitignore,不进仓库;macOS/Linux 的实际编译产物建议在 release/nightly 流水线观察一轮(Windows 已本机验证)。Checklist