### Install build toolchain Source: https://github.com/0xchasercat/draco/blob/main/docs/SANDBOX.md Install necessary dependencies for building BoringSSL and configuring the environment for bindgen. ```sh sudo dnf install -y gcc gcc-c++ make cmake ninja-build golang perl \ clang clang-libs llvm-libs export LIBCLANG_PATH=/usr/lib64 # so bindgen finds libclang ``` -------------------------------- ### Construct a widget Source: https://github.com/0xchasercat/draco/blob/main/crates/draco-static/tests/fixtures/content/docs_code.html Example of the inline constructor syntax. ```rust Widget::new() ``` -------------------------------- ### Install Draco via Shell Script Source: https://github.com/0xchasercat/draco/blob/main/README.md Use the provided install script to automatically detect the OS and architecture, download the binary, and update shell configuration files. ```sh curl -fsSL https://raw.githubusercontent.com/0xchasercat/draco/main/install.sh | sh ``` -------------------------------- ### Start Draco Daemon Source: https://github.com/0xchasercat/draco/blob/main/README.md Commands to launch the Draco HTTP server with default or custom configurations. ```sh draco serve # http://127.0.0.1:3002 (Firecrawl's default port) draco serve --host 0.0.0.0 --port 8080 --max-concurrency 16 ``` -------------------------------- ### Basic scraping usage Source: https://github.com/0xchasercat/draco/blob/main/README.md Examples for scraping URLs with default Markdown output, JSON metadata, or stealth configurations. ```sh # Default: URL → Markdown on stdout (great for piping) draco scrape https://example.com > page.md # Full envelope (markdown + metadata + trace) as JSON draco scrape https://example.com --json --pretty # Stealth + politeness draco scrape https://example.com --proxy socks5://127.0.0.1:9050 --delay 500 ``` -------------------------------- ### Crawl Page Webhook Payload Example Source: https://github.com/0xchasercat/draco/blob/main/docs/firecrawl-api-reference.md A concrete example of a crawl.page event payload containing scraped page data. ```json { "success": true, "type": "crawl.page", "id": "550e8400-e29b-41d4-a716-446655440000", "data": [ { "markdown": "# Page content...", "metadata": { "title": "Page Title", "description": "Page description", "url": "https://example.com/page", "statusCode": 200, "contentType": "text/html", "scrapeId": "550e8400-e29b-41d4-a716-446655440001", "sourceURL": "https://example.com/page", "proxyUsed": "basic", "cacheState": "hit", "cachedAt": "2025-09-03T21:11:25.636Z", "creditsUsed": 1 } } ], "metadata": {} } ``` -------------------------------- ### Commit and push work Source: https://github.com/0xchasercat/draco/blob/main/docs/SANDBOX.md Save progress to GitHub before starting long build processes to ensure work is not lost if the disk fills up. ```sh git add -A && git commit -m "wip: " # a WIP commit is fine git push origin HEAD:refs/heads/ # get it off the box ``` -------------------------------- ### Perform XHR Request Source: https://github.com/0xchasercat/draco/blob/main/crates/draco-runtime/tests/fixtures/spa_xhr.html Executes a GET request with the x-requested-with header and sets a global status variable upon completion. ```javascript (function () { const xhr = new XMLHttpRequest(); xhr.open("GET", "/api/legacy?page=1"); xhr.setRequestHeader("x-requested-with", "XMLHttpRequest"); xhr.responseType = "json"; xhr.onload = function () { window.__loaded = xhr.status; }; xhr.send(); })(); ``` -------------------------------- ### Vue 3 Hydration Test Fixture Source: https://github.com/0xchasercat/draco/blob/main/crates/draco-runtime/tests/fixtures/vue_app.html A complete Vue 3 application setup using the global build to test hydration, lifecycle hooks, and reactive data fetching. ```javascript __VUE_GLOBAL_BUILD__; const { createApp, defineComponent, h, ref, watch, onMounted } = Vue; const Panel = defineComponent({ setup() { // Paint-deferred secondary load, scheduled from a mounted child. onMounted(() => { setTimeout(() => { fetch("/api/panel/config", { headers: { accept: "application/json" } }); }, 5); }); return () => h("section", { class: "panel" }, "panel ready"); }, }); const App = defineComponent({ setup() { const status = ref("loading"); const detailId = ref(0); // Dependent fetch: only discoverable once the primary response has // mutated reactive state. Proves deferred, chained requests surface. watch(detailId, (id) => { if (id > 0) { fetch("/api/detail?id=" + id, { headers: { accept: "application/json" } }) .then((r) => r.json()) .then(() => { status.value = "ready"; }); } }); // Primary data fetch, fired from the mounted lifecycle hook. onMounted(() => { fetch("/api/data", { headers: { accept: "application/json" } }) .then((r) => r.json()) .then((data) => { const first = data && data.items && data.items[0]; detailId.value = (first && first.id) || 7; }); }); return () => h("main", { class: "app", "data-status": status.value }, [ h("h1", null, "Dashboard"), h("p", null, "status: " + status.value), h(Panel), ]); }, }); createApp(App).mount("#app"); ``` -------------------------------- ### Build the project Source: https://github.com/0xchasercat/draco/blob/main/docs/BARE_METAL_VALIDATION.md Clone the repository and compile the project in release mode. ```sh git clone https://github.com/0xchasercat/draco && cd draco cargo build --release ``` -------------------------------- ### Discover and Replay APIs Source: https://github.com/0xchasercat/draco/blob/main/README.md Use the CLI or API to discover endpoints and replay the winning data source. ```sh draco scrape https://shop.example --format endpoints --pretty # catalog + replayed winner ``` ```sh curl -X POST localhost:3002/v1/discover -H 'content-type: application/json' \ -d '{"url": "https://shop.example"}' # → { "success": true, "endpoints": [ { "method","url","via","score","replayable","headers" }, … ], # "data": } ``` -------------------------------- ### GET /health Source: https://github.com/0xchasercat/draco/blob/main/README.md Checks the health status of the Draco daemon. ```APIDOC ## GET /health ### Description Returns the current status and version of the daemon. ### Method GET ### Endpoint /health ### Response #### Success Response (200) - **status** (string) - The health status (e.g., "ok"). - **version** (string) - The version of the daemon. ``` -------------------------------- ### GET /v1/crawl/active Source: https://github.com/0xchasercat/draco/blob/main/docs/firecrawl-api-reference.md Lists all active crawl jobs for the authenticated team. ```APIDOC ## GET /v1/crawl/active ### Description Lists all active crawl jobs for the authenticated team. ### Method GET ### Endpoint /v1/crawl/active ### Response #### Success Response (200) - **success** (boolean) - Request status. - **crawls** (array) - List of active crawl objects. ``` -------------------------------- ### Build the project using Cargo Source: https://github.com/0xchasercat/draco/blob/main/crates/draco-static/tests/fixtures/content/docs_code.html Standard command to compile the project in release mode. ```bash $ cargo build --release Compiling widget v0.1.0 ``` -------------------------------- ### GET /v1/crawl/{id} Source: https://github.com/0xchasercat/draco/blob/main/docs/firecrawl-api-reference.md Retrieves the status and results of a specific crawl job by its ID. ```APIDOC ## GET /v1/crawl/{id} ### Description Retrieves the status and results of a specific crawl job by its ID. ### Method GET ### Endpoint /v1/crawl/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The UUID of the crawl job. #### Query Parameters - **skip** (integer) - Optional - Number of items to skip. - **limit** (integer) - Optional - Max items to return. ### Response #### Success Response (200) - **status** (enum) - Current job status (scraping, completed, failed, cancelled). - **total** (integer) - Total pages found. - **completed** (integer) - Pages completed. - **creditsUsed** (integer) - Credits consumed. - **expiresAt** (string) - ISO date-time of expiration. - **next** (string) - URL for the next page of results. - **data** (array) - Array of crawled documents. ``` -------------------------------- ### GET /v1/batch/scrape/{id} Source: https://github.com/0xchasercat/draco/blob/main/docs/firecrawl-api-reference.md Polls the status of a batch scraping job and retrieves results. ```APIDOC ## GET /v1/batch/scrape/{id} ### Description Polls the status of a batch scraping job and retrieves results. ### Method GET ### Endpoint /v1/batch/scrape/{id} ### Parameters #### Path Parameters - **id** (UUID) - Required - The ID of the batch scrape job. #### Query Parameters - **skip** (integer) - Optional - Number of items to skip for pagination. - **limit** (integer) - Optional - Maximum number of items to return. ### Response #### Success Response (200) - **status** (string) - Job status (scraping, completed, failed, cancelled). - **total** (integer) - Total pages attempted. - **completed** (integer) - Pages successfully scraped. - **creditsUsed** (integer) - Credits consumed by the job. - **expiresAt** (string) - ISO date-time of expiration. - **next** (string) - URL for the next page of results. - **data** (array) - The scraped document data. ``` -------------------------------- ### GET /v1/batch/scrape/{id}/errors Source: https://github.com/0xchasercat/draco/blob/main/docs/firecrawl-api-reference.md Retrieves errors associated with a specific batch scraping job. ```APIDOC ## GET /v1/batch/scrape/{id}/errors ### Description Retrieves errors associated with a specific batch scraping job. ### Method GET ### Endpoint /v1/batch/scrape/{id}/errors ### Parameters #### Path Parameters - **id** (UUID) - Required - The ID of the batch scrape job. ### Response #### Success Response (200) - **errors** (array) - List of error objects containing id, timestamp, url, and error message. - **robotsBlocked** (array of string) - List of URLs skipped due to robots.txt. ``` -------------------------------- ### Run verification tests and profiling Source: https://github.com/0xchasercat/draco/blob/main/docs/superpowers/plans/2026-07-15-render-memory-reliability-plan.md Commands to verify behavior and measure memory impact. ```bash cargo test -p draco-runtime --test interact_session --release -- --nocapture cargo test -p draco-runtime --test capture --release -- --nocapture bash tests/profile_spa_memory.sh ``` -------------------------------- ### Run verification tests Source: https://github.com/0xchasercat/draco/blob/main/docs/superpowers/plans/2026-07-15-render-memory-reliability-plan.md Commands to verify memory optimizations and performance regressions. ```bash cargo test -p draco-core chunk_cache --release -- --nocapture cargo test -p draco-runtime --test esm_dyn --release -- --nocapture cargo test -p draco-runtime --test capture --release -- --nocapture bash tests/profile_spa_memory.sh ``` -------------------------------- ### Configure MCP Server Source: https://github.com/0xchasercat/draco/blob/main/README.md Run the MCP server via stdio or configure it within an MCP client configuration file. ```sh draco mcp # stdio transport (newline-delimited JSON-RPC) ``` ```json { "mcpServers": { "draco": { "command": "draco", "args": ["mcp"] } } } ``` -------------------------------- ### Verify Linux kernel hardening prerequisites Source: https://github.com/0xchasercat/draco/blob/main/docs/BARE_METAL_VALIDATION.md Run these commands to check if the host kernel supports Landlock, user namespaces, and other security features required for full hardening. ```sh uname -r # ≥ 5.13 for Landlock (≥ 5.19 = Landlock v2+) sysctl user.max_user_namespaces # netns air-gap: want a non-zero number sysctl kernel.unprivileged_userns_clone 2>/dev/null # Debian/Ubuntu: want 1 sysctl kernel.apparmor_restrict_unprivileged_userns 2>/dev/null # Ubuntu 24.04+: want 0 grep -o landlock /sys/kernel/security/lsm # Landlock present? ``` -------------------------------- ### Run Verification Tests Source: https://github.com/0xchasercat/draco/blob/main/docs/superpowers/plans/2026-07-15-render-memory-reliability-plan.md Commands to execute unit and integration tests for the CLI, core, and heavy subsystems. ```bash cargo test -p draco-cli --features tier2,serve jobs --release -- --nocapture cargo test -p draco-core chunk_cache --release -- --nocapture cargo test -p draco-heavy browser --release -- --nocapture bash tests/test_live.sh ``` -------------------------------- ### Initialize Nuxt Store State Source: https://github.com/0xchasercat/draco/blob/main/crates/draco-static/tests/fixtures/nuxt_factory.html This snippet demonstrates how to populate the global __NUXT__ object with layout, product data, cart count, and server-rendered status. ```javascript window.__NUXT__ = (function (a, b, c) { return { layout: "default", data: [{ products: a }], state: { cartCount: b }, serverRendered: c, }; })( [ { id: 1, title: "Alpha", price: 10 }, { id: 2, title: "Beta", price: 20 }, ], 0, true ); ``` -------------------------------- ### GoogleAds Initialization Script Source: https://github.com/0xchasercat/draco/blob/main/crates/draco-cli/tests/fixtures/search/zapmeta.html Initializes the GoogleAds instance and sets up event listeners for the ad script element. ```javascript try{var googleAds=new GoogleAds,adsScriptElement=(window.appGatra&&googleAds.setAdsTopRequestAmount(appGatra),document.getElementById("google-csa-ads-script"));adsScriptElement.addEventListener("load",function(){googleAds.setGoogleAdsScriptLoaded(!0)}),adsScriptElement.addEventListener("error",function(){googleAds.setGoogleAdsScriptLoaded(!1)}),void 0!==adsScriptElement.dataset.state&&googleAds.setGoogleAdsScriptLoaded("loaded"===adsScriptElement.dataset.state)}catch(t){logError(t)} ``` -------------------------------- ### Interact with Pages via CLI Source: https://github.com/0xchasercat/draco/blob/main/README.md Use the CLI to perform one-shot JS execution or open an interactive REPL session. ```sh draco interact https://app.example.com --exec "return document.title" # one-shot draco interact https://app.example.com # REPL ``` -------------------------------- ### MockCapture Constructor Source: https://github.com/0xchasercat/draco/blob/main/docs/superpowers/plans/2026-07-15-render-memory-reliability-plan.md A helper constructor for MockCapture to initialize with specific candidates and rendered HTML. ```rust pub fn rendered_with_candidates( dom: impl Into, candidates: Vec, ) -> Self { let bodies = vec![None; candidates.len()]; Self { result: Ok(CaptureResult { candidates, bodies, outcome: RuntimeOutcome::Quiesced, sandbox_level: Some(Self::MOCK_LEVEL.to_string()), rendered_html: Some(dom.into()), logs: Vec::new(), }), calls: AtomicUsize::new(0), } } ``` -------------------------------- ### Commit API-first feasibility documentation Source: https://github.com/0xchasercat/draco/blob/main/docs/superpowers/plans/2026-07-15-render-memory-reliability-plan.md Stages and commits the feasibility documentation and probe script to the repository. ```bash git add docs/API_FIRST_FEASIBILITY.md tests/api_first_probe.sh git diff --cached --check git commit -m "docs: measure api-first markdown feasibility" ``` -------------------------------- ### Execute Search via CLI Source: https://github.com/0xchasercat/draco/blob/main/docs/ROADMAP.md Commands for performing searches with optional limit and format parameters. ```sh draco search "rust web scraper" draco search "rust web scraper" --limit 10 draco search "rust web scraper" --format markdown --format links ``` -------------------------------- ### Search Component Initialization Source: https://github.com/0xchasercat/draco/blob/main/crates/draco-cli/tests/fixtures/search/zapmeta.html Initializes search bars and auto-suggest components on page load, handling responsive layout changes. ```javascript appReady.push(function(){var n=null,t=window.screen.width;function e(){var i=MediaQuery.lte("b"),t=i?0:250;Helper.iterateHtmlElements(".search-bar",function(t){var e=t.querySelector(".auto-suggest"),n=t.closest(".search-header"),u=t.querySelector(".search-bar__field-input");t.classList.toggle("search-bar--full-page",i),i?u.blur():"true"===u.dataset.autofocus&&(u.setAttribute("autofocus","true"),u.focus()),null!==e&&e.classList.toggle("auto-suggest--full-page",i),null!==n&&n.classList.toggle("search-header--full-page",i)}),null!==n&&n.updateConfig({blurTimeout:t})}Helper.iterateHtmlElements(".search-bar__form",function(t){var e=t.querySelector(".auto-suggest");null!==e?n=(new AutoSuggest).create(t,{blurTimeout:250,showHistory:"1"===e.dataset.showHistory,showSuggestions:"1"===e.dataset.showSuggestions}):(new SearchBar).create(t,{preventMoveToStart:!0})}),window.addEventListener("resize",function(){window.screen.width!==t&&(t=window.screen.width,e())}),e()}); ``` -------------------------------- ### Enable Strict Sandbox Mode Source: https://github.com/0xchasercat/draco/blob/main/docs/BARE_METAL_VALIDATION.md Run the extraction command with the --strict-sandbox flag to enforce a default-deny allowlist. ```sh ./target/release/draco extract "https://" --tier-max 2 --strict-sandbox ``` -------------------------------- ### Verify Instrumentation Source: https://github.com/0xchasercat/draco/blob/main/docs/superpowers/plans/2026-07-15-render-memory-reliability-plan.md Run tests and profiling scripts to ensure memory instrumentation is working correctly. ```bash cargo test -p draco-runtime phase_memory_logs_are_ordered --release -- --nocapture cargo build -p draco-cli --release bash tests/profile_spa_memory.sh ``` -------------------------------- ### Framework Hydration Simulation Source: https://github.com/0xchasercat/draco/blob/main/crates/draco-runtime/tests/fixtures/framework_scheduler.html Simulates a framework's client runtime hydration process, including task scheduling, DOM mounting, and asynchronous data fetching. ```javascript (function () { // --- Minimal React-scheduler-shaped work loop over MessageChannel. --- const channel = new MessageChannel(); const taskQueue = []; channel.port1.onmessage = function () { const task = taskQueue.shift(); if (task) task(); if (taskQueue.length) channel.port2.postMessage(null); }; function scheduleWork(fn) { taskQueue.push(fn); channel.port2.postMessage(null); } // --- "Render + commit" into the DOM. --- function mount() { const root = document.getElementById("root"); const view = document.createElement("div"); view.className = "app"; view.setAttribute("data-hydrated", "true"); root.appendChild(view); // Effect after commit: load the primary resource (XHR path, like many // data libraries' default transport). scheduleWork(function effect() { const xhr = new XMLHttpRequest(); xhr.open("GET", "/api/hydrate/state"); xhr.setRequestHeader("accept", "application/json"); xhr.responseType = "json"; xhr.onload = function () { view.textContent = "state:" + xhr.status; // A dependent fetch discovered only after the first resolves. scheduleWork(function () { fetch("/api/hydrate/details?id=42") .then((r) => r.json()) .then((d) => { window.__details = d; }); }); }; xhr.send(); }); } // Kick off "hydration" after a paint-deferred timer, like a framework // that waits for the document to be interactive. setTimeout(mount, 5); })(); ``` -------------------------------- ### Execute automated verification suite Source: https://github.com/0xchasercat/draco/blob/main/docs/superpowers/plans/2026-07-15-render-memory-reliability-plan.md Runs formatting checks, linting, and the full test suite across the workspace. ```bash cargo fmt --all -- --check cargo clippy --workspace --all-targets --all-features -- -D warnings cargo test --workspace --all-features --release ``` -------------------------------- ### Verify Target Live via CLI Source: https://github.com/0xchasercat/draco/blob/main/docs/superpowers/plans/2026-07-15-render-memory-reliability-plan.md Run the Draco CLI against a target URL and validate the output using jq to ensure no challenge traces are present. ```bash cargo run -q -p draco-cli --no-default-features --features tier2 -- \ scrape https://www.target.com --json --runtime-log | jq -e ' .status == "success" and .source_tier == "static" and (all(.trace[]?; .action != "core.challenge")) and any(.trace[]?; (.detail // "") | contains("kept content-rich static shell")) ' ``` -------------------------------- ### MoreMenu Component Initialization and Events Source: https://github.com/0xchasercat/draco/blob/main/crates/draco-cli/tests/fixtures/search/zapmeta.html Manages the lifecycle and event listeners for 'more-menu' elements, including responsive toggling. ```javascript function MoreMenu(){return{_overlayMenu:overlayMenu,_moreMenuToggleElement:null,_moreMenuToggleClass:"more-menu__label",_moreMenuContentHiddenClass:null,create:function(e){var t=e.hasAttribute("data-more-menu-container"),n="more-menu__select";return t?(this._moreMenuToggleClass="more-menu__toggle",n="more-menu__content"):null!==e.querySelector(".more-menu__hamburger-icon")&&(this._moreMenuToggleClass="more-menu__hamburger-icon"),this._moreMenuToggleElement=e.querySelector("."+this._moreMenuToggleClass),null===this._moreMenuToggleElement||(this._moreMenuContentElement=e.querySelector("."+n),null===this._moreMenuContentElement)?null:(this._moreMenuContentHiddenClass=t?this._moreMenuContentElement.getAttribute("data-more-menu-hide-class"):n+"--hidden",this._attachEvents(),this)},_attachEvents:function(){var t=this;document.addEventListener("click",function(e){e.target.closest("."+t._moreMenuToggleClass)||t._moreMenuContentElement.classList.add(t._moreMenuContentHiddenClass)}),this._moreMenuToggleElement.addEventListener("click",this._toggle.bind(this)),this._moreMenuToggleElement.addEventListener("keyup",function(e){"Enter"!==e.key&&" "!==e.key||this._toggle(e)}.bind(this)),this._moreMenuContentElement.addEventListener("keyup",function(e){"Escape"===e.key&&(t._moreMenuContentElement.classList.add(t._moreMenuContentHiddenClass),this._overlayMenu.hide())}.bind(this)),window.addEventListener("orientationchange",function(){t._overlayMenu.hide()}),window.addEventListener("resize",function(){t._moreMenuContentElement.classList.add(t._moreMenuContentHiddenClass)})},_toggle:function(){MediaQuery.lte("b")?(this._moreMenuContentElement.classList.add(this._moreMenuContentHiddenClass),this._overlayMenu.show()):this._moreMenuContentElement.classList.toggle(this._moreMenuContentHiddenClass)}}}appReady.push(function(){for(var e=document.getElementsByClassName("more-menu"),t=0;t',this._getMenuHeadHtml(),this._getMenuItemsHtml(),""].join(""),document.querySelector("body").appendChild(this._overlayMenuElement),this._overlay.getElement().addEventListener("click",function(){t.hide()}),null!==(e=this._overlayMenuElement.querySelector(".overlay-menu__logo")))&&switchLogoImageOnBackground(e),!0},_getMenuHeadHtml:function(){var e=document.createElement("div"),t=document.createElement("div"),n=(t.classList.add("overlay-menu__head"),document.createElement("img"));return n.setAttribute("src",this.logoSrc),n.setAttribute("alt",app.brand.name),n.setAttribute("class","overlay-menu__logo"),t.appendChild(n),e.appendChild(t),e.innerHTML},_getMenuItemsHtml:function(){var e,t,n=document.createElement("div"),l=document.createElement("ul");l.classList.add("overlay-menu__items");for([e,t]of Object.entries(app.menu))l.appendChild(this._getMenuItemHtml(e,t));return n.appendChild(l),n.innerHTML},_getMenuItemHtml:function(e,t){var n=document.createElement("li"),l=(n.classList.add("overlay-menu__item"),document.createElement("a"));return l.setAttribute("href",t),l.classList.add("overlay-menu__link"),l.textContent=e,n.appendChild(l),n}}}var overlayMenu=new OverlayMenu; ``` -------------------------------- ### Parse HTML with Scraper Source: https://github.com/0xchasercat/draco/blob/main/crates/draco-cli/tests/fixtures/search/brave.html Demonstrates how to parse an HTML fragment and select elements using the scraper crate. ```rust use scraper::{Html, Selector}; let html = r#"
  • Foo
  • Bar
  • Baz
