@enactprotocol/shared 1.2.13 → 2.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 (207) hide show
  1. package/README.md +44 -0
  2. package/dist/config.d.ts +164 -0
  3. package/dist/config.d.ts.map +1 -0
  4. package/dist/config.js +386 -0
  5. package/dist/config.js.map +1 -0
  6. package/dist/constants.d.ts +15 -5
  7. package/dist/constants.d.ts.map +1 -0
  8. package/dist/constants.js +24 -8
  9. package/dist/constants.js.map +1 -0
  10. package/dist/execution/command.d.ts +102 -0
  11. package/dist/execution/command.d.ts.map +1 -0
  12. package/dist/execution/command.js +262 -0
  13. package/dist/execution/command.js.map +1 -0
  14. package/dist/execution/index.d.ts +12 -0
  15. package/dist/execution/index.d.ts.map +1 -0
  16. package/dist/execution/index.js +17 -0
  17. package/dist/execution/index.js.map +1 -0
  18. package/dist/execution/runtime.d.ts +82 -0
  19. package/dist/execution/runtime.d.ts.map +1 -0
  20. package/dist/execution/runtime.js +273 -0
  21. package/dist/execution/runtime.js.map +1 -0
  22. package/dist/execution/types.d.ts +306 -0
  23. package/dist/execution/types.d.ts.map +1 -0
  24. package/dist/execution/types.js +14 -0
  25. package/dist/execution/types.js.map +1 -0
  26. package/dist/execution/validation.d.ts +43 -0
  27. package/dist/execution/validation.d.ts.map +1 -0
  28. package/dist/execution/validation.js +430 -0
  29. package/dist/execution/validation.js.map +1 -0
  30. package/dist/index.d.ts +21 -21
  31. package/dist/index.d.ts.map +1 -0
  32. package/dist/index.js +49 -25
  33. package/dist/index.js.map +1 -0
  34. package/dist/manifest/index.d.ts +7 -0
  35. package/dist/manifest/index.d.ts.map +1 -0
  36. package/dist/manifest/index.js +10 -0
  37. package/dist/manifest/index.js.map +1 -0
  38. package/dist/manifest/loader.d.ts +76 -0
  39. package/dist/manifest/loader.d.ts.map +1 -0
  40. package/dist/manifest/loader.js +146 -0
  41. package/dist/manifest/loader.js.map +1 -0
  42. package/dist/manifest/parser.d.ts +64 -0
  43. package/dist/manifest/parser.d.ts.map +1 -0
  44. package/dist/manifest/parser.js +135 -0
  45. package/dist/manifest/parser.js.map +1 -0
  46. package/dist/manifest/validator.d.ts +95 -0
  47. package/dist/manifest/validator.d.ts.map +1 -0
  48. package/dist/manifest/validator.js +258 -0
  49. package/dist/manifest/validator.js.map +1 -0
  50. package/dist/paths.d.ts +57 -0
  51. package/dist/paths.d.ts.map +1 -0
  52. package/dist/paths.js +93 -0
  53. package/dist/paths.js.map +1 -0
  54. package/dist/registry.d.ts +73 -0
  55. package/dist/registry.d.ts.map +1 -0
  56. package/dist/registry.js +147 -0
  57. package/dist/registry.js.map +1 -0
  58. package/dist/resolver.d.ts +89 -0
  59. package/dist/resolver.d.ts.map +1 -0
  60. package/dist/resolver.js +282 -0
  61. package/dist/resolver.js.map +1 -0
  62. package/dist/types/index.d.ts +6 -0
  63. package/dist/types/index.d.ts.map +1 -0
  64. package/dist/types/index.js +5 -0
  65. package/dist/types/index.js.map +1 -0
  66. package/dist/types/manifest.d.ts +201 -0
  67. package/dist/types/manifest.d.ts.map +1 -0
  68. package/dist/types/manifest.js +13 -0
  69. package/dist/types/manifest.js.map +1 -0
  70. package/dist/types.d.ts +5 -132
  71. package/dist/types.d.ts.map +1 -0
  72. package/dist/types.js +5 -3
  73. package/dist/types.js.map +1 -0
  74. package/dist/utils/fs.d.ts +105 -0
  75. package/dist/utils/fs.d.ts.map +1 -0
  76. package/dist/utils/fs.js +233 -0
  77. package/dist/utils/fs.js.map +1 -0
  78. package/dist/utils/logger.d.ts +102 -25
  79. package/dist/utils/logger.d.ts.map +1 -0
  80. package/dist/utils/logger.js +214 -57
  81. package/dist/utils/logger.js.map +1 -0
  82. package/dist/utils/version.d.ts +60 -2
  83. package/dist/utils/version.d.ts.map +1 -0
  84. package/dist/utils/version.js +255 -31
  85. package/dist/utils/version.js.map +1 -0
  86. package/package.json +16 -58
  87. package/src/config.ts +510 -0
  88. package/src/constants.ts +36 -0
  89. package/src/execution/command.ts +314 -0
  90. package/src/execution/index.ts +73 -0
  91. package/src/execution/runtime.ts +308 -0
  92. package/src/execution/types.ts +379 -0
  93. package/src/execution/validation.ts +508 -0
  94. package/src/index.ts +238 -30
  95. package/src/manifest/index.ts +36 -0
  96. package/src/manifest/loader.ts +187 -0
  97. package/src/manifest/parser.ts +173 -0
  98. package/src/manifest/validator.ts +309 -0
  99. package/src/paths.ts +108 -0
  100. package/src/registry.ts +219 -0
  101. package/src/resolver.ts +345 -0
  102. package/src/types/index.ts +30 -0
  103. package/src/types/manifest.ts +255 -0
  104. package/src/types.ts +5 -188
  105. package/src/utils/fs.ts +281 -0
  106. package/src/utils/logger.ts +270 -59
  107. package/src/utils/version.ts +304 -36
  108. package/tests/config.test.ts +515 -0
  109. package/tests/execution/command.test.ts +317 -0
  110. package/tests/execution/validation.test.ts +384 -0
  111. package/tests/fixtures/invalid-tool.yaml +4 -0
  112. package/tests/fixtures/valid-tool.md +62 -0
  113. package/tests/fixtures/valid-tool.yaml +40 -0
  114. package/tests/index.test.ts +8 -0
  115. package/tests/manifest/loader.test.ts +291 -0
  116. package/tests/manifest/parser.test.ts +345 -0
  117. package/tests/manifest/validator.test.ts +394 -0
  118. package/tests/manifest-types.test.ts +358 -0
  119. package/tests/paths.test.ts +153 -0
  120. package/tests/registry.test.ts +231 -0
  121. package/tests/resolver.test.ts +272 -0
  122. package/tests/utils/fs.test.ts +388 -0
  123. package/tests/utils/logger.test.ts +480 -0
  124. package/tests/utils/version.test.ts +390 -0
  125. package/tsconfig.json +12 -0
  126. package/dist/LocalToolResolver.d.ts +0 -84
  127. package/dist/LocalToolResolver.js +0 -353
  128. package/dist/api/enact-api.d.ts +0 -130
  129. package/dist/api/enact-api.js +0 -428
  130. package/dist/api/index.d.ts +0 -2
  131. package/dist/api/index.js +0 -2
  132. package/dist/api/types.d.ts +0 -103
  133. package/dist/api/types.js +0 -1
  134. package/dist/core/DaggerExecutionProvider.d.ts +0 -169
  135. package/dist/core/DaggerExecutionProvider.js +0 -1029
  136. package/dist/core/DirectExecutionProvider.d.ts +0 -23
  137. package/dist/core/DirectExecutionProvider.js +0 -406
  138. package/dist/core/EnactCore.d.ts +0 -162
  139. package/dist/core/EnactCore.js +0 -597
  140. package/dist/core/NativeExecutionProvider.d.ts +0 -9
  141. package/dist/core/NativeExecutionProvider.js +0 -16
  142. package/dist/core/index.d.ts +0 -3
  143. package/dist/core/index.js +0 -3
  144. package/dist/exec/index.d.ts +0 -3
  145. package/dist/exec/index.js +0 -3
  146. package/dist/exec/logger.d.ts +0 -11
  147. package/dist/exec/logger.js +0 -57
  148. package/dist/exec/validate.d.ts +0 -5
  149. package/dist/exec/validate.js +0 -167
  150. package/dist/lib/enact-direct.d.ts +0 -150
  151. package/dist/lib/enact-direct.js +0 -159
  152. package/dist/lib/index.d.ts +0 -1
  153. package/dist/lib/index.js +0 -1
  154. package/dist/security/index.d.ts +0 -3
  155. package/dist/security/index.js +0 -3
  156. package/dist/security/security.d.ts +0 -23
  157. package/dist/security/security.js +0 -137
  158. package/dist/security/sign.d.ts +0 -103
  159. package/dist/security/sign.js +0 -666
  160. package/dist/security/verification-enforcer.d.ts +0 -53
  161. package/dist/security/verification-enforcer.js +0 -204
  162. package/dist/services/McpCoreService.d.ts +0 -98
  163. package/dist/services/McpCoreService.js +0 -124
  164. package/dist/services/index.d.ts +0 -1
  165. package/dist/services/index.js +0 -1
  166. package/dist/utils/config.d.ts +0 -111
  167. package/dist/utils/config.js +0 -342
  168. package/dist/utils/env-loader.d.ts +0 -54
  169. package/dist/utils/env-loader.js +0 -270
  170. package/dist/utils/help.d.ts +0 -36
  171. package/dist/utils/help.js +0 -248
  172. package/dist/utils/index.d.ts +0 -7
  173. package/dist/utils/index.js +0 -7
  174. package/dist/utils/silent-monitor.d.ts +0 -67
  175. package/dist/utils/silent-monitor.js +0 -242
  176. package/dist/utils/timeout.d.ts +0 -5
  177. package/dist/utils/timeout.js +0 -23
  178. package/dist/web/env-manager-server.d.ts +0 -29
  179. package/dist/web/env-manager-server.js +0 -367
  180. package/dist/web/index.d.ts +0 -1
  181. package/dist/web/index.js +0 -1
  182. package/src/LocalToolResolver.ts +0 -424
  183. package/src/api/enact-api.ts +0 -604
  184. package/src/api/index.ts +0 -2
  185. package/src/api/types.ts +0 -114
  186. package/src/core/DaggerExecutionProvider.ts +0 -1357
  187. package/src/core/DirectExecutionProvider.ts +0 -484
  188. package/src/core/EnactCore.ts +0 -847
  189. package/src/core/index.ts +0 -3
  190. package/src/exec/index.ts +0 -3
  191. package/src/exec/logger.ts +0 -63
  192. package/src/exec/validate.ts +0 -238
  193. package/src/lib/enact-direct.ts +0 -254
  194. package/src/lib/index.ts +0 -1
  195. package/src/services/McpCoreService.ts +0 -201
  196. package/src/services/index.ts +0 -1
  197. package/src/utils/config.ts +0 -438
  198. package/src/utils/env-loader.ts +0 -370
  199. package/src/utils/help.ts +0 -257
  200. package/src/utils/index.ts +0 -7
  201. package/src/utils/silent-monitor.ts +0 -328
  202. package/src/utils/timeout.ts +0 -26
  203. package/src/web/env-manager-server.ts +0 -465
  204. package/src/web/index.ts +0 -1
  205. package/src/web/static/app.js +0 -663
  206. package/src/web/static/index.html +0 -117
  207. package/src/web/static/style.css +0 -291
