@oh-my-pi/pi-coding-agent 14.5.12 → 14.5.13
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 +32 -0
- package/package.json +18 -10
- package/src/cli/jupyter-cli.ts +1 -1
- 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 +9 -0
- 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 +5 -41
- 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 +25 -14
- 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/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 +45 -31
- package/src/session/agent-session.ts +42 -42
- 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/executor.ts +5 -9
- package/src/tools/browser/launch.ts +22 -0
- 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 +12 -29
- 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/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/utils/markit.ts +15 -7
- package/src/utils/tools-manager.ts +5 -5
- package/src/web/search/index.ts +5 -5
- package/src/web/search/provider.ts +121 -39
- package/src/web/search/providers/gemini.ts +2 -2
- 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
|
|
|
@@ -129,7 +120,7 @@ export class BrowserTool implements AgentTool<typeof browserSchema, BrowserToolD
|
|
|
129
120
|
|
|
130
121
|
/** Restart browser to apply mode changes (e.g. headless toggle). Drops only headless browsers. */
|
|
131
122
|
async restartForModeChange(): Promise<void> {
|
|
132
|
-
await
|
|
123
|
+
await dropHeadlessTabs();
|
|
133
124
|
}
|
|
134
125
|
|
|
135
126
|
async execute(
|
|
@@ -216,10 +207,10 @@ export class BrowserTool implements AgentTool<typeof browserSchema, BrowserToolD
|
|
|
216
207
|
}),
|
|
217
208
|
);
|
|
218
209
|
const tab = result.tab;
|
|
219
|
-
const url = tab.
|
|
220
|
-
const title =
|
|
210
|
+
const url = tab.info.url;
|
|
211
|
+
const title = tab.info.title ?? "";
|
|
221
212
|
details.url = url;
|
|
222
|
-
details.viewport = tab.
|
|
213
|
+
details.viewport = tab.info.viewport;
|
|
223
214
|
const verb = result.created ? "Opened" : "Reused";
|
|
224
215
|
const lines = [
|
|
225
216
|
`${verb} tab ${JSON.stringify(name)} on ${describeBrowser(browser)}`,
|
|
@@ -258,16 +249,12 @@ export class BrowserTool implements AgentTool<typeof browserSchema, BrowserToolD
|
|
|
258
249
|
throw new ToolError("Missing required parameter 'code' for action 'run'.");
|
|
259
250
|
}
|
|
260
251
|
const tab = getTab(name);
|
|
261
|
-
if (
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
);
|
|
252
|
+
if (tab) {
|
|
253
|
+
details.browser = tab.browser.kind.kind;
|
|
254
|
+
details.url = tab.info.url;
|
|
265
255
|
}
|
|
266
|
-
details.browser = tab.browser.kind.kind;
|
|
267
|
-
details.url = tab.page.url();
|
|
268
256
|
|
|
269
|
-
const { displays, returnValue, screenshots } = await runInTab({
|
|
270
|
-
tab,
|
|
257
|
+
const { displays, returnValue, screenshots } = await runInTab(name, {
|
|
271
258
|
code: params.code,
|
|
272
259
|
timeoutMs,
|
|
273
260
|
signal,
|
|
@@ -330,7 +317,3 @@ function stringifyReturnValue(value: unknown): string {
|
|
|
330
317
|
return String(value);
|
|
331
318
|
}
|
|
332
319
|
}
|
|
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);
|