@allternit/gizzi-code 1.0.0

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 (64) hide show
  1. package/WORKSPACE_INTEGRATION.md +290 -0
  2. package/chat-sessions/sessions-index.json +98 -0
  3. package/package.json +43 -0
  4. package/package.json.original +31 -0
  5. package/package.json.publish +47 -0
  6. package/src/bootstrap/state.d.ts +169 -0
  7. package/src/bootstrap/state.js +261 -0
  8. package/src/bootstrap/state.ts +371 -0
  9. package/src/context/pack-builder.d.ts +24 -0
  10. package/src/context/pack-builder.js +281 -0
  11. package/src/context/pack-builder.ts +334 -0
  12. package/src/hooks/useExitOnCtrlCD.d.ts +86 -0
  13. package/src/hooks/useExitOnCtrlCD.js +130 -0
  14. package/src/hooks/useExitOnCtrlCD.ts +202 -0
  15. package/src/hooks/useKeybinding.d.ts +89 -0
  16. package/src/hooks/useKeybinding.js +163 -0
  17. package/src/hooks/useKeybinding.ts +226 -0
  18. package/src/hooks/useTerminalSize.d.ts +41 -0
  19. package/src/hooks/useTerminalSize.js +90 -0
  20. package/src/hooks/useTerminalSize.ts +117 -0
  21. package/src/index.d.ts +23 -0
  22. package/src/index.js +24 -0
  23. package/src/index.ts +132 -0
  24. package/src/runtime/brand/brand.d.ts +488 -0
  25. package/src/runtime/brand/brand.js +464 -0
  26. package/src/runtime/brand/brand.ts +667 -0
  27. package/src/runtime/services/tokenEstimation.d.ts +187 -0
  28. package/src/runtime/services/tokenEstimation.js +423 -0
  29. package/src/runtime/services/tokenEstimation.ts +547 -0
  30. package/src/runtime/tools/Tool.d.ts +239 -0
  31. package/src/runtime/tools/Tool.js +285 -0
  32. package/src/runtime/tools/Tool.ts +524 -0
  33. package/src/scheduler/TaskScheduler.d.ts +98 -0
  34. package/src/scheduler/TaskScheduler.js +201 -0
  35. package/src/scheduler/TaskScheduler.ts +259 -0
  36. package/src/state/AppStateStore.d.ts +347 -0
  37. package/src/state/AppStateStore.js +439 -0
  38. package/src/state/AppStateStore.ts +658 -0
  39. package/src/state/WorkspaceStateStore.d.ts +43 -0
  40. package/src/state/WorkspaceStateStore.js +224 -0
  41. package/src/state/WorkspaceStateStore.ts +297 -0
  42. package/src/types/message.d.ts +190 -0
  43. package/src/types/message.js +77 -0
  44. package/src/types/message.ts +277 -0
  45. package/src/utils/format.d.ts +126 -0
  46. package/src/utils/format.js +230 -0
  47. package/src/utils/format.ts +336 -0
  48. package/src/utils/fullscreen.d.ts +161 -0
  49. package/src/utils/fullscreen.js +277 -0
  50. package/src/utils/fullscreen.ts +382 -0
  51. package/src/utils/sessionStorage.d.ts +210 -0
  52. package/src/utils/sessionStorage.js +435 -0
  53. package/src/utils/sessionStorage.ts +559 -0
  54. package/src/watcher/WorkspaceWatcher.d.ts +70 -0
  55. package/src/watcher/WorkspaceWatcher.js +191 -0
  56. package/src/watcher/WorkspaceWatcher.ts +251 -0
  57. package/src/workspace/loader.d.ts +30 -0
  58. package/src/workspace/loader.js +117 -0
  59. package/src/workspace/loader.ts +171 -0
  60. package/src/workspace/types.d.ts +91 -0
  61. package/src/workspace/types.js +7 -0
  62. package/src/workspace/types.ts +122 -0
  63. package/threads/thread_1775361175022.json +9 -0
  64. package/tsconfig.json +14 -0
