@tokenoftrust/storefront-runner 2.4.88 → 2.4.89

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (152) hide show
  1. package/apps/storefront/astro.config.mjs +1 -1
  2. package/apps/storefront/perf/README.md +6 -6
  3. package/apps/storefront/perf/assert-budgets.ts +2 -2
  4. package/apps/storefront/src/components/content/storefront/blog/BlogPaywall.astro +1 -1
  5. package/apps/storefront/src/config/adminTargetTenant.ts +1 -1
  6. package/apps/storefront/src/config/devTenants.ts +1 -1
  7. package/apps/storefront/src/config/resolver.ts +1 -1
  8. package/apps/storefront/src/layouts/Layout.astro +4 -4
  9. package/apps/storefront/src/lib/{admin → access/admin}/README.md +3 -3
  10. package/apps/storefront/src/lib/{admin → access/admin}/adminShell.ts +1 -1
  11. package/apps/storefront/src/lib/{admin → access/admin}/envelope.ts +2 -2
  12. package/apps/storefront/src/lib/{admin → access/admin}/viewmodels/settings.ts +2 -2
  13. package/apps/storefront/src/lib/{auth → access/auth}/adminApiGuard.ts +2 -2
  14. package/apps/storefront/src/lib/{auth → access/auth}/adminEntry.ts +2 -2
  15. package/apps/storefront/src/lib/{auth → access/auth}/adminLanding.ts +1 -1
  16. package/apps/storefront/src/lib/{auth → access/auth}/identityToken.ts +1 -1
  17. package/apps/storefront/src/lib/{auth → access/auth}/loginGate.ts +2 -2
  18. package/apps/storefront/src/lib/{auth → access/auth}/totAccessClient.ts +4 -4
  19. package/apps/storefront/src/lib/{dashboard → access/dashboard}/delegateGate.ts +2 -2
  20. package/apps/storefront/src/lib/{dashboard → access/dashboard}/staffAdmission.ts +1 -1
  21. package/apps/storefront/src/lib/{dashboard → access/dashboard}/tenantSelection.ts +1 -1
  22. package/apps/storefront/src/lib/{admin/services/mock → access/fixtures}/settings.ts +4 -4
  23. package/apps/storefront/src/lib/{shared → access/shared}/accessExplain.ts +1 -1
  24. package/apps/storefront/src/lib/{adminTenantEnvelope.ts → access/shared/adminTenantEnvelope.ts} +3 -3
  25. package/apps/storefront/src/lib/{shared → access/shared}/developerInvites.ts +4 -4
  26. package/apps/storefront/src/lib/{shared → access/shared}/invitePreflight.ts +1 -1
  27. package/apps/storefront/src/lib/{shared → access/shared}/principalGrants.ts +2 -2
  28. package/apps/storefront/src/lib/{shared → access/shared}/viewerGrant.ts +1 -1
  29. package/apps/storefront/src/lib/activity/fixtures/evidence.ts +2 -2
  30. package/apps/storefront/src/lib/activity/uiActor.ts +4 -4
  31. package/apps/storefront/src/lib/activity/workerCommit.ts +1 -1
  32. package/apps/storefront/src/lib/admin/services/mock/index.ts +4 -4
  33. package/apps/storefront/src/lib/{admin → automation/admin}/viewmodels/aiWorkflows.ts +3 -3
  34. package/apps/storefront/src/lib/{admin → automation}/ai/askEnvelope.ts +1 -1
  35. package/apps/storefront/src/lib/{admin → automation}/ai/operationalRuns.ts +4 -4
  36. package/apps/storefront/src/lib/{admin/services/mock → automation/fixtures}/aiWorkflows.ts +4 -4
  37. package/apps/storefront/src/lib/basePath.ts +1 -1
  38. package/apps/storefront/src/lib/catalog/fixtures/products.ts +4 -4
  39. package/apps/storefront/src/lib/checkout/admin/checkoutStyleTarget.ts +2 -2
  40. package/apps/storefront/src/lib/checkout/fixtures/checkoutSettings.ts +1 -1
  41. package/apps/storefront/src/lib/compliance/browser/checkoutVerificationFlow.ts +1 -1
  42. package/apps/storefront/src/lib/compliance/verification/totVerificationClient.ts +1 -1
  43. package/apps/storefront/src/lib/content/blog/access.ts +1 -1
  44. package/apps/storefront/src/lib/content/blog/postView.ts +2 -2
  45. package/apps/storefront/src/lib/content/storyblok/provider.ts +1 -1
  46. package/apps/storefront/src/lib/customers/fixtures/customers.ts +3 -3
  47. package/apps/storefront/src/lib/{admin → developer-experience/admin}/memoizeByEnvelope.ts +1 -1
  48. package/apps/storefront/src/lib/{dev → developer-experience/dev}/activityIngestToken.ts +2 -2
  49. package/apps/storefront/src/lib/{dev → developer-experience/dev}/cliSignInCode.ts +3 -3
  50. package/apps/storefront/src/lib/{dev → developer-experience/dev}/livePreview.ts +1 -1
  51. package/apps/storefront/src/lib/{dev → developer-experience/dev}/previewStatus.ts +2 -2
  52. package/apps/storefront/src/lib/{dev → developer-experience/dev}/rendezvousBroker.ts +2 -2
  53. package/apps/storefront/src/lib/{dev → developer-experience/dev}/subjectReissue.ts +2 -2
  54. package/apps/storefront/src/lib/engagement/messaging/messagesClient.ts +1 -1
  55. package/apps/storefront/src/lib/fulfillment/fulfillmentService.ts +3 -3
  56. package/apps/storefront/src/lib/integrations/integration/browserEnvironment.ts +1 -1
  57. package/apps/storefront/src/lib/{monitoring → observability/monitoring}/manifest.ts +2 -2
  58. package/apps/storefront/src/lib/{analytics → observability/performance}/budgets.json +1 -1
  59. package/apps/storefront/src/lib/orders/fixtures/orders.ts +4 -4
  60. package/apps/storefront/src/lib/reporting/fixtures/reporting.ts +3 -3
  61. package/apps/storefront/src/lib/runtimeEnv.ts +1 -1
  62. package/apps/storefront/src/lib/subscriptions/fixtures/subscriptions.ts +3 -3
  63. package/apps/storefront/src/middleware/controlPlane.ts +6 -6
  64. package/apps/storefront/src/middleware/index.ts +11 -11
  65. package/apps/storefront/src/middleware/renderChain.ts +5 -5
  66. package/apps/storefront/src/pages/api/admin/activity-alerts.ts +1 -1
  67. package/apps/storefront/src/pages/api/admin/commerce-readiness.ts +1 -1
  68. package/apps/storefront/src/pages/api/admin/fulfillment/batches.ts +1 -1
  69. package/apps/storefront/src/pages/api/admin/fulfillment/orders/[id]/address.ts +1 -1
  70. package/apps/storefront/src/pages/api/admin/fulfillment/orders/[id].ts +1 -1
  71. package/apps/storefront/src/pages/api/admin/interaction-insights.ts +1 -1
  72. package/apps/storefront/src/pages/api/admin/orders/[id].ts +1 -1
  73. package/apps/storefront/src/pages/api/admin/orders.ts +1 -1
  74. package/apps/storefront/src/pages/api/auth/logout.ts +2 -2
  75. package/apps/storefront/src/pages/api/auth/magic-exchange.ts +6 -6
  76. package/apps/storefront/src/pages/api/auth/send.ts +2 -2
  77. package/apps/storefront/src/pages/api/auth/step-up-send.ts +1 -1
  78. package/apps/storefront/src/pages/api/auth/step-up-verify.ts +3 -3
  79. package/apps/storefront/src/pages/api/auth/verify.ts +4 -4
  80. package/apps/storefront/src/pages/api/blog/[collection]/[slug]/react.ts +1 -1
  81. package/apps/storefront/src/pages/api/newsletter/[collection]/subscribe.ts +1 -1
  82. package/apps/storefront/src/pages/api/rum/vitals.ts +1 -1
  83. package/apps/storefront/src/pages/auth/login.astro +2 -2
  84. package/apps/storefront/src/pages/auth/magic.astro +1 -1
  85. package/package.json +1 -1
  86. package/scripts/dev/locate.mjs +1 -1
  87. package/apps/storefront/src/lib/admin/ai/index.ts +0 -6
  88. /package/apps/storefront/src/components/{auth → access/storefront/auth}/AuthBadge.astro +0 -0
  89. /package/apps/storefront/src/lib/{auth → access/auth}/brokerAssertion.ts +0 -0
  90. /package/apps/storefront/src/lib/{auth → access/auth}/devAuth.ts +0 -0
  91. /package/apps/storefront/src/lib/{auth → access/auth}/gatePage.ts +0 -0
  92. /package/apps/storefront/src/lib/{auth → access/auth}/internalContentAuthority.ts +0 -0
  93. /package/apps/storefront/src/lib/{auth → access/auth}/mcpClientAssertion.ts +0 -0
  94. /package/apps/storefront/src/lib/{auth → access/auth}/operatorSession.ts +0 -0
  95. /package/apps/storefront/src/lib/{auth → access/auth}/route.ts +0 -0
  96. /package/apps/storefront/src/lib/{auth → access/auth}/session.ts +0 -0
  97. /package/apps/storefront/src/lib/{auth → access/auth}/stepUpChallenge.ts +0 -0
  98. /package/apps/storefront/src/lib/{dashboard → access/dashboard}/staffVendorAccess.ts +0 -0
  99. /package/apps/storefront/src/lib/{dashboard → access/dashboard}/vendorQuery.ts +0 -0
  100. /package/apps/storefront/src/lib/{admin/services/mock → access/fixtures}/tenants.ts +0 -0
  101. /package/apps/storefront/src/lib/{email → access/notifications}/magicLinkInviteEmail.ts +0 -0
  102. /package/apps/storefront/src/lib/{privacy → access/privacy}/emailHint.ts +0 -0
  103. /package/apps/storefront/src/lib/{rate → access/rate}/kvWindow.ts +0 -0
  104. /package/apps/storefront/src/lib/{shared → access/shared}/capability.ts +0 -0
  105. /package/apps/storefront/src/lib/{cspStaticHashes.ts → access/shared/cspStaticHashes.ts} +0 -0
  106. /package/apps/storefront/src/lib/{demoGate.ts → access/shared/demoGate.ts} +0 -0
  107. /package/apps/storefront/src/lib/{maintenance.ts → access/shared/maintenance.ts} +0 -0
  108. /package/apps/storefront/src/lib/{securityHeaders.ts → access/shared/securityHeaders.ts} +0 -0
  109. /package/apps/storefront/src/lib/{tenantOrigins.ts → access/shared/tenantOrigins.ts} +0 -0
  110. /package/apps/storefront/src/lib/{tenantRouting.ts → access/shared/tenantRouting.ts} +0 -0
  111. /package/apps/storefront/src/lib/{admin → automation}/ai/approvalMode.ts +0 -0
  112. /package/apps/storefront/src/lib/{admin → automation}/ai/audit.ts +0 -0
  113. /package/apps/storefront/src/lib/{admin → automation}/ai/recommendation.ts +0 -0
  114. /package/apps/storefront/src/lib/{admin → developer-experience/admin}/seed.ts +0 -0
  115. /package/apps/storefront/src/lib/{dev → developer-experience/dev}/activityStore.ts +0 -0
  116. /package/apps/storefront/src/lib/{dev → developer-experience/dev}/ai-widget-client.js +0 -0
  117. /package/apps/storefront/src/lib/{dev → developer-experience/dev}/apiBase.ts +0 -0
  118. /package/apps/storefront/src/lib/{dev → developer-experience/dev}/cockpit/ask.ts +0 -0
  119. /package/apps/storefront/src/lib/{dev → developer-experience/dev}/cockpit/clickToSource.ts +0 -0
  120. /package/apps/storefront/src/lib/{dev → developer-experience/dev}/cockpit/copyCommand.ts +0 -0
  121. /package/apps/storefront/src/lib/{dev → developer-experience/dev}/cockpit/files.ts +0 -0
  122. /package/apps/storefront/src/lib/{dev → developer-experience/dev}/cockpit/hostedActivity.ts +0 -0
  123. /package/apps/storefront/src/lib/{dev → developer-experience/dev}/cockpit/infoPopover.ts +0 -0
  124. /package/apps/storefront/src/lib/{dev → developer-experience/dev}/cockpit/mcpCopy.ts +0 -0
  125. /package/apps/storefront/src/lib/{dev → developer-experience/dev}/cockpit/monitor.ts +0 -0
  126. /package/apps/storefront/src/lib/{dev → developer-experience/dev}/cockpit/stepper.ts +0 -0
  127. /package/apps/storefront/src/lib/{dev → developer-experience/dev}/cockpit/themeToggle.ts +0 -0
  128. /package/apps/storefront/src/lib/{dev → developer-experience/dev}/devDraft.ts +0 -0
  129. /package/apps/storefront/src/lib/{dev → developer-experience/dev}/obstacleStore.ts +0 -0
  130. /package/apps/storefront/src/lib/{dev → developer-experience/dev}/runtimeStore.ts +0 -0
  131. /package/apps/storefront/src/lib/{dev → developer-experience/dev}/storeStatus.ts +0 -0
  132. /package/apps/storefront/src/lib/{fixtures → developer-experience/fixtures}/regulated-commerce-truth/index.ts +0 -0
  133. /package/apps/storefront/src/lib/{fixtures → developer-experience/fixtures}/ws3-readonly-clone-preflight/index.ts +0 -0
  134. /package/apps/storefront/src/lib/{http → developer-experience/http}/fetchTransport.ts +0 -0
  135. /package/apps/storefront/src/lib/{http → developer-experience/http}/mcpServiceCall.ts +0 -0
  136. /package/apps/storefront/src/lib/{memoryKv.ts → developer-experience/shared/memoryKv.ts} +0 -0
  137. /package/apps/storefront/src/lib/{cloudflare-workers.d.ts → developer-experience/types/cloudflare-workers.d.ts} +0 -0
  138. /package/apps/storefront/src/lib/{diag → observability/diag}/capture.ts +0 -0
  139. /package/apps/storefront/src/lib/{diag → observability/diag}/consoleLine.ts +0 -0
  140. /package/apps/storefront/src/lib/{diag → observability/diag}/debugConsole.ts +0 -0
  141. /package/apps/storefront/src/lib/{diag → observability/diag}/debugMode.ts +0 -0
  142. /package/apps/storefront/src/lib/{diag → observability/diag}/debugWindow.ts +0 -0
  143. /package/apps/storefront/src/lib/{diag → observability/diag}/redact.ts +0 -0
  144. /package/apps/storefront/src/lib/{diag → observability/diag}/reference.ts +0 -0
  145. /package/apps/storefront/src/lib/{diag → observability/diag}/referenceStore.ts +0 -0
  146. /package/apps/storefront/src/lib/{diag → observability/diag}/report.ts +0 -0
  147. /package/apps/storefront/src/lib/{diag → observability/diag}/session.ts +0 -0
  148. /package/apps/storefront/src/lib/{analytics → observability/performance}/lighthouseReport.ts +0 -0
  149. /package/apps/storefront/src/lib/{analytics → observability/performance}/perfBudgets.ts +0 -0
  150. /package/apps/storefront/src/lib/{analytics → observability/performance}/rumAlert.ts +0 -0
  151. /package/apps/storefront/src/lib/{analytics → observability/performance}/webVitals.ts +0 -0
  152. /package/apps/storefront/src/lib/{health.ts → observability/shared/health.ts} +0 -0
