@howaboua/pi-browser 0.0.10 → 0.0.11

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 CHANGED
@@ -1,5 +1,10 @@
1
1
  # @howaboua/pi-browser
2
2
 
3
+ ## 0.0.11
4
+
5
+ - - Browser calls in Code and Notebook now return objects instead of JSON strings.
6
+ - GPT mode uses note-style browser help.
7
+
3
8
  ## 0.0.10
4
9
 
5
10
  - Use denser browser help in PCC GPT prompt mode.
@@ -29,14 +34,12 @@
29
34
  ## 0.0.5
30
35
 
31
36
  - Browser snapshots now include link destinations.
32
-
33
37
  - Browser help and schemas now describe single-action requests, shared batch fields and JSON results with less repetition.
34
38
  - Click errors now identify zero-sized browser viewports.
35
39
 
36
40
  ## 0.0.4
37
41
 
38
42
  - Added session-owned background browser work and direct form controls.
39
-
40
43
  - Fill or clear fields, select options, and set checkbox states, including indeterminate checkboxes.
41
44
  - Press keys and shortcuts on the focused element.
42
45
  - Wait for an element, page text, or URL with cancellation and a bounded timeout.
@@ -51,13 +54,11 @@
51
54
  ## 0.0.2
52
55
 
53
56
  - Keep tool results actionable.
54
-
55
57
  - Browser evaluation errors preserve JavaScript exception details instead of a generic “Uncaught”.
56
58
  - Skill path inventories omit installed dependencies; reference reads list only the requested sources instead of repeating the full inventory.
57
59
 
58
60
  ## 0.0.1
59
61
 
60
62
  - Initial release of Browser, a persistent typed CDP tool for normal Pi, Code Mode, and Notebook Mode.
61
-
62
63
  - Inspect existing browser tabs, follow references, find text, click, type, capture screenshots, and use raw CDP when needed.
63
64
  - Connect to local or configured remote hosts, with aliases and worker setup managed through `/browser`.
package/README.md CHANGED
@@ -19,9 +19,11 @@ Pi Codex 3.0.52 or newer is optional. Without it, Browser remains a normal top-l
19
19
  In normal Pi, call `browser` with `{}` for help, then send JSON request strings in `command`. Explicit `command: "help"` and existing object requests remain accepted. In Code or Notebook Mode, start with:
20
20
 
21
21
  ```js
22
- await tools.browser()
22
+ await tools.browser();
23
23
  ```
24
24
 
25
+ Code and Notebook calls return objects directly. Remove `JSON.parse` around browser results in saved code and helpers.
26
+
25
27
  All modes accept single-action and batched requests described by help. A common route is `tabs`, then `open`, then `click` or `type` with the returned `ref_id` and element ID.
26
28
 
27
29
  Long Code and Notebook calls use the normal `exec` and `wait` lifecycle. Cancellation stops pending CDP work, though an already dispatched browser mutation may still take effect.
package/biome.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://biomejs.dev/schemas/2.5.15/schema.json",
2
+ "$schema": "https://biomejs.dev/schemas/2.6.3/schema.json",
3
3
  "vcs": {
4
4
  "enabled": true,
5
5
  "clientKind": "git",
package/dist/index.js CHANGED
@@ -57,6 +57,7 @@ async function registerBrowserInCodeMode(pi, tool) {
57
57
  kind: "freeform",
58
58
  prepareInput: prepareBrowserInput,
59
59
  discovery: "help",
60
+ resultValue: (result) => result.details,
60
61
  }),
61
62
  ]);
62
63
  }
