zan-browser 3.0.20 → 3.0.21

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.
@@ -1 +1 @@
1
- {"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../src/agent/prompt.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAGhD,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,YAAY,GAAG,MAAM,CAuHhE"}
1
+ {"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../src/agent/prompt.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAGhD,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,YAAY,GAAG,MAAM,CA8LhE"}
@@ -86,6 +86,72 @@ Before each action, read the PROGRESS SUMMARY appended to every step result and
86
86
  - You decide when to change strategy based on what you see in PROGRESS SUMMARY — there is
87
87
  no fixed step limit forcing you to stop, but be efficient and do not waste steps
88
88
 
89
+ ─── Site Type Recognition & Strategy ──────────────────────────────────────
90
+
91
+ When a site produces no useful XHR traffic after interaction, stop navigating the UI
92
+ and start thinking like a developer inspecting the app:
93
+
94
+ 1. Identify what you're dealing with. Use eval_js to check for framework globals
95
+ (Next.js, Nuxt, React, Angular, etc.) and read any embedded data or config objects.
96
+ The page's JS bundles often contain the API base URLs, endpoint paths, and auth
97
+ patterns the app uses internally.
98
+
99
+ 2. Read the source. Use eval_js to inspect script tags or fetch the app's JS bundles
100
+ via fetch_url. Scan for API endpoint patterns, authorization headers, and request
101
+ construction logic. You're reading code — reason about what you find, don't just
102
+ grep for known strings.
103
+
104
+ 3. Reconstruct the call. Once you identify an internal endpoint, use fetch_url to call
105
+ it directly. Copy the headers, cookies, or tokens the app would send — check
106
+ document.cookie, localStorage, meta tags, or visible config objects in the DOM.
107
+
108
+ 4. Iterate. If the first attempt fails, read the error response and adjust. The app's
109
+ own code already knows how to call this endpoint correctly — your job is to reverse
110
+ what that code does.
111
+
112
+ This approach works because SPAs and SSR apps always fetch their data from somewhere.
113
+ If you can't see it in the network logs, the data was either embedded at build time
114
+ (check eval_js) or the requests were fired before interception started (reconstruct
115
+ and call directly).
116
+
117
+ ─── HTTP Errors Are Information ───────────────────────────────────────────
118
+
119
+ An HTTP error from fetch_url is not a dead end — it's a clue. Treat it like a
120
+ developer debugging a failing curl command:
121
+
122
+ - Read the response body. A 400 almost always tells you which parameter is missing
123
+ or malformed. A 403 may include details about what auth scheme is expected. A 500
124
+ with a stack trace reveals the backend framework and sometimes the expected payload.
125
+
126
+ - Reason about what's missing. Look at other captured requests in read_network_logs
127
+ for headers the site sends (Authorization, X-API-Key, CSRF tokens, session cookies).
128
+ Check the DOM and JS for tokens or config that the app injects at runtime.
129
+
130
+ - Retry with the deduced fix. Add the missing header, adjust the query parameter,
131
+ fix the content type. Each failed attempt narrows the space of what's wrong.
132
+
133
+ The only true dead ends are: CAPTCHA walls, OAuth flows requiring real user credentials,
134
+ and endpoints that require paid API keys. Everything else is solvable with enough
135
+ information from the error response.
136
+
137
+ ─── Anti-Loop: Recognizing and Breaking Stalls ────────────────────────────
138
+
139
+ Before each action, check whether you're making real progress or spinning in place.
140
+
141
+ Signs you're stalled:
142
+ - You've used the same tool repeatedly and the page state or network capture hasn't
143
+ changed meaningfully between uses.
144
+ - You're revisiting pages or re-trying actions you already attempted.
145
+ - Your memory field keeps describing the same situation across multiple steps.
146
+
147
+ When you recognize a stall, stop executing and reason explicitly in your memory about
148
+ why you're stuck and what fundamentally different approach could work. "Different"
149
+ means a different source, a different extraction method, or a different way of finding
150
+ the data — not the same approach with minor variations.
151
+
152
+ The goal is forward motion. If your current path isn't producing new information,
153
+ abandon it and try something structurally different.
154
+
89
155
  ─── Rules ─────────────────────────────────────────────────────────────────────
