@wildo-ai/saas-frontend-lib 1.1.3 → 1.1.4

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 (127) hide show
  1. package/dist/esm/companion-exports.d.ts +1 -1
  2. package/dist/esm/companion-exports.d.ts.map +1 -1
  3. package/dist/esm/companion-exports.js +1 -1
  4. package/dist/esm/companion-exports.js.map +1 -1
  5. package/dist/esm/components/ai-elements/decision/approval.d.ts +13 -1
  6. package/dist/esm/components/ai-elements/decision/approval.d.ts.map +1 -1
  7. package/dist/esm/components/ai-elements/decision/approval.js.map +1 -1
  8. package/dist/esm/components/flows-actors/approval.d.ts.map +1 -1
  9. package/dist/esm/components/flows-actors/approval.js +12 -7
  10. package/dist/esm/components/flows-actors/approval.js.map +1 -1
  11. package/dist/esm/components/flows-actors/approval.labels.d.ts.map +1 -1
  12. package/dist/esm/components/flows-actors/approval.labels.js +3 -0
  13. package/dist/esm/components/flows-actors/approval.labels.js.map +1 -1
  14. package/dist/esm/components/flows-actors/execution-plan.js +1 -1
  15. package/dist/esm/components/flows-actors/execution-plan.js.map +1 -1
  16. package/dist/esm/components/flows-actors/task-memory.js +1 -1
  17. package/dist/esm/components/flows-actors/task-memory.js.map +1 -1
  18. package/dist/esm/components/form/automated/generated-relationship-field.hooks.d.ts +1 -1
  19. package/dist/esm/components/form/controls/number/slider.d.ts +1 -1
  20. package/dist/esm/components/form/fields/form-field-file-provider-constraints.frontend.utils.d.ts +1 -1
  21. package/dist/esm/components/form/fields/form-field-file-provider-constraints.frontend.utils.d.ts.map +1 -1
  22. package/dist/esm/components/form/fields/form-field-file-provider-constraints.frontend.utils.js.map +1 -1
  23. package/dist/esm/components/form/fields/form-field-file.d.ts.map +1 -1
  24. package/dist/esm/components/form/fields/form-field-file.js +66 -17
  25. package/dist/esm/components/form/fields/form-field-file.js.map +1 -1
  26. package/dist/esm/components/form/fields/form-field-file.labels.js +2 -2
  27. package/dist/esm/components/form/fields/form-field-file.labels.js.map +1 -1
  28. package/dist/esm/components/form/form-field-types.d.ts +20 -0
  29. package/dist/esm/components/form/form-field-types.d.ts.map +1 -1
  30. package/dist/esm/components/form/form-field-types.js.map +1 -1
  31. package/dist/esm/components/navigation/NavigationItemBadge.d.ts +7 -1
  32. package/dist/esm/components/navigation/NavigationItemBadge.d.ts.map +1 -1
  33. package/dist/esm/components/navigation/NavigationItemBadge.js +29 -1
  34. package/dist/esm/components/navigation/NavigationItemBadge.js.map +1 -1
  35. package/dist/esm/components/navigation/menu-bar.d.ts +1 -1
  36. package/dist/esm/components/overlays/containers/OverlayContainer.d.ts.map +1 -1
  37. package/dist/esm/components/overlays/containers/OverlayContainer.js +36 -9
  38. package/dist/esm/components/overlays/containers/OverlayContainer.js.map +1 -1
  39. package/dist/esm/components/overlays/floating/context-menu.d.ts +1 -1
  40. package/dist/esm/components/overlays/floating/dropdown-menu.d.ts +1 -1
  41. package/dist/esm/components/resources/ResourceLayout_FilterChips.js +1 -1
  42. package/dist/esm/components/resources/ResourceLayout_FilterChips.js.map +1 -1
  43. package/dist/esm/components/resources/ResourceListItemRenderer.js +1 -1
  44. package/dist/esm/components/resources/ResourceListItemRenderer.js.map +1 -1
  45. package/dist/esm/components/resources/skeleton/ResourceHeaderTitle.d.ts +12 -0
  46. package/dist/esm/components/resources/skeleton/ResourceHeaderTitle.d.ts.map +1 -1
  47. package/dist/esm/components/resources/skeleton/ResourceHeaderTitle.js +13 -1
  48. package/dist/esm/components/resources/skeleton/ResourceHeaderTitle.js.map +1 -1
  49. package/dist/esm/components/settings/AppPage_ConnectedAccountsSettings.d.ts +106 -49
  50. package/dist/esm/components/settings/AppPage_ConnectedAccountsSettings.d.ts.map +1 -1
  51. package/dist/esm/components/settings/AppPage_ConnectedAccountsSettings.js +311 -109
  52. package/dist/esm/components/settings/AppPage_ConnectedAccountsSettings.js.map +1 -1
  53. package/dist/esm/components/settings/AppPage_ConnectedAccountsSettings.labels.d.ts.map +1 -1
  54. package/dist/esm/components/settings/AppPage_ConnectedAccountsSettings.labels.js +32 -2
  55. package/dist/esm/components/settings/AppPage_ConnectedAccountsSettings.labels.js.map +1 -1
  56. package/dist/esm/components/settings/SettingsHub.d.ts.map +1 -1
  57. package/dist/esm/components/settings/SettingsHub.js +30 -6
  58. package/dist/esm/components/settings/SettingsHub.js.map +1 -1
  59. package/dist/esm/components/views/onboarding-view/OnboardingView.d.ts.map +1 -1
  60. package/dist/esm/components/views/onboarding-view/OnboardingView.js +9 -2
  61. package/dist/esm/components/views/onboarding-view/OnboardingView.js.map +1 -1
  62. package/dist/esm/core/automated-layout/automated-layout.frontend.schemas.d.ts +16 -0
  63. package/dist/esm/core/automated-layout/automated-layout.frontend.schemas.d.ts.map +1 -1
  64. package/dist/esm/core/automated-layout/automated-layout.frontend.schemas.js +17 -0
  65. package/dist/esm/core/automated-layout/automated-layout.frontend.schemas.js.map +1 -1
  66. package/dist/esm/core/automated-layout/default-layout-generator.frontend.utils.d.ts.map +1 -1
  67. package/dist/esm/core/automated-layout/default-layout-generator.frontend.utils.js +3 -2
  68. package/dist/esm/core/automated-layout/default-layout-generator.frontend.utils.js.map +1 -1
  69. package/dist/esm/core/billing/billing-launcher.js +1 -1
  70. package/dist/esm/core/billing/billing-launcher.js.map +1 -1
  71. package/dist/esm/core/components-registry/provider-component-registry.frontend.service.d.ts +64 -4
  72. package/dist/esm/core/components-registry/provider-component-registry.frontend.service.d.ts.map +1 -1
  73. package/dist/esm/core/components-registry/provider-component-registry.frontend.service.js +76 -4
  74. package/dist/esm/core/components-registry/provider-component-registry.frontend.service.js.map +1 -1
  75. package/dist/esm/core/components-registry/useProviderComponent.frontend.hooks.d.ts +8 -0
  76. package/dist/esm/core/components-registry/useProviderComponent.frontend.hooks.d.ts.map +1 -1
  77. package/dist/esm/core/components-registry/useProviderComponent.frontend.hooks.js +1 -0
  78. package/dist/esm/core/components-registry/useProviderComponent.frontend.hooks.js.map +1 -1
  79. package/dist/esm/core/config/chart-view.frontend.schemas.d.ts +8 -8
  80. package/dist/esm/core/config/composite-view.schemas.d.ts +4 -4
  81. package/dist/esm/core/config/engine-settings-destinations.d.ts +0 -69
  82. package/dist/esm/core/config/engine-settings-destinations.d.ts.map +1 -1
  83. package/dist/esm/core/config/engine-settings-destinations.js +35 -74
  84. package/dist/esm/core/config/engine-settings-destinations.js.map +1 -1
  85. package/dist/esm/core/config/settings-hub.frontend.schemas.d.ts +10 -1
  86. package/dist/esm/core/config/settings-hub.frontend.schemas.d.ts.map +1 -1
  87. package/dist/esm/core/config/settings-hub.frontend.schemas.js +9 -0
  88. package/dist/esm/core/config/settings-hub.frontend.schemas.js.map +1 -1
  89. package/dist/esm/core/config/useSettingsHubConfig.d.ts.map +1 -1
  90. package/dist/esm/core/config/useSettingsHubConfig.js +8 -1
  91. package/dist/esm/core/config/useSettingsHubConfig.js.map +1 -1
  92. package/dist/esm/core/events/events.frontend.schemas.d.ts +4 -4
  93. package/dist/esm/core/external-providers/ProviderFilePickerHost.d.ts +12 -1
  94. package/dist/esm/core/external-providers/ProviderFilePickerHost.d.ts.map +1 -1
  95. package/dist/esm/core/external-providers/ProviderFilePickerHost.js +15 -2
  96. package/dist/esm/core/external-providers/ProviderFilePickerHost.js.map +1 -1
  97. package/dist/esm/core/external-providers/provider-file-selection.frontend.utils.d.ts +1 -2
  98. package/dist/esm/core/external-providers/provider-file-selection.frontend.utils.d.ts.map +1 -1
  99. package/dist/esm/core/external-providers/provider-file-selection.frontend.utils.js.map +1 -1
  100. package/dist/esm/core/flows-actors/FlowsActorsContext.d.ts +6 -1
  101. package/dist/esm/core/flows-actors/FlowsActorsContext.d.ts.map +1 -1
  102. package/dist/esm/core/flows-actors/FlowsActorsContext.js +10 -2
  103. package/dist/esm/core/flows-actors/FlowsActorsContext.js.map +1 -1
  104. package/dist/esm/core/i18n/I18nContext.d.ts +23 -0
  105. package/dist/esm/core/i18n/I18nContext.d.ts.map +1 -1
  106. package/dist/esm/core/i18n/I18nContext.js +6 -1
  107. package/dist/esm/core/i18n/I18nContext.js.map +1 -1
  108. package/dist/esm/core/requests/wildo-http-client-manual-calls.frontend.service.d.ts +75 -2
  109. package/dist/esm/core/requests/wildo-http-client-manual-calls.frontend.service.d.ts.map +1 -1
  110. package/dist/esm/core/requests/wildo-http-client-manual-calls.frontend.service.js +52 -0
  111. package/dist/esm/core/requests/wildo-http-client-manual-calls.frontend.service.js.map +1 -1
  112. package/dist/esm/core/requests/wildo-http-client-resources.frontend.service.d.ts +3 -2
  113. package/dist/esm/core/requests/wildo-http-client-resources.frontend.service.d.ts.map +1 -1
  114. package/dist/esm/core/requests/wildo-http-client-resources.frontend.service.js +57 -4
  115. package/dist/esm/core/requests/wildo-http-client-resources.frontend.service.js.map +1 -1
  116. package/dist/esm/core/resources/ResourceReadCacheBridge.d.ts.map +1 -1
  117. package/dist/esm/core/resources/ResourceReadCacheBridge.js +130 -37
  118. package/dist/esm/core/resources/ResourceReadCacheBridge.js.map +1 -1
  119. package/dist/esm/core/resources/resources.frontend.schemas.d.ts +2 -2
  120. package/dist/esm/core/runtime/start-application.frontend.service.d.ts.map +1 -1
  121. package/dist/esm/core/runtime/start-application.frontend.service.js +17 -9
  122. package/dist/esm/core/runtime/start-application.frontend.service.js.map +1 -1
  123. package/dist/esm/core/security/UserOrgsContext.d.ts.map +1 -1
  124. package/dist/esm/core/security/UserOrgsContext.js +61 -5
  125. package/dist/esm/core/security/UserOrgsContext.js.map +1 -1
  126. package/dist/tsconfig.build.tsbuildinfo +1 -1
  127. package/package.json +6 -6
