@enactprotocol/shared 1.0.12

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 (97) hide show
  1. package/dist/LocalToolResolver.d.ts +84 -0
  2. package/dist/LocalToolResolver.js +353 -0
  3. package/dist/api/enact-api.d.ts +124 -0
  4. package/dist/api/enact-api.js +406 -0
  5. package/dist/api/index.d.ts +2 -0
  6. package/dist/api/index.js +2 -0
  7. package/dist/api/types.d.ts +83 -0
  8. package/dist/api/types.js +1 -0
  9. package/dist/core/DaggerExecutionProvider.d.ts +169 -0
  10. package/dist/core/DaggerExecutionProvider.js +996 -0
  11. package/dist/core/DirectExecutionProvider.d.ts +23 -0
  12. package/dist/core/DirectExecutionProvider.js +406 -0
  13. package/dist/core/EnactCore.d.ts +138 -0
  14. package/dist/core/EnactCore.js +609 -0
  15. package/dist/core/index.d.ts +3 -0
  16. package/dist/core/index.js +3 -0
  17. package/dist/exec/index.d.ts +3 -0
  18. package/dist/exec/index.js +3 -0
  19. package/dist/exec/logger.d.ts +11 -0
  20. package/dist/exec/logger.js +57 -0
  21. package/dist/exec/validate.d.ts +5 -0
  22. package/dist/exec/validate.js +167 -0
  23. package/dist/index.d.ts +25 -0
  24. package/dist/index.js +29 -0
  25. package/dist/lib/enact-direct.d.ts +156 -0
  26. package/dist/lib/enact-direct.js +158 -0
  27. package/dist/lib/index.d.ts +1 -0
  28. package/dist/lib/index.js +1 -0
  29. package/dist/security/index.d.ts +3 -0
  30. package/dist/security/index.js +3 -0
  31. package/dist/security/security.d.ts +23 -0
  32. package/dist/security/security.js +137 -0
  33. package/dist/security/sign.d.ts +103 -0
  34. package/dist/security/sign.js +532 -0
  35. package/dist/security/verification-enforcer.d.ts +41 -0
  36. package/dist/security/verification-enforcer.js +181 -0
  37. package/dist/services/McpCoreService.d.ts +102 -0
  38. package/dist/services/McpCoreService.js +120 -0
  39. package/dist/services/index.d.ts +1 -0
  40. package/dist/services/index.js +1 -0
  41. package/dist/types.d.ts +130 -0
  42. package/dist/types.js +3 -0
  43. package/dist/utils/config.d.ts +32 -0
  44. package/dist/utils/config.js +78 -0
  45. package/dist/utils/env-loader.d.ts +54 -0
  46. package/dist/utils/env-loader.js +270 -0
  47. package/dist/utils/help.d.ts +36 -0
  48. package/dist/utils/help.js +248 -0
  49. package/dist/utils/index.d.ts +7 -0
  50. package/dist/utils/index.js +7 -0
  51. package/dist/utils/logger.d.ts +35 -0
  52. package/dist/utils/logger.js +75 -0
  53. package/dist/utils/silent-monitor.d.ts +67 -0
  54. package/dist/utils/silent-monitor.js +242 -0
  55. package/dist/utils/timeout.d.ts +5 -0
  56. package/dist/utils/timeout.js +23 -0
  57. package/dist/utils/version.d.ts +4 -0
  58. package/dist/utils/version.js +14 -0
  59. package/dist/web/env-manager-server.d.ts +29 -0
  60. package/dist/web/env-manager-server.js +367 -0
  61. package/dist/web/index.d.ts +1 -0
  62. package/dist/web/index.js +1 -0
  63. package/package.json +79 -0
  64. package/src/LocalToolResolver.ts +424 -0
  65. package/src/api/enact-api.ts +569 -0
  66. package/src/api/index.ts +2 -0
  67. package/src/api/types.ts +93 -0
  68. package/src/core/DaggerExecutionProvider.ts +1308 -0
  69. package/src/core/DirectExecutionProvider.ts +484 -0
  70. package/src/core/EnactCore.ts +833 -0
  71. package/src/core/index.ts +3 -0
  72. package/src/exec/index.ts +3 -0
  73. package/src/exec/logger.ts +63 -0
  74. package/src/exec/validate.ts +238 -0
  75. package/src/index.ts +42 -0
  76. package/src/lib/enact-direct.ts +258 -0
  77. package/src/lib/index.ts +1 -0
  78. package/src/security/index.ts +3 -0
  79. package/src/security/security.ts +188 -0
  80. package/src/security/sign.ts +797 -0
  81. package/src/security/verification-enforcer.ts +268 -0
  82. package/src/services/McpCoreService.ts +203 -0
  83. package/src/services/index.ts +1 -0
  84. package/src/types.ts +190 -0
  85. package/src/utils/config.ts +97 -0
  86. package/src/utils/env-loader.ts +370 -0
  87. package/src/utils/help.ts +257 -0
  88. package/src/utils/index.ts +7 -0
  89. package/src/utils/logger.ts +83 -0
  90. package/src/utils/silent-monitor.ts +328 -0
  91. package/src/utils/timeout.ts +26 -0
  92. package/src/utils/version.ts +16 -0
  93. package/src/web/env-manager-server.ts +465 -0
  94. package/src/web/index.ts +1 -0
  95. package/src/web/static/app.js +663 -0
  96. package/src/web/static/index.html +117 -0
  97. package/src/web/static/style.css +291 -0
