@howaboua/pi-codex-web-run 0.0.3 → 0.0.5

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/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @howaboua/pi-codex-web-run
2
2
 
3
+ ## 0.0.5
4
+
5
+ - Web requests now re-evaluate proxy and `no_proxy` routing after redirects.
6
+
7
+ ## 0.0.4
8
+
9
+ - GPT-6 Sol and Luna now share Astra's Codex support.
10
+
11
+ - Removed `/terra`; use `/luna` instead.
12
+ - Added Responses Lite, non-destructive reasoning changes and terse context guidance for GPT-6 Sol and Luna.
13
+ - Image descriptions now use GPT-6 Luna directly instead of preferring older mini models.
14
+ - Cost estimates now use published GPT-6 Sol and Luna rates, including cache writes and long-context pricing.
15
+ - Agent, review, exploration, web search, voice summary and image-description defaults now use GPT-6; Luna replaces Terra defaults. GPT Switcher retains Luna's 472K context limit, while Codex Conversion defaults all three GPT-6 models to 272K.
16
+
3
17
  ## 0.0.3
4
18
 
5
19
  - Remove retired Spark from Codex tool authentication preferences. Codex Conversion now explains biological-policy errors when the server omits an explanation.
package/README.md CHANGED
@@ -16,7 +16,7 @@ Pi Codex 3.0.25 or newer is optional. With it installed, the normal web_run tool
16
16
 
17
17
  Use explicit search and navigation operations. Returned ref_ids belong to that search result and can be passed to open, click, or find. Cite the returned source URLs rather than internal ref_ids.
18
18
 
19
- The Codex route uses GPT-5.6 Luna by default. Set `PI_CODEX_MODEL` to override it. Configured Responses routes keep their active configured model.
19
+ The Codex route uses GPT-6 Luna by default. Set `PI_CODEX_MODEL` to override it. Configured Responses routes keep their active configured model.
20
20
 
21
21
  For a proxy that renames Codex providers or models, create `pi-codex-tools.json` in Pi's agent directory:
22
22
 
@@ -24,7 +24,7 @@ For a proxy that renames Codex providers or models, create `pi-codex-tools.json`
24
24
  {
25
25
  "providers": {
26
26
  "company-codex": {
27
- "gpt-5.6-luna": "company-luna"
27
+ "gpt-6-luna": "company-luna"
28
28
  }
29
29
  }
30
30
  }
package/UPSTREAM_SYNC.md CHANGED
@@ -3,3 +3,9 @@
3
3
  The contract follows OpenAI Codex web search at commit b545c94041017d000e2c8b2f6272705d21b85dfb.
4
4
 
5
5
  Reference snapshots live under upstream/. The executable implementation is TypeScript: it preserves Codex alpha/search requests, explicit search/navigation commands, proxy routing, and reusable result references without bundling the Rust client.
6
+
7
+ ## September 28 review
8
+
9
+ Reviewed through Codex `1b1835f751ebdc0cfc50b3fe55d4571dbb294563`; reference snapshots remain pinned to the revision above.
10
+
11
+ HTTP redirects resolve proxy and `no_proxy` routing for each destination, following the route-aware transport change in `6ea62c4396`. ChatGPT redirect bounds, cookie handling and cross-origin credential stripping remain enforced. The runtime remains identical to the image-generation package's copy.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@howaboua/pi-codex-web-run",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "description": "Codex web search and navigation for Pi, Code Mode and Notebook Mode.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -53,8 +53,8 @@
53
53
  },