@@ -0,0 +1,190 @@
1
+ /**
2
+ * @fileoverview Message types for gizzi-code integration
3
+ * @module types/message
4
+ *
5
+ * Defines core message interfaces and types used across the application
6
+ * for chat, notifications, and system communications.
7
+ */
8
+ /**
9
+ * Represents the possible roles a message can have in a conversation
10
+ * @typedef {'user' | 'assistant' | 'system'} MessageRole
11
+ */
12
+ export type MessageRole = 'user' | 'assistant' | 'system';
13
+ /**
14
+ * Valid message role values for runtime validation
15
+ * @constant {MessageRole[]}
16
+ */
17
+ export declare const MESSAGE_ROLES: readonly MessageRole[];
18
+ /**
19
+ * Supported MIME types for message attachments
20
+ * @typedef {string} AttachmentMimeType
21
+ */
22
+ export type AttachmentMimeType = 'image/png' | 'image/jpeg' | 'image/gif' | 'image/webp' | 'image/svg+xml' | 'text/plain' | 'text/markdown' | 'text/html' | 'application/json' | 'application/pdf' | 'application/zip' | 'audio/mpeg' | 'audio/wav' | 'video/mp4' | 'video/webm' | string;
23
+ /**
24
+ * Attachment metadata and content structure
25
+ * @interface Attachment
26
+ */
27
+ export interface Attachment {
28
+ /** Unique identifier for the attachment */
29
+ readonly id: string;
30
+ /** Original filename */
31
+ readonly name: string;
32
+ /** MIME type of the attachment */
33
+ readonly mimeType: AttachmentMimeType;
34
+ /** File size in bytes */
35
+ readonly size: number;
36
+ /** Data URL or storage reference for the attachment content */
37
+ readonly url: string;
38
+ /** Optional preview/thumbnail URL for image/video attachments */
39
+ readonly previewUrl?: string;
40
+ /** Optional caption or description */
41
+ readonly caption?: string;
42
+ /** Timestamp when the attachment was created */
43
+ readonly createdAt: Date;
44
+ /** Optional metadata for specific attachment types */
45
+ readonly metadata?: Readonly<Record<string, unknown>>;
46
+ }
47
+ /**
48
+ * Message status indicators
49
+ * @typedef {'pending' | 'sent' | 'delivered' | 'read' | 'error'} MessageStatus
50
+ */
51
+ export type MessageStatus = 'pending' | 'sent' | 'delivered' | 'read' | 'error';
52
+ /**
53
+ * Core message structure for all communications
54
+ * @interface Message
55
+ */
56
+ export interface Message {
57
+ /** Unique message identifier */
58
+ readonly id: string;
59
+ /** Message role identifying the sender type */
60
+ readonly role: MessageRole;
61
+ /** Message content - can be text or structured data */
62
+ readonly content: string;
63
+ /** Optional timestamp when the message was created */
64
+ readonly timestamp?: Date;
65
+ /** Optional array of file attachments */
66
+ readonly attachments?: readonly Attachment[];
67
+ /** Current status of the message delivery */
68
+ readonly status?: MessageStatus;
69
+ /** Optional metadata for extended message properties */
70
+ readonly metadata?: Readonly<Record<string, unknown>>;
71
+ /** Optional ID of the message this is replying to */
72
+ readonly replyTo?: string;
73
+ /** Optional edit history for tracking modifications */
74
+ readonly edits?: ReadonlyArray<{
75
+ readonly content: string;
76
+ readonly timestamp: Date;
77
+ }>;
78
+ }
79
+ /**
80
+ * System-specific message with additional metadata
81
+ * @interface SystemMessage
82
+ * @extends Message
83
+ */
84
+ export interface SystemMessage extends Message {
85
+ readonly role: 'system';
86
+ /** System message type categorization */
87
+ readonly systemType: 'notification' | 'error' | 'warning' | 'info' | 'command';
88
+ /** Optional action button or link */
89
+ readonly action?: {
90
+ readonly label: string;
91
+ readonly handler: string;
92
+ readonly payload?: unknown;
93
+ };
94
+ }
95
+ /**
96
+ * User message with optional context
97
+ * @interface UserMessage
98
+ * @extends Message
99
+ */
100
+ export interface UserMessage extends Message {
101
+ readonly role: 'user';
102
+ /** Optional session or conversation context */
103
+ readonly context?: Readonly<Record<string, unknown>>;
104
+ }
105
+ /**
106
+ * Assistant/AI response message with optional thinking/reasoning
107
+ * @interface AssistantMessage
108
+ * @extends Message
109
+ */
110
+ export interface AssistantMessage extends Message {
111
+ readonly role: 'assistant';
112
+ /** Optional thinking/reasoning process for the response */
113
+ readonly reasoning?: string;
114
+ /** Token usage statistics for the response */
115
+ readonly tokenUsage?: {
116
+ readonly prompt: number;
117
+ readonly completion: number;
118
+ readonly total: number;
119
+ };
120
+ /** Model identifier that generated the response */
121
+ readonly model?: string;
122
+ }
123
+ /**
124
+ * Union type for all message variants
125
+ * @typedef {UserMessage | AssistantMessage | SystemMessage} TypedMessage
126
+ */
127
+ export type TypedMessage = UserMessage | AssistantMessage | SystemMessage;
128
+ /**
129
+ * Message thread/conversation structure
130
+ * @interface MessageThread
131
+ */
132
+ export interface MessageThread {
133
+ /** Unique thread identifier */
134
+ readonly id: string;
135
+ /** Thread title or subject */
136
+ readonly title?: string;
137
+ /** Array of messages in the thread */
138
+ readonly messages: readonly TypedMessage[];
139
+ /** Thread creation timestamp */
140
+ readonly createdAt: Date;
141
+ /** Last activity timestamp */
142
+ readonly updatedAt: Date;
143
+ /** Optional metadata for the thread */
144
+ readonly metadata?: Readonly<Record<string, unknown>>;
145
+ }
146
+ /**
147
+ * Type guard to check if a message is from a user
148
+ * @param {Message} message - The message to check
149
+ * @returns {boolean} True if the message is from a user
150
+ */
151
+ export declare function isUserMessage(message: Message): message is UserMessage;
152
+ /**
153
+ * Type guard to check if a message is from the assistant
154
+ * @param {Message} message - The message to check
155
+ * @returns {boolean} True if the message is from the assistant
156
+ */
157
+ export declare function isAssistantMessage(message: Message): message is AssistantMessage;
158
+ /**
159
+ * Type guard to check if a message is a system message
160
+ * @param {Message} message - The message to check
161
+ * @returns {boolean} True if the message is a system message
162
+ */
163
+ export declare function isSystemMessage(message: Message): message is SystemMessage;
164
+ /**
165
+ * Type guard to check if a value is a valid MessageRole
166
+ * @param {unknown} value - The value to check
167
+ * @returns {boolean} True if the value is a valid MessageRole
168
+ */
169
+ export declare function isMessageRole(value: unknown): value is MessageRole;
170
+ /**
171
+ * Creates a new message with proper defaults
172
+ * @param {Object} params - Message creation parameters
173
+ * @returns {Message} A new message object
174
+ */
175
+ export declare function createMessage(params: {
176
+ role: MessageRole;
177
+ content: string;
178
+ attachments?: Attachment[];
179
+ metadata?: Record<string, unknown>;
180
+ replyTo?: string;
181
+ }): Message;
182
+ declare const _default: {
183
+ MESSAGE_ROLES: readonly MessageRole[];
184
+ isUserMessage: typeof isUserMessage;
185
+ isAssistantMessage: typeof isAssistantMessage;
186
+ isSystemMessage: typeof isSystemMessage;
187
+ isMessageRole: typeof isMessageRole;
188
+ createMessage: typeof createMessage;
189
+ };
190
+ export default _default;
@@ -0,0 +1,77 @@
1
+ /**
2
+ * @fileoverview Message types for gizzi-code integration
3
+ * @module types/message
4
+ *
5
+ * Defines core message interfaces and types used across the application
6
+ * for chat, notifications, and system communications.
7
+ */
8
+ /**
9
+ * Valid message role values for runtime validation
10
+ * @constant {MessageRole[]}
11
+ */
12
+ export const MESSAGE_ROLES = ['user', 'assistant', 'system'];
13
+ /**
14
+ * Type guard to check if a message is from a user
15
+ * @param {Message} message - The message to check
16
+ * @returns {boolean} True if the message is from a user
17
+ */
18
+ export function isUserMessage(message) {
19
+ return message.role === 'user';
20
+ }
21
+ /**
22
+ * Type guard to check if a message is from the assistant
23
+ * @param {Message} message - The message to check
24
+ * @returns {boolean} True if the message is from the assistant
25
+ */
26
+ export function isAssistantMessage(message) {
27
+ return message.role === 'assistant';
28
+ }
29
+ /**
30
+ * Type guard to check if a message is a system message
31
+ * @param {Message} message - The message to check
32
+ * @returns {boolean} True if the message is a system message
33
+ */
34
+ export function isSystemMessage(message) {
35
+ return message.role === 'system';
36
+ }
37
+ /**
38
+ * Type guard to check if a value is a valid MessageRole
39
+ * @param {unknown} value - The value to check
40
+ * @returns {boolean} True if the value is a valid MessageRole
41
+ */
42
+ export function isMessageRole(value) {
43
+ return typeof value === 'string' && MESSAGE_ROLES.includes(value);
44
+ }
45
+ /**
46
+ * Creates a new message with proper defaults
47
+ * @param {Object} params - Message creation parameters
48
+ * @returns {Message} A new message object
49
+ */
50
+ export function createMessage(params) {
51
+ return {
52
+ id: generateMessageId(),
53
+ role: params.role,
54
+ content: params.content,
55
+ timestamp: new Date(),
56
+ status: 'pending',
57
+ ...(params.attachments && { attachments: params.attachments }),
58
+ ...(params.metadata && { metadata: params.metadata }),
59
+ ...(params.replyTo && { replyTo: params.replyTo }),
60
+ };
61
+ }
62
+ /**
63
+ * Generates a unique message ID
64
+ * @returns {string} A unique identifier
65
+ */
66
+ function generateMessageId() {
67
+ return `msg_${Date.now()}_${Math.random().toString(36).substring(2, 11)}`;
68
+ }
69
+ // Default export for convenient importing
70
+ export default {
71
+ MESSAGE_ROLES,
72
+ isUserMessage,
73
+ isAssistantMessage,
74
+ isSystemMessage,
75
+ isMessageRole,
76
+ createMessage,
77
+ };
@@ -0,0 +1,277 @@
1
+ /**
2
+ * @fileoverview Message types for gizzi-code integration
3
+ * @module types/message
4
+ *
5
+ * Defines core message interfaces and types used across the application
6
+ * for chat, notifications, and system communications.
7
+ */
8
+
9
+ /**
10
+ * Represents the possible roles a message can have in a conversation
11
+ * @typedef {'user' | 'assistant' | 'system'} MessageRole
12
+ */
13
+ export type MessageRole = 'user' | 'assistant' | 'system';
14
+
15
+ /**
16
+ * Valid message role values for runtime validation
17
+ * @constant {MessageRole[]}
18
+ */
19
+ export const MESSAGE_ROLES: readonly MessageRole[] = ['user', 'assistant', 'system'] as const;
20
+
21
+ /**
22
+ * Supported MIME types for message attachments
23
+ * @typedef {string} AttachmentMimeType
24
+ */
25
+ export type AttachmentMimeType =
26
+ | 'image/png'
27
+ | 'image/jpeg'
28
+ | 'image/gif'
29
+ | 'image/webp'
30
+ | 'image/svg+xml'
31
+ | 'text/plain'
32
+ | 'text/markdown'
33
+ | 'text/html'
34
+ | 'application/json'
35
+ | 'application/pdf'
36
+ | 'application/zip'
37
+ | 'audio/mpeg'
38
+ | 'audio/wav'
39
+ | 'video/mp4'
40
+ | 'video/webm'
41
+ | string;
42
+
43
+ /**
44
+ * Attachment metadata and content structure
45
+ * @interface Attachment
46
+ */
47
+ export interface Attachment {
48
+ /** Unique identifier for the attachment */
49
+ readonly id: string;
50
+
51
+ /** Original filename */
52
+ readonly name: string;
53
+
54
+ /** MIME type of the attachment */
55
+ readonly mimeType: AttachmentMimeType;
56
+
57
+ /** File size in bytes */
58
+ readonly size: number;
59
+
60
+ /** Data URL or storage reference for the attachment content */
61
+ readonly url: string;
62
+
63
+ /** Optional preview/thumbnail URL for image/video attachments */
64
+ readonly previewUrl?: string;
65
+
66
+ /** Optional caption or description */
67
+ readonly caption?: string;
68
+
69
+ /** Timestamp when the attachment was created */
70
+ readonly createdAt: Date;
71
+
72
+ /** Optional metadata for specific attachment types */
73
+ readonly metadata?: Readonly<Record<string, unknown>>;
74
+ }
75
+
76
+ /**
77
+ * Message status indicators
78
+ * @typedef {'pending' | 'sent' | 'delivered' | 'read' | 'error'} MessageStatus
79
+ */
80
+ export type MessageStatus = 'pending' | 'sent' | 'delivered' | 'read' | 'error';
81
+
82
+ /**
83
+ * Core message structure for all communications
84
+ * @interface Message
85
+ */
86
+ export interface Message {
87
+ /** Unique message identifier */
88
+ readonly id: string;
89
+
90
+ /** Message role identifying the sender type */
91
+ readonly role: MessageRole;
92
+
93
+ /** Message content - can be text or structured data */
94
+ readonly content: string;
95
+
96
+ /** Optional timestamp when the message was created */
97
+ readonly timestamp?: Date;
98
+
99
+ /** Optional array of file attachments */
100
+ readonly attachments?: readonly Attachment[];
101
+
102
+ /** Current status of the message delivery */
103
+ readonly status?: MessageStatus;
104
+
105
+ /** Optional metadata for extended message properties */
106
+ readonly metadata?: Readonly<Record<string, unknown>>;
107
+
108
+ /** Optional ID of the message this is replying to */
109
+ readonly replyTo?: string;
110
+
111
+ /** Optional edit history for tracking modifications */
112
+ readonly edits?: ReadonlyArray<{
113
+ readonly content: string;
114
+ readonly timestamp: Date;
115
+ }>;
116
+ }
117
+
118
+ /**
119
+ * System-specific message with additional metadata
120
+ * @interface SystemMessage
121
+ * @extends Message
122
+ */
123
+ export interface SystemMessage extends Message {
124
+ readonly role: 'system';
125
+
126
+ /** System message type categorization */
127
+ readonly systemType: 'notification' | 'error' | 'warning' | 'info' | 'command';
128
+
129
+ /** Optional action button or link */
130
+ readonly action?: {
131
+ readonly label: string;
132
+ readonly handler: string;
133
+ readonly payload?: unknown;
134
+ };
135
+ }
136
+
137
+ /**
138
+ * User message with optional context
139
+ * @interface UserMessage
140
+ * @extends Message
141
+ */
142
+ export interface UserMessage extends Message {
143
+ readonly role: 'user';
144
+
145
+ /** Optional session or conversation context */
146
+ readonly context?: Readonly<Record<string, unknown>>;
147
+ }
148
+
149
+ /**
150
+ * Assistant/AI response message with optional thinking/reasoning
151
+ * @interface AssistantMessage
152
+ * @extends Message
153
+ */
154
+ export interface AssistantMessage extends Message {
155
+ readonly role: 'assistant';
156
+
157
+ /** Optional thinking/reasoning process for the response */
158
+ readonly reasoning?: string;
159
+
160
+ /** Token usage statistics for the response */
161
+ readonly tokenUsage?: {
162
+ readonly prompt: number;
163
+ readonly completion: number;
164
+ readonly total: number;
165
+ };
166
+
167
+ /** Model identifier that generated the response */
168
+ readonly model?: string;
169
+ }
170
+
171
+ /**
172
+ * Union type for all message variants
173
+ * @typedef {UserMessage | AssistantMessage | SystemMessage} TypedMessage
174
+ */
175
+ export type TypedMessage = UserMessage | AssistantMessage | SystemMessage;
176
+
177
+ /**
178
+ * Message thread/conversation structure
179
+ * @interface MessageThread
180
+ */
181
+ export interface MessageThread {
182
+ /** Unique thread identifier */
183
+ readonly id: string;
184
+
185
+ /** Thread title or subject */
186
+ readonly title?: string;
187
+
188
+ /** Array of messages in the thread */
189
+ readonly messages: readonly TypedMessage[];
190
+
191
+ /** Thread creation timestamp */
192
+ readonly createdAt: Date;
193
+
194
+ /** Last activity timestamp */
195
+ readonly updatedAt: Date;
196
+
197
+ /** Optional metadata for the thread */
198
+ readonly metadata?: Readonly<Record<string, unknown>>;
199
+ }
200
+
201
+ /**
202
+ * Type guard to check if a message is from a user
203
+ * @param {Message} message - The message to check
204
+ * @returns {boolean} True if the message is from a user
205
+ */
206
+ export function isUserMessage(message: Message): message is UserMessage {
207
+ return message.role === 'user';
208
+ }
209
+
210
+ /**
211
+ * Type guard to check if a message is from the assistant
212
+ * @param {Message} message - The message to check
213
+ * @returns {boolean} True if the message is from the assistant
214
+ */
215
+ export function isAssistantMessage(message: Message): message is AssistantMessage {
216
+ return message.role === 'assistant';
217
+ }
218
+
219
+ /**
220
+ * Type guard to check if a message is a system message
221
+ * @param {Message} message - The message to check
222
+ * @returns {boolean} True if the message is a system message
223
+ */
224
+ export function isSystemMessage(message: Message): message is SystemMessage {
225
+ return message.role === 'system';
226
+ }
227
+
228
+ /**
229
+ * Type guard to check if a value is a valid MessageRole
230
+ * @param {unknown} value - The value to check
231
+ * @returns {boolean} True if the value is a valid MessageRole
232
+ */
233
+ export function isMessageRole(value: unknown): value is MessageRole {
234
+ return typeof value === 'string' && MESSAGE_ROLES.includes(value as MessageRole);
235
+ }
236
+
237
+ /**
238
+ * Creates a new message with proper defaults
239
+ * @param {Object} params - Message creation parameters
240
+ * @returns {Message} A new message object
241
+ */
242
+ export function createMessage(params: {
243
+ role: MessageRole;
244
+ content: string;
245
+ attachments?: Attachment[];
246
+ metadata?: Record<string, unknown>;
247
+ replyTo?: string;
248
+ }): Message {
249
+ return {
250
+ id: generateMessageId(),
251
+ role: params.role,
252
+ content: params.content,
253
+ timestamp: new Date(),
254
+ status: 'pending',
255
+ ...(params.attachments && { attachments: params.attachments }),
256
+ ...(params.metadata && { metadata: params.metadata }),
257
+ ...(params.replyTo && { replyTo: params.replyTo }),
258
+ };
259
+ }
260
+
261
+ /**
262
+ * Generates a unique message ID
263
+ * @returns {string} A unique identifier
264
+ */
265
+ function generateMessageId(): string {
266
+ return `msg_${Date.now()}_${Math.random().toString(36).substring(2, 11)}`;
267
+ }
268
+
269
+ // Default export for convenient importing
270
+ export default {
271
+ MESSAGE_ROLES,
272
+ isUserMessage,
273
+ isAssistantMessage,
274
+ isSystemMessage,
275
+ isMessageRole,
276
+ createMessage,
277
+ };
@@ -0,0 +1,126 @@
1
+ /**
2
+ * @fileoverview Format utilities for gizzi-code integration
3
+ * @module utils/format
4
+ *
5
+ * Provides formatting utilities for durations, byte sizes, and numbers.
6
+ * These functions are commonly used in CLI output and display components.
7
+ */
8
+ /**
9
+ * Number format options
10
+ * @interface NumberFormatOptions
11
+ */
12
+ export interface NumberFormatOptions {
13
+ /** Minimum number of decimal places */
14
+ readonly minimumFractionDigits?: number;
15
+ /** Maximum number of decimal places */
16
+ readonly maximumFractionDigits?: number;
17
+ /** Use thousands separator */
18
+ readonly useGrouping?: boolean;
19
+ /** Locale for formatting (default: 'en-US') */
20
+ readonly locale?: string;
21
+ }
22
+ /**
23
+ * Duration format options
24
+ * @interface DurationFormatOptions
25
+ */
26
+ export interface DurationFormatOptions {
27
+ /** Format style (default: 'auto') */
28
+ readonly style?: 'short' | 'long' | 'narrow' | 'auto';
29
+ /** Maximum number of units to display (default: 2) */
30
+ readonly maxUnits?: number;
31
+ /** Include milliseconds in output */
32
+ readonly includeMs?: boolean;
33
+ /** Round to nearest unit */
34
+ readonly round?: boolean;
35
+ }
36
+ /**
37
+ * Byte format options
38
+ * @interface ByteFormatOptions
39
+ */
40
+ export interface ByteFormatOptions {
41
+ /** Number of decimal places (default: 2) */
42
+ readonly decimals?: number;
43
+ /** Use binary units (KiB, MiB) instead of decimal (KB, MB) */
44
+ readonly binary?: boolean;
45
+ /** Include space between value and unit */
46
+ readonly space?: boolean;
47
+ }
48
+ /**
49
+ * Formats a duration in milliseconds to a human-readable string
50
+ *
51
+ * @param {number} ms - Duration in milliseconds
52
+ * @param {DurationFormatOptions} [options] - Format options
53
+ * @returns {string} Formatted duration string
54
+ * @example
55
+ * ```typescript
56
+ * formatDuration(5000); // "5s"
57
+ * formatDuration(65000); // "1m 5s"
58
+ * formatDuration(3600000); // "1h"
59
+ * formatDuration(90000, { style: 'long' }); // "1 minute 30 seconds"
60
+ * ```
61
+ */
62
+ export declare function formatDuration(ms: number, options?: DurationFormatOptions): string;
63
+ /**
64
+ * Formats a byte size to a human-readable string
65
+ *
66
+ * @param {number} bytes - Size in bytes
67
+ * @param {ByteFormatOptions} [options] - Format options
68
+ * @returns {string} Formatted size string
69
+ * @example
70
+ * ```typescript
71
+ * formatBytes(1024); // "1 KB"
72
+ * formatBytes(1536); // "1.50 KB"
73
+ * formatBytes(1048576); // "1 MB"
74
+ * formatBytes(1024, { binary: true }); // "1 KiB"
75
+ * ```
76
+ */
77
+ export declare function formatBytes(bytes: number, options?: ByteFormatOptions): string;
78
+ /**
79
+ * Formats a number with locale-aware formatting
80
+ *
81
+ * @param {number} num - Number to format
82
+ * @param {NumberFormatOptions} [options] - Format options
83
+ * @returns {string} Formatted number string
84
+ * @example
85
+ * ```typescript
86
+ * formatNumber(1234567); // "1,234,567"
87
+ * formatNumber(1234.5678, { maximumFractionDigits: 2 }); // "1,234.57"
88
+ * formatNumber(0.001234, { minimumFractionDigits: 6 }); // "0.001234"
89
+ * ```
90
+ */
91
+ export declare function formatNumber(num: number, options?: NumberFormatOptions): string;
92
+ /**
93
+ * Formats a number as a percentage
94
+ *
95
+ * @param {number} value - Value to format (0.5 = 50%)
96
+ * @param {number} [decimals=1] - Number of decimal places
97
+ * @returns {string} Formatted percentage string
98
+ * @example
99
+ * ```typescript
100
+ * formatPercentage(0.5); // "50%"
101
+ * formatPercentage(0.1234, 2); // "12.34%"
102
+ * ```
103
+ */
104
+ export declare function formatPercentage(value: number, decimals?: number): string;
105
+ /**
106
+ * Formats a number as compact notation (1K, 1M, etc.)
107
+ *
108
+ * @param {number} num - Number to format
109
+ * @param {number} [decimals=1] - Number of decimal places
110
+ * @returns {string} Compact formatted string
111
+ * @example
112
+ * ```typescript
113
+ * formatCompact(1234); // "1.2K"
114
+ * formatCompact(1000000); // "1M"
115
+ * formatCompact(1234567890); // "1.2B"
116
+ * ```
117
+ */
118
+ export declare function formatCompact(num: number, decimals?: number): string;
119
+ declare const _default: {
120
+ formatDuration: typeof formatDuration;
121
+ formatBytes: typeof formatBytes;
122
+ formatNumber: typeof formatNumber;
123
+ formatPercentage: typeof formatPercentage;
124
+ formatCompact: typeof formatCompact;
125
+ };
126
+ export default _default;