@jx-grxf/patchpilot 0.2.1 → 0.3.1-beta

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.
Files changed (69) hide show
  1. package/README.md +70 -10
  2. package/SECURITY.md +20 -0
  3. package/dist/cli.js +52 -3
  4. package/dist/cli.js.map +1 -1
  5. package/dist/core/agent.d.ts +6 -2
  6. package/dist/core/agent.js +197 -27
  7. package/dist/core/agent.js.map +1 -1
  8. package/dist/core/codex.js +1 -1
  9. package/dist/core/codex.js.map +1 -1
  10. package/dist/core/gemini.js +8 -21
  11. package/dist/core/gemini.js.map +1 -1
  12. package/dist/core/http.d.ts +6 -0
  13. package/dist/core/http.js +45 -0
  14. package/dist/core/http.js.map +1 -0
  15. package/dist/core/json.js +9 -0
  16. package/dist/core/json.js.map +1 -1
  17. package/dist/core/nvidia.js +9 -2
  18. package/dist/core/nvidia.js.map +1 -1
  19. package/dist/core/ollama.js +8 -1
  20. package/dist/core/ollama.js.map +1 -1
  21. package/dist/core/openrouter.js +13 -8
  22. package/dist/core/openrouter.js.map +1 -1
  23. package/dist/core/reasoning.d.ts +12 -0
  24. package/dist/core/reasoning.js +108 -0
  25. package/dist/core/reasoning.js.map +1 -0
  26. package/dist/core/session.d.ts +31 -0
  27. package/dist/core/session.js +154 -0
  28. package/dist/core/session.js.map +1 -0
  29. package/dist/core/types.d.ts +103 -2
  30. package/dist/core/workspace.d.ts +17 -1
  31. package/dist/core/workspace.js +498 -16
  32. package/dist/core/workspace.js.map +1 -1
  33. package/dist/tui/App.js +368 -109
  34. package/dist/tui/App.js.map +1 -1
  35. package/dist/tui/commands.js +45 -4
  36. package/dist/tui/commands.js.map +1 -1
  37. package/dist/tui/components/Composer.js +1 -1
  38. package/dist/tui/components/Composer.js.map +1 -1
  39. package/dist/tui/components/Header.d.ts +2 -2
  40. package/dist/tui/components/Header.js +32 -53
  41. package/dist/tui/components/Header.js.map +1 -1
  42. package/dist/tui/components/OnboardingPanel.d.ts +5 -0
  43. package/dist/tui/components/OnboardingPanel.js +11 -13
  44. package/dist/tui/components/OnboardingPanel.js.map +1 -1
  45. package/dist/tui/components/Sidebar.d.ts +6 -1
  46. package/dist/tui/components/Sidebar.js +33 -7
  47. package/dist/tui/components/Sidebar.js.map +1 -1
  48. package/dist/tui/components/Transcript.js +57 -8
  49. package/dist/tui/components/Transcript.js.map +1 -1
  50. package/dist/tui/hosts.js +7 -1
  51. package/dist/tui/hosts.js.map +1 -1
  52. package/dist/tui/modelSelection.d.ts +1 -0
  53. package/dist/tui/modelSelection.js +29 -0
  54. package/dist/tui/modelSelection.js.map +1 -0
  55. package/dist/tui/modes.d.ts +10 -0
  56. package/dist/tui/modes.js +37 -0
  57. package/dist/tui/modes.js.map +1 -0
  58. package/dist/tui/types.d.ts +13 -3
  59. package/dist/tui/types.js.map +1 -1
  60. package/docs/releases/v0.1.0.md +26 -0
  61. package/docs/releases/v0.2.0.md +21 -0
  62. package/docs/releases/v0.2.1.md +26 -0
  63. package/docs/releases/v0.3.0.md +26 -0
  64. package/docs/releases/v0.3.1-beta.md +19 -0
  65. package/docs/showcase/patchpilot-showcase.svg +83 -38
  66. package/package.json +5 -2
  67. package/dist/tui/inputRouting.d.ts +0 -8
  68. package/dist/tui/inputRouting.js +0 -94
  69. package/dist/tui/inputRouting.js.map +0 -1
package/README.md CHANGED
@@ -34,6 +34,7 @@ PatchPilot is a terminal interface for running coding-agent tasks inside a repos
34
34
 
