mcp-casual-interview
Version:
MCP server for casual interview preparation workflow management
63 lines • 3.63 kB
JavaScript
import { NEXT_ACTION_PROMPTS } from './action-prompts.js';
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// Domain Constants - Business Rules as Data
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// Business Rules - Domain Policies
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
const WorkflowStateTransitions = {
/**
* Validates if a state transition is allowed
*/
canTransition: (from, to) => {
// Allow transition TO 'not_started' from any state (reset capability)
if (to === 'not_started') {
return true;
}
const allowedTransitions = {
'not_started': ['information_initially_registered', 'career_summary_created', 'completed'],
'information_initially_registered': ['career_summary_created', 'completed'],
'career_summary_created': ['match_position_determined', 'completed'],
'match_position_determined': ['match_degree_prediagnosed', 'career_summary_created', 'completed'],
'match_degree_prediagnosed': ['attract_plan_determined', 'match_position_determined', 'completed'],
'attract_plan_determined': ['completed', 'match_degree_prediagnosed'],
'completed': [] // Terminal state
};
return allowedTransitions[from]?.includes(to) ?? false;
},
/**
* Gets the next logical state in the workflow
*/
getNextState: (current) => {
const nextStates = {
'not_started': 'information_initially_registered',
'information_initially_registered': 'career_summary_created',
'career_summary_created': 'match_position_determined',
'match_position_determined': 'match_degree_prediagnosed',
'match_degree_prediagnosed': 'attract_plan_determined',
'attract_plan_determined': 'completed',
'completed': null
};
return nextStates[current] ?? null;
}
};
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// Public API - Term Model Interface
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
export const WorkflowValues = {
NextActionPrompts: NEXT_ACTION_PROMPTS
};
export const WorkflowPolicies = {
StateTransitions: WorkflowStateTransitions
};
export const WorkflowErrors = {
createValidationError: (message) => ({
type: 'BusinessRule',
message
}),
createWorkflowError: (type, message) => ({
type,
message
})
};
//# sourceMappingURL=index.js.map