## Infrastructure Services: Knowledge, AI, Billing, Storage, Epub Overview: Core infra services for semantic search, EPUB processing, storage, billing and platform integration. This document highlights interfaces, implementations, caching behavior and configuration (AiSettings, StripeSettings). === DIAGRAM 1: Dependency and Model Map (dependency-map) === ```mermaid --- config: flowchart: defaultRenderer: "elk" --- flowchart TD flow_file_nexusreader_infrastructure_helpers_contenthasher_cs_file_1["ContentHasher"] flow_file_nexusreader_infrastructure_helpers_jsonrepairhelper_cs_file_1["JsonRepairHelper"] flow_file_nexusreader_infrastructure_services_billingservice_cs_file_1["BillingService"] flow_file_nexusreader_infrastructure_services_bookstorageservice_cs_file_1["BookStorageService"] flow_file_nexusreader_infrastructure_services_epubreaderservice_cs_file_1["EpubReaderService"] flow_file_nexusreader_infrastructure_services_knowledgeservice_cs_file_1["KnowledgeService"] flow_file_nexusreader_web_client_program_cs_file_1["Program.cs"] flow_file_nexusreader_infrastructure_identity_tokenlimithandler_cs_file_1["TokenLimitHandler"] flow_file_nexusreader_infrastructure_identity_tokenlimitrequirement_cs_file_1["TokenLimitRequirement"] flow_file_nexusreader_infrastructure_persistence_ebookrepository_cs_file_1["EbookRepository"] flow_file_nexusreader_web_client_handlers_authenticationheaderhandler_cs_file_1["AuthenticationHeaderHandler"] flow_type_nexusreader_infrastructure_identity_tokenlimitrequirement_cs_tokenlimitrequirement_8[/"TokenLimitRequirement"/] flow_type_nexusreader_infrastructure_persistence_ebookrepository_cs_ebookrepository_12[/"EbookRepository"/] flow_type_nexusreader_infrastructure_services_bookstorageservice_cs_bookstorageservice_10[/"BookStorageService"/] flow_type_nexusreader_web_client_handlers_authenticationheaderhandler_cs_authenticationheaderhandler_14[/"AuthenticationHeaderHandler"/] flow_type_nexusreader_web_client_program_cs_throwingbookstorageservice_74[/"ThrowingBookStorageService"/] flow_type_nexusreader_web_client_program_cs_throwingdbcontextfactory_61[/"ThrowingDbContextFactory"/] flow_type_nexusreader_web_client_program_cs_throwingebookrepository_84[/"ThrowingEbookRepository"/] flow_type_nexusreader_web_client_program_cs_throwingembeddinggenerator_66[/"ThrowingEmbeddingGenerator"/] flow_type_nexusreader_web_client_program_cs_throwingsyncbroadcaster_94[/"ThrowingSyncBroadcaster"/] flow_file_nexusreader_infrastructure_identity_tokenlimitrequirement_cs_file_1 -->|model TokenLimitRequirement| flow_type_nexusreader_infrastructure_identity_tokenlimitrequirement_cs_tokenlimitrequirement_8 flow_file_nexusreader_infrastructure_persistence_ebookrepository_cs_file_1 -->|model EbookRepository| flow_type_nexusreader_infrastructure_persistence_ebookrepository_cs_ebookrepository_12 flow_file_nexusreader_infrastructure_services_bookstorageservice_cs_file_1 -->|model BookStorageService| flow_type_nexusreader_infrastructure_services_bookstorageservice_cs_bookstorageservice_10 flow_file_nexusreader_web_client_handlers_authenticationheaderhandler_cs_file_1 -->|model AuthenticationHeaderHandler| flow_type_nexusreader_web_client_handlers_authenticationheaderhandler_cs_authenticationheaderhandler_14 flow_file_nexusreader_web_client_program_cs_file_1 -->|model ThrowingBookStorageService| flow_type_nexusreader_web_client_program_cs_throwingbookstorageservice_74 flow_file_nexusreader_web_client_program_cs_file_1 -->|model ThrowingDbContextFactory| flow_type_nexusreader_web_client_program_cs_throwingdbcontextfactory_61 flow_file_nexusreader_web_client_program_cs_file_1 -->|model ThrowingEbookRepository| flow_type_nexusreader_web_client_program_cs_throwingebookrepository_84 flow_file_nexusreader_web_client_program_cs_file_1 -->|model ThrowingEmbeddingGenerator| flow_type_nexusreader_web_client_program_cs_throwingembeddinggenerator_66 flow_file_nexusreader_web_client_program_cs_file_1 -->|model ThrowingSyncBroadcaster| flow_type_nexusreader_web_client_program_cs_throwingsyncbroadcaster_94 click flow_file_nexusreader_infrastructure_identity_tokenlimithandler_cs_file_1 href "vscode://file/NexusReader.Infrastructure/Identity/TokenLimitHandler.cs:1:1" "Open source" click flow_file_nexusreader_infrastructure_identity_tokenlimitrequirement_cs_file_1 href "vscode://file/NexusReader.Infrastructure/Identity/TokenLimitRequirement.cs:1:1" "Open source" click flow_type_nexusreader_infrastructure_identity_tokenlimitrequirement_cs_tokenlimitrequirement_8 href "vscode://file/NexusReader.Infrastructure/Identity/TokenLimitRequirement.cs:8:1" "Open source" click flow_file_nexusreader_infrastructure_persistence_ebookrepository_cs_file_1 href "vscode://file/NexusReader.Infrastructure/Persistence/EbookRepository.cs:1:1" "Open source" click flow_type_nexusreader_infrastructure_persistence_ebookrepository_cs_ebookrepository_12 href "vscode://file/NexusReader.Infrastructure/Persistence/EbookRepository.cs:12:1" "Open source" click flow_file_nexusreader_infrastructure_services_billingservice_cs_file_1 href "vscode://file/NexusReader.Infrastructure/Services/BillingService.cs:1:1" "Open source" click flow_file_nexusreader_infrastructure_services_bookstorageservice_cs_file_1 href "vscode://file/NexusReader.Infrastructure/Services/BookStorageService.cs:1:1" "Open source" click flow_type_nexusreader_infrastructure_services_bookstorageservice_cs_bookstorageservice_10 href "vscode://file/NexusReader.Infrastructure/Services/BookStorageService.cs:10:1" "Open source" click flow_file_nexusreader_infrastructure_services_epubreaderservice_cs_file_1 href "vscode://file/NexusReader.Infrastructure/Services/EpubReaderService.cs:1:1" "Open source" click flow_file_nexusreader_infrastructure_services_knowledgeservice_cs_file_1 href "vscode://file/NexusReader.Infrastructure/Services/KnowledgeService.cs:1:1" "Open source" click flow_file_nexusreader_infrastructure_helpers_contenthasher_cs_file_1 href "vscode://file/NexusReader.Infrastructure/Helpers/ContentHasher.cs:1:1" "Open source" click flow_file_nexusreader_infrastructure_helpers_jsonrepairhelper_cs_file_1 href "vscode://file/NexusReader.Infrastructure/Helpers/JsonRepairHelper.cs:1:1" "Open source" click flow_file_nexusreader_web_client_handlers_authenticationheaderhandler_cs_file_1 href "vscode://file/NexusReader.Web.Client/Handlers/AuthenticationHeaderHandler.cs:1:1" "Open source" click flow_type_nexusreader_web_client_handlers_authenticationheaderhandler_cs_authenticationheaderhandler_14 href "vscode://file/NexusReader.Web.Client/Handlers/AuthenticationHeaderHandler.cs:14:1" "Open source" click flow_file_nexusreader_web_client_program_cs_file_1 href "vscode://file/NexusReader.Web.Client/Program.cs:1:1" "Open source" click flow_type_nexusreader_web_client_program_cs_throwingdbcontextfactory_61 href "vscode://file/NexusReader.Web.Client/Program.cs:61:1" "Open source" click flow_type_nexusreader_web_client_program_cs_throwingembeddinggenerator_66 href "vscode://file/NexusReader.Web.Client/Program.cs:66:1" "Open source" click flow_type_nexusreader_web_client_program_cs_throwingbookstorageservice_74 href "vscode://file/NexusReader.Web.Client/Program.cs:74:1" "Open source" click flow_type_nexusreader_web_client_program_cs_throwingebookrepository_84 href "vscode://file/NexusReader.Web.Client/Program.cs:84:1" "Open source" click flow_type_nexusreader_web_client_program_cs_throwingsyncbroadcaster_94 href "vscode://file/NexusReader.Web.Client/Program.cs:94:1" "Open source" ``` This shows file-level dependencies and models across Infrastructure and Web.Client, highlighting KnowledgeService, EpubReaderService, BookStorageService and BillingService. Clickable nodes reference source files for quick inspection. === DIAGRAM 2: Startup and Service Registration Flow (primary-runtime) === ```mermaid --- config: flowchart: defaultRenderer: "elk" --- flowchart TD subgraph flow_1_nexusreader_web_client_program_cs["Program.cs"] end subgraph flow_0_nexusreader_web_program_cs["Program.cs"] end flow_file_nexusreader_web_client_program_cs_file_1["Program.cs"] flow_file_nexusreader_web_program_cs_file_1["Program.cs"] flow_method_nexusreader_web_client_program_cs_findauthorbynameasync_88["FindAuthorByNameAsync"] flow_method_nexusreader_web_client_program_cs_getservice_71["GetService"] flow_method_nexusreader_web_client_program_cs_program_top_level_startup_15["Program (top-level startup)"] flow_method_nexusreader_web_client_program_cs_run_wasm_host_59["Run WASM Host"] flow_action_nexusreader_web_client_program_cs_findauthorbynameasync_repository_read_88_88["Reads repository or persistence state"] flow_file_nexusreader_infrastructure_configuration_aisettings_cs_file_1["AiSettings"] flow_file_nexusreader_infrastructure_configuration_stripesettings_cs_file_1["StripeSettings"] flow_type_nexusreader_infrastructure_configuration_aisettings_cs_aisettings_3[/"AiSettings"/] flow_type_nexusreader_infrastructure_configuration_stripesettings_cs_stripesettings_3[/"StripeSettings"/] flow_type_nexusreader_web_client_program_cs_configured_httpclient_40[/"configured HttpClient"/] flow_type_nexusreader_web_client_program_cs_n_a_55[/"N/A"/] flow_type_nexusreader_web_client_program_cs_nexusauthenticationstateprovider_33[/"NexusAuthenticationStateProvider"/] flow_type_nexusreader_web_client_program_cs_throwingbookstorageservice_74[/"ThrowingBookStorageService"/] flow_type_nexusreader_web_client_program_cs_throwingdbcontextfactory_61[/"ThrowingDbContextFactory"/] flow_type_nexusreader_web_client_program_cs_throwingebookrepository_84[/"ThrowingEbookRepository"/] flow_type_nexusreader_web_client_program_cs_throwingembeddinggenerator_66[/"ThrowingEmbeddingGenerator"/] flow_type_nexusreader_web_client_program_cs_throwingsyncbroadcaster_94[/"ThrowingSyncBroadcaster"/] flow_type_nexusreader_web_client_program_cs_wasmepubreader_56[/"WasmEpubReader"/] flow_type_nexusreader_web_client_program_cs_wasmknowledgeservice_38[/"WasmKnowledgeService"/] flow_type_nexusreader_web_client_program_cs_webplatformservice_18[/"WebPlatformService"/] flow_action_nexusreader_web_client_program_cs_getservice_return_71_71(["returns null"]) flow_file_nexusreader_web_client_program_cs_file_1 -->|unknown| flow_method_nexusreader_web_client_program_cs_run_wasm_host_59 flow_file_nexusreader_web_client_program_cs_file_1 -->|uses| flow_type_nexusreader_web_client_program_cs_configured_httpclient_40 flow_file_nexusreader_web_client_program_cs_file_1 -->|application services via extension| flow_type_nexusreader_web_client_program_cs_n_a_55 flow_file_nexusreader_web_client_program_cs_file_1 -->|NexusAuthenticationStateProvider| flow_type_nexusreader_web_client_program_cs_nexusauthenticationstateprovider_33 flow_file_nexusreader_web_client_program_cs_file_1 -->|IDbContextFactory AppDbContext>| flow_type_nexusreader_web_client_program_cs_throwingdbcontextfactory_49 flow_file_nexusreader_web_client_program_cs_file_1 -->|IEpubReader| flow_type_nexusreader_web_client_program_cs_wasmepubreader_56 flow_file_nexusreader_web_client_program_cs_file_1 -->|IKnowledgeService| flow_type_nexusreader_web_client_program_cs_wasmknowledgeservice_38 flow_file_nexusreader_web_client_program_cs_file_1 -->|IPlatformService| flow_type_nexusreader_web_client_program_cs_webplatformservice_18 click flow_file_nexusreader_web_client_program_cs_file_1 href "vscode://file/NexusReader.Web.Client/Program.cs:1:1" "Open source" click flow_method_nexusreader_web_client_program_cs_program_top_level_startup_15 href "vscode://file/NexusReader.Web.Client/Program.cs:15:1" "Open source" click flow_method_nexusreader_web_client_program_cs_getservice_71 href "vscode://file/NexusReader.Web.Client/Program.cs:71:1" "Open source" click flow_action_nexusreader_web_client_program_cs_getservice_return_71_71 href "vscode://file/NexusReader.Web.Client/Program.cs:71:1" "Open source" click flow_method_nexusreader_web_client_program_cs_findauthorbynameasync_88 href "vscode://file/NexusReader.Web.Client/Program.cs:88:1" "Open source" click flow_action_nexusreader_web_client_program_cs_findauthorbynameasync_repository_read_88_88 href "vscode://file/NexusReader.Web.Client/Program.cs:88:1" "Open source" click flow_type_nexusreader_web_client_program_cs_throwingdbcontextfactory_61 href "vscode://file/NexusReader.Web.Client/Program.cs:61:1" "Open source" click flow_type_nexusreader_web_client_program_cs_throwingembeddinggenerator_66 href "vscode://file/NexusReader.Web.Client/Program.cs:66:1" "Open source" click flow_type_nexusreader_web_client_program_cs_throwingbookstorageservice_74 href "vscode://file/NexusReader.Web.Client/Program.cs:74:1" "Open source" click flow_type_nexusreader_web_client_program_cs_throwingebookrepository_84 href "vscode://file/NexusReader.Web.Client/Program.cs:84:1" "Open source" click flow_type_nexusreader_web_client_program_cs_throwingsyncbroadcaster_94 href "vscode://file/NexusReader.Web.Client/Program.cs:94:1" "Open source" click flow_type_nexusreader_web_client_program_cs_webplatformservice_18 href "vscode://file/NexusReader.Web.Client/Program.cs:18:1" "Open source" click flow_type_nexusreader_web_client_program_cs_nexusauthenticationstateprovider_33 href "vscode://file/NexusReader.Web.Client/Program.cs:33:1" "Open source" click flow_type_nexusreader_web_client_program_cs_wasmknowledgeservice_38 href "vscode://file/NexusReader.Web.Client/Program.cs:38:1" "Open source" click flow_type_nexusreader_web_client_program_cs_configured_httpclient_40 href "vscode://file/NexusReader.Web.Client/Program.cs:40:1" "Open source" click flow_type_nexusreader_web_client_program_cs_throwingdbcontextfactory_49 href "vscode://file/NexusReader.Web.Client/Program.cs:49:1" "Open source" click flow_type_nexusreader_web_client_program_cs_n_a_55 href "vscode://file/NexusReader.Web.Client/Program.cs:55:1" "Open source" click flow_type_nexusreader_web_client_program_cs_wasmepubreader_56 href "vscode://file/NexusReader.Web.Client/Program.cs:56:1" "Open source" click flow_method_nexusreader_web_client_program_cs_run_wasm_host_59 href "vscode://file/NexusReader.Web.Client/Program.cs:59:1" "Open source" click flow_file_nexusreader_infrastructure_configuration_aisettings_cs_file_1 href "vscode://file/NexusReader.Infrastructure/Configuration/AiSettings.cs:1:1" "Open source" click flow_type_nexusreader_infrastructure_configuration_aisettings_cs_aisettings_3 href "vscode://file/NexusReader.Infrastructure/Configuration/AiSettings.cs:3:1" "Open source" click flow_file_nexusreader_infrastructure_configuration_stripesettings_cs_file_1 href "vscode://file/NexusReader.Infrastructure/Configuration/StripeSettings.cs:1:1" "Open source" click flow_type_nexusreader_infrastructure_configuration_stripesettings_cs_stripesettings_3 href "vscode://file/NexusReader.Infrastructure/Configuration/StripeSettings.cs:3:1" "Open source" click flow_file_nexusreader_web_program_cs_file_1 href "vscode://file/NexusReader.Web/Program.cs:1:1" "Open source" ``` This diagram emphasizes startup wiring: AiSettings/StripeSettings are loaded and WASM client services (WasmEpubReader, WasmKnowledgeService) are registered. It maps DI tokens (IEpubReader, IKnowledgeService, IPlatformService) to concrete platform implementations. === DIAGRAM 3: Program.cs Flow (primary-runtime) === ```mermaid --- config: flowchart: defaultRenderer: "elk" --- flowchart TD subgraph flow_1_nexusreader_web_client_program_cs["Program.cs"] end subgraph flow_0_nexusreader_web_program_cs["Program.cs"] end flow_file_nexusreader_web_client_program_cs_file_1["Program.cs"] flow_file_nexusreader_web_program_cs_file_1["Program.cs"] flow_method_nexusreader_web_client_program_cs_findauthorbynameasync_88["FindAuthorByNameAsync"] flow_method_nexusreader_web_client_program_cs_getservice_71["GetService"] flow_method_nexusreader_web_client_program_cs_program_top_level_startup_15["Program (top-level startup)"] flow_method_nexusreader_web_client_program_cs_run_wasm_host_59["Run WASM Host"] flow_action_nexusreader_web_client_program_cs_findauthorbynameasync_repository_read_88_88["Reads repository or persistence state"] flow_file_nexusreader_infrastructure_configuration_aisettings_cs_file_1["AiSettings"] flow_file_nexusreader_infrastructure_configuration_stripesettings_cs_file_1["StripeSettings"] flow_type_nexusreader_infrastructure_configuration_aisettings_cs_aisettings_3[/"AiSettings"/] flow_type_nexusreader_infrastructure_configuration_stripesettings_cs_stripesettings_3[/"StripeSettings"/] flow_type_nexusreader_web_client_program_cs_configured_httpclient_40[/"configured HttpClient"/] flow_type_nexusreader_web_client_program_cs_n_a_55[/"N/A"/] flow_type_nexusreader_web_client_program_cs_nexusauthenticationstateprovider_33[/"NexusAuthenticationStateProvider"/] flow_type_nexusreader_web_client_program_cs_throwingbookstorageservice_74[/"ThrowingBookStorageService"/] flow_type_nexusreader_web_client_program_cs_throwingdbcontextfactory_61[/"ThrowingDbContextFactory"/] flow_type_nexusreader_web_client_program_cs_throwingdbcontextfactory_61[/"ThrowingDbContextFactory"/] flow_type_nexusreader_web_client_program_cs_throwingebookrepository_84[/"ThrowingEbookRepository"/] flow_type_nexusreader_web_client_program_cs_throwingembeddinggenerator_66[/"ThrowingEmbeddingGenerator"/] flow_type_nexusreader_web_client_program_cs_throwingsyncbroadcaster_94[/"ThrowingSyncBroadcaster"/] flow_type_nexusreader_web_client_program_cs_wasmepubreader_56[/"WasmEpubReader"/] flow_type_nexusreader_web_client_program_cs_wasmknowledgeservice_38[/"WasmKnowledgeService"/] flow_type_nexusreader_web_client_program_cs_webplatformservice_18[/"WebPlatformService"/] flow_action_nexusreader_web_client_program_cs_getservice_return_71_71(["returns null"]) flow_file_nexusreader_infrastructure_configuration_aisettings_cs_file_1 -->|dto AiSettings| flow_type_nexusreader_infrastructure_configuration_aisettings_cs_aisettings_3 flow_file_nexusreader_infrastructure_configuration_stripesettings_cs_file_1 -->|dto StripeSettings| flow_type_nexusreader_infrastructure_configuration_stripesettings_cs_stripesettings_3 flow_file_nexusreader_web_client_program_cs_file_1 -->|FindAuthorByNameAsync| flow_method_nexusreader_web_client_program_cs_findauthorbynameasync_88 flow_file_nexusreader_web_client_program_cs_file_1 -->|GetService| flow_method_nexusreader_web_client_program_cs_getservice_71 flow_file_nexusreader_web_client_program_cs_file_1 -->|Program top-level startup| flow_method_nexusreader_web_client_program_cs_program_top_level_startup_15 flow_file_nexusreader_web_client_program_cs_file_1 -->|unknown| flow_method_nexusreader_web_client_program_cs_run_wasm_host_59 flow_file_nexusreader_web_client_program_cs_file_1 -->|uses| flow_type_nexusreader_web_client_program_cs_configured_httpclient_40 flow_file_nexusreader_web_client_program_cs_file_1 -->|application services via extension| flow_type_nexusreader_web_client_program_cs_n_a_55 flow_file_nexusreader_web_client_program_cs_file_1 -->|NexusAuthenticationStateProvider| flow_type_nexusreader_web_client_program_cs_nexusauthenticationstateprovider_33 flow_file_nexusreader_web_client_program_cs_file_1 -->|model ThrowingBookStorageService| flow_type_nexusreader_web_client_program_cs_throwingbookstorageservice_74 flow_file_nexusreader_web_client_program_cs_file_1 -->|IDbContextFactory AppDbContext>| flow_type_nexusreader_web_client_program_cs_throwingdbcontextfactory_49 flow_file_nexusreader_web_client_program_cs_file_1 -->|model ThrowingDbContextFactory| flow_type_nexusreader_web_client_program_cs_throwingdbcontextfactory_61 flow_file_nexusreader_web_client_program_cs_file_1 -->|model ThrowingEbookRepository| flow_type_nexusreader_web_client_program_cs_throwingebookrepository_84 flow_file_nexusreader_web_client_program_cs_file_1 -->|model ThrowingEmbeddingGenerator| flow_type_nexusreader_web_client_program_cs_throwingembeddinggenerator_66 flow_file_nexusreader_web_client_program_cs_file_1 -->|model ThrowingSyncBroadcaster| flow_type_nexusreader_web_client_program_cs_throwingsyncbroadcaster_94 flow_file_nexusreader_web_client_program_cs_file_1 -->|IEpubReader| flow_type_nexusreader_web_client_program_cs_wasmepubreader_56 flow_file_nexusreader_web_client_program_cs_file_1 -->|IKnowledgeService| flow_type_nexusreader_web_client_program_cs_wasmknowledgeservice_38 flow_file_nexusreader_web_client_program_cs_file_1 -->|IPlatformService| flow_type_nexusreader_web_client_program_cs_webplatformservice_18 flow_method_nexusreader_web_client_program_cs_findauthorbynameasync_88 -->|Reads repository or persistence state| flow_action_nexusreader_web_client_program_cs_findauthorbynameasync_repository_read_88_88 flow_method_nexusreader_web_client_program_cs_getservice_71 -->|returns null| flow_action_nexusreader_web_client_program_cs_getservice_return_71_71 click flow_file_nexusreader_web_client_program_cs_file_1 href "vscode://file/NexusReader.Web.Client/Program.cs:1:1" "Open source" click flow_method_nexusreader_web_client_program_cs_program_top_level_startup_15 href "vscode://file/NexusReader.Web.Client/Program.cs:15:1" "Open source" click flow_method_nexusreader_web_client_program_cs_getservice_71 href "vscode://file/NexusReader.Web.Client/Program.cs:71:1" "Open source" click flow_action_nexusreader_web_client_program_cs_getservice_return_71_71 href "vscode://file/NexusReader.Web.Client/Program.cs:71:1" "Open source" click flow_method_nexusreader_web_client_program_cs_findauthorbynameasync_88 href "vscode://file/NexusReader.Web.Client/Program.cs:88:1" "Open source" click flow_action_nexusreader_web_client_program_cs_findauthorbynameasync_repository_read_88_88 href "vscode://file/NexusReader.Web.Client/Program.cs:88:1" "Open source" click flow_type_nexusreader_web_client_program_cs_throwingdbcontextfactory_61 href "vscode://file/NexusReader.Web.Client/Program.cs:61:1" "Open source" click flow_type_nexusreader_web_client_program_cs_throwingembeddinggenerator_66 href "vscode://file/NexusReader.Web.Client/Program.cs:66:1" "Open source" click flow_type_nexusreader_web_client_program_cs_throwingbookstorageservice_74 href "vscode://file/NexusReader.Web.Client/Program.cs:74:1" "Open source" click flow_type_nexusreader_web_client_program_cs_throwingebookrepository_84 href "vscode://file/NexusReader.Web.Client/Program.cs:84:1" "Open source" click flow_type_nexusreader_web_client_program_cs_throwingsyncbroadcaster_94 href "vscode://file/NexusReader.Web.Client/Program.cs:94:1" "Open source" click flow_type_nexusreader_web_client_program_cs_webplatformservice_18 href "vscode://file/NexusReader.Web.Client/Program.cs:18:1" "Open source" click flow_type_nexusreader_web_client_program_cs_nexusauthenticationstateprovider_33 href "vscode://file/NexusReader.Web.Client/Program.cs:33:1" "Open source" click flow_type_nexusreader_web_client_program_cs_wasmknowledgeservice_38 href "vscode://file/NexusReader.Web.Client/Program.cs:38:1" "Open source" click flow_type_nexusreader_web_client_program_cs_configured_httpclient_40 href "vscode://file/NexusReader.Web.Client/Program.cs:40:1" "Open source" click flow_type_nexusreader_web_client_program_cs_throwingdbcontextfactory_49 href "vscode://file/NexusReader.Web.Client/Program.cs:49:1" "Open source" click flow_type_nexusreader_web_client_program_cs_n_a_55 href "vscode://file/NexusReader.Web.Client/Program.cs:55:1" "Open source" click flow_type_nexusreader_web_client_program_cs_wasmepubreader_56 href "vscode://file/NexusReader.Web.Client/Program.cs:56:1" "Open source" click flow_method_nexusreader_web_client_program_cs_run_wasm_host_59 href "vscode://file/NexusReader.Web.Client/Program.cs:59:1" "Open source" click flow_file_nexusreader_infrastructure_configuration_aisettings_cs_file_1 href "vscode://file/NexusReader.Infrastructure/Configuration/AiSettings.cs:1:1" "Open source" click flow_type_nexusreader_infrastructure_configuration_aisettings_cs_aisettings_3 href "vscode://file/NexusReader.Infrastructure/Configuration/AiSettings.cs:3:1" "Open source" click flow_file_nexusreader_infrastructure_configuration_stripesettings_cs_file_1 href "vscode://file/NexusReader.Infrastructure/Configuration/StripeSettings.cs:1:1" "Open source" click flow_type_nexusreader_infrastructure_configuration_stripesettings_cs_stripesettings_3 href "vscode://file/NexusReader.Infrastructure/Configuration/StripeSettings.cs:3:1" "Open source" click flow_file_nexusreader_web_program_cs_file_1 href "vscode://file/NexusReader.Web/Program.cs:1:1" "Open source" ``` This flow maps startup functions and method interactions (FindAuthorByNameAsync, GetService) to repository reads and DI results. It underlines where AiSettings/StripeSettings are consumed. === DIAGRAM 4: Program.cs Execution Control Flow (control-flow) === ```mermaid flowchart TD subgraph NexusReader_Web_Client_Program["Program"] end flow_file_nexusreader_web_client_program_cs_file_1["Program.cs"] flow_file_nexusreader_web_program_cs_file_1["Program.cs"] flow_method_nexusreader_web_client_program_cs_findauthorbynameasync_88["FindAuthorByNameAsync"] flow_method_nexusreader_web_client_program_cs_getservice_71["GetService"] flow_method_nexusreader_web_client_program_cs_program_top_level_startup_15["Program (top-level startup)"] flow_method_nexusreader_web_client_program_cs_run_wasm_host_59["Run WASM Host"] flow_action_nexusreader_web_client_program_cs_findauthorbynameasync_repository_read_88_88["Reads repository or persistence state"] flow_action_nexusreader_web_client_program_cs_getservice_return_71_71(["returns null"]) flow_method_nexusreader_web_client_program_cs_findauthorbynameasync_88 -->|Reads repository or persistence state| flow_action_nexusreader_web_client_program_cs_findauthorbynameasync_repository_read_88_88 flow_method_nexusreader_web_client_program_cs_getservice_71 -->|returns null| flow_action_nexusreader_web_client_program_cs_getservice_return_71_71 click flow_file_nexusreader_web_client_program_cs_file_1 href "vscode://file/NexusReader.Web.Client/Program.cs:1:1" "Open source" click flow_method_nexusreader_web_client_program_cs_program_top_level_startup_15 href "vscode://file/NexusReader.Web.Client/Program.cs:15:1" "Open source" click flow_method_nexusreader_web_client_program_cs_getservice_71 href "vscode://file/NexusReader.Web.Client/Program.cs:71:1" "Open source" click flow_action_nexusreader_web_client_program_cs_getservice_return_71_71 href "vscode://file/NexusReader.Web.Client/Program.cs:71:1" "Open source" click flow_method_nexusreader_web_client_program_cs_findauthorbynameasync_88 href "vscode://file/NexusReader.Web.Client/Program.cs:88:1" "Open source" click flow_action_nexusreader_web_client_program_cs_findauthorbynameasync_repository_read_88_88 href "vscode://file/NexusReader.Web.Client/Program.cs:88:1" "Open source" click flow_method_nexusreader_web_client_program_cs_run_wasm_host_59 href "vscode://file/NexusReader.Web.Client/Program.cs:59:1" "Open source" click flow_file_nexusreader_web_program_cs_file_1 href "vscode://file/NexusReader.Web/Program.cs:1:1" "Open source" ``` Control-flow view highlights runtime branches and repository read points for tracing execution during startup and WASM host runs. === DIAGRAM 5: Program.cs Contracts and Entities (class-diagram) === ```mermaid classDiagram class flow_file_nexusreader_web_client_program_cs_file_1["Program.cs"] class flow_file_nexusreader_web_program_cs_file_1["Program.cs"] class flow_file_nexusreader_infrastructure_configuration_aisettings_cs_file_1["AiSettings"] class flow_file_nexusreader_infrastructure_configuration_stripesettings_cs_file_1["StripeSettings"] class flow_type_nexusreader_infrastructure_configuration_aisettings_cs_aisettings_3["AiSettings"] class flow_type_nexusreader_infrastructure_configuration_stripesettings_cs_stripesettings_3["StripeSettings"] class flow_type_nexusreader_web_client_program_cs_configured_httpclient_40["configured HttpClient"] class flow_type_nexusreader_web_client_program_cs_n_a_55["N/A"] class flow_type_nexusreader_web_client_program_cs_nexusauthenticationstateprovider_33["NexusAuthenticationStateProvider"] class flow_type_nexusreader_web_client_program_cs_throwingbookstorageservice_74["ThrowingBookStorageService"] class flow_type_nexusreader_web_client_program_cs_throwingdbcontextfactory_49["ThrowingDbContextFactory"] class flow_type_nexusreader_web_client_program_cs_throwingdbcontextfactory_61["ThrowingDbContextFactory"] class flow_type_nexusreader_web_client_program_cs_throwingebookrepository_84["ThrowingEbookRepository"] class flow_type_nexusreader_web_client_program_cs_throwingembeddinggenerator_66["ThrowingEmbeddingGenerator"] class flow_type_nexusreader_web_client_program_cs_throwingsyncbroadcaster_94["ThrowingSyncBroadcaster"] class flow_type_nexusreader_web_client_program_cs_wasmepubreader_56["WasmEpubReader"] class flow_type_nexusreader_web_client_program_cs_wasmknowledgeservice_38["WasmKnowledgeService"] class flow_type_nexusreader_web_client_program_cs_webplatformservice_18["WebPlatformService"] class flow_type_nexusreader_web_program_cs_groundednessrequest_567["GroundednessRequest"] class flow_type_nexusreader_web_program_cs_knowledgerequest_566["KnowledgeRequest"] flow_file_nexusreader_infrastructure_configuration_aisettings_cs_file_1 --> flow_type_nexusreader_infrastructure_configuration_aisettings_cs_aisettings_3 : dto AiSettings flow_file_nexusreader_infrastructure_configuration_stripesettings_cs_file_1 --> flow_type_nexusreader_infrastructure_configuration_stripesettings_cs_stripesettings_3 : dto StripeSettings flow_file_nexusreader_web_client_program_cs_file_1 --> flow_type_nexusreader_web_client_program_cs_throwingbookstorageservice_74 : model ThrowingBookStorageService flow_file_nexusreader_web_client_program_cs_file_1 --> flow_type_nexusreader_web_client_program_cs_throwingdbcontextfactory_61 : model ThrowingDbContextFactory flow_file_nexusreader_web_client_program_cs_file_1 --> flow_type_nexusreader_web_client_program_cs_throwingebookrepository_84 : model ThrowingEbookRepository flow_file_nexusreader_web_client_program_cs_file_1 --> flow_type_nexusreader_web_client_program_cs_throwingembeddinggenerator_66 : model ThrowingEmbeddingGenerator flow_file_nexusreader_web_client_program_cs_file_1 --> flow_type_nexusreader_web_client_program_cs_throwingsyncbroadcaster_94 : model ThrowingSyncBroadcaster flow_file_nexusreader_web_program_cs_file_1 --> flow_type_nexusreader_web_program_cs_groundednessrequest_567 : dto GroundednessRequest flow_file_nexusreader_web_program_cs_file_1 --> flow_type_nexusreader_web_program_cs_knowledgerequest_566 : dto KnowledgeRequest click flow_file_nexusreader_web_client_program_cs_file_1 href "vscode://file/NexusReader.Web.Client/Program.cs:1:1" "Open source" click flow_type_nexusreader_web_client_program_cs_throwingdbcontextfactory_61 href "vscode://file/NexusReader.Web.Client/Program.cs:61:1" "Open source" click flow_type_nexusreader_web_client_program_cs_throwingembeddinggenerator_66 href "vscode://file/NexusReader.Web.Client/Program.cs:66:1" "Open source" click flow_type_nexusreader_web_client_program_cs_throwingbookstorageservice_74 href "vscode://file/NexusReader.Web.Client/Program.cs:74:1" "Open source" click flow_type_nexusreader_web_client_program_cs_throwingebookrepository_84 href "vscode://file/NexusReader.Web.Client/Program.cs:84:1" "Open source" click flow_type_nexusreader_web_client_program_cs_throwingsyncbroadcaster_94 href "vscode://file/NexusReader.Web.Client/Program.cs:94:1" "Open source" click flow_type_nexusreader_web_client_program_cs_webplatformservice_18 href "vscode://file/NexusReader.Web.Client/Program.cs:18:1" "Open source" click flow_type_nexusreader_web_client_program_cs_nexusauthenticationstateprovider_33 href "vscode://file/NexusReader.Web.Client/Program.cs:33:1" "Open source" click flow_type_nexusreader_web_client_program_cs_wasmknowledgeservice_38 href "vscode://file/NexusReader.Web.Client/Program.cs:38:1" "Open source" click flow_type_nexusreader_web_client_program_cs_configured_httpclient_40 href "vscode://file/NexusReader.Web.Client/Program.cs:40:1" "Open source" click flow_type_nexusreader_web_client_program_cs_throwingdbcontextfactory_49 href "vscode://file/NexusReader.Web.Client/Program.cs:49:1" "Open source" click flow_type_nexusreader_web_client_program_cs_n_a_55 href "vscode://file/NexusReader.Web.Client/Program.cs:55:1" "Open source" click flow_type_nexusreader_web_client_program_cs_wasmepubreader_56 href "vscode://file/NexusReader.Web.Client/Program.cs:56:1" "Open source" click flow_file_nexusreader_infrastructure_configuration_aisettings_cs_file_1 href "vscode://file/NexusReader.Infrastructure/Configuration/AiSettings.cs:1:1" "Open source" click flow_type_nexusreader_infrastructure_configuration_aisettings_cs_aisettings_3 href "vscode://file/NexusReader.Infrastructure/Configuration/AiSettings.cs:3:1" "Open source" click flow_file_nexusreader_infrastructure_configuration_stripesettings_cs_file_1 href "vscode://file/NexusReader.Infrastructure/Configuration/StripeSettings.cs:1:1" "Open source" click flow_type_nexusreader_infrastructure_configuration_stripesettings_cs_stripesettings_3 href "vscode://file/NexusReader.Infrastructure/Configuration/StripeSettings.cs:3:1" "Open source" click flow_file_nexusreader_web_program_cs_file_1 href "vscode://file/NexusReader.Web/Program.cs:1:1" "Open source" click flow_type_nexusreader_web_program_cs_knowledgerequest_566 href "vscode://file/NexusReader.Web/Program.cs:566:1" "Open source" click flow_type_nexusreader_web_program_cs_groundednessrequest_567 href "vscode://file/NexusReader.Web/Program.cs:567:1" "Open source" ``` Class view shows DTOs (AiSettings, StripeSettings), client-side stubs and concrete Wasm implementations, clarifying contract-to-implementation mapping in startup. === DIAGRAM 6: Program.cs Layer View (dependency-map) === ```mermaid --- config: flowchart: defaultRenderer: "elk" --- flowchart LR subgraph layer_frontend["frontend"] flow_file_nexusreader_web_client_program_cs_file_1["Program.cs"] flow_action_nexusreader_web_client_program_cs_findauthorbynameasync_repository_read_88_88["Reads repository or persistence state"] flow_type_nexusreader_web_client_program_cs_configured_httpclient_40[/"configured HttpClient"/] flow_type_nexusreader_web_client_program_cs_n_a_55[/"N/A"/] flow_type_nexusreader_web_client_program_cs_nexusauthenticationstateprovider_33[/"NexusAuthenticationStateProvider"/] flow_type_nexusreader_web_client_program_cs_throwingbookstorageservice_74[/"ThrowingBookStorageService"/] flow_type_nexusreader_web_client_program_cs_throwingdbcontextfactory_49[/"ThrowingDbContextFactory"/] flow_type_nexusreader_web_client_program_cs_throwingdbcontextfactory_61[/"ThrowingDbContextFactory"/] flow_type_nexusreader_web_client_program_cs_throwingebookrepository_84[/"ThrowingEbookRepository"/] flow_type_nexusreader_web_client_program_cs_throwingembeddinggenerator_66[/"ThrowingEmbeddingGenerator"/] flow_type_nexusreader_web_client_program_cs_throwingsyncbroadcaster_94[/"ThrowingSyncBroadcaster"/] flow_type_nexusreader_web_client_program_cs_wasmepubreader_56[/"WasmEpubReader"/] flow_type_nexusreader_web_client_program_cs_wasmknowledgeservice_38[/"WasmKnowledgeService"/] flow_type_nexusreader_web_client_program_cs_webplatformservice_18[/"WebPlatformService"/] flow_action_nexusreader_web_client_program_cs_getservice_return_71_71(["returns null"]) flow_file_nexusreader_web_client_program_cs_file_1 -->|uses| flow_type_nexusreader_web_client_program_cs_configured_httpclient_40 flow_file_nexusreader_web_client_program_cs_file_1 -->|application services via extension| flow_type_nexusreader_web_client_program_cs_n_a_55 flow_file_nexusreader_web_client_program_cs_file_1 -->|NexusAuthenticationStateProvider| flow_type_nexusreader_web_client_program_cs_nexusauthenticationstateprovider_33 flow_file_nexusreader_web_client_program_cs_file_1 -->|model ThrowingBookStorageService| flow_type_nexusreader_web_client_program_cs_throwingbookstorageservice_74 flow_file_nexusreader_web_client_program_cs_file_1 -->|IDbContextFactory AppDbContext>| flow_type_nexusreader_web_client_program_cs_throwingdbcontextfactory_49 flow_file_nexusreader_web_client_program_cs_file_1 -->|model ThrowingDbContextFactory| flow_type_nexusreader_web_client_program_cs_throwingdbcontextfactory_61 flow_file_nexusreader_web_client_program_cs_file_1 -->|model ThrowingEbookRepository| flow_type_nexusreader_web_client_program_cs_throwingebookrepository_84 flow_file_nexusreader_web_client_program_cs_file_1 -->|model ThrowingEmbeddingGenerator| flow_type_nexusreader_web_client_program_cs_throwingembeddinggenerator_66 flow_file_nexusreader_web_client_program_cs_file_1 -->|model ThrowingSyncBroadcaster| flow_type_nexusreader_web_client_program_cs_throwingsyncbroadcaster_94 flow_file_nexusreader_web_client_program_cs_file_1 -->|IEpubReader| flow_type_nexusreader_web_client_program_cs_wasmepubreader_56 flow_file_nexusreader_web_client_program_cs_file_1 -->|IKnowledgeService| flow_type_nexusreader_web_client_program_cs_wasmknowledgeservice_38 flow_file_nexusreader_web_client_program_cs_file_1 -->|IPlatformService| flow_type_nexusreader_web_client_program_cs_webplatformservice_18 end subgraph layer_infrastructure["infrastructure"] flow_file_nexusreader_infrastructure_configuration_aisettings_cs_file_1["AiSettings"] flow_file_nexusreader_infrastructure_configuration_stripesettings_cs_file_1["StripeSettings"] flow_type_nexusreader_infrastructure_configuration_aisettings_cs_aisettings_3[/"AiSettings"/] flow_file_nexusreader_infrastructure_configuration_aisettings_cs_file_1 -->|dto AiSettings| flow_type_nexusreader_infrastructure_configuration_aisettings_cs_aisettings_3 end subgraph layer_application["application"] end click flow_file_nexusreader_web_client_program_cs_file_1 href "vscode://file/NexusReader.Web.Client/Program.cs:1:1" "Open source" click flow_action_nexusreader_web_client_program_cs_getservice_return_71_71 href "vscode://file/NexusReader.Web.Client/Program.cs:71:1" "Open source" click flow_action_nexusreader_web_client_program_cs_findauthorbynameasync_repository_read_88_88 href "vscode://file/NexusReader.Web.Client/Program.cs:88:1" "Open source" click flow_type_nexusreader_web_client_program_cs_throwingdbcontextfactory_61 href "vscode://file/NexusReader.Web.Client/Program.cs:61:1" "Open source" click flow_type_nexusreader_web_client_program_cs_throwingembeddinggenerator_66 href "vscode://file/NexusReader.Web.Client/Program.cs:66:1" "Open source" click flow_type_nexusreader_web_client_program_cs_throwingbookstorageservice_74 href "vscode://file/NexusReader.Web.Client/Program.cs:74:1" "Open source" click flow_type_nexusreader_web_client_program_cs_throwingebookrepository_84 href "vscode://file/NexusReader.Web.Client/Program.cs:84:1" "Open source" click flow_type_nexusreader_web_client_program_cs_throwingsyncbroadcaster_94 href "vscode://file/NexusReader.Web.Client/Program.cs:94:1" "Open source" click flow_type_nexusreader_web_client_program_cs_webplatformservice_18 href "vscode://file/NexusReader.Web.Client/Program.cs:18:1" "Open source" click flow_type_nexusreader_web_client_program_cs_nexusauthenticationstateprovider_33 href "vscode://file/NexusReader.Web.Client/Program.cs:33:1" "Open source" click flow_type_nexusreader_web_client_program_cs_wasmknowledgeservice_38 href "vscode://file/NexusReader.Web.Client/Program.cs:38:1" "Open source" click flow_type_nexusreader_web_client_program_cs_configured_httpclient_40 href "vscode://file/NexusReader.Web.Client/Program.cs:40:1" "Open source" click flow_type_nexusreader_web_client_program_cs_throwingdbcontextfactory_49 href "vscode://file/NexusReader.Web.Client/Program.cs:49:1" "Open source" click flow_type_nexusreader_web_client_program_cs_n_a_55 href "vscode://file/NexusReader.Web.Client/Program.cs:55:1" "Open source" click flow_type_nexusreader_web_client_program_cs_wasmepubreader_56 href "vscode://file/NexusReader.Web.Client/Program.cs:56:1" "Open source" click flow_file_nexusreader_infrastructure_configuration_aisettings_cs_file_1 href "vscode://file/NexusReader.Infrastructure/Configuration/AiSettings.cs:1:1" "Open source" click flow_type_nexusreader_infrastructure_configuration_aisettings_cs_aisettings_3 href "vscode://file/NexusReader.Infrastructure/Configuration/AiSettings.cs:3:1" "Open source" click flow_file_nexusreader_infrastructure_configuration_stripesettings_cs_file_1 href "vscode://file/NexusReader.Infrastructure/Configuration/StripeSettings.cs:1:1" "Open source" ``` Layered diagram separates frontend WASM clients from infrastructure config; useful for seeing platform-specific implementations and where Ai/Stripe configs are loaded. === DIAGRAM 7: Method Flow Details (method-flow) === ```mermaid flowchart TD subgraph NexusReader_Infrastructure_Helpers_ContentHasher["ContentHasher"] end subgraph NexusReader_Infrastructure_Helpers_JsonRepairHelper["JsonRepairHelper"] end subgraph NexusReader_Infrastructure_RealTime_SyncHub["SyncHub"] end flow_file_nexusreader_infrastructure_helpers_contenthasher_cs_file_1["ContentHasher"] flow_file_nexusreader_infrastructure_helpers_jsonrepairhelper_cs_file_1["JsonRepairHelper"] flow_method_nexusreader_infrastructure_helpers_contenthasher_cs_computehash_9["ComputeHash"] flow_method_nexusreader_infrastructure_helpers_jsonrepairhelper_cs_repair_8["Repair"] flow_method_nexusreader_infrastructure_realtime_synchub_cs_onconnectedasync_28["OnConnectedAsync"] flow_method_nexusreader_infrastructure_realtime_synchub_cs_ondisconnectedasync_38["OnDisconnectedAsync"] flow_method_nexusreader_infrastructure_realtime_synchub_cs_synchub_14["SyncHub"] flow_method_nexusreader_infrastructure_realtime_synchub_cs_updateprogress_19["UpdateProgress"] flow_action_nexusreader_infrastructure_helpers_contenthasher_cs_computehash_branch_11_11{"Evaluates branch condition"} flow_action_nexusreader_infrastructure_helpers_jsonrepairhelper_cs_repair_guard_clause_10_10{"Guards early exit or rejection path"} flow_action_nexusreader_infrastructure_realtime_synchub_cs_onconnectedasync_repository_read_30_30["Reads repository or persistence state"] flow_action_nexusreader_infrastructure_realtime_synchub_cs_ondisconnectedasync_repository_read_40_40["Reads repository or persistence state"] flow_action_nexusreader_infrastructure_realtime_synchub_cs_updateprogress_repository_read_21_21["Reads repository or persistence state"] flow_action_nexusreader_infrastructure_services_knowledgeservice_cs_askquestionasync_repository_read_717_717["Reads repository or persistence state"] flow_action_nexusreader_infrastructure_services_knowledgeservice_cs_executeairequestandcacheasync_guard_clause_167_167{"Guards early exit or rejection path"} flow_action_nexusreader_infrastructure_services_knowledgeservice_cs_getknowledgeinternalasync_guard_clause_83_83{"Guards early exit or rejection path"} flow_action_nexusreader_web_program_cs_program_top_level_branch_237_237{"Evaluates branch condition"} flow_file_nexusreader_infrastructure_realtime_synchub_cs_file_1["SyncHub"] flow_action_nexusreader_infrastructure_services_knowledgeservice_cs_askquestionasync_repository_read_717_717 -->|JsonRepairHelper.Repair| flow_method_nexusreader_infrastructure_helpers_jsonrepairhelper_cs_repair_8 flow_action_nexusreader_infrastructure_services_knowledgeservice_cs_executeairequestandcacheasync_guard_clause_167_167 -->|JsonRepairHelper.Repair| flow_method_nexusreader_infrastructure_helpers_jsonrepairhelper_cs_repair_8 flow_action_nexusreader_infrastructure_services_knowledgeservice_cs_getknowledgeinternalasync_guard_clause_83_83 -->|ContentHasher.ComputeHash| flow_method_nexusreader_infrastructure_helpers_contenthasher_cs_computehash_9 flow_action_nexusreader_web_program_cs_program_top_level_branch_237_237 -->|SyncHub| flow_method_nexusreader_infrastructure_realtime_synchub_cs_synchub_14 flow_file_nexusreader_infrastructure_helpers_contenthasher_cs_file_1 -->|ComputeHash| flow_method_nexusreader_infrastructure_helpers_contenthasher_cs_computehash_9 flow_file_nexusreader_infrastructure_helpers_jsonrepairhelper_cs_file_1 -->|Repair| flow_method_nexusreader_infrastructure_helpers_jsonrepairhelper_cs_repair_8 flow_file_nexusreader_infrastructure_realtime_synchub_cs_file_1 -->|OnConnectedAsync| flow_method_nexusreader_infrastructure_realtime_synchub_cs_onconnectedasync_28 flow_file_nexusreader_infrastructure_realtime_synchub_cs_file_1 -->|OnDisconnectedAsync| flow_method_nexusreader_infrastructure_realtime_synchub_cs_ondisconnectedasync_38 flow_file_nexusreader_infrastructure_realtime_synchub_cs_file_1 -->|UpdateProgress| flow_method_nexusreader_infrastructure_realtime_synchub_cs_updateprogress_19 flow_method_nexusreader_infrastructure_helpers_contenthasher_cs_computehash_9 -->|true / false| flow_action_nexusreader_infrastructure_helpers_contenthasher_cs_computehash_branch_11_11 flow_method_nexusreader_infrastructure_helpers_jsonrepairhelper_cs_repair_8 -->|exit / continue| flow_action_nexusreader_infrastructure_helpers_jsonrepairhelper_cs_repair_guard_clause_10_10 flow_method_nexusreader_infrastructure_realtime_synchub_cs_onconnectedasync_28 -->|Reads repository or persistence state| flow_action_nexusreader_infrastructure_realtime_synchub_cs_onconnectedasync_repository_read_30_30 flow_method_nexusreader_infrastructure_realtime_synchub_cs_ondisconnectedasync_38 -->|Reads repository or persistence state| flow_action_nexusreader_infrastructure_realtime_synchub_cs_ondisconnectedasync_repository_read_40_40 flow_method_nexusreader_infrastructure_realtime_synchub_cs_updateprogress_19 -->|Reads repository or persistence state| flow_action_nexusreader_infrastructure_realtime_synchub_cs_updateprogress_repository_read_21_21 click flow_action_nexusreader_infrastructure_services_knowledgeservice_cs_getknowledgeinternalasync_guard_clause_83_83 href "vscode://file/NexusReader.Infrastructure/Services/KnowledgeService.cs:83:1" "Open source" click flow_file_nexusreader_infrastructure_helpers_contenthasher_cs_file_1 href "vscode://file/NexusReader.Infrastructure/Helpers/ContentHasher.cs:1:1" "Open source" click flow_method_nexusreader_infrastructure_helpers_contenthasher_cs_computehash_9 href "vscode://file/NexusReader.Infrastructure/Helpers/ContentHasher.cs:9:1" "Open source" click flow_action_nexusreader_infrastructure_services_knowledgeservice_cs_executeairequestandcacheasync_guard_clause_167_167 href "vscode://file/NexusReader.Infrastructure/Services/KnowledgeService.cs:167:1" "Open source" click flow_file_nexusreader_infrastructure_helpers_jsonrepairhelper_cs_file_1 href "vscode://file/NexusReader.Infrastructure/Helpers/JsonRepairHelper.cs:1:1" "Open source" click flow_method_nexusreader_infrastructure_helpers_jsonrepairhelper_cs_repair_8 href "vscode://file/NexusReader.Infrastructure/Helpers/JsonRepairHelper.cs:8:1" "Open source" click flow_action_nexusreader_infrastructure_services_knowledgeservice_cs_askquestionasync_repository_read_717_717 href "vscode://file/NexusReader.Infrastructure/Services/KnowledgeService.cs:717:1" "Open source" click flow_action_nexusreader_infrastructure_helpers_contenthasher_cs_computehash_branch_11_11 href "vscode://file/NexusReader.Infrastructure/Helpers/ContentHasher.cs:11:1" "Open source" click flow_action_nexusreader_infrastructure_helpers_jsonrepairhelper_cs_repair_guard_clause_10_10 href "vscode://file/NexusReader.Infrastructure/Helpers/JsonRepairHelper.cs:10:1" "Open source" click flow_action_nexusreader_web_program_cs_program_top_level_branch_237_237 href "vscode://file/NexusReader.Web/Program.cs:237:1" "Open source" click flow_file_nexusreader_infrastructure_realtime_synchub_cs_file_1 href "vscode://file/NexusReader.Infrastructure/RealTime/SyncHub.cs:1:1" "Open source" click flow_method_nexusreader_infrastructure_realtime_synchub_cs_synchub_14 href "vscode://file/NexusReader.Infrastructure/RealTime/SyncHub.cs:14:1" "Open source" click flow_method_nexusreader_infrastructure_realtime_synchub_cs_updateprogress_19 href "vscode://file/NexusReader.Infrastructure/RealTime/SyncHub.cs:19:1" "Open source" click flow_action_nexusreader_infrastructure_realtime_synchub_cs_updateprogress_repository_read_21_21 href "vscode://file/NexusReader.Infrastructure/RealTime/SyncHub.cs:21:1" "Open source" click flow_method_nexusreader_infrastructure_realtime_synchub_cs_onconnectedasync_28 href "vscode://file/NexusReader.Infrastructure/RealTime/SyncHub.cs:28:1" "Open source" flow_action ... (truncated from 56815 chars) ``` This connects KnowledgeService logic to helpers: ContentHasher computes hashes used to key KnowledgePacket caching, and JsonRepairHelper guards AI response parsing. It also shows repository reads and guard clauses; diagram output is truncated—see source files for full method flows. ### Key Files - NexusReader.Infrastructure/Services/KnowledgeService.cs - NexusReader.Infrastructure/Services/EpubReaderService.cs - NexusReader.Infrastructure/Services/BookStorageService.cs - NexusReader.Infrastructure/Services/BillingService.cs - NexusReader.Infrastructure/Configuration/AiSettings.cs - NexusReader.Infrastructure/Configuration/StripeSettings.cs - NexusReader.Infrastructure/Helpers/ContentHasher.cs - NexusReader.Infrastructure/Helpers/JsonRepairHelper.cs - NexusReader.Infrastructure/Persistence/EbookRepository.cs - NexusReader.Web.Client/Program.cs - NexusReader.Web.Client/Handlers/AuthenticationHeaderHandler.cs