pi-codex-search 0.1.2 → 0.1.3

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 CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  **Search the web in Pi through your Codex subscription.**
7
7
 
8
- Pi keeps the harness small. Codex already has a ChatGPT-backed search path. This package connects the two: it adds a `codex_search` tool to Pi and uses the same `openai-codex` login Pi already knows about.
8
+ Pi keeps the harness small. Codex already has a ChatGPT-backed search path. This package connects the two: it adds a `codex_search` tool to Pi and uses the same `openai-codex` login Pi already knows about. An optional `codex_standalone_web` tool exposes Codex's experimental webpage actions.
9
9
 
10
10
  No `ACCESS_TOKEN` env var. No separate login flow. If Pi can use your Codex subscription, this extension can use the same auth.
11
11
 
@@ -18,19 +18,21 @@ This extension is for Pi workflows that need fresh or source-backed information:
18
18
  - **Look up current docs and release notes.** Ask the model to check things that changed after its training cutoff.
19
19
  - **Get sources with the answer.** Search results include citations when Codex returns them.
20
20
  - **Reuse your Codex login.** The tool uses Pi's existing `openai-codex` OAuth credential instead of asking you to paste tokens.
21
- - **Batch related searches.** One tool call can run up to five related queries in parallel and return the results grouped by query.
22
- - **Keep projects in control.** Rename the tool, change defaults, or disable it per project.
21
+ - **Batch related searches in Responses mode.** One `codex_search` call can run related queries together.
22
+ - **Inspect webpages when explicitly enabled.** `codex_standalone_web` sends one standalone action per tool call because `/alpha/search` rejects multi-action batching.
23
+ - **Keep projects in control.** Change defaults, enable the standalone tool, or disable the extension per project.
23
24
 
24
25
  ## What this package adds
25
26
 
26
- - A `codex_search` Pi tool.
27
- - 1–5 search queries per call, run in parallel.
28
- - `live` or `cached` freshness, plus `low` / `medium` / `high` search context size.
27
+ - A `codex_search` Pi tool using the Responses API.
28
+ - 1–32 search queries per `codex_search` call, controlled by `batchSize`.
29
+ - Optional `codex_standalone_web` using experimental `/alpha/search` with open, find, click, screenshot, finance, weather, sports, and time commands. It accepts exactly one action per tool call.
30
+ - `live`, `indexed`, or `cached` freshness, plus `low` / `medium` / `high` search context size. Standalone mode disables `low` because Codex returns Cloudflare challenges for low-context standalone requests.
29
31
  - Streaming progress while Codex responds.
30
32
  - Collapsed result previews in the TUI, with full text and sources available when expanded.
31
33
  - Structured details: model, citations, search calls, response ids, usage, and per-query failures.
32
34
  - Config files for home and project defaults.
33
- - `/codex-search-settings` for status, editing, reset, rename, and disable.
35
+ - `/codex-search-settings` for status, editing, reset, standalone enablement, and disable.
34
36
 
35
37
  ## Install
36
38
 
@@ -71,12 +73,15 @@ Set `enabled: false` if you want the extension installed but hidden for a projec
71
73
 
72
74
  ## Tool
73
75
 
74
- Default tool name:
76
+ Default tools:
75
77
 
76
78
  ```text
77
79
  codex_search
80
+ codex_standalone_web
78
81
  ```
79
82
 
83
+ `codex_search` is always registered when the extension is enabled. `codex_standalone_web` is optional and off by default.
84
+
80
85
  Example call:
81
86
 
82
87
  ```json
@@ -90,17 +95,28 @@ Example call:
90
95
  }
91
96
  ```
92
97
 
93
- Arguments:
98
+ Arguments for `codex_search`:
94
99
 
95
- - `queries` — required array of 1–5 search questions. Queries run in parallel; results are grouped by query.
100
+ - `queries` — required array of search questions. Queries run in parallel and results are grouped by query. The default max is 5 and the hard max is 32.
96
101
  - `search_context_size` — optional, one of `low`, `medium`, `high`; defaults to `medium`.
97
- - `freshness` — optional, `live` or `cached`; defaults to `live`.
102
+ - `freshness` — optional, `live`, `indexed`, or `cached`; defaults to `live`.
103
+
104
+ Arguments for optional `codex_standalone_web`:
105
+
106
+ - `urls` — one page to open/fetch directly.
107
+ - `find` — one `{ "url", "pattern" }` object for in-page text search after opening the URL.
108
+ - `click` — one `{ "url", "id" }` object for following a link id from an opened page.
109
+ - `screenshot` — one `{ "url", "pageno" }` object for page screenshots after opening the URL.
110
+ - `finance`, `weather`, `sports`, `time` — one Codex web lookup command.
111
+
112
+ Standalone uses `medium` or `high` search context only. If standalone is enabled while the saved context is `low`, settings normalize it to `medium`.
98
113
 
99
114
  The tool returns text. When citations are available, the text includes a `Sources:` section.
100
115
 
101
116
  The structured `details` object includes:
102
117
 
103
118
  - `model`
