long
Health Uyari
- License — License: MIT
- Description — Repository has a description
- Active repo — Last push 0 days ago
- Low visibility — Only 7 GitHub stars
Code Uyari
- process.env — Environment variable access in examples/chat-server.ts
- network request — Outbound network request in examples/chat-server.ts
Permissions Gecti
- Permissions — No dangerous permissions requested
Bu listing icin henuz AI raporu yok.
Local-first AI coding agent with terminal, web and desktop clients. Built with TypeScript. Supports OpenAI-compatible models.
Long — Local-first AI Coding Agent
An open-source AI coding assistant for your terminal, browser and desktop. Built with TypeScript, powered by OpenAI-compatible models.
English · 简体中文 · Quick start · Report a bug
Long is a TypeScript coding agent that runs on your machine. Open a project in the web or desktop client, connect an OpenAI-compatible model, and follow its file edits and Bash commands as they happen. Conversations stay in local storage between runs; the model receives the conversation context and tool results it needs to respond.
Why Long?
- Three ways to work: a terminal CLI, a local web UI, and Electron desktop clients for Windows and macOS.
- Bring your own model: connect a tool-capable OpenAI Chat Completions-compatible provider.
- Visible coding tools: follow file reads, edits and Bash commands as they happen.
- Local session storage: resume conversations across projects; model requests still go to your configured provider.
- Hackable TypeScript core: separate model adapters, agent loop, runtime and coding tools.
Quick start
Install Git, Node.js 22.18 or later and npm. For command execution, install Bash (Git for Windows on Windows).
git clone https://github.com/yululiangcmr222-del/long.git
cd long
npm ci
npm run chat
Open http://127.0.0.1:3210. In Model settings (模型设置), add your provider’s API base URL, model ID, and API key or key environment variable. Select the default model, open a trusted project, and start with a read-only task such as “Where is the test runner configured?” To try the interface without sending requests to a model provider, set HARNESS_MODE=demo in .env before starting the server.
Long supports the OpenAI Chat Completions protocol. Choose a model that supports tool calls; a successful model listing does not establish tool compatibility. Native Anthropic, OpenAI Responses, and OAuth are not supported.
Terminal client
From the repository root run npm run cli for an interactive coding session. Long connects to the local server or starts one on loopback for the lifetime of the CLI. The prompt shows the workspace, default model, mode and available tools. Interactive mode uses Ink, with a solid-pixel dragon, a persistent input area, Markdown answers and compact tool summaries. Use ↑/↓ for input history, Esc to request cancellation, and Ctrl+O to toggle bounded tool-output previews (last eight events, up to 1,500 characters each). Streaming answers show the last ten source lines until completion; the completed answer is kept in terminal scrollback. /status shows the current model, workspace and permissions. Enter / and press Enter to open the command menu. Use the arrow keys to resume a project session or change the current session's model. /history shows the conversation; /new starts fresh. Scripts can use /sessions, /resume ID, /model ID and /exit without a graphical prompt. Ctrl+C requests cancellation during a turn (it does not undo earlier edits). For one-shot commands:
npm run cli -- --workspace . "Where is the test runner configured?"
npm run cli -- --session SESSION_ID "Which tests cover sessions?"
Replace SESSION_ID with the ID printed by the first command. Without --session, the first prompt starts a new session in the specified project (default: current directory). Only choose trusted projects: tools run without per-call approval. The CLI shares the server’s models, tools and history.
Working with Long
- Tools: The default profile exposes
read,write,edit, andbash. File reads are paginated. Long Bash output is shown as a bounded head/tail preview (16 KiB by default), with an on-disk log for inspection (up to 16 MiB). Truncation is reported rather than treated as complete output. - Project instructions: Long reads
AGENTS.mdfrom the workspace root, falling back toCLAUDE.mdonly ifAGENTS.mdis absent. Files are not merged. The selected file must stay inside the workspace and fit within 32 KiB. - Sessions: Switch projects or close the browser tab without cancelling a running task. Reconnect while the server is still running to see progress. Archive idle sessions to hide them without deleting their history; restore a session to continue it.
- Run control: Send additional instructions during a run or request cancellation. At the web client’s step limit, Long reserves the last turn for a report without tool calls. Reaching the limit is not a claim that the task is complete.
- Context: Long summarizes older messages when the model’s context budget is tight and keeps the original session history. Summarization uses the configured model and consumes tokens.
Configuration
Use the settings panel for model configuration or copy .env.example to .env before the first launch. Existing model settings take precedence over environment-based initialization. Restart the web server after editing .env.
| Variable | Purpose |
|---|---|
OPENAI_BASE_URL |
Chat Completions API base URL; defaults to https://api.openai.com/v1 |
OPENAI_API_KEY, DEEPSEEK_API_KEY |
Initial API credentials; OPENAI_API_KEY takes precedence |
HARNESS_MODEL, HARNESS_MODELS |
Initial default model and model list |
HARNESS_WORKSPACE, HARNESS_WORKSPACES |
Default project directory and additional directories (semicolon-separated). Without an explicit default, the web server creates <HARNESS_DATA_DIR>/workspace (normally ~/.harness-chat/workspace), not the server's working directory. Existing saved workspaces and sessions are retained. |
HARNESS_DATA_DIR |
Model settings and session storage; defaults to ~/.harness-chat |
HARNESS_MAX_STEPS |
Model turns per web run: 1–200, default 48 |
HARNESS_PROFILE, HARNESS_TOOLS |
Tool profile (coding, full, code, read, files) or an explicit comma-separated tool list |
LONG_BASH_PATH |
Path to a native Bash executable; Long does not fall back to CMD |
HARNESS_SHELL=off |
Disable Bash; does not disable separately enabled JavaScript or HTTP tools |
LONG_SANDBOX=on |
Restrict file access to the workspace and disable Bash, JavaScript execution, and HTTP tools; not a read-only mode or OS sandbox |
PORT |
Local web server port; defaults to 3210 |
Desktop and portable builds
| Target | Build from the repository root | Output |
|---|---|---|
| Windows or macOS desktop | npm ci, then npm --prefix desktop ci and npm --prefix desktop run package on the target OS |
.exe or .dmg in dist/desktop/; end users do not need Node.js |
| Both desktop installers | Push the desired revision to the GitHub default branch, then run npm run package:desktop with the GitHub CLI authenticated and Actions enabled |
Download Long-windows-latest and Long-macos-latest from the workflow run’s artifacts |
| Portable web client | npm ci, then npm run build and python scripts/package.py (or python3 on macOS) |
dist/Long.zip; requires Python 3 to build and Node.js 22.18+ to run |
The desktop workflow builds the remote revision, not uncommitted local changes. Unsigned desktop builds may trigger operating-system trust warnings. For the portable edition, extract the ZIP and run Start.cmd on Windows or sh Start.command on macOS. Keep the terminal open while using the web client.
Security and recovery
Long is intended for a single user working in trusted projects. Bash and optional JavaScript tools run with the host account’s permissions. The localhost binding and file-tool path checks are not a security boundary for untrusted users or code. Do not expose the service as a public endpoint.
Model settings can contain plaintext API keys. Prefer a named environment variable when possible. Prompts, tool output, and attached images may be sent to the selected provider. Session history and temporary command logs can contain sensitive data; do not include them in bug reports without redacting them.
Cancellation is cooperative: it cannot undo a file change or a remote request. If a tool’s outcome is unknown, inspect its effects before continuing. Active runs and their safety blocks do not survive a server restart; restarting is not a recovery procedure.
Contributing
Bug reports, model compatibility feedback and pull requests are welcome. Start with the contributing guide; include a minimal reproduction and redact credentials and private project data from reports.
License
Long is distributed under the MIT License.
Development
The Node.js runtime is split into four npm workspaces with no third-party runtime dependencies. The optional desktop client uses Electron.
| Package | Responsibility |
|---|---|
@long/ai |
Provider interface, streaming events, and model responses |
@long/agent-core |
Agent loop, tool contracts, and conversation state |
@long/agent-runtime |
Active runs, cancellation, and persistence coordination |
@long/coding-agent |
Workspace file operations and command execution |
Run npm run check before submitting changes. It builds the workspaces, checks TypeScript, and runs the test suite. For behavior changes, include a regression test and identify the affected platform or provider when relevant. See the architecture overview for the execution path.
Yorumlar (0)
Yorum birakmak icin giris yap.
Yorum birakSonuc bulunamadi