@enactprotocol/shared 1.2.11 → 2.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.
- package/README.md +44 -0
- package/package.json +16 -58
- package/src/config.ts +476 -0
- package/src/constants.ts +36 -0
- package/src/execution/command.ts +314 -0
- package/src/execution/index.ts +73 -0
- package/src/execution/runtime.ts +308 -0
- package/src/execution/types.ts +379 -0
- package/src/execution/validation.ts +508 -0
- package/src/index.ts +237 -30
- package/src/manifest/index.ts +36 -0
- package/src/manifest/loader.ts +187 -0
- package/src/manifest/parser.ts +173 -0
- package/src/manifest/validator.ts +309 -0
- package/src/paths.ts +108 -0
- package/src/registry.ts +219 -0
- package/src/resolver.ts +345 -0
- package/src/types/index.ts +30 -0
- package/src/types/manifest.ts +255 -0
- package/src/types.ts +5 -188
- package/src/utils/fs.ts +281 -0
- package/src/utils/logger.ts +270 -59
- package/src/utils/version.ts +304 -36
- package/tests/config.test.ts +515 -0
- package/tests/execution/command.test.ts +317 -0
- package/tests/execution/validation.test.ts +384 -0
- package/tests/fixtures/invalid-tool.yaml +4 -0
- package/tests/fixtures/valid-tool.md +62 -0
- package/tests/fixtures/valid-tool.yaml +40 -0
- package/tests/index.test.ts +8 -0
- package/tests/manifest/loader.test.ts +291 -0
- package/tests/manifest/parser.test.ts +345 -0
- package/tests/manifest/validator.test.ts +394 -0
- package/tests/manifest-types.test.ts +358 -0
- package/tests/paths.test.ts +153 -0
- package/tests/registry.test.ts +231 -0
- package/tests/resolver.test.ts +272 -0
- package/tests/utils/fs.test.ts +388 -0
- package/tests/utils/logger.test.ts +480 -0
- package/tests/utils/version.test.ts +390 -0
- package/tsconfig.json +12 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/dist/LocalToolResolver.d.ts +0 -84
- package/dist/LocalToolResolver.js +0 -353
- package/dist/api/enact-api.d.ts +0 -130
- package/dist/api/enact-api.js +0 -428
- package/dist/api/index.d.ts +0 -2
- package/dist/api/index.js +0 -2
- package/dist/api/types.d.ts +0 -103
- package/dist/api/types.js +0 -1
- package/dist/constants.d.ts +0 -7
- package/dist/constants.js +0 -10
- package/dist/core/DaggerExecutionProvider.d.ts +0 -169
- package/dist/core/DaggerExecutionProvider.js +0 -1029
- package/dist/core/DirectExecutionProvider.d.ts +0 -23
- package/dist/core/DirectExecutionProvider.js +0 -406
- package/dist/core/EnactCore.d.ts +0 -162
- package/dist/core/EnactCore.js +0 -597
- package/dist/core/NativeExecutionProvider.d.ts +0 -9
- package/dist/core/NativeExecutionProvider.js +0 -16
- package/dist/core/index.d.ts +0 -3
- package/dist/core/index.js +0 -3
- package/dist/exec/index.d.ts +0 -3
- package/dist/exec/index.js +0 -3
- package/dist/exec/logger.d.ts +0 -11
- package/dist/exec/logger.js +0 -57
- package/dist/exec/validate.d.ts +0 -5
- package/dist/exec/validate.js +0 -167
- package/dist/index.d.ts +0 -21
- package/dist/index.js +0 -25
- package/dist/lib/enact-direct.d.ts +0 -150
- package/dist/lib/enact-direct.js +0 -159
- package/dist/lib/index.d.ts +0 -1
- package/dist/lib/index.js +0 -1
- package/dist/security/index.d.ts +0 -3
- package/dist/security/index.js +0 -3
- package/dist/security/security.d.ts +0 -23
- package/dist/security/security.js +0 -137
- package/dist/security/sign.d.ts +0 -103
- package/dist/security/sign.js +0 -666
- package/dist/security/verification-enforcer.d.ts +0 -53
- package/dist/security/verification-enforcer.js +0 -204
- package/dist/services/McpCoreService.d.ts +0 -98
- package/dist/services/McpCoreService.js +0 -124
- package/dist/services/index.d.ts +0 -1
- package/dist/services/index.js +0 -1
- package/dist/types.d.ts +0 -132
- package/dist/types.js +0 -3
- package/dist/utils/config.d.ts +0 -111
- package/dist/utils/config.js +0 -342
- package/dist/utils/env-loader.d.ts +0 -54
- package/dist/utils/env-loader.js +0 -270
- package/dist/utils/help.d.ts +0 -36
- package/dist/utils/help.js +0 -248
- package/dist/utils/index.d.ts +0 -7
- package/dist/utils/index.js +0 -7
- package/dist/utils/logger.d.ts +0 -35
- package/dist/utils/logger.js +0 -75
- package/dist/utils/silent-monitor.d.ts +0 -67
- package/dist/utils/silent-monitor.js +0 -242
- package/dist/utils/timeout.d.ts +0 -5
- package/dist/utils/timeout.js +0 -23
- package/dist/utils/version.d.ts +0 -4
- package/dist/utils/version.js +0 -35
- package/dist/web/env-manager-server.d.ts +0 -29
- package/dist/web/env-manager-server.js +0 -367
- package/dist/web/index.d.ts +0 -1
- package/dist/web/index.js +0 -1
- package/src/LocalToolResolver.ts +0 -424
- package/src/api/enact-api.ts +0 -604
- package/src/api/index.ts +0 -2
- package/src/api/types.ts +0 -114
- package/src/core/DaggerExecutionProvider.ts +0 -1357
- package/src/core/DirectExecutionProvider.ts +0 -484
- package/src/core/EnactCore.ts +0 -847
- package/src/core/index.ts +0 -3
- package/src/exec/index.ts +0 -3
- package/src/exec/logger.ts +0 -63
- package/src/exec/validate.ts +0 -238
- package/src/lib/enact-direct.ts +0 -254
- package/src/lib/index.ts +0 -1
- package/src/services/McpCoreService.ts +0 -201
- package/src/services/index.ts +0 -1
- package/src/utils/config.ts +0 -438
- package/src/utils/env-loader.ts +0 -370
- package/src/utils/help.ts +0 -257
- package/src/utils/index.ts +0 -7
- package/src/utils/silent-monitor.ts +0 -328
- package/src/utils/timeout.ts +0 -26
- package/src/web/env-manager-server.ts +0 -465
- package/src/web/index.ts +0 -1
- package/src/web/static/app.js +0 -663
- package/src/web/static/index.html +0 -117
- package/src/web/static/style.css +0 -291
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
import { ExecutionProvider, type EnactTool, type ExecutionEnvironment, type ExecutionResult } from "../types.js";
|
|
2
|
-
export interface DaggerExecutionOptions {
|
|
3
|
-
baseImage?: string;
|
|
4
|
-
workdir?: string;
|
|
5
|
-
enableNetwork?: boolean;
|
|
6
|
-
enableHostFS?: boolean;
|
|
7
|
-
maxMemory?: string;
|
|
8
|
-
maxCPU?: string;
|
|
9
|
-
cacheVolume?: string;
|
|
10
|
-
useShell?: boolean;
|
|
11
|
-
engineTimeout?: number;
|
|
12
|
-
maxRetries?: number;
|
|
13
|
-
enableEngineHealthCheck?: boolean;
|
|
14
|
-
}
|
|
15
|
-
interface CommandResult {
|
|
16
|
-
stdout: string;
|
|
17
|
-
stderr: string;
|
|
18
|
-
exitCode: number;
|
|
19
|
-
}
|
|
20
|
-
interface EngineHealthStatus {
|
|
21
|
-
isHealthy: boolean;
|
|
22
|
-
lastCheck: Date;
|
|
23
|
-
consecutiveFailures: number;
|
|
24
|
-
}
|
|
25
|
-
export declare class DaggerExecutionProvider extends ExecutionProvider {
|
|
26
|
-
private client;
|
|
27
|
-
private options;
|
|
28
|
-
private tempDir;
|
|
29
|
-
private connectionCleanup;
|
|
30
|
-
private engineHealth;
|
|
31
|
-
private abortController;
|
|
32
|
-
private activeSessions;
|
|
33
|
-
private isShuttingDown;
|
|
34
|
-
constructor(options?: DaggerExecutionOptions);
|
|
35
|
-
setup(tool: EnactTool): Promise<boolean>;
|
|
36
|
-
/**
|
|
37
|
-
* Enhanced cleanup with comprehensive engine management and session tracking
|
|
38
|
-
*/
|
|
39
|
-
cleanup(): Promise<boolean>;
|
|
40
|
-
/**
|
|
41
|
-
* Enhanced engine cleanup with better container detection
|
|
42
|
-
*/
|
|
43
|
-
private performEngineCleanup;
|
|
44
|
-
/**
|
|
45
|
-
* Check engine health with comprehensive diagnostics
|
|
46
|
-
*/
|
|
47
|
-
private checkEngineHealth;
|
|
48
|
-
/**
|
|
49
|
-
* Reset engine container when health check fails
|
|
50
|
-
*/
|
|
51
|
-
private resetEngineContainer;
|
|
52
|
-
/**
|
|
53
|
-
* Start periodic engine health monitoring
|
|
54
|
-
*/
|
|
55
|
-
private startEngineHealthMonitoring;
|
|
56
|
-
/**
|
|
57
|
-
* Wait for active sessions to complete with timeout
|
|
58
|
-
*/
|
|
59
|
-
private waitForActiveSessions;
|
|
60
|
-
resolveEnvironmentVariables(envConfig: Record<string, any>, namespace?: string): Promise<Record<string, any>>;
|
|
61
|
-
execute(tool: EnactTool, inputs: Record<string, any>, environment: ExecutionEnvironment): Promise<ExecutionResult>;
|
|
62
|
-
/**
|
|
63
|
-
* Categorize errors for better handling
|
|
64
|
-
*/
|
|
65
|
-
private categorizeError;
|
|
66
|
-
executeCommand(command: string, inputs: Record<string, any>, environment: ExecutionEnvironment, timeout?: string, options?: {
|
|
67
|
-
verbose?: boolean;
|
|
68
|
-
showSpinner?: boolean;
|
|
69
|
-
streamOutput?: boolean;
|
|
70
|
-
}, tool?: EnactTool): Promise<CommandResult>;
|
|
71
|
-
/**
|
|
72
|
-
* Execute command using Dagger connect with proper session management
|
|
73
|
-
*/
|
|
74
|
-
private executeWithConnect;
|
|
75
|
-
/**
|
|
76
|
-
* Setup directory mounting for the container
|
|
77
|
-
*/
|
|
78
|
-
private setupDirectoryMount;
|
|
79
|
-
/**
|
|
80
|
-
* Enhanced container setup with better tool detection and installation
|
|
81
|
-
*/
|
|
82
|
-
private setupContainer;
|
|
83
|
-
/**
|
|
84
|
-
* Install common tools that Enact commands might need
|
|
85
|
-
* Enhanced with better error handling and timeout
|
|
86
|
-
*/
|
|
87
|
-
private installCommonTools;
|
|
88
|
-
/**
|
|
89
|
-
* Execute command in container with enhanced error handling
|
|
90
|
-
*/
|
|
91
|
-
private executeInContainer;
|
|
92
|
-
/**
|
|
93
|
-
* Enhanced execution error parsing
|
|
94
|
-
*/
|
|
95
|
-
private parseExecutionError;
|
|
96
|
-
/**
|
|
97
|
-
* Apply resource limits based on Enact tool specifications
|
|
98
|
-
*/
|
|
99
|
-
private applyResourceLimits;
|
|
100
|
-
/**
|
|
101
|
-
* Substitute template variables in Enact commands with enhanced security
|
|
102
|
-
*/
|
|
103
|
-
private substituteCommandVariables;
|
|
104
|
-
/**
|
|
105
|
-
* Enhanced shell argument escaping
|
|
106
|
-
*/
|
|
107
|
-
private escapeShellArg;
|
|
108
|
-
/**
|
|
109
|
-
* Prepare input files for Enact tools that expect file inputs
|
|
110
|
-
*/
|
|
111
|
-
private prepareInputFiles;
|
|
112
|
-
/**
|
|
113
|
-
* Heuristics to determine if input should be treated as file content
|
|
114
|
-
*/
|
|
115
|
-
private looksLikeFileContent;
|
|
116
|
-
/**
|
|
117
|
-
* Check if content looks like common file types
|
|
118
|
-
*/
|
|
119
|
-
private hasCommonFileExtensions;
|
|
120
|
-
/**
|
|
121
|
-
* Generate appropriate filename for input content
|
|
122
|
-
*/
|
|
123
|
-
private getInputFileName;
|
|
124
|
-
/**
|
|
125
|
-
* Map MIME types to file extensions
|
|
126
|
-
*/
|
|
127
|
-
private getExtensionFromMimeType;
|
|
128
|
-
/**
|
|
129
|
-
* Enhanced command parsing for non-shell execution
|
|
130
|
-
*/
|
|
131
|
-
private parseCommand;
|
|
132
|
-
/**
|
|
133
|
-
* Enhanced timeout promise with abort signal support
|
|
134
|
-
*/
|
|
135
|
-
private createTimeoutPromise;
|
|
136
|
-
/**
|
|
137
|
-
* Parse command output according to Enact tool output schema
|
|
138
|
-
*/
|
|
139
|
-
private parseOutput;
|
|
140
|
-
/**
|
|
141
|
-
* Execute command with exec.ts style interface for backwards compatibility
|
|
142
|
-
*/
|
|
143
|
-
executeCommandExecStyle(command: string, timeout: string, verbose?: boolean, envVars?: Record<string, string>): Promise<void>;
|
|
144
|
-
/**
|
|
145
|
-
* Enhanced cleanup handlers with graceful shutdown
|
|
146
|
-
*/
|
|
147
|
-
private registerCleanupHandlers;
|
|
148
|
-
/**
|
|
149
|
-
* Graceful shutdown with proper async cleanup
|
|
150
|
-
*/
|
|
151
|
-
private gracefulShutdown;
|
|
152
|
-
/**
|
|
153
|
-
* Get current engine status for debugging
|
|
154
|
-
*/
|
|
155
|
-
getEngineStatus(): {
|
|
156
|
-
health: EngineHealthStatus;
|
|
157
|
-
activeSessions: number;
|
|
158
|
-
isShuttingDown: boolean;
|
|
159
|
-
};
|
|
160
|
-
/**
|
|
161
|
-
* Manually trigger engine reset (for debugging/testing)
|
|
162
|
-
*/
|
|
163
|
-
resetEngine(): Promise<void>;
|
|
164
|
-
/**
|
|
165
|
-
* Check if provider is ready for new executions
|
|
166
|
-
*/
|
|
167
|
-
isReady(): boolean;
|
|
168
|
-
}
|
|
169
|
-
export {};
|