@@ -31,7 +31,7 @@ const cliVersion = (() => {
31
31
  const cliInstallSpec = cliVersion ? `@tokenoftrust/cli@${cliVersion}` : "@tokenoftrust/cli";
32
32
 
33
33
  // The commit THIS build was cut from, baked in at BUILD time so /health can report
34
- // exactly which code is live (see src/lib/health.ts + src/middleware). Prefer a CI-
34
+ // exactly which code is live (see src/lib/observability/shared/health.ts + src/middleware). Prefer a CI-
35
35
  // provided SHA (Workers Builds / GitHub Actions / CF Pages) so the value is right even
36
36
  // when the build runs from a shallow/detached checkout; fall back to `git rev-parse`
37
37
  // for local deploys. deploy.sh's source guard pins HEAD to origin/<deploySourceBranch>,
@@ -9,12 +9,12 @@ harness); the **field half** (Real User Monitoring) lives in
9
9
 
10
10
  | File | Role |
11
11
  |------|------|
12
- | `../src/lib/analytics/budgets.json` | **Source of truth.** Route budgets (LCP/INP/CLS p75 + JS/CSS/image/total KiB) + the third-party script allowlist. Edit here; everything derives from it. |
13
- | `../src/lib/analytics/perfBudgets.ts` | Typed lens + **pure** budget-assertion logic (`evaluateManifest`) + the Lighthouse-budgets exporter (`toLighthouseBudgets`). Unit-tested in `perfBudgets.test.ts`. |
14
- | `../src/lib/analytics/lighthouseReport.ts` | Pure adapter: a Lighthouse result (LHR JSON) → a `RouteMeasurement` the gate evaluates. Unit-tested in `lighthouseReport.test.ts`. |
12
+ | `../src/lib/observability/performance/budgets.json` | **Source of truth.** Route budgets (LCP/INP/CLS p75 + JS/CSS/image/total KiB) + the third-party script allowlist. Edit here; everything derives from it. |
13
+ | `../src/lib/observability/performance/perfBudgets.ts` | Typed lens + **pure** budget-assertion logic (`evaluateManifest`) + the Lighthouse-budgets exporter (`toLighthouseBudgets`). Unit-tested in `perfBudgets.test.ts`. |
14
+ | `../src/lib/observability/performance/lighthouseReport.ts` | Pure adapter: a Lighthouse result (LHR JSON) → a `RouteMeasurement` the gate evaluates. Unit-tested in `lighthouseReport.test.ts`. |
15
15
  | `assert-budgets.ts` | Thin CLI: reads measurements / LHRs, runs the gate, exits non-zero on a violation. |
16
- | `../src/lib/analytics/webVitals.ts` | Field RUM beacon (LCP/INP/CLS from real visitors → the RUM sink). |
17
- | `../src/lib/analytics/rumAlert.ts` | Pure sink-side regression-alert contract; feeds F16's `core-web-vitals` monitor. Unit-tested in `rumAlert.test.ts`. |
16
+ | `../src/lib/observability/performance/webVitals.ts` | Field RUM beacon (LCP/INP/CLS from real visitors → the RUM sink). |
17
+ | `../src/lib/observability/performance/rumAlert.ts` | Pure sink-side regression-alert contract; feeds F16's `core-web-vitals` monitor. Unit-tested in `rumAlert.test.ts`. |
18
18
 
19
19
  The budget numbers are enforced identically in three places, all reading the one
20
20
  manifest: the lab gate here, a Lighthouse `--budget-path` run (via
@@ -56,7 +56,7 @@ silently drift.
56
56
 
57
57
  ## Field RUM
58
58
 
59
- `startWebVitals()` (from `../src/lib/analytics/webVitals.ts`) is called from the
59
+ `startWebVitals()` (from `../src/lib/observability/performance/webVitals.ts`) is called from the
60
60
  client entry; it measures LCP/INP/CLS per real navigation, buckets each into the
61
61
  same budgeted route id the lab gate uses, and beacons finished samples to the RUM
62
62
  sink (`RUM_BEACON_PATH`). The sink rolls samples up per route/hour and calls
@@ -41,8 +41,8 @@ import {
41
41
  ROUTE_IDS,
42
42
  type RouteId,
43
43
  type RouteMeasurement,
44
- } from "../src/lib/analytics/perfBudgets.js";
45
- import { lhrToMeasurement, type LighthouseResult } from "../src/lib/analytics/lighthouseReport.js";
44
+ } from "../src/lib/observability/performance/perfBudgets.js";
45
+ import { lhrToMeasurement, type LighthouseResult } from "../src/lib/observability/performance/lighthouseReport.js";
46
46
 
47
47
  function die(msg: string, code = 2): never {
48
48
  process.stderr.write(`assert-budgets: ${msg}\n`);
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  // Paywall card shown under the teaser of a gated post the viewer can't read in
3
- // full. Mirrors the "Coming soon" host gate (`src/lib/auth/gatePage.ts`):
3
+ // full. Mirrors the "Coming soon" host gate (`src/lib/access/auth/gatePage.ts`):
4
4
  // badge + headline + one line of value + a single CTA — restyled with the site's
5
5
  // design tokens so it reads as native article chrome, and preceded by a fade that
6
6
  // dissolves the truncated body into the card.
@@ -4,7 +4,7 @@
4
4
  *
5
5
  * The admin console can operate on a target tenant that differs from the routed
6
6
  * (adminApp) tenant on `Astro.locals.tenant` — a real ToT-staff session may point
7
- * `targetTenant` at another tenant it has access to (see lib/adminTenantEnvelope).
7
+ * `targetTenant` at another tenant it has access to (see lib/access/shared/adminTenantEnvelope).
8
8
  * Panels that need the target's real config (e.g. the checkout appearance
9
9
  * panel, which derives from `theme_tokens` + `commerce.checkout`) resolve it HERE,
10
10
  * in the config layer, rather than reaching into the static tenant map — so they
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Dev-only tenant-registry seam for the localhost sign-in bypass.
3
3
  *
4
- * `lib/auth/devAuth` can't import the concrete static tenant map directly
4
+ * `lib/access/auth/devAuth` can't import the concrete static tenant map directly
5
5
  * (tenancy-resolver-fence — the registry stays behind the `config` boundary so a
6
6
  * single-tenant extraction stays a drop-in). This exposes exactly the one thing
7
7
  * that bypass needs: the resources a local dev session is granted membership on.
@@ -31,7 +31,7 @@ import { KvTenantResolver, putTenant } from "@/config/kvTenantResolver";
31
31
  import { getTenantTheme } from "@/themes/tenants";
32
32
  import { devTenantsToSeed } from "@/config/devTenantSeed";
33
33
  import { tenantAnalyticsRawById } from "@/config/tenantAnalyticsFiles";
34
- import { MemoryKv } from "@/lib/memoryKv";
34
+ import { MemoryKv } from "@/lib/developer-experience/shared/memoryKv";
35
35
 
36
36
  // LOCAL dev loop discovery: enumerate the colocated tenant dirs on disk,
37
37
  // INCLUDING a developer's checkout grafted in by `tot dev` (scripts/tot-dev.mjs).
@@ -21,7 +21,7 @@ import ShippingRestrictionNotice from "@/components/compliance/storefront/compli
21
21
  import ExciseTaxNotice from "@/components/compliance/storefront/compliance/ExciseTaxNotice.astro";
22
22
  import { EXCISE_TAX_DISCLOSURE_TEXT } from "@/lib/compliance/rawComplianceNotices";
23
23
  import IsolatedAgeGate from "@/components/compliance/storefront/islands/IsolatedAgeGate.tsx";
24
- import AuthBadge from "@/components/auth/AuthBadge.astro";
24
+ import AuthBadge from "@/components/access/storefront/auth/AuthBadge.astro";
25
25
  import { referenceTheme } from "@/themes/reference";
26
26
  import { mergeTheme } from "@/themes/schema";
27
27
  import { organizationLd, websiteLd } from "@/lib/content/shared/jsonld";
@@ -37,7 +37,7 @@ import { splitFooterLegal } from "@/lib/content/chrome/footerLegal";
37
37
  import { bindManagedCartAnchors, managedCartHref } from "@/lib/content/chrome/managedCart";
38
38
  import type { HeaderVariant, FooterVariant } from "@/lib/content/chrome/model";
39
39
  import { renderIntegrationPhases, INTERACTION_TRACKING_BOOT_JS } from "@tot/public-runtime";
40
- import { readViewerSession } from "@/lib/auth/route";
40
+ import { readViewerSession } from "@/lib/access/auth/route";
41
41
  import AppWidgetFrame from "@/components/integrations/storefront/apps/AppWidgetFrame.astro";
42
42
  import { getRegistryService } from "@/lib/integrations/apps/registryAccess.js";
43
43
  import { renderWidgetSlot } from "@/lib/integrations/apps/widgets/renderSlot.js";
@@ -601,7 +601,7 @@ const footerWidgets = await renderWidgetSlot(
601
601
  where PerformanceObserver is absent. This is the per-route-template
602
602
  signal the `core-web-vitals` monitor consumes. */}
603
603
  <script>
604
- import { startConsentGatedWebVitals } from "@/lib/analytics/webVitals";
604
+ import { startConsentGatedWebVitals } from "@/lib/observability/performance/webVitals";
605
605
  startConsentGatedWebVitals();
606
606
  </script>
607
607
 
@@ -631,7 +631,7 @@ const footerWidgets = await renderWidgetSlot(
631
631
  listener, and the install-once marker makes a double install a no-op —
632
632
  which is what makes the raw chrome wrapper spliced into this document
633
633
  (above) safe. Emitted as `is:inline` + the page nonce so it needs no
634
- entry in lib/cspStaticHashes.ts. */}
634
+ entry in lib/access/shared/cspStaticHashes.ts. */}
635
635
  <script is:inline nonce={cspNonce} set:html={INTERACTION_TRACKING_BOOT_JS}></script>
