Capability first · transport second

AIResponseURLPolicy.js

Extracts and audits links from AI Markdown, rendered HTML, CSS, srcset, bare URLs, and email text.

SDK 0.5.18Runtime 0.8.12Protocol arcane/1
On this page

Overview

Extracts and audits links from AI Markdown, rendered HTML, CSS, srcset, bare URLs, and email text.

  • Artifact
    AIResponseURLPolicy.js · esm
  • Classification
    public first party
  • Availability
    Cross-host
  • Normalization
    Mutable audit with exact link comparison after entity and Markdown escape decoding, without URI canonicalization or response mutation. Browsers use native HTML parsing; hosts without a document retain lexical extraction and the existing limited entity decoder. Already decoded rendered values are not decoded again. Authored links retain source offsets; DOM-only attribute links use document order after authored links.

Import and lifecycle

JavaScript
import * as module from '/arcane/modules/AIResponseURLPolicy.js';

Parsing and auditing with the bundled Markdown parser and detached native HTML elements when a document is available; performs no fetch or navigation and never changes response content.

Application-facing behavior: auditAIResponseLinks(), extractAIResponseLinks(), normalizeAIResponseLink(), decodeHTMLCharacterReferences().

Protocol and host implementation

In-process; bundled Marked parser and native HTML parsing when a document is available This detail does not widen the application-facing API or grant authority.

Exports, signatures, parameters, and results

BindingFormDeclaration or signatureParameter syntax
auditAIResponseLinksfunctionfunction auditAIResponseLinks(text='',allowedLinks=[])text='',allowedLinks=[]
decodeHTMLCharacterReferencesfunctionfunction decodeHTMLCharacterReferences(value='')value=''
extractAIResponseLinksfunctionfunction extractAIResponseLinks(text='')text=''
normalizeAIResponseLinkfunctionfunction normalizeAIResponseLink(value='',{bare=false}={})value='',{bare=false}={}
CallableKindExact public signatureParameter syntax
auditAIResponseLinksexported-functionfunction auditAIResponseLinks(text='',allowedLinks=[])text='',allowedLinks=[]
extractAIResponseLinksexported-functionfunction extractAIResponseLinks(text='')text=''
normalizeAIResponseLinkexported-functionfunction normalizeAIResponseLink(value='',{bare=false}={})value='',{bare=false}={}
decodeHTMLCharacterReferencesexported-functionfunction decodeHTMLCharacterReferences(value='')value=''

Parameter meanings and results

extractAIResponseLinks(text) finds links across Markdown, HTML, CSS, srcset, bare URLs, and email text. auditAIResponseLinks(text, allowedLinks) returns a mutable {ok, links, unsupportedLinks, allowedLinks} audit using exact values after entity and Markdown escape decoding, without URI canonicalization. Authored links retain source offsets; DOM-only attribute links use document order after authored links.

Events, side effects, and errors

Source-literal CustomEvent dispatches

No source-literal CustomEvent dispatch is part of this artifact.

Lifecycle and event flow

This artifact has no additional documented lifecycle event flow.

Direct coded failures

This artifact directly assigns no stable coded failure.

Exported Error subclasses

This artifact exports no Error subclass.

Documented failure behavior

No additional module-specific rejection behavior is documented.

Availability and capabilities

Cross-host. Mutable audit with exact link comparison after entity and Markdown escape decoding, without URI canonicalization or response mutation. Browsers use native HTML parsing; hosts without a document retain lexical extraction and the existing limited entity decoder. Already decoded rendered values are not decoded again. Authored links retain source offsets; DOM-only attribute links use document order after authored links.

Cross-host link auditing independent of Core and provider transport. Browsers use native HTML parsing and entity decoding; hosts without a document retain lexical extraction and the existing limited entity decoder. Already decoded rendered values are not decoded again.

Contract example

JavaScript
import {auditAIResponseLinks} from '/arcane/modules/AIResponseURLPolicy.js';

const audit=auditAIResponseLinks(
    '[Docs](https://example.com/docs)',
    ['https://example.com/docs']
);
console.log(audit.ok,audit.links);

No direct Core call is claimed for this artifact. Any injected provider or consuming module retains its own documented authority.