@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.
- package/README.md +44 -0
- package/dist/config.d.ts +164 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +386 -0
- package/dist/config.js.map +1 -0
- package/dist/constants.d.ts +15 -5
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +24 -8
- package/dist/constants.js.map +1 -0
- package/dist/execution/command.d.ts +102 -0
- package/dist/execution/command.d.ts.map +1 -0
- package/dist/execution/command.js +262 -0
- package/dist/execution/command.js.map +1 -0
- package/dist/execution/index.d.ts +12 -0
- package/dist/execution/index.d.ts.map +1 -0
- package/dist/execution/index.js +17 -0
- package/dist/execution/index.js.map +1 -0
- package/dist/execution/runtime.d.ts +82 -0
- package/dist/execution/runtime.d.ts.map +1 -0
- package/dist/execution/runtime.js +273 -0
- package/dist/execution/runtime.js.map +1 -0
- package/dist/execution/types.d.ts +306 -0
- package/dist/execution/types.d.ts.map +1 -0
- package/dist/execution/types.js +14 -0
- package/dist/execution/types.js.map +1 -0
- package/dist/execution/validation.d.ts +43 -0
- package/dist/execution/validation.d.ts.map +1 -0
- package/dist/execution/validation.js +430 -0
- package/dist/execution/validation.js.map +1 -0
- package/dist/index.d.ts +21 -21
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +49 -25
- package/dist/index.js.map +1 -0
- package/dist/manifest/index.d.ts +7 -0
- package/dist/manifest/index.d.ts.map +1 -0
- package/dist/manifest/index.js +10 -0
- package/dist/manifest/index.js.map +1 -0
- package/dist/manifest/loader.d.ts +76 -0
- package/dist/manifest/loader.d.ts.map +1 -0
- package/dist/manifest/loader.js +146 -0
- package/dist/manifest/loader.js.map +1 -0
- package/dist/manifest/parser.d.ts +64 -0
- package/dist/manifest/parser.d.ts.map +1 -0
- package/dist/manifest/parser.js +135 -0
- package/dist/manifest/parser.js.map +1 -0
- package/dist/manifest/validator.d.ts +95 -0
- package/dist/manifest/validator.d.ts.map +1 -0
- package/dist/manifest/validator.js +258 -0
- package/dist/manifest/validator.js.map +1 -0
- package/dist/paths.d.ts +57 -0
- package/dist/paths.d.ts.map +1 -0
- package/dist/paths.js +93 -0
- package/dist/paths.js.map +1 -0
- package/dist/registry.d.ts +73 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +147 -0
- package/dist/registry.js.map +1 -0
- package/dist/resolver.d.ts +89 -0
- package/dist/resolver.d.ts.map +1 -0
- package/dist/resolver.js +282 -0
- package/dist/resolver.js.map +1 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +5 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/manifest.d.ts +201 -0
- package/dist/types/manifest.d.ts.map +1 -0
- package/dist/types/manifest.js +13 -0
- package/dist/types/manifest.js.map +1 -0
- package/dist/types.d.ts +5 -132
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -3
- package/dist/types.js.map +1 -0
- package/dist/utils/fs.d.ts +105 -0
- package/dist/utils/fs.d.ts.map +1 -0
- package/dist/utils/fs.js +233 -0
- package/dist/utils/fs.js.map +1 -0
- package/dist/utils/logger.d.ts +102 -25
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +214 -57
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/version.d.ts +60 -2
- package/dist/utils/version.d.ts.map +1 -0
- package/dist/utils/version.js +255 -31
- package/dist/utils/version.js.map +1 -0
- package/package.json +16 -58
- package/src/config.ts +510 -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 +238 -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/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/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/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/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/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/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
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for the Enact execution engine
|
|
3
|
+
* Provides interfaces for tool execution, container management, and results
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { ToolManifest } from "../types/manifest";
|
|
7
|
+
|
|
8
|
+
// ============================================================================
|
|
9
|
+
// Execution Input/Output Types
|
|
10
|
+
// ============================================================================
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Input to a tool execution
|
|
14
|
+
*/
|
|
15
|
+
export interface ExecutionInput {
|
|
16
|
+
/** Input parameters (key-value pairs) */
|
|
17
|
+
params: Record<string, unknown>;
|
|
18
|
+
/** Files to mount into the container (path -> content/source) */
|
|
19
|
+
files?: Record<string, FileInput>;
|
|
20
|
+
/** Secret overrides (secret name -> Dagger URI) */
|
|
21
|
+
secretOverrides?: Record<string, string>;
|
|
22
|
+
/** Environment variable overrides */
|
|
23
|
+
envOverrides?: Record<string, string>;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* File input for execution
|
|
28
|
+
*/
|
|
29
|
+
export interface FileInput {
|
|
30
|
+
/** File content (string or Buffer) */
|
|
31
|
+
content?: string | Buffer;
|
|
32
|
+
/** Path to source file on host */
|
|
33
|
+
sourcePath?: string;
|
|
34
|
+
/** Target path in container */
|
|
35
|
+
targetPath: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Output from a tool execution
|
|
40
|
+
*/
|
|
41
|
+
export interface ExecutionOutput {
|
|
42
|
+
/** Standard output from the container */
|
|
43
|
+
stdout: string;
|
|
44
|
+
/** Standard error from the container */
|
|
45
|
+
stderr: string;
|
|
46
|
+
/** Exit code from the container */
|
|
47
|
+
exitCode: number;
|
|
48
|
+
/** Parsed output (if outputSchema is defined and output is JSON) */
|
|
49
|
+
parsed?: unknown;
|
|
50
|
+
/** Files extracted from the container */
|
|
51
|
+
files?: Record<string, Buffer>;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Result of a tool execution
|
|
56
|
+
*/
|
|
57
|
+
export interface ExecutionResult {
|
|
58
|
+
/** Whether the execution was successful */
|
|
59
|
+
success: boolean;
|
|
60
|
+
/** Output from the execution */
|
|
61
|
+
output: ExecutionOutput;
|
|
62
|
+
/** Execution metadata */
|
|
63
|
+
metadata: ExecutionMetadata;
|
|
64
|
+
/** Error information (if failed) */
|
|
65
|
+
error?: ExecutionError;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Metadata about the execution
|
|
70
|
+
*/
|
|
71
|
+
export interface ExecutionMetadata {
|
|
72
|
+
/** Tool name */
|
|
73
|
+
toolName: string;
|
|
74
|
+
/** Tool version (if available) */
|
|
75
|
+
toolVersion?: string;
|
|
76
|
+
/** Container image used */
|
|
77
|
+
containerImage: string;
|
|
78
|
+
/** Start time */
|
|
79
|
+
startTime: Date;
|
|
80
|
+
/** End time */
|
|
81
|
+
endTime: Date;
|
|
82
|
+
/** Duration in milliseconds */
|
|
83
|
+
durationMs: number;
|
|
84
|
+
/** Whether the result came from cache */
|
|
85
|
+
cached: boolean;
|
|
86
|
+
/** Execution ID for tracking */
|
|
87
|
+
executionId: string;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Error codes for execution failures
|
|
92
|
+
*/
|
|
93
|
+
export type ExecutionErrorCode =
|
|
94
|
+
| "TIMEOUT"
|
|
95
|
+
| "CONTAINER_ERROR"
|
|
96
|
+
| "VALIDATION_ERROR"
|
|
97
|
+
| "SECRET_ERROR"
|
|
98
|
+
| "NETWORK_ERROR"
|
|
99
|
+
| "RUNTIME_NOT_FOUND"
|
|
100
|
+
| "ENGINE_ERROR"
|
|
101
|
+
| "COMMAND_ERROR"
|
|
102
|
+
| "UNKNOWN";
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Execution error with details
|
|
106
|
+
*/
|
|
107
|
+
export interface ExecutionError {
|
|
108
|
+
/** Error code for programmatic handling */
|
|
109
|
+
code: ExecutionErrorCode;
|
|
110
|
+
/** Human-readable error message */
|
|
111
|
+
message: string;
|
|
112
|
+
/** Stack trace (if available) */
|
|
113
|
+
stack?: string;
|
|
114
|
+
/** Additional error details */
|
|
115
|
+
details?: Record<string, unknown>;
|
|
116
|
+
/** Suggested action to resolve */
|
|
117
|
+
suggestion?: string;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// ============================================================================
|
|
121
|
+
// Execution Options
|
|
122
|
+
// ============================================================================
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Options for tool execution
|
|
126
|
+
*/
|
|
127
|
+
export interface ExecutionOptions {
|
|
128
|
+
/** Timeout override (default from manifest or 30s) */
|
|
129
|
+
timeout?: string;
|
|
130
|
+
/** Working directory in container */
|
|
131
|
+
workdir?: string;
|
|
132
|
+
/** Whether to stream output in real-time */
|
|
133
|
+
stream?: boolean;
|
|
134
|
+
/** Callback for streaming output */
|
|
135
|
+
onOutput?: (type: "stdout" | "stderr", data: string) => void;
|
|
136
|
+
/** Whether to disable network access */
|
|
137
|
+
networkDisabled?: boolean;
|
|
138
|
+
/** Additional environment variables */
|
|
139
|
+
additionalEnv?: Record<string, string>;
|
|
140
|
+
/** Mount host directories (host path -> container path) */
|
|
141
|
+
mountDirs?: Record<string, string>;
|
|
142
|
+
/** Output files to extract (container path) */
|
|
143
|
+
outputFiles?: string[];
|
|
144
|
+
/** Retry configuration */
|
|
145
|
+
retry?: RetryConfig;
|
|
146
|
+
/** Dry run mode (don't actually execute) */
|
|
147
|
+
dryRun?: boolean;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Retry configuration for transient failures
|
|
152
|
+
*/
|
|
153
|
+
export interface RetryConfig {
|
|
154
|
+
/** Maximum number of retries */
|
|
155
|
+
maxRetries: number;
|
|
156
|
+
/** Initial delay in ms (for exponential backoff) */
|
|
157
|
+
initialDelayMs: number;
|
|
158
|
+
/** Maximum delay in ms */
|
|
159
|
+
maxDelayMs: number;
|
|
160
|
+
/** Error codes that should trigger a retry */
|
|
161
|
+
retryableCodes: ExecutionErrorCode[];
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Default retry configuration
|
|
166
|
+
*/
|
|
167
|
+
export const DEFAULT_RETRY_CONFIG: RetryConfig = {
|
|
168
|
+
maxRetries: 3,
|
|
169
|
+
initialDelayMs: 1000,
|
|
170
|
+
maxDelayMs: 8000,
|
|
171
|
+
retryableCodes: ["NETWORK_ERROR", "ENGINE_ERROR", "TIMEOUT"],
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
// ============================================================================
|
|
175
|
+
// Container Runtime Types
|
|
176
|
+
// ============================================================================
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Supported container runtimes
|
|
180
|
+
*/
|
|
181
|
+
export type ContainerRuntime = "docker" | "podman" | "nerdctl";
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Container runtime detection result
|
|
185
|
+
*/
|
|
186
|
+
export interface RuntimeDetection {
|
|
187
|
+
/** Whether a runtime was found */
|
|
188
|
+
found: boolean;
|
|
189
|
+
/** The detected runtime */
|
|
190
|
+
runtime?: ContainerRuntime;
|
|
191
|
+
/** Path to the runtime binary */
|
|
192
|
+
path?: string;
|
|
193
|
+
/** Runtime version */
|
|
194
|
+
version?: string;
|
|
195
|
+
/** Error if detection failed */
|
|
196
|
+
error?: string;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Container runtime status
|
|
201
|
+
*/
|
|
202
|
+
export interface RuntimeStatus {
|
|
203
|
+
/** Whether the runtime is available */
|
|
204
|
+
available: boolean;
|
|
205
|
+
/** The runtime in use */
|
|
206
|
+
runtime: ContainerRuntime;
|
|
207
|
+
/** Whether the engine is healthy */
|
|
208
|
+
engineHealthy: boolean;
|
|
209
|
+
/** Last health check time */
|
|
210
|
+
lastHealthCheck: Date;
|
|
211
|
+
/** Consecutive failure count */
|
|
212
|
+
failureCount: number;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// ============================================================================
|
|
216
|
+
// Engine Health Types
|
|
217
|
+
// ============================================================================
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Engine health check result
|
|
221
|
+
*/
|
|
222
|
+
export interface EngineHealth {
|
|
223
|
+
/** Whether the engine is healthy */
|
|
224
|
+
healthy: boolean;
|
|
225
|
+
/** Container runtime being used */
|
|
226
|
+
runtime: ContainerRuntime;
|
|
227
|
+
/** Engine version */
|
|
228
|
+
version?: string;
|
|
229
|
+
/** Last successful operation time */
|
|
230
|
+
lastSuccess?: Date;
|
|
231
|
+
/** Consecutive failure count */
|
|
232
|
+
consecutiveFailures: number;
|
|
233
|
+
/** Error message if unhealthy */
|
|
234
|
+
error?: string;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Engine state for tracking health
|
|
239
|
+
*/
|
|
240
|
+
export interface EngineState {
|
|
241
|
+
/** Current health status */
|
|
242
|
+
health: EngineHealth;
|
|
243
|
+
/** Whether engine needs reset */
|
|
244
|
+
needsReset: boolean;
|
|
245
|
+
/** Time of last reset */
|
|
246
|
+
lastReset?: Date;
|
|
247
|
+
/** Total executions */
|
|
248
|
+
totalExecutions: number;
|
|
249
|
+
/** Successful executions */
|
|
250
|
+
successfulExecutions: number;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
// ============================================================================
|
|
254
|
+
// Execution Provider Interface
|
|
255
|
+
// ============================================================================
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Interface for execution providers
|
|
259
|
+
* Allows for different implementations (Dagger, mock, etc.)
|
|
260
|
+
*/
|
|
261
|
+
export interface ExecutionProvider {
|
|
262
|
+
/** Provider name */
|
|
263
|
+
readonly name: string;
|
|
264
|
+
|
|
265
|
+
/** Initialize the provider */
|
|
266
|
+
initialize(): Promise<void>;
|
|
267
|
+
|
|
268
|
+
/** Check if the provider is available */
|
|
269
|
+
isAvailable(): Promise<boolean>;
|
|
270
|
+
|
|
271
|
+
/** Get provider health status */
|
|
272
|
+
getHealth(): Promise<EngineHealth>;
|
|
273
|
+
|
|
274
|
+
/** Execute a tool */
|
|
275
|
+
execute(
|
|
276
|
+
manifest: ToolManifest,
|
|
277
|
+
input: ExecutionInput,
|
|
278
|
+
options?: ExecutionOptions
|
|
279
|
+
): Promise<ExecutionResult>;
|
|
280
|
+
|
|
281
|
+
/** Execute a raw command in a tool's container */
|
|
282
|
+
exec(
|
|
283
|
+
manifest: ToolManifest,
|
|
284
|
+
command: string,
|
|
285
|
+
options?: ExecutionOptions
|
|
286
|
+
): Promise<ExecutionResult>;
|
|
287
|
+
|
|
288
|
+
/** Shutdown the provider */
|
|
289
|
+
shutdown(): Promise<void>;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
// ============================================================================
|
|
293
|
+
// Command Interpolation Types
|
|
294
|
+
// ============================================================================
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* Parsed command with tokens
|
|
298
|
+
*/
|
|
299
|
+
export interface ParsedCommand {
|
|
300
|
+
/** Original command string */
|
|
301
|
+
original: string;
|
|
302
|
+
/** Parsed tokens (strings and parameters) */
|
|
303
|
+
tokens: CommandToken[];
|
|
304
|
+
/** Parameters found in the command */
|
|
305
|
+
parameters: string[];
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* A token in a parsed command
|
|
310
|
+
*/
|
|
311
|
+
export type CommandToken = { type: "literal"; value: string } | { type: "parameter"; name: string };
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* Command interpolation options
|
|
315
|
+
*/
|
|
316
|
+
export interface InterpolationOptions {
|
|
317
|
+
/** Whether to shell-escape values */
|
|
318
|
+
escape?: boolean;
|
|
319
|
+
/** Whether to JSON-stringify objects */
|
|
320
|
+
jsonifyObjects?: boolean;
|
|
321
|
+
/** Missing parameter handling */
|
|
322
|
+
onMissing?: "error" | "empty" | "keep";
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
// ============================================================================
|
|
326
|
+
// Input Validation Types
|
|
327
|
+
// ============================================================================
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* Result of input validation
|
|
331
|
+
*/
|
|
332
|
+
export interface InputValidationResult {
|
|
333
|
+
/** Whether inputs are valid */
|
|
334
|
+
valid: boolean;
|
|
335
|
+
/** Validation errors */
|
|
336
|
+
errors: InputValidationError[];
|
|
337
|
+
/** Coerced/normalized values */
|
|
338
|
+
coercedValues?: Record<string, unknown>;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* Input validation error
|
|
343
|
+
*/
|
|
344
|
+
export interface InputValidationError {
|
|
345
|
+
/** Parameter path (e.g., "params.name" or "params.config.timeout") */
|
|
346
|
+
path: string;
|
|
347
|
+
/** Error message */
|
|
348
|
+
message: string;
|
|
349
|
+
/** Expected type or format */
|
|
350
|
+
expected?: string;
|
|
351
|
+
/** Actual value received */
|
|
352
|
+
actual?: unknown;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
// ============================================================================
|
|
356
|
+
// Dry Run Types
|
|
357
|
+
// ============================================================================
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* Dry run result showing what would be executed
|
|
361
|
+
*/
|
|
362
|
+
export interface DryRunResult {
|
|
363
|
+
/** Tool name */
|
|
364
|
+
toolName: string;
|
|
365
|
+
/** Container image that would be used */
|
|
366
|
+
containerImage: string;
|
|
367
|
+
/** Interpolated command that would run */
|
|
368
|
+
command: string;
|
|
369
|
+
/** Environment variables that would be set (secrets masked) */
|
|
370
|
+
environment: Record<string, string>;
|
|
371
|
+
/** Secrets that would be injected (names only) */
|
|
372
|
+
secrets: string[];
|
|
373
|
+
/** Files that would be mounted */
|
|
374
|
+
mounts: Array<{ source: string; target: string }>;
|
|
375
|
+
/** Timeout that would be applied */
|
|
376
|
+
timeout: string;
|
|
377
|
+
/** Input validation result */
|
|
378
|
+
validation: InputValidationResult;
|
|
379
|
+
}
|