package/dist/types.d.ts CHANGED
@@ -1,132 +1,5 @@
1
- export interface EnactTool {
2
- name: string;
3
- description: string;
4
- command: string;
5
- from?: string;
6
- timeout?: string;
7
- tags?: string[];
8
- license?: string;
9
- outputSchema?: JSONSchemaDefinition;
10
- enact?: string;
11
- version?: string;
12
- namespace?: string;
13
- resources?: {
14
- memory?: string;
15
- gpu?: string;
16
- disk?: string;
17
- };
18
- env?: Record<string, {
19
- description: string;
20
- source: string;
21
- required: boolean;
22
- default?: string;
23
- }>;
24
- inputSchema?: JSONSchemaDefinition;
25
- doc?: string;
26
- authors?: Array<{
27
- name: string;
28
- email?: string;
29
- url?: string;
30
- }>;
31
- examples?: Array<{
32
- input: Record<string, any>;
33
- output?: any;
34
- description?: string;
35
- }>;
36
- annotations?: {
37
- title?: string;
38
- readOnlyHint?: boolean;
39
- destructiveHint?: boolean;
40
- idempotentHint?: boolean;
41
- openWorldHint?: boolean;
42
- };
43
- signature?: {
44
- algorithm: string;
45
- type: string;
46
- signer: string;
47
- created: string;
48
- value: string;
49
- role?: string;
50
- };
51
- signatures?: {
52
- signer: string;
53
- algorithm: string;
54
- type: string;
55
- value: string;
56
- created: string;
57
- role?: string;
58
- }[];
59
- [key: string]: any;
60
- }
61
- export interface JSONSchemaDefinition {
62
- type?: string | string[];
63
- description?: string;
64
- format?: string;
65
- default?: any;
66
- enum?: any[];
67
- const?: any;
68
- pattern?: string;
69
- minLength?: number;
70
- maxLength?: number;
71
- minimum?: number;
72
- maximum?: number;
73
- exclusiveMinimum?: number;
74
- exclusiveMaximum?: number;
75
- multipleOf?: number;
76
- items?: JSONSchemaDefinition | JSONSchemaDefinition[];
77
- minItems?: number;
78
- maxItems?: number;
79
- uniqueItems?: boolean;
80
- properties?: Record<string, JSONSchemaDefinition>;
81
- required?: string[];
82
- additionalProperties?: JSONSchemaDefinition | boolean;
83
- allOf?: JSONSchemaDefinition[];
84
- anyOf?: JSONSchemaDefinition[];
85
- oneOf?: JSONSchemaDefinition[];
86
- not?: JSONSchemaDefinition;
87
- definitions?: Record<string, JSONSchemaDefinition>;
88
- $ref?: string;
89
- $id?: string;
90
- $schema?: string;
91
- [key: string]: any;
92
- }
93
- export interface ExecutionResult {
94
- success: boolean;
95
- output?: any;
96
- error?: {
97
- message: string;
98
- code?: string;
99
- details?: any;
100
- };
101
- metadata: {
102
- executionId: string;
103
- toolName: string;
104
- version?: string;
105
- executedAt: string;
106
- environment: string;
107
- timeout?: string;
108
- command?: string;
109
- };
110
- }
111
- export interface ExecutionEnvironment {
112
- vars: Record<string, any>;
113
- resources?: {
114
- memory?: string;
115
- gpu?: string;
116
- disk?: string;
117
- timeout?: string;
118
- };
119
- namespace?: string;
120
- mount?: string;
121
- }
122
- export declare abstract class ExecutionProvider {
123
- abstract setup(tool: EnactTool): Promise<boolean>;
124
- abstract execute(tool: EnactTool, inputs: Record<string, any>, environment: ExecutionEnvironment): Promise<ExecutionResult>;
125
- abstract cleanup(): Promise<boolean>;
126
- abstract resolveEnvironmentVariables(envConfig: Record<string, any>, namespace?: string): Promise<Record<string, any>>;
127
- abstract executeCommand(command: string, inputs: Record<string, any>, environment: ExecutionEnvironment, timeout?: string): Promise<{
128
- stdout: string;
129
- stderr: string;
130
- exitCode: number;
131
- }>;
132
- }
1
+ /**
2
+ * Type definitions for shared utilities
3
+ */
4
+ export type EnactManifest = Record<string, unknown>;
5
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC"}
package/dist/types.js CHANGED
@@ -1,3 +1,5 @@
1
- // Updated execution provider interface
2
- export class ExecutionProvider {
3
- }
1
+ /**
2
+ * Type definitions for shared utilities
3
+ */
4
+ export {};
5
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG"}
@@ -0,0 +1,105 @@
1
+ /**
2
+ * @enactprotocol/shared - File system helpers
3
+ *
4
+ * Provides utilities for common filesystem operations.
5
+ */
6
+ /**
7
+ * Ensure a directory exists, creating it if necessary
8
+ */
9
+ export declare function ensureDir(dirPath: string): void;
10
+ /**
11
+ * Ensure the parent directory of a file exists
12
+ */
13
+ export declare function ensureParentDir(filePath: string): void;
14
+ /**
15
+ * Check if a path exists
16
+ */
17
+ export declare function pathExists(path: string): boolean;
18
+ /**
19
+ * Check if a path is a directory
20
+ */
21
+ export declare function isDirectory(path: string): boolean;
22
+ /**
23
+ * Check if a path is a file
24
+ */
25
+ export declare function isFile(path: string): boolean;
26
+ /**
27
+ * Read and parse a JSON file
28
+ * @throws Error if file doesn't exist or isn't valid JSON
29
+ */
30
+ export declare function readJsonFile<T = unknown>(filePath: string): T;
31
+ /**
32
+ * Try to read and parse a JSON file
33
+ * @returns The parsed JSON or null if file doesn't exist or is invalid
34
+ */
35
+ export declare function tryReadJsonFile<T = unknown>(filePath: string): T | null;
36
+ /**
37
+ * Write data to a JSON file with formatting
38
+ */
39
+ export declare function writeJsonFile(filePath: string, data: unknown, options?: {
40
+ indent?: number | undefined;
41
+ }): void;
42
+ /**
43
+ * Read a text file
44
+ */
45
+ export declare function readTextFile(filePath: string): string;
46
+ /**
47
+ * Try to read a text file
48
+ * @returns The file content or null if file doesn't exist
49
+ */
50
+ export declare function tryReadTextFile(filePath: string): string | null;
51
+ /**
52
+ * Write content to a text file
53
+ */
54
+ export declare function writeTextFile(filePath: string, content: string): void;
55
+ /**
56
+ * Copy a file
57
+ */
58
+ export declare function copyFile(src: string, dest: string): void;
59
+ /**
60
+ * Copy a directory recursively
61
+ */
62
+ export declare function copyDir(src: string, dest: string): void;
63
+ /**
64
+ * Remove a file or directory
65
+ */
66
+ export declare function remove(path: string): void;
67
+ /**
68
+ * List directory contents
69
+ */
70
+ export declare function listDir(dirPath: string): string[];
71
+ /**
72
+ * List directory entries with types
73
+ */
74
+ export declare function listDirEntries(dirPath: string): Array<{
75
+ name: string;
76
+ type: "file" | "directory" | "unknown";
77
+ path: string;
78
+ }>;
79
+ /**
80
+ * Find files matching a pattern in a directory (non-recursive)
81
+ */
82
+ export declare function findFiles(dirPath: string, pattern: RegExp | string): string[];
83
+ /**
84
+ * Find files recursively
85
+ */
86
+ export declare function findFilesRecursive(dirPath: string, pattern?: RegExp | string): string[];
87
+ /**
88
+ * Get file stats
89
+ */
90
+ export declare function getStats(path: string): {
91
+ size: number;
92
+ isFile: boolean;
93
+ isDirectory: boolean;
94
+ created: Date;
95
+ modified: Date;
96
+ } | null;
97
+ /**
98
+ * Get file size in bytes
99
+ */
100
+ export declare function getFileSize(filePath: string): number | null;
101
+ /**
102
+ * Touch a file (create if not exists, update mtime if exists)
103
+ */
104
+ export declare function touchFile(filePath: string): void;
105
+ //# sourceMappingURL=fs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../../src/utils/fs.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAcH;;GAEG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAI/C;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAGtD;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEhD;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAMjD;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAM5C;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,CAAC,GAAG,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,CAAC,CAG7D;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,CAAC,GAAG,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI,CAMvE;AAED;;GAEG;AACH,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,OAAO,EACb,OAAO,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,GACxC,IAAI,CAIN;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAErD;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAM/D;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MA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 +1,233 @@
1
+ /**
2
+ * @enactprotocol/shared - File system helpers
3
+ *
4
+ * Provides utilities for common filesystem operations.
5
+ */
6
+ import { copyFileSync, existsSync, mkdirSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync, } from "node:fs";
7
+ import { dirname, join } from "node:path";
8
+ /**
9
+ * Ensure a directory exists, creating it if necessary
10
+ */
11
+ export function ensureDir(dirPath) {
12
+ if (!existsSync(dirPath)) {
13
+ mkdirSync(dirPath, { recursive: true });
14
+ }
15
+ }
16
+ /**
17
+ * Ensure the parent directory of a file exists
18
+ */
19
+ export function ensureParentDir(filePath) {
20
+ const parentDir = dirname(filePath);
21
+ ensureDir(parentDir);
22
+ }
23
+ /**
24
+ * Check if a path exists
25
+ */
26
+ export function pathExists(path) {
27
+ return existsSync(path);
28
+ }
29
+ /**
30
+ * Check if a path is a directory
31
+ */
32
+ export function isDirectory(path) {
33
+ try {
34
+ return existsSync(path) && statSync(path).isDirectory();
35
+ }
36
+ catch {
37
+ return false;
38
+ }
39
+ }
40
+ /**
41
+ * Check if a path is a file
42
+ */
43
+ export function isFile(path) {
44
+ try {
45
+ return existsSync(path) && statSync(path).isFile();
46
+ }
47
+ catch {
48
+ return false;
49
+ }
50
+ }
51
+ /**
52
+ * Read and parse a JSON file
53
+ * @throws Error if file doesn't exist or isn't valid JSON
54
+ */
55
+ export function readJsonFile(filePath) {
56
+ const content = readFileSync(filePath, "utf-8");
57
+ return JSON.parse(content);
58
+ }
59
+ /**
60
+ * Try to read and parse a JSON file
61
+ * @returns The parsed JSON or null if file doesn't exist or is invalid
62
+ */
63
+ export function tryReadJsonFile(filePath) {
64
+ try {
65
+ return readJsonFile(filePath);
66
+ }
67
+ catch {
68
+ return null;
69
+ }
70
+ }
71
+ /**
72
+ * Write data to a JSON file with formatting
73
+ */
74
+ export function writeJsonFile(filePath, data, options) {
75
+ const indent = options?.indent ?? 2;
76
+ ensureParentDir(filePath);
77
+ writeFileSync(filePath, `${JSON.stringify(data, null, indent)}\n`, "utf-8");
78
+ }
79
+ /**
80
+ * Read a text file
81
+ */
82
+ export function readTextFile(filePath) {
83
+ return readFileSync(filePath, "utf-8");
84
+ }
85
+ /**
86
+ * Try to read a text file
87
+ * @returns The file content or null if file doesn't exist
88
+ */
89
+ export function tryReadTextFile(filePath) {
90
+ try {
91
+ return readTextFile(filePath);
92
+ }
93
+ catch {
94
+ return null;
95
+ }
96
+ }
97
+ /**
98
+ * Write content to a text file
99
+ */
100
+ export function writeTextFile(filePath, content) {
101
+ ensureParentDir(filePath);
102
+ writeFileSync(filePath, content, "utf-8");
103
+ }
104
+ /**
105
+ * Copy a file
106
+ */
107
+ export function copyFile(src, dest) {
108
+ ensureParentDir(dest);
109
+ copyFileSync(src, dest);
110
+ }
111
+ /**
112
+ * Copy a directory recursively
113
+ */
114
+ export function copyDir(src, dest) {
115
+ ensureDir(dest);
116
+ const entries = readdirSync(src, { withFileTypes: true });
117
+ for (const entry of entries) {
118
+ const srcPath = join(src, entry.name);
119
+ const destPath = join(dest, entry.name);
120
+ if (entry.isDirectory()) {
121
+ copyDir(srcPath, destPath);
122
+ }
123
+ else {
124
+ copyFile(srcPath, destPath);
125
+ }
126
+ }
127
+ }
128
+ /**
129
+ * Remove a file or directory
130
+ */
131
+ export function remove(path) {
132
+ if (existsSync(path)) {
133
+ rmSync(path, { recursive: true, force: true });
134
+ }
135
+ }
136
+ /**
137
+ * List directory contents
138
+ */
139
+ export function listDir(dirPath) {
140
+ if (!existsSync(dirPath)) {
141
+ return [];
142
+ }
143
+ return readdirSync(dirPath);
144
+ }
145
+ /**
146
+ * List directory entries with types
147
+ */
148
+ export function listDirEntries(dirPath) {
149
+ if (!existsSync(dirPath)) {
150
+ return [];
151
+ }
152
+ const entries = readdirSync(dirPath, { withFileTypes: true });
153
+ return entries.map((entry) => ({
154
+ name: entry.name,
155
+ type: entry.isDirectory() ? "directory" : entry.isFile() ? "file" : "unknown",
156
+ path: join(dirPath, entry.name),
157
+ }));
158
+ }
159
+ /**
160
+ * Find files matching a pattern in a directory (non-recursive)
161
+ */
162
+ export function findFiles(dirPath, pattern) {
163
+ const entries = listDir(dirPath);
164
+ const regex = typeof pattern === "string" ? new RegExp(pattern) : pattern;
165
+ return entries
166
+ .filter((name) => regex.test(name) && isFile(join(dirPath, name)))
167
+ .map((name) => join(dirPath, name));
168
+ }
169
+ /**
170
+ * Find files recursively
171
+ */
172
+ export function findFilesRecursive(dirPath, pattern) {
173
+ const results = [];
174
+ if (!existsSync(dirPath)) {
175
+ return results;
176
+ }
177
+ const regex = pattern !== undefined ? (typeof pattern === "string" ? new RegExp(pattern) : pattern) : null;
178
+ function walk(dir) {
179
+ const entries = readdirSync(dir, { withFileTypes: true });
180
+ for (const entry of entries) {
181
+ const fullPath = join(dir, entry.name);
182
+ if (entry.isDirectory()) {
183
+ walk(fullPath);
184
+ }
185
+ else if (entry.isFile()) {
186
+ if (!regex || regex.test(entry.name)) {
187
+ results.push(fullPath);
188
+ }
189
+ }
190
+ }
191
+ }
192
+ walk(dirPath);
193
+ return results;
194
+ }
195
+ /**
196
+ * Get file stats
197
+ */
198
+ export function getStats(path) {
199
+ try {
200
+ const stats = statSync(path);
201
+ return {
202
+ size: stats.size,
203
+ isFile: stats.isFile(),
204
+ isDirectory: stats.isDirectory(),
205
+ created: stats.birthtime,
206
+ modified: stats.mtime,
207
+ };
208
+ }
209
+ catch {
210
+ return null;
211
+ }
212
+ }
213
+ /**
214
+ * Get file size in bytes
215
+ */
216
+ export function getFileSize(filePath) {
217
+ const stats = getStats(filePath);
218
+ return stats?.isFile ? stats.size : null;
219
+ }
220
+ /**
221
+ * Touch a file (create if not exists, update mtime if exists)
222
+ */
223
+ export function touchFile(filePath) {
224
+ ensureParentDir(filePath);
225
+ if (existsSync(filePath)) {
226
+ // Update access and modification time by rewriting the file
227
+ writeFileSync(filePath, readFileSync(filePath));
228
+ }
229
+ else {
230
+ writeFileSync(filePath, "", "utf-8");
231
+ }
232
+ }
233
+ //# sourceMappingURL=fs.js.map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MAAM,KAAK,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACjC,OAAO,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;AAC3C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,QAAgB;IACxC,eAAe,CAAC,QAAQ,CAAC,CAAC;IAC1B,IAAI,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QACzB,4DAA4D;QAC5D,aAAa,CAAC,QAAQ,EAAE,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC;IAClD,CAAC;SAAM,CAAC;QACN,aAAa,CAAC,QAAQ,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;IACvC,CAAC;AACH,CAAC"}
@@ -1,35 +1,112 @@
1
- export declare enum LogLevel {
2
- DEBUG = 0,
3
- INFO = 1,
4
- SUCCESS = 2,
5
- WARN = 3,
6
- ERROR = 4
7
- }
8
- /**
9
- * Sets the current log level
10
- */
11
- export declare function setLogLevel(level: LogLevel): void;
12
- /**
13
- * Debug log - only shown when log level is DEBUG
14
- */
15
- export declare function debug(message: string): void;
16
1
  /**
17
- * Info log - general information
2
+ * @enactprotocol/shared - Logger utility
3
+ *
4
+ * Provides structured logging with level filtering and
5
+ * configurable output formats (console with colors or JSON).
18
6
  */
