# Maweng Track A web demo — full agent/judge brief **Artifact:** `apps/track-a-web-demo/` (standalone static no-funds demo) **Status:** hosted at https://maweng-demo.binasta.workers.dev; **not submitted, not a release, not live**. **Boundary:** paper only. No funds, account, wallet, order, transfer, signing, key, or credential. **Source snapshot:** the demo is committed in the Maweng repository and deployed as an asset-only Worker at https://maweng-demo.binasta.workers.dev. The API Worker is version `1b696b23-c4e3-4c61-a18d-433caf8f77ea` with scoped public CORS. Production smoke passed for root, fixture mode, agent index, headless fixture render and catalog CORS from the demo origin. --- ## 1. Purpose The DevSpot submission requires a working demo link. The native judge build is on a device and the repository had no browser-openable demo path. This artifact supplies a standalone browser demo that can be reviewed locally or served statically. Its former public-route CORS blocker is resolved: the scoped Worker CORS is live and a logged-out direct static fetch was validated. It is deliberately not a mock of trading. It is a no-funds rehearsal of the supported Track A paper path: public catalog/quote → consequence ticket → local paper fill → paper certificate → optional public paper verifier. It does not produce a live order, transfer, wallet, account, or transaction. A separate explicit **fixed synthetic fixture rehearsal** mode uses only the committed fixture, makes no network request, is labeled SYNTHETIC FIXTURE / NOT A LIVE QUOTE, and is available 24/7. Default remains real public data. --- ## 2. Architecture Plain browser ES modules, no npm dependencies, no build step, no external assets, no inline scripts/styles. | File | Responsibility | |---|---| | `index.html` | Accessible mobile-first page; demo banner; guided checklist; paper sandbox; ticket; certificate dialog; verifier | | `styles.css` | Responsive light/dark styling, focus states, reduced-motion and print support | | `js/app.mjs` | UI state machine, mode switch, checklist, local persistence, ticket rendering, fill, certificate dialog, verifier UI | | `js/api.mjs` | Fixed API allowlist, shape validation, GET catalog/prices, POST paper verifier | | `js/paper.mjs` | Integer fee/notional math, freshness gate, synthetic quote builder, local fill, core-compatible canonical hash, local checks | | `js/format.mjs` | Deterministic money/quantity/age/timestamp formatting (no locale APIs) | | `js/fixture.mjs` | Embedded fixed synthetic envelope + copyable curl string | | `serve.mjs` | Zero-dependency local static server + strict same-origin relay for review | | `fixtures/paper-receipt.json` | Fixed synthetic paper envelope for curl | | `test/*.test.mjs` | Node built-in test suite, synthetic fixtures only | | `README.md`, `llms.txt`, `llms-full.txt` | Human/agent documentation | ### State flow ``` initial load (public mode, default) -> load cached curated catalog/quotes (if any) -> if online: GET catalog + prices (parallel, GET only) -> on success: replace cache, render quote age/freshness -> on failure: keep cache only if present; error/offline state; fill disabled -> Load $250 DEMO paper: local only, localStorage -> select SGOV/BILON: consequence ticket from the selected public quote -> review checkbox + freshness + cash + fee checks -> DEMO paper fill: local integer math, no network -> certificate: WebCrypto SHA-256 over core canonical order, local dialog -> optional POST /v1/tm/receipts/verify with mode:"paper" only -> display server verdict/reasons/requestCode; local check remains separate fixture mode (?mode=fixture or explicit mode button) -> no cache/fetch; fixed committed fixture quote from PAPER_RECEIPT_FIXTURE -> separate paper key maweng.track-a-web-demo.paper.fixture.v1 -> synthetic quote marked synthetic; not accepted by public mode -> fixed-fixture review -> local rehearsal fill -> fixture-disclaimed certificate -> local SHA-256/structure checks only; public verifier disabled and no HTTP request ``` Every 10 seconds the demo recomputes public quote age. If the quote crosses the 15-minute window, the public fill disables and the checklist's "fresh quote reviewed" step un-ticks. Fixture mode has no live age and is unaffected. --- ## 3. Guided checklist semantics The checklist is **derived**, not a scripted animation: 1. **Public catalog loaded** — `market.status === "ready"` and at least one curated listing is present. Detail shows listing/quote counts and whether the source is direct Worker, local relay, or cache. 2. **Paper cash loaded** — persisted `paper.initialized` is true. Shows the fake local cash amount. 3. **Fresh quote reviewed** — the selected quote is fresh (observed time is within 15 minutes, not future), and the user has ticked the review checkbox for the current symbol+quote+amount signature. Any change to symbol, amount, quote timestamp, or quote price invalidates the signature. 4. **Local paper fill created** — at least one persisted local fill exists. No network is involved. 5. **Certificate opened and locally verified** — the latest fill's certificate id is in the opened set, and the local WebCrypto hash + structure checks passed. A server verdict is optional and shown separately. The checklist explicitly shows pending when there is no fresh quote, no cash, or no fill. It cannot tick from a hardcoded price. In fixture mode the labels are **Synthetic fixture loaded** and **Synthetic fixture reviewed**. Step 1 ticks from the committed fixture, step 3 ticks from the explicit fixture review (no freshness claim), and steps 4–5 use the same local fill/certificate logic. Public verification is disabled. The checklist only reads the active mode's paper state; the two modes use separate storage keys. --- ## 4. Exact network calls **Real public mode only.** Fixture rehearsal mode makes no network call: no catalog, prices, verifier, or any other HTTP request. It uses the committed fixture embedded in `js/fixture.mjs` / `fixtures/paper-receipt.json`. ### 4.1 Catalog (GET only) ```http GET https://maweng-ai-proxy.binasta.workers.dev/v1/wealth/catalog?asset_class=stock accept: application/json credentials: omit cache: no-store redirect: error ``` Allowed response: `{ ok: true, data: [ … ] }`. The parser keeps only curated `SGOV` and `BILON` active listings. It requires `id`, `symbol`, `name`; optional `chain`, `venue`, `asset_class`. It ignores catalog price fields because the observed response had `price_usd_micros: null` for both curated rows. Malformed `ok`/`data` shapes produce a `ShapeError`; no asset or price is synthesized. Observed catalog: 2,169 rows / 1,478,935 bytes at `2026-11-29T15:22Z`. Both `SGOV` (`robinhood`) and `BILON` (`solana`) were present and active with null catalog prices. The demo stores only the curated subset in cache. Rows carry many extra fields; they are ignored. ### 4.2 Prices/quote (GET only) ```http GET https://maweng-ai-proxy.binasta.workers.dev/v1/wealth/prices?symbols=SGOV,BILON accept: application/json credentials: omit cache: no-store redirect: error ``` Allowed response: `{ ok: true, data: [ { symbol, asset_id, price_usd_micros, as_of|price_as_of, … } ] }`. A row is accepted only when: - symbol is one of the curated symbols, - `price_usd_micros` is a positive safe integer ≤ 10^15, - `price_as_of` or `as_of` parses to a positive epoch millisecond time. No accepted row means "no quote"; the fill is disabled. A quote older than 15 minutes means "stale"; the fill is disabled. A timestamp more than 60 seconds in the future is invalid. The quote source URL is retained in the certificate. The upstream feed is hourly public history data, not a websocket/tick feed. In the observed 2-symbol response at `15:22Z`, only `SGOV` was returned (`$96.369230`, observed `15:00:00Z`, already 22m stale); `BILON` was absent even though catalogued. A later probe at `16:02Z` returned a revised price but the **same** `15:00:00Z` observation time, so it remained stale. The page therefore showed stale/no-quote and disabled fill. ### 4.3 Paper verifier (POST only, fixed) ```http POST https://maweng-ai-proxy.binasta.workers.dev/v1/tm/receipts/verify content-type: application/json accept: application/json credentials: omit cache: no-store redirect: error { "mode": "paper", "certificate": { … core-shaped paper certificate … } } ``` Client policy rejects any envelope whose `mode` is not `paper`, whose `routeReason` is not `paper_local_simulation`, or that carries a non-null `orderId`/`txHash`. Maximum body 16,384 bytes. The route is used only when the user taps verify; it is never automatic. ### 4.4 No other calls There is no `Authorization`, `Bearer`, API key, cookie, account, wallet, order, quote, transfer, ramp, portfolio, cancel, execute, or signing call. The only permitted POST is the paper verifier. The API URL allowlist rejects: - http, other origins, lookalike origins, userinfo, non-default ports, - catalog without exactly `asset_class=stock`, - prices with symbols outside `SGOV`/`BILON` or extra query keys, - the verifier with any query string, - every `/v1/wealth/order`, `/v1/wealth/quote`, `/v1/wealth/transfers`, `/v1/wealth/user`, `/v1/wealth/portfolio`, `/v1/gateway/orders`, and similar path. The local relay enforces the same fixed paths and curated symbols server-side. --- ## 5. CORS status and public-route probes **CORS is live for exactly three public routes.** The separate Worker change in commit `c9eab90` adds a scoped wildcard `Access-Control-Allow-Origin: *` to catalog, prices, and paper verify, plus a 204 preflight for the matching method and an `Origin` header. It sends no `Access-Control-Allow-Credentials` and adds no CORS to order, transfer, account, org, or admin routes. The change was first observed live at `2026-11-29T16:16Z`; earlier probes at `15:22Z`, `15:38Z`, `15:55Z`, `16:00Z`, and `16:03Z` showed the old 405/no-header behavior. Live preflight and GET: ``` HTTP/2 204 access-control-allow-origin: * access-control-allow-headers: accept, content-type, cache-control, pragma access-control-allow-methods: GET, OPTIONS access-control-max-age: 600 HTTP/2 200 content-type: application/json; charset=utf-8 access-control-allow-origin: * access-control-expose-headers: date ``` The verifier POST also returned `200` with the wildcard CORS header and the normal demo verdict. Validated direct browser path (logged-out Chrome, page served from a plain static origin): catalog and prices were fetched from the Worker with two 200 responses; the synthetic fixture was POSTed to the real verifier and returned `verdict: demo`; no `MissingAllowOriginHeader` or console exception occurred. The same page still fails closed if a fetch is blocked or a quote is stale: it shows the error state, disables the fill, and does not invent a price or a server verdict. `serve.mjs` remains available as a zero-dependency same-origin relay for local review or when the Worker is unreachable. It is not required for static hosting now that CORS is live. It forwards only the same three fixed routes and only a paper verifier envelope. The verifier schema is **not** a blocker: the fixed fixture posted directly with curl returned HTTP 200, `verdict: "demo"`, `receiptId: "tmcert:8361fb9bf438d4f1"`, reasons `["demo_receipt_not_live","hash_verified","receipt_id_verified","fee_consistent","fill_consistent", "consensus_not_supplied","no_on_chain_tx"]`, and a generated `requestCode` such as `rcpt_24b5fe8b3128`. `requestCode` is per-request and not stable. --- ## 6. Paper certificate and core hash contract ### Values - `mode` envelope: `paper` - `version`: `1` - `id`: `tmcert:` (23 chars) - `hash`: 64 lowercase hex - `routeReason`: `paper_local_simulation` - `orderId`: `null` - `txHash`: `null` - `symbol`: `SGOV` (or another curated listing) - `side`: `buy` - `chain`: from catalog (e.g. `robinhood`, `solana`) - `venue`: from catalog (e.g. `defi`) - `quotePriceMicros` and `executedVwapMicros`: the same public quote price (local simulated fill) - `executedQtyText`: positive decimal, six base decimals - `notionalUsdcCents`: integer paper cents - `feeUsdcCents`: 20 bps rounded to integer cents (gateway leg) - `feeBps`: `round2(fee / notional * 10000)` - `feeBreakdown`: exactly five ordered legs: `gateway`, `ramp_spread_fx`, `gas_network`, `source_exit`, `target_exit` - gateway: amount = fee, basis = 20, status `estimated`, source = Gateway fee schedule, 12 Nov 2026 - ramp/FX and gas/network: null amounts, status `unknown`, explicit no-quote/no-settlement source - source/target exit: null amounts, status `not_applicable` - `feeTotalUsdcCents`: sum of known fee legs (equals gateway in paper mode) - `fx`: null (no FX quote is fetched or invented) - `priceImprovementBps`: 0 (quote == simulated VWAP) - `ledgerTxId`: null - `generatedAt`: local fill time (safe integer ms) - `disclaimer`: explicit `DEMO · PAPER · LOCAL SIMULATION`; no funds/account/order/transfer/on-chain claim - `consensusHash`: null - `quoteSource`: `TrueMarkets public catalogue via Maweng Worker · ` - `quoteObservedAt`: public quote timestamp - `quoteExpiresAt`: observed time + 15 minutes ### Canonical field order Mirrors `packages/core/src/plugins/truemarkets/certificate.ts` `tmCertificateCanonicalJson`: ``` version, id:"", orderId, symbol, side, chain, venue, routeReason, quotePriceMicros, executedVwapMicros, executedQtyText, notionalUsdcCents, feeUsdcCents, feeBps, feeBreakdown[id,label,amountUsdcCents,basisBps,status,source], feeTotalUsdcCents, fx, priceImprovementBps, txHash, ledgerTxId, generatedAt, disclaimer, consensusHash, quoteSource, quoteObservedAt, quoteExpiresAt ``` The final `hash` is excluded from its own body; `id` is pinned to `""` during hashing and then derived. The optional append-only fields are included because the paper certificate always carries them. ### Fixed synthetic fixture Path: `fixtures/paper-receipt.json` Hash: `8361fb9bf438d4f15a180c58080ded2864090deded44f802c0ecf742ee25ed9c` Id: `tmcert:8361fb9bf438d4f1` Generated once with core `tmCertificateHash`; `test/fixture.test.mjs` recomputes it with WebCrypto and asserts the same value. This pins the browser field order to the core order. Generated fixture quote/provenance is synthetic: - quote price `$100.0000`, quantity `0.5`, notional `$50.00`, fee `$0.10` (20 bps), total paper debit `$50.10` - fixed `generatedAt` 2026-11-29T14:00:00Z, observed 13:59Z, expires 14:14Z - no user, account, wallet, key, order, or transfer data Copyable curl is in README and on-page; it references the fixture file, not an arbitrary URL. ### 5.1 Synthetic fixture rehearsal certificate Fixture mode reads `quotePriceMicros`, `quoteObservedAt`, `symbol`, `chain`, and `venue` from the committed fixture certificate and marks the resulting quote object `synthetic: true`. A public-mode fill rejects it; only explicit fixture mode accepts it, and freshness is replaced by a fixed `SYNTHETIC` label (never `FRESH`). The generated rehearsal certificate: - keeps the core field order and 20 bps integer math; - uses `FIXTURE_CERTIFICATE_DISCLAIMER` (`DEMO · PAPER · SYNTHETIC FIXTURE...`); - uses `quoteSource = "Fixed synthetic fixture · fixtures/paper-receipt.json · NOT A LIVE QUOTE"`; - has a fixed quote timestamp, local `generatedAt`, and no network provenance URL; - passes local SHA-256/structure checks but is **not** posted to the public verifier; the verifier controls are disabled. Public paper state (`maweng.track-a-web-demo.paper.v1`) and fixture state (`maweng.track-a-web-demo.paper.fixture.v1`) are separate. `?mode=fixture` starts directly in fixture mode with no market request; the default (no query) remains real public data. --- ## 7. Fee and notional math - `notionalCents = usdToCents(amount)` integer parse, max two decimals. - `baseQtyMicros = round(notionalCents * 1e10 / priceUsdMicros)`; display six base decimals. - `gatewayFeeCents = round(notionalCents * 20 / 10000)`. - `feeCents = gatewayFeeCents` (only modeled leg with an amount). - `totalCents = notionalCents + feeCents`. - Fill requires `totalCents <= paperCashCents` and `baseQtyMicros > 0`. - Initial paper cash = `25000` cents ($250.00). - A fill decreases cash by `totalCents`; paper value (cost basis) = cash + sum(fill notional). Example fixture: $50.00 fill, $0.10 fee, cash $199.90, cost basis $249.90, value $249.90. - Fees displayed to cents; bps displayed with two decimals only when needed. No price fallback exists. No local hardcoded price is used. The only numeric price values in the repository are in synthetic test fixtures and documentation examples, not runtime fallbacks. --- ## 8. States and accessibility States: - public mode: initial loading / catalog skeleton - public mode: catalog loaded with listings and quotes - public mode: catalog loaded but curated listing missing (empty; fill disabled) - public mode: quote missing (no quote; refresh required; fill disabled) - public mode: quote stale (>15 min; refresh required; fill disabled) - public mode: quote invalid timestamp (fill disabled) - public mode: network/CORS error (fill disabled; exact endpoint and reason shown) - public mode: offline (no refresh; fresh cache only; stale/missing disables fill) - fixture mode: fixed synthetic fixture loaded, no network, synthetic quote, local-only fill/certificate - paper not loaded, loaded, spent, reset (per mode) - local fill created, certificate dialog, local verify pass/fail - verifier success (`demo`, reasons, requestCode) vs blocked/error (local check separate); public mode only All public-mode states were exercised in Chrome 145 headless on 29 Nov 2026. Loading shows two skeleton cards with `aria-busy=true`; empty, no-quote, malformed, HTTP 502, offline, stale-cache and direct CORS-blocked states all leave the fill disabled and do not invent a price. Fixture mode was exercised separately with zero API requests before a deliberate mode switch. Accessibility: - semantic header/main/section/footer, one `h1`, section headings - skip link; visible focus rings; 46px minimum button targets - labels for amount and review checkbox; `aria-live` status/progress; `role="alert"` offline banner - native `` with labelled title and close; textContent-only rendering (no injected HTML) - `aria-busy` on the market section; freshness and step states as text, not color alone - reduced-motion support; print styles for the certificate; mobile-first grid at 620px --- ## 9. Tests Run: ```bash node --test apps/track-a-web-demo/test/*.test.mjs ``` Files and coverage: - `test/format.test.mjs` — deterministic formatting; invalid integer rejection. - `test/paper.test.mjs` — 15-minute freshness boundary, future timestamp, missing quote, 20 bps fee/notional, insufficient cash, stale/no-quote fill refusal without state mutation, cash/cost-basis, certificate labels, no live order/tx, core field set, state sanitisation, synthetic quote rejection in public mode, fixture-only rehearsal fill/certificate/local check, separate public/fixture storage keys. - `test/api.test.mjs` — exact catalog/prices parsing; null/zero/absent/invalid prices ignored; allowlist rejects other origins, lookalike origins, credentials, ports, extra queries, non-curated symbols, order/ quote/transfer/user/portfolio routes; GET-only market calls; POST-only paper verifier; malformed verifier response rejection. - `test/fixture.test.mjs` — embedded vs. file fixture equality; WebCrypto hash vs. fixed core-generated hash; canonical field order; no private data; fixture-derived rehearsal quote; fixed curl. - `test/policy.test.mjs` — accessibility/paper labels; fixture-mode labels/default/separate state; local assets/CSP; no account/order/transfer/signing route; relay allowlist; README/llms truth boundaries. No automated test uses real data. No test posts an order/transfer/sign request. The fixture is synthetic. Manual browser smoke tests used the real public catalog, quote, and verifier. Because the hourly feed was stale for most of the session, the same page was exercised in both states: stale (fill correctly disabled) and fresh (at `16:12Z`, public observation `16:00Z`), where the complete paper flow succeeded. Fixture mode then completed the same UI path 24/7 with zero network calls. No runtime price fallback or timestamp re-stamping is shipped. ### Browser validation record - **34 local tests pass** (`node --test apps/track-a-web-demo/test/*.test.mjs`). - Local HTTP smoke: static 200s, relay GET 200 live data with `x-track-a-relay: 1`, relay POST 405, fixed fixture verifier `200` + `verdict: demo`. - Chrome 145 headless, local relay, real catalog (2 listings, 1 quote): first pass at `15:30Z`–`16:02Z` showed `SGOV` observed `15:00Z`, `STALE`, checklist 1/5, fill disabled. - Fresh public quote pass at `16:12Z`: `16:00:00Z` observation, `$97.873266`, 12m24s old, `FRESH`. Checklist 1→5; $50 fill at `$97.8732`; fee $0.10; qty `0.510865`; cash $199.90; cost basis $249.90; local hash/structure checks all PASS; real public verifier returned `demo` with `hash_verified`, `receipt_id_verified`, `fee_consistent`, `fill_consistent`, `consensus_not_supplied`, `no_on_chain_tx`. - Fixture mode at `?mode=fixture`: before a deliberate public-mode switch, Chrome's network log contained **zero** API requests (only local page assets). Fixed `$100.0000`, `SYNTHETIC`; checklist 1→5; $50 fill, qty `0.5`, fee `$0.10`, cash `$199.90`; local checks all PASS; public verifier controls disabled. Switching public showed 0/5, `$0.00`, no fills; switching back restored the fixture fill. No console errors/exceptions. - Plain static direct mode after CORS went live: logged-out Chrome loaded catalog and prices from the Worker with two 200 responses (`direct Worker`), checklist 1/5 because the public quote was 17m stale; fill disabled. A browser POST of the synthetic fixture to the real verifier returned `200` + `verdict: demo` with no console errors. The earlier pre-CORS run showed `MissingAllowOriginHeader` and the honest error state. - Accessibility markers: `lang`, one `h1`, skip link, labels, live regions, dialog label, no unlabelled buttons. --- ## 10. Local serve and hosting truth Working local review: ```bash node apps/track-a-web-demo/serve.mjs # http://127.0.0.1:4173/ real public data (default) # http://127.0.0.1:4173/?mode=fixture fixed synthetic fixture, no network ``` Plain static serve (direct Worker mode; CORS is live, so this is the static-hosting path): ```bash python3 -m http.server 4173 --directory apps/track-a-web-demo # http://127.0.0.1:4173/ direct Worker (CORS live) # http://127.0.0.1:4173/?mode=fixture no API fetch ``` The hosted demo is **https://maweng-demo.binasta.workers.dev**, deployed as a Cloudflare Workers static-assets project using `wrangler.jsonc`. It contains no API code, secrets, account/order/transfer route or relay. `serve.mjs` is for local review only and is not executed by the host. GitHub Pages remains an alternative: `git subtree push --prefix apps/track-a-web-demo origin gh-pages`, then Pages → branch `gh-pages` / root, or upload the directory as a static artifact. Both hosts stay in direct-Worker mode. The scoped public-route CORS is live and was validated from the hosted demo origin. --- ## 11. Truth boundaries - **Not a release**, not an app-store artifact, not a public submission. The hosted paper demo is public, but it is not live trading. - **Not live**: no order, quote, transfer, user, portfolio, ramp, cancel, execute, signing, or wallet path. - **No funds**: $250 is fake local paper cash. It is not a wallet/bank/brokerage/provider balance. - **No capital total**: TOTAL CAPITAL is "Not linked". Paper is excluded by design. - **No invented price**: missing/stale/malformed/blocked public quote means refresh-required and fill disabled. Fixture mode uses only the committed fixture values and says SYNTHETIC FIXTURE / NOT A LIVE QUOTE. - **Two isolated modes**: public paper state and fixture rehearsal state use different localStorage keys; the mode switch saves one and loads the other. Fixture mode makes no market/verifier network request and disables public verification. Default is real public data. - **Fixture is not live evidence**: the rehearsal certificate is not a quote, execution, funds, or on-chain proof. - **Hourly quote / 15-minute window:** the demo is deliberately unfillable for roughly 45 minutes of each hour. Do not re-stamp or fabricate a fresh observation to bypass this. - **No execution-quality claim**: the paper certificate is a local simulation against a public quote reference; it is not a live fill, transaction, tax record, or proof of funds. - **No best-execution/AMM/P2P comparison** and no savings claim. - **No private data or secrets**: no keys, tokens, accounts, wallet addresses, SMS, phone numbers, or seed phrases. The verifier fixture is synthetic. - **No Worker/core/app/schema/money-engine/device edit** was made by this artifact. The Worker CORS change is a separate task's commit; this artifact did not deploy it. - **CORS is live but scoped** for static hosting; direct catalog/prices/verifier fetches were validated from a logged-out browser. The local relay remains an optional same-origin review path. Order/transfer routes remain non-CORS. Wealth is a calculator and record-keeper, not financial advice.