54
54
  "devDependencies": {
55
55
  "@biomejs/biome": "^2.5.10",
56
- "@earendil-works/pi-coding-agent": "0.86.1",
57
- "@earendil-works/pi-tui": "0.86.1",
56
+ "@earendil-works/pi-coding-agent": "0.99.1",
57
+ "@earendil-works/pi-tui": "0.99.1",
58
58
  "@types/node": "^26.2.0",
59
59
  "tsx": "^4.23.12",
60
60
  "typebox": "1.3.18",
@@ -27,8 +27,7 @@ export async function fetchCodexTool(
27
27
  maxResponseBytes?: number;
28
28
  },
29
29
  ): Promise<CodexToolHttpResponse> {
30
- const proxy = getProxyForUrl(url);
31
- const dispatcher = proxy ? new ProxyAgent(proxy) : undefined;
30
+ const dispatchers = new Map<string, ProxyAgent>();
32
31
  let currentUrl = new URL(url);
33
32
  let method = options.method;
34
33
  let body = options.body;
@@ -36,6 +35,12 @@ export async function fetchCodexTool(
36
35
  try {
37
36
  for (let redirects = 0; ; redirects += 1) {
38
37
  const chatGptRequest = isChatGptCookieUrl(currentUrl);
38
+ const proxy = getProxyForUrl(currentUrl.href);
39
+ let dispatcher = proxy ? dispatchers.get(proxy) : undefined;
40
+ if (proxy && !dispatcher) {
41
+ dispatcher = new ProxyAgent(proxy);
42
+ dispatchers.set(proxy, dispatcher);
43
+ }
39
44
  const headers = new Headers(baseHeaders);
40
45
  const cookieHeader = cloudflareCookies.requestHeader(currentUrl);
41
46
  if (cookieHeader) headers.set("cookie", cookieHeader);
@@ -45,7 +50,7 @@ export async function fetchCodexTool(
45
50
  ...(body === undefined ? {} : { body }),
46
51
  ...(options.signal ? { signal: options.signal } : {}),
47
52
  ...(dispatcher ? { dispatcher } : {}),
48
- redirect: chatGptRequest ? "manual" : "follow",
53
+ redirect: "manual",
49
54
  });
50
55
  if (chatGptRequest)
51
56
  cloudflareCookies.storeResponse(
@@ -56,7 +61,7 @@ export async function fetchCodexTool(
56
61
  response.status,
57
62
  response.headers.get("location"),
58
63
  );
59
- if (!location || !chatGptRequest) {
64
+ if (!location) {
60
65
  return {
61
66
  status: response.status,
62
67
  statusText: response.statusText,
@@ -74,7 +79,7 @@ export async function fetchCodexTool(
74
79
  );
75
80
  }
76
81
  const nextUrl = new URL(location, currentUrl);
77
- if (!isChatGptCookieUrl(nextUrl)) {
82
+ if (chatGptRequest && !isChatGptCookieUrl(nextUrl)) {
78
83
  await response.body?.cancel();
79
84
  throw new Error(
80
85
  "Codex tool request refused redirect outside ChatGPT: " +
@@ -84,21 +89,30 @@ export async function fetchCodexTool(
84
89
  if (nextUrl.origin !== currentUrl.origin) {
85
90
  baseHeaders.delete("authorization");
86
91
  baseHeaders.delete("chatgpt-account-id");
92
+ baseHeaders.delete("cookie");
93
+ baseHeaders.delete("proxy-authorization");
94
+ baseHeaders.delete("host");
87
95
  }
88
96
  if (
89
- response.status === 303 ||
97
+ (response.status === 303 &&
98
+ method?.toUpperCase() !== "GET" &&
99
+ method?.toUpperCase() !== "HEAD") ||
90
100
  ((response.status === 301 || response.status === 302) &&
91
101
  method?.toUpperCase() === "POST")
92
102
  ) {
93
103
  method = "GET";
94
104
  body = undefined;
105
+ baseHeaders.delete("content-encoding");
106
+ baseHeaders.delete("content-language");
107
+ baseHeaders.delete("content-location");
95
108
  baseHeaders.delete("content-type");
109
+ baseHeaders.delete("content-length");
96
110
  }
97
111
  await response.body?.cancel();
98
112
  currentUrl = nextUrl;
99
113
  }
100
114
  } finally {
101
- await dispatcher?.close();
115
+ await Promise.all([...dispatchers.values()].map((agent) => agent.close()));
102
116
  }
103
117
  }
104
118
 
package/src/contract.ts CHANGED
@@ -5,7 +5,7 @@ import type { CodexToolProvider } from "./codex-runtime/types.js";
5
5
  export const WEB_SEARCH_TOOL_NAME = "web_run";
6
6
  export const WEB_SEARCH_UNSUPPORTED_MESSAGE =
7
7
  "web_run requires an OpenAI Codex-compatible Responses provider or /login openai-codex";
8
- export const DEFAULT_WEB_SEARCH_MODEL = "gpt-5.6-luna";
8
+ export const DEFAULT_WEB_SEARCH_MODEL = "gpt-6-luna";
9
9
  export const WEB_SEARCH_MAX_OUTPUT_TOKENS = 2_500;
10
10
  export const WEB_SEARCH_MAX_RESPONSE_BYTES = 8 * 1024 * 1024;
11
11