Skip to content

feat(miniapp): add scoped agent context files - #2597

Merged
nonoqing merged 3 commits into
GCWing:1.0.0-explorefrom
nonoqing:codex/miniapp-agent-context-files
Aug 28, 2026
Merged

feat(miniapp): add scoped agent context files#2597
nonoqing merged 3 commits into
GCWing:1.0.0-explorefrom
nonoqing:codex/miniapp-agent-context-files

Conversation

@nonoqing

Copy link
Copy Markdown
Collaborator

Summary

  • extend the generic MiniApp Agent bridge with optional bounded contextFiles
  • publish each run as an immutable, in-memory virtual snapshot under .miniapp-context/<scope>
  • let Agent Runtime Read and Grep inspect only the current snapshot without writing it to a MiniApp or workspace filesystem
  • enforce per-file, per-app, and runtime-wide budgets with turn-scoped lifecycle cleanup
  • fail closed on unknown, nested, expired, aliased, or malformed virtual paths and payloads
  • negotiate miniapp_agent_context_files_v1 for Peer Device runs so older peers cannot silently drop context
  • document the framework API and its trust/lifetime boundaries

Motivation

MiniApps can invoke Agent Runtime, but large structured inputs do not belong inline in the prompt. Previously an Agent-backed MiniApp could receive only a truncated summary and had no scoped tool path for inspecting the full payload. This adds a reusable, opt-in framework capability; it is not specific to one MiniApp or one data format.

Verification

  • pnpm --dir src/web-ui exec vitest run ... (6 focused files, 100 tests)
  • pnpm --dir src/web-ui run type-check
  • cargo test -p bitfun-core --no-default-features --features agent-runtime,tools-miniapp,git --lib miniapp::agent_context::tests
  • cargo test -p bitfun-core --no-default-features --features agent-runtime,tools-miniapp,git --lib miniapp_context_runtime::tests
  • cargo test -p bitfun-core --no-default-features --features agent-runtime,tools-miniapp,git --lib runtime_read_roots
  • cargo test -p bitfun-agent-tools --no-default-features
  • cargo test -p bitfun-desktop --lib peer_ping_advertises_mutation_capabilities
  • pnpm run check:core-boundaries

Remote scenarios

  • Remote workspace: virtual path resolution is tested independently of remote POSIX workspace storage.
  • Peer Device Mode: capability-present, capability-absent, malformed-payload, and context-free legacy paths are covered.
  • Remote control and Detached Dispatch entry points are unchanged and were not live-exercised for this change.

Scope note

This PR provides the reusable framework. The external Stock Market Lens MiniApp package still needs to pass its full market payload through contextFiles and receive a separate end-to-end Agent smoke test before that app-specific issue is considered fully resolved.

@nonoqing
nonoqing merged commit b7ff541 into GCWing:1.0.0-explore Aug 28, 2026
11 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