@zolomedia/bifrost-client 1.7.74

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 (140) hide show
  1. package/L1_Foundation/L1_Foundation.js +13 -0
  2. package/L1_Foundation/bootstrap/bootstrap.js +11 -0
  3. package/L1_Foundation/bootstrap/bootstrap_hooks.js +123 -0
  4. package/L1_Foundation/bootstrap/bootstrap_index.js +15 -0
  5. package/L1_Foundation/bootstrap/bootstrap_logger.js +135 -0
  6. package/L1_Foundation/bootstrap/cdn_loader.js +217 -0
  7. package/L1_Foundation/bootstrap/module_registry.js +102 -0
  8. package/L1_Foundation/bootstrap/prism_loader.js +164 -0
  9. package/L1_Foundation/config/client_config.js +110 -0
  10. package/L1_Foundation/config/config.js +7 -0
  11. package/L1_Foundation/connection/connection.js +8 -0
  12. package/L1_Foundation/connection/websocket_connection.js +122 -0
  13. package/L1_Foundation/constants/bifrost_constants.js +284 -0
  14. package/L1_Foundation/constants/constants.js +7 -0
  15. package/L1_Foundation/logger/logger.js +10 -0
  16. package/L2_Handling/L2_Handling.js +15 -0
  17. package/L2_Handling/cache/cache.js +22 -0
  18. package/L2_Handling/cache/cache_constants.js +69 -0
  19. package/L2_Handling/cache/orchestration/cache_manager.js +299 -0
  20. package/L2_Handling/cache/orchestration/cache_orchestrator.js +260 -0
  21. package/L2_Handling/cache/orchestration/orchestration.js +12 -0
  22. package/L2_Handling/cache/storage/session_manager.js +289 -0
  23. package/L2_Handling/cache/storage/storage.js +10 -0
  24. package/L2_Handling/cache/storage/storage_manager.js +590 -0
  25. package/L2_Handling/display/composite/composite.js +13 -0
  26. package/L2_Handling/display/composite/dashboard_renderer.js +221 -0
  27. package/L2_Handling/display/composite/swiper_renderer.js +564 -0
  28. package/L2_Handling/display/composite/terminal_renderer.js +922 -0
  29. package/L2_Handling/display/composite/wizard_conditional_renderer.js +274 -0
  30. package/L2_Handling/display/display.js +30 -0
  31. package/L2_Handling/display/feedback/feedback.js +11 -0
  32. package/L2_Handling/display/feedback/progressbar_renderer.js +418 -0
  33. package/L2_Handling/display/feedback/spinner_renderer.js +246 -0
  34. package/L2_Handling/display/inputs/button_renderer.js +634 -0
  35. package/L2_Handling/display/inputs/form_renderer.js +583 -0
  36. package/L2_Handling/display/inputs/input_renderer.js +658 -0
  37. package/L2_Handling/display/inputs/inputs.js +12 -0
  38. package/L2_Handling/display/navigation/menu_renderer.js +206 -0
  39. package/L2_Handling/display/navigation/navigation.js +11 -0
  40. package/L2_Handling/display/navigation/navigation_renderer.js +703 -0
  41. package/L2_Handling/display/orchestration/orchestration.js +11 -0
  42. package/L2_Handling/display/orchestration/renderer.js +430 -0
  43. package/L2_Handling/display/orchestration/zdisplay_orchestrator.js +1759 -0
  44. package/L2_Handling/display/outputs/alert_renderer.js +161 -0
  45. package/L2_Handling/display/outputs/audio_renderer.js +94 -0
  46. package/L2_Handling/display/outputs/card_renderer.js +229 -0
  47. package/L2_Handling/display/outputs/code_renderer.js +66 -0
  48. package/L2_Handling/display/outputs/dl_renderer.js +131 -0
  49. package/L2_Handling/display/outputs/header_renderer.js +162 -0
  50. package/L2_Handling/display/outputs/icon_renderer.js +107 -0
  51. package/L2_Handling/display/outputs/image_renderer.js +145 -0
  52. package/L2_Handling/display/outputs/list_renderer.js +190 -0
  53. package/L2_Handling/display/outputs/outputs.js +19 -0
  54. package/L2_Handling/display/outputs/table_renderer.js +765 -0
  55. package/L2_Handling/display/outputs/text_renderer.js +818 -0
  56. package/L2_Handling/display/outputs/typography_renderer.js +293 -0
  57. package/L2_Handling/display/outputs/video_renderer.js +116 -0
  58. package/L2_Handling/display/primitives/document_structure_primitives.js +319 -0
  59. package/L2_Handling/display/primitives/form_primitives.js +526 -0
  60. package/L2_Handling/display/primitives/generic_containers.js +109 -0
  61. package/L2_Handling/display/primitives/interactive_primitives.js +305 -0
  62. package/L2_Handling/display/primitives/link_primitives.js +552 -0
  63. package/L2_Handling/display/primitives/lists_primitives.js +262 -0
  64. package/L2_Handling/display/primitives/media_primitives.js +383 -0
  65. package/L2_Handling/display/primitives/primitives.js +19 -0
  66. package/L2_Handling/display/primitives/semantic_element_primitive.js +226 -0
  67. package/L2_Handling/display/primitives/table_primitives.js +528 -0
  68. package/L2_Handling/display/primitives/typography_primitives.js +175 -0
  69. package/L2_Handling/display/specialized/input_request_renderer.js +467 -0
  70. package/L2_Handling/display/specialized/specialized.js +10 -0
  71. package/L2_Handling/hooks/hooks.js +9 -0
  72. package/L2_Handling/hooks/menu_integration.js +57 -0
  73. package/L2_Handling/hooks/widget_hook_manager.js +292 -0
  74. package/L2_Handling/message/message.js +8 -0
  75. package/L2_Handling/message/message_handler.js +701 -0
  76. package/L2_Handling/navigation/navigation.js +8 -0
  77. package/L2_Handling/navigation/navigation_manager.js +403 -0
  78. package/L2_Handling/zhooks/features/cache_live.js +287 -0
  79. package/L2_Handling/zhooks/features/crumbs_live.js +292 -0
  80. package/L2_Handling/zhooks/zhooks_manager.js +65 -0
  81. package/L2_Handling/zvaf/zvaf.js +8 -0
  82. package/L2_Handling/zvaf/zvaf_manager.js +334 -0
  83. package/L3_Abstraction/L3_Abstraction.js +12 -0
  84. package/L3_Abstraction/orchestrator/container_unwrapper.js +101 -0
  85. package/L3_Abstraction/orchestrator/group_renderer.js +698 -0
  86. package/L3_Abstraction/orchestrator/input_event_handler.js +797 -0
  87. package/L3_Abstraction/orchestrator/metadata_processor.js +249 -0
  88. package/L3_Abstraction/orchestrator/navbar_builder.js +201 -0
  89. package/L3_Abstraction/orchestrator/orchestrator.js +13 -0
  90. package/L3_Abstraction/orchestrator/wizard_gate_handler.js +360 -0
  91. package/L3_Abstraction/renderer/renderer.js +1 -0
  92. package/L3_Abstraction/session/session.js +1 -0
  93. package/L4_Orchestration/L4_Orchestration.js +11 -0
  94. package/L4_Orchestration/client/client.js +1 -0
  95. package/L4_Orchestration/facade/facade.js +9 -0
  96. package/L4_Orchestration/facade/manager_registry.js +118 -0
  97. package/L4_Orchestration/facade/renderer_registry.js +274 -0
  98. package/L4_Orchestration/lifecycle/asset_loader.js +255 -0
  99. package/L4_Orchestration/lifecycle/initializer.js +135 -0
  100. package/L4_Orchestration/lifecycle/lifecycle.js +8 -0
  101. package/L4_Orchestration/rendering/facade.js +94 -0
  102. package/L4_Orchestration/rendering/rendering.js +7 -0
  103. package/LICENSE +21 -0
  104. package/README.md +82 -0
  105. package/bifrost_client.js +204 -0
  106. package/bifrost_core.js +1686 -0
  107. package/docs/ARCHITECTURE.md +111 -0
  108. package/docs/PROTOCOL.md +106 -0
  109. package/docs/RENDERERS.md +101 -0
  110. package/docs/SECURITY.md +92 -0
  111. package/package.json +24 -0
  112. package/syntax/prism-zconfig.js +41 -0
  113. package/syntax/prism-zenv.js +69 -0
  114. package/syntax/prism-zolo-theme.css +288 -0
  115. package/syntax/prism-zolo.js +380 -0
  116. package/syntax/prism-zschema.js +38 -0
  117. package/syntax/prism-zspark.js +25 -0
  118. package/syntax/prism-zui.js +68 -0
  119. package/zSys/accessibility/accessibility.js +10 -0
  120. package/zSys/accessibility/emoji_accessibility.js +173 -0
  121. package/zSys/dom/block_utils.js +122 -0
  122. package/zSys/dom/container_utils.js +370 -0
  123. package/zSys/dom/dom.js +13 -0
  124. package/zSys/dom/dom_utils.js +328 -0
  125. package/zSys/dom/encoding_utils.js +117 -0
  126. package/zSys/dom/style_utils.js +71 -0
  127. package/zSys/errors/error_display.js +299 -0
  128. package/zSys/errors/errors.js +10 -0
  129. package/zSys/theme/color_utils.js +274 -0
  130. package/zSys/theme/dark_mode_utils.js +272 -0
  131. package/zSys/theme/size_utils.js +256 -0
  132. package/zSys/theme/spacing_utils.js +405 -0
  133. package/zSys/theme/theme.js +14 -0
  134. package/zSys/theme/zbase.css +1735 -0
  135. package/zSys/theme/zbase_inject.js +161 -0
  136. package/zSys/theme/ztheme_utils.js +305 -0
  137. package/zSys/validation/error_boundary.js +201 -0
  138. package/zSys/validation/validation.js +11 -0
  139. package/zSys/validation/validation_utils.js +238 -0
  140. package/zSys/zSys.js +14 -0
