zan-browser 3.0.14 → 3.0.16
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":"parser.d.ts","sourceRoot":"","sources":["../../src/agent/parser.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC;AAOD,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,
|
|
1
|
+
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/agent/parser.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC;AAOD,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,CA8BtD"}
|
package/dist/agent/parser.js
CHANGED
|
@@ -14,7 +14,15 @@ function parseDecision(raw) {
|
|
|
14
14
|
const parsed = tryParseJson(cleaned);
|
|
15
15
|
if (parsed)
|
|
16
16
|
return toDecision(parsed);
|
|
17
|
-
// Try 2:
|
|
17
|
+
// Try 2: strip XML function_call tags that some models emit
|
|
18
|
+
const xmlStripped = raw
|
|
19
|
+
.replace(/<\/?(?:function_calls?|invoke|antml:[a-z_]+)[^>]*>/g, "")
|
|
20
|
+
.replace(/<\/?(?:parameter|result)[^>]*>/g, "")
|
|
21
|
+
.trim();
|
|
22
|
+
const fromXml = tryParseJson(xmlStripped);
|
|
23
|
+
if (fromXml)
|
|
24
|
+
return toDecision(fromXml);
|
|
25
|
+
// Try 3: extract the first JSON object from free-text
|
|
18
26
|
const jsonMatch = raw.match(/\{[\s\S]*\}/);
|
|
19
27
|
if (jsonMatch) {
|
|
20
28
|
const extracted = tryParseJson(jsonMatch[0]);
|
package/dist/agent/parser.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parser.js","sourceRoot":"","sources":["../../src/agent/parser.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,0DAA0D;AAC1D,qEAAqE;;AAgBrE,
|
|
1
|
+
{"version":3,"file":"parser.js","sourceRoot":"","sources":["../../src/agent/parser.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,0DAA0D;AAC1D,qEAAqE;;AAgBrE,sCA8BC;AAnCD,MAAM,iBAAiB,GAAG;IACxB,WAAW,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,IAAI;IACjD,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ;CAC7C,CAAC;AAEF,SAAgB,aAAa,CAAC,GAAW;IACvC,8CAA8C;IAC9C,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IAC7E,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC;IACrC,IAAI,MAAM;QAAE,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC;IAEtC,4DAA4D;IAC5D,MAAM,WAAW,GAAG,GAAG;SACpB,OAAO,CAAC,qDAAqD,EAAE,EAAE,CAAC;SAClE,OAAO,CAAC,iCAAiC,EAAE,EAAE,CAAC;SAC9C,IAAI,EAAE,CAAC;IACV,MAAM,OAAO,GAAG,YAAY,CAAC,WAAW,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AC5E,CAAC;AACJ,CAAC;AAED,SAAS,mBAAmB,CAAC,GAA4B;IACvD,MAAM,MAAM,GAA4B,EAAE,CAAC;IAC3C,KAAK,MAAM,GAAG,IAAI,iBAAiB,EAAE,CAAC;QACpC,IAAI,GAAG,CAAC,GAAG,CAAC,KAAK,SAAS;YAAE,MAAM,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;IACrD,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -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,
|
|
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"}
|
package/dist/agent/prompt.js
CHANGED
|
@@ -108,9 +108,21 @@ Before each action, read the PROGRESS SUMMARY appended to every step result and
|
|
|
108
108
|
14. Use "read_network_logs" to check if useful data has already been captured.
|
|
109
109
|
15. Use "eval_js" to extract SSR data (window.__NEXT_DATA__, etc.).
|
|
110
110
|
16. Reason like a real user. Click what you can see. Do not invent element IDs.
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
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.
|
|
119
|
+
|
|
120
|
+
CRITICAL RESPONSE FORMAT:
|
|
121
|
+
You MUST respond with a single valid JSON object. Your ENTIRE response must be parseable by JSON.parse().
|
|
122
|
+
NEVER use XML tags, <function_call>, <function_calls>, or any tag-based syntax.
|
|
123
|
+
NEVER wrap your response in markdown code fences.
|
|
124
|
+
NEVER include explanations, commentary, or text before or after the JSON.
|
|
125
|
+
Example: {"memory":"...","next_goal":"...","reasoning":"...","data_found":false,"tool_name":"web_search","params":{"query":"..."}}
|
|
126
|
+
Any response that is not pure JSON will cause an immediate failure.`;
|
|
115
127
|
}
|
|
116
128
|
//# sourceMappingURL=prompt.js.map
|
package/dist/agent/prompt.js.map
CHANGED
|
@@ -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,
|
|
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"}
|