@omote/core 0.1.0 → 0.1.2
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.
- package/dist/Logger-I_k4sGhM.d.mts +141 -0
- package/dist/Logger-I_k4sGhM.d.ts +141 -0
- package/dist/chunk-C3Y37HKD.mjs +26378 -0
- package/dist/chunk-C3Y37HKD.mjs.map +1 -0
- package/dist/chunk-ESU52TDS.mjs +287 -0
- package/dist/chunk-ESU52TDS.mjs.map +1 -0
- package/dist/chunk-NSSMTXJJ.mjs +8 -0
- package/dist/chunk-NSSMTXJJ.mjs.map +1 -0
- package/dist/chunk-RI6UQ7WF.mjs +26378 -0
- package/dist/chunk-RI6UQ7WF.mjs.map +1 -0
- package/dist/chunk-XK22BRG4.mjs +38 -0
- package/dist/chunk-XK22BRG4.mjs.map +1 -0
- package/dist/events/index.d.mts +233 -0
- package/dist/events/index.d.ts +233 -0
- package/dist/events/index.js +60 -0
- package/dist/events/index.js.map +1 -0
- package/dist/events/index.mjs +8 -0
- package/dist/events/index.mjs.map +1 -0
- package/dist/index.d.mts +4 -365
- package/dist/index.d.ts +4 -365
- package/dist/index.js +26539 -155
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +23 -303
- package/dist/index.mjs.map +1 -1
- package/dist/logging/index.d.mts +21 -0
- package/dist/logging/index.d.ts +21 -0
- package/dist/logging/index.js +309 -0
- package/dist/logging/index.js.map +1 -0
- package/dist/logging/index.mjs +34 -0
- package/dist/logging/index.mjs.map +1 -0
- package/dist/transformers.web-4C62MDO6.mjs +1724 -0
- package/dist/transformers.web-4C62MDO6.mjs.map +1 -0
- package/dist/transformers.web-ALDLCPHT.mjs +1725 -0
- package/dist/transformers.web-ALDLCPHT.mjs.map +1 -0
- package/package.json +14 -4
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logging types for Omote SDK
|
|
3
|
+
*
|
|
4
|
+
* 6-level logging system with structured output:
|
|
5
|
+
* - error: Critical failures that prevent operation
|
|
6
|
+
* - warn: Recoverable issues or degraded performance
|
|
7
|
+
* - info: Key lifecycle events (model loaded, inference complete)
|
|
8
|
+
* - debug: Detailed operational info for development
|
|
9
|
+
* - trace: Fine-grained tracing for performance analysis
|
|
10
|
+
* - verbose: Extremely detailed output (tensor shapes, intermediate values)
|
|
11
|
+
*/
|
|
12
|
+
type LogLevel = 'error' | 'warn' | 'info' | 'debug' | 'trace' | 'verbose';
|
|
13
|
+
/**
|
|
14
|
+
* Numeric priority for log levels (lower = more severe)
|
|
15
|
+
*/
|
|
16
|
+
declare const LOG_LEVEL_PRIORITY: Record<LogLevel, number>;
|
|
17
|
+
/**
|
|
18
|
+
* Structured log entry
|
|
19
|
+
*/
|
|
20
|
+
interface LogEntry {
|
|
21
|
+
/** Unix timestamp in milliseconds */
|
|
22
|
+
timestamp: number;
|
|
23
|
+
/** Log level */
|
|
24
|
+
level: LogLevel;
|
|
25
|
+
/** Module name (e.g., 'LocalInference', 'ModelCache') */
|
|
26
|
+
module: string;
|
|
27
|
+
/** Human-readable message */
|
|
28
|
+
message: string;
|
|
29
|
+
/** Optional structured data */
|
|
30
|
+
data?: Record<string, unknown>;
|
|
31
|
+
/** Optional error object */
|
|
32
|
+
error?: Error;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Log output sink interface
|
|
36
|
+
*/
|
|
37
|
+
interface LogSink {
|
|
38
|
+
(entry: LogEntry): void;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Log formatter interface
|
|
42
|
+
*/
|
|
43
|
+
interface LogFormatter {
|
|
44
|
+
(entry: LogEntry): string;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Global logging configuration
|
|
48
|
+
*/
|
|
49
|
+
interface LoggingConfig {
|
|
50
|
+
/** Minimum log level to output (default: 'info') */
|
|
51
|
+
level: LogLevel;
|
|
52
|
+
/** Enable/disable logging globally (default: true) */
|
|
53
|
+
enabled: boolean;
|
|
54
|
+
/** Output format: 'json' for structured, 'pretty' for human-readable */
|
|
55
|
+
format: 'json' | 'pretty';
|
|
56
|
+
/** Custom output sink (default: console) */
|
|
57
|
+
sink?: LogSink;
|
|
58
|
+
/** Include timestamps in output (default: true) */
|
|
59
|
+
timestamps?: boolean;
|
|
60
|
+
/** Include module name in output (default: true) */
|
|
61
|
+
includeModule?: boolean;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Logger interface for module-specific logging
|
|
65
|
+
*/
|
|
66
|
+
interface ILogger {
|
|
67
|
+
error(message: string, data?: Record<string, unknown>): void;
|
|
68
|
+
warn(message: string, data?: Record<string, unknown>): void;
|
|
69
|
+
info(message: string, data?: Record<string, unknown>): void;
|
|
70
|
+
debug(message: string, data?: Record<string, unknown>): void;
|
|
71
|
+
trace(message: string, data?: Record<string, unknown>): void;
|
|
72
|
+
verbose(message: string, data?: Record<string, unknown>): void;
|
|
73
|
+
/** Create a child logger with a sub-module name */
|
|
74
|
+
child(subModule: string): ILogger;
|
|
75
|
+
/** Get the module name for this logger */
|
|
76
|
+
readonly module: string;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Default configuration
|
|
80
|
+
*/
|
|
81
|
+
declare const DEFAULT_LOGGING_CONFIG: LoggingConfig;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Omote SDK Logger
|
|
85
|
+
*
|
|
86
|
+
* Unified logging system with:
|
|
87
|
+
* - 6 log levels (error, warn, info, debug, trace, verbose)
|
|
88
|
+
* - Structured JSON output for machine parsing
|
|
89
|
+
* - Pretty output for human readability
|
|
90
|
+
* - Module-based child loggers
|
|
91
|
+
* - Runtime configuration
|
|
92
|
+
* - Browser and Node.js compatible
|
|
93
|
+
*/
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Configure global logging settings
|
|
97
|
+
*/
|
|
98
|
+
declare function configureLogging(config: Partial<LoggingConfig>): void;
|
|
99
|
+
/**
|
|
100
|
+
* Get current logging configuration
|
|
101
|
+
*/
|
|
102
|
+
declare function getLoggingConfig(): LoggingConfig;
|
|
103
|
+
/**
|
|
104
|
+
* Reset logging configuration to defaults
|
|
105
|
+
*/
|
|
106
|
+
declare function resetLoggingConfig(): void;
|
|
107
|
+
/**
|
|
108
|
+
* Set log level at runtime
|
|
109
|
+
*/
|
|
110
|
+
declare function setLogLevel(level: LogLevel): void;
|
|
111
|
+
/**
|
|
112
|
+
* Enable or disable logging
|
|
113
|
+
*/
|
|
114
|
+
declare function setLoggingEnabled(enabled: boolean): void;
|
|
115
|
+
/**
|
|
116
|
+
* Create a logger for a specific module
|
|
117
|
+
*
|
|
118
|
+
* @param module - Module name (e.g., 'LocalInference', 'ModelCache')
|
|
119
|
+
* @returns Logger instance
|
|
120
|
+
*
|
|
121
|
+
* @example
|
|
122
|
+
* ```typescript
|
|
123
|
+
* const logger = createLogger('LocalInference');
|
|
124
|
+
* logger.info('Model loaded', { backend: 'webgpu', loadTimeMs: 1234 });
|
|
125
|
+
* ```
|
|
126
|
+
*/
|
|
127
|
+
declare function createLogger(module: string): ILogger;
|
|
128
|
+
/**
|
|
129
|
+
* Clear logger cache (useful for testing)
|
|
130
|
+
*/
|
|
131
|
+
declare function clearLoggerCache(): void;
|
|
132
|
+
/**
|
|
133
|
+
* No-op logger for when logging is completely disabled
|
|
134
|
+
*/
|
|
135
|
+
declare const noopLogger: ILogger;
|
|
136
|
+
/**
|
|
137
|
+
* Get a no-op logger (for production builds that tree-shake logging)
|
|
138
|
+
*/
|
|
139
|
+
declare function getNoopLogger(): ILogger;
|
|
140
|
+
|
|
141
|
+
export { DEFAULT_LOGGING_CONFIG as D, type ILogger as I, type LogFormatter as L, type LogLevel as a, type LogEntry as b, type LogSink as c, type LoggingConfig as d, LOG_LEVEL_PRIORITY as e, configureLogging as f, getLoggingConfig as g, setLoggingEnabled as h, createLogger as i, clearLoggerCache as j, getNoopLogger as k, noopLogger as n, resetLoggingConfig as r, setLogLevel as s };
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logging types for Omote SDK
|
|
3
|
+
*
|
|
4
|
+
* 6-level logging system with structured output:
|
|
5
|
+
* - error: Critical failures that prevent operation
|
|
6
|
+
* - warn: Recoverable issues or degraded performance
|
|
7
|
+
* - info: Key lifecycle events (model loaded, inference complete)
|
|
8
|
+
* - debug: Detailed operational info for development
|
|
9
|
+
* - trace: Fine-grained tracing for performance analysis
|
|
10
|
+
* - verbose: Extremely detailed output (tensor shapes, intermediate values)
|
|
11
|
+
*/
|
|
12
|
+
type LogLevel = 'error' | 'warn' | 'info' | 'debug' | 'trace' | 'verbose';
|
|
13
|
+
/**
|
|
14
|
+
* Numeric priority for log levels (lower = more severe)
|
|
15
|
+
*/
|
|
16
|
+
declare const LOG_LEVEL_PRIORITY: Record<LogLevel, number>;
|
|
17
|
+
/**
|
|
18
|
+
* Structured log entry
|
|
19
|
+
*/
|
|
20
|
+
interface LogEntry {
|
|
21
|
+
/** Unix timestamp in milliseconds */
|
|
22
|
+
timestamp: number;
|
|
23
|
+
/** Log level */
|
|
24
|
+
level: LogLevel;
|
|
25
|
+
/** Module name (e.g., 'LocalInference', 'ModelCache') */
|
|
26
|
+
module: string;
|
|
27
|
+
/** Human-readable message */
|
|
28
|
+
message: string;
|
|
29
|
+
/** Optional structured data */
|
|
30
|
+
data?: Record<string, unknown>;
|
|
31
|
+
/** Optional error object */
|
|
32
|
+
error?: Error;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Log output sink interface
|
|
36
|
+
*/
|
|
37
|
+
interface LogSink {
|
|
38
|
+
(entry: LogEntry): void;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Log formatter interface
|
|
42
|
+
*/
|
|
43
|
+
interface LogFormatter {
|
|
44
|
+
(entry: LogEntry): string;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Global logging configuration
|
|
48
|
+
*/
|
|
49
|
+
interface LoggingConfig {
|
|
50
|
+
/** Minimum log level to output (default: 'info') */
|
|
51
|
+
level: LogLevel;
|
|
52
|
+
/** Enable/disable logging globally (default: true) */
|
|
53
|
+
enabled: boolean;
|
|
54
|
+
/** Output format: 'json' for structured, 'pretty' for human-readable */
|
|
55
|
+
format: 'json' | 'pretty';
|
|
56
|
+
/** Custom output sink (default: console) */
|
|
57
|
+
sink?: LogSink;
|
|
58
|
+
/** Include timestamps in output (default: true) */
|
|
59
|
+
timestamps?: boolean;
|
|
60
|
+
/** Include module name in output (default: true) */
|
|
61
|
+
includeModule?: boolean;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Logger interface for module-specific logging
|
|
65
|
+
*/
|
|
66
|
+
interface ILogger {
|
|
67
|
+
error(message: string, data?: Record<string, unknown>): void;
|
|
68
|
+
warn(message: string, data?: Record<string, unknown>): void;
|
|
69
|
+
info(message: string, data?: Record<string, unknown>): void;
|
|
70
|
+
debug(message: string, data?: Record<string, unknown>): void;
|
|
71
|
+
trace(message: string, data?: Record<string, unknown>): void;
|
|
72
|
+
verbose(message: string, data?: Record<string, unknown>): void;
|
|
73
|
+
/** Create a child logger with a sub-module name */
|
|
74
|
+
child(subModule: string): ILogger;
|
|
75
|
+
/** Get the module name for this logger */
|
|
76
|
+
readonly module: string;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Default configuration
|
|
80
|
+
*/
|
|
81
|
+
declare const DEFAULT_LOGGING_CONFIG: LoggingConfig;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Omote SDK Logger
|
|
85
|
+
*
|
|
86
|
+
* Unified logging system with:
|
|
87
|
+
* - 6 log levels (error, warn, info, debug, trace, verbose)
|
|
88
|
+
* - Structured JSON output for machine parsing
|
|
89
|
+
* - Pretty output for human readability
|
|
90
|
+
* - Module-based child loggers
|
|
91
|
+
* - Runtime configuration
|
|
92
|
+
* - Browser and Node.js compatible
|
|
93
|
+
*/
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Configure global logging settings
|
|
97
|
+
*/
|
|
98
|
+
declare function configureLogging(config: Partial<LoggingConfig>): void;
|
|
99
|
+
/**
|
|
100
|
+
* Get current logging configuration
|
|
101
|
+
*/
|
|
102
|
+
declare function getLoggingConfig(): LoggingConfig;
|
|
103
|
+
/**
|
|
104
|
+
* Reset logging configuration to defaults
|
|
105
|
+
*/
|
|
106
|
+
declare function resetLoggingConfig(): void;
|
|
107
|
+
/**
|
|
108
|
+
* Set log level at runtime
|
|
109
|
+
*/
|
|
110
|
+
declare function setLogLevel(level: LogLevel): void;
|
|
111
|
+
/**
|
|
112
|
+
* Enable or disable logging
|
|
113
|
+
*/
|
|
114
|
+
declare function setLoggingEnabled(enabled: boolean): void;
|
|
115
|
+
/**
|
|
116
|
+
* Create a logger for a specific module
|
|
117
|
+
*
|
|
118
|
+
* @param module - Module name (e.g., 'LocalInference', 'ModelCache')
|
|
119
|
+
* @returns Logger instance
|
|
120
|
+
*
|
|
121
|
+
* @example
|
|
122
|
+
* ```typescript
|
|
123
|
+
* const logger = createLogger('LocalInference');
|
|
124
|
+
* logger.info('Model loaded', { backend: 'webgpu', loadTimeMs: 1234 });
|
|
125
|
+
* ```
|
|
126
|
+
*/
|
|
127
|
+
declare function createLogger(module: string): ILogger;
|
|
128
|
+
/**
|
|
129
|
+
* Clear logger cache (useful for testing)
|
|
130
|
+
*/
|
|
131
|
+
declare function clearLoggerCache(): void;
|
|
132
|
+
/**
|
|
133
|
+
* No-op logger for when logging is completely disabled
|
|
134
|
+
*/
|
|
135
|
+
declare const noopLogger: ILogger;
|
|
136
|
+
/**
|
|
137
|
+
* Get a no-op logger (for production builds that tree-shake logging)
|
|
138
|
+
*/
|
|
139
|
+
declare function getNoopLogger(): ILogger;
|
|
140
|
+
|
|
141
|
+
export { DEFAULT_LOGGING_CONFIG as D, type ILogger as I, type LogFormatter as L, type LogLevel as a, type LogEntry as b, type LogSink as c, type LoggingConfig as d, LOG_LEVEL_PRIORITY as e, configureLogging as f, getLoggingConfig as g, setLoggingEnabled as h, createLogger as i, clearLoggerCache as j, getNoopLogger as k, noopLogger as n, resetLoggingConfig as r, setLogLevel as s };
|