636
636
 
637
637
  {/* Swaps every <AsyncStylesheet>-rendered preload link to rel="stylesheet"
@@ -10,8 +10,8 @@ these implement.
10
10
  ## Tenant envelope
11
11
 
12
12
  The canonical tenant envelope is `AdminTenantEnvelope`, defined in
13
- `lib/adminTenantEnvelope.ts` (admin-tenant-mode) and re-exported from
14
- `lib/admin/envelope.ts` so everything under `lib/admin/**` can import it from
13
+ `lib/access/shared/adminTenantEnvelope.ts` (admin-tenant-mode) and re-exported from
14
+ `lib/access/admin/envelope.ts` so everything under `lib/admin/**` can import it from
15
15
  a stable relative path:
16
16
 
17
17
  ```ts
@@ -29,7 +29,7 @@ refused not hidden-only). `targetTenant` is the sole key mock services use to
29
29
  select/derive data. **Authorization must always be evaluated against
30
30
  `targetTenant`, never `adminAppTenant`** (decision `tenant-envelope-contract`).
31
31
 
32
- (`lib/admin/envelope.ts` used to declare its own 2-field copy of this
32
+ (`lib/access/admin/envelope.ts` used to declare its own 2-field copy of this
33
33
  interface — data-view-contracts and admin-tenant-mode were built in parallel
34
34
  per that decision, with no live coordination. Reconciled here per decision
35
35
  `envelope-type-duplication-follow-up`: one canonical type, re-exported.)
@@ -10,7 +10,7 @@
10
10
  * only (window.__toTAdminAsk + a "tot:admin-ask" CustomEvent), never sent over
11
11
  * the network.
12
12
  */
13
- import { buildAskEnvelope, type AskEnvelope } from "./ai/askEnvelope";
13
+ import { buildAskEnvelope, type AskEnvelope } from "../../automation/ai/askEnvelope";
14
14
 
15
15
  /** Static shell data shared by server-rendered navigation and browser startup. */
16
16
  export const ADMIN_SHELL_CONFIG = {
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * Canonical tenant envelope for the admin console lives in
3
- * `lib/adminTenantEnvelope.ts` (admin-tenant-mode) — it carries the real
3
+ * `lib/access/shared/adminTenantEnvelope.ts` (admin-tenant-mode) — it carries the real
4
4
  * staff-override authorization (`resolveAdminTenantMode`) that admin.astro
5
5
  * actually runs. This module re-exports that type so every mock service under
6
6
  * `lib/admin/**` can keep importing it from a stable relative path
7
7
  * (`../../envelope`) without declaring a second, competing interface.
8
8
  */
9
- export type { AdminTenantEnvelope } from "@/lib/adminTenantEnvelope";
9
+ export type { AdminTenantEnvelope } from "@/lib/access/shared/adminTenantEnvelope";
@@ -7,8 +7,8 @@
7
7
  */
8
8
 
9
9
  import type { CheckoutStyle } from "@tot/public-runtime";
10
- import type { ApprovalMode } from "../ai/approvalMode";
11
- import type { AuditEvent } from "../ai/audit";
10
+ import type { ApprovalMode } from "../../../automation/ai/approvalMode";
11
+ import type { AuditEvent } from "../../../automation/ai/audit";
12
12
 
13
13
  export type { ApprovalMode };
14
14
  export type { CheckoutStyle };
@@ -17,8 +17,8 @@
17
17
  * Astro/I-O wrapper the routes call.
18
18
  */
19
19
  import type { APIContext } from "astro";
20
- import { readViewerSession } from "@/lib/auth/route";
21
- import { resolveAdminEntry, type AdminEntryDecision } from "@/lib/auth/adminEntry";
20
+ import { readViewerSession } from "@/lib/access/auth/route";
21
+ import { resolveAdminEntry, type AdminEntryDecision } from "@/lib/access/auth/adminEntry";
22
22
  import type { SessionRecord } from "./session.js";
23
23
 
24
24
  export type AdminApiAccess =
@@ -31,14 +31,14 @@
31
31
  */
32
32
  import type { SessionRecord } from "./session.js";
33
33
  import { sessionHostCapability } from "./loginGate.js";
34
- import { staffAdmits } from "@/lib/dashboard/tenantSelection";
34
+ import { staffAdmits } from "@/lib/access/dashboard/tenantSelection";
35
35
  import {
36
36
  decideIsOwner,
37
37
  isOwnerCapability,
38
38
  resolveShipCapabilities,
39
39
  type Capability,
40
40
  type ShipCapabilities,
41
- } from "@/lib/shared/capability";
41
+ } from "@/lib/access/shared/capability";
42
42
 
43
43
  /** Which entry case a viewer is in, for chrome + the DoD test matrix. */
44
44
  export type AdminEntryPrincipal =
@@ -25,7 +25,7 @@
25
25
  import type { SessionRecord } from "./session.js";
26
26
  import { sessionAdmitsHost } from "./loginGate.js";
27
27
  import { safeNext } from "./route.js";
28
- import { selectTenant } from "@/lib/dashboard/tenantSelection";
28
+ import { selectTenant } from "@/lib/access/dashboard/tenantSelection";
29
29
 
30
30
  /** The tenant-selection surface, in both host-routed and tenant-first path forms. */
31
31
  export function isAdminSelectPath(pathname: string): boolean {
@@ -31,7 +31,7 @@ import {
31
31
  TENANT_ROLES,
32
32
  isTenantRole,
33
33
  type TenantRole,
34
- } from "@/lib/shared/capability";
34
+ } from "@/lib/access/shared/capability";
35
35
 
36
36
  /** tot's issuer — consumers pin/allowlist this (`auth.jwt.issuer`). */
37
37
  export const TOT_ISSUER = "tokenoftrust-internal-ops";
@@ -13,8 +13,8 @@
13
13
  * drifting apart. The auth surface itself (/auth/*, /api/auth/*) is always exempt
14
14
  * so a visitor can actually sign in.
15
15
  */
16
- import { hostInGateList } from "@/lib/demoGate";
17
- import { normalizeMemberships, staffAdmits } from "@/lib/dashboard/tenantSelection";
16
+ import { hostInGateList } from "@/lib/access/shared/demoGate";
17
+ import { normalizeMemberships, staffAdmits } from "@/lib/access/dashboard/tenantSelection";
18
18
  import type { SessionRecord } from "./session.js";
19
19
 
20
20
  export type GateMode = "password" | "login";
@@ -27,8 +27,8 @@
27
27
  * bodies, response shapes) is contract-fixed.
28
28
  */
29
29
  import { readEnv } from "@/lib/env";
30
- import { diagEmail } from "@/lib/diag/redact";
31
- import { FetchHttpTransport, type HttpResponseLike, type HttpTransport } from "@/lib/http/fetchTransport";
30
+ import { diagEmail } from "@/lib/observability/diag/redact";
31
+ import { FetchHttpTransport, type HttpResponseLike, type HttpTransport } from "@/lib/developer-experience/http/fetchTransport";
32
32
  import { classifyStepUp, type StepUpChallenge, type StepUpObligation } from "./stepUpChallenge.js";
33
33
 
34
34
  /** `send` is deliberately opaque — it never reveals whether the email was eligible. */
@@ -49,7 +49,7 @@ export type AccessCodeVerifyResult =
49
49
  * Present-usually, NOT guaranteed: tot returns the flat result without it
50
50
  * if signing hiccups (contract §6 graceful degradation). Phase 3 verifies
51
51
  * this OFFLINE and derives the session from its claims rather than trusting
52
- * the flat `roles`/`capability`. See `@/lib/auth/identityToken`.
52
+ * the flat `roles`/`capability`. See `@/lib/access/auth/identityToken`.
53
53
  */
54
54
  id_token?: string;
55
55
  }