19
- export declare function info(message: string): void;
7
+ export type LogLevel = "debug" | "info" | "warn" | "error" | "silent";
8
+ export interface LogEntry {
9
+ timestamp: string;
10
+ level: LogLevel;
11
+ message: string;
12
+ context?: Record<string, unknown> | undefined;
13
+ }
14
+ export interface LoggerOptions {
15
+ /** Minimum level to output */
16
+ level?: LogLevel;
17
+ /** Output format: 'console' for colored output, 'json' for structured */
18
+ format?: "console" | "json";
19
+ /** Enable colors in console output */
20
+ colors?: boolean;
21
+ /** Custom output function (defaults to console) */
22
+ output?: (text: string) => void;
23
+ /** Custom error output function (defaults to console.error) */
24
+ errorOutput?: (text: string) => void;
25
+ /** Prefix for log messages */
26
+ prefix?: string;
27
+ }
20
28
  /**
21
- * Success log - operation completed successfully
29
+ * Logger class with level filtering and structured output
22
30
  */
23
- export declare function success(message: string): void;
31
+ export declare class Logger {
32
+ private level;
33
+ private format;
34
+ private colors;
35
+ private output;
36
+ private errorOutput;
37
+ private prefix;
38
+ constructor(options?: LoggerOptions);
39
+ /**
40
+ * Check if a level should be logged
41
+ */
42
+ shouldLog(level: LogLevel): boolean;
43
+ /**
44
+ * Set the minimum log level
45
+ */
46
+ setLevel(level: LogLevel): void;
47
+ /**
48
+ * Get the current log level
49
+ */
50
+ getLevel(): LogLevel;
51
+ /**
52
+ * Set the output format
53
+ */
54
+ setFormat(format: "console" | "json"): void;
55
+ /**
56
+ * Enable or disable colors
57
+ */
58
+ setColors(enabled: boolean): void;
59
+ /**
60
+ * Set the prefix for log messages
61
+ */
62
+ setPrefix(prefix: string): void;
63
+ /**
64
+ * Create a child logger with a prefix
65
+ */
66
+ child(prefix: string): Logger;
67
+ /**
68
+ * Log a debug message
69
+ */
70
+ debug(message: string, context?: Record<string, unknown>): void;
71
+ /**
72
+ * Log an info message
73
+ */
74
+ info(message: string, context?: Record<string, unknown>): void;
75
+ /**
76
+ * Log a warning message
77
+ */
78
+ warn(message: string, context?: Record<string, unknown>): void;
79
+ /**
80
+ * Log an error message
81
+ */
82
+ error(message: string, context?: Record<string, unknown>): void;
83
+ /**
84
+ * Core logging method
85
+ */
86
+ private log;
87
+ /**
88
+ * Format entry as JSON
89
+ */
90
+ private formatJson;
91
+ /**
92
+ * Format entry for console with colors
93
+ */
94
+ private formatConsole;
95
+ }
24
96
  /**
25
- * Warning log - non-critical issues
97
+ * Get the default logger instance
26
98
  */
