@oh-my-pi/pi-coding-agent 14.5.12 → 14.5.14
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 +45 -0
- package/package.json +18 -10
- package/src/cli/jupyter-cli.ts +1 -1
- package/src/commit/pipeline.ts +4 -3
- package/src/config/model-equivalence.ts +49 -16
- package/src/config/model-registry.ts +100 -25
- package/src/config/model-resolver.ts +29 -15
- package/src/config/settings-schema.ts +20 -6
- package/src/config/settings.ts +9 -8
- package/src/config.ts +18 -6
- package/src/eval/backend.ts +43 -0
- package/src/eval/eval.lark +43 -0
- package/src/eval/index.ts +5 -0
- package/src/eval/js/context-manager.ts +717 -0
- package/src/eval/js/executor.ts +131 -0
- package/src/eval/js/index.ts +46 -0
- package/src/eval/js/prelude.ts +2 -0
- package/src/eval/js/prelude.txt +84 -0
- package/src/eval/js/tool-bridge.ts +124 -0
- package/src/eval/parse.ts +337 -0
- package/src/{ipy → eval/py}/executor.ts +2 -180
- package/src/{ipy → eval/py}/gateway-coordinator.ts +2 -2
- package/src/eval/py/index.ts +58 -0
- package/src/{ipy → eval/py}/kernel.ts +9 -45
- package/src/{ipy → eval/py}/prelude.py +39 -227
- package/src/eval/types.ts +48 -0
- package/src/export/html/template.generated.ts +1 -1
- package/src/export/html/template.js +8 -10
- package/src/extensibility/extensions/types.ts +2 -3
- package/src/internal-urls/docs-index.generated.ts +5 -5
- package/src/lsp/client.ts +9 -0
- package/src/lsp/index.ts +395 -0
- package/src/lsp/types.ts +15 -4
- package/src/main.ts +35 -14
- package/src/mcp/manager.ts +22 -0
- package/src/mcp/oauth-flow.ts +1 -1
- package/src/memories/index.ts +1 -1
- package/src/modes/acp/acp-event-mapper.ts +1 -1
- package/src/modes/components/{python-execution.ts → eval-execution.ts} +11 -4
- package/src/modes/components/login-dialog.ts +1 -1
- package/src/modes/components/oauth-selector.ts +2 -1
- package/src/modes/components/tool-execution.ts +3 -4
- package/src/modes/controllers/command-controller.ts +28 -8
- package/src/modes/controllers/input-controller.ts +4 -4
- package/src/modes/controllers/selector-controller.ts +2 -1
- package/src/modes/interactive-mode.ts +4 -5
- package/src/modes/rpc/rpc-client.ts +9 -0
- package/src/modes/rpc/rpc-mode.ts +6 -0
- package/src/modes/rpc/rpc-types.ts +9 -0
- package/src/modes/types.ts +3 -3
- package/src/modes/utils/ui-helpers.ts +2 -2
- package/src/prompts/system/system-prompt.md +3 -3
- package/src/prompts/tools/eval.md +92 -0
- package/src/prompts/tools/lsp.md +7 -3
- package/src/sdk.ts +64 -35
- package/src/session/agent-session.ts +152 -46
- package/src/session/messages.ts +1 -1
- package/src/slash-commands/builtin-registry.ts +1 -1
- package/src/system-prompt.ts +34 -66
- package/src/task/agents.ts +4 -5
- package/src/task/executor.ts +5 -9
- package/src/tools/archive-reader.ts +9 -3
- package/src/tools/browser/launch.ts +22 -0
- package/src/tools/browser/readable.ts +11 -6
- package/src/tools/browser/registry.ts +25 -244
- package/src/tools/browser/render.ts +1 -1
- package/src/tools/browser/tab-protocol.ts +101 -0
- package/src/tools/browser/tab-supervisor.ts +429 -0
- package/src/tools/browser/tab-worker-entry.ts +21 -0
- package/src/tools/browser/tab-worker.ts +1006 -0
- package/src/tools/browser.ts +17 -32
- package/src/tools/checkpoint.ts +2 -2
- package/src/tools/{python.ts → eval.ts} +324 -315
- package/src/tools/exit-plan-mode.ts +1 -1
- package/src/tools/image-gen.ts +2 -2
- package/src/tools/index.ts +62 -100
- package/src/tools/read.ts +0 -6
- package/src/tools/recipe/runners/pkg.ts +34 -32
- package/src/tools/renderers.ts +2 -2
- package/src/tools/resolve.ts +7 -2
- package/src/tools/todo-write.ts +0 -1
- package/src/tools/tool-timeouts.ts +2 -2
- package/src/tools/write.ts +8 -1
- package/src/utils/markit.ts +15 -7
- package/src/utils/tools-manager.ts +5 -5
- package/src/web/scrapers/crossref.ts +3 -3
- package/src/web/scrapers/devto.ts +1 -1
- package/src/web/scrapers/discourse.ts +5 -5
- package/src/web/scrapers/firefox-addons.ts +1 -1
- package/src/web/scrapers/flathub.ts +2 -2
- package/src/web/scrapers/gitlab.ts +1 -1
- package/src/web/scrapers/go-pkg.ts +2 -2
- package/src/web/scrapers/jetbrains-marketplace.ts +1 -1
- package/src/web/scrapers/mastodon.ts +9 -9
- package/src/web/scrapers/mdn.ts +11 -7
- package/src/web/scrapers/pub-dev.ts +1 -1
- package/src/web/scrapers/rawg.ts +3 -3
- package/src/web/scrapers/readthedocs.ts +1 -1
- package/src/web/scrapers/spdx.ts +1 -1
- package/src/web/scrapers/stackoverflow.ts +2 -2
- package/src/web/scrapers/types.ts +53 -39
- package/src/web/scrapers/w3c.ts +1 -1
- package/src/web/search/index.ts +5 -5
- package/src/web/search/provider.ts +121 -39
- package/src/web/search/providers/gemini.ts +4 -4
- package/src/web/search/render.ts +2 -2
- package/src/ipy/modules.ts +0 -144
- package/src/prompts/tools/python.md +0 -57
- package/src/tools/browser/vm.ts +0 -792
- /package/src/{ipy → eval/py}/cancellation.ts +0 -0
- /package/src/{ipy → eval/py}/prelude.ts +0 -0
- /package/src/{ipy → eval/py}/runtime.ts +0 -0
package/src/tools/browser.ts
CHANGED
|
@@ -4,18 +4,9 @@ import { prompt, untilAborted } from "@oh-my-pi/pi-utils";
|
|
|
4
4
|
import { type Static, Type } from "@sinclair/typebox";
|
|
5
5
|
import browserDescription from "../prompts/tools/browser.md" with { type: "text" };
|
|
6
6
|
import type { ToolSession } from "../sdk";
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
type BrowserHandle,
|
|
11
|
-
type BrowserKind,
|
|
12
|
-
type BrowserKindTag,
|
|
13
|
-
dropHeadlessBrowsers,
|
|
14
|
-
getTab,
|
|
15
|
-
releaseAllTabs,
|
|
16
|
-
releaseTab,
|
|
17
|
-
} from "./browser/registry";
|
|
18
|
-
import { collectObservation, formatObservation, type Observation, runInTab, type ScreenshotResult } from "./browser/vm";
|
|
7
|
+
import { acquireBrowser, type BrowserHandle, type BrowserKind, type BrowserKindTag } from "./browser/registry";
|
|
8
|
+
import type { Observation, ScreenshotResult } from "./browser/tab-protocol";
|
|
9
|
+
import { acquireTab, dropHeadlessTabs, getTab, releaseAllTabs, releaseTab, runInTab } from "./browser/tab-supervisor";
|
|
19
10
|
import type { OutputMeta } from "./output-meta";
|
|
20
11
|
import { resolveToCwd } from "./path-utils";
|
|
21
12
|
import { ToolAbortError, ToolError, throwIfAborted } from "./tool-errors";
|
|
@@ -23,7 +14,7 @@ import { toolResult } from "./tool-result";
|
|
|
23
14
|
import { clampTimeout } from "./tool-timeouts";
|
|
24
15
|
|
|
25
16
|
export { extractReadableFromHtml, type ReadableFormat, type ReadableResult } from "./browser/readable";
|
|
26
|
-
export type { Observation, ObservationEntry } from "./browser/
|
|
17
|
+
export type { Observation, ObservationEntry } from "./browser/tab-protocol";
|
|
27
18
|
|
|
28
19
|
const DEFAULT_TAB_NAME = "main";
|
|
29
20
|
|
|
@@ -119,17 +110,19 @@ function resolveBrowserKind(params: BrowserParams, session: ToolSession): Browse
|
|
|
119
110
|
export class BrowserTool implements AgentTool<typeof browserSchema, BrowserToolDetails> {
|
|
120
111
|
readonly name = "browser";
|
|
121
112
|
readonly label = "Browser";
|
|
122
|
-
readonly description: string;
|
|
123
113
|
readonly parameters = browserSchema;
|
|
124
114
|
readonly strict = true;
|
|
125
115
|
|
|
126
|
-
constructor(private readonly session: ToolSession) {
|
|
127
|
-
|
|
116
|
+
constructor(private readonly session: ToolSession) {}
|
|
117
|
+
#description?: string;
|
|
118
|
+
get description(): string {
|
|
119
|
+
this.#description ??= prompt.render(browserDescription, {});
|
|
120
|
+
return this.#description;
|
|
128
121
|
}
|
|
129
122
|
|
|
130
123
|
/** Restart browser to apply mode changes (e.g. headless toggle). Drops only headless browsers. */
|
|
131
124
|
async restartForModeChange(): Promise<void> {
|
|
132
|
-
await
|
|
125
|
+
await dropHeadlessTabs();
|
|
133
126
|
}
|
|
134
127
|
|
|
135
128
|
async execute(
|
|
@@ -216,10 +209,10 @@ export class BrowserTool implements AgentTool<typeof browserSchema, BrowserToolD
|
|
|
216
209
|
}),
|
|
217
210
|
);
|
|
218
211
|
const tab = result.tab;
|
|
219
|
-
const url = tab.
|
|
220
|
-
const title =
|
|
212
|
+
const url = tab.info.url;
|
|
213
|
+
const title = tab.info.title ?? "";
|
|
221
214
|
details.url = url;
|
|
222
|
-
details.viewport = tab.
|
|
215
|
+
details.viewport = tab.info.viewport;
|
|
223
216
|
const verb = result.created ? "Opened" : "Reused";
|
|
224
217
|
const lines = [
|
|
225
218
|
`${verb} tab ${JSON.stringify(name)} on ${describeBrowser(browser)}`,
|
|
@@ -258,16 +251,12 @@ export class BrowserTool implements AgentTool<typeof browserSchema, BrowserToolD
|
|
|
258
251
|
throw new ToolError("Missing required parameter 'code' for action 'run'.");
|
|
259
252
|
}
|
|
260
253
|
const tab = getTab(name);
|
|
261
|
-
if (
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
);
|
|
254
|
+
if (tab) {
|
|
255
|
+
details.browser = tab.browser.kind.kind;
|
|
256
|
+
details.url = tab.info.url;
|
|
265
257
|
}
|
|
266
|
-
details.browser = tab.browser.kind.kind;
|
|
267
|
-
details.url = tab.page.url();
|
|
268
258
|
|
|
269
|
-
const { displays, returnValue, screenshots } = await runInTab({
|
|
270
|
-
tab,
|
|
259
|
+
const { displays, returnValue, screenshots } = await runInTab(name, {
|
|
271
260
|
code: params.code,
|
|
272
261
|
timeoutMs,
|
|
273
262
|
signal,
|
|
@@ -330,7 +319,3 @@ function stringifyReturnValue(value: unknown): string {
|
|
|
330
319
|
return String(value);
|
|
331
320
|
}
|
|
332
321
|
}
|
|
333
|
-
|
|
334
|
-
// Re-export collectObservation so external callers (e.g. tests) can use it without
|
|
335
|
-
// reaching into the browser/ subdirectory.
|
|
336
|
-
export { collectObservation, formatObservation };
|
package/src/tools/checkpoint.ts
CHANGED
|
@@ -52,7 +52,7 @@ export class CheckpointTool implements AgentTool<typeof checkpointSchema, Checkp
|
|
|
52
52
|
readonly description: string;
|
|
53
53
|
readonly parameters = checkpointSchema;
|
|
54
54
|
readonly strict = true;
|
|
55
|
-
readonly intent = (args: Partial<CheckpointParams>) => args.goal;
|
|
55
|
+
readonly intent = (args: Partial<CheckpointParams>) => (args.goal ? `checkpointing: ${args.goal}` : "checkpointing");
|
|
56
56
|
|
|
57
57
|
constructor(private readonly session: ToolSession) {
|
|
58
58
|
this.description = prompt.render(checkpointDescription);
|
|
@@ -95,7 +95,7 @@ export class RewindTool implements AgentTool<typeof rewindSchema, RewindToolDeta
|
|
|
95
95
|
readonly description: string;
|
|
96
96
|
readonly parameters = rewindSchema;
|
|
97
97
|
readonly strict = true;
|
|
98
|
-
readonly intent = (): string => "
|
|
98
|
+
readonly intent = (): string => "rewinding";
|
|
99
99
|
|
|
100
100
|
constructor(private readonly session: ToolSession) {
|
|
101
101
|
this.description = prompt.render(rewindDescription);
|