@springbrand/agent-runtime 0.2.0-alpha.24 → 0.2.0-alpha.25

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@springbrand/agent-runtime",
3
- "version": "0.2.0-alpha.24",
3
+ "version": "0.2.0-alpha.25",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "src",
@@ -83,6 +83,16 @@ function previewNote(base: string): string {
83
83
  "file:// cannot reach the workspace, and there is no other preview host — do not guess one.";
84
84
  }
85
85
 
86
+ function browserToolDescription(): string {
87
+ return "Run JavaScript against a live browser over the Chrome DevTools Protocol through the `cdp` connector. " +
88
+ "Each top-level `browser_execute` call is one-shot: it starts a fresh browser and closes it when the call returns. " +
89
+ "Never reuse a `targetId` or `sessionId` from an earlier browser_execute call. " +
90
+ "Create targets, attach, navigate, interact, inspect diagnostics, and capture screenshots within the same call. " +
91
+ "Use `cdp.spec()` to discover commands, `cdp.send({ method, params })` for target-scoped commands, " +
92
+ "and `cdp.attachToTarget({ targetId })` before page-scoped commands. " +
93
+ "Issue browser calls sequentially so the inspection can be replayed reliably.";
94
+ }
95
+
86
96
  /**
87
97
  * 把宿主的 Durable Object state、Worker Loader 和 Browser Run 绑定组装成浏览器执行 Port。
88
98
  *
@@ -121,7 +131,10 @@ export function createBrowserExecutionFactory(options: {
121
131
  if (!tool) {
122
132
  throw new Error("Upstream createBrowserTools did not return browser_execute");
123
133
  }
124
- const port = toCodeExecutionPort(tool, "browser_execute");
134
+ const port = {
135
+ ...toCodeExecutionPort(tool, "browser_execute"),
136
+ description: browserToolDescription(),
137
+ };
125
138
  if (!options.previewBaseUrl) return port;
126
139
  // 前置而不是追加:上游的 codemode 描述很长,缀在末尾的一句会被读丢 ——
127
140
  // 2026-08-13 手动冒烟里模型就没看见它,转而去猜 `file://` 和 `https://workspace.local/`。