mirror of
https://github.com/alkimake/paperclip.git
synced 2026-06-16 19:00:38 +09:00
## Thinking Path > - Paperclip orchestrates AI agents for zero-human companies > - Agents can run inside sandboxed environments like E2B, or on remote hosts via SSH > - The cursor adapter needs to resolve `cursor-agent` inside sandbox environments where it's installed in `~/.local/bin` > - But when using the default `agent` command on a sandbox target, the adapter didn't know to look in `~/.local/bin/cursor-agent`, causing "command not found" failures > - Additionally, repeated SSH runs failed because `git checkout` during workspace sync conflicted with leftover `.paperclip-runtime` files from previous runs > - This PR adds sandbox-aware command resolution for cursor and fixes the SSH workspace sync conflict > - The benefit is cursor works in E2B sandboxes out of the box, and repeated SSH runs don't fail on workspace sync ## What Changed - `cursor-local`: Added `prepareCursorSandboxCommand` — on sandbox targets, reads the remote `$HOME`, prepends `~/.local/bin` to PATH, and prefers `~/.local/bin/cursor-agent` when the default command is requested; tightened the sandbox command probe to validate the binary exists before launching; preserves explicit custom command overrides - `adapter-utils/ssh.ts`: Added `--force` to git checkout in SSH workspace sync to handle `.paperclip-runtime` untracked file conflicts from previous runs ## Verification - `pnpm test` — all existing and new tests pass, including cursor sandbox probe, sandbox execution, and custom command override tests - `pnpm typecheck` — clean - Manual: configure an E2B environment, run a cursor-local task, verify it resolves cursor-agent from the sandbox install path ## Risks - Low-medium. The `--force` flag on git checkout could discard uncommitted changes in the remote workspace, but the workspace is managed by Paperclip and should not contain user edits. ## Model Used Codex GPT 5.4 high via Paperclip. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [ ] If this change affects the UI, I have included before/after screenshots - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [x] I will address all Greptile and reviewer comments before requesting merge
84 lines
3 KiB
TypeScript
84 lines
3 KiB
TypeScript
export const type = "cursor";
|
|
export const label = "Cursor CLI (local)";
|
|
export const DEFAULT_CURSOR_LOCAL_MODEL = "auto";
|
|
|
|
const CURSOR_FALLBACK_MODEL_IDS = [
|
|
"auto",
|
|
"composer-1.5",
|
|
"composer-1",
|
|
"gpt-5.3-codex-low",
|
|
"gpt-5.3-codex-low-fast",
|
|
"gpt-5.3-codex",
|
|
"gpt-5.3-codex-fast",
|
|
"gpt-5.3-codex-high",
|
|
"gpt-5.3-codex-high-fast",
|
|
"gpt-5.3-codex-xhigh",
|
|
"gpt-5.3-codex-xhigh-fast",
|
|
"gpt-5.3-codex-spark-preview",
|
|
"gpt-5.2",
|
|
"gpt-5.2-codex-low",
|
|
"gpt-5.2-codex-low-fast",
|
|
"gpt-5.2-codex",
|
|
"gpt-5.2-codex-fast",
|
|
"gpt-5.2-codex-high",
|
|
"gpt-5.2-codex-high-fast",
|
|
"gpt-5.2-codex-xhigh",
|
|
"gpt-5.2-codex-xhigh-fast",
|
|
"gpt-5.1-codex-max",
|
|
"gpt-5.1-codex-max-high",
|
|
"gpt-5.2-high",
|
|
"gpt-5.1-high",
|
|
"gpt-5.1-codex-mini",
|
|
"opus-4.6-thinking",
|
|
"opus-4.6",
|
|
"opus-4.5",
|
|
"opus-4.5-thinking",
|
|
"sonnet-4.6",
|
|
"sonnet-4.6-thinking",
|
|
"sonnet-4.5",
|
|
"sonnet-4.5-thinking",
|
|
"gemini-3.1-pro",
|
|
"gemini-3-pro",
|
|
"gemini-3-flash",
|
|
"grok",
|
|
"kimi-k2.5",
|
|
];
|
|
|
|
export const models = CURSOR_FALLBACK_MODEL_IDS.map((id) => ({ id, label: id }));
|
|
|
|
export const agentConfigurationDoc = `# cursor agent configuration
|
|
|
|
Adapter: cursor
|
|
|
|
Use when:
|
|
- You want Paperclip to run Cursor Agent CLI locally as the agent runtime
|
|
- You want Cursor chat session resume across heartbeats via --resume
|
|
- You want structured stream output in run logs via --output-format stream-json
|
|
|
|
Don't use when:
|
|
- You need webhook-style external invocation (use openclaw_gateway or http)
|
|
- You only need one-shot shell commands (use process)
|
|
- Cursor Agent CLI is not installed on the machine
|
|
|
|
Core fields:
|
|
- cwd (string, optional): default absolute working directory fallback for the agent process (created if missing when possible)
|
|
- instructionsFilePath (string, optional): absolute path to a markdown instructions file prepended to the run prompt
|
|
- promptTemplate (string, optional): run prompt template
|
|
- model (string, optional): Cursor model id (for example auto or gpt-5.3-codex)
|
|
- mode (string, optional): Cursor execution mode passed as --mode (plan|ask). Leave unset for normal autonomous runs.
|
|
- command (string, optional): defaults to "agent"
|
|
- extraArgs (string[], optional): additional CLI args
|
|
- env (object, optional): KEY=VALUE environment variables
|
|
|
|
Operational fields:
|
|
- timeoutSec (number, optional): run timeout in seconds
|
|
- graceSec (number, optional): SIGTERM grace period in seconds
|
|
|
|
Notes:
|
|
- Runs are executed with: agent -p --output-format stream-json ...
|
|
- Prompts are piped to Cursor via stdin.
|
|
- Sessions are resumed with --resume when stored session cwd matches current cwd.
|
|
- Paperclip auto-injects local skills into "~/.cursor/skills" when missing, so Cursor can discover "$paperclip" and related skills on local runs.
|
|
- Paperclip auto-adds --yolo unless one of --trust/--yolo/-f is already present in extraArgs.
|
|
- Remote sandbox runs prepend "~/.local/bin" to PATH and prefer "~/.local/bin/cursor-agent" when the default Cursor entrypoint is requested, so standard E2B-style installs do not need hardcoded absolute command paths.
|
|
`;
|