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
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -62,10 +62,10 @@ For **complex, multi-step tasks**, use task tools to track your progress:
62
62
63
63
## Binary File Workflow
64
64
65
-
OPFS workspace stores files persistently. Binary files (images, PDFs, etc.) should stay as file references — never put large binary data in your messages.
65
+
OPFS workspace stores files persistently. \`opfs_read\` always returns a blob URL — file content is never loaded into the conversation context.
**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
68
+
**Use**: \`opfs_read(path)\` → returns \`blob:chrome-extension://\` URL → pass to \`execute_script(target='page', world='ISOLATED')\` which can \`fetch()\` the blob URL and manipulate page DOM
69
69
**Note**: Blob URLs are scoped to the extension origin. Only ISOLATED world (or Offscreen) can access them — MAIN world cannot.`;
"Read a file from the workspace. For text files returns content. For binary files use format='bloburl' to get a blob URL usable in executeScript (ISOLATED world).",
33
+
"Read a file from the workspace. Returns a blob URL (blob:chrome-extension://...) that can be used in executeScript (ISOLATED world) for download, display, or further processing. Never returns file content directly to avoid context overflow.",
34
34
parameters: {
35
35
type: "object",
36
36
properties: {
37
37
path: {type: "string",description: "File path relative to workspace root"},
38
-
format: {
39
-
type: "string",
40
-
enum: ["text","bloburl"],
41
-
description:
42
-
"Output format: 'text' (default) returns file content as string; 'bloburl' returns a blob:chrome-extension:// URL for binary files (usable in executeScript ISOLATED world)",
43
-
},
44
38
},
45
39
required: ["path"],
46
40
},
@@ -119,27 +113,22 @@ export function createOPFSTools(): {
119
113
execute: async(args: Record<string,unknown>)=>{
120
114
constsafePath=sanitizePath(args.pathasstring);
121
115
if(!safePath)thrownewError("path is required");
122
-
constformat=(args.formatasstring)||"text";
116
+
117
+
if(!createBlobUrlFn){
118
+
thrownewError("Blob URL creation not available (Offscreen not initialized)");
0 commit comments