Repository navigation
fix(core,schema,runtime): resolve international currencies, URI regexes, price formatting, SPA hash UTMs, attribute escaping, and unicode whitespace - #32
Merged
Conversation
…es, price formatting, SPA hash UTMs, attribute escaping, and unicode whitespace
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of Changes
This pull request resolves 6 key open issues across
@agentlens/core,@agentlens/schema, and@agentlens/runtime, significantly enhancing cross-border e-commerce accuracy, entity registry corroboration, single-page application (SPA) AI arrival detection, and DOM safety.1. Fix #15: Broaden International Currency Recognition (
@agentlens/core)[$₹€£¥₩₪₫฿],zł,kr,R$,CHF) and top ISO 4217 3-letter currency codes (USD,EUR,GBP,INR,CAD,AUD,JPY,CHF,BRL,CNY,SEK,NOK,KRW,NZD,SGD,HKD,PLN,ZAR,TRY,ILS).CURRENCY_REGEXinquotability.tsandCURRENCY_OR_NUMERIC_REGEXandtokenizeWordsindiffer.ts.packages/core/test/core.test.ts.2. Fix #16: Alternate Wikidata and Multilingual Wikipedia URIs (
@agentlens/schema)WIKIDATA_URI_REGEXto accept canonical Wikidata entity formats (https://wikidata.org/entity/Q...,/wiki/Q...,http://).WIKIPEDIA_URI_REGEXto support multilingual and regional subdomains (simple.wikipedia.org,zh-classical.wikipedia.org,fr.wikipedia.org).packages/schema/test/schema.test.ts.3. Fix #18: Normalized Price Matching in JSON-LD Parity Checks (
@agentlens/core)isPricePresentInText()injsonld.tsto normalize prices with thousands separators ($1,250), decimals ($1,250.00,$249), European dot separators (1.250 €), and Scandinavian spaces (1 250 kr).packages/core/test/core.test.ts.4. Fix #20: SPA Hash Route AI Arrival & UTM Detection (
@agentlens/runtime)detectExplicitReferrer()to inspectwindow.location.hashfor query strings whenwindow.location.searchis empty (e.g./#/product?utm_source=perplexity.ai).utm_medium=ai-searchpreviously overrode specificutm_sourcematches.packages/runtime/test/runtime.test.ts.5. Fix #21: Single-Quote Sanitization & Selector Escaping (
@agentlens/runtime)escapeHtml()to sanitize single quotes (') as'.data-agent-sectionvalues usingreplace(/["\\]/g, '\\$&')before building attribute selectors.document.querySelector()lookups intry/catchto gracefully tolerate malformed selectors.packages/runtime/test/runtime.test.ts.6. Fix #23: Unicode Whitespace & Non-Breaking Space Normalization (
@agentlens/schema)\u00A0), thin spaces (\u2009), em spaces (\u2003), and zero-width joiners incountWords()andstartsWithBarePronoun().packages/schema/test/schema.test.ts.Verification & Test Results
pnpm check-types)@agentlens/core: 19 passed@agentlens/schema: 11 passed@agentlens/runtime: 6 passedagentlens(CLI): 5 passed@agentlens/mcp: 3 passedFixes #15
Fixes #16
Fixes #18
Fixes #20
Fixes #21
Fixes #23