@@ -1732,13 +1732,13 @@ async function discardCachedResult(handle) {
1732
1732
  function browserHelp(hosts = [], gpt = false) {
1733
1733
  const routed = hosts.length > 0;
1734
1734
  return {
1735
- input: gpt ? "Request={action,...fields}; Pi {command:JSON.stringify(request)}; Code/Notebook JSON.stringify(request), JSON.parse(result)" : "Request={action,...fields}; Pi: {command:JSON.stringify(request)}; Code/Notebook: JSON.stringify(request), JSON.parse(result)",
1735
+ input: "{action,...fields}",
1736
1736
  ...routed ? {
1737
- host: `${hosts.join("|")}${gpt ? " optional; user-named host→retain every call+its refs/handles" : " optional; keep a user-named host on every call and its refs/handles"}`
1737
+ host: `${hosts.join("|")}${gpt ? " optional; user-named host→retain EVERY call+refs/handles" : " optional; keep a user-named host on every call and its refs/handles"}`
1738
1738
  } : {},
1739
- refs: "tabs -> open; keep ref_id/id/cursors with their result",
1740
- safety: gpt ? "Unfamiliar low-trust navigation/consequential action→ask first unless authorized; never close shared browser" : "Ask before unfamiliar low-trust navigation or consequential action unless authorized; never close shared browser",
1741
- batch: gpt ? "{action_name:[{...fields}],...}; arrays nonempty; items omit action; host/response_length at root; independent only" : "{action_name:[{...fields}],...}; nonempty arrays; items omit action; host/response_length at request root; independent only",
1739
+ refs: gpt ? "tabs→open; ref_id/id/cursors stay with result" : "tabs -> open; keep ref_id/id/cursors with their result",
1740
+ safety: gpt ? "Unfamiliar low-trust navigation/consequential action→ask UNLESS authorised; NEVER close shared browser" : "Ask before unfamiliar low-trust navigation or consequential action unless authorized; never close shared browser",
1741
+ batch: gpt ? "{action_name:[{...fields}],...}; nonempty arrays; omit item action; root host/response_length; independent ONLY" : "{action_name:[{...fields}],...}; nonempty arrays; items omit action; host/response_length at request root; independent only",
1742
1742
  actions: {
1743
1743
  help: "",
1744
1744
  tabs: "query? offset? owned_only? -> ref_id title url owned",
@@ -1,20 +1,20 @@
1
1
  export function browserHelp(hosts = [], gpt = false) {
2
2
  const routed = hosts.length > 0;
3
3
  return {
4
- input: gpt
5
- ? "Request={action,...fields}; Pi {command:JSON.stringify(request)}; Code/Notebook JSON.stringify(request), JSON.parse(result)"
6
- : "Request={action,...fields}; Pi: {command:JSON.stringify(request)}; Code/Notebook: JSON.stringify(request), JSON.parse(result)",
4
+ input: "{action,...fields}",
7
5
  ...(routed
8
6
  ? {
9
- host: `${hosts.join("|")}${gpt ? " optional; user-named host→retain every call+its refs/handles" : " optional; keep a user-named host on every call and its refs/handles"}`,
7
+ host: `${hosts.join("|")}${gpt ? " optional; user-named host→retain EVERY call+refs/handles" : " optional; keep a user-named host on every call and its refs/handles"}`,
10
8
  }
11
9
  : {}),
12
- refs: "tabs -> open; keep ref_id/id/cursors with their result",
10
+ refs: gpt
11
+ ? "tabs→open; ref_id/id/cursors stay with result"
12
+ : "tabs -> open; keep ref_id/id/cursors with their result",
13
13
  safety: gpt
14
- ? "Unfamiliar low-trust navigation/consequential action→ask first unless authorized; never close shared browser"
14
+ ? "Unfamiliar low-trust navigation/consequential action→ask UNLESS authorised; NEVER close shared browser"
15
15
  : "Ask before unfamiliar low-trust navigation or consequential action unless authorized; never close shared browser",
16
16
  batch: gpt
17
- ? "{action_name:[{...fields}],...}; arrays nonempty; items omit action; host/response_length at root; independent only"
17
+ ? "{action_name:[{...fields}],...}; nonempty arrays; omit item action; root host/response_length; independent ONLY"
18
18
  : "{action_name:[{...fields}],...}; nonempty arrays; items omit action; host/response_length at request root; independent only",
19
19
  actions: {
20
20
  help: "",
package/index.ts CHANGED
@@ -71,6 +71,7 @@ async function registerBrowserInCodeMode(
71
71
  kind: "freeform",
72
72
  prepareInput: prepareBrowserInput,
73
73
  discovery: "help",
74
+ resultValue: (result) => result.details,
74
75
  }),
75
76
  ]);
76
77
  } catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@howaboua/pi-browser",
3
- "version": "0.0.10",
3
+ "version": "0.0.11",
4
4
  "description": "Logged-in browser inspection and control for Pi, Code Mode and Notebook Mode.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -45,7 +45,7 @@
45
45
  "pack:dry": "npm pack --dry-run"
46
46
  },
47
47
  "peerDependencies": {
48
- "@howaboua/pi-codex-conversion": ">=4.0.3",
48
+ "@howaboua/pi-codex-conversion": ">=4.0.5",
49
49
  "@earendil-works/pi-ai": ">=1.0.0",
50
50
  "@earendil-works/pi-coding-agent": ">=1.0.0",
51
51
  "typebox": "*",
@@ -57,12 +57,12 @@
57
57
  }
58
58
  },
59
59
  "devDependencies": {
60
- "@howaboua/pi-codex-conversion": "4.0.3",
61
- "@biomejs/biome": "^2.5.15",
62
- "@earendil-works/pi-ai": "1.3.0",
63
- "@earendil-works/pi-coding-agent": "1.3.0",
60
+ "@howaboua/pi-codex-conversion": "4.0.5",
61
+ "@biomejs/biome": "^2.6.3",
62
+ "@earendil-works/pi-ai": "1.4.0",
63
+ "@earendil-works/pi-coding-agent": "1.4.0",
64
64
  "@types/node": "^26.6.5",
65
- "typebox": "1.3.37",
65
+ "typebox": "1.4.3",
66
66
  "typescript": "^7.0.2"
67
67
  },
68
68
  "pi": {
@@ -4,20 +4,20 @@ export function browserHelp(
4
4
  ): Record<string, unknown> {
5
5
  const routed = hosts.length > 0;
6
6
  return {
7
- input: gpt
8
- ? "Request={action,...fields}; Pi {command:JSON.stringify(request)}; Code/Notebook JSON.stringify(request), JSON.parse(result)"
9
- : "Request={action,...fields}; Pi: {command:JSON.stringify(request)}; Code/Notebook: JSON.stringify(request), JSON.parse(result)",
7
+ input: "{action,...fields}",
10
8
  ...(routed
11
9
  ? {
12
- host: `${hosts.join("|")}${gpt ? " optional; user-named host→retain every call+its refs/handles" : " optional; keep a user-named host on every call and its refs/handles"}`,
10
+ host: `${hosts.join("|")}${gpt ? " optional; user-named host→retain EVERY call+refs/handles" : " optional; keep a user-named host on every call and its refs/handles"}`,
13
11
  }
14
12
  : {}),
15
- refs: "tabs -> open; keep ref_id/id/cursors with their result",
13
+ refs: gpt
14
+ ? "tabs→open; ref_id/id/cursors stay with result"
15
+ : "tabs -> open; keep ref_id/id/cursors with their result",
16
16
  safety: gpt
17
- ? "Unfamiliar low-trust navigation/consequential action→ask first unless authorized; never close shared browser"
17
+ ? "Unfamiliar low-trust navigation/consequential action→ask UNLESS authorised; NEVER close shared browser"
18
18
  : "Ask before unfamiliar low-trust navigation or consequential action unless authorized; never close shared browser",
19
19
  batch: gpt
20
- ? "{action_name:[{...fields}],...}; arrays nonempty; items omit action; host/response_length at root; independent only"
20
+ ? "{action_name:[{...fields}],...}; nonempty arrays; omit item action; root host/response_length; independent ONLY"
21
21
  : "{action_name:[{...fields}],...}; nonempty arrays; items omit action; host/response_length at request root; independent only",
22
22
  actions: {
23
23
  help: "",