Skip to content

feat(runtime): add TRAE CLI (traecli) provider and personal credential support - #1166

Open
neuromancerzeng wants to merge 2 commits into
Tencent:mainfrom
neuromancerzeng:feat/traecli-provider
Open

neuromancerzeng wants to merge 2 commits into
Tencent:mainfrom
neuromancerzeng:feat/traecli-provider

Conversation

@neuromancerzeng

Copy link
Copy Markdown

What changed

Add built-in TRAE CLI (traecli) support across the LoopForge platform (domain, runtime, runner discovery, HTTP API model catalog, and web/chatbot UI):

  • Domain & auth modes:
    • Register traecli in AgentCLIExecutorKinds, ExecutorEffortLevels, AgentCLIProtocolOptions (responses, chat), and SupportsRunnerLogin so users can either reuse their machine's local TRAE CLI login (~/.trae/cli/auth.json via TRAE_HOME) on a personal Runner or configure a personal API Key + Base URL in #/settings.
  • Runtime execution & MCP isolation:
    • Build traecli exec --json headless commands with mutually exclusive permission flags (--permission-mode bypass_permissions for unattended SOP/workspace runs, --sandbox read-only for read-only platform chat) and -c approval_policy="never".
    • Render .trae/traecli.toml MCP entries (including url/http_headers, command/cwd/args/env for agentflow-gate, and default_tools_approval_mode = "approve").
    • Translate traecli exec --json JSONL events into ClaudeStream via traeCLIStream, wire PreToolUse conversation approval hooks, and clean host TRAE_HOME / TRAECLI_PERSONAL_ACCESS_TOKEN env vars in isolated runs.
  • Runner, catalog & UI:
    • Detect local traecli binary in internal/runner/detect.go, expose TRAE CLI in built-in executors and model catalogs, and wire it into #/settings, #/runners, role editor, and AI chat engine picker (with bundled trae.svg logo).

Scope

  • Platform core / API / runner
  • Public adapter / deployment
  • Classic
  • Portable
  • Shared behavior contract
  • Installer / CLI
  • Documentation only

Compatibility

  • Purely additive executor kind (traecli); no database schema migration or breaking changes to existing executors (codex, claude-code, codebuddy, or other agent CLIs).
  • Personal Runners need an updated agentflow-runner binary to detect and report local traecli installations.

Validation

bash scripts/build-chatbot.sh                                         # passed (56 test files, 401 tests)
go test ./internal/domain/... ./internal/runner/... ./internal/repo/... ./web/...  # passed
go test ./internal/runtime -run "TestTraeCLI|TestCodex|TestProvider|TestConversationSupportsEveryRegisteredCLI"  # passed
go vet ./...                                                          # passed
python3 scripts/check-public.py                                       # passed
bash scripts/scan-secrets.sh                                          # 0 leaks in tracked/changed files (4 alerts only in untracked local wiki/)
bash local/scripts/validate.sh                                        # not run (local/ untouched)
bash local/scripts/smoke-install.sh                                   # not run (local/ untouched)
bash local/scripts/e2e.sh                                             # not run (local/ untouched)

Safety

  • I did not include credentials, internal endpoints, production data, or organization-specific infrastructure.
  • I preserved user files and unrelated changes.
  • I updated generated Classic host bundles when applicable.
  • I documented third-party content and licensing changes when applicable.

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.

2 participants