@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,569 @@
1
+ import {
2
+ EnactToolDefinition,
3
+ ToolUsage,
4
+ ToolSearchQuery,
5
+ CLITokenCreate,
6
+ OAuthTokenExchange,
7
+ } from "./types";
8
+
9
+ export class EnactApiClient {
10
+ baseUrl: string;
11
+ supabaseUrl: string;
12
+
13
+ constructor(
14
+ baseUrl: string = "https://enact.tools",
15
+ supabaseUrl: string = "https://xjnhhxwxovjifdxdwzih.supabase.co",
16
+ ) {
17
+ this.baseUrl = baseUrl.replace(/\/$/, ""); // Remove trailing slash
18
+ this.supabaseUrl = supabaseUrl.replace(/\/$/, "");
19
+ }
20
+
21
+ // Helper method to make authenticated requests
22
+ private async makeRequest<T>(
23
+ endpoint: string,
24
+ options: RequestInit = {},
25
+ token?: string,
26
+ tokenType: "jwt" | "cli" = "jwt",
27
+ ): Promise<T> {
28
+ const url = endpoint.startsWith("http")
29
+ ? endpoint
30
+ : `${this.supabaseUrl}${endpoint}`;
31
+
32
+ const headers: Record<string, string> = {
33
+ "Content-Type": "application/json",
34
+ ...(options.headers as Record<string, string>),
35
+ };
36
+
37
+ // Add authentication headers if token provided
38
+ if (token) {
39
+ if (tokenType === "jwt") {
40
+ headers.Authorization = `Bearer ${token}`;
41
+ } else {
42
+ headers["X-API-Key"] = token;
43
+ }
44
+ }
45
+
46
+ const response = await fetch(url, {
47
+ ...options,
48
+ headers,
49
+ });
50
+
51
+ if (!response.ok) {
52
+ const errorData = await response
53
+ .json()
54
+ .catch(() => ({ error: "Unknown error" }));
55
+ throw new EnactApiError(
56
+ `${(errorData as { error?: string }).error || response.statusText}`,
57
+ response.status,
58
+ endpoint,
59
+ );
60
+ }
61
+
62
+ const responseData = await response.json();
63
+
64
+ // Debug logging to help identify response structure issues
65
+ if (process.env.NODE_ENV === "development" || process.env.DEBUG) {
66
+ console.error(`API Response for ${endpoint}:`, responseData);
67
+ }
68
+
69
+ return responseData as T;
70
+ }
71
+
72
+ // =================
73
+ // PUBLIC ENDPOINTS
74
+ // =================
75
+
76
+ /**
77
+ * Get all tools (public, no auth required)
78
+ */
79
+ async getTools(params?: {
80
+ limit?: number;
81
+ offset?: number;
82
+ tags?: string[];
83
+ author?: string;
84
+ }): Promise<EnactToolDefinition[]> {
85
+ const searchParams = new URLSearchParams();
86
+ if (params?.limit) searchParams.set("limit", params.limit.toString());
87
+ if (params?.offset) searchParams.set("offset", params.offset.toString());
88
+ if (params?.tags) searchParams.set("tags", params.tags.join(","));
89
+ if (params?.author) searchParams.set("author", params.author);
90
+
91
+ const query = searchParams.toString();
92
+ const endpoint = `/functions/v1/tools${query ? `?${query}` : ""}`;
93
+
94
+ const response = await this.makeRequest<any>(endpoint);
95
+
96
+ // Handle different response structures
97
+ if (Array.isArray(response)) {
98
+ return response;
99
+ } else if (response.data && Array.isArray(response.data)) {
100
+ return response.data;
101
+ } else if (response.tools && Array.isArray(response.tools)) {
102
+ return response.tools;
103
+ } else {
104
+ console.warn("Unexpected response structure for getTools:", response);
105
+ return [];
106
+ }
107
+ }
108
+
109
+ /**
110
+ * Get specific tool details (public, no auth required)
111
+ */
112
+ async getTool(name: string): Promise<EnactToolDefinition> {
113
+ const endpoint = `/functions/v1/tools/${encodeURIComponent(name)}`;
114
+ return this.makeRequest<EnactToolDefinition>(endpoint);
115
+ }
116
+
117
+ /**
118
+ * Get tool usage statistics (public, no auth required)
119
+ */
120
+ async getToolUsage(name: string): Promise<any> {
121
+ const endpoint = `/functions/v1/tools/${encodeURIComponent(name)}/usage`;
122
+ return this.makeRequest(endpoint);
123
+ }
124
+
125
+ /**
126
+ * Log tool usage (public, no auth required)
127
+ */
128
+ async logToolUsage(name: string, usage: ToolUsage): Promise<any> {
129
+ const endpoint = `/functions/v1/tools/${encodeURIComponent(name)}/usage`;
130
+ return this.makeRequest(endpoint, {
131
+ method: "POST",
132
+ body: JSON.stringify(usage),
133
+ });
134
+ }
135
+
136
+ /**
137
+ * Search tools with semantic/text search (public, no auth required)
138
+ */
139
+ async searchTools(query: ToolSearchQuery): Promise<EnactToolDefinition[]> {
140
+ const endpoint = "/functions/v1/tools-search";
141
+
142
+ try {
143
+ // Log the request for debugging
144
+ if (process.env.NODE_ENV === "development" || process.env.DEBUG) {
145
+ console.error(
146
+ `Search request to ${endpoint}:`,
147
+ JSON.stringify(query, null, 2),
148
+ );
149
+ }
150
+
151
+ const response = await this.makeRequest<any>(endpoint, {
152
+ method: "POST",
153
+ body: JSON.stringify(query),
154
+ });
155
+
156
+ // Handle different response structures
157
+ if (Array.isArray(response)) {
158
+ return response;
159
+ } else if (response.data && Array.isArray(response.data)) {
160
+ return response.data;
161
+ } else if (response.results && Array.isArray(response.results)) {
162
+ return response.results;
163
+ } else if (response.tools && Array.isArray(response.tools)) {
164
+ return response.tools;
165
+ } else {
166
+ console.warn(
167
+ "Unexpected response structure for searchTools:",
168
+ response,
169
+ );
170
+ return [];
171
+ }
172
+ } catch (error) {
173
+ // Enhanced error logging
174
+ if (error instanceof EnactApiError) {
175
+ console.error(
176
+ `Search API error (${error.statusCode}): ${error.message}`,
177
+ );
178
+ console.error(`Endpoint: ${error.endpoint}`);
179
+
180
+ // If it's a 502 error, provide more specific guidance
181
+ if (error.statusCode === 502) {
182
+ console.error("502 Bad Gateway error - this usually indicates:");
183
+ console.error("• The API server is temporarily unavailable");
184
+ console.error("• The search service is overloaded");
185
+ console.error("• Network connectivity issues");
186
+ console.error("• Try again in a few moments");
187
+ }
188
+ } else {
189
+ console.error("Unexpected search error:", error);
190
+ }
191
+
192
+ // Re-throw the error
193
+ throw error;
194
+ }
195
+ }
196
+
197
+ // ===================
198
+ // AUTHENTICATED ENDPOINTS
199
+ // ===================
200
+
201
+ /**
202
+ * Publish/create new tool (requires authentication)
203
+ */
204
+ async publishTool(
205
+ tool: EnactToolDefinition,
206
+ token: string,
207
+ tokenType: "jwt" | "cli" = "cli",
208
+ ): Promise<any> {
209
+ const endpoint = "/functions/v1/tools";
210
+ return this.makeRequest(
211
+ endpoint,
212
+ {
213
+ method: "POST",
214
+ body: JSON.stringify(tool),
215
+ },
216
+ token,
217
+ tokenType,
218
+ );
219
+ }
220
+
221
+ /**
222
+ * Update existing tool (requires authentication, must be owner)
223
+ */
224
+ async updateTool(
225
+ name: string,
226
+ tool: EnactToolDefinition,
227
+ token: string,
228
+ tokenType: "jwt" | "cli" = "cli",
229
+ ): Promise<any> {
230
+ const endpoint = `/functions/v1/tools/${encodeURIComponent(name)}`;
231
+ return this.makeRequest(
232
+ endpoint,
233
+ {
234
+ method: "PUT",
235
+ body: JSON.stringify(tool),
236
+ },
237
+ token,
238
+ tokenType,
239
+ );
240
+ }
241
+
242
+ /**
243
+ * Delete tool (requires authentication, must be owner)
244
+ */
245
+ async deleteTool(
246
+ name: string,
247
+ token: string,
248
+ tokenType: "jwt" | "cli" = "cli",
249
+ ): Promise<any> {
250
+ const endpoint = `/functions/v1/tools/${encodeURIComponent(name)}`;
251
+ return this.makeRequest(
252
+ endpoint,
253
+ {
254
+ method: "DELETE",
255
+ },
256
+ token,
257
+ tokenType,
258
+ );
259
+ }
260
+
261
+ /**
262
+ * Create new CLI token (requires JWT authentication)
263
+ */
264
+ async createCLIToken(
265
+ tokenData: CLITokenCreate,
266
+ jwtToken: string,
267
+ ): Promise<{ token: string; id: string; name?: string }> {
268
+ const endpoint = "/functions/v1/cli-token";
269
+ return this.makeRequest(
270
+ endpoint,
271
+ {
272
+ method: "POST",
273
+ body: JSON.stringify(tokenData),
274
+ },
275
+ jwtToken,
276
+ "jwt",
277
+ );
278
+ }
279
+
280
+ /**
281
+ * List user's CLI tokens (requires JWT authentication)
282
+ */
283
+ async getCLITokens(jwtToken: string): Promise<any[]> {
284
+ const endpoint = "/functions/v1/cli-token";
285
+ return this.makeRequest(
286
+ endpoint,
287
+ {
288
+ method: "GET",
289
+ },
290
+ jwtToken,
291
+ "jwt",
292
+ );
293
+ }
294
+
295
+ /**
296
+ * Delete CLI token (requires JWT authentication, must be owner)
297
+ */
298
+ async deleteCLIToken(tokenId: string, jwtToken: string): Promise<any> {
299
+ const endpoint = `/functions/v1/cli-token/${tokenId}`;
300
+ return this.makeRequest(
301
+ endpoint,
302
+ {
303
+ method: "DELETE",
304
+ },
305
+ jwtToken,
306
+ "jwt",
307
+ );
308
+ }
309
+
310
+ /**
311
+ * Exchange OAuth authorization code for access token
312
+ */
313
+ async exchangeOAuthCode(oauthData: OAuthTokenExchange): Promise<{
314
+ access_token: string;
315
+ token_type: string;
316
+ expires_in: number;
317
+ scope?: string;
318
+ }> {
319
+ const endpoint = "/functions/v1/cli-oauth";
320
+ return this.makeRequest(endpoint, {
321
+ method: "POST",
322
+ body: JSON.stringify(oauthData),
323
+ });
324
+ }
325
+
326
+ /**
327
+ * Generate embeddings for tools (requires authentication)
328
+ */
329
+ async generateEmbeddings(
330
+ data: { toolId: string; text: string },
331
+ token: string,
332
+ tokenType: "jwt" | "cli" = "cli",
333
+ ): Promise<any> {
334
+ const endpoint = "/functions/v1/generate-embeddings";
335
+ return this.makeRequest(
336
+ endpoint,
337
+ {
338
+ method: "POST",
339
+ body: JSON.stringify(data),
340
+ },
341
+ token,
342
+ tokenType,
343
+ );
344
+ }
345
+
346
+ // ===================
347
+ // CONVENIENCE METHODS
348
+ // ===================
349
+
350
+ /**
351
+ * Check if a tool exists
352
+ */
353
+ async toolExists(name: string): Promise<boolean> {
354
+ try {
355
+ await this.getTool(name);
356
+ return true;
357
+ } catch (error) {
358
+ if (error instanceof Error && error.message.includes("404")) {
359
+ return false;
360
+ }
361
+ throw error;
362
+ }
363
+ }
364
+
365
+ /**
366
+ * Publish or update tool based on existence
367
+ */
368
+ async publishOrUpdateTool(
369
+ tool: EnactToolDefinition,
370
+ token: string,
371
+ tokenType: "jwt" | "cli" = "cli",
372
+ ): Promise<{ isUpdate: boolean; result: any }> {
373
+ let exists: boolean;
374
+ try {
375
+ exists = await this.toolExists(tool.name);
376
+ } catch (error) {
377
+ exists = false;
378
+ }
379
+ if (exists) {
380
+ const result = await this.updateTool(tool.name, tool, token, tokenType);
381
+ return { isUpdate: true, result };
382
+ } else {
383
+ const result = await this.publishTool(tool, token, tokenType);
384
+ return { isUpdate: false, result };
385
+ }
386
+ }
387
+
388
+ /**
389
+ * Search tools by tags
390
+ */
391
+ async getToolsByTags(
392
+ tags: string[],
393
+ limit: number = 20,
394
+ ): Promise<EnactToolDefinition[]> {
395
+ return this.searchTools({
396
+ query: tags.join(" "),
397
+ tags,
398
+ limit,
399
+ });
400
+ }
401
+
402
+ /**
403
+ * Get tools by author
404
+ */
405
+ async getToolsByAuthor(
406
+ author: string,
407
+ limit: number = 20,
408
+ ): Promise<EnactToolDefinition[]> {
409
+ return this.getTools({
410
+ author,
411
+ limit,
412
+ });
413
+ }
414
+
415
+ /**
416
+ * Get a user's public key
417
+ */
418
+ async getUserPublicKey(userId: string): Promise<any> {
419
+ const url = `${this.supabaseUrl}/functions/v1/tools/user/public-key/${userId}`;
420
+
421
+ const headers = {
422
+ Accept: "application/json",
423
+ "Content-Type": "application/json",
424
+ };
425
+
426
+ try {
427
+ const response = await fetch(url, {
428
+ method: "GET",
429
+ headers,
430
+ });
431
+ if (!response.ok) {
432
+ const errorText = await response.text();
433
+ let errorMessage = `HTTP ${response.status}: ${response.statusText}`;
434
+
435
+ try {
436
+ const errorJson = JSON.parse(errorText);
437
+ if (errorJson.message) {
438
+ errorMessage = errorJson.message;
439
+ } else if (errorJson.error) {
440
+ errorMessage = errorJson.error;
441
+ }
442
+ } catch {
443
+ // If we can't parse JSON, stick with the original error message
444
+ }
445
+
446
+ throw new EnactApiError(errorMessage, response.status);
447
+ }
448
+
449
+ const data = await response.json();
450
+ return data as any;
451
+ } catch (error) {
452
+ if (error instanceof EnactApiError) {
453
+ throw error;
454
+ }
455
+
456
+ // Handle network errors
457
+ if (error instanceof Error) {
458
+ if (error.message.includes("fetch")) {
459
+ throw new EnactApiError(
460
+ "Network error: Could not connect to Enact API",
461
+ 0,
462
+ );
463
+ }
464
+ throw new EnactApiError(error.message, 0);
465
+ }
466
+
467
+ throw new EnactApiError("Unknown error occurred", 0);
468
+ }
469
+ }
470
+
471
+ // ===================
472
+ // OAUTH FLOW HELPERS
473
+ // ===================
474
+
475
+ /**
476
+ * Generate OAuth authorization URL
477
+ */
478
+ generateOAuthUrl(options: {
479
+ clientId: string;
480
+ redirectUri: string;
481
+ scope: string;
482
+ state: string;
483
+ codeChallenge: string;
484
+ codeChallengeMethod: string;
485
+ }): string {
486
+ const params = new URLSearchParams({
487
+ response_type: "code",
488
+ client_id: options.clientId,
489
+ redirect_uri: options.redirectUri,
490
+ scope: options.scope,
491
+ state: options.state,
492
+ code_challenge: options.codeChallenge,
493
+ code_challenge_method: options.codeChallengeMethod,
494
+ });
495
+
496
+ return `${this.baseUrl}/auth/cli/oauth?${params.toString()}`;
497
+ }
498
+
499
+ /**
500
+ * Validate tool definition before publishing
501
+ */
502
+ validateTool(tool: any): { valid: boolean; errors: string[] } {
503
+ const errors: string[] = [];
504
+
505
+ if (!tool.name || typeof tool.name !== "string") {
506
+ errors.push("Tool name is required and must be a string");
507
+ } else if (!/^[a-zA-Z0-9_-]+\/[a-zA-Z0-9_\/-]+$/.test(tool.name)) {
508
+ errors.push(
509
+ "Tool name must follow hierarchical format: org/package/tool-name",
510
+ );
511
+ }
512
+
513
+ if (!tool.description || typeof tool.description !== "string") {
514
+ errors.push("Tool description is required and must be a string");
515
+ }
516
+
517
+ if (!tool.command || typeof tool.command !== "string") {
518
+ errors.push("Tool command is required and must be a string");
519
+ }
520
+
521
+ if (tool.timeout && typeof tool.timeout === "string") {
522
+ if (!/^\d+[smh]$/.test(tool.timeout)) {
523
+ errors.push(
524
+ 'Timeout must be in Go duration format (e.g., "30s", "5m", "1h")',
525
+ );
526
+ }
527
+ }
528
+
529
+ if (tool.tags && !Array.isArray(tool.tags)) {
530
+ errors.push("Tags must be an array of strings");
531
+ }
532
+
533
+ if (tool.inputSchema && typeof tool.inputSchema !== "object") {
534
+ errors.push("inputSchema must be a valid JSON Schema object");
535
+ }
536
+
537
+ if (tool.outputSchema && typeof tool.outputSchema !== "object") {
538
+ errors.push("outputSchema must be a valid JSON Schema object");
539
+ }
540
+
541
+ return {
542
+ valid: errors.length === 0,
543
+ errors,
544
+ };
545
+ }
546
+ }
547
+
548
+ // Export a default instance
549
+ export const enactApi = new EnactApiClient();
550
+
551
+ // Export error types for better error handling
552
+ export class EnactApiError extends Error {
553
+ constructor(
554
+ message: string,
555
+ public statusCode?: number,
556
+ public endpoint?: string,
557
+ ) {
558
+ super(message);
559
+ this.name = "EnactApiError";
560
+ }
561
+ }
562
+
563
+ // Helper function to create API client with custom configuration
564
+ export function createEnactApiClient(
565
+ baseUrl?: string,
566
+ supabaseUrl?: string,
567
+ ): EnactApiClient {
568
+ return new EnactApiClient(baseUrl, supabaseUrl);
569
+ }
@@ -0,0 +1,2 @@
1
+ export * from './enact-api';
2
+ export * from './types';
@@ -0,0 +1,93 @@
1
+ export interface EnactToolDefinition {
2
+ name: string;
3
+ description: string;
4
+ command: string;
5
+ version?: string;
6
+ timeout?: string;
7
+ tags?: string[];
8
+ inputSchema?: any;
9
+ outputSchema?: any;
10
+ examples?: any[];
11
+ annotations?: {
12
+ title?: string;
13
+ readOnlyHint?: boolean;
14
+ destructiveHint?: boolean;
15
+ idempotentHint?: boolean;
16
+ openWorldHint?: boolean;
17
+ };
18
+ env?: Record<
19
+ string,
20
+ {
21
+ description: string;
22
+ source?: string;
23
+ required: boolean;
24
+ default?: string;
25
+ }
26
+ >;
27
+ resources?: {
28
+ memory?: string;
29
+ gpu?: string;
30
+ disk?: string;
31
+ };
32
+ signature?: {
33
+ algorithm: string;
34
+ type: string;
35
+ signer: string;
36
+ created: string;
37
+ value: string;
38
+ role?: string;
39
+ };
40
+ signatures?: Record<string, any>;
41
+ raw_content?: string;
42
+ namespace?: string;
43
+ enact?: string;
44
+ [key: string]: any;
45
+ }
46
+
47
+ export interface ToolSearchQuery {
48
+ query: string;
49
+ limit?: number;
50
+ tags?: string[];
51
+ format?: string;
52
+ }
53
+
54
+ export interface ToolUsage {
55
+ action: "view" | "download" | "execute";
56
+ metadata?: any;
57
+ }
58
+
59
+ export interface CLITokenCreate {
60
+ name?: string;
61
+ }
62
+
63
+ export interface OAuthTokenExchange {
64
+ grant_type: "authorization_code";
65
+ code: string;
66
+ redirect_uri: string;
67
+ client_id: string;
68
+ code_verifier: string;
69
+ }
70
+
71
+ export interface ApiResponse<T = any> {
72
+ success: boolean;
73
+ data?: T;
74
+ error?: string;
75
+ }
76
+
77
+ export interface VerificationPolicy {
78
+ minimumSignatures?: number;
79
+ trustedSigners?: string[];
80
+ allowedAlgorithms?: string[];
81
+ }
82
+
83
+ export interface EnactExecOptions {
84
+ help?: boolean;
85
+ input?: string;
86
+ params?: string;
87
+ timeout?: string;
88
+ dry?: boolean;
89
+ verbose?: boolean;
90
+ skipVerification?: boolean; // New option to skip signature verification
91
+ verifyPolicy?: string; // Verification policy to use
92
+ force?: boolean; // Force execution even if verification fails
93
+ }