@jx-grxf/patchpilot 1.0.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +51 -16
- package/dist/cli.js +46 -3
- package/dist/cli.js.map +1 -1
- package/dist/core/agent.d.ts +44 -1
- package/dist/core/agent.js +617 -70
- package/dist/core/agent.js.map +1 -1
- package/dist/core/clipboard.d.ts +14 -0
- package/dist/core/clipboard.js +134 -0
- package/dist/core/clipboard.js.map +1 -0
- package/dist/core/codex.d.ts +8 -0
- package/dist/core/codex.js +28 -2
- package/dist/core/codex.js.map +1 -1
- package/dist/core/compaction.d.ts +23 -0
- package/dist/core/compaction.js +145 -0
- package/dist/core/compaction.js.map +1 -0
- package/dist/core/contextFormat.d.ts +21 -0
- package/dist/core/contextFormat.js +87 -0
- package/dist/core/contextFormat.js.map +1 -0
- package/dist/core/contextItem.d.ts +41 -0
- package/dist/core/contextItem.js +93 -0
- package/dist/core/contextItem.js.map +1 -0
- package/dist/core/contextStore.d.ts +48 -0
- package/dist/core/contextStore.js +306 -0
- package/dist/core/contextStore.js.map +1 -0
- package/dist/core/doctor.js +9 -8
- package/dist/core/doctor.js.map +1 -1
- package/dist/core/gemini.js +10 -4
- package/dist/core/gemini.js.map +1 -1
- package/dist/core/geminiWrapper.d.ts +43 -2
- package/dist/core/geminiWrapper.js +582 -42
- package/dist/core/geminiWrapper.js.map +1 -1
- package/dist/core/http.js +70 -6
- package/dist/core/http.js.map +1 -1
- package/dist/core/json.d.ts +1 -1
- package/dist/core/json.js +18 -20
- package/dist/core/json.js.map +1 -1
- package/dist/core/nvidia.d.ts +1 -1
- package/dist/core/nvidia.js +13 -4
- package/dist/core/nvidia.js.map +1 -1
- package/dist/core/ollama.js +13 -3
- package/dist/core/ollama.js.map +1 -1
- package/dist/core/openrouter.js +15 -6
- package/dist/core/openrouter.js.map +1 -1
- package/dist/core/reasoning.js +3 -0
- package/dist/core/reasoning.js.map +1 -1
- package/dist/core/session.js +9 -3
- package/dist/core/session.js.map +1 -1
- package/dist/core/tokenAccounting.d.ts +4 -0
- package/dist/core/tokenAccounting.js +75 -13
- package/dist/core/tokenAccounting.js.map +1 -1
- package/dist/core/types.d.ts +58 -3
- package/dist/core/types.js +30 -1
- package/dist/core/types.js.map +1 -1
- package/dist/core/updateCheck.d.ts +19 -0
- package/dist/core/updateCheck.js +103 -0
- package/dist/core/updateCheck.js.map +1 -0
- package/dist/core/workspace.d.ts +29 -0
- package/dist/core/workspace.js +1271 -92
- package/dist/core/workspace.js.map +1 -1
- package/dist/tui/App.d.ts +1 -0
- package/dist/tui/App.js +1346 -112
- package/dist/tui/App.js.map +1 -1
- package/dist/tui/commands.js +109 -6
- package/dist/tui/commands.js.map +1 -1
- package/dist/tui/components/ApprovalPanel.js +16 -1
- package/dist/tui/components/ApprovalPanel.js.map +1 -1
- package/dist/tui/components/CommandSuggestions.js +26 -3
- package/dist/tui/components/CommandSuggestions.js.map +1 -1
- package/dist/tui/components/Composer.d.ts +3 -0
- package/dist/tui/components/Composer.js +57 -5
- package/dist/tui/components/Composer.js.map +1 -1
- package/dist/tui/components/ExperimentalPanel.d.ts +1 -1
- package/dist/tui/components/ExperimentalPanel.js +5 -0
- package/dist/tui/components/ExperimentalPanel.js.map +1 -1
- package/dist/tui/components/OnboardingPanel.d.ts +12 -0
- package/dist/tui/components/OnboardingPanel.js +69 -21
- package/dist/tui/components/OnboardingPanel.js.map +1 -1
- package/dist/tui/components/StartupBanner.d.ts +4 -0
- package/dist/tui/components/StartupBanner.js +9 -0
- package/dist/tui/components/StartupBanner.js.map +1 -0
- package/dist/tui/components/Transcript.d.ts +7 -0
- package/dist/tui/components/Transcript.js +86 -16
- package/dist/tui/components/Transcript.js.map +1 -1
- package/dist/tui/contextCommands.d.ts +8 -0
- package/dist/tui/contextCommands.js +205 -0
- package/dist/tui/contextCommands.js.map +1 -0
- package/dist/tui/experimental/AnimatedText.d.ts +38 -0
- package/dist/tui/experimental/AnimatedText.js +55 -0
- package/dist/tui/experimental/AnimatedText.js.map +1 -0
- package/dist/tui/experimental/Banner.d.ts +10 -0
- package/dist/tui/experimental/Banner.js +33 -0
- package/dist/tui/experimental/Banner.js.map +1 -0
- package/dist/tui/experimental/CommandPalette.d.ts +11 -0
- package/dist/tui/experimental/CommandPalette.js +25 -0
- package/dist/tui/experimental/CommandPalette.js.map +1 -0
- package/dist/tui/experimental/ExperimentalShell.d.ts +58 -0
- package/dist/tui/experimental/ExperimentalShell.js +366 -0
- package/dist/tui/experimental/ExperimentalShell.js.map +1 -0
- package/dist/tui/experimental/ThemePicker.d.ts +13 -0
- package/dist/tui/experimental/ThemePicker.js +12 -0
- package/dist/tui/experimental/ThemePicker.js.map +1 -0
- package/dist/tui/experimental/attachments.d.ts +35 -0
- package/dist/tui/experimental/attachments.js +244 -0
- package/dist/tui/experimental/attachments.js.map +1 -0
- package/dist/tui/experimental/composer.d.ts +24 -0
- package/dist/tui/experimental/composer.js +84 -0
- package/dist/tui/experimental/composer.js.map +1 -0
- package/dist/tui/experimental/geminiPricing.d.ts +16 -0
- package/dist/tui/experimental/geminiPricing.js +39 -0
- package/dist/tui/experimental/geminiPricing.js.map +1 -0
- package/dist/tui/experimental/layout.d.ts +46 -0
- package/dist/tui/experimental/layout.js +112 -0
- package/dist/tui/experimental/layout.js.map +1 -0
- package/dist/tui/experimental/theme.d.ts +35 -0
- package/dist/tui/experimental/theme.js +86 -0
- package/dist/tui/experimental/theme.js.map +1 -0
- package/dist/tui/experimental/transcriptRows.d.ts +20 -0
- package/dist/tui/experimental/transcriptRows.js +169 -0
- package/dist/tui/experimental/transcriptRows.js.map +1 -0
- package/dist/tui/experimental/ultraModes.d.ts +46 -0
- package/dist/tui/experimental/ultraModes.js +95 -0
- package/dist/tui/experimental/ultraModes.js.map +1 -0
- package/dist/tui/experimental/ultramaxx.d.ts +19 -0
- package/dist/tui/experimental/ultramaxx.js +43 -0
- package/dist/tui/experimental/ultramaxx.js.map +1 -0
- package/dist/tui/format.d.ts +4 -2
- package/dist/tui/format.js +14 -0
- package/dist/tui/format.js.map +1 -1
- package/dist/tui/hosts.js +7 -1
- package/dist/tui/hosts.js.map +1 -1
- package/dist/tui/layout.d.ts +26 -0
- package/dist/tui/layout.js +66 -0
- package/dist/tui/layout.js.map +1 -0
- package/dist/tui/modelSelection.d.ts +1 -1
- package/dist/tui/modelSelection.js +8 -6
- package/dist/tui/modelSelection.js.map +1 -1
- package/dist/tui/modes.d.ts +7 -0
- package/dist/tui/modes.js +12 -0
- package/dist/tui/modes.js.map +1 -1
- package/dist/tui/onboardingPreferences.d.ts +37 -0
- package/dist/tui/onboardingPreferences.js +118 -0
- package/dist/tui/onboardingPreferences.js.map +1 -0
- package/dist/tui/runStatus.d.ts +50 -0
- package/dist/tui/runStatus.js +164 -0
- package/dist/tui/runStatus.js.map +1 -0
- package/dist/tui/types.d.ts +8 -0
- package/dist/tui/types.js.map +1 -1
- package/docs/architecture.md +115 -0
- package/docs/gemini-wrapper.md +23 -0
- package/docs/product-context.md +43 -0
- package/docs/releases/v1.0.1.md +25 -0
- package/docs/releases/v1.1.0.md +30 -0
- package/docs/releases/v1.2.0.md +28 -0
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
[](https://github.com/jx-grxf/PatchPilot/actions/workflows/ci.yml)
|
|
10
10
|
[](https://www.npmjs.com/package/@jx-grxf/patchpilot)
|
|
11
11
|
[](https://www.npmjs.com/package/@jx-grxf/patchpilot)
|
|
12
|
-

|
|
13
|
+

|
|
14
14
|

|
|
15
15
|

|
|
16
16
|

|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
PatchPilot is a terminal interface for running coding-agent tasks inside a repository. It shows what the agent is doing, keeps risky actions behind explicit permissions, and supports local Ollama, remote Ollama, Google Gemini, experimental Gemini Web wrapper routing, OpenRouter, NVIDIA NIM-compatible endpoints, and Codex CLI OAuth.
|
|
40
40
|
|
|
41
41
|
> [!IMPORTANT]
|
|
42
|
-
> PatchPilot v1.
|
|
42
|
+
> PatchPilot v1.2.0 is the large agent-hardening release: default fullscreen shell, context compaction, composable ultra modes, safer shell approvals, first-run risk acceptance, Windows fixes, and refreshed npm dependencies.
|
|
43
43
|
|
|
44
44
|
---
|
|
45
45
|
|
|
@@ -66,17 +66,36 @@ PatchPilot is a terminal interface for running coding-agent tasks inside a repos
|
|
|
66
66
|
| Feature | What it means |
|
|
67
67
|
|---|---|
|
|
68
68
|
| Local-first by default | Uses Ollama on your own machine unless you choose another route. |
|
|
69
|
+
| Fullscreen shell | A Claude-Code / Codex-CLI-style TUI: compact header, scrolling transcript, command palette, animated run status, artifacts, and a bottom-pinned composer. `/theme` switches between the new shell and the legacy layout. |
|
|
69
70
|
| Remote GPU workflow | Connect your laptop TUI to an Ollama host on a desktop, LAN, or Tailscale machine. |
|
|
70
71
|
| Cloud provider routes | Gemini, Gemini-Wrapper, OpenRouter, NVIDIA, and Codex CLI OAuth are available from one TUI. |
|
|
71
|
-
| Guided onboarding | First-run setup walks through local/remote mode, provider auth, host discovery, and
|
|
72
|
+
| Guided onboarding | First-run setup walks through local/remote mode, provider auth, host discovery, model choice, defaults, and risk acceptance. |
|
|
72
73
|
| Observable agent loop | Transcript, tool calls, telemetry, token counts, provider cache hits, latency, and cost estimates are visible. |
|
|
73
|
-
|
|
|
74
|
+
| Document attachments | Paste a path to an image, PDF, or DOCX and it becomes an attachment chip; an artifacts bar lists what you attached and what PatchPilot created. |
|
|
75
|
+
| Composable ultra modes | Type `ultramaxx`, `ultrafast`, `ultracheap`, `ultrafocus:<path>`, or `ultraloop` in a prompt to tune effort, speed, scope, and self-review. |
|
|
76
|
+
| Context compaction | `/context` and `/compact` keep long sessions usable by storing and summarizing workspace context. |
|
|
77
|
+
| Saved-cost counter | The gemini-wrapper route is free; the header shows what the same tokens would have cost on the paid Gemini API. |
|
|
78
|
+
| Explicit permissions | Risky tools show a sticky approval box unless trusted bypass is explicitly accepted; high-risk shell syntax still asks in bypass. |
|
|
74
79
|
| Workspace boundary | File tools are constrained to the selected project root and block common secret files. |
|
|
75
80
|
| Slash-command palette | Type `/` for browsable commands, provider switching, modes, models, diagnostics, and host selection. |
|
|
76
81
|
| Advisor subagents | Explorer, planner, and reviewer advisor calls can brief the main agent before it edits. |
|
|
82
|
+
| Windows-ready paths | Clipboard paste, attachments, Codex CLI resolution, and Gemini-Wrapper bootstrap paths handle Windows launchers and separators. |
|
|
77
83
|
| Ollama eject | `/eject` unloads the active Ollama model; `/eject all` clears models PatchPilot used in the session. |
|
|
78
84
|
| CI-ready TypeScript | Strict TypeScript, Vitest, GitHub Actions, and package verification are included. |
|
|
79
85
|
|
|
86
|
+
## Interface
|
|
87
|
+
|
|
88
|
+
PatchPilot ships two interfaces. The **experimental shell** is the default: a
|
|
89
|
+
fullscreen layout with a compact header, a real scrolling transcript, a
|
|
90
|
+
bottom-pinned multiline composer, a categorized command palette, and animated
|
|
91
|
+
run status. The **legacy** layout keeps the original sidebar split-pane TUI.
|
|
92
|
+
Switch any time with `/theme` (or `/theme new` / `/theme legacy`) — the choice
|
|
93
|
+
is remembered.
|
|
94
|
+
|
|
95
|
+
Useful keys: `tab` cycles plan → build → build+bypass, `/` opens the command
|
|
96
|
+
palette, `←/→` move the cursor inside the composer, `shift+enter` inserts a
|
|
97
|
+
newline, and `esc` stops a running task.
|
|
98
|
+
|
|
80
99
|
## Why This Exists
|
|
81
100
|
|
|
82
101
|
Most local coding-agent experiments fall into one of two traps: they are either raw scripts that feel painful to use, or polished tools that hide too much of what is happening. PatchPilot aims for the middle: a practical TUI where every file read, search, proposed write, command, model route, and token/cost signal stays visible.
|
|
@@ -123,8 +142,12 @@ For source development, clone it, install dependencies, build it, and link the l
|
|
|
123
142
|
```bash
|
|
124
143
|
git clone https://github.com/jx-grxf/PatchPilot.git
|
|
125
144
|
cd PatchPilot
|
|
126
|
-
npm
|
|
145
|
+
npm ci
|
|
146
|
+
npm run typecheck
|
|
147
|
+
npm test
|
|
127
148
|
npm run build
|
|
149
|
+
node dist/cli.js --version
|
|
150
|
+
npm pack --dry-run
|
|
128
151
|
npm link
|
|
129
152
|
```
|
|
130
153
|
|
|
@@ -159,7 +182,7 @@ patchpilot "add tests for the parser" --apply --allow-shell
|
|
|
159
182
|
|
|
160
183
|
API keys are stored by onboarding in `~/.patchpilot/.env`.
|
|
161
184
|
|
|
162
|
-
On first launch, PatchPilot opens guided setup for provider choice, API-key storage, host discovery, and model selection. Press Escape to leave setup, or run `/onboarding` later to reopen it.
|
|
185
|
+
On first launch, PatchPilot opens guided setup for provider choice, API-key storage, host discovery, and model selection. Setup includes a discreet use-at-your-own-risk acceptance step. Press Escape to leave setup, or run `/onboarding` later to reopen it.
|
|
163
186
|
|
|
164
187
|
## Usage
|
|
165
188
|
|
|
@@ -190,7 +213,7 @@ Useful slash commands inside the TUI:
|
|
|
190
213
|
|---|---|
|
|
191
214
|
| `/help` | Show available commands. |
|
|
192
215
|
| `/help <command>` | Explain one command, for example `/help think` or `/help model`. |
|
|
193
|
-
| `/onboarding` | Open guided provider
|
|
216
|
+
| `/onboarding` | Open guided local/remote provider, auth, and model setup. |
|
|
194
217
|
| `/mode plan` | Read-only planning mode. |
|
|
195
218
|
| `/mode build` | Implementation mode; writes, scripts, tests, and shell require per-tool approval. |
|
|
196
219
|
| `/think fixed\|adaptive` | Switch between fixed and adaptive step budgets. |
|
|
@@ -208,7 +231,7 @@ Useful slash commands inside the TUI:
|
|
|
208
231
|
| `/doctor` | Run provider diagnostics from inside the TUI. |
|
|
209
232
|
| `/doctor fix` | Apply safe doctor repairs, such as installing the managed Gemini-API bridge. |
|
|
210
233
|
| `/cleanup cache\|sessions\|temp\|all` | Clean PatchPilot workspace state. |
|
|
211
|
-
| `/experimental` | Open the experimental checkbox menu; use Space to toggle file-analysis, memory, and
|
|
234
|
+
| `/experimental` | Open the experimental checkbox menu; use Space to toggle file-analysis, memory, subagents, and shell-metacharacters. |
|
|
212
235
|
| `/init` | Ask the selected model to inspect the repository and create or update `PATCHPILOT.md`. |
|
|
213
236
|
| `/new` | Start a fresh session and clear current context. |
|
|
214
237
|
| `/sessions` | List recent sessions for the current workspace. |
|
|
@@ -221,7 +244,9 @@ Useful slash commands inside the TUI:
|
|
|
221
244
|
|
|
222
245
|
The transcript and sidebar have internal scroll areas. With an empty prompt, use left/right to choose the sidebar or transcript, then Page Up/Page Down and Home/End to navigate long sessions.
|
|
223
246
|
|
|
224
|
-
|
|
247
|
+
The TUI also keeps a live todo panel in the lower transcript area. Providers can update it through the provider-neutral `update_todo` tool, so longer runs show the current task, pending work, and completed checkpoints without hiding the chat transcript.
|
|
248
|
+
|
|
249
|
+
Experimental file analysis allows `inspect_document` to read supported files outside the workspace after per-path approval when the user provides an absolute path. With Gemini-Wrapper's managed Python bridge, PatchPilot sends PNG/JPEG/WebP/GIF/HEIC images to Gemini Web as file inputs for visual analysis and text extraction. PDFs and DOCX files use local text extraction first, then fall back to Gemini-Wrapper only when local extraction cannot produce useful text. Image OCR remains explicit through `mode:"ocr"`/`mode:"local"`. Experimental memory stores durable workspace notes in `~/.patchpilot/memory.sqlite`; `memory_remember` requires write approval and `memory_search` is read-only. Experimental shell-metacharacters allow `run_shell` to use pipes, `&&`, and `;`; redirects, shell expansion, background jobs, OR chains, and multiline commands still require explicit approval even in build+bypass.
|
|
225
250
|
|
|
226
251
|
## Providers
|
|
227
252
|
|
|
@@ -230,7 +255,7 @@ Experimental file analysis allows `inspect_document` to read supported files out
|
|
|
230
255
|
| Ollama local | `ollama` | `qwen2.5-coder:7b` | Private local coding work and offline experiments. | Install Ollama, pull a model, run `patchpilot`. |
|
|
231
256
|
| Ollama remote | `ollama` with `--ollama-url` or `/connect` | Host model inventory | Laptop editing with a stronger desktop/server GPU. | Expose Ollama on the host, then use `/connect` or `--ollama-url`. |
|
|
232
257
|
| Google Gemini | `gemini`, `google` | `gemini-2.5-flash` | Fast cloud inference through a Gemini API key. | Store `GEMINI_API_KEY` in `~/.patchpilot/.env` or use onboarding. |
|
|
233
|
-
| Gemini-Wrapper | `gemini-wrapper`, `geminiwrapper` | `auto` |
|
|
258
|
+
| Gemini-Wrapper | `gemini-wrapper`, `geminiwrapper` | `auto` | Advanced, unofficial opt-in bridge to the pinned `gemini_webapi` Python wrapper, with optional HTTP-wrapper mode. | Read [docs/gemini-wrapper.md](docs/gemini-wrapper.md), use onboarding to paste `__Secure-1PSID`, then run `/doctor fix` to approve the pinned managed bridge install. PatchPilot creates `~/.patchpilot/gemini-cookies.json`, exposes `auto`, `flash-lite`, `flash`, and `pro` shortcuts, asks the WebAPI for real available model descriptors, and never scans browser cookies. |
|
|
234
259
|
| OpenRouter | `openrouter`, `open-router` | `openrouter/auto` | Broad model routing, auto model selection, and free variants. | Store `OPENROUTER_API_KEY` in `~/.patchpilot/.env` or use onboarding. |
|
|
235
260
|
| NVIDIA | `nvidia`, `nim` | `meta/llama-3.1-70b-instruct` | NVIDIA NIM OpenAI-compatible endpoints. | Store `NVIDIA_API_KEY` in `~/.patchpilot/.env` or use onboarding. |
|
|
236
261
|
| Codex CLI | `codex`, `openai`, `openai-codex` | `gpt-5.5` | Using an existing Codex CLI OAuth login. | Run `codex login`, then `patchpilot --provider codex`. |
|
|
@@ -241,6 +266,9 @@ Examples:
|
|
|
241
266
|
patchpilot --provider ollama --model qwen2.5-coder:7b
|
|
242
267
|
patchpilot --provider gemini --model gemini-2.5-flash
|
|
243
268
|
patchpilot --provider gemini-wrapper --model auto
|
|
269
|
+
patchpilot --provider gemini-wrapper --model flash-lite
|
|
270
|
+
patchpilot --provider gemini-wrapper --model flash
|
|
271
|
+
patchpilot --provider gemini-wrapper --model pro
|
|
244
272
|
patchpilot --provider openrouter --model openrouter/auto
|
|
245
273
|
patchpilot --provider nvidia --model meta/llama-3.1-70b-instruct
|
|
246
274
|
patchpilot --provider codex --model gpt-5.5
|
|
@@ -264,7 +292,7 @@ PatchPilot caches model discovery for a short TTL inside the running TUI, so nor
|
|
|
264
292
|
|
|
265
293
|
PatchPilot reads provider cache telemetry when the provider reports it, for example Codex cached input tokens or OpenRouter `prompt_tokens_details.cached_tokens`, then displays cache hit rate as `cached / input`.
|
|
266
294
|
|
|
267
|
-
Reasoning support is provider and model dependent. Codex accepts fixed reasoning levels. OpenRouter receives `reasoning.effort` only for models whose metadata advertises reasoning support. Gemini uses Thinking configuration where the selected model exposes it; some Gemini models cannot disable thinking. Gemini-Wrapper
|
|
295
|
+
Reasoning support is provider and model dependent. Codex accepts fixed reasoning levels. OpenRouter receives `reasoning.effort` only for models whose metadata advertises reasoning support. Gemini uses Thinking configuration where the selected model exposes it; some Gemini models cannot disable thinking. Gemini-Wrapper exposes Gemini Web model shortcuts through live `gemini_webapi` discovery: `flash-lite`, `flash`, and `pro` resolve to the currently listed Web model IDs, while `thinking` remains a legacy compatibility alias only. The wrapper does not expose Gemini Web Denkaufwand as a stable `/reasoning` control yet. Ollama only receives native `think` values for known thinking model families. NVIDIA reasoning effort is limited to supported GPT-OSS NIM routes.
|
|
268
296
|
|
|
269
297
|
Gemini-Wrapper is intentionally explicit and unofficial. In default `python` bridge mode, PatchPilot creates a managed Python venv and installs the pinned wrapper there only after `/doctor fix` or `patchpilot doctor --fix` approval:
|
|
270
298
|
|
|
@@ -286,7 +314,7 @@ PATCHPILOT_GEMINI_WRAPPER_MIN_INTERVAL_MS=1500
|
|
|
286
314
|
PATCHPILOT_GEMINI_WRAPPER_TIMEOUT_MS=180000
|
|
287
315
|
```
|
|
288
316
|
|
|
289
|
-
The cookie JSON must contain `__Secure-1PSID`; `__Secure-1PSIDTS` is optional for some accounts. If the optional timestamp expires, PatchPilot retries once without it. Transient WebAPI network timeouts are retried inside the bridge. `auto` lets Gemini Web pick its default model and avoids relying on brittle Web model headers. Env alternatives are `GEMINI_SECURE_1PSID` and `GEMINI_SECURE_1PSIDTS`. See [docs/gemini-wrapper.md](docs/gemini-wrapper.md) for the exact setup steps.
|
|
317
|
+
The cookie JSON must contain `__Secure-1PSID`; `__Secure-1PSIDTS` is optional for some accounts. If the optional timestamp expires, PatchPilot retries once without it. Transient WebAPI network timeouts are retried inside the bridge. `auto` lets Gemini Web pick its default model and avoids relying on brittle Web model headers. `flash-lite`, `flash`, and `pro` are PatchPilot shortcuts resolved from live Gemini Web model descriptors; `thinking` is kept only for legacy sessions. In Python bridge mode, `inspect_document` passes supported files through `gemini_webapi` so Gemini Web can analyze screenshots, images, PDFs, and DOCX files directly. Env alternatives are `GEMINI_SECURE_1PSID` and `GEMINI_SECURE_1PSIDTS`. See [docs/gemini-wrapper.md](docs/gemini-wrapper.md) for the exact setup steps.
|
|
290
318
|
|
|
291
319
|
PatchPilot also sets `GEMINI_COOKIE_PATH` to `~/.patchpilot/gemini-webapi-cache` for the Python process so refreshed wrapper cookies stay in a local owner-only cache instead of a temporary directory.
|
|
292
320
|
|
|
@@ -298,6 +326,8 @@ OpenRouter `:free` models are rate-limited by OpenRouter. PatchPilot warns when
|
|
|
298
326
|
|
|
299
327
|
PatchPilot can run the TUI and workspace tools on one machine while sending model requests to Ollama on another machine. This is useful when your desktop has the GPU and your laptop is where you edit code.
|
|
300
328
|
|
|
329
|
+
The guided setup can choose between `This Device` and `Remote Host`. Remote host setup checks LAN and Tailscale candidates first, then fetches the selected host's models before prompting for a model.
|
|
330
|
+
|
|
301
331
|
Inside PatchPilot:
|
|
302
332
|
|
|
303
333
|
```text
|
|
@@ -307,6 +337,8 @@ Inside PatchPilot:
|
|
|
307
337
|
/connect local
|
|
308
338
|
```
|
|
309
339
|
|
|
340
|
+
If both machines are on the same Tailscale tailnet, PatchPilot also checks Tailscale peers and MagicDNS names during `/connect` and the startup host flow. A host can be selected by Tailscale IP, MagicDNS name, or full URL.
|
|
341
|
+
|
|
310
342
|
From the shell:
|
|
311
343
|
|
|
312
344
|
```bash
|
|
@@ -320,7 +352,7 @@ On a Windows desktop or remote host, expose Ollama on your private network:
|
|
|
320
352
|
3. Start Ollama again.
|
|
321
353
|
4. Allow inbound TCP traffic on port `11434` only on trusted private networks.
|
|
322
354
|
|
|
323
|
-
PatchPilot verifies candidates with Ollama's `/api/version` endpoint before listing them. It does not move file reads, writes, Git, or test commands to the remote host; only model requests are routed there.
|
|
355
|
+
PatchPilot verifies candidates with Ollama's `/api/version` endpoint before listing them. When connected, the header/sidebar switch to the selected host's device name, route, version, and model inventory instead of showing the client machine as the compute target. It does not move file reads, writes, Git, or test commands to the remote host; only model requests are routed there.
|
|
324
356
|
|
|
325
357
|
For smaller local machines, reduce the request budget before starting PatchPilot:
|
|
326
358
|
|
|
@@ -336,7 +368,7 @@ PatchPilot is designed to keep powerful actions boring and reviewable:
|
|
|
336
368
|
- Secret-like files such as `.env`, `.envrc`, `.npmrc`, `.netrc`, SSH keys, PEM/key/cert bundles, and credential files are blocked from normal file tools.
|
|
337
369
|
- Writes are blocked by default; in the TUI, risky write tools request approval, and `--apply` keeps the legacy always-allow write path.
|
|
338
370
|
- Shell commands are blocked by default; dedicated script/test tools request approval and show the package script body before running. `--allow-shell` keeps the legacy always-allow shell path.
|
|
339
|
-
- Shell execution uses a restricted
|
|
371
|
+
- Shell execution uses a restricted runner. Pipes are supported; `&&` and `;` require `/experimental shell-metacharacters`, and higher-risk shell syntax remains approval-gated even in build+bypass.
|
|
340
372
|
- Provider config is stored in `~/.patchpilot/.env`, not in the current repository by default.
|
|
341
373
|
- Session logs are stored as append-only JSONL in `.patchpilot/sessions/`; that folder is gitignored. A global index in `~/.patchpilot/session-index.json` powers `patchpilot sessions` and `/resume`.
|
|
342
374
|
- Tool output is shown in the transcript and fed back into the agent in clipped form.
|
|
@@ -409,6 +441,9 @@ Release notes are kept in [docs/releases](docs/releases).
|
|
|
409
441
|
|
|
410
442
|
| Version | Notes |
|
|
411
443
|
|---|---|
|
|
444
|
+
| `v1.2.0` | [Release notes](docs/releases/v1.2.0.md) |
|
|
445
|
+
| `v1.1.0` | [Release notes](docs/releases/v1.1.0.md) |
|
|
446
|
+
| `v1.0.1` | [Release notes](docs/releases/v1.0.1.md) |
|
|
412
447
|
| `v1.0.0` | [Release notes](docs/releases/v1.0.0.md) |
|
|
413
448
|
| `v0.4.0` | [Release notes](docs/releases/v0.4.0.md) |
|
|
414
449
|
| `v0.3.1-beta` | [Release notes](docs/releases/v0.3.1-beta.md) |
|
|
@@ -419,7 +454,7 @@ Release notes are kept in [docs/releases](docs/releases).
|
|
|
419
454
|
|
|
420
455
|
## Security and Legal
|
|
421
456
|
|
|
422
|
-
PatchPilot can read files, write files, and run shell commands when you enable those capabilities. Use it only in repositories and environments you trust.
|
|
457
|
+
PatchPilot can read files, write files, and run shell commands when you enable those capabilities. Use it only in repositories and environments you trust. You use PatchPilot at your own risk; the maintainer accepts no liability for actions you approve, bypass, or run from generated output.
|
|
423
458
|
|
|
424
459
|
- Security policy: see [SECURITY.md](SECURITY.md).
|
|
425
460
|
- Security reports: please use GitHub Security Advisories or contact the maintainer privately with reproduction steps and impact.
|
package/dist/cli.js
CHANGED
|
@@ -6,9 +6,9 @@ import { render } from "ink";
|
|
|
6
6
|
import { Command } from "commander";
|
|
7
7
|
import { defaultCodexModel } from "./core/codex.js";
|
|
8
8
|
import { cleanupPatchPilot, readCleanupTarget } from "./core/cleanup.js";
|
|
9
|
-
import { loadPatchPilotEnv } from "./core/env.js";
|
|
9
|
+
import { loadPatchPilotEnv, savePatchPilotEnvValues } from "./core/env.js";
|
|
10
10
|
import { defaultGeminiModel } from "./core/gemini.js";
|
|
11
|
-
import { defaultGeminiWrapperModel } from "./core/geminiWrapper.js";
|
|
11
|
+
import { defaultGeminiWrapperModel, importGeminiWrapperBrowserCookies } from "./core/geminiWrapper.js";
|
|
12
12
|
import { normalizeModelProvider, readModelProvider } from "./core/modelClient.js";
|
|
13
13
|
import { defaultNvidiaModel } from "./core/nvidia.js";
|
|
14
14
|
import { runDoctor } from "./core/doctor.js";
|
|
@@ -32,6 +32,11 @@ const defaultModel = process.env.PATCHPILOT_MODEL ??
|
|
|
32
32
|
: defaultProvider === "codex"
|
|
33
33
|
? defaultCodexModel
|
|
34
34
|
: defaultOllamaModel);
|
|
35
|
+
// Onboarding persists the chosen first-run agent mode; bypass implies the
|
|
36
|
+
// always-allow write/shell defaults so the next launch starts where the user
|
|
37
|
+
// left off. plan and build keep the per-action approval flow.
|
|
38
|
+
const defaultMode = process.env.PATCHPILOT_DEFAULT_MODE?.trim().toLowerCase();
|
|
39
|
+
const defaultBypass = defaultMode === "bypass";
|
|
35
40
|
const program = new Command();
|
|
36
41
|
program.enablePositionalOptions();
|
|
37
42
|
program
|
|
@@ -81,6 +86,34 @@ program
|
|
|
81
86
|
}
|
|
82
87
|
process.exitCode = results.every((result) => result.ok) ? 0 : 1;
|
|
83
88
|
});
|
|
89
|
+
const geminiWrapperCommand = program
|
|
90
|
+
.command("gemini-wrapper")
|
|
91
|
+
.description("Manage the local Gemini-Wrapper Python bridge.");
|
|
92
|
+
geminiWrapperCommand
|
|
93
|
+
.command("import-cookies")
|
|
94
|
+
.description("Explicitly import Gemini Web cookies from a local supported browser.")
|
|
95
|
+
.action(async () => {
|
|
96
|
+
try {
|
|
97
|
+
const result = await importGeminiWrapperBrowserCookies();
|
|
98
|
+
process.env.PATCHPILOT_PROVIDER = "gemini-wrapper";
|
|
99
|
+
process.env.PATCHPILOT_MODEL = defaultGeminiWrapperModel;
|
|
100
|
+
process.env.PATCHPILOT_GEMINI_WRAPPER_MODE = "python";
|
|
101
|
+
process.env.PATCHPILOT_GEMINI_WRAPPER_COOKIES_JSON = result.cookiesPath;
|
|
102
|
+
savePatchPilotEnvValues({
|
|
103
|
+
PATCHPILOT_PROVIDER: "gemini-wrapper",
|
|
104
|
+
PATCHPILOT_MODEL: defaultGeminiWrapperModel,
|
|
105
|
+
PATCHPILOT_GEMINI_WRAPPER_MODE: "python",
|
|
106
|
+
PATCHPILOT_GEMINI_WRAPPER_COOKIES_JSON: result.cookiesPath
|
|
107
|
+
});
|
|
108
|
+
console.log(`imported ${result.cookieCount} Gemini browser cookies from ${result.source}`);
|
|
109
|
+
console.log(`saved ${result.cookiesPath}`);
|
|
110
|
+
console.log(`__Secure-1PSIDTS ${result.hasSecure1psidts ? "present" : "missing; bridge will try refresh fallback"}`);
|
|
111
|
+
}
|
|
112
|
+
catch (error) {
|
|
113
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
114
|
+
process.exitCode = 1;
|
|
115
|
+
}
|
|
116
|
+
});
|
|
84
117
|
program
|
|
85
118
|
.command("sessions")
|
|
86
119
|
.description("List recent PatchPilot sessions.")
|
|
@@ -128,10 +161,20 @@ program
|
|
|
128
161
|
.option("--allow-shell", "Allow shell commands inside the workspace.", false)
|
|
129
162
|
.option("--subagents", "Enable planner and reviewer subagents.", readBooleanEnv(process.env.PATCHPILOT_SUBAGENTS, false))
|
|
130
163
|
.option("--no-subagents", "Disable planner and reviewer subagents for faster local runs.")
|
|
164
|
+
.addHelpText("after", [
|
|
165
|
+
"",
|
|
166
|
+
"Examples:",
|
|
167
|
+
" $ patchpilot",
|
|
168
|
+
" $ patchpilot \"summarize this repo and list the safest next fixes\"",
|
|
169
|
+
" $ patchpilot --provider codex --model gpt-5.5 --workspace .",
|
|
170
|
+
" $ patchpilot --provider gemini-wrapper --model auto",
|
|
171
|
+
"",
|
|
172
|
+
"First-run setup opens automatically. Reopen it anytime with /onboarding."
|
|
173
|
+
].join("\n"))
|
|
131
174
|
.action((taskParts, options) => {
|
|
132
175
|
const workspace = path.resolve(String(options.workspace));
|
|
133
176
|
const maxSteps = Number.parseInt(String(options.steps), 10);
|
|
134
|
-
render(_jsx(App, { initialTask: taskParts.join(" ").trim() || undefined, provider: readModelProvider({ PATCHPILOT_PROVIDER: String(options.provider) }), model: String(options.model), ollamaUrl: String(options.ollamaUrl), workspace: workspace, allowWrite: Boolean(options.apply), allowShell: Boolean(options.allowShell), maxSteps: Number.isFinite(maxSteps) ? maxSteps : 8, thinkingMode: String(options.thinking) === "adaptive" ? "adaptive" : "fixed", reasoningEffort: readReasoningEffort(String(options.reasoning)), subagents: Boolean(options.subagents) }));
|
|
177
|
+
render(_jsx(App, { initialTask: taskParts.join(" ").trim() || undefined, provider: readModelProvider({ PATCHPILOT_PROVIDER: String(options.provider) }), model: String(options.model), ollamaUrl: String(options.ollamaUrl), workspace: workspace, packageVersion: readPackageVersion(), allowWrite: Boolean(options.apply), allowShell: Boolean(options.allowShell), maxSteps: Number.isFinite(maxSteps) ? maxSteps : 8, thinkingMode: String(options.thinking) === "adaptive" ? "adaptive" : "fixed", reasoningEffort: readReasoningEffort(String(options.reasoning)), subagents: Boolean(options.subagents) }));
|
|
135
178
|
});
|
|
136
179
|
await program.parseAsync(process.argv);
|
|
137
180
|
function readReasoningEffort(value) {
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.tsx"],"names":[],"mappings":";;AACA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.tsx"],"names":[],"mappings":";;AACA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,EAAE,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,IAAI,KAAK,KAAK,UAAU;YACtG,CAAC,CAAC,KAAK;YACP,CAAC,CAAC,QAAQ,CAAC;AACjB,CAAC;AAED,SAAS,cAAc,CAAC,KAAyB,EAAE,QAAiB;IAClE,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAC9C,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;QACpD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;QACrD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,SAAS,kBAAkB;IACzB,IAAI,CAAC;QACH,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,GAAG,CAAC,iBAAiB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CAA0B,CAAC;QAC3H,OAAO,OAAO,WAAW,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;IACjF,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,OAAO,CAAC;IACjB,CAAC;AACH,CAAC"}
|
package/dist/core/agent.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { SessionStore } from "./session.js";
|
|
2
|
-
import type
|
|
2
|
+
import { type AgentEvent, type AgentTodoItem, type AgentWorkState, type ApprovalRequest, type ChatMessage, type ModelProvider, type PermissionDecision, type ProviderReasoningEffort, type ToolCategory } from "./types.js";
|
|
3
|
+
import { WorkspaceTools } from "./workspace.js";
|
|
3
4
|
export type AgentRunnerOptions = {
|
|
4
5
|
provider: ModelProvider;
|
|
5
6
|
model: string;
|
|
@@ -14,8 +15,11 @@ export type AgentRunnerOptions = {
|
|
|
14
15
|
subagents: boolean;
|
|
15
16
|
resumeContext?: string;
|
|
16
17
|
allowExternalFileAnalysis?: boolean;
|
|
18
|
+
allowShellMetacharacters?: boolean;
|
|
17
19
|
memoryEnabled?: boolean;
|
|
20
|
+
ultramaxx?: boolean;
|
|
18
21
|
signal?: AbortSignal;
|
|
22
|
+
shouldStopAfterStep?: () => boolean;
|
|
19
23
|
sessionStore?: SessionStore;
|
|
20
24
|
approvalHandler?: (request: ApprovalRequest) => Promise<PermissionDecision>;
|
|
21
25
|
};
|
|
@@ -25,4 +29,43 @@ export declare class AgentRunner {
|
|
|
25
29
|
private readonly options;
|
|
26
30
|
constructor(options: AgentRunnerOptions);
|
|
27
31
|
run(task: string): AsyncGenerator<AgentEvent>;
|
|
32
|
+
private chatWithRetry;
|
|
28
33
|
}
|
|
34
|
+
export declare function recoverMalformedToolResponse(rawContent: string): {
|
|
35
|
+
action: "tools";
|
|
36
|
+
message: string;
|
|
37
|
+
tool_calls: Array<{
|
|
38
|
+
name: "write_file";
|
|
39
|
+
arguments: {
|
|
40
|
+
path: string;
|
|
41
|
+
content: string;
|
|
42
|
+
};
|
|
43
|
+
}>;
|
|
44
|
+
} | null;
|
|
45
|
+
export declare function shouldExpectTodos(task: string, ultramaxx?: boolean): boolean;
|
|
46
|
+
export declare function isTodoOnlyFinalResponse(message: string): boolean;
|
|
47
|
+
export declare function shouldStopAfterEmptyToolBatches(emptyToolBatches: number): boolean;
|
|
48
|
+
export declare function findRepeatedToolCall(toolCalls: Parameters<WorkspaceTools["execute"]>[0][], recentSignatures: string[]): Parameters<WorkspaceTools["execute"]>[0] | null;
|
|
49
|
+
export declare function normalizeTodoItems(argumentsValue: Record<string, unknown>, existingItems?: AgentTodoItem[]): AgentTodoItem[];
|
|
50
|
+
type WorkspaceToolCallRecord = {
|
|
51
|
+
id: string;
|
|
52
|
+
call: Parameters<WorkspaceTools["execute"]>[0];
|
|
53
|
+
workState: AgentWorkState;
|
|
54
|
+
};
|
|
55
|
+
export declare function executeToolCallsWithReadParallelism(tools: WorkspaceTools, toolCalls: WorkspaceToolCallRecord[]): Promise<{
|
|
56
|
+
tool: "update_todo" | "list_files" | "find_files" | "read_file" | "read_range" | "file_info" | "search_text" | "inspect_document" | "memory_remember" | "memory_search" | "git_status" | "git_diff" | "git_log" | "git_show" | "list_changed_files" | "list_scripts" | "repo_overview" | "test_list" | "dependency_tree" | "write_file" | "edit_file" | "create_pdf" | "create_docx" | "apply_patch" | "run_script" | "run_tests" | "run_shell";
|
|
57
|
+
ok: boolean;
|
|
58
|
+
summary: string;
|
|
59
|
+
content: string;
|
|
60
|
+
toolCallId: string;
|
|
61
|
+
category: ToolCategory;
|
|
62
|
+
preview: string | undefined;
|
|
63
|
+
approval: {
|
|
64
|
+
request: ApprovalRequest;
|
|
65
|
+
decision: PermissionDecision;
|
|
66
|
+
} | undefined;
|
|
67
|
+
metadata: Record<string, unknown> | undefined;
|
|
68
|
+
workState: AgentWorkState;
|
|
69
|
+
}[]>;
|
|
70
|
+
export declare function compactTranscript(messages: ChatMessage[], tokenBudget?: number): void;
|
|
71
|
+
export {};
|