@steipete/oracle 0.8.5 → 0.9.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.
Files changed (49) hide show
  1. package/README.md +99 -5
  2. package/dist/bin/oracle-cli.js +376 -13
  3. package/dist/src/browser/actions/assistantResponse.js +72 -37
  4. package/dist/src/browser/actions/modelSelection.js +60 -8
  5. package/dist/src/browser/actions/navigation.js +2 -1
  6. package/dist/src/browser/actions/promptComposer.js +141 -32
  7. package/dist/src/browser/chromeLifecycle.js +25 -9
  8. package/dist/src/browser/config.js +14 -0
  9. package/dist/src/browser/constants.js +1 -1
  10. package/dist/src/browser/index.js +414 -43
  11. package/dist/src/browser/profileState.js +93 -0
  12. package/dist/src/browser/providerDomFlow.js +17 -0
  13. package/dist/src/browser/providers/chatgptDomProvider.js +49 -0
  14. package/dist/src/browser/providers/geminiDeepThinkDomProvider.js +245 -0
  15. package/dist/src/browser/providers/index.js +2 -0
  16. package/dist/src/cli/browserConfig.js +33 -6
  17. package/dist/src/cli/browserDefaults.js +21 -0
  18. package/dist/src/cli/detach.js +5 -2
  19. package/dist/src/cli/fileSize.js +11 -0
  20. package/dist/src/cli/help.js +3 -3
  21. package/dist/src/cli/markdownBundle.js +5 -1
  22. package/dist/src/cli/options.js +40 -3
  23. package/dist/src/cli/runOptions.js +11 -3
  24. package/dist/src/cli/sessionDisplay.js +91 -2
  25. package/dist/src/cli/sessionLineage.js +56 -0
  26. package/dist/src/cli/sessionRunner.js +169 -2
  27. package/dist/src/cli/sessionTable.js +2 -1
  28. package/dist/src/cli/tui/index.js +3 -0
  29. package/dist/src/gemini-web/browserSessionManager.js +76 -0
  30. package/dist/src/gemini-web/client.js +16 -5
  31. package/dist/src/gemini-web/executionClients.js +1 -0
  32. package/dist/src/gemini-web/executionMode.js +18 -0
  33. package/dist/src/gemini-web/executor.js +273 -120
  34. package/dist/src/mcp/tools/consult.js +35 -21
  35. package/dist/src/oracle/client.js +42 -13
  36. package/dist/src/oracle/config.js +43 -7
  37. package/dist/src/oracle/errors.js +2 -2
  38. package/dist/src/oracle/files.js +20 -5
  39. package/dist/src/oracle/gemini.js +3 -0
  40. package/dist/src/oracle/modelResolver.js +33 -1
  41. package/dist/src/oracle/request.js +7 -2
  42. package/dist/src/oracle/run.js +22 -12
  43. package/dist/src/sessionManager.js +13 -2
  44. package/dist/src/sessionStore.js +2 -2
  45. package/dist/vendor/oracle-notifier/OracleNotifier.app/Contents/CodeResources +0 -0
  46. package/dist/vendor/oracle-notifier/OracleNotifier.app/Contents/MacOS/OracleNotifier +0 -0
  47. package/package.json +24 -24
  48. package/vendor/oracle-notifier/OracleNotifier.app/Contents/CodeResources +0 -0
  49. package/vendor/oracle-notifier/OracleNotifier.app/Contents/MacOS/OracleNotifier +0 -0
package/README.md CHANGED
@@ -11,7 +11,39 @@
11
11
  <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-green?style=for-the-badge" alt="MIT License"></a>
12
12
  </p>
13
13
 