@@ -0,0 +1,3 @@
1
+ export * from './EnactCore';
2
+ export * from './DirectExecutionProvider';
3
+ export * from './DaggerExecutionProvider';
@@ -0,0 +1,3 @@
1
+ export { default } from './logger';
2
+ export { default as logger } from './logger';
3
+ export * from './validate';
@@ -0,0 +1,63 @@
1
+ import pino from "pino";
2
+
3
+ // Determine if the environment is silent (e.g., CI, testing, or specific env var)
4
+ const isSilentMode =
5
+ () =>
6
+ process.env.CI === "true" ||
7
+ process.env.NODE_ENV === "test" ||
8
+ process.env.ENACT_SILENT === "true" ||
9
+ process.env.ENACT_SKIP_INTERACTIVE === "true";
10
+
11
+ // Base logger configuration
12
+ const logger = pino({
13
+ level: process.env.LOG_LEVEL || "info",
14
+ // In tests, we don't want the pretty transport, as it adds noise.
15
+ // The output is captured anyway.
16
+ ...(process.env.NODE_ENV !== "test" && {
17
+ transport: {
18
+ target: "pino-pretty",
19
+ options: {
20
+ colorize: true,
21
+ ignore: "pid,hostname",
22
+ translateTime: "SYS:standard",
23
+ },
24
+ },
25
+ }),
26
+ });
27
+
28
+ // Wrapper to dynamically check silent mode on each call
29
+ const wrappedLogger = {
30
+ info: (...args: Parameters<typeof logger.info>) => {
31
+ if (!isSilentMode()) {
32
+ logger.info(...args);
33
+ }
34
+ },
35
+ warn: (...args: Parameters<typeof logger.warn>) => {
36
+ if (!isSilentMode()) {
37
+ logger.warn(...args);
38
+ }
39
+ },
40
+ error: (...args: Parameters<typeof logger.error>) => {
41
+ // The silent tests expect errors to be silent too.
42
+ if (!isSilentMode()) {
43
+ logger.error(...args);
44
+ }
45
+ },
46
+ debug: (...args: Parameters<typeof logger.debug>) => {
47
+ if (!isSilentMode() && (process.env.DEBUG || process.env.VERBOSE)) {
48
+ logger.debug(...args);
49
+ }
50
+ },
51
+ // Expose a way to check if client logging is enabled (for MCP)
52
+ clientLoggingEnabled: () => !process.env.ENACT_MCP_CLIENT,
53
+ isLevelEnabled: (level: string) => {
54
+ if (isSilentMode()) {
55
+ return false;
56
+ }
57
+ return logger.isLevelEnabled(level);
58
+ },
59
+ // Keep original pino instance available if needed
60
+ pino: logger,
61
+ };
62
+
63
+ export default wrappedLogger;
@@ -0,0 +1,238 @@
1
+ // src/exec/validate.ts - Simplified validation module for CLI core
2
+ import type { EnactTool, JSONSchemaDefinition } from "../types";
3
+
4
+ export function validateAgainstSchema(
5
+ value: any,
6
+ schema: JSONSchemaDefinition,
7
+ fieldName: string,
8
+ ): void {
9
+ const {
10
+ type,
11
+ format,
12
+ enum: enumValues,
13
+ minimum,
14
+ maximum,
15
+ pattern,
16
+ required,
17
+ } = schema;
18
+
19
+ // Type validation
20
+ if (type) {
21
+ let validType = false;
22
+
23
+ switch (type) {
24
+ case "string":
25
+ validType = typeof value === "string";
26
+ break;
27
+ case "number":
28
+ case "integer":
29
+ validType = typeof value === "number";
30
+ if (type === "integer" && !Number.isInteger(value)) {
31
+ validType = false;
32
+ }
33
+ break;
34
+ case "boolean":
35
+ validType = typeof value === "boolean";
36
+ break;
37
+ case "array":
38
+ validType = Array.isArray(value);
39
+ break;
40
+ case "object":
41
+ validType =
42
+ typeof value === "object" && value !== null && !Array.isArray(value);
43
+ break;
44
+ }
45
+
46
+ if (!validType) {
47
+ throw new Error(`Invalid type for ${fieldName}: expected ${type}`);
48
+ }
49
+ }
50
+
51
+ // For object types, validate required properties
52
+ if (type === "object" && required && Array.isArray(required)) {
53
+ for (const requiredProp of required) {
54
+ if (value[requiredProp] === undefined) {
55
+ throw new Error(
56
+ `Missing required property: ${requiredProp} in ${fieldName}`,
57
+ );
58
+ }
59
+ }
60
+ }
61
+
62
+ // Format validation (simplified)
63
+ if (format && type === "string") {
64
+ const formatValidators: Record<string, RegExp> = {
65
+ email: /^.+@.+\..+$/,
66
+ "date-time":
67
+ /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(.\d+)?(Z|[+-]\d{2}:\d{2})$/,
68
+ uri: /^https?:\/\/.+/,
69
+ };
70
+
71
+ if (formatValidators[format] && !formatValidators[format].test(value)) {
72
+ throw new Error(`Invalid format for ${fieldName}: expected ${format}`);
73
+ }
74
+ }
75
+
76
+ // Enum validation
77
+ if (enumValues && !enumValues.includes(value)) {
78
+ throw new Error(
79
+ `Invalid value for ${fieldName}: must be one of [${enumValues.join(", ")}]`,
80
+ );
81
+ }
82
+
83
+ // Range validation for numbers
84
+ if (
85
+ (minimum !== undefined || maximum !== undefined) &&
86
+ typeof value === "number"
87
+ ) {
88
+ if (minimum !== undefined && value < minimum) {
89
+ throw new Error(`Value for ${fieldName} must be >= ${minimum}`);
90
+ }
91
+ if (maximum !== undefined && value > maximum) {
92
+ throw new Error(`Value for ${fieldName} must be <= ${maximum}`);
93
+ }
94
+ }
95
+
96
+ // Pattern validation for strings
97
+ if (
98
+ pattern &&
99
+ typeof value === "string" &&
100
+ !new RegExp(pattern).test(value)
101
+ ) {
102
+ throw new Error(`Value for ${fieldName} must match pattern: ${pattern}`);
103
+ }
104
+ }
105
+
106
+ export function validateToolStructure(tool: EnactTool): void {
107
+ // Check required fields
108
+ const requiredFields = ["name", "description", "command"];
109
+
110
+ for (const field of requiredFields) {
111
+ if (!(tool as any)[field]) {
112
+ throw new Error(
113
+ `Missing required field: ${field} in tool ${JSON.stringify(tool)}`,
114
+ );
115
+ }
116
+ }
117
+
118
+ // Validate name format - supports hierarchical names with forward slashes
119
+ if (
120
+ !/^[a-zA-Z0-9][a-zA-Z0-9_-]*(?:\/[a-zA-Z0-9][a-zA-Z0-9_-]*)*$/.test(
121
+ tool.name,
122
+ )
123
+ ) {
124
+ throw new Error(
125
+ `Invalid tool name: ${tool.name}. Must follow hierarchical format like "tool-name" or "org/package/tool-name".`,
126
+ );
127
+ }
128
+
129
+ // Validate command is not empty
130
+ if (!tool.command.trim()) {
131
+ throw new Error("Command field cannot be empty");
132
+ }
133
+
134
+ // Validate timeout format if provided
135
+ if (tool.timeout) {
136
+ if (!/^\d+[smh]$/.test(tool.timeout)) {
137
+ throw new Error(
138
+ `Invalid timeout format: ${tool.timeout}. Must be Go duration format like "30s", "5m", "1h"`,
139
+ );
140
+ }
141
+ }
142
+
143
+ // Validate environment variables structure
144
+ if (tool.env) {
145
+ for (const [varName, config] of Object.entries(tool.env)) {
146
+ if (
147
+ !config.description ||
148
+ !config.source ||
149
+ config.required === undefined
150
+ ) {
151
+ throw new Error(
152
+ `Environment variable ${varName} must have description, source, and required fields`,
153
+ );
154
+ }
155
+
156
+ if (!/^[A-Z][A-Z0-9_]*$/.test(varName)) {
157
+ throw new Error(
158
+ `Invalid environment variable name: ${varName}. Must be uppercase with underscores`,
159
+ );
160
+ }
161
+ }
162
+ }
163
+
164
+ // Validate authors structure if provided
165
+ if (tool.authors) {
166
+ for (const author of tool.authors) {
167
+ if (!author.name) {
168
+ throw new Error("Author must have a name field");
169
+ }
170
+
171
+ if (author.email && !/^.+@.+\..+$/.test(author.email)) {
172
+ throw new Error(`Invalid email format for author: ${author.email}`);
173
+ }
174
+
175
+ if (author.url && !/^https?:\/\/.+/.test(author.url)) {
176
+ throw new Error(`Invalid URL format for author: ${author.url}`);
177
+ }
178
+ }
179
+ }
180
+ }
181
+
182
+ export function validateInputs(
183
+ tool: EnactTool,
184
+ inputs: Record<string, any>,
185
+ ): Record<string, any> {
186
+ const validatedInputs: Record<string, any> = {};
187
+
188
+ if (!tool.inputSchema || !tool.inputSchema.properties) {
189
+ return inputs;
190
+ }
191
+
192
+ // Check for required fields
193
+ const requiredFields = tool.inputSchema.required || [];
194
+ for (const field of requiredFields) {
195
+ if (inputs[field] === undefined) {
196
+ throw new Error(`Missing required input: ${field}`);
197
+ }
198
+ }
199
+
200
+ // Validate and extract values
201
+ for (const [key, schema] of Object.entries(tool.inputSchema.properties)) {
202
+ if (inputs[key] !== undefined) {
203
+ validateAgainstSchema(inputs[key], schema, key);
204
+ validatedInputs[key] = inputs[key];
205
+ } else if (schema.default !== undefined) {
206
+ validatedInputs[key] = schema.default;
207
+ }
208
+ }
209
+
210
+ return validatedInputs;
211
+ }
212
+
213
+ export function validateOutput(tool: EnactTool, output: any): any {
214
+ if (!tool.outputSchema) {
215
+ return output;
216
+ }
217
+
218
+ try {
219
+ // Validate the entire output against the schema
220
+ validateAgainstSchema(output, tool.outputSchema, "output");
221
+
222
+ // Also check required fields specifically
223
+ if (
224
+ tool.outputSchema.required &&
225
+ Array.isArray(tool.outputSchema.required)
226
+ ) {
227
+ for (const requiredField of tool.outputSchema.required) {
228
+ if (output[requiredField] === undefined) {
229
+ throw new Error(`Missing required output field: ${requiredField}`);
230
+ }
231
+ }
232
+ }
233
+
234
+ return output;
235
+ } catch (error) {
236
+ throw new Error(`Output validation failed: ${(error as Error).message}`);
237
+ }
238
+ }
package/src/index.ts ADDED
@@ -0,0 +1,42 @@
1
+ // Core exports
2
+ export { EnactCore } from './core/EnactCore';
3
+ export { DirectExecutionProvider } from './core/DirectExecutionProvider';
4
+ export { DaggerExecutionProvider } from './core/DaggerExecutionProvider';
5
+
6
+ // Types and utilities
7
+ export type { EnactTool } from './types';
8
+ export type { EnactToolDefinition } from './api/types';
9
+ export { default as LocalToolResolver } from './LocalToolResolver';
10
+ export { default } from './LocalToolResolver';
11
+
12
+ // Exec utilities
13
+ export { default as logger } from './exec/logger';
14
+ export * from './exec/validate';
15
+
16
+ // Utils
17
+ export * from './utils/config';
18
+ export * from './utils/env-loader';
19
+ export { showHelp } from './utils/help';
20
+ export { showVersion as utilsShowVersion } from './utils/version';
21
+ export * from './utils/logger';
22
+ export * from './utils/silent-monitor';
23
+ export * from './utils/timeout';
24
+
25
+ // Security
26
+ export * from './security/security';
27
+ export { verifyTool, shouldExecuteTool, VERIFICATION_POLICIES } from './security/sign';
28
+ export type { VerificationPolicy as SecurityVerificationPolicy } from './security/sign';
29
+ export * from './security/verification-enforcer';
30
+
31
+ // Services
32
+ export * from './services/McpCoreService';
33
+
34
+ // Web
35
+ export * from './web/env-manager-server';
36
+
37
+ // API
38
+ export * from './api/enact-api';
39
+ export type { ApiResponse, ToolSearchQuery, ToolUsage, CLITokenCreate, OAuthTokenExchange } from './api/types';
40
+
41
+ // Lib
42
+ export * from './lib/enact-direct';
@@ -0,0 +1,258 @@
1
+ // src/lib/enact-direct.ts - Library interface for direct usage by MCP servers
2
+ import {
3
+ EnactCore,
4
+ type ToolSearchOptions,
5
+ type ToolExecuteOptions,
6
+ } from "../core/EnactCore";
7
+ import type { EnactTool, ExecutionResult } from "../types";
8
+
9
+ /**
10
+ * Direct Enact Library Interface
11
+ *
12
+ * This provides a simple, direct interface for MCP servers to use Enact
13
+ * without any CLI process spawning. All operations happen in-process.
14
+ */
15
+ export class EnactDirect {
16
+ private core: EnactCore;
17
+
18
+ constructor(
19
+ options: {
20
+ apiUrl?: string;
21
+ supabaseUrl?: string;
22
+ authToken?: string;
23
+ verificationPolicy?: "permissive" | "enterprise" | "paranoid";
24
+ defaultTimeout?: string;
25
+ } = {},
26
+ ) {
27
+ this.core = new EnactCore({
28
+ apiUrl:
29
+ options.apiUrl || process.env.ENACT_API_URL || "https://enact.tools",
30
+ supabaseUrl:
31
+ options.supabaseUrl ||
32
+ process.env.ENACT_SUPABASE_URL ||
33
+ "https://xjnhhxwxovjifdxdwzih.supabase.co",
34
+ executionProvider: "direct",
35
+ authToken: options.authToken || process.env.ENACT_AUTH_TOKEN,
36
+ verificationPolicy: options.verificationPolicy || "permissive",
37
+ defaultTimeout: options.defaultTimeout || "30s",
38
+ });
39
+ }
40
+
41
+ /**
42
+ * Execute a tool by name with inputs
43
+ *
44
+ * @param name - Tool name (e.g., "my-org/data-processor")
45
+ * @param inputs - Input parameters for the tool
46
+ * @param options - Execution options
47
+ * @returns Execution result
48
+ */
49
+ async executeToolByName(
50
+ name: string,
51
+ inputs: Record<string, any> = {},
52
+ options: ToolExecuteOptions = {},
53
+ ): Promise<ExecutionResult> {
54
+ return this.core.executeToolByName(name, inputs, options);
55
+ }
56
+
57
+ /**
58
+ * Search for tools matching a query
59
+ *
60
+ * @param options - Search options
61
+ * @returns Array of matching tools
62
+ */
63
+ async searchTools(options: ToolSearchOptions): Promise<EnactTool[]> {
64
+ return this.core.searchTools(options);
65
+ }
66
+
67
+ /**
68
+ * Get detailed information about a specific tool
69
+ *
70
+ * @param name - Tool name
71
+ * @param version - Optional specific version
72
+ * @returns Tool information or null if not found
73
+ */
74
+ async getToolInfo(name: string, version?: string): Promise<EnactTool | null> {
75
+ return this.core.getToolInfo(name, version);
76
+ }
77
+
78
+ /**
79
+ * Verify a tool's cryptographic signatures
80
+ *
81
+ * @param name - Tool name
82
+ * @param policy - Verification policy
83
+ * @returns Verification result
84
+ */
85
+ async verifyTool(
86
+ name: string,
87
+ policy?: "permissive" | "enterprise" | "paranoid",
88
+ ): Promise<{
89
+ verified: boolean;
90
+ signatures: any[];
91
+ policy: string;
92
+ errors?: string[];
93
+ }> {
94
+ return this.core.verifyTool(name, policy);
95
+ }
96
+
97
+ /**
98
+ * Execute a tool from raw YAML definition
99
+ *
100
+ * @param toolYaml - YAML tool definition
101
+ * @param inputs - Input parameters
102
+ * @param options - Execution options
103
+ * @returns Execution result
104
+ */
105
+ async executeRawTool(
106
+ toolYaml: string,
107
+ inputs: Record<string, any> = {},
108
+ options: ToolExecuteOptions = {},
109
+ ): Promise<ExecutionResult> {
110
+ return this.core.executeRawTool(toolYaml, inputs, options);
111
+ }
112
+
113
+ /**
114
+ * Check if a tool exists in the registry
115
+ *
116
+ * @param name - Tool name
117
+ * @returns True if tool exists
118
+ */
119
+ async toolExists(name: string): Promise<boolean> {
120
+ return this.core.toolExists(name);
121
+ }
122
+
123
+ /**
124
+ * Get all tools with optional filtering
125
+ *
126
+ * @param options - Filter options
127
+ * @returns Array of tools
128
+ */
129
+ async getTools(
130
+ options: {
131
+ limit?: number;
132
+ offset?: number;
133
+ tags?: string[];
134
+ author?: string;
135
+ } = {},
136
+ ): Promise<EnactTool[]> {
137
+ return this.core.getTools(options);
138
+ }
139
+
140
+ /**
141
+ * Get tools by specific tags
142
+ *
143
+ * @param tags - Array of tags to filter by
144
+ * @param limit - Maximum number of results
145
+ * @returns Array of tools
146
+ */
147
+ async getToolsByTags(
148
+ tags: string[],
149
+ limit: number = 20,
150
+ ): Promise<EnactTool[]> {
151
+ return this.core.getToolsByTags(tags, limit);
152
+ }
153
+
154
+ /**
155
+ * Get tools by a specific author
156
+ *
157
+ * @param author - Author name
158
+ * @param limit - Maximum number of results
159
+ * @returns Array of tools
160
+ */
161
+ async getToolsByAuthor(
162
+ author: string,
163
+ limit: number = 20,
164
+ ): Promise<EnactTool[]> {
165
+ return this.core.getToolsByAuthor(author, limit);
166
+ }
167
+
168
+ /**
169
+ * Get the current status of the Enact core
170
+ *
171
+ * @returns Status information
172
+ */
173
+ async getStatus(): Promise<{
174
+ executionProvider: string;
175
+ apiUrl: string;
176
+ verificationPolicy: string;
177
+ defaultTimeout: string;
178
+ authenticated: boolean;
179
+ }> {
180
+ return this.core.getStatus();
181
+ }
182
+
183
+ /**
184
+ * Set authentication token
185
+ *
186
+ * @param token - Authentication token
187
+ */
188
+ setAuthToken(token: string): void {
189
+ this.core.setAuthToken(token);
190
+ }
191
+
192
+ /**
193
+ * Get authentication status
194
+ *
195
+ * @returns Authentication status
196
+ */
197
+ async getAuthStatus(): Promise<{
198
+ authenticated: boolean;
199
+ user?: string;
200
+ server?: string;
201
+ }> {
202
+ return this.core.getAuthStatus();
203
+ }
204
+
205
+ /**
206
+ * Publish a tool (requires authentication)
207
+ *
208
+ * @param tool - Tool definition to publish
209
+ * @returns Publication result
210
+ */
211
+ async publishTool(
212
+ tool: EnactTool,
213
+ ): Promise<{ success: boolean; message: string }> {
214
+ return this.core.publishTool(tool);
215
+ }
216
+ }
217
+
218
+ // Create and export a default instance
219
+ export const enactDirect = new EnactDirect();
220
+
221
+ // Export convenience functions using the default instance
222
+ export const executeToolByName = (
223
+ name: string,
224
+ inputs: Record<string, any> = {},
225
+ options: ToolExecuteOptions = {},
226
+ ) => enactDirect.executeToolByName(name, inputs, options);
227
+
228
+ export const searchTools = (options: ToolSearchOptions) =>
229
+ enactDirect.searchTools(options);
230
+
231
+ export const getToolInfo = (name: string, version?: string) =>
232
+ enactDirect.getToolInfo(name, version);
233
+
234
+ export const executeRawTool = (
235
+ toolYaml: string,
236
+ inputs: Record<string, any> = {},
237
+ options: ToolExecuteOptions = {},
238
+ ) => enactDirect.executeRawTool(toolYaml, inputs, options);
239
+
240
+ export const getToolsByTags = (tags: string[], limit: number = 20) =>
241
+ enactDirect.getToolsByTags(tags, limit);
242
+
243
+ export const getToolsByAuthor = (author: string, limit: number = 20) =>
244
+ enactDirect.getToolsByAuthor(author, limit);
245
+
246
+ export const toolExists = (name: string) => enactDirect.toolExists(name);
247
+
248
+ export const getAuthStatus = () => enactDirect.getAuthStatus();
249
+
250
+ export const publishTool = (tool: EnactTool) => enactDirect.publishTool(tool);
251
+
252
+ // Also export the core for advanced usage
253
+ export {
254
+ EnactCore,
255
+ type ToolSearchOptions,
256
+ type ToolExecuteOptions,
257
+ } from "../core/EnactCore";
258
+ export type { EnactTool, ExecutionResult } from "../types";
@@ -0,0 +1 @@
1
+ export * from './enact-direct';
@@ -0,0 +1,3 @@
1
+ export * from './security';
2
+ export * from './sign';
3
+ export * from './verification-enforcer';