@phi-code-admin/phi-code 0.76.2 → 0.76.4

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.
@@ -116,7 +116,15 @@ export default function browserExtension(pi: ExtensionAPI) {
116
116
  pi.registerTool({
117
117
  name: "browser_navigate",
118
118
  description:
119
- "Open a URL in a Camoufox tab. If `tabId` is omitted, a new tab is created. Returns the tab id, the final URL and the HTTP status when available.",
119
+ "Open a URL in a real anti-detect Firefox browser (Camoufox). " +
120
+ "Use this as the FIRST STEP whenever you need to interact with a page " +
121
+ "(click, fill a form, take a screenshot) or when a previous `fetch_url` " +
122
+ "returned empty/minimal content (sign that the page is JavaScript-rendered " +
123
+ "or behind bot protection like Cloudflare). " +
124
+ "Returns `tabId` to chain with `browser_extract` / `browser_snapshot` / " +
125
+ "`browser_click` / `browser_type` / `browser_screenshot` / `browser_scroll`. " +
126
+ "Slower than `fetch_url` (~3-5s boot on first call) — do not use for plain " +
127
+ "static HTML pages where `fetch_url` already works.",
120
128
  parameters: Type.Object({
121
129
  url: Type.String({ description: "Full URL (https://...)" }),
122
130
  tabId: Type.Optional(Type.String()),
@@ -140,7 +148,16 @@ export default function browserExtension(pi: ExtensionAPI) {
140
148
  pi.registerTool({
141
149
  name: "browser_extract",
142
150
  description:
143
- "Return the readable content of a page (Mozilla Readability under the hood). Works on SPA / JS-heavy sites. Pass either `tabId` (existing tab) or `url` (opens a fresh tab).",
151
+ "Extract readable text from a fully rendered page using Mozilla Readability. " +
152
+ "**PREFER THIS OVER `fetch_url`** when the target URL is: " +
153
+ "(1) a JavaScript SPA (React, Vue, Svelte, Next.js client-side, etc.), " +
154
+ "(2) behind Cloudflare / Akamai / PerimeterX bot protection, " +
155
+ "(3) a site where `fetch_url` returned the shell HTML only (title + empty body, " +
156
+ "or a noscript fallback). Also use this when you've already called " +
157
+ "`browser_navigate` and want the page content. " +
158
+ "Either pass `tabId` (continues in an existing tab) or `url` (opens a fresh " +
159
+ "tab and extracts in one call). Slower than `fetch_url` — keep `fetch_url` as " +
160
+ "the default for plain static pages, docs, blog posts, etc.",
144
161
  parameters: Type.Object({
145
162
  tabId: Type.Optional(Type.String()),
146
163
  url: Type.Optional(Type.String()),
@@ -163,7 +180,12 @@ export default function browserExtension(pi: ExtensionAPI) {
163
180
  pi.registerTool({
164
181
  name: "browser_screenshot",
165
182
  description:
166
- "Capture a screenshot of the current tab as a PNG. The image bytes are returned base64-encoded under `bytesBase64`.",
183
+ "Capture a PNG screenshot of an open tab. Use this whenever the user asks " +
184
+ "to *see* a page, when a visual proof is requested (e.g. \"show me what " +
185
+ "this looks like\", \"is the layout broken\", \"did the bot detection page " +
186
+ "trigger?\"), or to confirm a UI state after `browser_click` / " +
187
+ "`browser_type`. Requires a `tabId` from a prior `browser_navigate`. " +
188
+ "Returns the image as base64 under `bytesBase64` with `mimeType: image/png`.",
167
189
  parameters: Type.Object({
168
190
  tabId: Type.String(),
169
191
  fullPage: Type.Optional(Type.Boolean()),
@@ -179,7 +201,14 @@ export default function browserExtension(pi: ExtensionAPI) {
179
201
  pi.registerTool({
180
202
  name: "browser_search",
181
203
  description:
182
- "Run a web search through the Camoufox browser (anti-detect Firefox) and return the readability extraction of the results page. Useful when scraping Google directly is rate-limited.",
204
+ "Search the web *through* a real anti-detect Firefox browser, then return " +
205
+ "the readability extraction of the results page. " +
206
+ "**Fallback for `web_search`** — use this only when `web_search` " +
207
+ "rate-limited, returned a CAPTCHA / 429 / 403, or you specifically need " +
208
+ "the rendered search engine UI (e.g. featured snippets, knowledge cards, " +
209
+ "AI Overview boxes). Slower than `web_search` and requires the Camoufox " +
210
+ "browser to boot. Defaults to DuckDuckGo (least restrictive); pass " +
211
+ "`engine: \"google\"` only when you need Google-specific results.",
183
212
  parameters: Type.Object({
184
213
  query: Type.String(),
185
214
  engine: Type.Optional(
@@ -201,7 +230,15 @@ export default function browserExtension(pi: ExtensionAPI) {
201
230
  pi.registerTool({
202
231
  name: "browser_click",
203
232
  description:
204
- "Click an element. Pass either `ref` (returned by browser_snapshot) or `selector` (CSS).",
233
+ "Click an element on an open tab buttons, links, checkboxes, modal " +
234
+ "close icons, etc. Use this for any interactive workflow: accepting " +
235
+ "cookies, dismissing popups, opening menus, submitting forms (alongside " +
236
+ "`browser_type`), pagination, etc. Resolve the target with either " +
237
+ "`ref` (from `browser_snapshot`, semantically stable across renders — " +
238
+ "PREFERRED) or `selector` (CSS, fragile if the site changes). Requires " +
239
+ "a `tabId` from `browser_navigate`. No interactive equivalent exists in " +
240
+ "`fetch_url` / `web_search` — this tool is only available via the bundled " +
241
+ "browser.",
205
242
  parameters: Type.Object({
206
243
  tabId: Type.String(),
207
244
  ref: Type.Optional(Type.String()),
@@ -225,7 +262,13 @@ export default function browserExtension(pi: ExtensionAPI) {
225
262
  pi.registerTool({
226
263
  name: "browser_type",
227
264
  description:
228
- "Type text into an element. Pass `ref` or `selector` to target a specific input; otherwise types into the currently focused element. Set `pressEnter: true` to submit a form.",
265
+ "Type text into an input or contenteditable on an open tab search boxes, " +
266
+ "login forms, chat composers, etc. Target with `ref` (PREFERRED, from " +
267
+ "`browser_snapshot`) or `selector` (CSS). Without either, types into the " +
268
+ "currently focused element. Set `pressEnter: true` to submit a form / " +
269
+ "trigger a search. Combine with `browser_click` for full form workflows " +
270
+ "(click field → type → click submit). No equivalent in `fetch_url` or " +
271
+ "`web_search`.",
229
272
  parameters: Type.Object({
230
273
  tabId: Type.String(),
231
274
  text: Type.String(),
@@ -245,7 +288,12 @@ export default function browserExtension(pi: ExtensionAPI) {
245
288
  pi.registerTool({
246
289
  name: "browser_scroll",
247
290
  description:
248
- "Scroll the page (or a specific element by `ref`) by `pixels` in the given direction.",
291
+ "Scroll an open tab to reveal more content. Essential for infinite-scroll " +
292
+ "feeds (Twitter/X, Reddit, news sites, e-commerce listings), lazy-loaded " +
293
+ "images, and dropdowns inside scrollable containers. Defaults to scrolling " +
294
+ "the page; pass `ref` to scroll inside a specific element. After scrolling, " +
295
+ "re-run `browser_snapshot` or `browser_extract` to see the newly loaded " +
296
+ "content.",
249
297
  parameters: Type.Object({
250
298
  tabId: Type.String(),
251
299
  direction: Type.Union([
@@ -268,7 +316,13 @@ export default function browserExtension(pi: ExtensionAPI) {
268
316
  pi.registerTool({
269
317
  name: "browser_snapshot",
270
318
  description:
271
- "Return the accessibility tree for the current tab. Each node carries a `ref` that can be passed back to browser_click / browser_type / browser_scroll. Cheaper than parsing HTML.",
319
+ "Return the accessibility tree of the current tab a structured outline of " +
320
+ "every interactive element (links, buttons, inputs, headings) with a stable " +
321
+ "`ref` you can pass back to `browser_click` / `browser_type` / " +
322
+ "`browser_scroll`. **Use this BEFORE clicking or typing** to discover the " +
323
+ "`ref` of the target element — much more reliable than guessing CSS " +
324
+ "selectors. Lighter and more semantic than raw HTML. " +
325
+ "Requires a `tabId` from `browser_navigate`.",
272
326
  parameters: Type.Object({
273
327
  tabId: Type.String(),
274
328
  }),
@@ -282,7 +336,11 @@ export default function browserExtension(pi: ExtensionAPI) {
282
336
  // ─── browser_close_tab ────────────────────────────────────────────
283
337
  pi.registerTool({
284
338
  name: "browser_close_tab",
285
- description: "Close a single tab. The browser process stays warm.",
339
+ description:
340
+ "Close a single browser tab once you no longer need it. " +
341
+ "**Always call this at the end of a browsing workflow** to free memory — " +
342
+ "a Camoufox tab can hold 50-200 MB. The underlying Firefox process stays " +
343
+ "warm for the next `browser_navigate`, so this is cheap (no re-boot cost).",
286
344
  parameters: Type.Object({
287
345
  tabId: Type.String(),
288
346
  }),
@@ -296,7 +354,11 @@ export default function browserExtension(pi: ExtensionAPI) {
296
354
  // ─── browser_list_tabs ────────────────────────────────────────────
297
355
  pi.registerTool({
298
356
  name: "browser_list_tabs",
299
- description: "List open tabs for the current user.",
357
+ description:
358
+ "List all open tabs in the current browser session with their URL, title, " +
359
+ "and `tabId`. Use this to recover a `tabId` if you lost track of which tab " +
360
+ "holds which page (e.g. across multi-step workflows that opened several " +
361
+ "tabs). Cheap — no Firefox interaction required.",
300
362
  parameters: Type.Object({
301
363
  userId: Type.Optional(Type.String()),
302
364
  }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phi-code-admin/phi-code",
3
- "version": "0.76.2",
3
+ "version": "0.76.4",
4
4
  "description": "Coding agent CLI with persistent memory, sub-agents, intelligent routing, and orchestration",
5
5
  "type": "module",
6
6
  "piConfig": {
@@ -47,7 +47,7 @@
47
47
  },
48
48
  "dependencies": {
49
49
  "@mariozechner/jiti": "^2.6.5",
50
- "@phi-code-admin/browser": "^1.0.1",
50
+ "@phi-code-admin/browser": "^1.0.2",
51
51
  "@silvia-odwyer/photon-node": "^0.3.4",
52
52
  "chalk": "^5.5.0",
53
53
  "cli-highlight": "^2.1.11",