14
- Oracle bundles your prompt and files so another AI can answer with real context. It speaks GPT-5.1 Pro (default alias to GPT-5.2 Pro on the API), GPT-5.1 Codex (API-only), GPT-5.1, GPT-5.2, Gemini 3 Pro, Claude Sonnet 4.5, Claude Opus 4.1, and more—and it can ask one or multiple models in a single run. Browser automation is available; use `--browser-model-strategy current` to keep the active ChatGPT model (or `ignore` to skip the picker). API remains the most reliable path, and `--copy` is an easy manual fallback.
14
+ Oracle bundles your prompt and files so another AI can answer with real context. It speaks GPT-5.4 Pro (default), GPT-5.4, GPT-5.1 Pro, GPT-5.1 Codex (API-only), GPT-5.1, GPT-5.2, Gemini 3.1 Pro (API-only), Gemini 3 Pro, Claude Sonnet 4.5, Claude Opus 4.1, and more—and it can ask one or multiple models in a single run. Browser automation is available; use `--browser-model-strategy current` to keep the active ChatGPT model (or `ignore` to skip the picker). API remains the most reliable path, and `--copy` is an easy manual fallback.
15
+
16
+ ## Setting up (macOS Browser Mode)
17
+
18
+ Browser mode lets you use GPT-5.2 Pro without any API keys — it automates your Chrome browser directly.
19
+
20
+ ### First-time login
21
+
22
+ Run this once to create an automation profile and log into ChatGPT. The browser will stay open so you can complete the login:
23
+
24
+ ```bash
25
+ oracle --engine browser --browser-manual-login \
26
+ --browser-keep-browser --browser-input-timeout 120000 \
27
+ -p "HI"
28
+ ```
29
+
30
+ ### Subsequent runs
31
+
32
+ Once logged in, the automation profile is saved. Use this for all future runs:
33
+
34
+ ```bash
35
+ oracle --engine browser --browser-manual-login \
36
+ --browser-auto-reattach-delay 5s \
37
+ --browser-auto-reattach-interval 3s \
38
+ --browser-auto-reattach-timeout 60s \
39
+ -p "your prompt"
40
+ ```
41
+
42
+ > **Why these flags?**
43
+ > - `--browser-manual-login` — Skips macOS Keychain cookie access (avoids repeated permission popups)
44
+ > - `--browser-auto-reattach-*` — Reconnects when ChatGPT redirects mid-page-load (fixes "Inspected target navigated or closed" error)
45
+ > - `--browser-keep-browser` — Keeps browser open for first-time login (not needed after)
46
+ > - `--browser-input-timeout 120000` — Gives you 2 minutes to log in on first run
15
47
 
16
48
  ## Quick start
17
49
 
@@ -30,6 +62,12 @@ npx -y @steipete/oracle -p "Write a concise architecture note for the storage ad
30
62
  # Multi-model API run
31
63
  npx -y @steipete/oracle -p "Cross-check the data layer assumptions" --models gpt-5.1-pro,gemini-3-pro --file "src/**/*.ts"
32
64
 
65
+ # Follow up from an existing OpenAI/Azure session id
66
+ npx -y @steipete/oracle --engine api --model gpt-5.2-pro --followup release-readiness-audit --followup-model gpt-5.2-pro -p "Re-evaluate with this new context" --file "src/**/*.ts"
67
+
68
+ # Follow up directly from an OpenAI Responses API id
69
+ npx -y @steipete/oracle --engine api --model gpt-5.2-pro --followup resp_abc1234567890 -p "Continue from this response" --file docs/notes.md
70
+
33
71
  # Preview without spending tokens
34
72
  npx -y @steipete/oracle --dry-run summary -p "Check release notes" --file docs/release-notes.md
35
73
 
@@ -42,6 +80,7 @@ npx -y @steipete/oracle --engine browser --model gemini-3-pro --prompt "a cute r
42
80
  # Sessions (list and replay)
43
81
  npx -y @steipete/oracle status --hours 72
44
82
  npx -y @steipete/oracle session <id> --render
83
+ npx -y @steipete/oracle restart <id>
45
84
 
46
85
  # TUI (interactive, only for humans)
47
86
  npx -y @steipete/oracle tui
@@ -52,7 +91,7 @@ Engine auto-picks API when `OPENAI_API_KEY` is set, otherwise browser; browser i
52
91
  ## Integration
53
92
 
54
93
  **CLI**
55
- - API mode expects API keys in your environment: `OPENAI_API_KEY` (GPT-5.x), `GEMINI_API_KEY` (Gemini 3 Pro), `ANTHROPIC_API_KEY` (Claude Sonnet 4.5 / Opus 4.1).
94
+ - API mode expects API keys in your environment: `OPENAI_API_KEY` (GPT-5.x), `GEMINI_API_KEY` (Gemini 3.1 Pro / Gemini 3 Pro), `ANTHROPIC_API_KEY` (Claude Sonnet 4.5 / Opus 4.1).
56
95
  - Gemini browser mode uses Chrome cookies instead of an API key—just be logged into `gemini.google.com` in Chrome (no Python/venv required).
57
96
  - If your Gemini account can’t access “Pro”, Oracle auto-falls back to a supported model for web runs (and logs the fallback in verbose mode).
58
97
  - Prefer API mode or `--copy` + manual paste; browser automation is experimental.
@@ -95,11 +134,61 @@ npx -y @steipete/oracle oracle-mcp
95
134
  - Multi-model API runs with aggregated cost/usage, including OpenRouter IDs alongside first-party models.
