Quick Start · Architecture · Features · Commands · Configuration · Contributing
Ask Qwen anything about your code — without leaving your terminal. coder-SIN-Qwen is a standalone relay proxy that collects local project context, sends it to Qwen via browser UI automation, and returns the answer. No API key needed — just Chrome and a Qwen account.
1. Clonegit clone https://github.com/OpenSIN-Browser-Use-Agents/coder-SIN-Qwen.git |
2. Installpnpm install |
3. Ask Qwennode ./index.js "Review this repo" |
Tip
No API key needed. Requires Chrome + Qwen account. Set CHROME_CDP_URL or let the sidecar handle it.
flowchart TB
subgraph CLI["CLI Layer"]
direction LR
CLI["index.js<br/>CLI Entrypoint"]
PRE["preflight.js<br/>Env & Dep Checks"]
SMOKE["smoke.js<br/>Readiness Check"]
end
subgraph Core["packages/qwen-core"]
direction LR
CTX["context.js<br/>Context Collector"]
PB["prompt-builder.js<br/>Prompt Shaping"]
VAL["validator.js<br/>Response Validator"]
BR["browser-hardening.js<br/>UI Hardening"]
LC["lifecycle.js<br/>Resource Manager"]
TR["trace.js<br/>Observability"]
CONV["conversation-tree.js<br/>Branching Store"]
end
subgraph Lib["packages/qwen-core/lib"]
direction LR
SC["secret-client.js<br/>Zero-Trust Secrets"]
SM["browser-state-machine.js<br/>9-State Machine"]
SH["self-heal.js<br/>Recovery Playbooks"]
CR["context-compressor.js<br/>Token Budget"]
EL["async-event-loop.js<br/>Task Queue"]
SL["structured-log.js<br/>Observability 2.0"]
end
subgraph Browser["Browser Automation"]
B["browser.js<br/>Playwright Session"]
CDP["CDP Sidecar<br/>Chrome Debug"]
Q["chat.qwen.ai<br/>Qwen UI"]
end
CLI --> Core
Core --> Lib
Core --> B
B --> CDP
CDP --> Q
classDef cliClass fill:#e1f5fe,stroke:#01579b,stroke-width:2px
classDef coreClass fill:#e8f5e9,stroke:#1b5e20,stroke-width:2px
classDef libClass fill:#fff3e0,stroke:#e65100,stroke-width:2px
classDef browserClass fill:#fce4ec,stroke:#880e4f,stroke-width:2px
class CLI,PRE,SMOKE cliClass
class CTX,PB,VAL,BR,LC,TR,CONV coreClass
class SC,SM,SH,CR,EL,SL libClass
class B,CDP,Q browserClass
Full architecture details in docs/architecture.md
| Capability | Description | Status |
|---|---|---|
| Qwen Relay | Send code context to Qwen via browser UI automation | ✅ |
| Zero API Keys | No API key needed — uses real Qwen web UI | ✅ |
| Conversation Tree | Persistent branching, --branch/--tree/--checkout |
✅ |
| Account Rotation | 3+ Qwen accounts with cooldown + circuit breaker | ✅ |
| Self-Healing | DOM drift detection, recovery playbooks, 6 error scenarios | ✅ |
| State Machine | 9-state browser lifecycle with event-driven sync | ✅ |
| SecretClient | Zero-trust secret management, never logs values | ✅ |
| Context Compression | Token budget manager + relevance scoring (TF-IDF) | ✅ |
| Observability 2.0 | Structured logging with step IDs, DOM snapshots | ✅ |
| Async CLI | Task queue with timeout, progress spinner | ✅ |
| Attachment Hardening | Size validation, MIME checks, upload retry | ✅ |
| Test Pyramid | 200+ tests, property-based + integration + unit | ✅ |
| TypeScript Ready | tsconfig.json with strict mode, 0 type errors |
✅ |
| ADRs | 5 architecture decision records in docs/adr/ |
✅ |
| Who | Problem | Solution |
|---|---|---|
| Developer | Need code review but no API budget | Relay context to Qwen's free UI |
| OpenCode Agent | Needs Qwen consultation mid-task | /ask-qwen command → structured reply |
| DevOps | Automate code analysis in CI | --json mode for machine-readable output |
| Researcher | Compare model outputs iteratively | Conversation tree with branching |
| Team Lead | Audit code quality at scale | Autotraining snapshots + trace correlation |
🔍 Ask Qwen (Core Relay)
# Basic prompt
node ./index.js "Review the error handling in this repo"
# Machine-readable JSON output
node ./index.js --json "List all exported functions"
# Multi-turn conversation
node ./index.js --turns 2 "Design the next feature"
# Dry-run (no browser)
node ./index.js --dry-run "What context would you send?"🌳 Conversation Tree
# Print current tree
node ./index.js --tree
# Branch from specific node
node ./index.js --branch <node-id> "Refine this branch"
# Switch active branch
node ./index.js --checkout <node-id>
node ./index.js --checkout latest
node ./index.js --checkout none
# Prepare commit (dry-run)
node ./index.js --prepare-commit --dry-run🧪 Validation & Smoke
# Full test suite
pnpm test
# Preflight checks
node ./preflight.js
# Smoke tests
pnpm run smoke
pnpm run smoke:live
# Coverage report
pnpm run coverage🔐 Secrets & Auth
# Validate secrets
pnpm run secrets:check
# Pull from Infisical
pnpm run secrets:pull
# Push to Infisical
pnpm run secrets:push
# CDP sidecar
pnpm run cdp:start
pnpm run cdp:status🔄 Release & Merge
# Merge to main (requires ALLOW_GH_MERGE=1)
pnpm run merge:main
# Release
pnpm run release:patch
pnpm run release:minor
pnpm run release:major
# Verify after changes
node ./verify.jscoder-SIN-Qwen/
├── index.js # CLI Entrypoint
├── browser.js # Playwright browser session
├── preflight.js # Env & dependency gate
├── cli-autotraining.js # Self-improvement engine
├── push-secrets.js # Infisical push helper
├── verify.js # Install/test/build gate
├── smoke.js # Readiness check
├── restore.js # Rollback helper
├── packages/
│ └── qwen-core/ # 📦 Shared library (21+ modules)
│ ├── index.js # Barrel exports
│ ├── context.js # Context collector
│ ├── prompt-builder.js # Prompt shaping
│ ├── validator.js # Response validator
│ ├── lifecycle.js # Resource cleanup
│ ├── trace.js # Observability
│ ├── conversation-tree.js # Branching store
│ ├── secret-schema.js # Secret schema
│ └── lib/ # Internal utilities
│ ├── secret-client.js # SecretClient
│ ├── selector-chain.js # DOM selector engine
│ ├── browser-state-machine.js # 9-state FSM
│ ├── self-heal.js # Recovery playbooks
│ ├── dom-hash.js # DOM drift detection
│ ├── context-compressor.js # Token budgeting
│ ├── structured-log.js # Observability 2.0
│ ├── async-event-loop.js # Task queue
│ ├── ephemeral-profile.js # Session isolation
│ └── attachment-hardening.js # File validation
├── apps/qwen-connector/ # CLI package wrapper
├── test/ # 200+ tests
├── docs/
│ ├── adr/ # 5 ADRs
│ └── architecture.md # Full design docs
├── plans/ # 14 implementation plans
├── scripts/ # Shell helpers
├── .github/workflows/ci.yml # CI pipeline
├── Dockerfile # Container support
├── docker-compose.yml # Dev environment
├── tsconfig.json # TypeScript config
├── pnpm-lock.yaml # Lockfile
└── turbo.json # Task orchestration
📋 Environment Variables
| Variable | Default | Description |
|---|---|---|
QWEN_URL |
https://chat.qwen.ai |
Qwen chat URL |
QWEN_AUTH_METHOD |
email_password |
Auth mode (locked) |
CHROME_CDP_URL |
— | CDP endpoint for attach mode |
CHROME_REMOTE_DEBUGGING_PORT |
9444 |
Sidecar CDP port |
CHROME_PROFILE |
— | Chrome profile path |
QWEN_ACCOUNT_ORDER |
— | Account rotation order |
QWEN_ACCOUNT_1_EMAIL |
— | Account 1 email |
QWEN_ACCOUNT_1_PASSWORD |
— | Account 1 password |
SIN_CODER_QWEN_DRY_RUN |
0 |
Skip browser automation |
SIN_CODER_QWEN_LOG_FILE |
— | JSONL log path |
SIN_CODER_QWEN_ARTIFACT_DIR |
artifacts/ |
Screenshot output |
SIN_CODER_QWEN_MAX_PROMPT_LENGTH |
12000 |
Max prompt chars |
SIN_CODER_QWEN_SESSION_TIMEOUT_MS |
— | Browser timeout |
INFISICAL_PROJECT_ID |
— | Infisical project ID |
GH_TOKEN |
— | GitHub token |
📁 Key Files
| File | Purpose |
|---|---|
.qwenignore |
Token-saving context filter |
.coder-sin-qwen-memory.json |
Consult memory store |
.coder-sin-qwen-conversations.json |
Conversation tree store |
secrets.required.json |
Secret validation spec |
coder-sin-qwen-tasks/ |
Task packet workspace |
The relay uses sidecar CDP attach as the only supported browser path:
# Start the CDP sidecar
export CHROME_REMOTE_DEBUGGING_PORT="9444"
pnpm run cdp:start
export CHROME_CDP_URL="http://127.0.0.1:9444"
# Run with live browser
node ./index.js --smoke-liveImportant
No direct browser launches. The sidecar attaches to your Chrome via CDP. Close other Chrome instances first to avoid profile locks.
// .opencode/opencode.json
{
"commands": {
"ask-qwen": {
"command": "node ./index.js --turns 1 --json \"$ARGUMENTS\""
}
}
}Run /ask-qwen from any OpenCode session to consult Qwen without leaving your workflow.
# Install
pnpm install
# Run tests
pnpm test
# TypeScript check
pnpm run typecheck
# Coverage
pnpm run coverage
# Build
pnpm run build
# Full verification
node ./verify.js- Fork the repo
- Create a feature branch (
git checkout -b feature/amazing) - Run tests (
pnpm test) - Commit (
git commit -m 'feat: add amazing feature') - Push (
git push origin feature/amazing) - Open a Pull Request
See CONTRIBUTING.md for detailed guidelines.
Distributed under the MIT License. See LICENSE for more information.
Entwickelt vom OpenSIN-AI Ökosystem – Enterprise AI Agents die autonom arbeiten.
🌐 opensin.ai · 💬 Alle Agenten · 🚀 Dashboard