You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/app/service/agent/system_prompt.ts
+13-8Lines changed: 13 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -44,14 +44,19 @@ Detect when you are stuck and stop early:
44
44
- Keep responses concise — do not over-explain routine operations.
45
45
- When reporting extracted data or results, format them clearly (use lists or structured text).
46
46
47
-
## Built-in Tools
48
-
49
-
You have direct access to these tools (no skill loading needed):
50
-
- **web_fetch**: Fetch and extract content from a URL (HTML auto-extracted to readable text, JSON returned directly). Use for reading web pages, APIs, or downloading text content.
51
-
- **web_search**: Search the web for information. Returns results with title, URL, and snippet.
52
-
- **ask_user**: Ask the user a question and wait for their response. Use when you need clarification or a decision.
53
-
- **agent**: Spawn a sub-agent for complex independent subtasks. The sub-agent has its own context and can use web_fetch, web_search, task tools, skills, and MCP tools. It cannot interact with the user directly.
54
-
- **create_task / get_task / update_task / list_tasks**: Track multi-step work within this conversation. Tasks are in-memory only (not persisted across conversations).`;
- **Fetch remote data** → \`web_fetch\` for text/HTML/JSON. It does NOT support binary downloads — use a SkillScript with \`fetch()\` + \`CAT.agent.opfs.write(blob)\` for binary files.
51
+
- **Ask user** → \`ask_user\` supports text only. To show images to the user, use \`execute_script\` to display them on page.
52
+
53
+
## Binary File Workflow
54
+
55
+
OPFS workspace stores files persistently. Binary files (images, PDFs, etc.) should stay as file references — never put large binary data in your messages.
**Use**: \`opfs_read(path, format='bloburl')\` → returns \`blob:chrome-extension://\` URL → pass to \`execute_script(target='page', world='ISOLATED')\` which can \`fetch()\` the blob URL and manipulate page DOM
59
+
**Note**: Blob URLs are scoped to the extension origin. Only ISOLATED world (or Offscreen) can access them — MAIN world cannot.`;
Copy file name to clipboardExpand all lines: src/app/service/agent/tools/opfs_tools.ts
+2-1Lines changed: 2 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,8 @@ export { sanitizePath };
15
15
16
16
constOPFS_WRITE_DEFINITION: ToolDefinition={
17
17
name: "opfs_write",
18
-
description: "Write text content to a file in the workspace. Creates parent directories automatically.",
18
+
description:
19
+
"Write content to a file in the workspace. Supports text strings, Blob, and data URL (base64 auto-decoded to binary). Creates parent directories automatically.",
Copy file name to clipboardExpand all lines: src/app/service/agent/tools/web_fetch.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ import { extractHtmlContent } from "@App/app/service/offscreen/client";
6
6
exportconstWEB_FETCH_DEFINITION: ToolDefinition={
7
7
name: "web_fetch",
8
8
description:
9
-
"Fetch content from a URL. Returns extracted text for HTML pages, raw content for JSON/plain text. Use this to read web pages, APIs, or download text content. "+
9
+
"Fetch content from a URL. Returns extracted text for HTML pages, raw content for JSON/plain text. Text only — not suitable for binary downloads. "+
10
10
"Use prompt to have the LLM summarize/extract specific information from the fetched content.",
0 commit comments