Skip to content

Commit 95cbc63

Browse files
committed
browser_execute: add harness zone map to tool description
Tells the agent up front: edit only under agent-workspace/ (those edits persist), everything else gets overwritten on upgrade, and previous trees are kept at <harness-archive>/<old-build>/ for reference. One short paragraph; the description still defers all workflow guidance to SKILL.md. Templates {{HARNESS_ARCHIVE_DIR}} alongside {{HARNESS_DIR}}; both substituted in the opencode adapter from BrowserExecute.make().
1 parent ec490ca commit 95cbc63

3 files changed

Lines changed: 9 additions & 5 deletions

File tree

packages/bcode-browser/src/browser-execute.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import os from "os"
2828
import path from "path"
2929
import { Effect, Schema, Stream } from "effect"
3030
import { ChildProcess, ChildProcessSpawner } from "effect/unstable/process"
31-
import { resolveHarnessDir } from "./harness"
31+
import { harnessArchiveDir, resolveHarnessDir } from "./harness"
3232
import { uvLocate } from "./uv-locate"
3333

3434
// Per-session persistent scratch under <dataDir>/sessions/<sid>/. Holds
@@ -157,7 +157,7 @@ export const make = Effect.fn("BrowserExecute.make")(function* (dataDir: string)
157157
}),
158158
)
159159

160-
return { parameters, execute, harnessDir }
160+
return { parameters, execute, harnessDir, harnessArchiveDir: harnessArchiveDir(dataDir) }
161161
})
162162

163163
export * as BrowserExecute from "./browser-execute"

packages/opencode/src/tool/browser-execute.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@ export const BrowserExecuteTool = Tool.define(
1818
const impl = yield* BrowserExecute.make(Global.Path.data)
1919
return {
2020
// Substitute the resolved harness path (dev: repo path; compiled:
21-
// <dataDir>/harness/) so the SKILL.md / helpers.py references in the
22-
// description point at files that actually exist on disk.
23-
description: DESCRIPTION.replaceAll("{{HARNESS_DIR}}", impl.harnessDir),
21+
// <dataDir>/harness/) and the archive path so the SKILL.md / helpers.py
22+
// / archive references in the description point at concrete locations.
23+
description: DESCRIPTION
24+
.replaceAll("{{HARNESS_DIR}}", impl.harnessDir)
25+
.replaceAll("{{HARNESS_ARCHIVE_DIR}}", impl.harnessArchiveDir),
2426
parameters: impl.parameters,
2527
execute: (args: Schema.Schema.Type<typeof impl.parameters>, ctx: Tool.Context) =>
2628
Effect.gen(function* () {

packages/opencode/src/tool/browser-execute.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,6 @@ Use this tool whenever the task requires driving a real browser — automation,
44

55
Before the first `browser_execute` call of a session, you MUST read `{{HARNESS_DIR}}/SKILL.md`. It defines the helper surface, the screenshot-driven workflow, remote-browser setup, and gotchas — none of that is repeated here.
66

7+
Edits persist only under `{{HARNESS_DIR}}/agent-workspace/`. Everything else is overwritten on bcode upgrade; previous trees are kept at `{{HARNESS_ARCHIVE_DIR}}/<old-build>/` for migration reference.
8+
79
Optional: read `{{HARNESS_DIR}}/src/browser_harness/helpers.py` when you need an exact signature that SKILL.md does not show.

0 commit comments

Comments
 (0)