"#; let fragment = Html::parse_fragment(html); let ul_selector = Selector::parse("ul").unwrap(); let li_selector = Selector::parse("li").unwrap(); let ul = fragment.select(&ul_selector).next().unwrap(); for element in ul.select(&li_selector) { assert_eq!("li", element.value().name()); } ``` -------------------------------- ### Run guarded development scripts Source: https://github.com/0xchasercat/draco/blob/main/README.md Use these scripts in resource-constrained environments like CI containers to manage disk usage and build safety. ```sh bash scripts/gate.sh # fmt + clippy + test, disk-guarded bash scripts/reclaim.sh # free regenerable build artifacts in a pinch ``` -------------------------------- ### Execute gated builds Source: https://github.com/0xchasercat/draco/blob/main/docs/SANDBOX.md Use the gate script to enforce disk space checks and limit parallel jobs, preventing OOM kills and disk-full deadlocks. ```sh bash scripts/gate.sh # fmt + clippy + test, disk-guarded, single-job bash scripts/gate.sh clippy # or a subset: any of fmt | clippy | test ``` -------------------------------- ### Crawl Site with Webhook Source: https://github.com/0xchasercat/draco/blob/main/README.md Initiate an asynchronous crawl job and specify a webhook URL for event notifications. ```sh curl -X POST localhost:3002/v1/crawl -H 'content-type: application/json' \ -d '{"url": "https://site.example", "webhook": "https://my.app/hook"}' ``` -------------------------------- ### JSON-LD Product and Breadcrumb Schema Source: https://github.com/0xchasercat/draco/blob/main/crates/draco-static/tests/fixtures/jsonld_product.html Structured data for product details and breadcrumb navigation using Schema.org vocabulary. ```json { "@context": "https://schema.org/", "@type": "Product", "name": "Deluxe Kettle", "sku": "KETTLE-42", "offers": { "@type": "Offer", "price": "49.95", "priceCurrency": "USD", "availability": "https://schema.org/InStock" } } ``` ```json { "@context": "https://schema.org/", "@type": "BreadcrumbList", "itemListElement": [ { "@type": "ListItem", "position": 1, "name": "Home" }, { "@type": "ListItem", "position": 2, "name": "Kitchen" } ] } ``` -------------------------------- ### GoogleAds Prototype Methods Source: https://github.com/0xchasercat/draco/blob/main/crates/draco-cli/tests/fixtures/search/zapmeta.html Methods for managing ad containers, tracking ad requests, and handling statistics for Google Ads. ```javascript googleAds.isAdUnit(t)}),this._pendingAdsContainers)},GoogleAds.prototype.hasPendingRelatedTermsContainers=function(){return!!this._pendingRelatedTermsContainers&&(this._pendingRelatedTermsContainers=this._hasPendingContainers(function(t){return googleAds.isRelatedUnit(t)}),this._pendingRelatedTermsContainers)},GoogleAds.prototype._hasPendingContainers=function(e){var s=!1;return Helper.iterateHtmlElements(".csa",function(t){!e(t.id)||t.classList.contains("csa--loaded")||t.classList.contains("csa--empty")||(s=!0)}),s},GoogleAds.prototype.setAdsRequest=function(t){this._adsRequest=t},GoogleAds.prototype.hasAdsRequest=function(){return this._adsRequest},GoogleAds.prototype.hasShoppingAds=function(){return null!==this._adsTopAmount&&null!==this._adsTopRequestAmount&&this._adsTopAmount>this._adsTopRequestAmount},GoogleAds.prototype.isAdUnit=function(t){return!this.isRelatedUnit(t)},GoogleAds.prototype.isTopAdUnit=function(t){return 0<=t.indexOf(this._topAdUnitId)},GoogleAds.prototype.isRelatedUnit=function(t){return 0<=t.indexOf(this._relatedUnitIdPrefix)},GoogleAds.prototype.isAdIframe=function(t){t=this._getUnitIdFromIframeId(t);return null!==t&&this.isAdUnit(t)},GoogleAds.prototype.isRelatedIframe=function(t){t=this._getUnitIdFromIframeId(t);return null!==t&&this.isRelatedUnit(t)},GoogleAds.prototype._getUnitIdFromIframeId=function(t){var t=document.getElementById(t);return null!==t&&(null!==(t=t.closest(".csa[id]"))?t.id:null)},GoogleAds.prototype.setAdsAmount=function(t){null===this._adsAmount&&(this._adsAmount=t)},GoogleAds.prototype.setAdsTopRequestAmount=function(t){null===this._adsTopRequestAmount&&(this._adsTopRequestAmount=t)},GoogleAds.prototype.setAdsTopAmount=function(t){null===this._adsTopAmount&&(this._adsTopAmount=t)},GoogleAds.prototype.setGoogleAdsScriptLoaded=function(t){this._googleAdsScriptStatisticsResult.setGoogleAdsScriptLoaded(t)},GoogleAds.prototype.setRequestedRelatedTerms=function(t){this._googleAdsRelatedTermsStatisticsResult.setTermsRequested(t)},GoogleAds.prototype.registerAdsTimeToLoad=function(){null===this._adsTimeToLoad&&(this._adsTimeToLoad=(new Date).getTime()-this._adsLoadTime,this._adsTimeToLoad<0)&&(this._adsTimeToLoad=0)},GoogleAds.prototype.registerFirstShown=function(t){delayedContainerStatisticsResult.setFirstShown(t)},GoogleAds.prototype.registerRelatedOnlineResponse=function(t){this._googleAdsRelatedTermsStatisticsResult.handleGoogleAdsRelatedOnlineResponse(t)},GoogleAds.prototype.registerRelatedResponse=function(t){this._googleAdsRelatedTermsStatisticsResult.handleGoogleAdsRelatedResponse(t)},GoogleAds.prototype.registerRelatedUnitLoaded=function(t,e,s,o){this._googleAdsRelatedTermsStatisticsResult.handleGoogleAdsRelatedUnitLoaded(t,e,s,o)},GoogleAds.prototype.sendStatistics=function(){var t;null===this._adsAmount||this.hasPendingAdsContainers()||((t=this._googleAdsStatisticsResult).setAdsLoaded(!0),t.setAdsAmount(this._adsAmount),t.setAdsTime(this._adsTimeToLoad),t.setAdsTopAmount(this._adsTopAmount),t.setHasShoppingAds(this._adsTopAmount>this._adsTopRequestAmount),t.sendStatistics())}; ``` -------------------------------- ### Sticky Display Banner Initialization Source: https://github.com/0xchasercat/draco/blob/main/crates/draco-cli/tests/fixtures/search/zapmeta.html Initializes sticky display banners by checking for specific DOM elements. ```javascript function DisplayBannerSticky(){var e,t,s,n=document.querySelector(".display-banner--sticky");n&&(e=document.querySelector(".gr-results:not(:empty), ``` -------------------------------- ### POST /v1/crawl Source: https://github.com/0xchasercat/draco/blob/main/README.md Initiates an asynchronous crawl job for a website. ```APIDOC ## POST /v1/crawl ### Description Starts an async crawl job. Results can be polled via GET /v1/crawl/{id}. ### Method POST ### Endpoint /v1/crawl ### Request Body - **url** (string) - Required - The starting URL for the crawl. - **webhook** (string) - Optional - URL to receive job event notifications. ``` -------------------------------- ### POST /v1/discover Source: https://github.com/0xchasercat/draco/blob/main/README.md Surfaces the full ranked catalog of APIs behind a SPA by intercepting fetch/XHR requests. ```APIDOC ## POST /v1/discover ### Description Surfaces the full ranked catalog of APIs behind a SPA. It returns a ranked list of endpoints and the replayed winner data. ### Method POST ### Endpoint /v1/discover ### Request Body - **url** (string) - Required - The URL of the page to discover APIs from. ### Request Example { "url": "https://shop.example" } ### Response #### Success Response (200) - **success** (boolean) - Indicates if the request was successful. - **endpoints** (array) - A ranked list of discovered endpoints. - **data** (object|null) - The replayed winner JSON or null. #### Response Example { "success": true, "endpoints": [ { "method": "GET", "url": "...", "score": 0.9, "replayable": true } ], "data": {} } ``` -------------------------------- ### AMD-style Module Loader Source: https://github.com/0xchasercat/draco/blob/main/crates/draco-cli/tests/fixtures/search/bing.html A minimal implementation of define and require for managing module dependencies. ```javascript (function(n){function e(n,i,u){t[n]||(t[n]={dependencies:i,callback:u},r(n))}function r(n){if(n){if(n)return u(n)}else{if(!f){for(var r in t)u(r);f=!0}return i}}function u(n){var s,e;if(i[n])return i[n];if(t.hasOwnProperty(n)){var h=t[n],f=h.dependencies,l=h.callback,a=r,o={},c=[a,o];if(f.length<2)throw"invalid usage";else if(f.length>2)for(s=f.slice(2,f.length),e=0;e" --tier-max 2 --pretty ``` ```sh ./target/release/draco extract "https://" --tier-max 2 --no-jail --pretty ``` -------------------------------- ### SPA Analytics and Data Fetching Script Source: https://github.com/0xchasercat/draco/blob/main/crates/draco-runtime/tests/fixtures/spa_decoy.html Executes an analytics beacon via POST and a subsequent data fetch for product information. The delay ensures the analytics call is prioritized. ```javascript (function () { // Analytics decoy: POST a beacon to a telemetry host. fetch("https://analytics.example.com/collect", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ event: "pageview", ts: Date.now() }), }); // The endpoint we actually care about. setTimeout(function () { fetch("/api/products?category=widgets") .then((r) => r.json()) .then(function (d) { window.__products = d; }); }, 20); })(); ``` -------------------------------- ### Run Draco Core Tests Source: https://github.com/0xchasercat/draco/blob/main/docs/superpowers/plans/2026-07-15-render-memory-reliability-plan.md Execute specific test suites for the draco-core crate with tier2 features enabled. ```bash cargo test -p draco-core --features tier2 challenge::tests -- --nocapture cargo test -p draco-core --features tier2 target_like_px_telemetry_and_main_collapse_keep_rich_static_result -- --nocapture cargo test -p draco-core --features tier2 hydration_collapse -- --nocapture ``` -------------------------------- ### Define a greeting function in Python Source: https://github.com/0xchasercat/draco/blob/main/crates/draco-static/tests/fixtures/content/docs_code.html A simple function that prints a formatted greeting string. ```python def greet(name): print(f"hello, {name}") ``` -------------------------------- ### Logging Utility Source: https://github.com/0xchasercat/draco/blob/main/crates/draco-cli/tests/fixtures/search/bing.html Logs events to the server using the directLog interface. ```javascript var sj_log=function(n,t,i){var r=window.directLog;r&&r(JSON.stringify([{T:n,FID:"CI",Name:t,Text:encodeURIComponent(i.replace(/"/g,"")),SDK:"SJ"}]),0)}; ``` -------------------------------- ### Commit changes to repository Source: https://github.com/0xchasercat/draco/blob/main/docs/superpowers/plans/2026-07-15-render-memory-reliability-plan.md Stage the modified files and commit the changes with a descriptive message. ```bash git add crates/draco-core/src/tier2.rs crates/draco-runtime/src/lib.rs crates/draco-runtime/src/session.rs crates/draco-runtime/tests/interact_session.rs git diff --cached --check git commit -m "fix: bound tier2 cancellation and script execution" ``` -------------------------------- ### Log Memory Phase Helper Source: https://github.com/0xchasercat/draco/blob/main/docs/superpowers/plans/2026-07-15-render-memory-reliability-plan.md Private helper function to record V8 heap statistics and source byte counts into the runtime log. ```rust fn log_memory_phase( runtime: &mut JsRuntime, cap: &Rc>, phase: &str, module_bytes: usize, external_script_bytes: usize, ) { let mut heap = deno_core::v8::HeapStatistics::default(); runtime.v8_isolate().get_heap_statistics(&mut heap); cap.borrow_mut().push_log(&format!( "[raze.memory] phase={phase} used_heap={} total_heap={} physical={} external={} heap_limit={} module_bytes={module_bytes} external_script_bytes={external_script_bytes}", heap.used_heap_size(), heap.total_heap_size(), heap.total_physical_size(), heap.external_memory(), heap.heap_size_limit(), )); } ``` -------------------------------- ### POST /v1/map Source: https://github.com/0xchasercat/draco/blob/main/README.md Performs fast site URL discovery by merging sitemaps and page links. ```APIDOC ## POST /v1/map ### Description Discovers URLs within a site based on sitemaps and link crawling. ### Method POST ### Endpoint /v1/map ### Request Body - **url** (string) - Required - The base URL to map. - **search** (string) - Optional - Filter links by search term. ### Response #### Success Response (200) - **success** (boolean) - Indicates success. - **links** (array) - List of discovered URLs. ``` -------------------------------- ### CSS Styles for UI Components Source: https://github.com/0xchasercat/draco/blob/main/crates/draco-cli/tests/fixtures/search/zapmeta.html Styles for pagination, footer navigation, and cookie consent banners. ```css .organic-pagination__icon{display:none}@media(max-width: 767px){.organic-pagination--default .organic-pagination__list{height:3.8rem}.organic-pagination--default .organic-pagination__link{height:3.8rem;line-height:3.8rem}.organic-pagination--default .organic-pagination__item--number{display:none}.organic-pagination--default .organic-pagination__link--chevron{font-size:1.4rem;padding:0 1.4rem}}@media(prefers-contrast){.organic-pagination--default .organic-pagination__item--active .organic-pagination__link{color:var(--contrast-override_color) !important}}.footer--default{margin-top:auto;position:relative}.footer-logo--default{text-align:center}.footer-logo--default .footer-logo__brand-link{display:inline-block}@media(min-width: 768px){.footer-logo--default.footer-logo--hide-on-desktop{display:none}}.footer-navigation--borderless{color:var(--brand_body_color, #666666);line-height:2.6rem;padding-bottom:1rem;padding-top:1rem;position:relative;text-align:center;width:100%}.footer-navigation--borderless .footer-navigation__list{font-size:0}.footer-navigation--borderless .footer-navigation__item{display:inline-flex;font-size:1.3rem}.footer-navigation--borderless .footer-navigation__item:before{content:"-";display:inline-block;padding:0 .8rem}.footer-navigation--borderless .footer-navigation__item--copyright{display:block;margin-top:1rem}.footer-navigation--borderless .footer-navigation__item:first-child:before,.footer-navigation--borderless .footer-navigation__item--copyright:before{display:none}.footer-navigation--borderless .footer-navigation__link{color:var(--brand_body_color, #666666);cursor:pointer;white-space:nowrap}.footer-navigation--borderless .footer-navigation__link:hover{text-decoration:underline}.cookie-consent--default.cookie-consent--hidden{display:none}.cookie-consent--default .cookie-consent__container{bottom:0;left:0;position:fixed;right:0;z-index:1000}.cookie-consent--default .cookie-consent__container-inner{background-color:var(--brand_body_background-color, #ffffff);border-top:.1rem solid #eee;color:var(--brand_body_color, #666666);display:block;font-size:1.2rem;line-height:1.4rem;padding:.9rem 0;position:relative;text-align:center;width:100%}.cookie-consent--default .cookie-consent__content{display:inline-block;padding-left:1.5rem;padding-right:1.5rem;position:relative}.cookie-consent--default .cookie-consent__message,.cookie-consent--default .cookie-consent__options{display:inline}.cookie-consent--default .cookie-consent__accept,.cookie-consent--default .cookie-consent__more-info{color:inherit;display:inline;padding:0;text-decoration:underline;white-space:nowrap}.cookie-consent--default .cookie-consent__accept{color:inherit;cursor:pointer;text-align:center}.cookie-consent--default .cookie-consent__accept:before{content:"-";display:inline-block;padding-left:.15rem;padding-right:.5rem;text-decoration:none}.cookie-consent--default .cookie-consent__more-info{color:inherit}.cookie-consent--default .cookie-consent__more-info:hover,.cookie-consent--default .cookie-consent__accept:hover{text-decoration:underline} ``` -------------------------------- ### Assert Phase Log Order Source: https://github.com/0xchasercat/draco/blob/main/docs/superpowers/plans/2026-07-15-render-memory-reliability-plan.md Verify that the captured logs contain the expected sequence of memory phases. ```rust let phases: Vec<&str> = report .logs .iter() .filter_map(|line| line.strip_prefix("[raze.memory] phase=")) .map(|rest| rest.split_whitespace().next().unwrap()) .collect(); assert_eq!( phases, ["snapshot", "dom", "scripts-fetched", "scripts-run", "settled", "serialized"] ); ``` -------------------------------- ### Interact with Pages via HTTP API Source: https://github.com/0xchasercat/draco/blob/main/README.md Manage stateful sessions and execute JavaScript using the Draco daemon API. ```sh # Open a session, act, read back, close (the daemon keeps it warm between calls). curl -X POST localhost:3002/v1/interact -H 'content-type: application/json' \ -d '{"url": "https://app.example.com"}' # → { "success": true, "sessionId": "…", "snapshot": { "markdown": … } } curl -X POST localhost:3002/v1/interact//exec -H 'content-type: application/json' \ -d '{"js": "return [...document.querySelectorAll(\"a\")].map(a => a.href)"}' # → { "success": true, "result": [ … ], "logs": [ … ] } ``` -------------------------------- ### POST /v1/map Source: https://github.com/0xchasercat/draco/blob/main/docs/firecrawl-api-reference.md Maps a URL to discover all associated links. This endpoint acts as a compatibility shim over v2 logic. ```APIDOC ## POST /v1/map ### Description Maps a base URL to discover and return a list of links found on the site. ### Method POST ### Endpoint /v1/map ### Parameters #### Request Body - **url** (string) - Required - Base URL to map from. - **search** (string) - Optional - Filters/ranks discovered links by a search query. - **ignoreSitemap** (boolean) - Optional - Whether to ignore the sitemap. Defaults to false. - **sitemapOnly** (boolean) - Optional - Only return links found in the sitemap. Defaults to false. - **includeSubdomains** (boolean) - Optional - Whether to include subdomains. Defaults to true. - **limit** (integer) - Optional - Maximum number of links to return. Defaults to 5000. - **timeout** (integer) - Optional - Timeout in milliseconds. - **location** (object) - Optional - Location settings (country, languages). - **ignoreQueryParameters** (boolean) - Optional - Whether to ignore query parameters. Defaults to true. - **filterByPath** (boolean) - Optional - Whether to filter by path. Defaults to true. - **useIndex** (boolean) - Optional - Whether to use index. Defaults to true. - **ignoreCache** (boolean) - Optional - Whether to ignore cache. Defaults to false. - **ignoreRobotsTxt** (boolean) - Optional - Whether to ignore robots.txt. Defaults to false. - **headers** (object) - Optional - Custom headers. ### Response #### Success Response (200) - **success** (boolean) - Indicates if the request was successful. - **links** (array) - A list of discovered URLs. - **scrape_id** (string) - Optional - The ID of the scrape operation. ``` -------------------------------- ### Commit Changes Source: https://github.com/0xchasercat/draco/blob/main/docs/superpowers/plans/2026-07-15-render-memory-reliability-plan.md Git commands to stage and commit the performance improvements. ```bash git add crates/draco-runtime/src/lib.rs crates/draco-runtime/js/glue.js crates/draco-runtime/tests/capture.rs crates/draco-runtime/tests/dom_globals.rs git diff --cached --check git commit -m "perf: avoid nested JSON copies in live fetch responses" ``` ```bash git add crates/draco-runtime/src/lib.rs tests/profile_spa_memory.sh git diff --cached --check git commit -m "perf: set measured safe tier2 heap ceiling" ``` -------------------------------- ### Network Challenge and Hydration Guards Source: https://github.com/0xchasercat/draco/blob/main/docs/superpowers/plans/2026-07-15-render-memory-reliability-plan.md Existing policies for detecting network challenges and handling hydration collapse during runtime rendering. ```rust let kind = capture .candidates .iter() .find_map(|candidate| detect_network_challenge(&candidate.url))?; runtime_challenge_dominates(capture.rendered_html.as_deref()) .then(|| format!("network:{}", kind.as_str())) ``` ```rust if let Some(detail) = hydration_collapse_detail(prev_len, new_len) { if prev_len < CHALLENGE_FALLBACK_CONTENT_CHARS { return Some(finish_runtime_challenge(run, detail)); } run.record( SourceTier::RuntimeInterception, "runtime.render", StepOutcome::Missed, cap_ms, Bucket::Runtime, Some(format!("{detail}; kept content-rich static shell")), ); return None; } ``` -------------------------------- ### Commit changes Source: https://github.com/0xchasercat/draco/blob/main/docs/superpowers/plans/2026-07-15-render-memory-reliability-plan.md Git commands to stage, verify, and commit the memory optimization changes. ```bash git add crates/draco-runtime/src/lib.rs crates/draco-runtime/src/session.rs crates/draco-runtime/tests/interact_session.rs git diff --cached --check git commit -m "perf: move tier2 output buffers out of live state" ```