119
+ - `api`
104
120
  - `freshness` / `searchContextSize`
105
121
  - `queryCount` / `failedQueryCount`
106
122
  - `successes`: per-query `{ query, text, citations, searchCalls, responseId?, usage? }`
@@ -120,7 +136,7 @@ Most users do not need to set this.
120
136
 
121
137
  ## Settings
122
138
 
123
- Most users only need `/login openai-codex`. Use settings when you want to rename the tool, disable it for a project, pin a model, or change defaults.
139
+ Most users only need `/login openai-codex`. Use settings when you want to enable `codex_standalone_web`, disable the extension for a project, pin a model, or change defaults.
124
140
 
125
141
  Open the interactive settings dialog:
126
142
 
@@ -143,39 +159,45 @@ Settings are merged from three layers, highest precedence first:
143
159
 
144
160
  Each layer is optional. Missing files are skipped. Malformed JSON or invalid values fail fast so you do not silently run with the wrong tool settings.
145
161
 
162
+ Because the project file lives under `<cwd>/.pi/`, it follows Pi's project trust rules. If you decline to trust a project, the extension reads only the home file and environment variables; the project scope is hidden in the settings dialog and cannot be saved or deleted until the project is trusted.
163
+
146
164
  Full schema, all fields optional:
147
165
 
148
166
  ```json
149
167
  {
150
168
  "enabled": true,
151
- "toolName": "codex_search",
169
+ "standaloneEnabled": false,
152
170
  "model": "gpt-5-codex",
153
171
  "baseUrl": "https://chatgpt.com/backend-api",
154
172
  "clientVersion": "1.0.0",
155
173
  "searchContextSize": "medium",
156
- "freshness": "live"
174
+ "freshness": "live",
175
+ "batchSize": 5
157
176
  }
158
177
  ```
159
178
 
160
- `enabled: false` skips tool registration entirely. The model will not see `codex_search` at all.
179
+ `enabled: false` skips tool registration entirely. The model will not see `codex_search` or `codex_standalone_web`.
180
+
181
+ `standaloneEnabled: true` registers `codex_standalone_web`. It posts web commands to `/codex/alpha/search` on `chatgpt.com/backend-api` or `/v1/alpha/search` for `api.openai.com/v1`-style bases, accepts one action per tool call, stores returned ref ids for follow-up open/find/click/screenshot actions, disables `low` search context, and may be blocked by Cloudflare or backend session limits. Use `codex_search` for web search queries.
161
182
 
162
- `toolName` lets you avoid conflicts with another extension. Tool names must match `[a-zA-Z_][a-zA-Z0-9_]{0,63}`.
183
+ `searchApi: "standalone"` from older configs is treated as `standaloneEnabled: true` for compatibility.
163
184
 
164
185
  Environment variable equivalents:
165
186
 
166
187
  | Field | Env var |
167
188
  | ------------------- | ------------------------------------ |
168
189
  | `enabled` | `PI_CODEX_WEB_SEARCH_ENABLED` |
169
- | `toolName` | `PI_CODEX_WEB_SEARCH_TOOL_NAME` |
190
+ | `standaloneEnabled` | `PI_CODEX_WEB_STANDALONE_ENABLED` |
170
191
  | `model` | `PI_CODEX_WEB_SEARCH_MODEL` |
171
192
  | `baseUrl` | `PI_CODEX_WEB_SEARCH_BASE_URL` |
172
193
  | `clientVersion` | `PI_CODEX_WEB_SEARCH_CLIENT_VERSION` |
173
194
  | `searchContextSize` | `PI_CODEX_WEB_SEARCH_CONTEXT_SIZE` |
174
195
  | `freshness` | `PI_CODEX_WEB_SEARCH_FRESHNESS` |
196
+ | `batchSize` | `PI_CODEX_WEB_SEARCH_BATCH_SIZE` |
175
197
 
176
198
  `PI_CODEX_WEB_SEARCH_ENABLED` accepts `true` / `false` (case-insensitive). Any other value fails config loading.
177
199
 
178
- Interactive edits write the selected config file immediately. When you close the dialog, Pi reloads so the new tool name and defaults apply without restarting the whole terminal.
200
+ The settings dialog shows a unified `SettingsList` view. The model picker loads available Codex models asynchronously after the dialog opens, so the UI appears immediately even when `/codex/models` is slow. Interactive edits write the selected config file immediately. When you close the dialog, Pi reloads so the tool set and defaults apply without restarting the whole terminal.
179
201
 
180
202
  ## Notes
181
203
 
@@ -219,7 +241,7 @@ Set `model` in your config file, or set `PI_CODEX_WEB_SEARCH_MODEL`, to the Code
219
241
 
220
242
  ### A different extension already registers `codex_search`
221
243
 
222
- Use `/codex-search-settings` to rename this extension's tool, or set `toolName` in `~/.pi/pi-codex-search.json`. Tool renames apply after the settings dialog reloads Pi.
244
+ The tool names are fixed as `codex_search` and `codex_standalone_web`. Disable conflicting extensions or tools with the same names.
223
245
 
224
246
  ## Development
225
247