35
35
  - [Highlights](#highlights)
36
36
  - [Why This Exists](#why-this-exists)
37
+ - [Requirements](#requirements)
37
38
  - [Quick Start](#quick-start)
38
39
  - [Usage](#usage)
39
40
  - [Providers](#providers)
@@ -42,6 +43,7 @@ PatchPilot is a terminal interface for running coding-agent tasks inside a repos
42
43
  - [Tech Stack](#tech-stack)
43
44
  - [Development](#development)
44
45
  - [Roadmap](#roadmap)
46
+ - [Release Notes](#release-notes)
45
47
  - [Security and Legal](#security-and-legal)
46
48
  - [License](#license)
47
49
 
@@ -54,7 +56,7 @@ PatchPilot is a terminal interface for running coding-agent tasks inside a repos
54
56
  | Cloud provider routes | Gemini, OpenRouter, NVIDIA, and Codex CLI OAuth are available from one TUI. |
55
57
  | Guided onboarding | First-run setup walks through local/remote mode, provider auth, host discovery, and model choice. |
56
58
  | Observable agent loop | Transcript, tool calls, telemetry, token counts, provider cache hits, latency, and cost estimates are visible. |
57
- | Explicit permissions | File writes require `--apply`; shell commands require `--allow-shell`. |
59
+ | Explicit permissions | Risky tools request approval unless writes or shell commands are explicitly enabled. |
58
60
  | Workspace boundary | File tools are constrained to the selected project root and block common secret files. |
59
61
  | Slash-command palette | Type `/` for browsable commands, provider switching, modes, models, diagnostics, and host selection. |
60
62
  | Advisor subagents | Explorer, planner, and reviewer advisor calls can brief the main agent before it edits. |
@@ -70,8 +72,20 @@ The core workflow is intentionally simple:
70
72
  1. Open a repository.
71
73
  2. Pick local, remote, or cloud inference.
72
74
  3. Ask for a patch, review, summary, or refactor plan.
73
- 4. Enable writes or shell commands only when the current task needs them.
74
- 5. Review the diff before committing.
75
+ 4. Approve writes or shell commands only when the current task needs them.
76
+ 5. Review `/diff`, run tests, then commit manually.
77
+
78
+ Mode behavior is intentionally explicit: `plan` is read-only, `build` keeps writes and shell behind approval prompts, and `build+bypass` enables write and shell permissions only after a visible warning is accepted in the TUI.
79
+
80
+ ## Requirements
81
+
82
+ | Requirement | Notes |
83
+ |---|---|
84
+ | Node.js 22 or newer | Required for the published CLI and source builds. |
85
+ | Git | Required for repository context and normal development workflows. |
86
+ | Ollama | Optional, only needed for local or remote Ollama inference. |
87
+ | Provider API key | Optional, only needed for Gemini, OpenRouter, or NVIDIA routes. |
88
+ | Codex CLI login | Optional, only needed for the Codex provider route. |
75
89
 
76
90
  ## Quick Start
77
91
 
@@ -81,6 +95,13 @@ Install the public CLI globally:
81
95
  npm install -g @jx-grxf/patchpilot
82
96
  ```
83
97
 
98
+ Verify the installed CLI:
99
+
100
+ ```bash
101
+ patchpilot --version
102
+ patchpilot doctor --provider ollama
103
+ ```
104
+
84
105
  For source development, clone it, install dependencies, build it, and link the local CLI:
85
106
 
86
107
  ```bash
@@ -95,7 +116,6 @@ For local Ollama inference:
95
116
 
96
117
  ```bash
97
118
  ollama pull qwen2.5-coder:7b
98
- patchpilot doctor
99
119
  patchpilot
100
120
  ```
101
121
 
@@ -120,11 +140,15 @@ patchpilot "add tests for the parser" --apply --allow-shell
120
140
 
121
141
  API keys are stored by onboarding in `~/.patchpilot/.env`.
122
142
 
143
+ 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.
144
+
123
145
  ## Usage
124
146
 
125
147
  ```bash
126
148
  patchpilot [task] [options]
127
149
  patchpilot doctor [options]
150
+ patchpilot sessions [--workspace <path>]
151
+ patchpilot resume [session-id] [--workspace <path>]
128
152
  ```
129
153
 
130
154
  | Option | Description |
@@ -135,7 +159,7 @@ patchpilot doctor [options]
135
159
  | `--ollama-url <url>` | Ollama base URL. Defaults to `http://127.0.0.1:11434`. |
136
160
  | `--steps <count>` | Maximum agent loop steps before stopping. |
137
161
  | `--thinking <mode>` | Step-budget mode: `fixed` or `adaptive`. |
138
- | `--reasoning <effort>` | Provider reasoning effort: `low`, `medium`, `high`, `xhigh`, or `adaptive`. |
162
+ | `--reasoning <effort>` | Provider reasoning effort: `none`, `low`, `medium`, `high`, `xhigh`, or `adaptive`. Unsupported provider/model combinations fall back to provider defaults. |
139
163
  | `--apply` | Allows file writes inside the workspace. |
140
164
  | `--allow-shell` | Allows shell commands inside the workspace. |
141
165
  | `--no-subagents` | Disables explorer/planner/reviewer advisor calls for faster runs. |
@@ -150,7 +174,7 @@ Useful slash commands inside the TUI:
150
174
  | `/mode plan` | Read-only planning mode. |
151
175
  | `/mode build` | Implementation mode; writes and shell can still be toggled separately. |
152
176
  | `/think fixed\|adaptive` | Switch between fixed and adaptive step budgets. |
153
- | `/reasoning low\|medium\|high\|xhigh\|adaptive` | Set provider reasoning effort where supported. |
177
+ | `/reasoning none\|low\|medium\|high\|xhigh\|adaptive` | Set provider reasoning effort where supported. |
154
178
  | `/write on\|off` | Enable or disable workspace writes. |
155
179
  | `/shell on\|off` | Enable or disable shell commands. |
156
180
  | `/agents on\|off` | Enable or disable advisor subagents. |
@@ -162,6 +186,11 @@ Useful slash commands inside the TUI:
162
186
  | `/eject [model\|all]` | Unload Ollama model(s) from the active host. |
163
187
  | `/hosts` | Re-scan reachable Ollama hosts. |
164
188
  | `/doctor` | Run provider diagnostics from inside the TUI. |
189
+ | `/sessions` | List recent sessions for the current workspace. |
190
+ | `/resume [session-id]` | Load a previous session summary. |
191
+ | `/diff` | Show the current Git diff. |
192
+ | `/approve once\|session` | Approve a pending risky tool request. |
193
+ | `/deny` | Deny a pending risky tool request. |
165
194
  | `/clear` | Clear the current transcript. |
166
195
  | `/exit` | Quit PatchPilot. |
167
196
 
@@ -205,6 +234,8 @@ PatchPilot caches model discovery for a short TTL inside the running TUI, so nor
205
234
 
206
235
  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`.
207
236
 
237
+ Reasoning support is provider and model dependent. Codex accepts fixed reasoning levels. OpenRouter receives normalized `reasoning.effort` for compatible models. Gemini uses Thinking configuration where the selected model exposes it; some Gemini models cannot disable thinking. Ollama only receives native `think` values for known thinking model families. NVIDIA reasoning effort is limited to supported GPT-OSS NIM routes.
238
+
208
239
  OpenRouter `:free` models are rate-limited by OpenRouter. PatchPilot warns when a selected model ID ends in `:free`.
209
240
 
210
241
  ## Remote Ollama
@@ -247,15 +278,30 @@ PatchPilot is designed to keep powerful actions boring and reviewable:
247
278
 
248
279
  - File access is constrained to one workspace root.
249
280
  - Secret-like files such as `.env`, `.npmrc`, SSH keys, and `.netrc` are blocked from normal file tools.
250
- - Writes are disabled unless `--apply` is set.
251
- - Shell commands are disabled unless `--allow-shell` is set.
281
+ - Writes are blocked by default; in the TUI, risky write tools request approval, and `--apply` keeps the legacy always-allow write path.
282
+ - Shell commands are blocked by default; dedicated script/test tools request approval, and `--allow-shell` keeps the legacy always-allow shell path.
252
283
  - Shell execution uses a restricted single-command runner.
253
284
  - Provider config is stored in `~/.patchpilot/.env`, not in the current repository by default.
285
+ - 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`.
254
286
  - Tool output is shown in the transcript and fed back into the agent in clipped form.
255
287
  - Cloud providers may process prompts and context remotely under their own terms.
256
288
 
257
289
  This is still experimental agent tooling. Review diffs, avoid sensitive repositories when using cloud providers, and do not enable write or shell permissions casually.
258
290
 
291
+ Safe patch workflow:
292
+
293
+ ```text
294
+ /mode plan
295
+ ask PatchPilot to inspect and propose the change
296
+ /mode build
297
+ approve only the specific write/test requests you expect
298
+ /diff
299
+ run tests
300
+ commit manually with git
301
+ ```
302
+
303
+ PatchPilot now has approval prompts and a Git diff command, but it still does not replace human review. Inline rich diff review and commit/PR automation remain future work.
304
+
259
305
  ## Tech Stack
260
306
 
261
307
  | Layer | Technologies |
@@ -264,6 +310,7 @@ This is still experimental agent tooling. Review diffs, avoid sensitive reposito
264
310
  | Runtime | Node.js 22+ |
265
311
  | TUI | Ink, React, ink-text-input |
266
312
  | Agent protocol | JSON command envelope validated with Zod |
313
+ | Sessions | Append-only JSONL in `.patchpilot/sessions` plus global index in `~/.patchpilot` |
267
314
  | Providers | Ollama chat API, Gemini generateContent API, OpenRouter OpenAI-compatible API, NVIDIA OpenAI-compatible API, Codex CLI OAuth backend |
268
315
  | Tests | Vitest |
269
316
  | CI | GitHub Actions |
@@ -293,17 +340,30 @@ If Vitest fails because a native optional dependency was installed incorrectly,
293
340
  | Area | Planned work |
294
341
  |---|---|
295
342
  | Patch review | Rich diff preview before writes. |
296
- | Permissions | Interactive approve/deny prompts per risky tool call. |
343
+ | Permissions | Per-tool approval exists; richer previews and persisted policies are next. |
297
344
  | Agents | Dedicated editor and test-runner roles with hard tool boundaries. |
298
- | Memory | Repository summaries and local task state. |
345
+ | Memory | Deeper resume that restores full transcript context, not just session summaries. |
299
346
  | Model support | Native Ollama tool calling when model support is reliable. |
300
347
  | Distribution | Signed macOS and Windows desktop shell with the CLI as a sidecar. |
301
348
  | Efficiency | More token-cache-aware prompts and provider-specific cost reporting. |
302
349
 
350
+ ## Release Notes
351
+
352
+ Release notes are kept in [docs/releases](docs/releases).
353
+
354
+ | Version | Notes |
355
+ |---|---|
356
+ | `v0.3.1-beta` | [Release notes](docs/releases/v0.3.1-beta.md) |
357
+ | `v0.3.0` | [Release notes](docs/releases/v0.3.0.md) |
358
+ | `v0.2.1` | [Release notes](docs/releases/v0.2.1.md) |
359
+ | `v0.2.0` | [Release notes](docs/releases/v0.2.0.md) |
360
+ | `v0.1.0` | [Release notes](docs/releases/v0.1.0.md) |
361
+
303
362
  ## Security and Legal
304
363
 
305
364
  PatchPilot can read files, write files, and run shell commands when you enable those capabilities. Use it only in repositories and environments you trust.
306
365
 
366
+ - Security policy: see [SECURITY.md](SECURITY.md).
307
367
  - Security reports: please use GitHub Security Advisories or contact the maintainer privately with reproduction steps and impact.
308
368
  - License: this project is provided under the [MIT License](LICENSE).
309
369
  - Warranty: the software is provided "AS IS", without warranties of any kind.
package/SECURITY.md ADDED
@@ -0,0 +1,20 @@
1
+ # Security Policy
2
+
3
+ ## Supported Versions
4
+
5
+ PatchPilot is public preview software. Security fixes target the latest published npm version and the `main` branch.
6
+
7
+ ## Reporting a Vulnerability
8
+
9
+ Please report security issues through GitHub Security Advisories when available, or contact the maintainer privately with:
10
+
11
+ - affected version or commit
12
+ - reproduction steps
13
+ - expected impact
14
+ - whether provider credentials, local files, or shell permissions are involved
15
+
16
+ Do not open a public issue for a vulnerability before the maintainer has had time to triage it.
17
+
18
+ ## Security Model
19
+
20
+ PatchPilot keeps file tools inside one workspace root, blocks common secret files, and requires explicit flags for writes and shell commands. Cloud providers may receive prompt and repository context under their own terms. Review diffs before committing generated changes.
package/dist/cli.js CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import path from "node:path";
4
+ import { readFileSync } from "node:fs";
4
5
  import { render } from "ink";
5
6
  import { Command } from "commander";
6
7
  import { defaultCodexModel } from "./core/codex.js";
@@ -11,6 +12,7 @@ import { defaultNvidiaModel } from "./core/nvidia.js";
11
12
  import { runDoctor } from "./core/doctor.js";
12
13
  import { defaultOllamaModel, resolveOllamaBaseUrl } from "./core/ollama.js";
13
14
  import { defaultOpenRouterModel } from "./core/openrouter.js";
15
+ import { listIndexedSessions, listWorkspaceSessions, loadSessionSummary } from "./core/session.js";
14
16
  import { App } from "./tui/App.js";
15
17
  loadPatchPilotEnv();
16
18
  const defaultOllamaUrl = resolveOllamaBaseUrl();
@@ -30,7 +32,7 @@ program.enablePositionalOptions();
30
32
  program
31
33
  .name("patchpilot")
32
34
  .description("Local-first coding agent TUI powered by Ollama and OpenAI-compatible providers.")
33
- .version("0.2.0");
35
+ .version(readPackageVersion());
34
36
  program
35
37
  .command("doctor")
36
38
  .description("Check local PatchPilot requirements.")
@@ -47,6 +49,40 @@ program
47
49
  }
48
50
  process.exitCode = results.every((result) => result.ok) ? 0 : 1;
49
51
  });
52
+ program
53
+ .command("sessions")
54
+ .description("List recent PatchPilot sessions.")
55
+ .option("--workspace <path>", "Workspace root. Defaults to the current directory.")
56
+ .action(async (options) => {
57
+ const sessions = options.workspace ? await listWorkspaceSessions(path.resolve(options.workspace)) : await listIndexedSessions();
58
+ if (sessions.length === 0) {
59
+ console.log("No PatchPilot sessions found.");
60
+ return;
61
+ }
62
+ for (const session of sessions.slice(0, 20)) {
63
+ console.log(`${session.sessionId} ${session.updatedAt} ${session.workspace} ${session.lastTask ?? ""}`);
64
+ }
65
+ });
66
+ program
67
+ .command("resume")
68
+ .description("Show a previous PatchPilot session summary.")
69
+ .argument("[session-id]", "Session id to inspect. Defaults to the latest workspace session.")
70
+ .option("--workspace <path>", "Workspace root", process.cwd())
71
+ .action(async (sessionId, options) => {
72
+ const workspace = path.resolve(options.workspace);
73
+ const latest = sessionId ? null : (await listWorkspaceSessions(workspace))[0] ?? null;
74
+ const summary = sessionId ? await loadSessionSummary(workspace, sessionId) : latest;
75
+ if (!summary) {
76
+ console.log("No PatchPilot session found for this workspace.");
77
+ process.exitCode = 1;
78
+ return;
79
+ }
80
+ console.log(`session: ${summary.sessionId}`);
81
+ console.log(`workspace: ${summary.workspace}`);
82
+ console.log(`updated: ${summary.updatedAt}`);
83
+ console.log(`model: ${summary.provider ?? "-"} ${summary.model ?? "-"}`);
84
+ console.log(`last task: ${summary.lastTask ?? "-"}`);
85
+ });
50
86
  program
51
87
  .argument("[task...]", "Task for the local coding agent.")
52
88
  .option("--workspace <path>", "Workspace root", process.cwd())
@@ -55,7 +91,7 @@ program
55
91
  .option("--ollama-url <url>", "Ollama base URL", defaultOllamaUrl)
56
92
  .option("--steps <count>", "Maximum agent steps", "8")
57
93
  .option("--thinking <mode>", "Thinking budget mode: fixed or adaptive.", process.env.PATCHPILOT_THINKING_MODE ?? "fixed")
58
- .option("--reasoning <effort>", "Provider reasoning effort: low, medium, high, xhigh, or adaptive.", process.env.PATCHPILOT_REASONING_EFFORT ?? "medium")
94
+ .option("--reasoning <effort>", "Provider reasoning effort: none, low, medium, high, xhigh, or adaptive.", process.env.PATCHPILOT_REASONING_EFFORT ?? "medium")
59
95
  .option("--apply", "Allow file writes inside the workspace.", false)
60
96
  .option("--allow-shell", "Allow shell commands inside the workspace.", false)
61
97
  .option("--no-subagents", "Disable planner and reviewer subagents for faster local runs.")
@@ -66,6 +102,19 @@ program
66
102
  });
67
103
  await program.parseAsync(process.argv);
68
104
  function readReasoningEffort(value) {
69
- return value === "low" || value === "medium" || value === "high" || value === "xhigh" || value === "adaptive" ? value : "medium";
105
+ return value === "none" || value === "off" || value === "false"
106
+ ? "none"
107
+ : value === "low" || value === "medium" || value === "high" || value === "xhigh" || value === "adaptive"
108
+ ? value
109
+ : "medium";
110
+ }
111
+ function readPackageVersion() {
112
+ try {
113
+ const packageJson = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"));
114
+ return typeof packageJson.version === "string" ? packageJson.version : "0.0.0";
115
+ }
116
+ catch {
117
+ return "0.0.0";
118
+ }
70
119
  }
71
120
  //# sourceMappingURL=cli.js.map
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;AAE7B,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,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAClF,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAC5E,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAEnC,iBAAiB,EAAE,CAAC;AAEpB,MAAM,gBAAgB,GAAG,oBAAoB,EAAE,CAAC;AAChD,MAAM,eAAe,GAAG,iBAAiB,EAAE,CAAC;AAC5C,MAAM,YAAY,GAChB,OAAO,CAAC,GAAG,CAAC,gBAAgB;IAC5B,CAAC,eAAe,KAAK,QAAQ;QAC3B,CAAC,CAAC,kBAAkB;QACpB,CAA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AAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,EAC5E,eAAe,EAAE,mBAAmB,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,EAC/D,SAAS,EAAE,OAAO,CAAC,SAAS,KAAK,KAAK,GACtC,CACH,CAAC;AACJ,CAAC,CAAC,CAAC;AAEL,MAAM,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAEvC,SAAS,mBAAmB,CAAC,KAAa;IACxC,OAAO,KAAK,KAAK,MAAM,IAAI,KAAK,KAAK,KAAK,IAAI,KAAK,KAAK,OAAO;QAC7D,CAAC,CAAC,MAAM;QACR,CAAC,CAAC,KAAK,KAAK,KAAK,IAAI,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,MAAM,IAAI,KAAK,KAAK,OAAO,IAAI,KAAK,KAAK,UAAU;YACtG,CAAC,CAAC,KAAK;YACP,CAAC,CAAC,QAAQ,CAAC;AACjB,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"}
@@ -1,16 +1,20 @@
1
- import type { AgentEvent, ModelProvider, ReasoningEffort } from "./types.js";
1
+ import type { SessionStore } from "./session.js";
2
+ import type { AgentEvent, ApprovalRequest, ModelProvider, PermissionDecision, ProviderReasoningEffort } from "./types.js";
2
3
  export type AgentRunnerOptions = {
3
4
  provider: ModelProvider;
4
5
  model: string;
5
6
  ollamaUrl: string;
6
7
  workspace: string;
8
+ mode?: "plan" | "build" | "bypass";
7
9
  allowWrite: boolean;
8
10
  allowShell: boolean;
9
11
  maxSteps: number;
10
12
  thinkingMode: "fixed" | "adaptive";
11
- reasoningEffort: ReasoningEffort | "adaptive";
13
+ reasoningEffort: ProviderReasoningEffort | "adaptive";
12
14
  subagents: boolean;
13
15
  signal?: AbortSignal;
16
+ sessionStore?: SessionStore;
17
+ approvalHandler?: (request: ApprovalRequest) => Promise<PermissionDecision>;
14
18
  };
15
19
  export declare class AgentRunner {
16
20
  private readonly client;