Skip to content

feat: agent system with LLM-driven TUI and package migration#204

Merged
Sunrisepeak merged 8 commits intomainfrom
feat/agent-eventstream-capability
Mar 10, 2026
Merged

feat: agent system with LLM-driven TUI and package migration#204
Sunrisepeak merged 8 commits intomainfrom
feat/agent-eventstream-capability

Conversation

@Sunrisepeak
Copy link
Copy Markdown
Member

Summary

  • Agent subsystem: LLM-powered interactive agent with tool bridge, session management, context manager, approval system, token tracker, and ftxui-based TUI rendering
  • Capability registry: Package management tools (xim/xvm command wrappers) exposed as LLM-callable capabilities via event stream dual-consumer architecture
  • Package migration: Replace local includes() for tinyhttps/llmapi with add_requires() from mcpplibs-index; rewrite tinyhttps.cppm as thin wrapper over mcpplibs::tinyhttps::HttpClient; remove direct mbedtls dependency (now transitive)

Key changes

  • src/agent/ — New agent modules: loop, tool_bridge, tui, session, context_manager, approval, token_tracker, commands, etc.
  • src/capabilities.cppm — Capability registry with xim/xvm wrappers
  • src/runtime/event_stream.cppm — Listener IDs with enable/disable support for dual-consumer pattern
  • src/libs/tinyhttps.cppm — Rewritten from raw mbedtls to mcpplibs::tinyhttps wrapper (~660→184 lines)
  • xmake.lua — Migrated to mcpplibs-tinyhttps 0.1.0 + llmapi 0.2.1 packages, removed mbedtls, added GCC 15 ICE workaround (-Og)
  • src/platform/ — Added console_init() for Windows UTF-8/VT support

Test plan

  • xmake build passes on Linux
  • xlings agent chat starts interactive agent TUI
  • Agent can call package management capabilities and receive structured results
  • xlings --help and existing CLI commands unaffected

🤖 Generated with Claude Code

Sunrisepeak and others added 8 commits March 11, 2026 04:36
…age migration

- Add agent subsystem: LLM loop, tool bridge, session management, context
  manager, approval system, token tracker, TUI rendering, slash commands
- Add capability registry with package management tools (xim/xvm wrappers)
- Add event stream dual-consumer architecture for agent output capture
- Add runtime modules: event_stream listener IDs, enable/disable support
- Migrate from local tinyhttps/llmapi includes to mcpplibs-index packages
- Rewrite tinyhttps.cppm as thin wrapper over mcpplibs::tinyhttps::HttpClient
- Remove direct mbedtls dependency (now transitive via mcpplibs-tinyhttps)
- Add platform console_init() for Windows UTF-8/VT support
- Add GCC 15 ICE workaround (-Og for tree-ssa-dce crash)
- Add agent libs: agentfs, flock, journal, semantic_memory, soul, mcp_server
- Add e2e smoke test for agent CLI

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… version to 0.4.2

Replace raw popen/pclose with platform abstraction for cross-platform
compatibility. Remove unused cstdio/sys/wait.h includes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…Windows

- tinyhttps: follow 3xx redirects (up to 10) in download_once and
  query_content_length — needed for GitHub release URLs that 302 redirect
- FileLock tests: scope lock objects so file handles close before
  fs::remove on Windows (can't delete open files)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…port

tinyhttps 0.2.0 fixes:
- Force TLS 1.2 max version (mbedTLS 3.6 TLS 1.3 fails in static builds)
- Built-in 3xx redirect following (needed for GitHub release CDN URLs)
- VERIFY_OPTIONAL for robust cert handling

Simplify xlings tinyhttps wrapper: remove manual redirect loops (now
handled by the library).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…padding

Layout changes for agent TUI:
- Add separator above input box (input now bounded by separators on both sides)
- Remove turn-end separator from agent output area
- Remove empty padding line below status bar (improves cursor positioning
  for Chinese IME which renders pre-edit text at terminal cursor)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fixes json::type_error.316 crash when sending Chinese/non-ASCII text
to LLM APIs. The dump() call now uses error_handler_t::replace instead
of throwing on invalid UTF-8 bytes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ursor workaround

- Adaptive layout: content expands downward naturally until reaching terminal
  bottom, then pins input/status bar and scrolls content up via yframe
- Full-width input box with leading space for cursor blink (Chinese IME workaround)
- 24fps refresh timer for smooth resize handling
- UserMsg rendered with amber separator lines in chat history
- Auto-compact evicts by logical turns (user→assistant→tool→assistant) instead
  of fixed message pairs, preventing orphaned tool_calls/results (400 Bad Request)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Sunrisepeak Sunrisepeak merged commit 6a1ccf0 into main Mar 10, 2026
3 checks passed
@Sunrisepeak Sunrisepeak deleted the feat/agent-eventstream-capability branch March 10, 2026 22:49
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