Downloadable offline regions (experimental)

@honua/sdk-js/offline is the first bounded slice of issue #396. It defines a versioned manifest and a storage-neutral download coordinator. It does not make the broader local-first feature complete.

import {
  createOfflineRegionManifest,
  downloadOfflineRegion,
} from "@honua/sdk-js/offline";

const manifest = await createOfflineRegionManifest({
  name: "Field area",
  sourceId: "incidents",
  endpoint: "https://example.test/FeatureServer/0",
  authorizationScopeFingerprint: currentAclFingerprint,
  bounds: { minX: -158.3, minY: 21.4, maxX: -157.6, maxY: 21.8, crs: "EPSG:4326" },
  minZoom: 8,
  maxZoom: 14,
  sourceVersion: "source-v3",
  schemaVersion: "schema-v7",
  planVersion: "plan-v2",
  observation: { state: "live", observedAt: "2026-07-10T10:00:00Z" },
  resources: plannedResources,
});

const receipt = await downloadOfflineRegion(manifest, {
  store: applicationStore,
  load: applicationResourceLoader,
  logicalQuotaBytes: 512 * 1024 * 1024,
  signal: abortController.signal,
  onProgress: renderProgress,
});

Contract guarantees

The manifest contains logical resource ids, not request URLs. The injected loader may resolve short-lived signed URLs or authorization at download time; those values never cross the persistent-store boundary.

Non-goals and remaining work

This slice intentionally provides no IndexedDB or service-worker adapter, no network reachability policy, no resumable partial transaction, no encryption policy, no storage schema migration, no cached query/read integration, and no local edit queue or replica conflict replay. Those remain required before issue #396 can satisfy its GA acceptance criteria. This entrypoint is @experimental and subpath-only so the root and browser bundles do not absorb it.