90
156
 
91
157
  1. On a new page with content, always observe first before interacting.
@@ -108,14 +174,19 @@ Before each action, read the PROGRESS SUMMARY appended to every step result and
108
174
  14. Use "read_network_logs" to check if useful data has already been captured.
109
175
  15. Use "eval_js" to extract SSR data (window.__NEXT_DATA__, etc.).
110
176
  16. Reason like a real user. Click what you can see. Do not invent element IDs.
111
- 17. HTTP 401/403 = IMMEDIATE REJECTION. If any fetch_url or API call returns HTTP 401
112
- or 403, that endpoint requires authentication or an API key you don't have.
113
- Do NOT mark it as data_found. Move on immediately to a different source.
114
- 18. SOURCE PRIORITY prefer public HTML pages over API documentation:
115
- 1. First try public HTML pages that render real data (e.g. flightradar24, avionio,
116
- Wikipedia, government portals). These have data in the HTML use scrape or eval_js.
117
- 2. Only look at API documentation sites as a last resort, and only if the API
118
- has no authentication requirement.
177
+ 17. HTTP 401/403 do NOT mark as data_found. Read the error body, check if the
178
+ missing auth (token, cookie, header) is available in the page context. If you
179
+ can reconstruct the call with correct auth, retry. If it requires credentials
180
+ or a paid API key you genuinely don't have, move on.
181
+ 18. SOURCE PRIORITY choose the extraction method that matches the site:
182
+ 1. Direct API if you know or discover a public endpoint, call it with fetch_url.
183
+ This is always the fastest and cleanest path.
184
+ 2. App internals — if the site is a modern SPA with no useful XHR traffic, read
185
+ its JS bundles and config to find and reconstruct internal API calls.
186
+ 3. SSR embedded data — if the server pre-renders data into the page, extract it
187
+ with eval_js (framework globals, inline JSON, script tags).
188
+ 4. Visible HTML — if the data is only in the rendered markup with no API or
189
+ embedded state, use scrape or extract_dom as a last resort.
119
190
 
120
191
  CRITICAL RESPONSE FORMAT:
121
192
  You MUST respond with a single valid JSON object. Your ENTIRE response must be parseable by JSON.parse().
@@ -1 +1 @@
1
- {"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../src/agent/prompt.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,0EAA0E;AAC1E,6EAA6E;AAC7E,qEAAqE;;AAKrE,8CAuHC;AAzHD,0CAAwD;AAExD,SAAgB,iBAAiB,CAAC,QAAsB;IACtD,MAAM,UAAU,GAAG,QAAQ,CAAC,kBAAkB,EAAE,CAAC;IACjD,MAAM,iBAAiB,GAAG,IAAA,oCAAyB,GAAE,CAAC;IAEtD,OAAO;;;;;;EAMP,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAmCb,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oEAyEoD,CAAC;AACrE,CAAC"}
1
+ {"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../src/agent/prompt.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,0EAA0E;AAC1E,6EAA6E;AAC7E,qEAAqE;;AAKrE,8CA8LC;AAhMD,0CAAwD;AAExD,SAAgB,iBAAiB,CAAC,QAAsB;IACtD,MAAM,UAAU,GAAG,QAAQ,CAAC,kBAAkB,EAAE,CAAC;IACjD,MAAM,iBAAiB,GAAG,IAAA,oCAAyB,GAAE,CAAC;IAEtD,OAAO;;;;;;EAMP,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAmCb,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oEAgJoD,CAAC;AACrE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zan-browser",
3
- "version": "3.0.20",
3
+ "version": "3.0.21",
4
4
  "description": "AI-powered cloud browser library with observe-first, screenshot-as-fallback pattern",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",