@@ -128,7 +128,7 @@ export interface TotAccessClient {
128
128
  * (signer degradation, contract §6); the consumer fails closed when it's absent.
129
129
  *
130
130
  * The `step-up-required`/`success-pending` variants carry tot20's RFC 9470
131
- * obligations (see `@/lib/auth/stepUpChallenge`) instead of a plain failure
131
+ * obligations (see `@/lib/access/auth/stepUpChallenge`) instead of a plain failure
132
132
  * reason, so the caller can drive the SMS completion loop rather than just
133
133
  * showing a generic "invalid code" error.
134
134
  */
@@ -22,8 +22,8 @@
22
22
  * the page, matching `@/lib/dashboard/tenantSelection` and `@/lib/auth/loginGate`.
23
23
  */
24
24
  import { storefrontModeAllowsGoLive } from "@tot/public-runtime";
25
- import { membershipFor, staffAdmits } from "@/lib/dashboard/tenantSelection";
26
- import type { StaffAdmission, TenantMembership } from "@/lib/dashboard/tenantSelection";
25
+ import { membershipFor, staffAdmits } from "@/lib/access/dashboard/tenantSelection";
26
+ import type { StaffAdmission, TenantMembership } from "@/lib/access/dashboard/tenantSelection";
27
27
 
28
28
  /** What every viewer of an unpaid store is told in place of the delegate section. */
29
29
  export const UNPAID_DELEGATION_NOTE =
@@ -12,7 +12,7 @@
12
12
  * scoped to the returned staffRoles capability. It is stamped on the session as a
13
13
  * DISTINCT marker from `tenants[]` — never a synthesized membership.
14
14
  */
15
- import type { SessionRecord, StaffSelection } from "@/lib/auth/session";
15
+ import type { SessionRecord, StaffSelection } from "@/lib/access/auth/session";
16
16
 
17
17
  /**
18
18
  * Staff selection lifetime. Deliberately short: staff cross-vendor access is a
@@ -17,7 +17,7 @@
17
17
  * tot20 populates all of the email's memberships. Flagged to the workstream lead.
18
18
  */
19
19
 
20
- import type { StaffSelection } from "@/lib/auth/session";
20
+ import type { StaffSelection } from "@/lib/access/auth/session";
21
21
 
22
22
  /** One tenant membership carried in the verified session. */
23
23
  export interface TenantMembership {
@@ -1,8 +1,8 @@
1
1
  import { DEFAULT_CHECKOUT_STYLE } from "@tot/public-runtime";
2
- import type { AdminTenantEnvelope } from "../../envelope";
3
- import { memoizeByEnvelope } from "../../memoizeByEnvelope";
4
- import { MOCK_ANCHOR_ISO, offsetIso, randomInt, seededRandom } from "../../seed";
5
- import type { SettingsAuditEvent, SettingsSection, SettingsViewModel } from "../../viewmodels/settings";
2
+ import type { AdminTenantEnvelope } from "../admin/envelope";
3
+ import { memoizeByEnvelope } from "../../developer-experience/admin/memoizeByEnvelope";
4
+ import { MOCK_ANCHOR_ISO, offsetIso, randomInt, seededRandom } from "../../developer-experience/admin/seed";
5
+ import type { SettingsAuditEvent, SettingsSection, SettingsViewModel } from "../admin/viewmodels/settings";
6
6
 
7
7
  const SECTION_DEFS: Omit<SettingsSection, "riskyChangeReview">[] = [
8
8
  { key: "store", label: "Store", summary: "Store profile, branding, and white-label copy." },
@@ -17,7 +17,7 @@
17
17
  * Nothing here is ever reported as verified unless tot-mcp said so: an unconfigured seam,
18
18
  * a non-200 or a timeout is `unavailable`, which the UI shows as unverified.
19
19
  */
20
- import { callMcpService } from "@/lib/http/mcpServiceCall";
20
+ import { callMcpService } from "@/lib/developer-experience/http/mcpServiceCall";
21
21
 
22
22
  const EXPLAIN_TIMEOUT_MS = 8000;
23
23
 
@@ -21,9 +21,9 @@
21
21
  * request asks for: the staff check gates evaluation of the request
22
22
  * entirely, not just the picker's visibility.
23
23
  */
24
- import type { SessionRecord } from "@/lib/auth/session";
25
- import { isStaffSession } from "@/lib/dashboard/staffAdmission";
26
- import { membershipFor, normalizeMemberships, type TenantMembership } from "@/lib/dashboard/tenantSelection";
24
+ import type { SessionRecord } from "@/lib/access/auth/session";
25
+ import { isStaffSession } from "@/lib/access/dashboard/staffAdmission";
26
+ import { membershipFor, normalizeMemberships, type TenantMembership } from "@/lib/access/dashboard/tenantSelection";
27
27
 
28
28
  export interface AdminTenantEnvelope {
29
29
  /** The tenant that actually served this request. */
@@ -53,10 +53,10 @@
53
53
  * control-plane cluster stays self-contained (see `.dependency-cruiser.cjs`).
54
54
  */
55
55
  import { readEnv } from "@/lib/env";
56
- import { callMcpService } from "@/lib/http/mcpServiceCall";
57
- import { diagEmail } from "@/lib/diag/redact";
58
- import { checkStorePreviewReady, type PreflightDecision } from "@/lib/shared/invitePreflight";
59
- import { explainDeveloperAccess, type AccessVerification } from "@/lib/shared/accessExplain";
56
+ import { callMcpService } from "@/lib/developer-experience/http/mcpServiceCall";
57
+ import { diagEmail } from "@/lib/observability/diag/redact";
58
+ import { checkStorePreviewReady, type PreflightDecision } from "@/lib/access/shared/invitePreflight";
59
+ import { explainDeveloperAccess, type AccessVerification } from "@/lib/access/shared/accessExplain";
60
60
 
61
61
  /**
62
62
  * The header carrying the storefront-signed staff BROKER ASSERTION to tot20
@@ -22,7 +22,7 @@
22
22
  * mirroring recordDeveloperAppBinding's "skipped when not-configured" stance — we
23
23
  * never break invites just because the MCP is briefly unreachable.
24
24
  */
25
- import { callMcpService } from "@/lib/http/mcpServiceCall";
25
+ import { callMcpService } from "@/lib/developer-experience/http/mcpServiceCall";
26
26
 
27
27
  /** How long we'll wait on the preview-status read before failing open. */
28
28
  const PREFLIGHT_TIMEOUT_MS = 4000;
@@ -76,8 +76,8 @@
76
76
  * swaps in the Http client with no call-site change.
77
77
  */
78
78
  import { readEnv } from "@/lib/env";
79
- import { diagEmail } from "@/lib/diag/redact";
80
- import { BROKER_ASSERTION_HEADER, BROKER_PRIVATE_KEY_ENV } from "@/lib/auth/brokerAssertion";
79
+ import { diagEmail } from "@/lib/observability/diag/redact";
80
+ import { BROKER_ASSERTION_HEADER, BROKER_PRIVATE_KEY_ENV } from "@/lib/access/auth/brokerAssertion";
81
81
 
82
82
  /** A human grantee — the only principal type this HTTP surface accepts. */
83
83
  export interface UserPrincipal {
@@ -30,7 +30,7 @@
30
30
  * app-binding WRITE (`recordDeveloperAppBinding`) targets, so this READ and that
31
31
  * WRITE always agree on which subject-capability store they speak to.
32
32
  */
33
- import { callMcpService } from "@/lib/http/mcpServiceCall";
33
+ import { callMcpService } from "@/lib/developer-experience/http/mcpServiceCall";
34
34
  import type { Capability } from "./capability.js";
35
35
 
36
36
  /** Minimal GET transport (mirrors `dev/previewStatus.ts` — decoupled by design). */
@@ -1,5 +1,5 @@
1
- import type { AdminTenantEnvelope } from "../../admin/envelope";
2
- import { memoizeByEnvelope } from "../../admin/memoizeByEnvelope";
1
+ import type { AdminTenantEnvelope } from "../../access/admin/envelope";
2
+ import { memoizeByEnvelope } from "../../developer-experience/admin/memoizeByEnvelope";
3
3
  import type { EvidenceReference } from "../evidence/evidenceReference";
4
4
  import { getCustomersViewModel } from "../../customers/fixtures/customers";
5
5
  import { getOrdersViewModel } from "../../orders/fixtures/orders";
@@ -48,11 +48,11 @@ import type {
48
48
  ActivityPayload,
49
49
  } from "@tot/public-runtime";
50
50
  import type { ActionKey } from "@tot/public-runtime";
51
- import { readViewerSession } from "@/lib/auth/route";
52
- import { sessionHostCapability } from "@/lib/auth/loginGate";
53
- import { isStaffSession } from "@/lib/dashboard/staffAdmission";
51
+ import { readViewerSession } from "@/lib/access/auth/route";
52
+ import { sessionHostCapability } from "@/lib/access/auth/loginGate";
53
+ import { isStaffSession } from "@/lib/access/dashboard/staffAdmission";
54
54
  import { readEnv } from "@/lib/env";
55
- import { isOwnerCapability } from "@/lib/shared/capability";
55
+ import { isOwnerCapability } from "@/lib/access/shared/capability";
56
56
  import { hashActorId, recordActivity } from "./recordActivity";
57
57
 
58
58
  /** The minimal viewer chrome the middleware stamps on `locals.viewer`. */
@@ -11,7 +11,7 @@
11
11
  * baked in at BUILD time: astro.config.mjs's Vite `define` replaces the
12
12
  * `__GIT_SHA__` token with a string literal of the build's commit (CI-provided
13
13
  * `GIT_SHA`/`WORKERS_CI_COMMIT_SHA`/`GITHUB_SHA`, else local `git rev-parse`,
14
- * else "unknown"). This is the SAME source /health already reports (lib/health.ts)
14
+ * else "unknown"). This is the SAME source /health already reports (lib/observability/shared/health.ts)
15
15
  * — we read it through the identical `typeof` guard so both agree by construction,
16
16
  * and so the value is safe under vitest (where the define isn't applied → "unknown").
17
17
  *
@@ -2,11 +2,11 @@ export { getOrdersViewModel } from "../../../orders/fixtures/orders";
2
2
  export { getProductsViewModel } from "../../../catalog/fixtures/products";
3
3
  export { getCustomersViewModel } from "../../../customers/fixtures/customers";
4
4
  export { getReportingViewModel } from "../../../reporting/fixtures/reporting";
5
- export { getSettingsViewModel } from "./settings";
5
+ export { getSettingsViewModel } from "../../../access/fixtures/settings";
6
6
  export { getCheckoutSettingsViewModel } from "../../../checkout/fixtures/checkoutSettings";
7
7
  export type { CheckoutSettingsViewModel } from "../../../checkout/fixtures/checkoutSettings";
8
8
  export { getSubscriptionsViewModel } from "../../../subscriptions/fixtures/subscriptions";
9
- export { getAiWorkflowsViewModel } from "./aiWorkflows";
9
+ export { getAiWorkflowsViewModel } from "../../../automation/fixtures/aiWorkflows";
10
10
  export { getEvidenceViewModel } from "../../../activity/fixtures/evidence";
11
- export { SEEDED_TENANTS, tenantProfile } from "./tenants";
12
- export type { SeededTenantProfile, MockVertical } from "./tenants";
11
+ export { SEEDED_TENANTS, tenantProfile } from "../../../access/fixtures/tenants";
12
+ export type { SeededTenantProfile, MockVertical } from "../../../access/fixtures/tenants";
@@ -5,9 +5,9 @@
5
5
  * come from `lib/admin/ai`, which formalizes the approval/evidence models.
6
6
  */
7
7
 
8
- import type { ApprovalMode } from "../ai/approvalMode";
9
- import type { AiRecommendation } from "../ai/recommendation";
10
- import type { AuditEvent } from "../ai/audit";
8
+ import type { ApprovalMode } from "../../ai/approvalMode";
9
+ import type { AiRecommendation } from "../../ai/recommendation";
10
+ import type { AuditEvent } from "../../ai/audit";
11
11
 
12
12
  export type { ApprovalMode };
13
13
 
@@ -6,7 +6,7 @@
6
6
  * this is emitted for dev inspection only (see adminShell.ts's `data-admin-ask`
7
7
  * click handler), never sent over the network.
8
8
  */
9
- import type { AdminTenantEnvelope } from "../envelope";
9
+ import type { AdminTenantEnvelope } from "../../access/admin/envelope";
10
10
 
11
11
  export type AdminRole = "internal_staff" | "merchant_operator";
12
12
 
@@ -7,10 +7,10 @@
7
7
  * The other 5 workflows remain scaffold-only until their own units connect
8
8
  * real source data.
9
9
  */
10
- import type { AdminTenantEnvelope } from "../envelope";
11
- import { getOrdersViewModel, getProductsViewModel, getEvidenceViewModel } from "../services/mock";
12
- import { MOCK_ANCHOR_ISO, offsetIso, randomInt, seededRandom } from "../seed";
13
- import { OPERATIONAL_WORKFLOW_KEYS, type OperationalWorkflowKey } from "../viewmodels/aiWorkflows";
10
+ import type { AdminTenantEnvelope } from "../../access/admin/envelope";
11
+ import { getOrdersViewModel, getProductsViewModel, getEvidenceViewModel } from "../../admin/services/mock/index";
12
+ import { MOCK_ANCHOR_ISO, offsetIso, randomInt, seededRandom } from "../../developer-experience/admin/seed";
13
+ import { OPERATIONAL_WORKFLOW_KEYS, type OperationalWorkflowKey } from "../admin/viewmodels/aiWorkflows";
14
14
  import type { ApprovalMode } from "./approvalMode";
15
15
  import type { AuditEvent } from "./audit";
16
16
  import type { AiRecommendation } from "./recommendation";
@@ -1,7 +1,7 @@
1
- import type { AdminTenantEnvelope } from "../../envelope";
2
- import { memoizeByEnvelope } from "../../memoizeByEnvelope";
3
- import { MOCK_ANCHOR_ISO, offsetIso, pick, randomInt, seededRandom } from "../../seed";
4
- import { AI_WORKFLOW_NAMES, OPERATIONAL_WORKFLOW_KEYS, type AiWorkflowsViewModel, type ApprovalMode, type WorkflowRecord, type WorkflowStatus } from "../../viewmodels/aiWorkflows";
1
+ import type { AdminTenantEnvelope } from "../../access/admin/envelope";
2
+ import { memoizeByEnvelope } from "../../developer-experience/admin/memoizeByEnvelope";
3
+ import { MOCK_ANCHOR_ISO, offsetIso, pick, randomInt, seededRandom } from "../../developer-experience/admin/seed";
4
+ import { AI_WORKFLOW_NAMES, OPERATIONAL_WORKFLOW_KEYS, type AiWorkflowsViewModel, type ApprovalMode, type WorkflowRecord, type WorkflowStatus } from "../admin/viewmodels/aiWorkflows";
5
5
 
6
6
  const OWNERS = ["Ops", "Trust & Safety", "Growth", "Fulfillment"];
7
7
  const APPROVAL_MODES: ApprovalMode[] = ["draft_only", "approval_required", "guarded_automation"];
@@ -2,7 +2,7 @@
2
2
  * Tenant base-path helpers.
3
3
  *
4
4
  * When a request selects its tenant via a `/<domain>/` path prefix (see
5
- * lib/tenantRouting.ts), every same-origin link must carry that prefix or the
5
+ * lib/access/shared/tenantRouting.ts), every same-origin link must carry that prefix or the
6
6
  * visitor falls out of the tenant. Host-routed requests have an empty base path
7
7
  * and links are returned unchanged.
8
8
  *
@@ -1,5 +1,5 @@
1
- import type { AdminTenantEnvelope } from "../../admin/envelope";
2
- import { MOCK_ANCHOR_ISO, offsetIso, pick, randomBool, randomInt, seededRandom } from "../../admin/seed";
1
+ import type { AdminTenantEnvelope } from "../../access/admin/envelope";
2
+ import { MOCK_ANCHOR_ISO, offsetIso, pick, randomBool, randomInt, seededRandom } from "../../developer-experience/admin/seed";
3
3
  import type {
4
4
  ExciseCheckKey,
5
5
  ExciseReadinessCheck,
@@ -8,8 +8,8 @@ import type {
8
8
  ProductsViewModel,
9
9
  ProductVariant,
10
10
  } from "../admin/viewmodels/products";
11
- import { tenantProfile } from "../../admin/services/mock/tenants";
12
- import { memoizeByEnvelope } from "../../admin/memoizeByEnvelope";
11
+ import { tenantProfile } from "../../access/fixtures/tenants";
12
+ import { memoizeByEnvelope } from "../../developer-experience/admin/memoizeByEnvelope";
13
13
 
14
14
  // Must stay index-aligned with orders.ts's ITEM_POOLS: a product's id is
15
15
  // `prod-<tenant>-<position here>`, and orders.ts derives each order's productId
@@ -20,8 +20,8 @@
20
20
  * Pure (no I/O, no Astro) — the caller supplies the already-read viewer session —
21
21
  * so it is unit-testable in isolation.
22
22
  */
23
- import { resolveAdminTenantMode } from "@/lib/adminTenantEnvelope";
24
- import type { SessionRecord } from "@/lib/auth/session";
23
+ import { resolveAdminTenantMode } from "@/lib/access/shared/adminTenantEnvelope";
24
+ import type { SessionRecord } from "@/lib/access/auth/session";
25
25
 
26
26
  export type WriteTargetResult =
27
27
  | { ok: true; targetTenant: string }
@@ -18,7 +18,7 @@ import { resolveManagedCheckout } from "@tot/public-runtime";
18
18
  import type { TenantConfig } from "@tot/public-runtime";
19
19
  import { referenceTheme } from "@/themes/reference";
20
20
  import { mergeTheme } from "@/themes/schema";
21
- import type { AdminTenantEnvelope } from "../../admin/envelope";
21
+ import type { AdminTenantEnvelope } from "../../access/admin/envelope";
22
22
  import {
23
23
  buildCheckoutSettingsFields,
24
24
  deriveCheckoutSettings,
@@ -175,7 +175,7 @@ export interface PollDeps {
175
175
 
176
176
  /**
177
177
  * True when the login gate, not the preflight route, answered: the store is not
178
- * public and this viewer holds no session (see `lib/auth/gatePage.ts`). Still fail
178
+ * public and this viewer holds no session (see `lib/access/auth/gatePage.ts`). Still fail
179
179
  * closed — the caller only names the reason instead of reporting an outage.
180
180
  */
181
181
  export function isStoreNotPublicRefusal(res: Pick<Response, "status" | "headers">): boolean {
@@ -40,7 +40,7 @@ import {
40
40
  type HttpGetTransport,
41
41
  type HttpResponseLike,
42
42
  type HttpTransport,
43
- } from "@/lib/http/fetchTransport";
43
+ } from "@/lib/developer-experience/http/fetchTransport";
44
44
 
45
45
  // --- Gate normalization -----------------------------------------------------
46
46
 
@@ -1,4 +1,4 @@
1
- import type { SessionRecord } from "@/lib/auth/session.js";
1
+ import type { SessionRecord } from "@/lib/access/auth/session.js";
2
2
  import type { BlogAccess } from "./types.js";
3
3
 
4
4
  /**
@@ -18,12 +18,12 @@ import {
18
18
  import { homeCrumbLabel, siteTrail, type Crumb } from "@/lib/content/shared/breadcrumbs.js";
19
19
  import { viewerHasBlogAccess } from "./access.js";
20
20
  import { articleBodyHtml } from "./teaser.js";
21
- import { readViewerSession, safeNext } from "@/lib/auth/route.js";
21
+ import { readViewerSession, safeNext } from "@/lib/access/auth/route.js";
22
22
  import { buildAlternates, type Alternate } from "@/lib/content/seo/alternates.js";
23
23
  import { breadcrumbLd, blogPostingLd } from "@/lib/content/shared/jsonld.js";
24
24
  import { collectionPathsV1, blogPathOptsV1 } from "./collectionPaths.js";
25
25
  import type { BlogPost } from "./types.js";
26
- import type { SessionRecord } from "@/lib/auth/session.js";
26
+ import type { SessionRecord } from "@/lib/access/auth/session.js";
27
27
 
28
28
  export interface BlogPostViewPropsV1 {
29
29
  post: BlogPost;