27
- export declare function warn(message: string): void;
99
+ export declare function getLogger(): Logger;
28
100
  /**
29
- * Error log - critical issues
101
+ * Configure the default logger
30
102
  */
31
- export declare function error(message: string, details?: any): void;
103
+ export declare function configureLogger(options: LoggerOptions): void;
32
104
  /**
33
- * Table log - display tabular data
105
+ * Create a new logger with the given options
34
106
  */
35
- export declare function table(data: any[], columns?: string[]): void;
107
+ export declare function createLogger(options?: LoggerOptions): Logger;
108
+ export declare const debug: (message: string, context?: Record<string, unknown>) => void;
109
+ export declare const info: (message: string, context?: Record<string, unknown>) => void;
110
+ export declare const warn: (message: string, context?: Record<string, unknown>) => void;
111
+ export declare const error: (message: string, context?: Record<string, unknown>) => void;
112
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEtE,MAAM,WAAW,QAAQ;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,QAAQ,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;CAC/C;AAED,MAAM,WAAW,aAAa;IAC5B,8BAA8B;IAC9B,KAAK,CAAC,EAAE,QAAQ,CAAC;IACjB,yEAAyE;IACzE,MAAM,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;IAC5B,sCAAsC;IACtC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,mDAAmD;IACnD,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,+DAA+D;IAC/D,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,8BAA8B;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAuCD;;GAEG;AACH,qBAAa,MAAM;IACjB,OAAO,CAAC,KAAK,CAAW;IACxB,OAAO,CAAC,MAAM,CAAqB;IACnC,OAAO,CAAC,MAAM,CAAU;IACxB,OAAO,CAAC,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