@oh-my-pi/pi-coding-agent 14.5.11 → 14.5.12
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 +26 -0
- package/package.json +7 -7
- package/src/export/html/template.generated.ts +1 -1
- package/src/export/html/template.js +15 -7
- package/src/ipy/gateway-coordinator.ts +2 -1
- package/src/prompts/tools/atom.md +3 -2
- package/src/prompts/tools/browser.md +61 -16
- package/src/session/agent-session.ts +2 -12
- package/src/tools/browser/attach.ts +175 -0
- package/src/tools/browser/launch.ts +554 -0
- package/src/tools/browser/readable.ts +90 -0
- package/src/tools/browser/registry.ts +417 -0
- package/src/tools/browser/render.ts +212 -0
- package/src/tools/browser/vm.ts +792 -0
- package/src/tools/browser.ts +249 -1568
- package/src/tools/plan-mode-guard.ts +27 -1
- package/src/tools/renderers.ts +2 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as path from "node:path";
|
|
1
2
|
import { resolveLocalUrlToPath } from "../internal-urls";
|
|
2
3
|
import type { ToolSession } from ".";
|
|
3
4
|
import { normalizeLocalScheme, resolveToCwd } from "./path-utils";
|
|
@@ -5,7 +6,7 @@ import { ToolError } from "./tool-errors";
|
|
|
5
6
|
|
|
6
7
|
const LOCAL_SCHEME_PREFIX = "local:";
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
function resolveRawPath(session: ToolSession, targetPath: string): string {
|
|
9
10
|
const normalized = normalizeLocalScheme(targetPath);
|
|
10
11
|
if (normalized.startsWith(LOCAL_SCHEME_PREFIX)) {
|
|
11
12
|
return resolveLocalUrlToPath(normalized, {
|
|
@@ -17,6 +18,31 @@ export function resolvePlanPath(session: ToolSession, targetPath: string): strin
|
|
|
17
18
|
return resolveToCwd(normalized, session.cwd);
|
|
18
19
|
}
|
|
19
20
|
|
|
21
|
+
/**
|
|
22
|
+
* Resolve a write/edit target to its absolute filesystem path.
|
|
23
|
+
*
|
|
24
|
+
* In plan mode, transparently redirects targets whose basename matches the
|
|
25
|
+
* plan file's basename (e.g. a bare `PLAN.md` or `./PLAN.md`) to the canonical
|
|
26
|
+
* plan file location at `state.planFilePath`. This lets `write` and `edit`
|
|
27
|
+
* accept the unqualified plan filename and have the change land at the
|
|
28
|
+
* session-scoped `local://PLAN.md` artifact instead of a stray cwd-relative
|
|
29
|
+
* file the plan-mode guard would otherwise reject.
|
|
30
|
+
*
|
|
31
|
+
* Outside plan mode (or when the basename does not match) this is a no-op.
|
|
32
|
+
*/
|
|
33
|
+
export function resolvePlanPath(session: ToolSession, targetPath: string): string {
|
|
34
|
+
const resolved = resolveRawPath(session, targetPath);
|
|
35
|
+
|
|
36
|
+
const state = session.getPlanModeState?.();
|
|
37
|
+
if (!state?.enabled) return resolved;
|
|
38
|
+
|
|
39
|
+
const planResolved = resolveRawPath(session, state.planFilePath);
|
|
40
|
+
if (resolved === planResolved) return resolved;
|
|
41
|
+
if (path.basename(resolved) !== path.basename(planResolved)) return resolved;
|
|
42
|
+
|
|
43
|
+
return planResolved;
|
|
44
|
+
}
|
|
45
|
+
|
|
20
46
|
export function enforcePlanModeWrite(
|
|
21
47
|
session: ToolSession,
|
|
22
48
|
targetPath: string,
|
package/src/tools/renderers.ts
CHANGED
|
@@ -14,6 +14,7 @@ import { askToolRenderer } from "./ask";
|
|
|
14
14
|
import { astEditToolRenderer } from "./ast-edit";
|
|
15
15
|
import { astGrepToolRenderer } from "./ast-grep";
|
|
16
16
|
import { bashToolRenderer } from "./bash";
|
|
17
|
+
import { browserToolRenderer } from "./browser/render";
|
|
17
18
|
import { calculatorToolRenderer } from "./calculator";
|
|
18
19
|
import { debugToolRenderer } from "./debug";
|
|
19
20
|
import { findToolRenderer } from "./find";
|
|
@@ -49,6 +50,7 @@ export const toolRenderers: Record<string, ToolRenderer> = {
|
|
|
49
50
|
ast_grep: astGrepToolRenderer as ToolRenderer,
|
|
50
51
|
ast_edit: astEditToolRenderer as ToolRenderer,
|
|
51
52
|
bash: bashToolRenderer as ToolRenderer,
|
|
53
|
+
browser: browserToolRenderer as ToolRenderer,
|
|
52
54
|
recipe: recipeToolRenderer as ToolRenderer,
|
|
53
55
|
debug: debugToolRenderer as ToolRenderer,
|
|
54
56
|
python: pythonToolRenderer as ToolRenderer,
|