@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
@@ -0,0 +1,273 @@
1
+ /**
2
+ * Container runtime detection
3
+ *
4
+ * Auto-detects available container runtimes (docker, podman, nerdctl)
5
+ * and provides runtime status monitoring.
6
+ */
7
+ import { spawnSync } from "node:child_process";
8
+ /**
9
+ * Order of preference for container runtime detection
10
+ */
11
+ const RUNTIME_PREFERENCE = ["docker", "podman", "nerdctl"];
12
+ /**
13
+ * Runtime-specific version commands
14
+ */
15
+ const VERSION_COMMANDS = {
16
+ docker: ["docker", "--version"],
17
+ podman: ["podman", "--version"],
18
+ nerdctl: ["nerdctl", "--version"],
19
+ };
20
+ /**
21
+ * Cached detection result
22
+ */
23
+ let cachedDetection = null;
24
+ let cachedDetectionTime = 0;
25
+ const CACHE_TTL_MS = 60000; // 1 minute
26
+ /**
27
+ * Check if a command is available in PATH
28
+ */
29
+ function commandExists(command) {
30
+ try {
31
+ const result = spawnSync("which", [command], {
32
+ encoding: "utf-8",
33
+ timeout: 5000,
34
+ });
35
+ return result.status === 0 && result.stdout.trim().length > 0;
36
+ }
37
+ catch {
38
+ return false;
39
+ }
40
+ }
41
+ /**
42
+ * Get the version of a container runtime
43
+ */
44
+ function getRuntimeVersion(runtime) {
45
+ try {
46
+ const versionCmd = VERSION_COMMANDS[runtime];
47
+ const cmd = versionCmd[0];
48
+ if (!cmd)
49
+ return undefined;
50
+ const args = versionCmd.slice(1);
51
+ const result = spawnSync(cmd, args, {
52
+ encoding: "utf-8",
53
+ timeout: 5000,
54
+ });
55
+ if (result.status === 0) {
56
+ // Parse version from output
57
+ // Docker: "Docker version 24.0.6, build ed223bc"
58
+ // Podman: "podman version 4.5.1"
59
+ // nerdctl: "nerdctl version 1.5.0"
60
+ const match = result.stdout.match(/(\d+\.\d+\.\d+)/);
61
+ return match?.[1];
62
+ }
63
+ }
64
+ catch {
65
+ // Ignore errors
66
+ }
67
+ return undefined;
68
+ }
69
+ /**
70
+ * Get the path to a runtime binary
71
+ */
72
+ function getRuntimePath(runtime) {
73
+ try {
74
+ const result = spawnSync("which", [runtime], {
75
+ encoding: "utf-8",
76
+ timeout: 5000,
77
+ });
78
+ if (result.status === 0) {
79
+ return result.stdout.trim();
80
+ }
81
+ }
82
+ catch {
83
+ // Ignore errors
84
+ }
85
+ return undefined;
86
+ }
87
+ /**
88
+ * Detect available container runtime
89
+ *
90
+ * Checks for docker, podman, and nerdctl in order of preference.
91
+ * Results are cached for 1 minute.
92
+ *
93
+ * @returns Detection result with runtime info or error
94
+ */
95
+ export function detectRuntime() {
96
+ // Return cached result if still valid
97
+ const now = Date.now();
98
+ if (cachedDetection && now - cachedDetectionTime < CACHE_TTL_MS) {
99
+ return cachedDetection;
100
+ }
101
+ for (const runtime of RUNTIME_PREFERENCE) {
102
+ if (commandExists(runtime)) {
103
+ const version = getRuntimeVersion(runtime);
104
+ const path = getRuntimePath(runtime);
105
+ const result = {
106
+ found: true,
107
+ runtime,
108
+ };
109
+ if (path)
110
+ result.path = path;
111
+ if (version)
112
+ result.version = version;
113
+ cachedDetection = result;
114
+ cachedDetectionTime = now;
115
+ return result;
116
+ }
117
+ }
118
+ const notFoundResult = {
119
+ found: false,
120
+ error: getInstallInstructions(),
121
+ };
122
+ cachedDetection = notFoundResult;
123
+ cachedDetectionTime = now;
124
+ return notFoundResult;
125
+ }
126
+ /**
127
+ * Get helpful installation instructions when no runtime is found
128
+ */
129
+ function getInstallInstructions() {
130
+ const platform = process.platform;
131
+ if (platform === "darwin") {
132
+ return ("No container runtime found. Install Docker Desktop:\n" +
133
+ " brew install --cask docker\n" +
134
+ "Or install Podman:\n" +
135
+ " brew install podman");
136
+ }
137
+ if (platform === "linux") {
138
+ return ("No container runtime found. Install Docker:\n" +
139
+ " curl -fsSL https://get.docker.com | sh\n" +
140
+ "Or install Podman:\n" +
141
+ " sudo apt install podman # Debian/Ubuntu\n" +
142
+ " sudo dnf install podman # Fedora/RHEL");
143
+ }
144
+ if (platform === "win32") {
145
+ return ("No container runtime found. Install Docker Desktop:\n" +
146
+ " winget install Docker.DockerDesktop\n" +
147
+ "Or download from: https://www.docker.com/products/docker-desktop");
148
+ }
149
+ return "No container runtime found. Please install Docker, Podman, or nerdctl.";
150
+ }
151
+ /**
152
+ * Clear the cached detection result
153
+ * Useful after installing a runtime
154
+ */
155
+ export function clearRuntimeCache() {
156
+ cachedDetection = null;
157
+ cachedDetectionTime = 0;
158
+ }
159
+ /**
160
+ * Force detection of a specific runtime
161
+ *
162
+ * @param runtime - The runtime to check
163
+ * @returns Whether the runtime is available
164
+ */
165
+ export function isRuntimeAvailable(runtime) {
166
+ return commandExists(runtime);
167
+ }
168
+ /**
169
+ * Get all available runtimes
170
+ *
171
+ * @returns Array of available runtimes
172
+ */
173
+ export function getAvailableRuntimes() {
174
+ return RUNTIME_PREFERENCE.filter((runtime) => commandExists(runtime));
175
+ }
176
+ /**
177
+ * Runtime status tracker for health monitoring
178
+ */
179
+ export class RuntimeStatusTracker {
180
+ status;
181
+ healthCheckInterval = null;
182
+ constructor(runtime) {
183
+ this.status = {
184
+ available: true,
185
+ runtime,
186
+ engineHealthy: true,
187
+ lastHealthCheck: new Date(),
188
+ failureCount: 0,
189
+ };
190
+ }
191
+ /**
192
+ * Record a successful operation
193
+ */
194
+ recordSuccess() {
195
+ this.status.failureCount = 0;
196
+ this.status.engineHealthy = true;
197
+ this.status.lastHealthCheck = new Date();
198
+ }
199
+ /**
200
+ * Record a failed operation
201
+ *
202
+ * @returns Whether the engine should be reset (3+ consecutive failures)
203
+ */
204
+ recordFailure() {
205
+ this.status.failureCount++;
206
+ this.status.lastHealthCheck = new Date();
207
+ if (this.status.failureCount >= 3) {
208
+ this.status.engineHealthy = false;
209
+ return true; // Engine needs reset
210
+ }
211
+ return false;
212
+ }
213
+ /**
214
+ * Get current status
215
+ */
216
+ getStatus() {
217
+ return { ...this.status };
218
+ }
219
+ /**
220
+ * Check if engine needs reset
221
+ */
222
+ needsReset() {
223
+ return this.status.failureCount >= 3;
224
+ }
225
+ /**
226
+ * Reset failure count after engine restart
227
+ */
228
+ resetFailureCount() {
229
+ this.status.failureCount = 0;
230
+ this.status.engineHealthy = true;
231
+ }
232
+ /**
233
+ * Start periodic health checks
234
+ *
235
+ * @param intervalMs - Check interval in milliseconds (default: 60000)
236
+ * @param onUnhealthy - Callback when engine becomes unhealthy
237
+ */
238
+ startHealthChecks(intervalMs = 60000, onUnhealthy) {
239
+ if (this.healthCheckInterval) {
240
+ clearInterval(this.healthCheckInterval);
241
+ }
242
+ this.healthCheckInterval = setInterval(() => {
243
+ const detection = detectRuntime();
244
+ this.status.available = detection.found;
245
+ this.status.lastHealthCheck = new Date();
246
+ if (!detection.found || !this.status.engineHealthy) {
247
+ onUnhealthy?.(this.status);
248
+ }
249
+ }, intervalMs);
250
+ }
251
+ /**
252
+ * Stop periodic health checks
253
+ */
254
+ stopHealthChecks() {
255
+ if (this.healthCheckInterval) {
256
+ clearInterval(this.healthCheckInterval);
257
+ this.healthCheckInterval = null;
258
+ }
259
+ }
260
+ }
261
+ /**
262
+ * Create a runtime status tracker for the detected runtime
263
+ *
264
+ * @returns Status tracker or null if no runtime found
265
+ */
266
+ export function createRuntimeTracker() {
267
+ const detection = detectRuntime();
268
+ if (!detection.found || !detection.runtime) {
269
+ return null;
270
+ }
271
+ return new RuntimeStatusTracker(detection.runtime);
272
+ }
273
+ //# sourceMappingURL=runtime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../src/execution/runtime.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAG/C;;GAEG;AACH,MAAM,kBAAkB,GAAuB,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;AAE/E;;GAEG;AACH,MAAM,gBAAgB,GAAuC;IAC3D,MAAM,EAAE,CAAC,QAAQ,EAAE,WAAW,CAAC;IAC/B,MAAM,EAAE,CAAC,QAAQ,EAAE,WAAW,CAAC;IAC/B,OAAO,EAAE,CAAC,SAAS,EAAE,WAAW,CAAC;CAClC,CAAC;AAEF;;GAEG;AACH,IAAI,eAAe,GAA4B,IAAI,CAAC;AACpD,IAAI,mBAAmB,GAAG,CAAC,CAAC;AAC5B,MAAM,YAAY,GAAG,KAAK,CAAC,CAAC,WAAW;AAEvC;;GAEG;AACH,SAAS,aAAa,CAAC,OAAe;IACpC,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,EAAE;YAC3C,QAAQ,EAAE,OAAO;YACjB,OAAO,EAAE,IAAI;SACd,CAAC,CAAC;QACH,OAAO,MAAM,CAAC,MAAM,KAAK,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CA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mB,EAAE,CAAC;YAC7B,aAAa,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;YACxC,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC;QAClC,CAAC;IACH,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB;IAClC,MAAM,SAAS,GAAG,aAAa,EAAE,CAAC;IAClC,IAAI,CAAC,SAAS,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;QAC3C,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,IAAI,oBAAoB,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;AACrD,CAAC"}
@@ -0,0 +1,306 @@
1
+ /**
2
+ * Type definitions for the Enact execution engine
3
+ * Provides interfaces for tool execution, container management, and results
4
+ */
5
+ import type { ToolManifest } from "../types/manifest";
6
+ /**
7
+ * Input to a tool execution
8
+ */
9
+ export interface ExecutionInput {
10
+ /** Input parameters (key-value pairs) */
11
+ params: Record<string, unknown>;
12
+ /** Files to mount into the container (path -> content/source) */
13
+ files?: Record<string, FileInput>;
14
+ /** Secret overrides (secret name -> Dagger URI) */
15
+ secretOverrides?: Record<string, string>;
16
+ /** Environment variable overrides */
17
+ envOverrides?: Record<string, string>;
18
+ }
19
+ /**
20
+ * File input for execution
21
+ */
22
+ export interface FileInput {
23
+ /** File content (string or Buffer) */
24
+ content?: string | Buffer;
25
+ /** Path to source file on host */
26
+ sourcePath?: string;
27
+ /** Target path in container */
28
+ targetPath: string;
29
+ }
30
+ /**
31
+ * Output from a tool execution
32
+ */
33
+ export interface ExecutionOutput {
34
+ /** Standard output from the container */
35
+ stdout: string;
36
+ /** Standard error from the container */
37
+ stderr: string;
38
+ /** Exit code from the container */
39
+ exitCode: number;
40
+ /** Parsed output (if outputSchema is defined and output is JSON) */
41
+ parsed?: unknown;
42
+ /** Files extracted from the container */
43
+ files?: Record<string, Buffer>;
44
+ }
45
+ /**
46
+ * Result of a tool execution
47
+ */
48
+ export interface ExecutionResult {
49
+ /** Whether the execution was successful */
50
+ success: boolean;
51
+ /** Output from the execution */
52
+ output: ExecutionOutput;
53
+ /** Execution metadata */
54
+ metadata: ExecutionMetadata;
55
+ /** Error information (if failed) */
56
+ error?: ExecutionError;
57
+ }
58
+ /**
59
+ * Metadata about the execution
60
+ */
61
+ export interface ExecutionMetadata {
62
+ /** Tool name */
63
+ toolName: string;
64
+ /** Tool version (if available) */
65
+ toolVersion?: string;
66
+ /** Container image used */
67
+ containerImage: string;
68
+ /** Start time */
69
+ startTime: Date;
70
+ /** End time */
71
+ endTime: Date;
72
+ /** Duration in milliseconds */
73
+ durationMs: number;
74
+ /** Whether the result came from cache */
75
+ cached: boolean;
76
+ /** Execution ID for tracking */
77
+ executionId: string;
78
+ }
79
+ /**
80
+ * Error codes for execution failures
81
+ */
82
+ export type ExecutionErrorCode = "TIMEOUT" | "CONTAINER_ERROR" | "VALIDATION_ERROR" | "SECRET_ERROR" | "NETWORK_ERROR" | "RUNTIME_NOT_FOUND" | "ENGINE_ERROR" | "COMMAND_ERROR" | "UNKNOWN";
83
+ /**
84
+ * Execution error with details
85
+ */
86
+ export interface ExecutionError {
87
+ /** Error code for programmatic handling */
88
+ code: ExecutionErrorCode;
89
+ /** Human-readable error message */
90
+ message: string;
91
+ /** Stack trace (if available) */
92
+ stack?: string;
93
+ /** Additional error details */
94
+ details?: Record<string, unknown>;
95
+ /** Suggested action to resolve */
96
+ suggestion?: string;
97
+ }
98
+ /**
99
+ * Options for tool execution
100
+ */
101
+ export interface ExecutionOptions {
102
+ /** Timeout override (default from manifest or 30s) */
103
+ timeout?: string;
104
+ /** Working directory in container */
105
+ workdir?: string;
106
+ /** Whether to stream output in real-time */
107
+ stream?: boolean;
108
+ /** Callback for streaming output */
109
+ onOutput?: (type: "stdout" | "stderr", data: string) => void;
110
+ /** Whether to disable network access */
111
+ networkDisabled?: boolean;
112
+ /** Additional environment variables */
113
+ additionalEnv?: Record<string, string>;
114
+ /** Mount host directories (host path -> container path) */
115
+ mountDirs?: Record<string, string>;
116
+ /** Output files to extract (container path) */
117
+ outputFiles?: string[];
118
+ /** Retry configuration */
119
+ retry?: RetryConfig;
120
+ /** Dry run mode (don't actually execute) */
121
+ dryRun?: boolean;
122
+ }
123
+ /**
124
+ * Retry configuration for transient failures
125
+ */
126
+ export interface RetryConfig {
127
+ /** Maximum number of retries */
128
+ maxRetries: number;
129
+ /** Initial delay in ms (for exponential backoff) */
130
+ initialDelayMs: number;
131
+ /** Maximum delay in ms */
132
+ maxDelayMs: number;
133
+ /** Error codes that should trigger a retry */
134
+ retryableCodes: ExecutionErrorCode[];
135
+ }
136
+ /**
137
+ * Default retry configuration
138
+ */
139
+ export declare const DEFAULT_RETRY_CONFIG: RetryConfig;
140
+ /**
141
+ * Supported container runtimes
142
+ */
143
+ export type ContainerRuntime = "docker" | "podman" | "nerdctl";
144
+ /**
145
+ * Container runtime detection result
146
+ */
147
+ export interface RuntimeDetection {
148
+ /** Whether a runtime was found */
149
+ found: boolean;
150
+ /** The detected runtime */
151
+ runtime?: ContainerRuntime;
152
+ /** Path to the runtime binary */
153
+ path?: string;
154
+ /** Runtime version */
155
+ version?: string;
156
+ /** Error if detection failed */
157
+ error?: string;
158
+ }
159
+ /**
160
+ * Container runtime status
161
+ */
162
+ export interface RuntimeStatus {
163
+ /** Whether the runtime is available */
164
+ available: boolean;
165
+ /** The runtime in use */
166
+ runtime: ContainerRuntime;
167
+ /** Whether the engine is healthy */
168
+ engineHealthy: boolean;
169
+ /** Last health check time */
170
+ lastHealthCheck: Date;
171
+ /** Consecutive failure count */
172
+ failureCount: number;
173
+ }
174
+ /**
175
+ * Engine health check result
176
+ */
177
+ export interface EngineHealth {
178
+ /** Whether the engine is healthy */
179
+ healthy: boolean;
180
+ /** Container runtime being used */
181
+ runtime: ContainerRuntime;
182
+ /** Engine version */
183
+ version?: string;
184
+ /** Last successful operation time */
185
+ lastSuccess?: Date;
186
+ /** Consecutive failure count */
187
+ consecutiveFailures: number;
188
+ /** Error message if unhealthy */
189
+ error?: string;
190
+ }
191
+ /**
192
+ * Engine state for tracking health
193
+ */
194
+ export interface EngineState {
195
+ /** Current health status */
196
+ health: EngineHealth;
197
+ /** Whether engine needs reset */
198
+ needsReset: boolean;
199
+ /** Time of last reset */
200
+ lastReset?: Date;
201
+ /** Total executions */
202
+ totalExecutions: number;
203
+ /** Successful executions */
204
+ successfulExecutions: number;
205
+ }
206
+ /**
207
+ * Interface for execution providers
208
+ * Allows for different implementations (Dagger, mock, etc.)
209
+ */
210
+ export interface ExecutionProvider {
211
+ /** Provider name */
212
+ readonly name: string;
213
+ /** Initialize the provider */
214
+ initialize(): Promise<void>;
215
+ /** Check if the provider is available */
216
+ isAvailable(): Promise<boolean>;
217
+ /** Get provider health status */
218
+ getHealth(): Promise<EngineHealth>;
219
+ /** Execute a tool */
220
+ execute(manifest: ToolManifest, input: ExecutionInput, options?: ExecutionOptions): Promise<ExecutionResult>;
221
+ /** Execute a raw command in a tool's container */
222
+ exec(manifest: ToolManifest, command: string, options?: ExecutionOptions): Promise<ExecutionResult>;
223
+ /** Shutdown the provider */
224
+ shutdown(): Promise<void>;
225
+ }
226
+ /**
227
+ * Parsed command with tokens
228
+ */
229
+ export interface ParsedCommand {
230
+ /** Original command string */
231
+ original: string;
232
+ /** Parsed tokens (strings and parameters) */
233
+ tokens: CommandToken[];
234
+ /** Parameters found in the command */
235
+ parameters: string[];
236
+ }
237
+ /**
238
+ * A token in a parsed command
239
+ */
240
+ export type CommandToken = {
241
+ type: "literal";
242
+ value: string;
243
+ } | {
244
+ type: "parameter";
245
+ name: string;
246
+ };
247
+ /**
248
+ * Command interpolation options
249
+ */
250
+ export interface InterpolationOptions {
251
+ /** Whether to shell-escape values */
252
+ escape?: boolean;
253
+ /** Whether to JSON-stringify objects */
254
+ jsonifyObjects?: boolean;
255
+ /** Missing parameter handling */
256
+ onMissing?: "error" | "empty" | "keep";
257
+ }
258
+ /**
259
+ * Result of input validation
260
+ */
261
+ export interface InputValidationResult {
262
+ /** Whether inputs are valid */
263
+ valid: boolean;
264
+ /** Validation errors */
265
+ errors: InputValidationError[];
266
+ /** Coerced/normalized values */
267
+ coercedValues?: Record<string, unknown>;
268
+ }
269
+ /**
270
+ * Input validation error
271
+ */
272
+ export interface InputValidationError {
273
+ /** Parameter path (e.g., "params.name" or "params.config.timeout") */
274
+ path: string;
275
+ /** Error message */
276
+ message: string;
277
+ /** Expected type or format */
278
+ expected?: string;
279
+ /** Actual value received */
280
+ actual?: unknown;
281
+ }
282
+ /**
283
+ * Dry run result showing what would be executed
284
+ */
285
+ export interface DryRunResult {
286
+ /** Tool name */
287
+ toolName: string;
288
+ /** Container image that would be used */
289
+ containerImage: string;
290
+ /** Interpolated command that would run */
291
+ command: string;
292
+ /** Environment variables that would be set (secrets masked) */
293
+ environment: Record<string, string>;
294
+ /** Secrets that would be injected (names only) */
295
+ secrets: string[];
296
+ /** Files that would be mounted */
297
+ mounts: Array<{
298
+ source: string;
299
+ target: string;
300
+ }>;
301
+ /** Timeout that would be applied */
302
+ timeout: string;
303
+ /** Input validation result */
304
+ validation: InputValidationResult;
305
+ }
306
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/execution/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAMtD;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,yCAAyC;IACzC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,iEAAiE;IACjE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAClC,mDAAmD;IACnD,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC,qCAAqC;IACrC,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAA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+ * Provides interfaces for tool execution, container management, and results
4
+ */
5
+ /**
6
+ * Default retry configuration
7
+ */
8
+ export const DEFAULT_RETRY_CONFIG = {
9
+ maxRetries: 3,
10
+ initialDelayMs: 1000,
11
+ maxDelayMs: 8000,
12
+ retryableCodes: ["NETWORK_ERROR", "ENGINE_ERROR", "TIMEOUT"],
13
+ };
14
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/execution/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAgKH;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAgB;IAC/C,UAAU,EAAE,CAAC;IACb,cAAc,EAAE,IAAI;IACpB,UAAU,EAAE,IAAI;IAChB,cAAc,EAAE,CAAC,eAAe,EAAE,cAAc,EAAE,SAAS,CAAC;CAC7D,CAAC"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Input validation using JSON Schema
3
+ *
4
+ * Validates tool inputs against the manifest's inputSchema.
5
+ */
6
+ import type { JSONSchema7 } from "json-schema";
7
+ import type { InputValidationResult } from "./types";
8
+ /**
9
+ * Validate inputs against a JSON Schema
10
+ *
11
+ * @param inputs - The inputs to validate
12
+ * @param schema - The JSON Schema to validate against
13
+ * @returns Validation result with errors and coerced values
14
+ */
15
+ export declare function validateInputs(inputs: Record<string, unknown>, schema: JSONSchema7 | undefined): InputValidationResult;
16
+ /**
17
+ * Apply default values from schema to inputs
18
+ *
19
+ * @param inputs - Current inputs
20
+ * @param schema - Input schema with defaults
21
+ * @returns Inputs with defaults applied
22
+ */
23
+ export declare function applyDefaults(inputs: Record<string, unknown>, schema: JSONSchema7 | undefined): Record<string, unknown>;
24
+ /**
25
+ * Get the list of required parameters from a schema
26
+ *
27
+ * @param schema - Input schema
28
+ * @returns Array of required parameter names
29
+ */
30
+ export declare function getRequiredParams(schema: JSONSchema7 | undefined): string[];
31
+ /**
32
+ * Get parameter info from schema for help/documentation
33
+ *
34
+ * @param schema - Input schema
35
+ * @returns Map of parameter name to info
36
+ */
37
+ export declare function getParamInfo(schema: JSONSchema7 | undefined): Map<string, {
38
+ type: string;
39
+ description?: string | undefined;
40
+ required: boolean;
41
+ default?: unknown;
42
+ }>;
43
+ //# sourceMappingURL=validation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/execution/validation.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAwB,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAE3E;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,MAAM,EAAE,WAAW,GAAG,SAAS,GAC9B,qBAAqB,CA6DvB;AAqVD;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,MAAM,EAAE,WAAW,GAAG,SAAS,GAC9B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAiBzB;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,WAAW,GAAG,SAAS,GAAG,MAAM,EAAE,CAK3E;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,WAAW,GAAG,SAAS,GAC9B,GAAG,CACJ,MAAM,EACN;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CACzF,CAiCA"}