96
135
  - Render/copy bundles for manual paste into ChatGPT when automation is blocked.
97
136
  - GPT‑5 Pro API runs detach by default; reattach via `oracle session <id>` / `oracle status` or block with `--wait`.
137
+ - OpenAI/Azure follow-up API runs can continue from `--followup <sessionId|responseId>`; for multi-model parents, add `--followup-model <model>`.
98
138
  - Azure endpoints supported via `--azure-endpoint/--azure-deployment/--azure-api-version` or `AZURE_OPENAI_*` envs.
99
139
  - File safety: globs/excludes, size guards, `--files-report`.
100
140
  - Sessions you can replay (`oracle status`, `oracle session <id> --render`).
101
141
  - Session logs and bundles live in `~/.oracle/sessions` (override with `ORACLE_HOME_DIR`).
102
142
 
143
+ ## Follow-up and lineage
144
+
145
+ Use `--followup` to continue an existing OpenAI/Azure Responses API run with additional context/files:
146
+
147
+ ```bash
148
+ oracle \
149
+ --engine api \
150
+ --model gpt-5.2-pro \
151
+ --followup <existing-session-id-or-resp_id> \
152
+ --followup-model gpt-5.2-pro \
153
+ --slug "my-followup-run" \
154
+ --wait \
155
+ -p "Follow-up: re-evaluate the previous recommendation with the attached files." \
156
+ --file "server/src/strategy/plan.ts" \
157
+ --file "server/src/strategy/executor.ts"
158
+ ```
159
+
160
+ When the parent session used `--models`, `--followup-model` picks which model's response id to chain from.
161
+ Custom `--base-url` providers plus Gemini/Claude API runs are excluded here because they do not preserve `previous_response_id` in Oracle.
162
+
163
+ `oracle status` shows parent/child lineage in tree form:
164
+
165
+ ```text
166
+ Recent Sessions
167
+ Status Model Mode Timestamp Chars Cost Slug
168
+ completed gpt-5.2-pro api 03/01/2026 09:00 AM 1800 $2.110 architecture-review-parent
169
+ completed gpt-5.2-pro api 03/01/2026 09:14 AM 2200 $2.980 ├─ architecture-review-followup
170
+ running gpt-5.2-pro api 03/01/2026 09:22 AM 1400 - │ └─ architecture-review-implementation-pass
171
+ pending gpt-5.2-pro api 03/01/2026 09:25 AM 900 - └─ architecture-review-risk-check
172
+ ```
173
+
174
+ ## Browser auto-reattach (long Pro runs)
175
+
176
+ When browser runs time out (common with long GPT‑5.x Pro responses), Oracle can keep polling the existing ChatGPT tab and capture the final answer without manual `oracle session <id>` commands.
177
+
178
+ Enable auto-reattach by setting a non-zero interval:
179
+ - `--browser-auto-reattach-delay` — wait before the first retry (e.g. `30s`)
180
+ - `--browser-auto-reattach-interval` — how often to retry (e.g. `2m`)
181
+ - `--browser-auto-reattach-timeout` — per-attempt budget (default `2m`)
182
+
183
+ ```bash
184
+ oracle --engine browser \
185
+ --browser-timeout 6m \
186
+ --browser-auto-reattach-delay 30s \
187
+ --browser-auto-reattach-interval 2m \
188
+ --browser-auto-reattach-timeout 2m \
189
+ -p "Run the long UI audit" --file "src/**/*.ts"
190
+ ```
191
+
103
192
  ## Flags you’ll actually use
104
193
 
105
194
  | Flag | Purpose |
@@ -107,8 +196,10 @@ npx -y @steipete/oracle oracle-mcp
107
196
  | `-p, --prompt <text>` | Required prompt. |
108
197
  | `-f, --file <paths...>` | Attach files/dirs (globs + `!` excludes). |
109
198
  | `-e, --engine <api\|browser>` | Choose API or browser (browser is experimental). |
110
- | `-m, --model <name>` | Built-ins (`gpt-5.1-pro` default, `gpt-5-pro`, `gpt-5.1`, `gpt-5.1-codex`, `gpt-5.2`, `gpt-5.2-instant`, `gpt-5.2-pro`, `gemini-3-pro`, `claude-4.5-sonnet`, `claude-4.1-opus`) plus any OpenRouter id (e.g., `minimax/minimax-m2`, `openai/gpt-4o-mini`). |
199
+ | `-m, --model <name>` | Built-ins (`gpt-5.4-pro` default, `gpt-5.4`, `gpt-5.1-pro`, `gpt-5-pro`, `gpt-5.1`, `gpt-5.1-codex`, `gpt-5.2`, `gpt-5.2-instant`, `gpt-5.2-pro`, `gemini-3.1-pro` API-only, `gemini-3-pro`, `claude-4.5-sonnet`, `claude-4.1-opus`) plus any OpenRouter id (e.g., `minimax/minimax-m2`, `openai/gpt-4o-mini`). |
111
200
  | `--models <list>` | Comma-separated API models (mix built-ins and OpenRouter ids) for multi-model runs. |
