Drops the cloud-comparison chip and replaces the data-sheet
energy estimate with a real per-call measurement off the L4 GPU.
inference-vllm/proxy.py
- Background sampler reads nvmlDeviceGetPowerUsage every 100 ms into
a 60 s ring buffer. Each forwarded POST records the upstream
wall-clock window and computes the mean power across the matching
samples; results land on the response as X-GPU-Power-W and
X-GPU-Energy-J (joules).
- New GET /v1/power exposes instantaneous + 1 s avg + 5 s avg for
bracket-sampling clients (used by the LLM path, where LiteLLM
hides response headers).
- pynvml init is best-effort: on failure the proxy still serves
traffic, just without power data.
inference-vllm/Dockerfile
- Adds nvidia-ml-py>=12.560 to the proxy's pip layer.
app/emissions.py
- Tracker.record_{llm,ml} accept optional joules_real / power_w_real.
When present, those values land on the row directly and the row is
flagged measured=True. Otherwise we fall back to the data-sheet
…
feat(emissions): per-call inference energy + token tracker
Adds an additive emissions ledger that records every llm.chat call
and every remote app.inference._post call, surfacing the per-query
total Wh / J + token counts on the briefing.
Backend
- app/emissions.py: thread-local Tracker with hardware power profiles
(MI300X 600 W, T4 50 W, Apple M 20 W, x86 30 W) and a summarize()
rollup with by-kind, by-hardware, and frontier-cloud comparison.
- app/llm.py: chat() times each call, picks hardware via engine
detection, reads prompt/completion tokens from LiteLLM usage for
non-stream calls, estimates from response text for streams.
- app/inference.py: _post() records duration vs the MI300X profile.
- app/fsm.py: captures the parent-thread tracker and re-installs it on
the iter_steps runner thread (mirrors the token_callback pattern);
attaches `emissions` alongside the existing `energy` block in both
run() and the iter_steps final event.
- app/context/eo_chip_cache.py + app/flood_layers/prithvi_live.py:
ThreadPoolExecutor initializ…
feat(map): wire TerraMind Buildings + Prithvi-Live layers to map
Round-tripped the per-pixel argmax raster from the droplet so the HF
Space can vectorise it onto WGS84 polygons and the MapLibre layer
actually paints the live model output. Was: only terramind_synthesis's
local fallback path generated polygons; everything else returned
class fractions only and the map showed nothing.
Wire format: droplet's /v1/prithvi-pluvial and /v1/terramind responses
gain `pred_b64` (uint8 base64) + `pred_shape` + (terramind only)
`class_labels`. Small payload — 224x224 uint8 round-trips in ~50 KB.
HF side:
- new app/context/_polygonize.py: polygonize_class_raster() and
polygonize_binary_mask() helpers
- app/context/eo_chip_cache.py adds `bounds_4326` to chip output
- app/context/terramind_nyc lulc/buildings accept bounds_4326,
_try_remote polygonises the response and attaches polygons_geojson
- app/context/terramind_synthesis.py polygonises the remote response
- app/flood_layers/prithvi_live.py polygonises the remote water mask
- app/fsm.py threads chip.boun…
Upload web/sveltekit/src/lib/components/shell/AppFooter.svelte with huggingface_hub
Phase 1 — tests/test_compare_shape.py: asserts /api/agent/stream for a
compare query emits exactly one final event with intent="compare", two
targets each carrying an address field, and a merged paragraph that
splits at "---" into PLACE A / PLACE B sections each with citations.
6/6 pass against the live server.
Phase 2 — CompareBriefing.svelte: when plan.intent=="compare" and
finalResult lands, renders a two-column layout (1fr 1px 1fr grid,
collapses below 900 px) with:
- Per-column .address-header showing the resolved address
- Existing Briefing component in each column, no changes to Briefing
- compare-delta-bar above both columns: one row per canonical section
where the first compared number differs (e.g. "TWI: 12.4 vs 8.2")
- Stone provenance / FindingsRegion unchanged (full-width below)
During streaming the merged paragraph renders in the existing single
Briefing path; the two-column view switches in only after finalResult.
FinalResult interface gains optional intent + target…
Squash-merge of all commits on origin/main not present on HF Space:
- fix(riprap-models): port v2 test_transform patch (services container)
- feat(map): wire TerraMind LULC + Ida 2021 HWM map layers
- fix(map): MapLegend booleans, FloodNet tier proxy
- fix(slides): deck visual fixes
- docs: live-system screenshots (now as LFS/XET pointers, not raw blobs)
- chore: repo cleanup, session artifacts to docs/sessions/
- chore: LFS tracking rules for screenshot and slide PNGs/PPTX
Binary files (screenshots + deck.pptx) are stored as git-lfs/git-xet
pointers so HF's pre-receive hook accepts them. git-xet handles
upload to XET object store during the push.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add Noun Project dam mark, recolored to federal blue
Logo: "Dam" by Chintuza via Noun Project (CC-BY 3.0). The original
SVG embedded the attribution as on-canvas Arial text rendered below
the artwork; the cleaned versions in assets/ strip that text from
the image and carry the credit in body copy on every front-facing
surface, per CC-BY's attribution-required-but-not-on-the-artwork
provision.
assets/:
- logo.svg currentColor variant for inline use
- logo-blue.svg #005EA2 (federal blue) baked
- logo-paper.svg #F4F6F9 (paper) baked, for dark surfaces
- logo.png / @2x federal-blue raster, 256/512 px
- logo-paper.png / @2x paper-cream raster, 256/512 px
Color-matched via rsvg-convert against the Civic Hydrology palette
introduced in e84d03c. The mark inherits CSS color in app contexts
(currentColor) and ships its own fill in standalone files.
App wiring:
- new component web/sveltekit/src/lib/components/shell/RipMark.svelte
inlines the SVG with currentColor; size prop, role=img, aria-label
- AppHeader …
Re-theme: Civic Hydrology palette (USWDS federal blue, cool slate)
src/lib/components/shell/StatusPill.svelte (new)
Live phase + active-step + fired-count indicator for the AppHeader.
Reads from the briefingState rune store. Phases the user sees during
a real query, in order:
● planning intent — planner JSON streaming
● gathering evidence · <step name> · X/Y — FSM data Stones firing
● reconciling · granite4.1 + mellea — waiting on the LLM
● writing briefing — first reconcile token landed
(hidden once briefingState.markReady() fires)
Step labels lifted from the legacy agent.js short-name set so the
pill reads "Sandy 2012" / "FloodNet sensors" / "TTM Battery (NYC
fine-tune)" instead of raw FSM ids. Two specifically renamed for
accuracy: prithvi_eo_v2 → "Ida 2021 polygons (baked lookup)" and
prithvi_eo_live → "Prithvi-NYC-Pluvial v2 segmentation" — the
former is a static spatial join, not a model run, and the old label
misled the user about wh…
fix: pre-import heavy ML modules on main thread; bump footer to v0.4.5
Two fixes spotted on the live PS 188 query:
web/main.py
Beef up the startup pre-import block that exists "so the parallel-
fanout workers don't race each other on first import" (per
CLAUDE.md "known sharp edges").
Previously the startup imported terratorch + tsfm_public top-level
only. That left transformers' lazy `PreTrainedModel` getter, the
tsfm_public.toolkit.get_model chain, and every specialist's own
module-level deps probe to be exercised in FSM worker threads —
which races the lazy-import system and surfaces as
ModuleNotFoundError("Could not import module 'PreTrainedModel'")
or "deps unavailable: tsfm_public" even when both ARE installed.
New pre-import block now also touches:
transformers.PreTrainedModel (resolves the lazy chain)
tsfm_public.TinyTimeMixerForPrediction
tsfm_public.toolkit.get_model.get_model
plus force-imports every specialist module that does heavy ML at
runtime so its mo…
ux v0.4.5: replace landing-page mini-map mockup with a real MapLibre tile
The hand-drawn SVG mockup of Red Hook on the landing page's "What
you'll get back" preview was carried over from the design-handoff
prototype. Replace it with a real MapLibre instance pinned to 80
Pioneer Street so visitors see a working map at the actual scale,
with the same stylized FEMA AE polygon / HWM contour / FloodNet pin
/ 311 cluster / address pin overlays.
src/lib/components/landing/LandMiniMap.svelte (new)
- Carto Positron base, no nav controls, no scale, interactive=false
(it's a preview, not a navigable map).
- 6:5 aspect ratio matches the original SVG container so the
3-pane layout doesn't shift.
- z14.5 / centered on -74.0096, 40.6776 (the same Red Hook anchor
the sample fixture uses).
- Legend overlay (empirical / modeled / proxy swatches) painted
on top of the canvas, same place as before.
src/lib/components/landing/LandPreview.svelte
- Map pane swaps the inline <svg> for <LandMiniMap />.
- Updated meta line ("80 Pi…
User feedback: "the marketing landing should be the app page. it's
fine. just get rid of the /app page."
src/routes/app/ — deleted (+page.svelte + +page.ts)
web/main.py — drops the /app GET route
src/routes/+layout.svelte — onResetCold redirects to / again
(instead of /app)
src/lib/components/shell/AppHeader.svelte
— wordmark links to / (was /app)
src/lib/components/landing/LandHeader.svelte
— drops the "Open the app" nav link;
the hero query box IS the app entry
Routing simplifies to:
/ marketing landing + query entry (app entry)
/q/sample prerendered Red Hook briefing
/q/<id> live FSM briefing
/print/<id> print artifact
Build clean. The cold-start ColdStart.svelte component stays on disk
(in case a future iteration wants a separate analyst-mode entry) but
isn't m…
Two related changes that close out v0.4.5 — the landing page that the
README §"Landing page" called for, and the legacy custom-element
fallback routes that were silently masking the bug ("I see the
pre-v0.4.4 UI" was someone's tab on /single or /legacy).
LANDING PAGE — new at /, four sections per the README spec:
src/lib/components/landing/LandHeader.svelte
Wordmark · slash · "Flood Exposure Briefing · NYC" · nav links
(Open the app / Methodology / Sources). Distinct from AppHeader
so the marketing surface reads as its own page.
src/lib/components/landing/LandHero.svelte
Italic-serif headline ("A flood exposure briefing for *any place*
in New York City."), serif deck, big query box ("Brief this place
→"), cycling examples on a fixed dotted-underline rail (six NYC
queries, 2.2 s rotation, click to run). Submit + click both
navigate to /q/<query>.
src/lib/components/landing/LandPreview.svelte
"What you'll get back" three-pane grid: briefing e…
ux v0.4.5: nine polish deltas on the Findings region
Surgical polish on the shipped v0.4.4 Findings region. None of these
are structural; the card grammar, briefing prose, Mellea status strip,
four-tier palette, cold-start, footer, and PDF template all stay.
P1 — Status semantics (V0.4.5_SPEC §1, "actively misrepresenting
system integrity"). Splits the FSM specialist status from the
four-state ok|warn|error|silent into the five-state
fired / silent_by_design / warned / errored / not_invoked.
- lib/types/card.ts gains a documented SpecialistStatus union
- StoneTally / RunHealthStrip / ProvenanceTrace updated to
branch on the new states
- cardAdapter mapStatus() carefully classifies FSM trace-silent
as silent_by_design, not errored — the spec voice
- Top tally now reads "5 Stones · 21 fired · 5 silent · 1
errored · 24.0s · 25 registered" instead of the old "15/18
functions fired · 3 error" lie
P2 — Capstone meta-card field plumbing (§2). Wires the four metrics
to the rec…
ux: stream Findings cards in real time + fade-in instead of typing caret
Two follow-ups from the live Red Hook walkthrough:
1) **Findings stream as specialists fire.** Previously cards only
populated from `finalResult` (one event at end of stream). Now a
`liveResults` map updates on every SSE `step` event and feeds the
adapter; cards pop into each Stone's rail as their specialist
completes.
* lib/client/cardAdapter.ts gains `applyStepEventToLiveState()`,
mapping step names like `sandy_inundation` / `dep_stormwater` /
`mta_entrance_exposure` to the FSM state-keys the card builders
expect (`sandy`, `dep`, `mta_entrances`, ...). The slim `step.result`
summary shapes are translated into the doc-payload shapes the
builders read; one card per fired specialist, partial-data tolerant.
* `adaptFinalToFindings()` accepts `Partial<FinalResult> | null` and
skips the Capstone meta card until at least one of streaming /
finalResult has produced something to summarise.
* src/routes/q/[queryId]/+page.svelte plumbs `…
ux: build the Findings region (12 card variants + StoneRegion + run-health)
Telescoped from ~25 spine commits into the three UI generations:
Lit (kept on disk for reference, not loaded):
web/static/components/{briefing,trace,signals,sources-footer}.js
Component-per-tag custom elements with reactive props.
Svelte 5 custom-element bundle (legacy primary, served at /legacy):
web/svelte/src/lib/{Briefing,Trace,SourcesFooter}.svelte + main.js
Shared store for cross-component highlight (citeIndex,
highlightedDocId). Built artifact ships at web/static/dist/riprap.js.
SvelteKit design-system v0.4.2 (the new primary):
web/sveltekit/src/* — adapter-static build, IBM Plex, four-tier
glyphs, MapLibre map with custom basemap, server-side render of
/q/sample + /q/<query>. Built artifact ships at web/sveltekit/build/.
web/main.py wired up the new endpoint surface:
/, /q/sample, /q/<query> → SvelteKit build
/legacy, /single, /compare → Svelte custom-element bundle
/api/agent/stream → SSE pipeline (plan/step/toke…