@@ -0,0 +1,284 @@
1
+ /**
2
+ * ═══════════════════════════════════════════════════════════════
3
+ * Bifrost Constants - Centralized Constants (SSOT)
4
+ * ═══════════════════════════════════════════════════════════════
5
+ *
6
+ * Single source of truth for all constants used across the Bifrost
7
+ * client architecture. Eliminates 730+ instances of duplication.
8
+ *
9
+ * @module bifrost_constants
10
+ * @layer 0 (Constants - imported by all layers)
11
+ *
12
+ * Dependencies: None
13
+ *
14
+ * Exports:
15
+ * - TIMEOUTS: Request/connection/animation timeouts
16
+ * - COLORS: Semantic color names
17
+ * - SIZES: Component size variants
18
+ * - EVENT_TYPES: DOM event names (browser-native)
19
+ * - PROTOCOL_EVENTS / PROTOCOL_REASONS: zBifrost WebSocket protocol vocabulary (SSOT)
20
+ * - CSS_CLASSES: Common zTheme class names
21
+ * - TYPOGRAPHY: Font weights and styles
22
+ *
23
+ * Usage:
24
+ * ```javascript
25
+ * import { TIMEOUTS, CSS_CLASSES } from '../constants/bifrost_constants.js';
26
+ * setTimeout(() => {}, TIMEOUTS.FADE_TRANSITION);
27
+ * element.classList.add(CSS_CLASSES.CARD.BODY);
28
+ * ```
29
+ */
30
+
31
+ // ─────────────────────────────────────────────────────────────────
32
+ // Timeout Constants (30+ occurrences across 10 files)
33
+ // ─────────────────────────────────────────────────────────────────
34
+ export const TIMEOUTS = {
35
+ // Request/Connection timeouts
36
+ REQUEST_TIMEOUT: 30000, // 30 seconds - Default request timeout
37
+ RECONNECT_DELAY: 3000, // 3 seconds - Delay between reconnect attempts
38
+
39
+ // Auto-dismiss timeouts
40
+ AUTO_DISMISS: 10000, // 10 seconds - Default auto-dismiss for alerts
41
+ AUTO_DISMISS_SHORT: 5000, // 5 seconds - Short auto-dismiss
42
+
43
+ // Animation/Transition timeouts
44
+ FADE_TRANSITION: 300, // 300ms - Fade in/out transitions
45
+ AUTO_REMOVE_SPINNER: 3000, // 3 seconds - Auto-remove spinner
46
+ AUTO_REMOVE_PROGRESS: 2000, // 2 seconds - Auto-remove progress bar
47
+
48
+ // Debounce/Throttle timeouts
49
+ DEBOUNCE_WIDGET: 1000, // 1 second - Widget hook debounce
50
+ };
51
+
52
+ // ─────────────────────────────────────────────────────────────────
53
+ // Color Constants (150+ occurrences across 29 files)
54
+ // ─────────────────────────────────────────────────────────────────
55
+ export const COLORS = {
56
+ // Semantic colors (primary UI actions)
57
+ SEMANTIC: ['primary', 'secondary', 'success', 'danger', 'warning', 'info'],
58
+
59
+ // Neutral colors (backgrounds, borders)
60
+ NEUTRAL: ['light', 'dark', 'white', 'black'],
61
+
62
+ // State colors (alerts, signals)
63
+ STATES: ['error', 'success', 'warning', 'info'],
64
+
65
+ // Individual color names (for validation)
66
+ PRIMARY: 'primary',
67
+ SECONDARY: 'secondary',
68
+ SUCCESS: 'success',
69
+ DANGER: 'danger',
70
+ WARNING: 'warning',
71
+ INFO: 'info',
72
+ ERROR: 'error',
73
+ LIGHT: 'light',
74
+ DARK: 'dark',
75
+ WHITE: 'white',
76
+ BLACK: 'black',
77
+ };
78
+
79
+ // ─────────────────────────────────────────────────────────────────
80
+ // Size Constants (20+ occurrences across 6 files)
81
+ // ─────────────────────────────────────────────────────────────────
82
+ export const SIZES = {
83
+ // Button sizes
84
+ BUTTON: ['sm', 'md', 'lg'],
85
+
86
+ // Spinner sizes
87
+ SPINNER: ['sm', 'md', 'lg'],
88
+
89
+ // Icon sizes
90
+ ICON: ['xs', 'sm', 'md', 'lg', 'xl', '2xl'],
91
+
92
+ // Individual size names
93
+ EXTRA_SMALL: 'xs',
94
+ SMALL: 'sm',
95
+ MEDIUM: 'md',
96
+ LARGE: 'lg',
97
+ EXTRA_LARGE: 'xl',
98
+ EXTRA_LARGE_2X: '2xl',
99
+ };
100
+
101
+ // ─────────────────────────────────────────────────────────────────
102
+ // Event Type Constants (80+ occurrences across 18 files)
103
+ // ─────────────────────────────────────────────────────────────────
104
+ // DOM event names (browser-native — used with addEventListener).
105
+ export const EVENT_TYPES = {
106
+ CLICK: 'click',
107
+ CHANGE: 'change',
108
+ SUBMIT: 'submit',
109
+ INPUT: 'input',
110
+ FOCUS: 'focus',
111
+ BLUR: 'blur',
112
+ KEYDOWN: 'keydown',
113
+ KEYUP: 'keyup',
114
+ };
115
+
116
+ // ─────────────────────────────────────────────────────────────────
117
+ // zBifrost WebSocket Protocol Events (SSOT)
118
+ // ─────────────────────────────────────────────────────────────────
119
+ // Control-plane + display event names that arrive on `message.event`.
120
+ // This is the single source of truth for the client's protocol vocabulary —
121
+ // message_handler dispatch MUST reference these instead of raw string
122
+ // literals. Keep in sync with the server's emitted event names. Render-node
123
+ // *display* ops carried inside a render_chunk are decoded separately via the
124
+ // opcode map (mirror of render_opcodes.py) in message_handler.
125
+ export const PROTOCOL_EVENTS = {
126
+ // Transport / connection control
127
+ RENDER_CHUNK: 'render_chunk',
128
+ CONNECTION_INFO: 'connection_info',
129
+ NAVIGATE_BACK: 'navigate_back',
130
+ OPEN_URL: 'open_url',
131
+ ERROR: 'error',
132
+
133
+ // Display / output
134
+ DISPLAY: 'display',
135
+ OUTPUT: 'output',
136
+ ZTABLE: 'zTable',
137
+ ZDASH: 'zDash',
138
+ ZMENU: 'zMenu',
139
+ ZDIALOG: 'zDialog',
140
+ SWIPER_INIT: 'swiper_init',
141
+
142
+ // Progress / spinner
143
+ PROGRESS_BAR: 'progress_bar',
144
+ PROGRESS_UPDATE: 'progress_update',
145
+ PROGRESS_COMPLETE: 'progress_complete',
146
+ SPINNER_START: 'spinner_start',
147
+ SPINNER_STOP: 'spinner_stop',
148
+
149
+ // Input request / response
150
+ REQUEST_INPUT: 'request_input',
151
+ INPUT_REQUEST: 'input_request',
152
+ INPUT_RESPONSE: 'input_response',
153
+
154
+ // Execution / wizard / RBAC
155
+ EXECUTE_WALKER: 'execute_walker',
156
+ EXECUTE_ZFUNC_RESPONSE: 'execute_zfunc_response',
157
+ EXECUTE_CODE_RESPONSE: 'execute_code_response',
158
+ ZFUNC_EXEC: 'zfunc_exec',
159
+ WIZARD_GATE_RESULT: 'wizard_gate_result',
160
+ RBAC_DENIED: 'rbac_denied',
161
+
162
+ // Logging
163
+ APP_LOG: 'app_log',
164
+ };
165
+
166
+ // navigate_back `reason` discriminators (SSOT).
167
+ export const PROTOCOL_REASONS = {
168
+ BOUNCE_BACK_COMPLETED: 'bounce_back_block_completed',
169
+ RBAC_DENIED: 'rbac_denied',
170
+ };
171
+
172
+ // ─────────────────────────────────────────────────────────────────
173
+ // CSS Class Constants (300+ occurrences across 30 files)
174
+ // ─────────────────────────────────────────────────────────────────
175
+ export const CSS_CLASSES = {
176
+ // Card classes
177
+ CARD: {
178
+ BASE: 'zCard',
179
+ BODY: 'zCard-body',
180
+ TITLE: 'zCard-title',
181
+ SUBTITLE: 'zCard-subtitle',
182
+ TEXT: 'zCard-text',
183
+ HEADER: 'zCard-header',
184
+ FOOTER: 'zCard-footer',
185
+ IMG: 'zCard-img',
186
+ IMG_TOP: 'zCard-img-top',
187
+ },
188
+
189
+ // Input group classes
190
+ INPUT_GROUP: {
191
+ BASE: 'zInputGroup',
192
+ TEXT: 'zInputGroup-text',
193
+ PREPEND: 'zInputGroup-prepend',
194
+ APPEND: 'zInputGroup-append',
195
+ },
196
+
197
+ // List group classes
198
+ LIST_GROUP: {
199
+ BASE: 'zList-group',
200
+ ITEM: 'zList-group-item',
201
+ ITEM_ACTION: 'zList-group-item-action',
202
+ },
203
+
204
+ // Navbar classes
205
+ NAVBAR: {
206
+ BASE: 'zNavbar',
207
+ LIGHT: 'zNavbar-light',
208
+ DARK: 'zNavbar-dark',
209
+ EXPAND_LG: 'zNavbar-expand-lg',
210
+ },
211
+
212
+ // Background classes (prefix)
213
+ BG_PREFIX: 'zBg-',
214
+
215
+ // Text color classes (prefix)
216
+ TEXT_PREFIX: 'zText-',
217
+
218
+ // Border classes (prefix)
219
+ BORDER_PREFIX: 'zBorder-',
220
+
221
+ // Button classes (prefix)
222
+ BUTTON_PREFIX: 'zBtn',
223
+ };
224
+
225
+ // ─────────────────────────────────────────────────────────────────
226
+ // Typography Constants (10+ occurrences across 4 files)
227
+ // ─────────────────────────────────────────────────────────────────
228
+ export const TYPOGRAPHY = {
229
+ FONT_WEIGHTS: {
230
+ LIGHT: '300',
231
+ NORMAL: '400',
232
+ MEDIUM: '500',
233
+ SEMIBOLD: '600',
234
+ BOLD: '700',
235
+ },
236
+ };
237
+
238
+ // ─────────────────────────────────────────────────────────────────
239
+ // Z-Index Layers (Stacking Context)
240
+ // ─────────────────────────────────────────────────────────────────
241
+ export const Z_INDEX = {
242
+ ERROR_CONTAINER: 10000, // Error display container (highest)
243
+ MODAL: 1000, // Modal overlays
244
+ DROPDOWN: 100, // Dropdowns and popovers
245
+ STICKY: 10, // Sticky headers
246
+ BASE: 1, // Base layer
247
+ };
248
+
249
+ // ─────────────────────────────────────────────────────────────────
250
+ // WebSocket Close Codes
251
+ // ─────────────────────────────────────────────────────────────────
252
+ export const WS_CLOSE_CODES = {
253
+ NORMAL: 1000, // Normal closure
254
+ GOING_AWAY: 1001, // Endpoint going away
255
+ PROTOCOL_ERROR: 1002, // Protocol error
256
+ UNSUPPORTED: 1003, // Unsupported data
257
+ ABNORMAL: 1006, // Abnormal closure (no status)
258
+ };
259
+
260
+ // ─────────────────────────────────────────────────────────────────
261
+ // Spacing Values (Rem-based spacing scale)
262
+ // ─────────────────────────────────────────────────────────────────
263
+ export const SPACING = {
264
+ NONE: '0',
265
+ XXS: '0.25rem', // 4px
266
+ XS: '0.5rem', // 8px
267
+ SM: '0.75rem', // 12px
268
+ MD: '1rem', // 16px
269
+ LG: '1.5rem', // 24px
270
+ XL: '2rem', // 32px
271
+ XXL: '3rem', // 48px
272
+ };
273
+
274
+ // ─────────────────────────────────────────────────────────────────
275
+ // Position Constants
276
+ // ─────────────────────────────────────────────────────────────────
277
+ export const POSITIONS = {
278
+ TOP_RIGHT: 'top-right',
279
+ TOP_LEFT: 'top-left',
280
+ BOTTOM_RIGHT: 'bottom-right',
281
+ BOTTOM_LEFT: 'bottom-left',
282
+ TOP_CENTER: 'top-center',
283
+ BOTTOM_CENTER: 'bottom-center',
284
+ };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * L1_Foundation/constants - SSOT Constants
3
+ *
4
+ * All application constants: Event types, Cache tiers, Z-index, WS codes.
5
+ */
6
+
7
+ export * from './bifrost_constants.js';
@@ -0,0 +1,10 @@
1
+ /**
2
+ * L1_Foundation/logger - Logging Infrastructure Barrel
3
+ *
4
+ * Provides logging with level management and ANSI color formatting.
5
+ *
6
+ * Note: Actual implementation loaded dynamically via MODULE_REGISTRY.
7
+ * This is a placeholder barrel file for the logger subsystem.
8
+ */
9
+
10
+ // Empty barrel - implementation loaded dynamically by bifrost_client
@@ -0,0 +1,15 @@
1
+ /**
2
+ * L2_Handling - Business Logic Layer
3
+ *
4
+ * Processes events, handles user interactions, manages state.
5
+ * Depends on: L1_Foundation
6
+ * Provides: Message routing, Navigation, Cache, Display, Hooks, zVaF
7
+ */
8
+
9
+ // Export subdirectories (will be populated in Step 3)
10
+ export * from './message/message.js';
11
+ export * from './navigation/navigation.js';
12
+ export * from './cache/cache.js';
13
+ export * from './display/display.js';
14
+ export * from './hooks/hooks.js';
15
+ export * from './zvaf/zvaf.js';
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Caching Module - Barrel Export
3
+ *
4
+ * Client caching surface after the SSOT collapse: the server (zLoader) is the
5
+ * single cache of record. The client keeps only IDENTITY (SessionManager) and
6
+ * the visited-page TRAIL (TrailStore / CacheOrchestrator alias), backed by
7
+ * StorageManager (IndexedDB). The old per-tier "mirror of zLoader" and the HTTP
8
+ * conditional-request manager are gone.
9
+ *
10
+ * @module caching
11
+ */
12
+
13
+ // Constants
14
+ export * from './cache_constants.js';
15
+
16
+ // Storage Layer
17
+ export { StorageManager } from './storage/storage_manager.js';
18
+ export { SessionManager } from './storage/session_manager.js';
19
+
20
+ // Orchestration Layer
21
+ export { CacheOrchestrator } from './orchestration/cache_orchestrator.js';
22
+ export { CacheManager } from './orchestration/cache_manager.js';
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Cache Constants - SSOT for client-side caching configuration
3
+ *
4
+ * The client is NOT a second zLoader. The server (zLoader) is the single cache
5
+ * of record for everything parsed/rendered. The browser holds exactly two
6
+ * things: IDENTITY (SessionManager) and the user's own VISITED TRAIL of
7
+ * rendered pages (the TrailStore, backed by IndexedDB) — the offline-browse
8
+ * engine that lets Back/forward work when the socket is down.
9
+ *
10
+ * Static assets (CSS / JS plugins / images / fonts) are cached by the BROWSER's
11
+ * native HTTP cache (SHA-pinned, immutable) — we do not reimplement that here.
12
+ *
13
+ * @module cache_constants
14
+ * @layer 0 (Constants - imported by all cache layers)
15
+ */
16
+
17
+ // ─────────────────────────────────────────────────────────────────
18
+ // Trail tier — the ONLY client cache tier (rendered pages)
19
+ // ─────────────────────────────────────────────────────────────────
20
+
21
+ export const TIER_RENDERED = 'rendered';
22
+
23
+ export const VALID_TIERS = [TIER_RENDERED];
24
+
25
+ // ─────────────────────────────────────────────────────────────────
26
+ // TTL (Time-To-Live) in milliseconds
27
+ // The trail is bounded primarily by session_hash + LRU; TTL is a secondary
28
+ // safety so a long-abandoned tab can't replay very stale paints.
29
+ // ─────────────────────────────────────────────────────────────────
30
+
31
+ export const TRAIL_TTL = 86400000; // 24 hours
32
+
33
+ export const TTL = {
34
+ rendered: TRAIL_TTL
35
+ };
36
+
37
+ // ─────────────────────────────────────────────────────────────────
38
+ // LRU (Least Recently Used) limit — cap the trail size
39
+ // ─────────────────────────────────────────────────────────────────
40
+
41
+ export const TRAIL_LIMIT = 50;
42
+
43
+ export const LRU_LIMITS = {
44
+ rendered: TRAIL_LIMIT
45
+ };
46
+
47
+ // ─────────────────────────────────────────────────────────────────
48
+ // Storage Configuration
49
+ // DB_VERSION bumped to 2: legacy stores (system/pinned/plugin) are dropped —
50
+ // only the rendered trail persists now.
51
+ // ─────────────────────────────────────────────────────────────────
52
+
53
+ export const DB_VERSION = 2;
54
+ export const STORE_NAMES = ['rendered'];
55
+ export const LEGACY_STORE_NAMES = ['system', 'pinned', 'plugin'];
56
+
57
+ // ─────────────────────────────────────────────────────────────────
58
+ // Session Configuration
59
+ // ─────────────────────────────────────────────────────────────────
60
+
61
+ export const SESSION_KEY = 'public_session';
62
+ export const DEFAULT_SESSION = {
63
+ authenticated: false,
64
+ username: null,
65
+ role: null,
66
+ session_hash: null,
67
+ app: null,
68
+ timestamp: null
69
+ };