@allternit/gizzi-code 1.0.0 → 1.0.1

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 (158) hide show
  1. package/bin/gizzi +4 -0
  2. package/bin/gizzi-ink +5 -0
  3. package/package.json +137 -31
  4. package/src/Tool.ts +26 -0
  5. package/src/bootstrap/state.ts +165 -322
  6. package/src/commands.ts +209 -0
  7. package/src/context/QueuedMessageContext.tsx +63 -0
  8. package/src/context/fpsMetrics.tsx +30 -0
  9. package/src/context/mailbox.tsx +38 -0
  10. package/src/context/modalContext.tsx +58 -0
  11. package/src/context/notifications.tsx +240 -0
  12. package/src/context/overlayContext.tsx +151 -0
  13. package/src/context/promptOverlayContext.tsx +125 -0
  14. package/src/context/stats.tsx +220 -0
  15. package/src/context/voice.tsx +88 -0
  16. package/src/hooks/useCanUseTool.ts +11 -0
  17. package/src/hooks/useExitOnCtrlCD.ts +40 -187
  18. package/src/hooks/useExitOnCtrlCDWithKeybindings.ts +68 -0
  19. package/src/hooks/useKeybinding.ts +68 -209
  20. package/src/hooks/useTerminalSize.ts +31 -99
  21. package/src/hooks.ts +37 -0
  22. package/src/ink.ts +204 -0
  23. package/src/main.ts +7 -0
  24. package/src/types/command.ts +216 -0
  25. package/src/types/connectorText.ts +39 -0
  26. package/src/types/fileSuggestion.ts +15 -0
  27. package/src/types/generated/events_mono/claude_code/v1/claude_code_internal_event.ts +865 -0
  28. package/src/types/generated/events_mono/common/v1/auth.ts +100 -0
  29. package/src/types/generated/events_mono/growthbook/v1/growthbook_experiment_event.ts +223 -0
  30. package/src/types/generated/google/protobuf/timestamp.ts +187 -0
  31. package/src/types/hooks.ts +319 -0
  32. package/src/types/ids.ts +44 -0
  33. package/src/types/logs.ts +331 -0
  34. package/src/types/merged/index.ts +5 -0
  35. package/src/types/merged/message.ts +552 -0
  36. package/src/types/message.ts +927 -186
  37. package/src/types/messageQueueTypes.ts +21 -0
  38. package/src/types/notebook.ts +72 -0
  39. package/src/types/permissions.ts +447 -0
  40. package/src/types/plugin.ts +363 -0
  41. package/src/types/statusLine.ts +15 -0
  42. package/src/types/textInputTypes.ts +387 -0
  43. package/src/types/tools.ts +149 -0
  44. package/src/types/utils.ts +20 -0
  45. package/src/utils/advisor.ts +12 -0
  46. package/src/utils/api.ts +29 -0
  47. package/src/utils/array.ts +7 -0
  48. package/src/utils/attachments.ts +60 -0
  49. package/src/utils/auth.ts +3 -0
  50. package/src/utils/claudeInChrome/chromeNativeHost.ts +15 -0
  51. package/src/utils/claudeInChrome/common.ts +12 -0
  52. package/src/utils/claudeInChrome/mcpServer.ts +15 -0
  53. package/src/utils/computerUse/common.ts +19 -0
  54. package/src/utils/computerUse/mcpServer.ts +15 -0
  55. package/src/utils/config.ts +35 -0
  56. package/src/utils/context.ts +19 -0
  57. package/src/utils/cwd.ts +3 -0
  58. package/src/utils/debug.ts +3 -0
  59. package/src/utils/earlyInput.ts +7 -0
  60. package/src/utils/effort.ts +13 -0
  61. package/src/utils/embeddedTools.ts +12 -0
  62. package/src/utils/envUtils.ts +3 -0
  63. package/src/utils/errors.ts +3 -0
  64. package/src/utils/execFileNoThrow.ts +24 -0
  65. package/src/utils/feature-flags.ts +112 -0
  66. package/src/utils/file.ts +3 -0
  67. package/src/utils/fileHistory.ts +17 -0
  68. package/src/utils/fingerprint.ts +7 -0
  69. package/src/utils/format.ts +75 -305
  70. package/src/utils/frontmatterParser.ts +33 -0
  71. package/src/utils/fsOperations.ts +31 -0
  72. package/src/utils/fullscreen.ts +40 -350
  73. package/src/utils/git.ts +15 -0
  74. package/src/utils/imageResizer.ts +30 -0
  75. package/src/utils/lazySchema.ts +9 -0
  76. package/src/utils/log.ts +3 -0
  77. package/src/utils/markdownConfigLoader.ts +12 -0
  78. package/src/utils/messages.ts +13 -0
  79. package/src/utils/migration.ts +137 -0
  80. package/src/utils/model/providers.ts +15 -0
  81. package/src/utils/path.ts +3 -0
  82. package/src/utils/permissions/PermissionResult.ts +14 -0
  83. package/src/utils/permissions/autoModeState.ts +12 -0
  84. package/src/utils/permissions/filesystem.ts +12 -0
  85. package/src/utils/plugins/loadPluginOutputStyles.ts +12 -0
  86. package/src/utils/plugins/schemas.ts +25 -0
  87. package/src/utils/process.ts +16 -0
  88. package/src/utils/sandbox/sandbox-adapter.ts +19 -0
  89. package/src/utils/sessionStorage.ts +238 -472
  90. package/src/utils/settings/constants.ts +10 -0
  91. package/src/utils/settings/settings.ts +19 -0
  92. package/src/utils/settings/types.ts +18 -0
  93. package/src/utils/shell/shellToolUtils.ts +9 -0
  94. package/src/utils/sinks.ts +11 -0
  95. package/src/utils/sleep.ts +7 -0
  96. package/src/utils/sliceAnsi.ts +7 -0
  97. package/src/utils/slowOperations.ts +3 -0
  98. package/src/utils/startupProfiler.ts +11 -0
  99. package/src/utils/stringUtils.ts +106 -0
  100. package/src/utils/systemPromptType.ts +9 -0
  101. package/src/utils/teleport/api.ts +15 -0
  102. package/src/utils/textHighlighting.ts +16 -0
  103. package/src/utils/theme.ts +17 -0
  104. package/src/utils/thinking.ts +58 -0
  105. package/src/utils/tokens.ts +11 -0
  106. package/src/utils/toolResultStorage.ts +17 -0
  107. package/src/utils/worktreeModeEnabled.ts +7 -0
  108. package/WORKSPACE_INTEGRATION.md +0 -290
  109. package/chat-sessions/sessions-index.json +0 -98
  110. package/package.json.original +0 -31
  111. package/package.json.publish +0 -47
  112. package/src/bootstrap/state.d.ts +0 -169
  113. package/src/bootstrap/state.js +0 -261
  114. package/src/context/pack-builder.d.ts +0 -24
  115. package/src/context/pack-builder.js +0 -281
  116. package/src/hooks/useExitOnCtrlCD.d.ts +0 -86
  117. package/src/hooks/useExitOnCtrlCD.js +0 -130
  118. package/src/hooks/useKeybinding.d.ts +0 -89
  119. package/src/hooks/useKeybinding.js +0 -163
  120. package/src/hooks/useTerminalSize.d.ts +0 -41
  121. package/src/hooks/useTerminalSize.js +0 -90
  122. package/src/index.d.ts +0 -23
  123. package/src/index.js +0 -24
  124. package/src/runtime/brand/brand.d.ts +0 -488
  125. package/src/runtime/brand/brand.js +0 -464
  126. package/src/runtime/brand/brand.ts +0 -667
  127. package/src/runtime/services/tokenEstimation.d.ts +0 -187
  128. package/src/runtime/services/tokenEstimation.js +0 -423
  129. package/src/runtime/services/tokenEstimation.ts +0 -547
  130. package/src/runtime/tools/Tool.d.ts +0 -239
  131. package/src/runtime/tools/Tool.js +0 -285
  132. package/src/runtime/tools/Tool.ts +0 -524
  133. package/src/scheduler/TaskScheduler.d.ts +0 -98
  134. package/src/scheduler/TaskScheduler.js +0 -201
  135. package/src/scheduler/TaskScheduler.ts +0 -259
  136. package/src/state/AppStateStore.d.ts +0 -347
  137. package/src/state/AppStateStore.js +0 -439
  138. package/src/state/AppStateStore.ts +0 -658
  139. package/src/state/WorkspaceStateStore.d.ts +0 -43
  140. package/src/state/WorkspaceStateStore.js +0 -224
  141. package/src/state/WorkspaceStateStore.ts +0 -297
  142. package/src/types/message.d.ts +0 -190
  143. package/src/types/message.js +0 -77
  144. package/src/utils/format.d.ts +0 -126
  145. package/src/utils/format.js +0 -230
  146. package/src/utils/fullscreen.d.ts +0 -161
  147. package/src/utils/fullscreen.js +0 -277
  148. package/src/utils/sessionStorage.d.ts +0 -210
  149. package/src/utils/sessionStorage.js +0 -435
  150. package/src/watcher/WorkspaceWatcher.d.ts +0 -70
  151. package/src/watcher/WorkspaceWatcher.js +0 -191
  152. package/src/watcher/WorkspaceWatcher.ts +0 -251
  153. package/src/workspace/loader.d.ts +0 -30
  154. package/src/workspace/loader.js +0 -117
  155. package/src/workspace/types.d.ts +0 -91
  156. package/src/workspace/types.js +0 -7
  157. package/threads/thread_1775361175022.json +0 -9
  158. package/tsconfig.json +0 -14
