@howaboua/pi-codex-web-run 0.0.1 → 0.0.2
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 +4 -1
- package/LICENSE +1 -1
- package/README.md +2 -2
- package/index.ts +2 -7
- package/package.json +3 -10
- package/src/codex-runtime/policy.ts +3 -22
- package/src/codex-runtime/resolve.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
# @howaboua/pi-codex-web-run
|
|
2
2
|
|
|
3
|
+
## 0.0.2
|
|
4
|
+
|
|
5
|
+
- Fixed Codex web search and image generation to use local Codex authentication on unrelated chat providers while preserving explicit Codex routes and optional Pi Codex integration. Removed Pi Codex package dependencies.
|
|
6
|
+
|
|
3
7
|
## 0.0.1
|
|
4
8
|
|
|
5
9
|
- Initial release of Web Run for Codex web search and page navigation in normal Pi, Code Mode, and Notebook Mode.
|
|
6
10
|
|
|
7
11
|
- Search the web or images, open results, follow links, and find text while retaining reusable source references.
|
|
8
12
|
- Use stock, renamed, or proxied Codex providers through a small JSON route file.
|
|
9
|
-
|
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -8,9 +8,9 @@ Codex web search, page opening, link traversal, and in-page finding for ordinary
|
|
|
8
8
|
|
|
9
9
|
Requires Pi 0.84.4 or newer and Node.js 22.19 or newer.
|
|
10
10
|
|
|
11
|
-
Run `/login openai-codex` for the normal Codex route
|
|
11
|
+
Run `/login openai-codex` for the normal Codex route, including when chatting with another provider. Compatible active Codex transports keep their own credentials. Pi Codex's resolver is preferred when present, but its conversation-provider scope does not select tool endpoints. Neither Pi Codex nor an install script is required.
|
|
12
12
|
|
|
13
|
-
Pi Codex 3.0.
|
|
13
|
+
Pi Codex 3.0.25 or newer is optional. With it installed, the normal web_run tool becomes tools.web__run inside Code and Notebook Mode.
|
|
14
14
|
|
|
15
15
|
## Use
|
|
16
16
|
|
package/index.ts
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
2
2
|
import registerPackageChangelog from "./changelog.js";
|
|
3
3
|
import { webRunCodeModeResult } from "./src/code-mode.js";
|
|
4
|
-
import {
|
|
5
|
-
isConfiguredCodexToolProvider,
|
|
6
|
-
resolveHostedCodexToolProvider,
|
|
7
|
-
} from "./src/codex-runtime/policy.js";
|
|
4
|
+
import { resolveHostedCodexToolProvider } from "./src/codex-runtime/policy.js";
|
|
8
5
|
import { createWebSearchTool } from "./src/tool.js";
|
|
9
6
|
|
|
10
7
|
const CODE_MODE_PACKAGE = "@howaboua/pi-codex-conversion";
|
|
@@ -18,8 +15,6 @@ export default async function webRunExtension(pi: ExtensionAPI): Promise<void> {
|
|
|
18
15
|
registerPackageChangelog(pi);
|
|
19
16
|
const tool = createWebSearchTool("web_run", {
|
|
20
17
|
allowCodexProviderFallback: true,
|
|
21
|
-
allowConfiguredProvider: (model) =>
|
|
22
|
-
isConfiguredCodexToolProvider(pi, model),
|
|
23
18
|
resolveProvider: (ctx) => resolveHostedCodexToolProvider(pi, ctx),
|
|
24
19
|
promptSnippet: false,
|
|
25
20
|
});
|
|
@@ -34,7 +29,7 @@ async function registerWebRunInCodeMode(
|
|
|
34
29
|
) {
|
|
35
30
|
try {
|
|
36
31
|
const { adaptToolForCodeMode, registerCodeModeExtensionTools } =
|
|
37
|
-
await import(
|
|
32
|
+
await import(CODE_MODE_MODULE);
|
|
38
33
|
return registerCodeModeExtensionTools(pi, () => [
|
|
39
34
|
adaptToolForCodeMode(tool, {
|
|
40
35
|
usage:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@howaboua/pi-codex-web-run",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"description": "Codex web search and navigation for Pi, Code Mode and Notebook Mode.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -47,21 +47,14 @@
|
|
|
47
47
|
"undici": "8.10.0"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@howaboua/pi-codex-conversion": ">=3.0.24",
|
|
51
50
|
"@earendil-works/pi-coding-agent": ">=0.84.4",
|
|
52
51
|
"@earendil-works/pi-tui": ">=0.84.4",
|
|
53
52
|
"typebox": "*"
|
|
54
53
|
},
|
|
55
|
-
"peerDependenciesMeta": {
|
|
56
|
-
"@howaboua/pi-codex-conversion": {
|
|
57
|
-
"optional": true
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
54
|
"devDependencies": {
|
|
61
|
-
"@howaboua/pi-codex-conversion": "3.0.24",
|
|
62
55
|
"@biomejs/biome": "^2.5.10",
|
|
63
|
-
"@earendil-works/pi-coding-agent": "0.
|
|
64
|
-
"@earendil-works/pi-tui": "0.
|
|
56
|
+
"@earendil-works/pi-coding-agent": "0.85.0",
|
|
57
|
+
"@earendil-works/pi-tui": "0.85.0",
|
|
65
58
|
"@types/node": "^26.2.0",
|
|
66
59
|
"tsx": "^4.23.12",
|
|
67
60
|
"typebox": "1.3.18",
|
|
@@ -3,36 +3,16 @@ import type {
|
|
|
3
3
|
ExtensionContext,
|
|
4
4
|
} from "@earendil-works/pi-coding-agent";
|
|
5
5
|
import type { CodexToolProviderResolver } from "../contract.js";
|
|
6
|
+
import { resolveAuthModel } from "./resolve.js";
|
|
6
7
|
import type { CodexToolProvider } from "./types.js";
|
|
7
8
|
|
|
8
|
-
const CONFIGURED_PROVIDER_CHANNEL =
|
|
9
|
-
"@howaboua/pi-codex-conversion.configured-provider/v1";
|
|
10
9
|
const PROVIDER_RESOLVER_CHANNEL =
|
|
11
10
|
"@howaboua/pi-codex-conversion.provider-resolver/v1";
|
|
12
11
|
|
|
13
|
-
interface ConfiguredProviderRequest {
|
|
14
|
-
model: ExtensionContext["model"];
|
|
15
|
-
allow(): void;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
12
|
interface ProviderResolverRequest {
|
|
19
13
|
use(resolver: CodexToolProviderResolver): void;
|
|
20
14
|
}
|
|
21
15
|
|
|
22
|
-
export function isConfiguredCodexToolProvider(
|
|
23
|
-
pi: ExtensionAPI,
|
|
24
|
-
model: ExtensionContext["model"],
|
|
25
|
-
): boolean {
|
|
26
|
-
let allowed = false;
|
|
27
|
-
pi.events.emit(CONFIGURED_PROVIDER_CHANNEL, {
|
|
28
|
-
model,
|
|
29
|
-
allow() {
|
|
30
|
-
allowed = true;
|
|
31
|
-
},
|
|
32
|
-
} satisfies ConfiguredProviderRequest);
|
|
33
|
-
return allowed;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
16
|
export async function resolveHostedCodexToolProvider(
|
|
37
17
|
pi: ExtensionAPI,
|
|
38
18
|
ctx: ExtensionContext,
|
|
@@ -43,5 +23,6 @@ export async function resolveHostedCodexToolProvider(
|
|
|
43
23
|
resolver ??= candidate;
|
|
44
24
|
},
|
|
45
25
|
} satisfies ProviderResolverRequest);
|
|
46
|
-
|
|
26
|
+
// Conversation-provider opt-ins do not advertise Codex tool endpoints.
|
|
27
|
+
return resolver?.({ ...ctx, model: resolveAuthModel(ctx) });
|
|
47
28
|
}
|
|
@@ -101,7 +101,7 @@ function resolveOpenAICodexAuthModel(
|
|
|
101
101
|
);
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
function resolveAuthModel(
|
|
104
|
+
export function resolveAuthModel(
|
|
105
105
|
ctx: ExtensionContext,
|
|
106
106
|
allowConfiguredProvider?: AllowConfiguredCodexToolProvider,
|
|
107
107
|
isConfiguredCodexTransport?: AllowConfiguredCodexToolProvider,
|