@enactprotocol/mcp-server 1.0.13 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/minimal.js CHANGED
@@ -1,4 +1,3 @@
1
- #!/usr/bin/env node
2
1
  import { createRequire } from "node:module";
3
2
  var __create = Object.create;
4
3
  var __getProtoOf = Object.getPrototypeOf;
@@ -225969,7 +225968,7 @@ class EnactApiClient {
225969
225968
  throw new EnactApiError(`${errorData.error || response.statusText}`, response.status, endpoint);
225970
225969
  }
225971
225970
  const responseData = await response.json();
225972
- if (true) {
225971
+ if (!process.env.ENACT_SILENT) {
225973
225972
  console.error(`API Response for ${endpoint}:`, responseData);
225974
225973
  }
225975
225974
  return responseData;
@@ -226016,7 +226015,7 @@ class EnactApiClient {
226016
226015
  async searchTools(query) {
226017
226016
  const endpoint = "/functions/v1/tools-search";
226018
226017
  try {
226019
- if (true) {
226018
+ if (!process.env.ENACT_SILENT) {
226020
226019
  console.error(`Search request to ${endpoint}:`, JSON.stringify(query, null, 2));
226021
226020
  }
226022
226021
  const response = await this.makeRequest(endpoint, {
@@ -226376,25 +226375,6 @@ function verifyCommandSafety(command, tool) {
226376
226375
  ...blocked.length > 0 && { blocked }
226377
226376
  };
226378
226377
  }
226379
- function sanitizeEnvironmentVariables(envVars) {
226380
- const sanitized = {};
226381
- for (const [key, value] of Object.entries(envVars)) {
226382
- if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(key)) {
226383
- logger_default.warn(`Invalid environment variable name: ${key}`);
226384
- continue;
226385
- }
226386
- const strValue = String(value);
226387
- if (strValue.includes(`
226388
- `) || strValue.includes("\r")) {
226389
- logger_default.warn(`Environment variable ${key} contains newline characters`);
226390
- }
226391
- if (strValue.includes("$(") || strValue.includes("`")) {
226392
- logger_default.warn(`Environment variable ${key} contains command substitution patterns`);
226393
- }
226394
- sanitized[key] = strValue;
226395
- }
226396
- return sanitized;
226397
- }
226398
226378
 
226399
226379
  // ../shared/dist/exec/validate.js
226400
226380
  function validateAgainstSchema(value, schema, fieldName) {
@@ -226521,24 +226501,6 @@ function validateInputs(tool, inputs) {
226521
226501
  }
226522
226502
  return validatedInputs;
226523
226503
  }
226524
- function validateOutput(tool, output) {
226525
- if (!tool.outputSchema) {
226526
- return output;
226527
- }
226528
- try {
226529
- validateAgainstSchema(output, tool.outputSchema, "output");
226530
- if (tool.outputSchema.required && Array.isArray(tool.outputSchema.required)) {
226531
- for (const requiredField of tool.outputSchema.required) {
226532
- if (output[requiredField] === undefined) {
226533
- throw new Error(`Missing required output field: ${requiredField}`);
226534
- }
226535
- }
226536
- }
226537
- return output;
226538
- } catch (error) {
226539
- throw new Error(`Output validation failed: ${error.message}`);
226540
- }
226541
- }
226542
226504
 
226543
226505
  // ../shared/dist/core/DirectExecutionProvider.js
226544
226506
  import { spawn } from "child_process";
@@ -235380,7 +235342,7 @@ class DaggerExecutionProvider extends ExecutionProvider {
235380
235342
  logger_default.warn(`Attempt ${attempt}: Engine unhealthy, resetting...`);
235381
235343
  await this.resetEngineContainer();
235382
235344
  }
235383
- const result = await this.executeCommand(tool.command, inputs, environment, tool.timeout);
235345
+ const result = await this.executeCommand(tool.command, inputs, environment, tool.timeout, undefined, tool);
235384
235346
  logger_default.debug(`Command result: exitCode=${result.exitCode}, stdout length=${result.stdout?.length || 0}, stderr length=${result.stderr?.length || 0}`);
235385
235347
  const output = this.parseOutput(result.stdout, tool);
235386
235348
  return {
@@ -235463,7 +235425,7 @@ class DaggerExecutionProvider extends ExecutionProvider {
235463
235425
  }
235464
235426
  return "EXECUTION_ERROR";
235465
235427
  }
235466
- async executeCommand(command, inputs, environment, timeout, options) {
235428
+ async executeCommand(command, inputs, environment, timeout, options, tool) {
235467
235429
  const verbose = options?.verbose ?? false;
235468
235430
  const showSpinner = options?.showSpinner ?? false;
235469
235431
  this.abortController = new AbortController;
@@ -235480,24 +235442,25 @@ class DaggerExecutionProvider extends ExecutionProvider {
235480
235442
  try {
235481
235443
  const substitutedCommand = this.substituteCommandVariables(command, inputs);
235482
235444
  if (verbose) {
235445
+ const containerImage = tool?.from || this.options.baseImage;
235483
235446
  try {
235484
235447
  const pc = require_picocolors();
235485
235448
  console.error(pc.cyan(`
235486
235449
  \uD83D\uDC33 Executing Enact command in Dagger container:`));
235487
235450
  console.error(pc.white(substitutedCommand));
235488
- console.error(pc.gray(`Base image: ${this.options.baseImage}`));
235451
+ console.error(pc.gray(`Container image: ${containerImage}${tool?.from ? " (from tool.from)" : " (default baseImage)"}`));
235489
235452
  } catch (e2) {
235490
235453
  console.error(`
235491
235454
  \uD83D\uDC33 Executing Enact command in Dagger container:`);
235492
235455
  console.error(substitutedCommand);
235493
- console.error(`Base image: ${this.options.baseImage}`);
235456
+ console.error(`Container image: ${containerImage}${tool?.from ? " (from tool.from)" : " (default baseImage)"}`);
235494
235457
  }
235495
235458
  }
235496
235459
  const timeoutMs = timeout ? parseTimeout(timeout) : 30000;
235497
235460
  const effectiveTimeout = Math.max(timeoutMs, this.options.engineTimeout);
235498
235461
  logger_default.debug(`Parsed timeout: ${effectiveTimeout}ms (command: ${timeoutMs}ms, engine: ${this.options.engineTimeout}ms)`);
235499
235462
  const result = await Promise.race([
235500
- this.executeWithConnect(substitutedCommand, environment, inputs),
235463
+ this.executeWithConnect(substitutedCommand, environment, inputs, tool),
235501
235464
  this.createTimeoutPromise(effectiveTimeout)
235502
235465
  ]);
235503
235466
  if (spinner) {
@@ -235521,7 +235484,7 @@ class DaggerExecutionProvider extends ExecutionProvider {
235521
235484
  this.abortController = null;
235522
235485
  }
235523
235486
  }
235524
- async executeWithConnect(command, environment, inputs) {
235487
+ async executeWithConnect(command, environment, inputs, tool) {
235525
235488
  return new Promise((resolve, reject) => {
235526
235489
  const abortHandler = () => {
235527
235490
  reject(new Error("Execution aborted"));
@@ -235532,7 +235495,7 @@ class DaggerExecutionProvider extends ExecutionProvider {
235532
235495
  connect(async (client) => {
235533
235496
  try {
235534
235497
  logger_default.debug("\uD83D\uDD17 Connected to Dagger client");
235535
- const container = await this.setupContainer(client, environment, inputs);
235498
+ const container = await this.setupContainer(client, environment, inputs, tool);
235536
235499
  logger_default.debug("\uD83D\uDCE6 Container setup complete");
235537
235500
  const commandResult = await this.executeInContainer(container, command);
235538
235501
  logger_default.debug("⚡ Command execution complete");
@@ -235556,9 +235519,10 @@ class DaggerExecutionProvider extends ExecutionProvider {
235556
235519
  });
235557
235520
  });
235558
235521
  }
235559
- async setupContainer(client, environment, inputs) {
235560
- logger_default.debug(`\uD83D\uDE80 Setting up container with base image: ${this.options.baseImage}`);
235561
- let container = client.container().from(this.options.baseImage);
235522
+ async setupContainer(client, environment, inputs, tool) {
235523
+ const containerImage = tool?.from || this.options.baseImage;
235524
+ logger_default.debug(`\uD83D\uDE80 Setting up container with image: ${containerImage}${tool?.from ? " (from tool.from)" : " (default baseImage)"}`);
235525
+ let container = client.container().from(containerImage);
235562
235526
  logger_default.debug("\uD83D\uDCE6 Base container created");
235563
235527
  container = container.withWorkdir(this.options.workdir);
235564
235528
  logger_default.debug(`\uD83D\uDCC1 Working directory set to: ${this.options.workdir}`);
@@ -235567,7 +235531,7 @@ class DaggerExecutionProvider extends ExecutionProvider {
235567
235531
  }
235568
235532
  logger_default.debug(`\uD83C\uDF0D Added ${Object.keys(environment.vars).length} environment variables`);
235569
235533
  if (this.options.enableNetwork) {
235570
- container = await this.installCommonTools(container);
235534
+ container = await this.installCommonTools(container, containerImage);
235571
235535
  logger_default.debug("\uD83D\uDD27 Common tools installed");
235572
235536
  } else {
235573
235537
  logger_default.debug("\uD83D\uDD27 Skipping common tools installation (network disabled)");
@@ -235581,15 +235545,15 @@ class DaggerExecutionProvider extends ExecutionProvider {
235581
235545
  logger_default.debug("✅ Container setup complete");
235582
235546
  return container;
235583
235547
  }
235584
- async installCommonTools(container) {
235585
- logger_default.debug(`\uD83D\uDD27 Installing common tools for base image: ${this.options.baseImage}`);
235548
+ async installCommonTools(container, containerImage) {
235549
+ logger_default.debug(`\uD83D\uDD27 Installing common tools for container image: ${containerImage}`);
235586
235550
  try {
235587
- if (this.options.baseImage?.includes("node:")) {
235551
+ if (containerImage.includes("node:")) {
235588
235552
  logger_default.debug("\uD83D\uDCE6 Node.js image detected, skipping tool installation (most tools already available)");
235589
235553
  return container;
235590
235554
  }
235591
- const isAlpine = this.options.baseImage?.includes("alpine");
235592
- const isDebian = this.options.baseImage?.includes("debian") || this.options.baseImage?.includes("ubuntu");
235555
+ const isAlpine = containerImage.includes("alpine");
235556
+ const isDebian = containerImage.includes("debian") || containerImage.includes("ubuntu");
235593
235557
  if (isAlpine) {
235594
235558
  logger_default.debug("\uD83D\uDCE6 Detected Alpine Linux, installing basic tools");
235595
235559
  container = container.withExec([
@@ -235605,7 +235569,7 @@ class DaggerExecutionProvider extends ExecutionProvider {
235605
235569
  'timeout 60 apt-get update && timeout 60 apt-get install -y curl wget git && rm -rf /var/lib/apt/lists/* || echo "Package installation failed, continuing..."'
235606
235570
  ]);
235607
235571
  } else {
235608
- logger_default.warn(`Unknown base image ${this.options.baseImage}, skipping tool installation`);
235572
+ logger_default.warn(`Unknown container image ${containerImage}, skipping tool installation`);
235609
235573
  }
235610
235574
  logger_default.debug("✅ Common tools installation complete");
235611
235575
  return container;
@@ -235846,7 +235810,7 @@ class DaggerExecutionProvider extends ExecutionProvider {
235846
235810
  verbose,
235847
235811
  showSpinner: true,
235848
235812
  streamOutput: false
235849
- });
235813
+ }, undefined);
235850
235814
  if (result.exitCode !== 0) {
235851
235815
  throw new Error(`Command failed with exit code ${result.exitCode}: ${result.stderr}`);
235852
235816
  }
@@ -236392,9 +236356,26 @@ var VERIFICATION_POLICIES = {
236392
236356
  };
236393
236357
 
236394
236358
  // ../shared/dist/security/verification-enforcer.js
236359
+ function getSecurityPolicy(options) {
236360
+ if (options.isLocalFile) {
236361
+ return {
236362
+ allowSkipVerification: true,
236363
+ allowUnsigned: true,
236364
+ requireInteractiveConfirmation: false,
236365
+ defaultVerificationPolicy: "permissive"
236366
+ };
236367
+ }
236368
+ return {
236369
+ allowSkipVerification: false,
236370
+ allowUnsigned: false,
236371
+ requireInteractiveConfirmation: !!options.interactive,
236372
+ defaultVerificationPolicy: options.verifyPolicy || "permissive"
236373
+ };
236374
+ }
236395
236375
  async function enforceSignatureVerification(tool, options = {}) {
236396
236376
  const toolName = tool.name || "unknown";
236397
- if (options.skipVerification) {
236377
+ const securityPolicy = getSecurityPolicy(options);
236378
+ if (options.skipVerification && securityPolicy.allowSkipVerification) {
236398
236379
  logger_default.warn(`\uD83D\uDEA8 SECURITY WARNING: Signature verification skipped for tool: ${toolName}`);
236399
236380
  logger_default.warn(` This bypasses security measures and is NOT recommended for production use!`);
236400
236381
  return {
@@ -236413,7 +236394,7 @@ async function enforceSignatureVerification(tool, options = {}) {
236413
236394
  const hasSignatures = !!(tool.signatures && Object.keys(tool.signatures).length > 0) || !!tool.signature;
236414
236395
  if (!hasSignatures) {
236415
236396
  logger_default.warn(`⚠️ Tool has no signatures: ${toolName}`);
236416
- if (options.allowUnsigned) {
236397
+ if (options.allowUnsigned || securityPolicy.allowUnsigned) {
236417
236398
  logger_default.warn(` Allowing unsigned tool execution due to allowUnsigned flag (DEV/TEST ONLY)`);
236418
236399
  return {
236419
236400
  allowed: true,
@@ -236555,7 +236536,7 @@ class EnactCore {
236555
236536
  this.options = {
236556
236537
  apiUrl: "https://enact.tools",
236557
236538
  supabaseUrl: "https://xjnhhxwxovjifdxdwzih.supabase.co",
236558
- executionProvider: "direct",
236539
+ executionProvider: "dagger",
236559
236540
  defaultTimeout: "30s",
236560
236541
  verificationPolicy: "permissive",
236561
236542
  ...options
@@ -236566,7 +236547,8 @@ class EnactCore {
236566
236547
  setAuthToken(token) {
236567
236548
  this.options.authToken = token;
236568
236549
  }
236569
- async searchTools(options) {
236550
+ static async searchTools(options, coreOptions = {}) {
236551
+ const apiClient = new EnactApiClient(coreOptions.apiUrl || "https://enact.tools", coreOptions.supabaseUrl || "https://xjnhhxwxovjifdxdwzih.supabase.co");
236570
236552
  try {
236571
236553
  logger_default.info(`Searching for tools with query: "${options.query}"`);
236572
236554
  const searchParams = {
@@ -236574,12 +236556,12 @@ class EnactCore {
236574
236556
  limit: options.limit,
236575
236557
  tags: options.tags
236576
236558
  };
236577
- const results = await this.apiClient.searchTools(searchParams);
236559
+ const results = await apiClient.searchTools(searchParams);
236578
236560
  const tools = [];
236579
236561
  for (const result of results) {
236580
236562
  if (result.name) {
236581
236563
  try {
236582
- const tool = await this.getToolByName(result.name);
236564
+ const tool = await EnactCore.getToolByName(result.name, undefined, coreOptions);
236583
236565
  if (tool) {
236584
236566
  tools.push(tool);
236585
236567
  }
@@ -236594,15 +236576,19 @@ class EnactCore {
236594
236576
  logger_default.error("Error searching tools:", error);
236595
236577
  if (error instanceof Error && error.message.includes("502")) {
236596
236578
  logger_default.info("Search API unavailable, trying fallback to local filtering...");
236597
- return this.searchToolsFallback(options);
236579
+ return EnactCore.searchToolsFallback(options, coreOptions);
236598
236580
  }
236599
236581
  throw new Error(`Search failed: ${error instanceof Error ? error.message : String(error)}`);
236600
236582
  }
236601
236583
  }
236602
- async searchToolsFallback(options) {
236584
+ async searchTools(options) {
236585
+ return EnactCore.searchTools(options, this.options);
236586
+ }
236587
+ static async searchToolsFallback(options, coreOptions = {}) {
236588
+ const apiClient = new EnactApiClient(coreOptions.apiUrl || "https://enact.tools", coreOptions.supabaseUrl || "https://xjnhhxwxovjifdxdwzih.supabase.co");
236603
236589
  try {
236604
236590
  logger_default.info("Using fallback search method...");
236605
- const allTools = await this.apiClient.getTools({
236591
+ const allTools = await apiClient.getTools({
236606
236592
  limit: options.limit || 100
236607
236593
  });
236608
236594
  const filteredTools = [];
@@ -236610,7 +236596,7 @@ class EnactCore {
236610
236596
  for (const result of allTools) {
236611
236597
  if (result.name) {
236612
236598
  try {
236613
- const tool = await this.getToolByName(result.name);
236599
+ const tool = await EnactCore.getToolByName(result.name, undefined, coreOptions);
236614
236600
  if (tool) {
236615
236601
  const matchesQuery = tool.name.toLowerCase().includes(query) || tool.description && tool.description.toLowerCase().includes(query) || tool.tags && tool.tags.some((tag) => tag.toLowerCase().includes(query));
236616
236602
  const matchesTags = !options.tags || !options.tags.length || tool.tags && options.tags.some((searchTag) => tool.tags.some((toolTag) => toolTag.toLowerCase().includes(searchTag.toLowerCase())));
@@ -236634,10 +236620,11 @@ class EnactCore {
236634
236620
  throw new Error(`Search failed (including fallback): ${fallbackError instanceof Error ? fallbackError.message : String(fallbackError)}`);
236635
236621
  }
236636
236622
  }
236637
- async getToolByName(name, version) {
236623
+ static async getToolByName(name, version, coreOptions = {}) {
236624
+ const apiClient = new EnactApiClient(coreOptions.apiUrl || "https://enact.tools", coreOptions.supabaseUrl || "https://xjnhhxwxovjifdxdwzih.supabase.co");
236638
236625
  try {
236639
236626
  logger_default.info(`Fetching tool: ${name}${version ? `@${version}` : ""}`);
236640
- const response = await this.apiClient.getTool(name);
236627
+ const response = await apiClient.getTool(name);
236641
236628
  if (!response) {
236642
236629
  logger_default.info(`Tool not found: ${name}`);
236643
236630
  return null;
@@ -236687,6 +236674,9 @@ class EnactCore {
236687
236674
  throw error;
236688
236675
  }
236689
236676
  }
236677
+ async getToolByName(name, version) {
236678
+ return EnactCore.getToolByName(name, version, this.options);
236679
+ }
236690
236680
  async executeToolByName(name, inputs = {}, options = {}) {
236691
236681
  const executionId = this.generateExecutionId();
236692
236682
  try {
@@ -236728,20 +236718,6 @@ class EnactCore {
236728
236718
  try {
236729
236719
  logger_default.info(`Executing tool: ${tool.name}`);
236730
236720
  validateToolStructure(tool);
236731
- const verificationResult = await enforceSignatureVerification(tool, {
236732
- skipVerification: options.skipVerification,
236733
- verifyPolicy: options.verifyPolicy,
236734
- force: options.force,
236735
- allowUnsigned: false
236736
- });
236737
- logSecurityAudit(tool, verificationResult, verificationResult.allowed, {
236738
- skipVerification: options.skipVerification,
236739
- verifyPolicy: options.verifyPolicy,
236740
- force: options.force
236741
- });
236742
- if (!verificationResult.allowed) {
236743
- return createVerificationFailureResult(tool, verificationResult, executionId);
236744
- }
236745
236721
  const validatedInputs = validateInputs(tool, inputs);
236746
236722
  const safetyCheck = verifyCommandSafety(tool.command, tool);
236747
236723
  if (!safetyCheck.isSafe && !options.force) {
@@ -236757,81 +236733,48 @@ class EnactCore {
236757
236733
  toolName: tool.name,
236758
236734
  version: tool.version,
236759
236735
  executedAt: new Date().toISOString(),
236760
- environment: "direct",
236761
- command: tool.command
236762
- }
236763
- };
236764
- }
236765
- if (safetyCheck.warnings.length > 0) {
236766
- safetyCheck.warnings.forEach((warning) => logger_default.warn(warning));
236767
- }
236768
- if (options.dryRun) {
236769
- return {
236770
- success: true,
236771
- output: {
236772
- dryRun: true,
236773
- tool: tool.name,
236774
- command: tool.command,
236775
- inputs: validatedInputs,
236776
- safetyCheck
236777
- },
236778
- metadata: {
236779
- executionId,
236780
- toolName: tool.name,
236781
- version: tool.version,
236782
- executedAt: new Date().toISOString(),
236783
- environment: "direct",
236784
- command: tool.command
236736
+ environment: "direct"
236785
236737
  }
236786
236738
  };
236787
236739
  }
236788
- const envResult = await resolveToolEnvironmentVariables(tool.name, tool.env);
236789
- if (envResult.missing.length > 0) {
236790
- logger_default.warn(`Missing required environment variables: ${envResult.missing.join(", ")}`);
236740
+ const { resolved: envVars, missing: missingEnvVars } = await resolveToolEnvironmentVariables(tool.name, tool.env || {});
236741
+ const verificationResult = await enforceSignatureVerification(tool, {
236742
+ skipVerification: options.skipVerification,
236743
+ verifyPolicy: options.verifyPolicy,
236744
+ force: options.force,
236745
+ allowUnsigned: false,
236746
+ isLocalFile: options.isLocalFile,
236747
+ interactive: options.interactive
236748
+ });
236749
+ logSecurityAudit(tool, verificationResult, verificationResult.allowed, {
236750
+ skipVerification: options.skipVerification,
236751
+ verifyPolicy: options.verifyPolicy,
236752
+ force: options.force
236753
+ });
236754
+ if (!verificationResult.allowed) {
236755
+ return createVerificationFailureResult(tool, verificationResult, executionId);
236791
236756
  }
236792
- const environment = {
236793
- vars: {
236794
- ...envResult.resolved,
236795
- ...sanitizeEnvironmentVariables(validatedInputs)
236796
- },
236797
- resources: tool.resources,
236798
- namespace: tool.namespace
236799
- };
236800
- await this.executionProvider.setup(tool);
236801
- const result = await this.executionProvider.execute(tool, validatedInputs, environment);
236802
- if (result.success && result.output && tool.outputSchema) {
236803
- try {
236804
- result.output = validateOutput(tool, result.output);
236805
- } catch (error) {
236806
- logger_default.warn(`Output validation failed: ${error.message}`);
236757
+ logger_default.info(`✅ Security verification passed for tool: ${tool.name}`);
236758
+ return await this.executionProvider.execute(tool, { ...validatedInputs, ...envVars }, {
236759
+ vars: { ...envVars, ...validatedInputs },
236760
+ resources: {
236761
+ timeout: options.timeout || tool.timeout || this.options.defaultTimeout
236807
236762
  }
236808
- }
236809
- logger_default.info(`Tool execution completed: ${tool.name} (success: ${result.success})`);
236810
- return result;
236763
+ });
236811
236764
  } catch (error) {
236812
- logger_default.error(`Error executing tool: ${error.message}`);
236813
236765
  return {
236814
236766
  success: false,
236815
236767
  error: {
236816
236768
  message: error.message,
236817
- code: "EXECUTION_ERROR",
236818
- details: error
236769
+ code: "EXECUTION_ERROR"
236819
236770
  },
236820
236771
  metadata: {
236821
236772
  executionId,
236822
236773
  toolName: tool.name,
236823
- version: tool.version,
236824
236774
  executedAt: new Date().toISOString(),
236825
- environment: "direct",
236826
- command: tool.command
236775
+ environment: "direct"
236827
236776
  }
236828
236777
  };
236829
- } finally {
236830
- try {
236831
- await this.executionProvider.cleanup();
236832
- } catch (cleanupError) {
236833
- logger_default.error("Error during cleanup:", cleanupError);
236834
- }
236835
236778
  }
236836
236779
  }
236837
236780
  async executeRawTool(toolYaml, inputs = {}, options = {}) {
@@ -236861,9 +236804,9 @@ class EnactCore {
236861
236804
  };
236862
236805
  }
236863
236806
  }
236864
- async verifyTool(name, policy) {
236807
+ static async verifyTool(name, policy, coreOptions = {}) {
236865
236808
  try {
236866
- const tool = await this.getToolByName(name);
236809
+ const tool = await EnactCore.getToolByName(name, undefined, coreOptions);
236867
236810
  if (!tool) {
236868
236811
  return {
236869
236812
  verified: false,
@@ -236919,36 +236862,43 @@ class EnactCore {
236919
236862
  };
236920
236863
  }
236921
236864
  }
236922
- async toolExists(name) {
236865
+ async verifyTool(name, policy) {
236866
+ return EnactCore.verifyTool(name, policy, this.options);
236867
+ }
236868
+ static async toolExists(name, coreOptions = {}) {
236923
236869
  try {
236924
- const tool = await this.getToolByName(name);
236870
+ const tool = await EnactCore.getToolByName(name, undefined, coreOptions);
236925
236871
  return tool !== null;
236926
236872
  } catch (error) {
236927
236873
  return false;
236928
236874
  }
236929
236875
  }
236876
+ async toolExists(name) {
236877
+ return EnactCore.toolExists(name, this.options);
236878
+ }
236930
236879
  async getToolsByTags(tags, limit = 20) {
236931
- return this.searchTools({
236880
+ return EnactCore.searchTools({
236932
236881
  query: tags.join(" "),
236933
236882
  tags,
236934
236883
  limit
236935
- });
236884
+ }, this.options);
236936
236885
  }
236937
236886
  async getToolsByAuthor(author, limit = 20) {
236938
- return this.searchTools({
236887
+ return EnactCore.searchTools({
236939
236888
  query: `author:${author}`,
236940
236889
  author,
236941
236890
  limit
236942
- });
236891
+ }, this.options);
236943
236892
  }
236944
- async getTools(options = {}) {
236893
+ static async getTools(options = {}, coreOptions = {}) {
236894
+ const apiClient = new EnactApiClient(coreOptions.apiUrl || "https://enact.tools", coreOptions.supabaseUrl || "https://xjnhhxwxovjifdxdwzih.supabase.co");
236945
236895
  try {
236946
- const apiResults = await this.apiClient.getTools(options);
236896
+ const apiResults = await apiClient.getTools(options);
236947
236897
  const tools = [];
236948
236898
  for (const result of apiResults) {
236949
236899
  if (result.name) {
236950
236900
  try {
236951
- const tool = await this.getToolByName(result.name);
236901
+ const tool = await EnactCore.getToolByName(result.name, undefined, coreOptions);
236952
236902
  if (tool) {
236953
236903
  tools.push(tool);
236954
236904
  }
@@ -236963,22 +236913,20 @@ class EnactCore {
236963
236913
  throw new Error(`Failed to get tools: ${error instanceof Error ? error.message : String(error)}`);
236964
236914
  }
236965
236915
  }
236916
+ async getTools(options = {}) {
236917
+ return EnactCore.getTools(options, this.options);
236918
+ }
236966
236919
  async getAuthStatus() {
236967
236920
  return {
236968
236921
  authenticated: !!this.options.authToken,
236969
236922
  server: this.options.apiUrl
236970
236923
  };
236971
236924
  }
236972
- async publishTool(tool) {
236973
- if (!this.options.authToken) {
236974
- return {
236975
- success: false,
236976
- message: "Authentication required to publish tools"
236977
- };
236978
- }
236925
+ static async publishTool(tool, authToken, coreOptions = {}) {
236926
+ const apiClient = new EnactApiClient(coreOptions.apiUrl || "https://enact.tools", coreOptions.supabaseUrl || "https://xjnhhxwxovjifdxdwzih.supabase.co");
236979
236927
  try {
236980
236928
  validateToolStructure(tool);
236981
- await this.apiClient.publishTool(tool, this.options.authToken);
236929
+ await apiClient.publishTool(tool, authToken);
236982
236930
  return {
236983
236931
  success: true,
236984
236932
  message: `Successfully published tool: ${tool.name}`
@@ -236990,8 +236938,17 @@ class EnactCore {
236990
236938
  };
236991
236939
  }
236992
236940
  }
236941
+ async publishTool(tool) {
236942
+ if (!this.options.authToken) {
236943
+ return {
236944
+ success: false,
236945
+ message: "Authentication required to publish tools"
236946
+ };
236947
+ }
236948
+ return EnactCore.publishTool(tool, this.options.authToken, this.options);
236949
+ }
236993
236950
  async getToolInfo(name, version) {
236994
- return this.getToolByName(name, version);
236951
+ return EnactCore.getToolByName(name, version, this.options);
236995
236952
  }
236996
236953
  async getStatus() {
236997
236954
  const authStatus = await this.getAuthStatus();
@@ -237005,11 +236962,11 @@ class EnactCore {
237005
236962
  }
237006
236963
  createExecutionProvider() {
237007
236964
  switch (this.options.executionProvider) {
237008
- case "dagger":
237009
- return new DaggerExecutionProvider(this.options.daggerOptions);
237010
236965
  case "direct":
237011
- default:
237012
236966
  return new DirectExecutionProvider;
236967
+ case "dagger":
236968
+ default:
236969
+ return new DaggerExecutionProvider(this.options.daggerOptions);
237013
236970
  }
237014
236971
  }
237015
236972
  switchExecutionProvider(provider, options) {
@@ -237020,7 +236977,6 @@ class EnactCore {
237020
236977
  return `exec_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
237021
236978
  }
237022
236979
  }
237023
- var enactCore = new EnactCore;
237024
236980
  // ../shared/dist/utils/config.js
237025
236981
  import { homedir as homedir3 } from "os";
237026
236982
  import { join as join4 } from "path";
@@ -237166,6 +237122,8 @@ function validateSilentEnvironment() {
237166
237122
  issues
237167
237123
  };
237168
237124
  }
237125
+ // ../shared/dist/utils/version.js
237126
+ var __filename = "/Users/keithgroves/projects/enact/enact-cli/packages/shared/dist/utils/version.js";
237169
237127
  // ../shared/dist/web/env-manager-server.js
237170
237128
  import { createServer } from "http";
237171
237129
  import { parse as parse4 } from "url";
@@ -237452,8 +237410,8 @@ var yaml2 = __toESM(require_dist3(), 1);
237452
237410
  import { promises as fs6, readFileSync as readFileSync4, writeFileSync as writeFileSync2 } from "fs";
237453
237411
  import { join as join6, resolve, basename as basename2 } from "path";
237454
237412
  class LocalToolResolver {
237455
- constructor(enactCore2, localToolsDir = "./tools", cacheDir = "./.tool-cache") {
237456
- this.enactCore = enactCore2;
237413
+ constructor(enactCore, localToolsDir = "./tools", cacheDir = "./.tool-cache") {
237414
+ this.enactCore = enactCore;
237457
237415
  this.toolCache = new Map;
237458
237416
  this.aliases = new Map;
237459
237417
  this.favorites = new Set;
@@ -237874,10 +237832,10 @@ if (true) {
237874
237832
  `);
237875
237833
  }
237876
237834
  }
237877
- var enactCore2 = new EnactCore({
237835
+ var enactCore = new EnactCore({
237878
237836
  apiUrl: process.env.ENACT_API_URL || "https://enact.tools",
237879
237837
  supabaseUrl: process.env.ENACT_SUPABASE_URL || "https://xjnhhxwxovjifdxdwzih.supabase.co",
237880
- executionProvider: "direct",
237838
+ executionProvider: process.env.ENACT_EXECUTION_PROVIDER || "dagger",
237881
237839
  verificationPolicy: process.env.ENACT_VERIFY_POLICY || "permissive",
237882
237840
  authToken: process.env.ENACT_AUTH_TOKEN,
237883
237841
  defaultTimeout: "120s"
@@ -237957,7 +237915,7 @@ async function validateMcpToolEnvironmentVariables(toolName, toolEnv) {
237957
237915
  }
237958
237916
  var defaultToolsDir = join7(homedir5(), ".enact", "tools");
237959
237917
  var defaultCacheDir = join7(homedir5(), ".enact", "cache");
237960
- var toolResolver = new LocalToolResolver_default(enactCore2, process.env.LOCAL_TOOLS_DIR || defaultToolsDir, process.env.TOOL_CACHE_DIR || defaultCacheDir);
237918
+ var toolResolver = new LocalToolResolver_default(enactCore, process.env.LOCAL_TOOLS_DIR || defaultToolsDir, process.env.TOOL_CACHE_DIR || defaultCacheDir);
237961
237919
  (async () => {
237962
237920
  try {
237963
237921
  await toolResolver.initialize();
@@ -237965,8 +237923,8 @@ var toolResolver = new LocalToolResolver_default(enactCore2, process.env.LOCAL_T
237965
237923
  logger_default.warn(`Failed to initialize LocalToolResolver: ${error instanceof Error ? error.message : String(error)}`);
237966
237924
  }
237967
237925
  })();
237968
- server2.registerTool("execute-tool-by-name-enhanced", {
237969
- title: "Execute Tool (Enhanced)",
237926
+ server2.registerTool("execute-tool-by-name", {
237927
+ title: "Execute Tool",
237970
237928
  description: "Execute tools with smart resolution: local files, local tools directory, or registry. Supports async execution.",
237971
237929
  inputSchema: {
237972
237930
  name: exports_external.string().describe("Tool name OR file path to local YAML"),
@@ -237974,8 +237932,7 @@ server2.registerTool("execute-tool-by-name-enhanced", {
237974
237932
  localFile: exports_external.boolean().optional().describe("Treat 'name' as a file path to local YAML tool"),
237975
237933
  timeout: exports_external.string().optional().describe("Execution timeout"),
237976
237934
  verifyPolicy: exports_external.enum(["permissive", "enterprise", "paranoid"]).optional().describe("Verification policy"),
237977
- skipVerification: exports_external.boolean().optional().describe("Skip signature verification"),
237978
- force: exports_external.boolean().optional().describe("Force execution"),
237935
+ dangerouslySkipVerification: exports_external.boolean().optional().describe("Skip all signature verification (DANGEROUS)"),
237979
237936
  dryRun: exports_external.boolean().optional().describe("Dry run mode"),
237980
237937
  verbose: exports_external.boolean().optional().describe("Verbose output"),
237981
237938
  async: exports_external.boolean().optional().describe("Run in background for long operations"),
@@ -237988,8 +237945,7 @@ server2.registerTool("execute-tool-by-name-enhanced", {
237988
237945
  localFile = false,
237989
237946
  timeout: timeout3,
237990
237947
  verifyPolicy,
237991
- skipVerification,
237992
- force,
237948
+ dangerouslySkipVerification,
237993
237949
  dryRun,
237994
237950
  verbose,
237995
237951
  async = false,
@@ -238028,7 +237984,7 @@ server2.registerTool("execute-tool-by-name-enhanced", {
238028
237984
  };
238029
237985
  }
238030
237986
  } else if (forceRegistry) {
238031
- toolToExecute = await enactCore2.getToolByName(name);
237987
+ toolToExecute = await enactCore.getToolByName(name);
238032
237988
  resolutionInfo = "\uD83C\uDF10 Registry (forced)";
238033
237989
  } else {
238034
237990
  const resolution = await toolResolver.resolveTool(name);
@@ -238088,20 +238044,20 @@ ${suggestions.map((s2) => ` • ${s2}`).join(`
238088
238044
  let executionPromise;
238089
238045
  if (isLocalFile) {
238090
238046
  const yamlContent = await import("fs/promises").then((fs7) => fs7.readFile(toolToExecute.path, "utf-8"));
238091
- executionPromise = enactCore2.executeRawTool(yamlContent, inputs, {
238047
+ executionPromise = enactCore.executeRawTool(yamlContent, inputs, {
238092
238048
  timeout: timeout3 || "300s",
238093
238049
  verifyPolicy,
238094
- skipVerification: true,
238095
- force,
238050
+ skipVerification: dangerouslySkipVerification || true,
238051
+ force: dangerouslySkipVerification || true,
238096
238052
  dryRun,
238097
238053
  verbose
238098
238054
  });
238099
238055
  } else {
238100
- executionPromise = enactCore2.executeToolByName(toolToExecute.name || name, inputs, {
238056
+ executionPromise = enactCore.executeToolByName(toolToExecute.name || name, inputs, {
238101
238057
  timeout: timeout3 || "300s",
238102
238058
  verifyPolicy,
238103
- skipVerification,
238104
- force,
238059
+ skipVerification: dangerouslySkipVerification,
238060
+ force: dangerouslySkipVerification,
238105
238061
  dryRun,
238106
238062
  verbose
238107
238063
  });
@@ -238141,20 +238097,20 @@ Operation ID: ${operationId}
238141
238097
  let result;
238142
238098
  if (isLocalFile) {
238143
238099
  const yamlContent = await import("fs/promises").then((fs7) => fs7.readFile(toolToExecute.path, "utf-8"));
238144
- result = await enactCore2.executeRawTool(yamlContent, inputs, {
238100
+ result = await enactCore.executeRawTool(yamlContent, inputs, {
238145
238101
  timeout: timeout3 || "120s",
238146
238102
  verifyPolicy,
238147
- skipVerification: true,
238148
- force,
238103
+ skipVerification: dangerouslySkipVerification || true,
238104
+ force: dangerouslySkipVerification || true,
238149
238105
  dryRun,
238150
238106
  verbose
238151
238107
  });
238152
238108
  } else {
238153
- result = await enactCore2.executeToolByName(toolToExecute.name || name, inputs, {
238109
+ result = await enactCore.executeToolByName(toolToExecute.name || name, inputs, {
238154
238110
  timeout: timeout3 || "120s",
238155
238111
  verifyPolicy,
238156
- skipVerification,
238157
- force,
238112
+ skipVerification: dangerouslySkipVerification,
238113
+ force: dangerouslySkipVerification,
238158
238114
  dryRun,
238159
238115
  verbose
238160
238116
  });
@@ -238395,7 +238351,7 @@ server2.registerTool("create-local-tool", {
238395
238351
  timeout: exports_external.string().optional().describe("Execution timeout"),
238396
238352
  inputSchema: exports_external.record(exports_external.any()).optional().describe("Input schema for the tool"),
238397
238353
  env: exports_external.record(exports_external.any()).optional().describe("Environment variables"),
238398
- force: exports_external.boolean().default(false).describe("Overwrite if tool already exists")
238354
+ overwrite: exports_external.boolean().default(false).describe("Overwrite if tool already exists")
238399
238355
  }
238400
238356
  }, async ({
238401
238357
  name,
@@ -238405,7 +238361,7 @@ server2.registerTool("create-local-tool", {
238405
238361
  timeout: timeout3,
238406
238362
  inputSchema,
238407
238363
  env: env3,
238408
- force = false
238364
+ overwrite = false
238409
238365
  }) => {
238410
238366
  try {
238411
238367
  const { promises: fs7 } = await import("fs");
@@ -238413,7 +238369,7 @@ server2.registerTool("create-local-tool", {
238413
238369
  const toolsDir = join7(homedir5(), ".enact", "tools");
238414
238370
  await fs7.mkdir(toolsDir, { recursive: true });
238415
238371
  const toolPath = join7(toolsDir, `${name}.yaml`);
238416
- if (!force) {
238372
+ if (!overwrite) {
238417
238373
  try {
238418
238374
  await fs7.access(toolPath);
238419
238375
  return {
@@ -238422,7 +238378,7 @@ server2.registerTool("create-local-tool", {
238422
238378
  type: "text",
238423
238379
  text: `❌ Tool already exists: ${toolPath}
238424
238380
 
238425
- Use force: true to overwrite, or choose a different name.`
238381
+ Use overwrite: true to overwrite, or choose a different name.`
238426
238382
  }
238427
238383
  ],
238428
238384
  isError: true
@@ -238459,7 +238415,7 @@ Use force: true to overwrite, or choose a different name.`
238459
238415
  `;
238460
238416
  }
238461
238417
  output += `
238462
- \uD83D\uDCA1 Execute with: execute-tool-by-name-enhanced "${name}"`;
238418
+ \uD83D\uDCA1 Execute with: execute-tool-by-name "${name}"`;
238463
238419
  return { content: [{ type: "text", text: output }] };
238464
238420
  } catch (error) {
238465
238421
  return {
@@ -238486,7 +238442,7 @@ server2.registerTool("enact-search-tools", {
238486
238442
  }, async ({ query, limit = 10, tags, author, detailed = false }) => {
238487
238443
  try {
238488
238444
  logger_default.info(`Searching registry tools: "${query}"`);
238489
- const tools = await enactCore2.searchTools({ query, limit, tags, author });
238445
+ const tools = await enactCore.searchTools({ query, limit, tags, author });
238490
238446
  if (tools.length === 0) {
238491
238447
  return {
238492
238448
  content: [
@@ -238525,7 +238481,7 @@ server2.registerTool("enact-search-tools", {
238525
238481
  output += `
238526
238482
  `;
238527
238483
  });
238528
- output += `\uD83D\uDCA1 Execute any tool with: execute-tool-by-name-enhanced "<tool-name>"`;
238484
+ output += `\uD83D\uDCA1 Execute any tool with: execute-tool-by-name "<tool-name>"`;
238529
238485
  return { content: [{ type: "text", text: output }] };
238530
238486
  } catch (error) {
238531
238487
  logger_default.error("Error searching tools:", error);
@@ -238766,7 +238722,7 @@ server2.registerTool("enact-core-status", {
238766
238722
  }
238767
238723
  }, async ({ detailed = false }) => {
238768
238724
  try {
238769
- const status = await enactCore2.getStatus();
238725
+ const status = await enactCore.getStatus();
238770
238726
  const toolStats = await toolResolver.listAllTools();
238771
238727
  let output = `\uD83D\uDD27 Enact MCP Status
238772
238728
  `;
@@ -238903,5 +238859,5 @@ if (__require.main == __require.module) {
238903
238859
  }
238904
238860
  export {
238905
238861
  server2 as server,
238906
- enactCore2 as enactCore
238862
+ enactCore
238907
238863
  };