@@ -1 +1 @@
1
- {"version":3,"file":"ResourceReadCacheBridge.js","sourceRoot":"","sources":["../../../../src/core/resources/ResourceReadCacheBridge.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC1E,OAAO,EACL,kBAAkB,EAClB,+BAA+B,EAC/B,kBAAkB,GAInB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,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AAI,CAAC;AACd,CAAC,CAAC","sourcesContent":["import React, { useCallback, useContext, useEffect, useRef } from 'react';\nimport {\n CoreWebSocketEvent,\n WebSocketResourceDeliveryTarget,\n buildScopeRoomName,\n type ResourceScopeRoomQualifier,\n type WS_ResourceDeletedPayload,\n type WS_ResourceUpdatedPayload,\n} from '@wildo-ai/saas-models';\n\nimport { useWebSocket } from '~wildo-frontend-lib/core/requests/websockets/useWebSocket';\nimport { useResourceRegistry } from '~wildo-frontend-lib/core/resources/useResourceRegistry';\nimport { useAppScopeSafe } from '~wildo-frontend-lib/core/scope/useAppScope';\nimport { ApplicationContext } from '~wildo-frontend-lib/core/runtime/ApplicationContext.shared';\nimport { LoggerFrontendService } from '~wildo-frontend-lib/core/monitoring/logger.frontend.service';\nimport { envLoader } from '~wildo-frontend-lib/core/runtime/env-variable-loader.frontend.service';\nimport type { ResourceReadCoverageAuthority } from '~wildo-frontend-lib/core/resources/resource-read-cache.frontend.service';\n\nconst logger = LoggerFrontendService.getLogger();\nconst logDebug = logger.debugByType('ResourceReadCacheBridge');\nlogger.setDebugTypeLogging('ResourceReadCacheBridge', false);\n\n/** The owner key every scope-room claim from this bridge is made under. */\nconst CLAIM_OWNER_PREFIX = 'read-cache';\n\n/**\n * The environment flag that removes the read cache from the picture entirely.\n *\n * Mirrors `COMPANION_INTROSPECTION_CACHE` on the companion side, deliberately: the same word, the\n * same value, so an operator who has met one knows the other. Optional, and read through the\n * NON-throwing accessor — a diagnostic toggle must never be able to stop an application booting\n * because it was not declared.\n */\nconst READ_CACHE_ENVIRONMENT_FLAG = 'VITE_RESOURCE_READ_CACHE';\n\n/** The value that turns it off. */\nconst READ_CACHE_DISABLED_VALUE = 'off';\n\n/**\n * Makes cached resource reads SERVABLE, by joining the rooms through which they would be told they\n * are stale — and by dropping them when that stops being true.\n *\n * ## Why the cache cannot do this itself\n *\n * `ResourceReadCacheFrontendService` is a plain service on the HTTP client, deliberately: both read\n * paths reach it and it must outlive any React tree. But the answer to \"would an invalidation for\n * this entry reach us?\" lives in the WebSocket connection, which is React-scoped. So the cache holds\n * the entries and this bridge holds the truth about whether they may be served.\n *\n * ## Scope rooms, which the engine already emits into and nobody joined\n *\n * On a mutation the notifications dispatcher emits twice: into the per-row RESOURCE room, and into\n * the SCOPE rooms. Its own comment says why they are separate — *\"Scope rooms are emitted separately\n * from per-resource rooms because they serve list/cache refresh semantics rather than authoritative\n * per-resource replay semantics.\"* That is exactly this tier's channel, and until now nothing on the\n * client subscribed to it: rooms were claimed only from live `ResourceMutationManager` instances, so\n * a LIST had no way to hear that it had changed.\n *\n * The room set for an entry is computed by `deriveResourceScopeRoomQualifiers` — the SAME function\n * the dispatcher uses to decide where to emit, moved into `@wildo-ai/saas-models` for this purpose.\n * Two implementations of that rule would fail silently: a client subscribed to the wrong room does\n * not error, it simply never hears anything.\n *\n * ## Coverage is refused, not assumed\n *\n * `covers()` answers `true` only while the socket is connected AND every room for the entry is\n * claimed AND confirmed by the server. A subscription the server REFUSED — `verifyResourceAccess`\n * denies a PUBLIC socket outright — leaves the room unconfirmed, so nothing is served from it. The\n * cache then behaves exactly as it did before this tier existed.\n */\nexport const ResourceReadCacheBridge: React.FC = () => {\n const { on, isConnected, connectionCount, claimResourceRoom, releaseResourceRoom } = useWebSocket();\n const { getReadCache } = useResourceRegistry();\n /*\n * Resolved ONCE per render into the cache INSTANCE, and every effect below depends on that\n * instance rather than on `getReadCache`.\n *\n * `ResourceRegistryContext` builds its value object unmemoized, so `getReadCache` is a fresh\n * closure on every provider render. Depending on it re-ran the authority effect each time, and\n * `setCoverageAuthority` clears the cache by design — so the cache was emptied on essentially\n * every render and could never survive long enough to be useful. The instance itself comes from\n * the HTTP-client singleton and is stable for the life of the application.\n *\n * Found by a mutation test: removing the organization-switch clear left every case green, because\n * this effect was already clearing the cache constantly and masking it.\n */\n const readCache = getReadCache();\n\n /*\n * The operator escape hatch, applied before anything can be stored.\n *\n * The blast radius of this tier is every generated application on both persistence adapters, so\n * someone who SUSPECTS the cache has to be able to take it out of the picture without a rebuild\n * and without waiting for a fix. `VITE_RESOURCE_READ_CACHE=off` does that, and the cache then\n * behaves exactly as it did before this tier existed.\n */\n useEffect(() => {\n const disabled = envLoader.readOptionalEnvironmentValue(READ_CACHE_ENVIRONMENT_FLAG)?.toLowerCase()\n === READ_CACHE_DISABLED_VALUE;\n readCache.setEnabled(!disabled);\n if (disabled) {\n logger.info('Resource read cache disabled by environment', { flag: READ_CACHE_ENVIRONMENT_FLAG });\n }\n }, [readCache]);\n /*\n * The SAFE accessor, because this bridge is mounted ABOVE `AppScopeProvider`.\n *\n * The provider lives inside the router shell, while the bridges sit beside `RMMRegistryProvider`\n * one subtree up — so the throwing `useAppScope()` crashes the whole application here, which is\n * exactly what it did the first time. `ScopedResourceRegistryProvider` already solved this the\n * same way and for the same reason (\"If AppScopeProvider isn't mounted yet, behave exactly like\n * the base registry\").\n *\n * The consequence is deliberate and safe: with no scope mounted, `currentOrganizationId` is\n * `undefined` and stays that way, so the organization-switch effect below never fires a spurious\n * clear — and nothing is being cached at that point either, because the socket has no rooms.\n */\n const appScope = useAppScopeSafe();\n const currentOrganizationId = appScope?.currentOrganizationId ?? null;\n /*\n * The application id comes from APP CONFIG, not from the scope and not from the token.\n *\n * Both were checked on the running stack (issue #283): the access token's claims carry `userId`\n * and no `applicationId`, and `AppScopeContext` derives its `currentApplicationId` by decoding\n * that same token — so it is null wherever the claim is absent, which is everywhere. The backend\n * now publishes the id on `appIdentity`, which is the one surface that actually has it.\n *\n * Read through `useContext` rather than `useApplication()` on purpose: that hook THROWS outside\n * its provider, and a bridge that crashes the tree when mounted a level too high is a defect this\n * component has already had once.\n */\n const applicationContext = useContext(ApplicationContext);\n const currentApplicationId = applicationContext?.appIdentity?.applicationId\n ?? appScope?.currentApplicationId\n ?? null;\n\n /** Rooms the server has CONFIRMED. Only these make an entry servable. */\n const confirmedRoomsRef = useRef<Set<string>>(new Set());\n /** Rooms claimed but not yet confirmed, so a burst of reads claims each room once. */\n const requestedRoomsRef = useRef<Map<string, ResourceScopeRoomQualifier & { resourceType: string }>>(new Map());\n\n const releaseAllRooms = useCallback(() => {\n for (const [roomName, qualifier] of requestedRoomsRef.current) {\n void releaseResourceRoom({\n ownerKey: `${CLAIM_OWNER_PREFIX}:${roomName}`,\n resourceType: qualifier.resourceType,\n scopeKey: qualifier.scopeKey,\n scopeId: qualifier.scopeId,\n contextResourceIdentifiers: { [`${qualifier.scopeKey}Id`]: qualifier.scopeId },\n });\n }\n requestedRoomsRef.current.clear();\n confirmedRoomsRef.current.clear();\n }, [releaseResourceRoom]);\n\n /*\n * Install the authority, and take it away again on unmount.\n *\n * `setCoverageAuthority` clears the cache on both edges by construction — an authority that is\n * being replaced knows nothing about what the previous one covered, so every held entry is of\n * unknown freshness.\n */\n useEffect(() => {\n const cache = readCache;\n\n const authority: ResourceReadCoverageAuthority = {\n covers: (_resourceType, scopes) => {\n if (!isConnected) return false;\n if (scopes.length === 0) return false;\n return scopes.every((scope) => confirmedRoomsRef.current.has(\n buildScopeRoomName(_resourceType, scope.scopeKey, scope.scopeId),\n ));\n },\n requestCoverage: (resourceType, scopes) => {\n if (!isConnected) return;\n for (const scope of scopes) {\n const roomName = buildScopeRoomName(resourceType, scope.scopeKey, scope.scopeId);\n if (requestedRoomsRef.current.has(roomName)) continue;\n requestedRoomsRef.current.set(roomName, { ...scope, resourceType });\n\n void claimResourceRoom({\n ownerKey: `${CLAIM_OWNER_PREFIX}:${roomName}`,\n resourceType,\n scopeKey: scope.scopeKey,\n scopeId: scope.scopeId,\n /*\n * The scope's own identifier, in the shape the server's authorization expects. The\n * subscribe handler refuses an EMPTY `contextResourceIdentifiers` outright, and\n * `verifyScopeAccess` reads the scope from it — so this is the authorization input, not\n * decoration.\n */\n contextResourceIdentifiers: { [`${scope.scopeKey}Id`]: scope.scopeId },\n }).then((result) => {\n if (result?.success) {\n confirmedRoomsRef.current.add(roomName);\n logDebug('scope room confirmed', { roomName });\n } else {\n // Refused or unreachable. The room stays unconfirmed, so nothing keyed to it is ever\n // served — the cache degrades to the un-cached path rather than guessing.\n requestedRoomsRef.current.delete(roomName);\n logDebug('scope room not confirmed; entries under it stay unservable', { roomName });\n }\n }).catch(() => {\n requestedRoomsRef.current.delete(roomName);\n });\n }\n },\n };\n\n cache.setCoverageAuthority(authority);\n return () => {\n cache.setCoverageAuthority(null);\n releaseAllRooms();\n };\n }, [readCache, isConnected, claimResourceRoom, releaseAllRooms]);\n\n /*\n * Hand the cache the ambient application id.\n *\n * An APPLICATION-scoped resource's room is keyed on it, and no URL carries one — so without this\n * the read path cannot name the room it belongs in, and a push addressed there is received by\n * nobody (issue #283). The bridge is the right place because it is a COMPONENT and can read the\n * app scope; the cache service is plain and cannot.\n */\n useEffect(() => {\n readCache.setApplicationId(currentApplicationId);\n }, [currentApplicationId, readCache]);\n\n /*\n * A reconnect invalidates every confirmation.\n *\n * Rooms are per-SOCKET, so a new connection has joined nothing — and the window in which the\n * socket was down is exactly the window in which a mutation could have gone unheard. Both halves\n * point the same way: drop the cache and start the claims again.\n */\n useEffect(() => {\n if (connectionCount === 0) return;\n confirmedRoomsRef.current.clear();\n requestedRoomsRef.current.clear();\n readCache.clear();\n logDebug('connection changed; coverage and cache reset', { connectionCount });\n }, [connectionCount, readCache]);\n\n /*\n * An ORGANIZATION SWITCH changes which rows a read returns without changing the request.\n *\n * `commitOrganizationScopeValue` is a `setState` plus a WebSocket room re-point — there is no page\n * reload, and reads are tenancy-filtered at the repository. So without this, switching organization\n * would serve the previous tenant's rows from cache. The rooms are re-claimed under the new\n * organization by the next read that wants them.\n */\n useEffect(() => {\n readCache.clear();\n releaseAllRooms();\n logDebug('organization scope changed; cache cleared', { currentOrganizationId });\n }, [currentOrganizationId, readCache, releaseAllRooms]);\n\n /* Invalidate on anything the server says changed, at whatever grade it arrives. */\n useEffect(() => {\n if (!isConnected) return;\n\n const unsubscribeUpdated = on<WS_ResourceUpdatedPayload>(\n CoreWebSocketEvent.RESOURCE_UPDATED,\n (payload) => {\n /*\n * Every grade invalidates, including the SYNC grade that carries a full row.\n *\n * A sync payload is authoritative for ONE row, and a cached entry is usually a LIST whose\n * membership, ordering and pagination the row cannot settle — an added row does not announce\n * where it belongs. Patching the row into the cached list would be a guess; dropping the\n * entry costs one refetch and cannot be wrong.\n */\n readCache.invalidateResourceType(payload.resourceType);\n logDebug('invalidated by resource update', {\n resourceType: payload.resourceType,\n deliveryTarget: payload.deliveryTarget,\n isScopeRoom: payload.deliveryTarget === WebSocketResourceDeliveryTarget.SCOPE_ROOM_NOTIFICATION,\n });\n },\n );\n\n const unsubscribeDeleted = on<WS_ResourceDeletedPayload>(\n CoreWebSocketEvent.RESOURCE_DELETED,\n (payload) => {\n readCache.invalidateResourceType(payload.resourceType);\n },\n );\n\n return () => {\n unsubscribeUpdated();\n unsubscribeDeleted();\n };\n }, [on, isConnected, readCache]);\n\n return null;\n};\n"]}
1
+ {"version":3,"file":"ResourceReadCacheBridge.js","sourceRoot":"","sources":["../../../../src/core/resources/ResourceReadCacheBridge.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC1E,OAAO,EACL,kBAAkB,EAClB,+BAA+B,EAC/B,kBAAkB,GAInB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,YAAY,EAAE,MAAM,2DAA2D,CAAC;AACzF,OAAO,EAAE,mBAAmB,EAAE,MAAM,wDAAwD,CAAC;AAC7F,OAAO,EAAE,eAAe,EAAE,MAAM,4CAA4C,CAAC;AAC7E,OAAO,EAAE,kBAAkB,EAAE,MAAM,4DAA4D,CAAC;AAChG,OAAO,EAAE,qBAAqB,EAAE,MAAM,6DAA6D,CAAC;AACpG,OAAO,EAAE,SAAS,EAAE,MAAM,uEAAuE,CAAC;AAGlG,MAAM,MAAM,GAAG,qBAAqB,CAAC,SAAS,EAAE,CAAC;AACjD,MAAM,QAAQ,GAAG,MAAM,CAAC,WAAW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V,kBAAkB,EAAE,CAAC;YACrB,kBAAkB,EAAE,CAAC;QACvB,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,EAAE,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC,CAAC;IAEjC,OAAO,IAAI,CAAC;AACd,CAAC,CAAC","sourcesContent":["import React, { useCallback, useContext, useEffect, useRef } from 'react';\nimport {\n CoreWebSocketEvent,\n WebSocketResourceDeliveryTarget,\n buildScopeRoomName,\n type ResourceScopeRoomQualifier,\n type WS_ResourceDeletedPayload,\n type WS_ResourceUpdatedPayload,\n} from '@wildo-ai/saas-models';\n\nimport { useWebSocket } from '~wildo-frontend-lib/core/requests/websockets/useWebSocket';\nimport { useResourceRegistry } from '~wildo-frontend-lib/core/resources/useResourceRegistry';\nimport { useAppScopeSafe } from '~wildo-frontend-lib/core/scope/useAppScope';\nimport { ApplicationContext } from '~wildo-frontend-lib/core/runtime/ApplicationContext.shared';\nimport { LoggerFrontendService } from '~wildo-frontend-lib/core/monitoring/logger.frontend.service';\nimport { envLoader } from '~wildo-frontend-lib/core/runtime/env-variable-loader.frontend.service';\nimport type { ResourceReadCoverageAuthority } from '~wildo-frontend-lib/core/resources/resource-read-cache.frontend.service';\n\nconst logger = LoggerFrontendService.getLogger();\nconst logDebug = logger.debugByType('ResourceReadCacheBridge');\nlogger.setDebugTypeLogging('ResourceReadCacheBridge', false);\n\n/** The owner key every scope-room claim from this bridge is made under. */\nconst CLAIM_OWNER_PREFIX = 'read-cache';\n\n/**\n * The environment flag that removes the read cache from the picture entirely.\n *\n * Mirrors `COMPANION_INTROSPECTION_CACHE` on the companion side, deliberately: the same word, the\n * same value, so an operator who has met one knows the other. Optional, and read through the\n * NON-throwing accessor — a diagnostic toggle must never be able to stop an application booting\n * because it was not declared.\n */\nconst READ_CACHE_ENVIRONMENT_FLAG = 'VITE_RESOURCE_READ_CACHE';\n\n/** The value that turns it off. */\nconst READ_CACHE_DISABLED_VALUE = 'off';\n\n/**\n * Makes cached resource reads SERVABLE, by joining the rooms through which they would be told they\n * are stale — and by dropping them when that stops being true.\n *\n * ## Why the cache cannot do this itself\n *\n * `ResourceReadCacheFrontendService` is a plain service on the HTTP client, deliberately: both read\n * paths reach it and it must outlive any React tree. But the answer to \"would an invalidation for\n * this entry reach us?\" lives in the WebSocket connection, which is React-scoped. So the cache holds\n * the entries and this bridge holds the truth about whether they may be served.\n *\n * ## Scope rooms, which the engine already emits into and nobody joined\n *\n * On a mutation the notifications dispatcher emits twice: into the per-row RESOURCE room, and into\n * the SCOPE rooms. Its own comment says why they are separate — *\"Scope rooms are emitted separately\n * from per-resource rooms because they serve list/cache refresh semantics rather than authoritative\n * per-resource replay semantics.\"* That is exactly this tier's channel, and until now nothing on the\n * client subscribed to it: rooms were claimed only from live `ResourceMutationManager` instances, so\n * a LIST had no way to hear that it had changed.\n *\n * The room set for an entry is computed by `deriveResourceScopeRoomQualifiers` — the SAME function\n * the dispatcher uses to decide where to emit, moved into `@wildo-ai/saas-models` for this purpose.\n * Two implementations of that rule would fail silently: a client subscribed to the wrong room does\n * not error, it simply never hears anything.\n *\n * ## Coverage is refused, not assumed\n *\n * `covers()` answers `true` only while the socket is connected AND every room for the entry is\n * claimed AND confirmed by the server. A subscription the server REFUSED — `verifyResourceAccess`\n * denies a PUBLIC socket outright — leaves the room unconfirmed, so nothing is served from it. The\n * cache then behaves exactly as it did before this tier existed.\n */\nexport const ResourceReadCacheBridge: React.FC = () => {\n const { on, isConnected, connectionCount, claimResourceRoom, releaseResourceRoom } = useWebSocket();\n const { getReadCache } = useResourceRegistry();\n /*\n * Resolved ONCE per render into the cache INSTANCE, and every effect below depends on that\n * instance rather than on `getReadCache`.\n *\n * `ResourceRegistryContext` builds its value object unmemoized, so `getReadCache` is a fresh\n * closure on every provider render. Depending on it re-ran the authority effect each time, and\n * `setCoverageAuthority` clears the cache by design — so the cache was emptied on essentially\n * every render and could never survive long enough to be useful. The instance itself comes from\n * the HTTP-client singleton and is stable for the life of the application.\n *\n * Found by a mutation test: removing the organization-switch clear left every case green, because\n * this effect was already clearing the cache constantly and masking it.\n */\n const readCache = getReadCache();\n\n /*\n * The operator escape hatch, applied before anything can be stored.\n *\n * The blast radius of this tier is every generated application on both persistence adapters, so\n * someone who SUSPECTS the cache has to be able to take it out of the picture without a rebuild\n * and without waiting for a fix. `VITE_RESOURCE_READ_CACHE=off` does that, and the cache then\n * behaves exactly as it did before this tier existed.\n */\n useEffect(() => {\n const disabled = envLoader.readOptionalEnvironmentValue(READ_CACHE_ENVIRONMENT_FLAG)?.toLowerCase()\n === READ_CACHE_DISABLED_VALUE;\n readCache.setEnabled(!disabled);\n if (disabled) {\n logger.info('Resource read cache disabled by environment', { flag: READ_CACHE_ENVIRONMENT_FLAG });\n }\n }, [readCache]);\n /*\n * The SAFE accessor, because this bridge is mounted ABOVE `AppScopeProvider`.\n *\n * The provider lives inside the router shell, while the bridges sit beside `RMMRegistryProvider`\n * one subtree up — so the throwing `useAppScope()` crashes the whole application here, which is\n * exactly what it did the first time. `ScopedResourceRegistryProvider` already solved this the\n * same way and for the same reason (\"If AppScopeProvider isn't mounted yet, behave exactly like\n * the base registry\").\n *\n * The consequence is deliberate and safe: with no scope mounted, `currentOrganizationId` is\n * `undefined` and stays that way, so the organization-switch effect below never fires a spurious\n * clear — and nothing is being cached at that point either, because the socket has no rooms.\n */\n const appScope = useAppScopeSafe();\n const currentOrganizationId = appScope?.currentOrganizationId ?? null;\n /*\n * The application id comes from APP CONFIG, not from the scope and not from the token.\n *\n * Both were checked on the running stack (issue #283): the access token's claims carry `userId`\n * and no `applicationId`, and `AppScopeContext` derives its `currentApplicationId` by decoding\n * that same token — so it is null wherever the claim is absent, which is everywhere. The backend\n * now publishes the id on `appIdentity`, which is the one surface that actually has it.\n *\n * Read through `useContext` rather than `useApplication()` on purpose: that hook THROWS outside\n * its provider, and a bridge that crashes the tree when mounted a level too high is a defect this\n * component has already had once.\n */\n const applicationContext = useContext(ApplicationContext);\n const currentApplicationId = applicationContext?.appIdentity?.applicationId\n ?? appScope?.currentApplicationId\n ?? null;\n\n /** Rooms the server has CONFIRMED. Only these make an entry servable. */\n const confirmedRoomsRef = useRef<Set<string>>(new Set());\n /** Rooms claimed but not yet confirmed, so a burst of reads claims each room once. */\n const requestedRoomsRef = useRef<Map<string, ResourceScopeRoomQualifier & { resourceType: string }>>(new Map());\n /*\n * Rooms a read asked for BEFORE the socket was up, held until it is.\n *\n * This is the difference between a cache that works on a page load and one that does not.\n * `requestCoverage` used to return silently when disconnected, and nothing ever asked again — so\n * every read that completed during the connect window was stored uncovered and stayed uncovered\n * for the surface's whole life. Measured on the running dogfood application (2026-09-10): a single\n * navigation to the todos collection issued FOUR coverage requests for `todos`, all four with\n * `isConnected: false`, and the client emitted no `resource:subscribe` frame at all. Whether a room\n * was ever claimed came down to whether some LATER read happened to re-enter `store()` after the\n * socket came up, which is incidental rather than designed — and on the e2e lane's timing it did\n * not happen, so the scenario timed out against a subscription nobody had asked for.\n */\n const pendingRoomsRef = useRef<Map<string, ResourceScopeRoomQualifier & { resourceType: string }>>(new Map());\n /*\n * LATEST-VALUE refs, read by the authority rather than captured by it.\n *\n * The authority must be installed ONCE per cache instance, because installing it CLEARS the cache\n * (see `setCoverageAuthority`). Capturing `isConnected` or the claim callbacks in the closure would\n * put them in the effect's dependency list and reinstall the authority every time any of them\n * changed — which is exactly what happened on the `isConnected` false -> true edge, wiping the\n * cache at the precise moment it first became coverable. Assigned during render so a read firing\n * from a sibling's effect cannot observe a stale value.\n */\n const isConnectedRef = useRef(isConnected);\n isConnectedRef.current = isConnected;\n\n /*\n * Claim one scope room and record the outcome. The single place a claim is made, so a room queued\n * while disconnected and a room requested while connected travel identical paths.\n */\n const claimScopeRoom = useCallback((\n roomName: string,\n qualifier: ResourceScopeRoomQualifier & { resourceType: string },\n ) => {\n if (requestedRoomsRef.current.has(roomName)) return;\n requestedRoomsRef.current.set(roomName, qualifier);\n\n void claimResourceRoom({\n ownerKey: `${CLAIM_OWNER_PREFIX}:${roomName}`,\n resourceType: qualifier.resourceType,\n scopeKey: qualifier.scopeKey,\n scopeId: qualifier.scopeId,\n /*\n * The scope's own identifier, in the shape the server's authorization expects. The subscribe\n * handler refuses an EMPTY `contextResourceIdentifiers` outright, and `verifyScopeAccess` reads\n * the scope from it — so this is the authorization input, not decoration.\n */\n contextResourceIdentifiers: { [`${qualifier.scopeKey}Id`]: qualifier.scopeId },\n }).then((result) => {\n if (result?.success) {\n confirmedRoomsRef.current.add(roomName);\n logDebug('scope room confirmed', { roomName });\n } else {\n // Refused or unreachable. The room stays unconfirmed, so nothing keyed to it is ever\n // served — the cache degrades to the un-cached path rather than guessing.\n requestedRoomsRef.current.delete(roomName);\n logDebug('scope room not confirmed; entries under it stay unservable', { roomName });\n }\n }).catch(() => {\n requestedRoomsRef.current.delete(roomName);\n });\n }, [claimResourceRoom]);\n\n const claimScopeRoomRef = useRef(claimScopeRoom);\n claimScopeRoomRef.current = claimScopeRoom;\n\n const releaseAllRooms = useCallback(() => {\n for (const [roomName, qualifier] of requestedRoomsRef.current) {\n void releaseResourceRoom({\n ownerKey: `${CLAIM_OWNER_PREFIX}:${roomName}`,\n resourceType: qualifier.resourceType,\n scopeKey: qualifier.scopeKey,\n scopeId: qualifier.scopeId,\n contextResourceIdentifiers: { [`${qualifier.scopeKey}Id`]: qualifier.scopeId },\n });\n }\n requestedRoomsRef.current.clear();\n confirmedRoomsRef.current.clear();\n pendingRoomsRef.current.clear();\n }, [releaseResourceRoom]);\n\n const releaseAllRoomsRef = useRef(releaseAllRooms);\n releaseAllRoomsRef.current = releaseAllRooms;\n\n /*\n * Install the authority, and take it away again on unmount.\n *\n * `setCoverageAuthority` clears the cache on both edges by construction — an authority that is\n * being replaced knows nothing about what the previous one covered, so every held entry is of\n * unknown freshness.\n */\n useEffect(() => {\n const cache = readCache;\n\n const authority: ResourceReadCoverageAuthority = {\n covers: (_resourceType, scopes) => {\n if (!isConnectedRef.current) return false;\n if (scopes.length === 0) return false;\n return scopes.every((scope) => confirmedRoomsRef.current.has(\n buildScopeRoomName(_resourceType, scope.scopeKey, scope.scopeId),\n ));\n },\n requestCoverage: (resourceType, scopes) => {\n for (const scope of scopes) {\n const roomName = buildScopeRoomName(resourceType, scope.scopeKey, scope.scopeId);\n if (requestedRoomsRef.current.has(roomName)) continue;\n\n /*\n * DEFERRED, not dropped. A read completing before the socket is up is the ordinary case on\n * a page load, not an edge — the surface's own first read is usually one of them — and\n * returning here silently left its entry uncovered forever.\n */\n if (!isConnectedRef.current) {\n pendingRoomsRef.current.set(roomName, { ...scope, resourceType });\n logDebug('coverage deferred until the socket is up', { roomName });\n continue;\n }\n\n claimScopeRoomRef.current(roomName, { ...scope, resourceType });\n }\n },\n };\n\n cache.setCoverageAuthority(authority);\n return () => {\n cache.setCoverageAuthority(null);\n releaseAllRoomsRef.current();\n };\n /*\n * `readCache` ALONE, and that is the whole point of the refs above.\n *\n * `isConnected` was in this list until 2026-09-10, and because installing an authority clears\n * the cache, the false -> true edge emptied it at the exact moment it first became coverable.\n * Every entry a page had read up to that point was discarded, and the coverage those reads had\n * asked for had already been dropped by the disconnected early-return. The tier could therefore\n * only ever cache reads that happened to occur AFTER the socket came up — on the dogfood\n * application's todos collection, none did, so it served nothing while reporting nothing.\n *\n * The authority's IDENTITY does not change when the socket connects; only its ability to claim\n * rooms does, and that is now read from a ref. A genuine socket REPLACEMENT is a different event\n * and is still handled, by the `connectionCount` effect below.\n */\n }, [readCache]);\n\n /*\n * Claim what the page already asked for, as soon as the socket can carry it.\n *\n * The other half of the deferral above. Without this the queue would only be a politer way of\n * dropping the request.\n */\n useEffect(() => {\n if (!isConnected) return;\n if (pendingRoomsRef.current.size === 0) return;\n\n const deferred = [...pendingRoomsRef.current.entries()];\n pendingRoomsRef.current.clear();\n logDebug('claiming coverage deferred during the connect window', { rooms: deferred.length });\n for (const [roomName, qualifier] of deferred) claimScopeRoom(roomName, qualifier);\n }, [isConnected, claimScopeRoom]);\n\n /*\n * Hand the cache the ambient application id.\n *\n * An APPLICATION-scoped resource's room is keyed on it, and no URL carries one — so without this\n * the read path cannot name the room it belongs in, and a push addressed there is received by\n * nobody (issue #283). The bridge is the right place because it is a COMPONENT and can read the\n * app scope; the cache service is plain and cannot.\n */\n useEffect(() => {\n readCache.setApplicationId(currentApplicationId);\n }, [currentApplicationId, readCache]);\n\n /*\n * A RE-connect invalidates every confirmation. The FIRST connection does not.\n *\n * Rooms are per-SOCKET, so a REPLACEMENT socket has joined nothing — and the window in which a\n * socket was down is exactly the window in which a mutation could have gone unheard. Both halves\n * point the same way for a reconnect: drop the cache and start the claims again.\n *\n * Neither half holds for connection number one, and treating it the same was the second half of\n * the page-load defect. There is no earlier socket whose rooms could have lapsed, nothing was ever\n * served (`covers()` answers false while disconnected, so a stale entry could not have reached a\n * caller), and the \"window in which a mutation went unheard\" is the page load itself — during\n * which the entries were read from the server and are as fresh as any read. Clearing there simply\n * discarded the first screen's worth of reads and left the tier inert for the surface that\n * triggered them. The residual window — a mutation between a read and its room being joined — is\n * unavoidable in any read-through cache and exists identically for the first read AFTER connection.\n */\n const previousConnectionCountRef = useRef(connectionCount);\n useEffect(() => {\n const previousConnectionCount = previousConnectionCountRef.current;\n previousConnectionCountRef.current = connectionCount;\n if (connectionCount <= 1) return;\n if (connectionCount === previousConnectionCount) return;\n confirmedRoomsRef.current.clear();\n requestedRoomsRef.current.clear();\n pendingRoomsRef.current.clear();\n readCache.clear();\n logDebug('reconnected; coverage and cache reset', { connectionCount });\n }, [connectionCount, readCache]);\n\n /*\n * An ORGANIZATION SWITCH changes which rows a read returns without changing the request.\n *\n * `commitOrganizationScopeValue` is a `setState` plus a WebSocket room re-point — there is no page\n * reload, and reads are tenancy-filtered at the repository. So without this, switching organization\n * would serve the previous tenant's rows from cache. The rooms are re-claimed under the new\n * organization by the next read that wants them.\n */\n useEffect(() => {\n readCache.clear();\n releaseAllRooms();\n logDebug('organization scope changed; cache cleared', { currentOrganizationId });\n }, [currentOrganizationId, readCache, releaseAllRooms]);\n\n /* Invalidate on anything the server says changed, at whatever grade it arrives. */\n useEffect(() => {\n if (!isConnected) return;\n\n const unsubscribeUpdated = on<WS_ResourceUpdatedPayload>(\n CoreWebSocketEvent.RESOURCE_UPDATED,\n (payload) => {\n /*\n * Every grade invalidates, including the SYNC grade that carries a full row.\n *\n * A sync payload is authoritative for ONE row, and a cached entry is usually a LIST whose\n * membership, ordering and pagination the row cannot settle — an added row does not announce\n * where it belongs. Patching the row into the cached list would be a guess; dropping the\n * entry costs one refetch and cannot be wrong.\n */\n readCache.invalidateResourceType(payload.resourceType);\n logDebug('invalidated by resource update', {\n resourceType: payload.resourceType,\n deliveryTarget: payload.deliveryTarget,\n isScopeRoom: payload.deliveryTarget === WebSocketResourceDeliveryTarget.SCOPE_ROOM_NOTIFICATION,\n });\n },\n );\n\n const unsubscribeDeleted = on<WS_ResourceDeletedPayload>(\n CoreWebSocketEvent.RESOURCE_DELETED,\n (payload) => {\n readCache.invalidateResourceType(payload.resourceType);\n },\n );\n\n return () => {\n unsubscribeUpdated();\n unsubscribeDeleted();\n };\n }, [on, isConnected, readCache]);\n\n return null;\n};\n"]}
@@ -731,8 +731,6 @@ export declare const ResourceOperationFrontendConfigSchema: z.ZodObject<{
731
731
  hasDescription: z.ZodOptional<z.ZodBoolean>;
732
732
  adjacentZoneOnEmpty: z.ZodOptional<z.ZodEnum<typeof ZoneEmptyBehavior>>;
733
733
  zoneContentMaxWidth: z.ZodOptional<z.ZodEnum<{
734
- none: "none";
735
- content: "content";
736
734
  full: "full";
737
735
  sm: "sm";
738
736
  md: "md";
@@ -740,6 +738,8 @@ export declare const ResourceOperationFrontendConfigSchema: z.ZodObject<{
740
738
  xl: "xl";
741
739
  measure: "measure";
742
740
  "centered-readable": "centered-readable";
741
+ content: "content";
742
+ none: "none";
743
743
  }>>;
744
744
  zoneContentFillsHeight: z.ZodOptional<z.ZodBoolean>;
745
745
  }, z.core.$strip>;
@@ -1 +1 @@
1
- {"version":3,"file":"start-application.frontend.service.d.ts","sourceR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A+E;IAIzF,qBAAqB,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,mBAAmB,CAAC;YA4B7E,qBAAqB;IA+VnC;;OAEG;IACH,WAAW,IAAI,mBAAmB,GAAG,IAAI;IAIzC;;OAEG;IACH,wBAAwB,IAAI,OAAO;IAInC;;OAEG;IACH,KAAK,IAAI,IAAI;IASb;;OAEG;YACW,gBAAgB;CAoB/B;AAUD,eAAO,MAAM,uBAAuB,EAAyD,+BAA+B,CAAC"}
1
+ {"version":3,"file":"start-application.frontend.service.d.ts","sourceRoot":"","sources":["../../../../src/core/runtime/start-application.frontend.service.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,6DAA6D,CAAC;AAEpG,OAAO,EAAE,sBAAsB,EAAE,MAAM,sEAAsE,CAAC;AAE9G,OAAO,EAAE,kCAAkC,EAAE,MAAM,0EAA0E,CAAC;AAC9H,OAAO,EAAE,+BAA+B,EAAE,MAAM,0BAA0B,CAAC;AAE3E,OAAO,EAGL,uBAAuB,EACvB,KAAK,oBAAoB,EACzB,2CAA2C,EAC3C,oBAAoB,EACpB,KAAK,2BAA2B,EACjC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAEL,KAAK,yBAAyB,EAC/B,MAAM,oEAAoE,CAAC;AAC5E,OAAO,KAAK,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,MAAM,+DAA+D,CAAC;AAEnI,OAAO,EAAE,KAAK,uBAAuB,EAAgC,MAAM,6CAA6C,CAAC;AAMzH,OAAO,EAIL,KAAK,yBAAyB,EAC/B,MAAM,2FAA2F,CAAC;AACnG,OAAO,EAEL,KAAK,uCAAuC,EAC7C,MAAM,yFAAyF,CAAC;AAEjG,OAAO,EAEL,KAAK,6BAA6B,EAClC,KAAK,2BAA2B,EACjC,MAAM,0CAA0C,CAAC;AAwElD,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,+BAA+B,CAAC;IACxC,QAAQ,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AAC;IAClE;;;;;;;OAOG;IACH,oBAAoB,EAAE,6BAA6B,CAAC;IACpD;;;;;;;;;;OAUG;IACH,yBAAyB,EAAE,yBAAyB,CAAC;IACrD,sFAAsF;IACtF,qBAAqB,EAAE,yBAAyB,CAAC;CAClD;AAED,qBAAa,+BAA+B;IAC1C,OAAO,CAAC,QAAQ,CAAoC;IACpD,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,qBAAqB,CAA6C;IAC1E,OAAO,CAAC,MAAM,CAAsC;IACpD,OAAO,CAAC,QAAQ,CAA+E;IAIzF,qBAAqB,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,mBAAmB,CAAC;YA4B7E,qBAAqB;IAuWnC;;OAEG;IACH,WAAW,IAAI,mBAAmB,GAAG,IAAI;IAIzC;;OAEG;IACH,wBAAwB,IAAI,OAAO;IAInC;;OAEG;IACH,KAAK,IAAI,IAAI;IASb;;OAEG;YACW,gBAAgB;CAoB/B;AAUD,eAAO,MAAM,uBAAuB,EAAyD,+BAA+B,CAAC"}
@@ -320,16 +320,24 @@ export class StartApplicationFrontendService {
320
320
  // Registered from the SAME hydrated modules the SDKs activate from, so a
321
321
  // provider that is not live for this service contributes no component
322
322
  // either. Nothing is loaded here: a loader runs when a surface asks.
323
+ const onProviderComponentDiagnostic = (diagnostic) => {
324
+ this.logger?.warn('Provider component diagnostic', {
325
+ kind: diagnostic.kind,
326
+ capability: diagnostic.capability,
327
+ providerRef: diagnostic.providerRef,
328
+ message: diagnostic.message,
329
+ });
330
+ };
323
331
  const providerComponentRegistry = createProviderComponentRegistry({
324
- registrations: collectProviderComponentRegistrations(resolvedProviderRegistry.listAll()),
325
- onDiagnostic: (diagnostic) => {
326
- this.logger?.warn('Provider component diagnostic', {
327
- kind: diagnostic.kind,
328
- capability: diagnostic.capability,
329
- providerRef: diagnostic.providerRef,
330
- message: diagnostic.message,
331
- });
332
- },
332
+ // Each declaration is joined to its loader here: the module's own when it
333
+ // carries one, else the one the facet library contributed at startup
334
+ // (`registerDefaultPresets` → `registerProviderComponents`). A declaration
335
+ // nothing can load is reported and left out, so the chooser offers only
336
+ // what can render.
337
+ registrations: collectProviderComponentRegistrations(resolvedProviderRegistry.listAll(), {
338
+ onDiagnostic: onProviderComponentDiagnostic,
339
+ }),
340
+ onDiagnostic: onProviderComponentDiagnostic,
333
341
  });
334
342
  const services = {
335
343
  logger: this.logger,
@@ -1 +1 @@
1
- {"version":3,"file":"start-application.frontend.service.js","sourceRoot":"","sources":["../../../../src/core/runtime/start-application.frontend.service.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,6DAA6D,CAAC;AACpG,OAAO,EAAE,kCAAkC,EAAE,MAAM,mFAAmF,CAAC;AACvI,OAAO,EAAE,sBAAsB,EAAE,MAAM,sEAAsE,CAAC;AAC9G,OAAO,EAAE,+BAA+B,EAAE,MAAM,uEAAuE,CAAC;AACxH,OAAO,EAAE,kCAAkC,EAAE,MAAM,0EAA0E,CAAC;AAG9H,OAAO,EACL,iDAAiD,EACjD,8BAA8B,GAM/B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,gCAAgC,GAEjC,MAAM,oEAAoE,CAAC;AAE5E,OAAO,EAAE,SAAS,EAAE,MAAM,uEAAuE,CAAC;AAClG,OAAO,EAAgC,4BAA4B,EAAE,MAAM,6CAA6C,CAAC;AACzH,OAAO,EAAE,qBAAqB,EAAE,iCAAiC,EAAE,MAAM,yDAAyD,CAAC;AACnI,OAAO,EAAE,wBAAwB,EAAE,oCAAoC,EAAE,MAAM,6DAA6D,CAAC;AAC7I,OAAO,EAAE,wBAAwB,EAAE,0BAA0B,EAAE,MAAM,sDAAsD,CAAC;AAC5H,OAAO,EAAE,+BAA+B,EAAE,MAAM,oEAAoE,CAAC;AACrH,OAAO,EAAE,wBAAwB,EAAE,MAAM,kFAAkF,CAAC;AAC5H,OAAO,EACL,qCAAqC,EACrC,+BAA+B,GAEhC,M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C3B,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC;QAClC,gDAAgD;IAClD,CAAC;IAID;;OAEG;IACK,KAAK,CAAC,gBAAgB,CAAC,SAAmB;QAChD,IAAI,CAAC,IAAI,CAAC,MAAM;YAAE,OAAO;QAEzB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,yBAAyB,EAAE,EAAE,aAAa,EAAE,SAAS,CAAC,MAAM,EAAE,CAAC,CAAC;QAEjF,IAAI,CAAC;YACH,4CAA4C;YAC5C,uEAAuE;YAEvE,MAAM,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE;gBACjD,IAAI,CAAC,MAAO,CAAC,KAAK,CAAC,wBAAwB,QAAQ,EAAE,CAAC,CAAC;gBACvD,wDAAwD;YAC1D,CAAC,CAAC,CAAC,CAAC;YAEJ,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,4CAA4C,CAAC,CAAC;QACjE,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,4BAA4B,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;YACzE,sEAAsE;QACxE,CAAC;IACH,CAAC;CACF;AAED;;GAEG;AACH,kEAAkE;AAClE,MAAM,WAAW,GAAQ,CAAC,OAAO,UAAU,KAAK,WAAW,CAAC,CAAC,CAAE,UAAkB,CAAC,CAAC,CAAE,MAAc,CAAC,CAAC;AACrG,IAAI,CAAC,WAAW,CAAC,sCAAsC,EAAE,CAAC;IACxD,WAAW,CAAC,sCAAsC,GAAG,IAAI,+BAA+B,EAAE,CAAC;AAC7F,CAAC;AACD,MAAM,CAAC,MAAM,uBAAuB,GAAG,WAAW,CAAC,sCAAyE,CAAC","sourcesContent":["/**\n * Start Application Frontend Service\n * Handles application initialization and startup logic\n */\n\nimport { LoggerFrontendService } from '~wildo-frontend-lib/core/monitoring/logger.frontend.service';\nimport { WildoBackendHttpClient_ManualCalls } from '~wildo-frontend-lib/core/requests/wildo-http-client-manual-calls.frontend.service';\nimport { WildoBackendHttpClient } from '~wildo-frontend-lib/core/requests/wildo-http-client.frontend.service';\nimport { configureClientInstanceIdPolicy } from '~wildo-frontend-lib/core/requests/client-instance-id.frontend.service';\nimport { ResourcesRepositoryFrontendService } from '~wildo-frontend-lib/core/resources/resources-repository.frontend.service';\nimport { InitializationApplicationConfig } from './ApplicationMainContext';\n\nimport {\n AppConfiguration_FrontendBootstrapResponse_Schema,\n AppConfiguration_Shared_Schema,\n AppConfiguration_Shared,\n type FeatureConfiguration,\n ResourceConfiguration_InitializationFactory,\n ResourceRelationship,\n type NotificationBadgeDefinition,\n} from '@wildo-ai/saas-models';\nimport {\n AppConfiguration_Frontend_Schema,\n type AppConfiguration_Frontend,\n} from '~wildo-frontend-lib/core/config/app-configuration-frontend.schemas';\nimport type { ResourceUIBehavior, FrontendResourcesRegistry } from '~wildo-frontend-lib/core/resources/resources.frontend.schemas';\nimport { envLoader } from '~wildo-frontend-lib/core/runtime/env-variable-loader.frontend.service';\nimport { type FrontendConfigOverrides, applyFrontendConfigOverrides } from './app-config-overrides.frontend.definitions';\nimport { verifyLauncherContent, reportLauncherVerificationResults } from '~wildo-frontend-lib/core/config/verify-launcher-content';\nimport { verifySettingsHubContent, reportSettingsHubVerificationResults } from '~wildo-frontend-lib/core/config/verify-settings-hub-content';\nimport { resolveSettingsHubConfig, findUnknownDestinationRefs } from '~wildo-frontend-lib/core/config/useSettingsHubConfig';\nimport { verifyFrontendFeatureReferences } from '~wildo-frontend-lib/core/config/verify-feature-references.frontend';\nimport { ComponentRegistryService } from '~wildo-frontend-lib/core/components-registry/component-registry.frontend.service';\nimport {\n collectProviderComponentRegistrations,\n createProviderComponentRegistry,\n type ProviderComponentRegistry,\n} from '~wildo-frontend-lib/core/components-registry/provider-component-registry.frontend.service';\nimport {\n createFrontendProviderRegistryFrontendService,\n type FrontendProviderRegistryFrontendService,\n} from '~wildo-frontend-lib/core/external-providers/frontend-provider-registry.frontend.service';\nimport { createFrontendErrorMonitoringBridge } from '~wildo-frontend-lib/core/monitoring/error-monitoring-bridge.frontend.service';\nimport {\n activateFrontendProviderSdks,\n type ActivatedFrontendProviderSdks,\n type GeneratedAppProviderModules,\n} from '@wildo-ai/external-connectors-public/app';\nimport { AppFrontendType } from '@wildo-ai/saas-models/public-runtime';\n\ninterface InitializationFailureDiagnostics {\n phase: string;\n apiBaseUrl: string;\n frontendServiceName?: string;\n errorName?: string;\n errorMessage: string;\n stack?: string;\n causeMessage?: string;\n wildoError?: {\n type?: unknown;\n customMessageReference?: unknown;\n context?: Record<string, unknown>;\n };\n}\n\ntype InitializationFailureError = Error & {\n initializationDiagnostics?: InitializationFailureDiagnostics;\n};\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null;\n}\n\nfunction extractCauseMessage(error: unknown): string | undefined {\n if (!isRecord(error) || !('cause' in error)) {\n return undefined;\n }\n\n const cause = error.cause;\n if (cause instanceof Error) {\n return cause.message;\n }\n\n if (typeof cause === 'string') {\n return cause;\n }\n\n return undefined;\n}\n\nfunction normalizeInitializationFailure(\n error: unknown,\n baseDiagnostics: {\n phase: string;\n apiBaseUrl: string;\n frontendServiceName?: string;\n },\n): InitializationFailureError {\n const normalizedError = error instanceof Error ? error : new Error(String(error));\n const wildoError = isRecord(normalizedError) && isRecord(normalizedError.wildoError)\n ? normalizedError.wildoError\n : undefined;\n\n (normalizedError as InitializationFailureError).initializationDiagnostics = {\n ...baseDiagnostics,\n errorName: normalizedError.name,\n errorMessage: normalizedError.message,\n stack: normalizedError.stack,\n causeMessage: extractCauseMessage(normalizedError),\n wildoError: wildoError ? {\n type: wildoError.type,\n customMessageReference: wildoError.customMessageReference,\n context: isRecord(wildoError.context) ? wildoError.context : undefined,\n } : undefined,\n };\n\n return normalizedError as InitializationFailureError;\n}\n\nexport interface StartApplicationOptions {\n config: InitializationApplicationConfig;\n autoAuth?: boolean;\n preloadResources?: string[];\n onInitialized?: () => void;\n onError?: (error: Error) => void;\n\n /**\n * Custom shared resources configuration factory map from custom-shared-lib.\n * Required for custom resources to be registered in the frontend ResourceRegistryContext.\n */\n customShared_ResourcesConfigurationsFactoryMap?: { [key: string]: ResourceConfiguration_InitializationFactory<any, any, any> };\n\n /**\n * Custom shared resource field identifiers from custom-shared-lib.\n */\n customShared_ResourceFieldIdentifier?: { [key: string]: string };\n\n /**\n * Custom shared resource relationships from custom-shared-lib.\n */\n customShared_ResourcesRelationships?: ResourceRelationship[];\n\n /**\n * Resource types to leave OUT of the registry, even though the core factory map declares them.\n *\n * `ResourcesRepositoryFrontendService.initializeResources` has always accepted this; the bootstrap\n * passed a hard-coded `undefined`, so the capability existed and no application-level caller could\n * reach it. That is fine for an application, which wants the whole core vocabulary — and wrong for\n * any OTHER kind of Wildo frontend.\n *\n * The application-creation workbench is the case that surfaced it: it observes an application's\n * structure and is not that application's admin console, so registering the engine's billing,\n * subscription, milestone, user and organization resources would surface a tenant vocabulary it has\n * no business showing. Its exclusion set is derived from `CoreResourceType` minus the types its own\n * relationships anchor on, so it needs no list here — only a way to pass one.\n */\n excludedResourceTypes?: ReadonlySet<string>;\n\n /**\n * Final frontend resource configuration preset.\n *\n * Controls how each resource and its operations appear in the frontend:\n * labels, sections, views, empty state, guidance (resource-level) and\n * addressability, sidebar placement, layout presets (operation-level).\n *\n * Apps must pass one already-composed object. In Wonder Todos, the engine\n * module owns the framework base preset and layers any app-shell\n * overrides before the final aggregated module registry reaches startup.\n *\n * The preset is the sole source of truth — only resources and operations\n * declared in the preset exist in the frontend registry.\n */\n resourceUIBehavior?: ResourceUIBehavior;\n\n /**\n * App-declared notification badge definitions (merged with the framework's\n * `coreNotificationBadgeDefinitions` in the frontend registry so\n * `NavigationItemBadge` can resolve an app badge). Mirror the backend\n * `ApplicationInitializationConfig.notificationBadgeDefinitions`.\n */\n notificationBadgeDefinitions?: NotificationBadgeDefinition[];\n\n /**\n * Base frontend configuration — provided by the app via the preset layer.\n * No implicit framework defaults: apps must explicitly provide this.\n */\n baseFrontendConfig: AppConfiguration_Frontend;\n\n /** Per-section frontend config overrides (factories or partial values) */\n frontendConfigOverrides?: FrontendConfigOverrides;\n\n /** Merged feature configuration used for frontend-only feature-ref validation. */\n featureConfiguration?: FeatureConfiguration;\n\n /** Component loader — registers component presets during initialization */\n componentLoader: () => Promise<void>;\n\n /**\n * The CODE channel for frontend providers (#332): the\n * `generatedFrontendProviderModules` export of this frontend service's own\n * `src/generated/frontend-providers.generated.ts`, written by\n * `wildo config sync`.\n *\n * The bootstrap payload says WHICH providers this service turned on; this says\n * what code the bundle actually contains for them. Both are needed, because a\n * JSON payload cannot carry an SDK loader and a bundle cannot know which\n * environment it is running in.\n *\n * Omitted is the ordinary case for an application declaring no package-shipped\n * frontend provider: no such file is generated, so there is nothing to import.\n */\n frontendProviderModules?: GeneratedAppProviderModules;\n}\n\nexport interface ApplicationServices {\n logger: LoggerFrontendService;\n httpClient: WildoBackendHttpClient;\n resourceRepository: ResourcesRepositoryFrontendService;\n resourcesRegistry: FrontendResourcesRegistry;\n appConfigFromBackend: AppConfiguration_Shared;\n frontendProviderRegistry: FrontendProviderRegistryFrontendService;\n /**\n * The vendor SDKs of every declared provider that carries one, already loaded\n * and started (#332).\n *\n * Present even when empty, so a consumer never has to distinguish \"no SDKs\"\n * from \"activation has not run\". `deactivateAll()` is the paired path a\n * consent withdrawal needs.\n */\n frontendProviderSdks: ActivatedFrontendProviderSdks;\n /**\n * Components contributed by the live providers, keyed by capability (#380).\n *\n * A sibling of `ComponentRegistryService`, not a part of it: that one indexes\n * the engine's CLOSED component-type enum with exactly one answer per key,\n * while this indexes the OPEN capability vocabulary where several providers\n * may answer and the surface presents the choice.\n *\n * Always present, even when empty, so a consumer never has to tell \"no\n * provider components\" from \"registration has not run\".\n */\n providerComponentRegistry: ProviderComponentRegistry;\n /** Resolved per-app frontend configuration (defaults + overrides). Always present. */\n frontendConfiguration: AppConfiguration_Frontend;\n}\n\nexport class StartApplicationFrontendService {\n private services: ApplicationServices | null = null;\n private isInitialized = false;\n private initializationPromise: Promise<ApplicationServices> | null = null;\n private logger: LoggerFrontendService | null = null;\n private logDebug: ((message: string, context?: Record<string, unknown>) => void) | null = null;\n\n\n\n async initializeApplication(options: StartApplicationOptions): Promise<ApplicationServices> {\n if (this.isInitialized && this.services)\n return this.services;\n\n if (this.initializationPromise)\n return this.initializationPromise;\n\n // Freeze options snapshot to ensure stable initialization across dev StrictMode double-invoke\n const snapshot: StartApplicationOptions = { ...options };\n this.initializationPromise = this.performInitialization(snapshot);\n\n try {\n this.services = await this.initializationPromise;\n this.isInitialized = true;\n\n try {\n options.onInitialized && options.onInitialized();\n } catch (error) {\n this.logger.error('Failed to fire onInitialized callback', { error: error instanceof Error ? error.message : String(error) });\n }\n return this.services;\n\n } catch (error) {\n this.initializationPromise = null;\n throw error;\n }\n }\n\n private async performInitialization(options: StartApplicationOptions): Promise<ApplicationServices> {\n const {\n config,\n autoAuth = true,\n preloadResources = [],\n onError,\n customShared_ResourcesConfigurationsFactoryMap,\n customShared_ResourceFieldIdentifier,\n customShared_ResourcesRelationships,\n componentLoader,\n } = options;\n let currentPhase = 'startup preparation';\n let envConfig: ReturnType<typeof envLoader.loadEnvironmentConfig> | undefined;\n\n if (!this.logger) {\n this.logger = LoggerFrontendService.getLogger();\n this.logDebug = this.logger.debugByType('StartApplicationFrontendService');\n this.logger.setDebugTypeLogging('StartApplicationFrontendService', false);\n }\n\n this.logger.info('Starting application initialization...', {\n autoAuth,\n });\n\n this.logDebug!('Frontend initialization started with config', {\n apiBaseUrl: config.apiBaseUrl,\n autoAuth,\n });\n\n try {\n // Initialize HTTP client\n currentPhase = 'http client initialization';\n this.logDebug('Initializing HTTP client...');\n const httpClient = new WildoBackendHttpClient({ baseURL: config.apiBaseUrl });\n\n // Fetch application configuration from backend\n currentPhase = 'manual backend client setup';\n this.logDebug('Fetching application configuration from backend...');\n const manualCallsClient = new WildoBackendHttpClient_ManualCalls({ baseURL: config.apiBaseUrl });\n\n try {\n currentPhase = 'environment configuration loading';\n envConfig = envLoader.loadEnvironmentConfig();\n this.logDebug('Environment configuration loaded', {\n frontendServiceName: envConfig.frontendServiceName,\n apiBaseUrl: envConfig.apiBaseUrl,\n appName: envConfig.appName\n });\n } catch (error) {\n this.logger.error('Failed to load environment configuration', { error: error.message });\n throw new Error(`Environment configuration failed: ${error.message}`);\n }\n\n let appConfigFromBackend;\n let frontendProviderRegistry: FrontendProviderRegistryFrontendService | undefined;\n try {\n currentPhase = 'backend application configuration fetch';\n // Retry logic for config retrieval\n // Note: Keep this low to avoid long waits when backend is down\n // HTTP client also has its own retry logic (3 attempts by default)\n const CONFIG_RETRY_ATTEMPTS = 2; // Reduced from 10 to avoid long waits\n const CONFIG_BASE_DELAY_MS = 2000; // 2 seconds between retries\n const CONFIG_MAX_DELAY_MS = 5000;\n\n let lastError: Error | null = null;\n for (let attempt = 1; attempt <= CONFIG_RETRY_ATTEMPTS; attempt++) {\n try {\n const bootstrapPayload = AppConfiguration_FrontendBootstrapResponse_Schema.parse(\n await manualCallsClient.getApplicationConfig(envConfig.frontendServiceName),\n );\n frontendProviderRegistry = createFrontendProviderRegistryFrontendService({\n entries: bootstrapPayload.frontendProviders,\n modules: options.frontendProviderModules,\n // Hydration diagnostics are WARNINGS, never failures. Every one of\n // them names a provider that is declared but cannot fully run, and\n // an application must still start: the alternative is a blank page\n // because an analytics provider's config was renamed.\n onDiagnostic: (diagnostic) => {\n this.logger?.warn('Frontend provider hydration diagnostic', {\n kind: diagnostic.kind,\n providerRef: diagnostic.providerRef,\n message: diagnostic.message,\n });\n },\n });\n appConfigFromBackend = AppConfiguration_Shared_Schema.parse(bootstrapPayload);\n break; // Success, exit retry loop\n } catch (error) {\n lastError = error instanceof Error ? error : new Error(String(error));\n\n if (attempt < CONFIG_RETRY_ATTEMPTS) {\n const delay = Math.min(\n CONFIG_BASE_DELAY_MS * Math.pow(2, attempt - 1),\n CONFIG_MAX_DELAY_MS\n );\n this.logDebug(`Config fetch attempt ${attempt}/${CONFIG_RETRY_ATTEMPTS} failed, retrying after ${delay}ms`, {\n error: lastError.message,\n attempt,\n totalAttempts: CONFIG_RETRY_ATTEMPTS\n });\n await new Promise(resolve => setTimeout(resolve, delay));\n } else {\n this.logger.error(`All ${CONFIG_RETRY_ATTEMPTS} config fetch attempts failed`, {\n error: lastError.message,\n totalAttempts: CONFIG_RETRY_ATTEMPTS\n });\n throw lastError;\n }\n }\n }\n\n // Apply the application's client-install identification policy as soon as the config that\n // carries it is available (Fork D / SD9). Until this line runs, the store is fail-closed —\n // nothing is minted, stored, or sent — so bootstrap traffic before this point (including the\n // config fetch itself) never carries a client-install id. Applying `DISABLED` is NOT a no-op:\n // it purges any id a previously-enabled policy left on the device.\n configureClientInstanceIdPolicy(appConfigFromBackend.compliance.clientInstanceIdScope);\n\n this.logDebug('Application configuration fetched successfully', {\n hasAppIdentity: !!appConfigFromBackend.appIdentity,\n hasAppPreferences: !!appConfigFromBackend.appPreferences,\n hasRuntime: !!appConfigFromBackend.runtime,\n endpointsCount: Object.keys(appConfigFromBackend.runtime?.endPoints || {}).length\n });\n\n this.logDebug!('Application configuration loaded from backend', {\n appName: appConfigFromBackend.appIdentity?.appName,\n version: appConfigFromBackend.appIdentity?.version,\n hasAuth: !!appConfigFromBackend.auth,\n hasSocialOAuth2Providers:\n !!appConfigFromBackend.auth?.socialOAuth2Providers\n && Object.keys(appConfigFromBackend.auth.socialOAuth2Providers).length > 0,\n defaultLanguage: appConfigFromBackend.appPreferences?.languages?.defaultLanguage,\n enabledLanguages: appConfigFromBackend.appPreferences?.languages?.enabledLanguages,\n endpointsList: Object.keys(appConfigFromBackend.runtime?.endPoints || {}),\n frontendProvidersCount: frontendProviderRegistry?.listAll().length ?? 0,\n });\n\n\n } catch (error) {\n this.logger.error('Failed to fetch application configuration from backend', {\n error: error.message,\n frontendServiceName: envConfig?.frontendServiceName,\n apiBaseUrl: config.apiBaseUrl\n });\n throw new Error(`Application configuration fetch failed: ${error.message}`);\n }\n\n // Resolve frontend configuration from app-provided base + overrides\n // Frontend config is owned entirely by the frontend — not sent from backend\n currentPhase = 'frontend configuration validation';\n let resolvedFrontendConfig: AppConfiguration_Frontend = {\n ...options.baseFrontendConfig,\n };\n this.logDebug('Using app-provided base frontend configuration');\n\n if (options.frontendConfigOverrides) {\n resolvedFrontendConfig = applyFrontendConfigOverrides(\n resolvedFrontendConfig,\n options.frontendConfigOverrides,\n );\n this.logDebug('Applied frontend config overrides', { sections: Object.keys(options.frontendConfigOverrides) });\n }\n\n resolvedFrontendConfig = AppConfiguration_Frontend_Schema.parse(resolvedFrontendConfig);\n\n this.logDebug!('Frontend configuration resolved', {\n frontendServiceName: envConfig.frontendServiceName,\n finalConfig: {\n hasNavigationLayout: !!resolvedFrontendConfig.navigationLayout,\n hasAppComponentsConfiguration: !!resolvedFrontendConfig.appComponentsConfiguration,\n hasDesignSystem: !!resolvedFrontendConfig.designSystemConfiguration,\n hasTypography: !!resolvedFrontendConfig.designSystemConfiguration?.typography,\n }\n });\n\n // Initialize resources repository\n currentPhase = 'frontend resource registry initialization';\n this.logDebug('Initializing resources repository...');\n const resourceRepository = new ResourcesRepositoryFrontendService(httpClient);\n await resourceRepository.initializeResources(\n customShared_ResourcesConfigurationsFactoryMap,\n customShared_ResourceFieldIdentifier,\n customShared_ResourcesRelationships,\n options.excludedResourceTypes,\n options.resourceUIBehavior,\n options.notificationBadgeDefinitions,\n );\n const resourcesRegistry = resourceRepository.getResourcesRegistry();\n\n // Initialize frontend component presets (app-provided registration)\n currentPhase = 'component preset registration';\n await componentLoader();\n\n // DEV-mode: verify launcher/view declarations only after component\n // registration so custom component refs can be checked deterministically.\n if (envLoader.isDevelopment()) {\n currentPhase = 'development launcher verification';\n const verificationResult = verifyLauncherContent(\n resourcesRegistry,\n resolvedFrontendConfig,\n (componentRef: string) => ComponentRegistryService.hasComponentType(componentRef as any),\n );\n reportLauncherVerificationResults(verificationResult);\n\n // Settings Hub: catch duplicate section refs (and sibling structural\n // gaps) before they silently double-render the content panel. Verifies\n // the SAME resolved config the SettingsHub component renders.\n // Resolve the application's OWN authored rail — there is no framework\n // default to fall back to, so a missing `settingsHub` verifies as an\n // empty hub rather than as the engine's arrangement.\n reportSettingsHubVerificationResults(\n verifySettingsHubContent(\n resolveSettingsHubConfig(resolvedFrontendConfig?.settingsHub),\n findUnknownDestinationRefs(resolvedFrontendConfig?.settingsHub),\n ),\n );\n\n if (options.featureConfiguration) {\n const featureReferenceVerification = verifyFrontendFeatureReferences({\n resourcesRegistry,\n appConfig: resolvedFrontendConfig,\n featureConfiguration: options.featureConfiguration,\n // Same predicate the launcher verification uses, and available here for the same\n // reason: this block runs AFTER `componentLoader()`, so a CUSTOM feature's\n // `customComponentRef` can be checked against real registrations.\n isComponentRegistered: (componentRef: string) => ComponentRegistryService.hasComponentType(componentRef as any),\n });\n\n if (!featureReferenceVerification.isValid) {\n this.logger.warn(\n `Invalid frontend feature references detected:\\n${featureReferenceVerification.warnings\n .map(warning => ` ⚠ ${warning}`)\n .join('\\n')}`,\n );\n }\n }\n }\n\n // Preload resources if specified\n if (preloadResources.length > 0) {\n currentPhase = 'resource preload';\n await this.preloadResources(preloadResources);\n }\n\n // Load and start every declared provider's SDK. AFTER the registry is\n // composed, because the registry is what decides which providers are live\n // for this service, and BEFORE the services object is handed out, so a\n // consumer never observes a half-activated surface. One provider's\n // failure never stops another's, and none of them can fail startup.\n currentPhase = 'frontend provider SDK activation';\n const resolvedProviderRegistry =\n frontendProviderRegistry ?? createFrontendProviderRegistryFrontendService();\n const frontendProviderSdks = await activateFrontendProviderSdks({\n surface: AppFrontendType.SAAS_APP,\n modules: resolvedProviderRegistry.listAll(),\n onDiagnostic: (diagnostic) => {\n this.logger?.warn('Frontend provider SDK activation diagnostic', {\n kind: diagnostic.kind,\n providerRef: diagnostic.providerRef,\n message: diagnostic.message,\n });\n },\n });\n\n /*\n * Subscribe the live error-monitoring providers to the crash bus, IMMEDIATELY\n * after activation and from the same hydrated modules (#437).\n *\n * Here rather than in a React component because it must survive the one\n * situation a component cannot: a tree unmounting because it crashed. And after\n * activation rather than before, because a sink only exists once its SDK has\n * started — subscribing earlier would install a bridge with nothing behind it\n * and silently drop every crash in the window.\n *\n * Deliberately NOT retained for teardown: the bus, like the activated SDKs,\n * lives as long as the application does, and an unsubscribe reachable from\n * application code is a way for crash reporting to be switched off by accident.\n */\n currentPhase = 'frontend error-monitoring bridge';\n createFrontendErrorMonitoringBridge({\n modules: resolvedProviderRegistry.listAll(),\n activations: frontendProviderSdks.activations,\n onDiagnostic: (diagnostic) => {\n this.logger?.warn('Frontend error-monitoring bridge diagnostic', {\n kind: diagnostic.kind,\n providerRef: diagnostic.providerRef,\n message: diagnostic.message,\n });\n },\n });\n\n // Registered from the SAME hydrated modules the SDKs activate from, so a\n // provider that is not live for this service contributes no component\n // either. Nothing is loaded here: a loader runs when a surface asks.\n const providerComponentRegistry = createProviderComponentRegistry({\n registrations: collectProviderComponentRegistrations(resolvedProviderRegistry.listAll()),\n onDiagnostic: (diagnostic) => {\n this.logger?.warn('Provider component diagnostic', {\n kind: diagnostic.kind,\n capability: diagnostic.capability,\n providerRef: diagnostic.providerRef,\n message: diagnostic.message,\n });\n },\n });\n\n const services: ApplicationServices = {\n logger: this.logger,\n httpClient,\n resourceRepository,\n resourcesRegistry,\n appConfigFromBackend,\n frontendProviderRegistry: resolvedProviderRegistry,\n frontendProviderSdks,\n providerComponentRegistry,\n frontendConfiguration: resolvedFrontendConfig,\n };\n\n this.logger.info('Application initialization completed successfully');\n\n return services;\n\n } catch (error) {\n const initializationFailure = normalizeInitializationFailure(error, {\n phase: currentPhase,\n apiBaseUrl: config.apiBaseUrl,\n frontendServiceName: envConfig?.frontendServiceName,\n });\n\n if (this.logger) {\n this.logger.error('Application initialization failed', {\n error: initializationFailure.message,\n stack: initializationFailure.stack,\n phase: currentPhase,\n apiBaseUrl: config.apiBaseUrl,\n frontendServiceName: envConfig?.frontendServiceName,\n initializationDiagnostics: initializationFailure.initializationDiagnostics,\n });\n } else {\n console.error('Application initialization failed:', initializationFailure);\n }\n\n if (onError) {\n onError(initializationFailure);\n }\n\n throw initializationFailure;\n }\n }\n\n /**\n * Get the initialized services\n */\n getServices(): ApplicationServices | null {\n return this.services;\n }\n\n /**\n * Check if the application is initialized\n */\n isApplicationInitialized(): boolean {\n return this.isInitialized;\n }\n\n /**\n * Reset the initialization state (useful for testing)\n */\n reset(): void {\n this.services = null;\n this.isInitialized = false;\n this.initializationPromise = null;\n // Don't reset logger - keep singleton principle\n }\n\n\n\n /**\n * Preload specified resources\n */\n private async preloadResources(resources: string[]): Promise<void> {\n if (!this.logger) return;\n\n this.logger.info('Preloading resources...', { resourceCount: resources.length });\n\n try {\n // TODO: Implement resource preloading logic\n // This could involve fetching commonly used data, warming caches, etc.\n\n await Promise.all(resources.map(async (resource) => {\n this.logger!.debug(`Preloading resource: ${resource}`);\n // Implement specific preloading logic per resource type\n }));\n\n this.logger.info('Resource preloading completed successfully');\n } catch (error) {\n this.logger.warn('Resource preloading failed', { error: error.message });\n // Don't throw here - preloading failure shouldn't prevent app startup\n }\n }\n}\n\n/**\n * Global instance of the start application service\n */\n// Persist singleton across HMR/dev to avoid double initialization\nconst __globalAny: any = (typeof globalThis !== 'undefined' ? (globalThis as any) : (window as any));\nif (!__globalAny.__START_APPLICATION_FRONTEND_SERVICE__) {\n __globalAny.__START_APPLICATION_FRONTEND_SERVICE__ = new StartApplicationFrontendService();\n}\nexport const startApplicationService = __globalAny.__START_APPLICATION_FRONTEND_SERVICE__ as StartApplicationFrontendService;\n"]}
1
+ {"version":3,"file":"start-application.frontend.service.js","sourceRoot":"","sources":["../../../../src/core/runtime/start-application.frontend.service.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,6DAA6D,CAAC;AACpG,OAAO,EAAE,kCAAkC,EAAE,MAAM,mFAAmF,CAAC;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uEAAuE;YAEvE,MAAM,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE;gBACjD,IAAI,CAAC,MAAO,CAAC,KAAK,CAAC,wBAAwB,QAAQ,EAAE,CAAC,CAAC;gBACvD,wDAAwD;YAC1D,CAAC,CAAC,CAAC,CAAC;YAEJ,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,4CAA4C,CAAC,CAAC;QACjE,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,4BAA4B,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;YACzE,sEAAsE;QACxE,CAAC;IACH,CAAC;CACF;AAED;;GAEG;AACH,kEAAkE;AAClE,MAAM,WAAW,GAAQ,CAAC,OAAO,UAAU,KAAK,WAAW,CAAC,CAAC,CAAE,UAAkB,CAAC,CAAC,CAAE,MAAc,CAAC,CAAC;AACrG,IAAI,CAAC,WAAW,CAAC,sCAAsC,EAAE,CAAC;IACxD,WAAW,CAAC,sCAAsC,GAAG,IAAI,+BAA+B,EAAE,CAAC;AAC7F,CAAC;AACD,MAAM,CAAC,MAAM,uBAAuB,GAAG,WAAW,CAAC,sCAAyE,CAAC","sourcesContent":["/**\n * Start Application Frontend Service\n * Handles application initialization and startup logic\n */\n\nimport { LoggerFrontendService } from '~wildo-frontend-lib/core/monitoring/logger.frontend.service';\nimport { WildoBackendHttpClient_ManualCalls } from '~wildo-frontend-lib/core/requests/wildo-http-client-manual-calls.frontend.service';\nimport { WildoBackendHttpClient } from '~wildo-frontend-lib/core/requests/wildo-http-client.frontend.service';\nimport { configureClientInstanceIdPolicy } from '~wildo-frontend-lib/core/requests/client-instance-id.frontend.service';\nimport { ResourcesRepositoryFrontendService } from '~wildo-frontend-lib/core/resources/resources-repository.frontend.service';\nimport { InitializationApplicationConfig } from './ApplicationMainContext';\n\nimport {\n AppConfiguration_FrontendBootstrapResponse_Schema,\n AppConfiguration_Shared_Schema,\n AppConfiguration_Shared,\n type FeatureConfiguration,\n ResourceConfiguration_InitializationFactory,\n ResourceRelationship,\n type NotificationBadgeDefinition,\n} from '@wildo-ai/saas-models';\nimport {\n AppConfiguration_Frontend_Schema,\n type AppConfiguration_Frontend,\n} from '~wildo-frontend-lib/core/config/app-configuration-frontend.schemas';\nimport type { ResourceUIBehavior, FrontendResourcesRegistry } from '~wildo-frontend-lib/core/resources/resources.frontend.schemas';\nimport { envLoader } from '~wildo-frontend-lib/core/runtime/env-variable-loader.frontend.service';\nimport { type FrontendConfigOverrides, applyFrontendConfigOverrides } from './app-config-overrides.frontend.definitions';\nimport { verifyLauncherContent, reportLauncherVerificationResults } from '~wildo-frontend-lib/core/config/verify-launcher-content';\nimport { verifySettingsHubContent, reportSettingsHubVerificationResults } from '~wildo-frontend-lib/core/config/verify-settings-hub-content';\nimport { resolveSettingsHubConfig, findUnknownDestinationRefs } from '~wildo-frontend-lib/core/config/useSettingsHubConfig';\nimport { verifyFrontendFeatureReferences } from '~wildo-frontend-lib/core/config/verify-feature-references.frontend';\nimport { ComponentRegistryService } from '~wildo-frontend-lib/core/components-registry/component-registry.frontend.service';\nimport {\n collectProviderComponentRegistrations,\n createProviderComponentRegistry,\n type ProviderComponentDiagnostic,\n type ProviderComponentRegistry,\n} from '~wildo-frontend-lib/core/components-registry/provider-component-registry.frontend.service';\nimport {\n createFrontendProviderRegistryFrontendService,\n type FrontendProviderRegistryFrontendService,\n} from '~wildo-frontend-lib/core/external-providers/frontend-provider-registry.frontend.service';\nimport { createFrontendErrorMonitoringBridge } from '~wildo-frontend-lib/core/monitoring/error-monitoring-bridge.frontend.service';\nimport {\n activateFrontendProviderSdks,\n type ActivatedFrontendProviderSdks,\n type GeneratedAppProviderModules,\n} from '@wildo-ai/external-connectors-public/app';\nimport { AppFrontendType } from '@wildo-ai/saas-models/public-runtime';\n\ninterface InitializationFailureDiagnostics {\n phase: string;\n apiBaseUrl: string;\n frontendServiceName?: string;\n errorName?: string;\n errorMessage: string;\n stack?: string;\n causeMessage?: string;\n wildoError?: {\n type?: unknown;\n customMessageReference?: unknown;\n context?: Record<string, unknown>;\n };\n}\n\ntype InitializationFailureError = Error & {\n initializationDiagnostics?: InitializationFailureDiagnostics;\n};\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null;\n}\n\nfunction extractCauseMessage(error: unknown): string | undefined {\n if (!isRecord(error) || !('cause' in error)) {\n return undefined;\n }\n\n const cause = error.cause;\n if (cause instanceof Error) {\n return cause.message;\n }\n\n if (typeof cause === 'string') {\n return cause;\n }\n\n return undefined;\n}\n\nfunction normalizeInitializationFailure(\n error: unknown,\n baseDiagnostics: {\n phase: string;\n apiBaseUrl: string;\n frontendServiceName?: string;\n },\n): InitializationFailureError {\n const normalizedError = error instanceof Error ? error : new Error(String(error));\n const wildoError = isRecord(normalizedError) && isRecord(normalizedError.wildoError)\n ? normalizedError.wildoError\n : undefined;\n\n (normalizedError as InitializationFailureError).initializationDiagnostics = {\n ...baseDiagnostics,\n errorName: normalizedError.name,\n errorMessage: normalizedError.message,\n stack: normalizedError.stack,\n causeMessage: extractCauseMessage(normalizedError),\n wildoError: wildoError ? {\n type: wildoError.type,\n customMessageReference: wildoError.customMessageReference,\n context: isRecord(wildoError.context) ? wildoError.context : undefined,\n } : undefined,\n };\n\n return normalizedError as InitializationFailureError;\n}\n\nexport interface StartApplicationOptions {\n config: InitializationApplicationConfig;\n autoAuth?: boolean;\n preloadResources?: string[];\n onInitialized?: () => void;\n onError?: (error: Error) => void;\n\n /**\n * Custom shared resources configuration factory map from custom-shared-lib.\n * Required for custom resources to be registered in the frontend ResourceRegistryContext.\n */\n customShared_ResourcesConfigurationsFactoryMap?: { [key: string]: ResourceConfiguration_InitializationFactory<any, any, any> };\n\n /**\n * Custom shared resource field identifiers from custom-shared-lib.\n */\n customShared_ResourceFieldIdentifier?: { [key: string]: string };\n\n /**\n * Custom shared resource relationships from custom-shared-lib.\n */\n customShared_ResourcesRelationships?: ResourceRelationship[];\n\n /**\n * Resource types to leave OUT of the registry, even though the core factory map declares them.\n *\n * `ResourcesRepositoryFrontendService.initializeResources` has always accepted this; the bootstrap\n * passed a hard-coded `undefined`, so the capability existed and no application-level caller could\n * reach it. That is fine for an application, which wants the whole core vocabulary — and wrong for\n * any OTHER kind of Wildo frontend.\n *\n * The application-creation workbench is the case that surfaced it: it observes an application's\n * structure and is not that application's admin console, so registering the engine's billing,\n * subscription, milestone, user and organization resources would surface a tenant vocabulary it has\n * no business showing. Its exclusion set is derived from `CoreResourceType` minus the types its own\n * relationships anchor on, so it needs no list here — only a way to pass one.\n */\n excludedResourceTypes?: ReadonlySet<string>;\n\n /**\n * Final frontend resource configuration preset.\n *\n * Controls how each resource and its operations appear in the frontend:\n * labels, sections, views, empty state, guidance (resource-level) and\n * addressability, sidebar placement, layout presets (operation-level).\n *\n * Apps must pass one already-composed object. In Wonder Todos, the engine\n * module owns the framework base preset and layers any app-shell\n * overrides before the final aggregated module registry reaches startup.\n *\n * The preset is the sole source of truth — only resources and operations\n * declared in the preset exist in the frontend registry.\n */\n resourceUIBehavior?: ResourceUIBehavior;\n\n /**\n * App-declared notification badge definitions (merged with the framework's\n * `coreNotificationBadgeDefinitions` in the frontend registry so\n * `NavigationItemBadge` can resolve an app badge). Mirror the backend\n * `ApplicationInitializationConfig.notificationBadgeDefinitions`.\n */\n notificationBadgeDefinitions?: NotificationBadgeDefinition[];\n\n /**\n * Base frontend configuration — provided by the app via the preset layer.\n * No implicit framework defaults: apps must explicitly provide this.\n */\n baseFrontendConfig: AppConfiguration_Frontend;\n\n /** Per-section frontend config overrides (factories or partial values) */\n frontendConfigOverrides?: FrontendConfigOverrides;\n\n /** Merged feature configuration used for frontend-only feature-ref validation. */\n featureConfiguration?: FeatureConfiguration;\n\n /** Component loader — registers component presets during initialization */\n componentLoader: () => Promise<void>;\n\n /**\n * The CODE channel for frontend providers (#332): the\n * `generatedFrontendProviderModules` export of this frontend service's own\n * `src/generated/frontend-providers.generated.ts`, written by\n * `wildo config sync`.\n *\n * The bootstrap payload says WHICH providers this service turned on; this says\n * what code the bundle actually contains for them. Both are needed, because a\n * JSON payload cannot carry an SDK loader and a bundle cannot know which\n * environment it is running in.\n *\n * Omitted is the ordinary case for an application declaring no package-shipped\n * frontend provider: no such file is generated, so there is nothing to import.\n */\n frontendProviderModules?: GeneratedAppProviderModules;\n}\n\nexport interface ApplicationServices {\n logger: LoggerFrontendService;\n httpClient: WildoBackendHttpClient;\n resourceRepository: ResourcesRepositoryFrontendService;\n resourcesRegistry: FrontendResourcesRegistry;\n appConfigFromBackend: AppConfiguration_Shared;\n frontendProviderRegistry: FrontendProviderRegistryFrontendService;\n /**\n * The vendor SDKs of every declared provider that carries one, already loaded\n * and started (#332).\n *\n * Present even when empty, so a consumer never has to distinguish \"no SDKs\"\n * from \"activation has not run\". `deactivateAll()` is the paired path a\n * consent withdrawal needs.\n */\n frontendProviderSdks: ActivatedFrontendProviderSdks;\n /**\n * Components contributed by the live providers, keyed by capability (#380).\n *\n * A sibling of `ComponentRegistryService`, not a part of it: that one indexes\n * the engine's CLOSED component-type enum with exactly one answer per key,\n * while this indexes the OPEN capability vocabulary where several providers\n * may answer and the surface presents the choice.\n *\n * Always present, even when empty, so a consumer never has to tell \"no\n * provider components\" from \"registration has not run\".\n */\n providerComponentRegistry: ProviderComponentRegistry;\n /** Resolved per-app frontend configuration (defaults + overrides). Always present. */\n frontendConfiguration: AppConfiguration_Frontend;\n}\n\nexport class StartApplicationFrontendService {\n private services: ApplicationServices | null = null;\n private isInitialized = false;\n private initializationPromise: Promise<ApplicationServices> | null = null;\n private logger: LoggerFrontendService | null = null;\n private logDebug: ((message: string, context?: Record<string, unknown>) => void) | null = null;\n\n\n\n async initializeApplication(options: StartApplicationOptions): Promise<ApplicationServices> {\n if (this.isInitialized && this.services)\n return this.services;\n\n if (this.initializationPromise)\n return this.initializationPromise;\n\n // Freeze options snapshot to ensure stable initialization across dev StrictMode double-invoke\n const snapshot: StartApplicationOptions = { ...options };\n this.initializationPromise = this.performInitialization(snapshot);\n\n try {\n this.services = await this.initializationPromise;\n this.isInitialized = true;\n\n try {\n options.onInitialized && options.onInitialized();\n } catch (error) {\n this.logger.error('Failed to fire onInitialized callback', { error: error instanceof Error ? error.message : String(error) });\n }\n return this.services;\n\n } catch (error) {\n this.initializationPromise = null;\n throw error;\n }\n }\n\n private async performInitialization(options: StartApplicationOptions): Promise<ApplicationServices> {\n const {\n config,\n autoAuth = true,\n preloadResources = [],\n onError,\n customShared_ResourcesConfigurationsFactoryMap,\n customShared_ResourceFieldIdentifier,\n customShared_ResourcesRelationships,\n componentLoader,\n } = options;\n let currentPhase = 'startup preparation';\n let envConfig: ReturnType<typeof envLoader.loadEnvironmentConfig> | undefined;\n\n if (!this.logger) {\n this.logger = LoggerFrontendService.getLogger();\n this.logDebug = this.logger.debugByType('StartApplicationFrontendService');\n this.logger.setDebugTypeLogging('StartApplicationFrontendService', false);\n }\n\n this.logger.info('Starting application initialization...', {\n autoAuth,\n });\n\n this.logDebug!('Frontend initialization started with config', {\n apiBaseUrl: config.apiBaseUrl,\n autoAuth,\n });\n\n try {\n // Initialize HTTP client\n currentPhase = 'http client initialization';\n this.logDebug('Initializing HTTP client...');\n const httpClient = new WildoBackendHttpClient({ baseURL: config.apiBaseUrl });\n\n // Fetch application configuration from backend\n currentPhase = 'manual backend client setup';\n this.logDebug('Fetching application configuration from backend...');\n const manualCallsClient = new WildoBackendHttpClient_ManualCalls({ baseURL: config.apiBaseUrl });\n\n try {\n currentPhase = 'environment configuration loading';\n envConfig = envLoader.loadEnvironmentConfig();\n this.logDebug('Environment configuration loaded', {\n frontendServiceName: envConfig.frontendServiceName,\n apiBaseUrl: envConfig.apiBaseUrl,\n appName: envConfig.appName\n });\n } catch (error) {\n this.logger.error('Failed to load environment configuration', { error: error.message });\n throw new Error(`Environment configuration failed: ${error.message}`);\n }\n\n let appConfigFromBackend;\n let frontendProviderRegistry: FrontendProviderRegistryFrontendService | undefined;\n try {\n currentPhase = 'backend application configuration fetch';\n // Retry logic for config retrieval\n // Note: Keep this low to avoid long waits when backend is down\n // HTTP client also has its own retry logic (3 attempts by default)\n const CONFIG_RETRY_ATTEMPTS = 2; // Reduced from 10 to avoid long waits\n const CONFIG_BASE_DELAY_MS = 2000; // 2 seconds between retries\n const CONFIG_MAX_DELAY_MS = 5000;\n\n let lastError: Error | null = null;\n for (let attempt = 1; attempt <= CONFIG_RETRY_ATTEMPTS; attempt++) {\n try {\n const bootstrapPayload = AppConfiguration_FrontendBootstrapResponse_Schema.parse(\n await manualCallsClient.getApplicationConfig(envConfig.frontendServiceName),\n );\n frontendProviderRegistry = createFrontendProviderRegistryFrontendService({\n entries: bootstrapPayload.frontendProviders,\n modules: options.frontendProviderModules,\n // Hydration diagnostics are WARNINGS, never failures. Every one of\n // them names a provider that is declared but cannot fully run, and\n // an application must still start: the alternative is a blank page\n // because an analytics provider's config was renamed.\n onDiagnostic: (diagnostic) => {\n this.logger?.warn('Frontend provider hydration diagnostic', {\n kind: diagnostic.kind,\n providerRef: diagnostic.providerRef,\n message: diagnostic.message,\n });\n },\n });\n appConfigFromBackend = AppConfiguration_Shared_Schema.parse(bootstrapPayload);\n break; // Success, exit retry loop\n } catch (error) {\n lastError = error instanceof Error ? error : new Error(String(error));\n\n if (attempt < CONFIG_RETRY_ATTEMPTS) {\n const delay = Math.min(\n CONFIG_BASE_DELAY_MS * Math.pow(2, attempt - 1),\n CONFIG_MAX_DELAY_MS\n );\n this.logDebug(`Config fetch attempt ${attempt}/${CONFIG_RETRY_ATTEMPTS} failed, retrying after ${delay}ms`, {\n error: lastError.message,\n attempt,\n totalAttempts: CONFIG_RETRY_ATTEMPTS\n });\n await new Promise(resolve => setTimeout(resolve, delay));\n } else {\n this.logger.error(`All ${CONFIG_RETRY_ATTEMPTS} config fetch attempts failed`, {\n error: lastError.message,\n totalAttempts: CONFIG_RETRY_ATTEMPTS\n });\n throw lastError;\n }\n }\n }\n\n // Apply the application's client-install identification policy as soon as the config that\n // carries it is available (Fork D / SD9). Until this line runs, the store is fail-closed —\n // nothing is minted, stored, or sent — so bootstrap traffic before this point (including the\n // config fetch itself) never carries a client-install id. Applying `DISABLED` is NOT a no-op:\n // it purges any id a previously-enabled policy left on the device.\n configureClientInstanceIdPolicy(appConfigFromBackend.compliance.clientInstanceIdScope);\n\n this.logDebug('Application configuration fetched successfully', {\n hasAppIdentity: !!appConfigFromBackend.appIdentity,\n hasAppPreferences: !!appConfigFromBackend.appPreferences,\n hasRuntime: !!appConfigFromBackend.runtime,\n endpointsCount: Object.keys(appConfigFromBackend.runtime?.endPoints || {}).length\n });\n\n this.logDebug!('Application configuration loaded from backend', {\n appName: appConfigFromBackend.appIdentity?.appName,\n version: appConfigFromBackend.appIdentity?.version,\n hasAuth: !!appConfigFromBackend.auth,\n hasSocialOAuth2Providers:\n !!appConfigFromBackend.auth?.socialOAuth2Providers\n && Object.keys(appConfigFromBackend.auth.socialOAuth2Providers).length > 0,\n defaultLanguage: appConfigFromBackend.appPreferences?.languages?.defaultLanguage,\n enabledLanguages: appConfigFromBackend.appPreferences?.languages?.enabledLanguages,\n endpointsList: Object.keys(appConfigFromBackend.runtime?.endPoints || {}),\n frontendProvidersCount: frontendProviderRegistry?.listAll().length ?? 0,\n });\n\n\n } catch (error) {\n this.logger.error('Failed to fetch application configuration from backend', {\n error: error.message,\n frontendServiceName: envConfig?.frontendServiceName,\n apiBaseUrl: config.apiBaseUrl\n });\n throw new Error(`Application configuration fetch failed: ${error.message}`);\n }\n\n // Resolve frontend configuration from app-provided base + overrides\n // Frontend config is owned entirely by the frontend — not sent from backend\n currentPhase = 'frontend configuration validation';\n let resolvedFrontendConfig: AppConfiguration_Frontend = {\n ...options.baseFrontendConfig,\n };\n this.logDebug('Using app-provided base frontend configuration');\n\n if (options.frontendConfigOverrides) {\n resolvedFrontendConfig = applyFrontendConfigOverrides(\n resolvedFrontendConfig,\n options.frontendConfigOverrides,\n );\n this.logDebug('Applied frontend config overrides', { sections: Object.keys(options.frontendConfigOverrides) });\n }\n\n resolvedFrontendConfig = AppConfiguration_Frontend_Schema.parse(resolvedFrontendConfig);\n\n this.logDebug!('Frontend configuration resolved', {\n frontendServiceName: envConfig.frontendServiceName,\n finalConfig: {\n hasNavigationLayout: !!resolvedFrontendConfig.navigationLayout,\n hasAppComponentsConfiguration: !!resolvedFrontendConfig.appComponentsConfiguration,\n hasDesignSystem: !!resolvedFrontendConfig.designSystemConfiguration,\n hasTypography: !!resolvedFrontendConfig.designSystemConfiguration?.typography,\n }\n });\n\n // Initialize resources repository\n currentPhase = 'frontend resource registry initialization';\n this.logDebug('Initializing resources repository...');\n const resourceRepository = new ResourcesRepositoryFrontendService(httpClient);\n await resourceRepository.initializeResources(\n customShared_ResourcesConfigurationsFactoryMap,\n customShared_ResourceFieldIdentifier,\n customShared_ResourcesRelationships,\n options.excludedResourceTypes,\n options.resourceUIBehavior,\n options.notificationBadgeDefinitions,\n );\n const resourcesRegistry = resourceRepository.getResourcesRegistry();\n\n // Initialize frontend component presets (app-provided registration)\n currentPhase = 'component preset registration';\n await componentLoader();\n\n // DEV-mode: verify launcher/view declarations only after component\n // registration so custom component refs can be checked deterministically.\n if (envLoader.isDevelopment()) {\n currentPhase = 'development launcher verification';\n const verificationResult = verifyLauncherContent(\n resourcesRegistry,\n resolvedFrontendConfig,\n (componentRef: string) => ComponentRegistryService.hasComponentType(componentRef as any),\n );\n reportLauncherVerificationResults(verificationResult);\n\n // Settings Hub: catch duplicate section refs (and sibling structural\n // gaps) before they silently double-render the content panel. Verifies\n // the SAME resolved config the SettingsHub component renders.\n // Resolve the application's OWN authored rail — there is no framework\n // default to fall back to, so a missing `settingsHub` verifies as an\n // empty hub rather than as the engine's arrangement.\n reportSettingsHubVerificationResults(\n verifySettingsHubContent(\n resolveSettingsHubConfig(resolvedFrontendConfig?.settingsHub),\n findUnknownDestinationRefs(resolvedFrontendConfig?.settingsHub),\n ),\n );\n\n if (options.featureConfiguration) {\n const featureReferenceVerification = verifyFrontendFeatureReferences({\n resourcesRegistry,\n appConfig: resolvedFrontendConfig,\n featureConfiguration: options.featureConfiguration,\n // Same predicate the launcher verification uses, and available here for the same\n // reason: this block runs AFTER `componentLoader()`, so a CUSTOM feature's\n // `customComponentRef` can be checked against real registrations.\n isComponentRegistered: (componentRef: string) => ComponentRegistryService.hasComponentType(componentRef as any),\n });\n\n if (!featureReferenceVerification.isValid) {\n this.logger.warn(\n `Invalid frontend feature references detected:\\n${featureReferenceVerification.warnings\n .map(warning => ` ⚠ ${warning}`)\n .join('\\n')}`,\n );\n }\n }\n }\n\n // Preload resources if specified\n if (preloadResources.length > 0) {\n currentPhase = 'resource preload';\n await this.preloadResources(preloadResources);\n }\n\n // Load and start every declared provider's SDK. AFTER the registry is\n // composed, because the registry is what decides which providers are live\n // for this service, and BEFORE the services object is handed out, so a\n // consumer never observes a half-activated surface. One provider's\n // failure never stops another's, and none of them can fail startup.\n currentPhase = 'frontend provider SDK activation';\n const resolvedProviderRegistry =\n frontendProviderRegistry ?? createFrontendProviderRegistryFrontendService();\n const frontendProviderSdks = await activateFrontendProviderSdks({\n surface: AppFrontendType.SAAS_APP,\n modules: resolvedProviderRegistry.listAll(),\n onDiagnostic: (diagnostic) => {\n this.logger?.warn('Frontend provider SDK activation diagnostic', {\n kind: diagnostic.kind,\n providerRef: diagnostic.providerRef,\n message: diagnostic.message,\n });\n },\n });\n\n /*\n * Subscribe the live error-monitoring providers to the crash bus, IMMEDIATELY\n * after activation and from the same hydrated modules (#437).\n *\n * Here rather than in a React component because it must survive the one\n * situation a component cannot: a tree unmounting because it crashed. And after\n * activation rather than before, because a sink only exists once its SDK has\n * started — subscribing earlier would install a bridge with nothing behind it\n * and silently drop every crash in the window.\n *\n * Deliberately NOT retained for teardown: the bus, like the activated SDKs,\n * lives as long as the application does, and an unsubscribe reachable from\n * application code is a way for crash reporting to be switched off by accident.\n */\n currentPhase = 'frontend error-monitoring bridge';\n createFrontendErrorMonitoringBridge({\n modules: resolvedProviderRegistry.listAll(),\n activations: frontendProviderSdks.activations,\n onDiagnostic: (diagnostic) => {\n this.logger?.warn('Frontend error-monitoring bridge diagnostic', {\n kind: diagnostic.kind,\n providerRef: diagnostic.providerRef,\n message: diagnostic.message,\n });\n },\n });\n\n // Registered from the SAME hydrated modules the SDKs activate from, so a\n // provider that is not live for this service contributes no component\n // either. Nothing is loaded here: a loader runs when a surface asks.\n const onProviderComponentDiagnostic = (diagnostic: ProviderComponentDiagnostic): void => {\n this.logger?.warn('Provider component diagnostic', {\n kind: diagnostic.kind,\n capability: diagnostic.capability,\n providerRef: diagnostic.providerRef,\n message: diagnostic.message,\n });\n };\n const providerComponentRegistry = createProviderComponentRegistry({\n // Each declaration is joined to its loader here: the module's own when it\n // carries one, else the one the facet library contributed at startup\n // (`registerDefaultPresets` → `registerProviderComponents`). A declaration\n // nothing can load is reported and left out, so the chooser offers only\n // what can render.\n registrations: collectProviderComponentRegistrations(resolvedProviderRegistry.listAll(), {\n onDiagnostic: onProviderComponentDiagnostic,\n }),\n onDiagnostic: onProviderComponentDiagnostic,\n });\n\n const services: ApplicationServices = {\n logger: this.logger,\n httpClient,\n resourceRepository,\n resourcesRegistry,\n appConfigFromBackend,\n frontendProviderRegistry: resolvedProviderRegistry,\n frontendProviderSdks,\n providerComponentRegistry,\n frontendConfiguration: resolvedFrontendConfig,\n };\n\n this.logger.info('Application initialization completed successfully');\n\n return services;\n\n } catch (error) {\n const initializationFailure = normalizeInitializationFailure(error, {\n phase: currentPhase,\n apiBaseUrl: config.apiBaseUrl,\n frontendServiceName: envConfig?.frontendServiceName,\n });\n\n if (this.logger) {\n this.logger.error('Application initialization failed', {\n error: initializationFailure.message,\n stack: initializationFailure.stack,\n phase: currentPhase,\n apiBaseUrl: config.apiBaseUrl,\n frontendServiceName: envConfig?.frontendServiceName,\n initializationDiagnostics: initializationFailure.initializationDiagnostics,\n });\n } else {\n console.error('Application initialization failed:', initializationFailure);\n }\n\n if (onError) {\n onError(initializationFailure);\n }\n\n throw initializationFailure;\n }\n }\n\n /**\n * Get the initialized services\n */\n getServices(): ApplicationServices | null {\n return this.services;\n }\n\n /**\n * Check if the application is initialized\n */\n isApplicationInitialized(): boolean {\n return this.isInitialized;\n }\n\n /**\n * Reset the initialization state (useful for testing)\n */\n reset(): void {\n this.services = null;\n this.isInitialized = false;\n this.initializationPromise = null;\n // Don't reset logger - keep singleton principle\n }\n\n\n\n /**\n * Preload specified resources\n */\n private async preloadResources(resources: string[]): Promise<void> {\n if (!this.logger) return;\n\n this.logger.info('Preloading resources...', { resourceCount: resources.length });\n\n try {\n // TODO: Implement resource preloading logic\n // This could involve fetching commonly used data, warming caches, etc.\n\n await Promise.all(resources.map(async (resource) => {\n this.logger!.debug(`Preloading resource: ${resource}`);\n // Implement specific preloading logic per resource type\n }));\n\n this.logger.info('Resource preloading completed successfully');\n } catch (error) {\n this.logger.warn('Resource preloading failed', { error: error.message });\n // Don't throw here - preloading failure shouldn't prevent app startup\n }\n }\n}\n\n/**\n * Global instance of the start application service\n */\n// Persist singleton across HMR/dev to avoid double initialization\nconst __globalAny: any = (typeof globalThis !== 'undefined' ? (globalThis as any) : (window as any));\nif (!__globalAny.__START_APPLICATION_FRONTEND_SERVICE__) {\n __globalAny.__START_APPLICATION_FRONTEND_SERVICE__ = new StartApplicationFrontendService();\n}\nexport const startApplicationService = __globalAny.__START_APPLICATION_FRONTEND_SERVICE__ as StartApplicationFrontendService;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"UserOrgsContext.d.ts","sourceRoot":"","sources":["../../../../src/core/security/UserOrgsContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAA2B,SAAS,EAA2C,MAAM,OAAO,CAAC;AAC3G,OAAO,EACL,WAAW,EACX,mBAAmB,EAMnB,6BAA6B,EAC7B,WAAW,EAGZ,MAAM,uBAAuB,CAAC;AAK/B,OAAO,EACL,oBAAoB,EACrB,MA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AAU,CAAC,OAAO,cAAc,CAAC,CAAC,qBAAqB,CAAC,CAAC;IAC9E,sBAAsB,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,wBAAwB,CAAC,CAAC;IAGpF,IAAI,EAAE,WAAW,GAAG,IAAI,CAAC;IAGzB,aAAa,EAAE,mBAAmB,EAAE,CAAC;IACrC,qBAAqB,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,WAAW,EAAE,oBAAoB,GAAG,IAAI,CAAC;IACzC,wBAAwB,EAAE,6BAA6B,GAAG,IAAI,CAAC;IAG/D,OAAO,EAAE,WAAW,GAAG,IAAI,CAAC;IAG5B,sBAAsB,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,IAAI,CAAC;IACzD,sBAAsB,EAAE,MAAM,mBAAmB,GAAG,IAAI,CAAC;IACzD,oBAAoB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAG1C,UAAU,EAAE,MAAM,WAAW,GAAG,IAAI,CAAC;CACtC;AAED;;;;GAIG;AACH,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,OAAO,CAAC,mBAAmB,GAAG,SAAS,CAA6D,CAAC;AAEzI,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,CA+wB9D,CAAC"}
@@ -186,10 +186,66 @@ export const UserOrgsProvider = ({ children }) => {
186
186
  return { organizationsList, selectedOrgId: null };
187
187
  }
188
188
  const organizationsOperationPath = ResourcesConfig_OperationPathUtils.buildOperationPathKeyFromOperation(orgsReadOp);
189
+ /**
190
+ * The tenant's preference record is fetched SEPARATELY, and that is a decision rather than an
191
+ * omission (#563).
192
+ *
193
+ * `OrganizationContextSchema` declares `preferences`, and `doOperation<OrganizationContext>`
194
+ * is a CAST — nothing validates the response against it — so the field read as available
195
+ * while no producer existed: the ORGANIZATIONS **default** READ returns a plain
196
+ * `Organization`, and the organisation's regional block therefore never reached
197
+ * `I18nContext`. Every date and number in every generated application formatted at the
198
+ * framework floor as a result.
199
+ *
200
+ * The rejected alternative was to switch this call to the ORGANIZATIONS **context** variant,
201
+ * which does populate the child. Measured against the running stack on 2026-09-10, that
202
+ * response carries every context-enabled child of an organisation — `auditLogs`, `todos`,
203
+ * `tasks`, `knowledgeDocuments`, `organizationMembers`, … — so session restore would pull an
204
+ * unbounded page of tenant data per membership to obtain four regional fields. The
205
+ * preference record has its own default READ (`GET /organizations/{id}/organization-preference`,
206
+ * reachable by an ordinary `ORG_MEMBER`), which is one small request with a stable shape.
207
+ *
208
+ * Best-effort by construction: a tenant whose preferences cannot be read still yields a
209
+ * usable organisation, and `organizationPreferencesPayload(undefined)` then contributes
210
+ * nothing to the i18n event rather than clearing the member's own settings.
211
+ */
212
+ const organizationPreferencesConfig = registry.resourceConfigurations[CoreResourceType.ORGANIZATION_PREFERENCES];
213
+ const organizationPreferencesReadOp = organizationPreferencesConfig?.operations?.find((op) => op.operationIdentifier === CoreResourceOperation.READ &&
214
+ op.isOperationDefault === true &&
215
+ op.isBulkOperation !== true &&
216
+ (op.variantType === ResourceOperationVariantType.API_CALL ||
217
+ op.variantType === ResourceOperationVariantType.API_CALL_WITH_CALLBACK));
218
+ if (!organizationPreferencesReadOp) {
219
+ logger.warn('ORGANIZATION_PREFERENCES READ operation not found — tenant regional defaults will not be applied');
220
+ }
221
+ const organizationPreferencesOperationPath = organizationPreferencesReadOp
222
+ ? ResourcesConfig_OperationPathUtils.buildOperationPathKeyFromOperation(organizationPreferencesReadOp)
223
+ : null;
224
+ const fetchOrganizationPreferences = async (organizationId) => {
225
+ if (!organizationPreferencesOperationPath)
226
+ return undefined;
227
+ try {
228
+ return await doOperation(organizationPreferencesOperationPath, { contextualParameters: { organizationId } }) ?? undefined;
229
+ }
230
+ catch (error) {
231
+ logger.warn('Failed to fetch organization preferences', { organizationId, error });
232
+ return undefined;
233
+ }
234
+ };
189
235
  const orgPromises = memberships.map(async (membership) => {
190
236
  try {
191
- const org = await doOperation(organizationsOperationPath, { contextualParameters: { organizationId: membership.organizationId } });
192
- return org;
237
+ const [org, preferences] = await Promise.all([
238
+ doOperation(organizationsOperationPath, { contextualParameters: { organizationId: membership.organizationId } }),
239
+ fetchOrganizationPreferences(membership.organizationId),
240
+ ]);
241
+ if (!org)
242
+ return null;
243
+ // OMIT the key when the read failed rather than attaching `null`. The payload builder
244
+ // reads the two differently: `undefined`/absent contributes nothing to the i18n event,
245
+ // while `null` means "the tenant has cleared its preferences" and actively resets the
246
+ // organisation half — which would silently downgrade a member to the framework floor
247
+ // because one request failed.
248
+ return preferences ? { ...org, preferences } : org;
193
249
  }
194
250
  catch (error) {
195
251
  logger.warn('Failed to fetch organization', { organizationId: membership.organizationId, error });
@@ -276,7 +332,7 @@ export const UserOrgsProvider = ({ children }) => {
276
332
  const { organizationsList, selectedOrgId } = await loadOrganizations(userContext);
277
333
  // Store preferences after organization loading so i18n receives user and
278
334
  // active-organization language policy in the same event.
279
- const preferences = userContext.userSelfPreference;
335
+ const preferences = userContext.userSelfPreferences;
280
336
  if (preferences) {
281
337
  const currentOrganization = selectedOrgId
282
338
  ? organizationsList.find((organization) => organization._id === selectedOrgId)
@@ -447,13 +503,13 @@ export const UserOrgsProvider = ({ children }) => {
447
503
  await loadOrganizations(user);
448
504
  }, [user, loadOrganizations]);
449
505
  useEffect(() => {
450
- if (!user?.userSelfPreference) {
506
+ if (!user?.userSelfPreferences) {
451
507
  return;
452
508
  }
453
509
  const currentOrganization = currentOrganizationId
454
510
  ? organizations.find((organization) => organization._id === currentOrganizationId)
455
511
  : null;
456
- emitPreferencesChanged(user.userSelfPreference, currentOrganization?.preferences);
512
+ emitPreferencesChanged(user.userSelfPreferences, currentOrganization?.preferences);
457
513
  }, [currentOrganizationId, emitPreferencesChanged, organizations, user]);
458
514
  /**
459
515
  * Set the current active organization