@@ -1,161 +0,0 @@
1
- /**
2
- * @fileoverview Fullscreen utilities for gizzi-code integration
3
- * @module utils/fullscreen
4
- *
5
- * Provides utilities for managing fullscreen mode in browser environments.
6
- * Includes support for the standard Fullscreen API with vendor prefixes
7
- * for cross-browser compatibility.
8
- */
9
- /**
10
- * Fullscreen change event handler type
11
- * @typedef {Function} FullscreenChangeHandler
12
- */
13
- export type FullscreenChangeHandler = (isFullscreen: boolean) => void;
14
- /**
15
- * Checks if the Fullscreen API is supported in the current environment
16
- *
17
- * @returns {boolean} True if fullscreen is supported
18
- * @example
19
- * ```typescript
20
- * if (isFullscreenSupported()) {
21
- * enterFullscreen();
22
- * }
23
- * ```
24
- */
25
- export declare function isFullscreenSupported(): boolean;
26
- /**
27
- * Checks if the document is currently in fullscreen mode
28
- *
29
- * @returns {boolean} True if currently in fullscreen
30
- * @example
31
- * ```typescript
32
- * if (isFullscreen()) {
33
- * console.log('Currently in fullscreen mode');
34
- * }
35
- * ```
36
- */
37
- export declare function isFullscreen(): boolean;
38
- /**
39
- * Enters fullscreen mode for the specified element or document
40
- *
41
- * @param {HTMLElement} [element] - Element to make fullscreen (defaults to document.documentElement)
42
- * @param {FullscreenOptions} [options] - Fullscreen options
43
- * @returns {Promise<void>} Promise that resolves when fullscreen is entered
44
- * @throws {Error} If fullscreen is not supported or permission is denied
45
- * @example
46
- * ```typescript
47
- * // Make entire page fullscreen
48
- * await enterFullscreen();
49
- *
50
- * // Make specific element fullscreen
51
- * const video = document.getElementById('myVideo');
52
- * await enterFullscreen(video);
53
- *
54
- * // With navigation UI hidden
55
- * await enterFullscreen(undefined, { navigationUI: 'hide' });
56
- * ```
57
- */
58
- export declare function enterFullscreen(element?: HTMLElement, options?: FullscreenOptions): Promise<void>;
59
- /**
60
- * Exits fullscreen mode
61
- *
62
- * @returns {Promise<void>} Promise that resolves when fullscreen is exited
63
- * @throws {Error} If not in fullscreen or API not supported
64
- * @example
65
- * ```typescript
66
- * await exitFullscreen();
67
- * console.log('Exited fullscreen');
68
- * ```
69
- */
70
- export declare function exitFullscreen(): Promise<void>;
71
- /**
72
- * Toggles fullscreen mode for the specified element
73
- *
74
- * @param {HTMLElement} [element] - Element to toggle (defaults to document.documentElement)
75
- * @param {FullscreenOptions} [options] - Fullscreen options
76
- * @returns {Promise<boolean>} Promise that resolves to new fullscreen state
77
- * @example
78
- * ```typescript
79
- * const isFullscreen = await toggleFullscreen();
80
- * console.log('Fullscreen active:', isFullscreen);
81
- * ```
82
- */
83
- export declare function toggleFullscreen(element?: HTMLElement, options?: FullscreenOptions): Promise<boolean>;
84
- /**
85
- * Subscribes to fullscreen change events
86
- *
87
- * @param {FullscreenChangeHandler} handler - Callback fired when fullscreen state changes
88
- * @returns {() => void} Unsubscribe function
89
- * @example
90
- * ```typescript
91
- * const unsubscribe = onFullscreenChange((isFullscreen) => {
92
- * console.log('Fullscreen changed:', isFullscreen);
93
- * });
94
- *
95
- * // Later: unsubscribe();
96
- * ```
97
- */
98
- export declare function onFullscreenChange(handler: FullscreenChangeHandler): () => void;
99
- /**
100
- * Gets the current fullscreen element
101
- *
102
- * @returns {Element | null} The element currently in fullscreen, or null
103
- * @example
104
- * ```typescript
105
- * const element = getFullscreenElement();
106
- * if (element) {
107
- * console.log('Fullscreen element:', element.tagName);
108
- * }
109
- * ```
110
- */
111
- export declare function getFullscreenElement(): Element | null;
112
- /**
113
- * Locks screen orientation when in fullscreen (mobile devices)
114
- *
115
- * @param {OrientationLockType} orientation - Orientation to lock to
116
- * @returns {Promise<void>} Promise that resolves when orientation is locked
117
- * @example
118
- * ```typescript
119
- * await lockOrientation('landscape');
120
- * await enterFullscreen();
121
- * ```
122
- */
123
- /**
124
- * Valid orientation lock types
125
- * @typedef {string} OrientationLockType
126
- */
127
- type OrientationLockType = 'any' | 'natural' | 'landscape' | 'portrait' | 'portrait-primary' | 'portrait-secondary' | 'landscape-primary' | 'landscape-secondary';
128
- /**
129
- * Locks screen orientation when in fullscreen (mobile devices)
130
- *
131
- * @param {OrientationLockType} orientation - Orientation to lock to
132
- * @returns {Promise<void>} Promise that resolves when orientation is locked
133
- * @example
134
- * ```typescript
135
- * await lockOrientation('landscape');
136
- * await enterFullscreen();
137
- * ```
138
- */
139
- export declare function lockOrientation(orientation: OrientationLockType): Promise<void>;
140
- /**
141
- * Unlocks screen orientation
142
- *
143
- * @returns {Promise<void>} Promise that resolves when orientation is unlocked
144
- * @example
145
- * ```typescript
146
- * await unlockOrientation();
147
- * ```
148
- */
149
- export declare function unlockOrientation(): Promise<void>;
150
- declare const _default: {
151
- isFullscreenSupported: typeof isFullscreenSupported;
152
- isFullscreen: typeof isFullscreen;
153
- enterFullscreen: typeof enterFullscreen;
154
- exitFullscreen: typeof exitFullscreen;
155
- toggleFullscreen: typeof toggleFullscreen;
156
- onFullscreenChange: typeof onFullscreenChange;
157
- getFullscreenElement: typeof getFullscreenElement;
158
- lockOrientation: typeof lockOrientation;
159
- unlockOrientation: typeof unlockOrientation;
160
- };
161
- export default _default;
@@ -1,277 +0,0 @@
1
- /**
2
- * @fileoverview Fullscreen utilities for gizzi-code integration
3
- * @module utils/fullscreen
4
- *
5
- * Provides utilities for managing fullscreen mode in browser environments.
6
- * Includes support for the standard Fullscreen API with vendor prefixes
7
- * for cross-browser compatibility.
8
- */
9
- /**
10
- * Checks if the Fullscreen API is supported in the current environment
11
- *
12
- * @returns {boolean} True if fullscreen is supported
13
- * @example
14
- * ```typescript
15
- * if (isFullscreenSupported()) {
16
- * enterFullscreen();
17
- * }
18
- * ```
19
- */
20
- export function isFullscreenSupported() {
21
- if (typeof document === 'undefined') {
22
- return false;
23
- }
24
- const doc = document;
25
- const elem = document.documentElement;
26
- return !!(doc.fullscreenEnabled ??
27
- doc.webkitFullscreenEnabled ??
28
- doc.mozFullScreenEnabled ??
29
- doc.msFullscreenEnabled ??
30
- elem.requestFullscreen ??
31
- elem.webkitRequestFullscreen ??
32
- elem.mozRequestFullScreen ??
33
- elem.msRequestFullscreen);
34
- }
35
- /**
36
- * Checks if the document is currently in fullscreen mode
37
- *
38
- * @returns {boolean} True if currently in fullscreen
39
- * @example
40
- * ```typescript
41
- * if (isFullscreen()) {
42
- * console.log('Currently in fullscreen mode');
43
- * }
44
- * ```
45
- */
46
- export function isFullscreen() {
47
- if (typeof document === 'undefined') {
48
- return false;
49
- }
50
- const doc = document;
51
- return !!(doc.fullscreenElement ??
52
- doc.webkitFullscreenElement ??
53
- doc.mozFullScreenElement ??
54
- doc.msFullscreenElement ??
55
- doc.webkitIsFullScreen ??
56
- doc.mozFullScreen ??
57
- doc.msIsFullScreen);
58
- }
59
- /**
60
- * Enters fullscreen mode for the specified element or document
61
- *
62
- * @param {HTMLElement} [element] - Element to make fullscreen (defaults to document.documentElement)
63
- * @param {FullscreenOptions} [options] - Fullscreen options
64
- * @returns {Promise<void>} Promise that resolves when fullscreen is entered
65
- * @throws {Error} If fullscreen is not supported or permission is denied
66
- * @example
67
- * ```typescript
68
- * // Make entire page fullscreen
69
- * await enterFullscreen();
70
- *
71
- * // Make specific element fullscreen
72
- * const video = document.getElementById('myVideo');
73
- * await enterFullscreen(video);
74
- *
75
- * // With navigation UI hidden
76
- * await enterFullscreen(undefined, { navigationUI: 'hide' });
77
- * ```
78
- */
79
- export async function enterFullscreen(element, options) {
80
- if (typeof document === 'undefined') {
81
- return Promise.reject(new Error('Fullscreen not available in server environment'));
82
- }
83
- const target = (element ?? document.documentElement);
84
- // Try standard method first
85
- if (target.requestFullscreen) {
86
- return target.requestFullscreen(options);
87
- }
88
- // Vendor prefixed fallbacks
89
- if (target.webkitRequestFullscreen) {
90
- return target.webkitRequestFullscreen(options);
91
- }
92
- if (target.mozRequestFullScreen) {
93
- return target.mozRequestFullScreen(options);
94
- }
95
- if (target.msRequestFullscreen) {
96
- return target.msRequestFullscreen();
97
- }
98
- throw new Error('Fullscreen API is not supported in this browser');
99
- }
100
- /**
101
- * Exits fullscreen mode
102
- *
103
- * @returns {Promise<void>} Promise that resolves when fullscreen is exited
104
- * @throws {Error} If not in fullscreen or API not supported
105
- * @example
106
- * ```typescript
107
- * await exitFullscreen();
108
- * console.log('Exited fullscreen');
109
- * ```
110
- */
111
- export async function exitFullscreen() {
112
- if (typeof document === 'undefined') {
113
- return Promise.reject(new Error('Fullscreen not available in server environment'));
114
- }
115
- if (!isFullscreen()) {
116
- return Promise.resolve();
117
- }
118
- const doc = document;
119
- // Try standard method first
120
- if (document.exitFullscreen) {
121
- return document.exitFullscreen();
122
- }
123
- // Vendor prefixed fallbacks
124
- if (doc.webkitExitFullscreen) {
125
- return doc.webkitExitFullscreen();
126
- }
127
- if (doc.mozCancelFullScreen) {
128
- return doc.mozCancelFullScreen();
129
- }
130
- if (doc.msExitFullscreen) {
131
- return doc.msExitFullscreen();
132
- }
133
- throw new Error('Fullscreen API is not supported in this browser');
134
- }
135
- /**
136
- * Toggles fullscreen mode for the specified element
137
- *
138
- * @param {HTMLElement} [element] - Element to toggle (defaults to document.documentElement)
139
- * @param {FullscreenOptions} [options] - Fullscreen options
140
- * @returns {Promise<boolean>} Promise that resolves to new fullscreen state
141
- * @example
142
- * ```typescript
143
- * const isFullscreen = await toggleFullscreen();
144
- * console.log('Fullscreen active:', isFullscreen);
145
- * ```
146
- */
147
- export async function toggleFullscreen(element, options) {
148
- if (isFullscreen()) {
149
- await exitFullscreen();
150
- return false;
151
- }
152
- else {
153
- await enterFullscreen(element, options);
154
- return true;
155
- }
156
- }
157
- /**
158
- * Subscribes to fullscreen change events
159
- *
160
- * @param {FullscreenChangeHandler} handler - Callback fired when fullscreen state changes
161
- * @returns {() => void} Unsubscribe function
162
- * @example
163
- * ```typescript
164
- * const unsubscribe = onFullscreenChange((isFullscreen) => {
165
- * console.log('Fullscreen changed:', isFullscreen);
166
- * });
167
- *
168
- * // Later: unsubscribe();
169
- * ```
170
- */
171
- export function onFullscreenChange(handler) {
172
- if (typeof document === 'undefined') {
173
- return () => {
174
- // No-op in server environment
175
- };
176
- }
177
- const handleChange = () => {
178
- handler(isFullscreen());
179
- };
180
- // Standard event
181
- document.addEventListener('fullscreenchange', handleChange);
182
- // Vendor prefixed events
183
- document.addEventListener('webkitfullscreenchange', handleChange);
184
- document.addEventListener('mozfullscreenchange', handleChange);
185
- document.addEventListener('MSFullscreenChange', handleChange);
186
- // Return unsubscribe function
187
- return () => {
188
- document.removeEventListener('fullscreenchange', handleChange);
189
- document.removeEventListener('webkitfullscreenchange', handleChange);
190
- document.removeEventListener('mozfullscreenchange', handleChange);
191
- document.removeEventListener('MSFullscreenChange', handleChange);
192
- };
193
- }
194
- /**
195
- * Gets the current fullscreen element
196
- *
197
- * @returns {Element | null} The element currently in fullscreen, or null
198
- * @example
199
- * ```typescript
200
- * const element = getFullscreenElement();
201
- * if (element) {
202
- * console.log('Fullscreen element:', element.tagName);
203
- * }
204
- * ```
205
- */
206
- export function getFullscreenElement() {
207
- if (typeof document === 'undefined') {
208
- return null;
209
- }
210
- const doc = document;
211
- return (doc.fullscreenElement ??
212
- doc.webkitFullscreenElement ??
213
- doc.mozFullScreenElement ??
214
- doc.msFullscreenElement ??
215
- null);
216
- }
217
- /**
218
- * Locks screen orientation when in fullscreen (mobile devices)
219
- *
220
- * @param {OrientationLockType} orientation - Orientation to lock to
221
- * @returns {Promise<void>} Promise that resolves when orientation is locked
222
- * @example
223
- * ```typescript
224
- * await lockOrientation('landscape');
225
- * await enterFullscreen();
226
- * ```
227
- */
228
- export async function lockOrientation(orientation) {
229
- if (typeof screen === 'undefined' || !screen.orientation) {
230
- return Promise.reject(new Error('Screen Orientation API not supported'));
231
- }
232
- // Type assertion for lock method which may not be in all TypeScript lib versions
233
- const orientationApi = screen.orientation;
234
- if (!orientationApi.lock) {
235
- return Promise.reject(new Error('Screen orientation lock not supported'));
236
- }
237
- try {
238
- await orientationApi.lock(orientation);
239
- }
240
- catch (error) {
241
- return Promise.reject(error);
242
- }
243
- }
244
- /**
245
- * Unlocks screen orientation
246
- *
247
- * @returns {Promise<void>} Promise that resolves when orientation is unlocked
248
- * @example
249
- * ```typescript
250
- * await unlockOrientation();
251
- * ```
252
- */
253
- export async function unlockOrientation() {
254
- if (typeof screen === 'undefined' || !screen.orientation) {
255
- return Promise.resolve();
256
- }
257
- // Type assertion for unlock method which may not be in all TypeScript lib versions
258
- const orientationApi = screen.orientation;
259
- try {
260
- orientationApi.unlock?.();
261
- }
262
- catch {
263
- // Ignore unlock errors
264
- }
265
- }
266
- // Default export
267
- export default {
268
- isFullscreenSupported,
269
- isFullscreen,
270
- enterFullscreen,
271
- exitFullscreen,
272
- toggleFullscreen,
273
- onFullscreenChange,
274
- getFullscreenElement,
275
- lockOrientation,
276
- unlockOrientation,
277
- };
@@ -1,210 +0,0 @@
1
- /**
2
- * @fileoverview Session storage utilities for gizzi-code integration
3
- * @module utils/sessionStorage
4
- *
5
- * Provides session persistence, storage management, and user type detection
6
- * with safe fallbacks for environments without storage access.
7
- */
8
- import type { UserSession } from '../state/AppStateStore';
9
- import type { TypedMessage } from '../types/message';
10
- /**
11
- * Storage keys used throughout the application
12
- * @constant {Record<string, string>}
13
- */
14
- export declare const STORAGE_KEYS: {
15
- readonly SESSION: "gizzi_session";
16
- readonly USER_TYPE: "gizzi_user_type";
17
- readonly MESSAGES: "gizzi_messages";
18
- readonly PREFERENCES: "gizzi_preferences";
19
- readonly LAST_ACTIVITY: "gizzi_last_activity";
20
- readonly SESSION_METADATA: "gizzi_session_metadata";
21
- };
22
- /**
23
- * User type categories
24
- * @typedef {'anonymous' | 'free' | 'pro' | 'enterprise' | 'admin'} UserType
25
- */
26
- export type UserType = 'anonymous' | 'free' | 'pro' | 'enterprise' | 'admin';
27
- /**
28
- * Valid user types for runtime validation
29
- * @constant {readonly UserType[]}
30
- */
31
- export declare const VALID_USER_TYPES: readonly UserType[];
32
- /**
33
- * Session metadata stored alongside the session
34
- * @interface SessionMetadata
35
- */
36
- export interface SessionMetadata {
37
- /** When the session was created */
38
- readonly createdAt: string;
39
- /** Last activity timestamp (ISO string) */
40
- readonly lastActivity: string;
41
- /** Number of messages in this session */
42
- readonly messageCount: number;
43
- /** Session version for migration purposes */
44
- readonly version: number;
45
- /** Device/browser information */
46
- readonly deviceInfo?: {
47
- readonly userAgent: string;
48
- readonly platform: string;
49
- readonly language: string;
50
- };
51
- }
52
- /**
53
- * Complete session data structure
54
- * @interface SessionData
55
- */
56
- export interface SessionData {
57
- /** User session information */
58
- readonly session: UserSession;
59
- /** Session metadata */
60
- readonly metadata: SessionMetadata;
61
- /** Persisted messages */
62
- readonly messages: readonly TypedMessage[];
63
- /** User preferences */
64
- readonly preferences: Readonly<Record<string, unknown>>;
65
- }
66
- /**
67
- * Storage operation result
68
- * @interface StorageResult
69
- */
70
- export interface StorageResult<T> {
71
- /** Whether the operation succeeded */
72
- readonly success: boolean;
73
- /** The data if successful, null otherwise */
74
- readonly data: T | null;
75
- /** Error message if failed */
76
- readonly error: string | null;
77
- }
78
- /**
79
- * Saves the current session to storage
80
- *
81
- * @param {UserSession} session - The session to save
82
- * @param {Object} [options] - Save options
83
- * @param {TypedMessage[]} [options.messages] - Messages to persist
84
- * @param {Record<string, unknown>} [options.preferences] - Preferences to persist
85
- * @returns {StorageResult<void>} Result of the save operation
86
- * @example
87
- * ```typescript
88
- * const result = saveSession(session, { messages, preferences });
89
- * if (!result.success) {
90
- * console.error('Failed to save session:', result.error);
91
- * }
92
- * ```
93
- */
94
- export declare function saveSession(session: UserSession, options?: {
95
- messages?: TypedMessage[];
96
- preferences?: Record<string, unknown>;
97
- }): StorageResult<void>;
98
- /**
99
- * Loads the session from storage
100
- *
101
- * @returns {StorageResult<SessionData>} The loaded session data or error
102
- * @example
103
- * ```typescript
104
- * const result = loadSession();
105
- * if (result.success && result.data) {
106
- * const { session, messages } = result.data;
107
- * // Restore session...
108
- * }
109
- * ```
110
- */
111
- export declare function loadSession(): StorageResult<SessionData>;
112
- /**
113
- * Clears all session data from storage
114
- *
115
- * @returns {boolean} True if successful
116
- * @example
117
- * ```typescript
118
- * clearSession(); // Logs out the user
119
- * ```
120
- */
121
- export declare function clearSession(): boolean;
122
- /**
123
- * Gets the user type from storage
124
- * Returns 'anonymous' if no user type is stored or on error
125
- *
126
- * @returns {UserType} The stored user type or 'anonymous'
127
- * @example
128
- * ```typescript
129
- * const userType = getUserType();
130
- * if (userType === 'pro') {
131
- * // Show pro features
132
- * }
133
- * ```
134
- */
135
- export declare function getUserType(): UserType;
136
- /**
137
- * Saves messages to session storage
138
- *
139
- * @param {TypedMessage[]} messages - Messages to save
140
- * @returns {StorageResult<void>} Result of the operation
141
- */
142
- export declare function saveMessages(messages: TypedMessage[]): StorageResult<void>;
143
- /**
144
- * Loads messages from session storage
145
- *
146
- * @returns {StorageResult<TypedMessage[]>} The loaded messages or error
147
- */
148
- export declare function loadMessages(): StorageResult<TypedMessage[]>;
149
- /**
150
- * Saves user preferences to storage
151
- *
152
- * @param {Record<string, unknown>} preferences - Preferences to save
153
- * @returns {StorageResult<void>} Result of the operation
154
- */
155
- export declare function savePreferences(preferences: Record<string, unknown>): StorageResult<void>;
156
- /**
157
- * Loads user preferences from storage
158
- *
159
- * @returns {StorageResult<Record<string, unknown>>} The loaded preferences or error
160
- */
161
- export declare function loadPreferences(): StorageResult<Record<string, unknown>>;
162
- /**
163
- * Gets the timestamp of the last user activity
164
- *
165
- * @returns {Date | null} The last activity date or null if not found
166
- */
167
- export declare function getLastActivity(): Date | null;
168
- /**
169
- * Updates the last activity timestamp to now
170
- *
171
- * @returns {boolean} True if successful
172
- */
173
- export declare function updateLastActivity(): boolean;
174
- /**
175
- * Checks if there is an active session in storage
176
- *
177
- * @returns {boolean} True if a valid session exists
178
- */
179
- export declare function hasActiveSession(): boolean;
180
- /**
181
- * Type guard to check if a value is a valid UserType
182
- *
183
- * @param {unknown} value - The value to check
184
- * @returns {boolean} True if the value is a valid UserType
185
- */
186
- export declare function isUserType(value: unknown): value is UserType;
187
- declare const _default: {
188
- STORAGE_KEYS: {
189
- readonly SESSION: "gizzi_session";
190
- readonly USER_TYPE: "gizzi_user_type";
191
- readonly MESSAGES: "gizzi_messages";
192
- readonly PREFERENCES: "gizzi_preferences";
193
- readonly LAST_ACTIVITY: "gizzi_last_activity";
194
- readonly SESSION_METADATA: "gizzi_session_metadata";
195
- };
196
- VALID_USER_TYPES: readonly UserType[];
197
- saveSession: typeof saveSession;
198
- loadSession: typeof loadSession;
199
- clearSession: typeof clearSession;
200
- getUserType: typeof getUserType;
201
- saveMessages: typeof saveMessages;
202
- loadMessages: typeof loadMessages;
203
- savePreferences: typeof savePreferences;
204
- loadPreferences: typeof loadPreferences;
205
- getLastActivity: typeof getLastActivity;
206
- updateLastActivity: typeof updateLastActivity;
207
- hasActiveSession: typeof hasActiveSession;
208
- isUserType: typeof isUserType;
209
- };
210
- export default _default;