External agent execution via GitHub Codespaces, integrated into TextAgent's existing Agent Flow system. Users can click ☁️ on any Agent card to route step execution to a cloud Codespace instead of the local LLM.
| File | Change |
|---|---|
| storage-keys.js | +5 keys: GITHUB_TOKEN, GITHUB_USER, AGENT_PROVIDER, AGENT_CODESPACE_ID, AGENT_CUSTOM_URL |
| modal-templates.js | +50 lines: GitHub auth modal (reuses ai-consent-modal classes) |
| github-auth.js | NEW — Device Flow OAuth module (~215 lines) |
| agent-cloud.js | NEW — Codespaces API adapter (~270 lines) |
| ai-docgen.js | 3 edits: @cloud: parsing, ☁️ toggle button, toggle event handler |
| ai-docgen-generate.js | Cloud execution branch in generateAgentFlow() |
| main.js | Phase 3k: loads github-auth.js + agent-cloud.js |
| ai-docgen.css | +76 lines: cloud toggle active state, device code UI, spin animation |
| agent-cloud.spec.js | NEW — 20 Playwright tests |
sequenceDiagram
participant User
participant Editor as Agent Card
participant Auth as github-auth.js
participant Cloud as agent-cloud.js
participant GH as GitHub API
User->>Editor: Click ☁️ toggle
Editor->>Auth: isAuthenticated?
alt Not authenticated
Auth->>User: Show Device Flow modal
User->>GH: Enter code at github.com/login/device
GH->>Auth: Return access token
Auth->>Editor: Token stored ✅
end
User->>Editor: Click ▶ Run Agent Flow
Editor->>Cloud: run(stepCommand)
Cloud->>GH: Create/reuse Codespace
GH->>Cloud: Codespace ready
Cloud->>GH: Execute command
GH->>Cloud: stdout/stderr
Cloud->>Editor: Result → replace tag
{{@Agent:
@cloud: yes
1. Clone the OpenClaw repo and install dependencies
2. Run the agent on the provided dataset
3. Summarize the results
}}- Register GitHub OAuth App at
github.com/settings/developers→ set callback tohttp://127.0.0.1 - Replace
CLIENT_IDin github-auth.js:12 - Create template repo
textagent/agent-runnerwith devcontainer for OpenClaw/OpenFang
✅ 20 passed (11.6s)
Storage keys ✓ | GitHub auth modal ✓ | githubAuth module ✓
agentCloud module ✓ | @cloud: parsing ✓ | Cloud toggle UI ✓
Auth gate behavior ✓