UNPKG

mcp-decisive

Version:

MCP server for WRAP decision-making framework with structured output

51 lines 2.8 kB
import { ok } from 'neverthrow'; // ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ // Implementation Section // ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ // Business rule: Always allow reset (no validation needed) const validateResetRequest = (request) => { return ok(request); }; // Command implementation using functional composition const resetDecisionCommand = (request) => validateResetRequest(request) .andThen(() => { // Create the reset event const event = { type: 'DecisionProcessReset', timestamp: new Date() }; return ok(event); }); // ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ // Error Handling Utilities // ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ const ResetDecisionErrorHandler = { // Smart constructor for reset errors resetFailed: (reason) => ({ type: 'ResetFailed', reason }), // Convert errors to user-friendly messages toString: (error) => { switch (error.type) { case 'ResetFailed': return `Reset failed: ${error.reason}`; default: return `Unknown error type`; } } }; // ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ // Public API - Expose only what's needed // ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ /** * Reset Decision Aggregate - The public interface for resetting decision process * * @command resetDecision - Reset the entire decision process * @utility toErrorMessage - Convert errors to user-friendly strings */ export const ResetDecisionAggregate = { resetDecision: resetDecisionCommand, toErrorMessage: ResetDecisionErrorHandler.toString, }; //# sourceMappingURL=reset-decision.js.map