201
+ | `--followup <sessionId\|responseId>` | Continue an OpenAI/Azure Responses API run from a stored oracle session or `resp_...` response id. |
202
+ | `--followup-model <model>` | For multi-model OpenAI/Azure parent sessions, choose which model response to continue from. |
112
203
  | `--base-url <url>` | Point API runs at LiteLLM/Azure/OpenRouter/etc. |
113
204
  | `--chatgpt-url <url>` | Target a ChatGPT workspace/folder (browser). |
114
205
  | `--browser-model-strategy <select\|current\|ignore>` | Control ChatGPT model selection in browser mode (current keeps the active model; ignore skips the picker). |
@@ -117,6 +208,9 @@ npx -y @steipete/oracle oracle-mcp
117
208
  | `--browser-port <port>` | Pin the Chrome DevTools port (WSL/Windows firewall helper). |
118
209
  | `--browser-inline-cookies[(-file)] <payload|path>` | Supply cookies without Chrome/Keychain (browser). |
119
210
  | `--browser-timeout`, `--browser-input-timeout` | Control overall/browser input timeouts (supports h/m/s/ms). |
211
+ | `--browser-recheck-delay`, `--browser-recheck-timeout` | Delayed recheck for long Pro runs: wait then retry capture after timeout (supports h/m/s/ms). |
212
+ | `--browser-reuse-wait` | Wait for a shared Chrome profile before launching (parallel browser runs). |
213
+ | `--browser-profile-lock-timeout` | Wait for the shared manual-login profile lock before sending (serializes parallel runs). |
120
214
  | `--render`, `--copy` | Print and/or copy the assembled markdown bundle. |
121
215
  | `--wait` | Block for background API runs (e.g., GPT‑5.1 Pro) instead of detaching. |
122
216
  | `--timeout <seconds\|auto>` | Overall API deadline (auto = 60m for pro, 120s otherwise). |
@@ -139,7 +233,7 @@ npx -y @steipete/oracle oracle-mcp
139
233
  Put defaults in `~/.oracle/config.json` (JSON5). Example:
140
234
  ```json5
141
235
  {
142
- model: "gpt-5.1-pro",
236
+ model: "gpt-5.4-pro",
143
237
  engine: "api",
144
238
  filesReport: true,
145
239
  browser: {
@@ -154,7 +248,7 @@ Advanced flags
154
248
 
155
249
  | Area | Flags |
156
250
  | --- | --- |
157
- | Browser | `--browser-manual-login`, `--browser-thinking-time`, `--browser-timeout`, `--browser-input-timeout`, `--browser-cookie-wait`, `--browser-inline-cookies[(-file)]`, `--browser-attachments`, `--browser-inline-files`, `--browser-bundle-files`, `--browser-keep-browser`, `--browser-headless`, `--browser-hide-window`, `--browser-no-cookie-sync`, `--browser-allow-cookie-errors`, `--browser-chrome-path`, `--browser-cookie-path`, `--chatgpt-url` |
251
+ | Browser | `--browser-manual-login`, `--browser-thinking-time`, `--browser-timeout`, `--browser-input-timeout`, `--browser-recheck-delay`, `--browser-recheck-timeout`, `--browser-reuse-wait`, `--browser-profile-lock-timeout`, `--browser-auto-reattach-delay`, `--browser-auto-reattach-interval`, `--browser-auto-reattach-timeout`, `--browser-cookie-wait`, `--browser-inline-cookies[(-file)]`, `--browser-attachments`, `--browser-inline-files`, `--browser-bundle-files`, `--browser-keep-browser`, `--browser-headless`, `--browser-hide-window`, `--browser-no-cookie-sync`, `--browser-allow-cookie-errors`, `--browser-chrome-path`, `--browser-cookie-path`, `--chatgpt-url` |
158
252
  | Run control | `--background`, `--no-background`, `--http-timeout`, `--zombie-timeout`, `--zombie-last-activity` |
159
253
  | Azure/OpenAI | `--azure-endpoint`, `--azure-deployment`, `--azure-api-version`, `--base-url` |
160
254