mcp-decisive
Version:
MCP server for WRAP decision-making framework with structured output
91 lines • 3.04 kB
JavaScript
import { z } from 'zod';
/**
* WidenOptionsStepsのコンストラクタ
*/
export const WidenOptionsSteps = {
initialRegistered: () => ({ type: 'initial_registered', description: '初期登録した' }),
laddered: () => ({ type: 'laddered', description: 'ラダリングした' }),
analogicalResearchDone: () => ({ type: 'analogical_research_done', description: '類推解決策調査した' }),
eliminationTested: () => ({ type: 'elimination_tested', description: '消去テストした' }),
fixed: () => ({ type: 'fixed', description: 'fixした' }),
};
/**
* Zodスキーマ
*/
export const WidenOptionsStepsSchema = z.discriminatedUnion('type', [
z.object({
type: z.literal('initial_registered'),
description: z.literal('初期登録した')
}),
z.object({
type: z.literal('laddered'),
description: z.literal('ラダリングした')
}),
z.object({
type: z.literal('analogical_research_done'),
description: z.literal('類推解決策調査した')
}),
z.object({
type: z.literal('elimination_tested'),
description: z.literal('消去テストした')
}),
z.object({
type: z.literal('fixed'),
description: z.literal('fixした')
}),
]);
/**
* WorkflowStateからWidenOptionsStepsへのマッピング
*/
export const fromWorkflowState = (workflowState) => {
switch (workflowState.type) {
case 'initial_options_registered':
return WidenOptionsSteps.initialRegistered();
case 'laddered':
return WidenOptionsSteps.laddered();
case 'analogical_research_done':
return WidenOptionsSteps.analogicalResearchDone();
case 'elimination_tested':
return WidenOptionsSteps.eliminationTested();
case 'options_fixed':
return WidenOptionsSteps.fixed();
default:
return null;
}
};
/**
* WidenOptionsStepsからWorkflowStateのtypeへのマッピング
*/
export const toWorkflowStateType = (step) => {
switch (step.type) {
case 'initial_registered':
return 'initial_options_registered';
case 'laddered':
return 'laddered';
case 'analogical_research_done':
return 'analogical_research_done';
case 'elimination_tested':
return 'elimination_tested';
case 'fixed':
return 'options_fixed';
}
};
/**
* ステップの表示名を取得する純粋関数
*/
export const getStepDisplayName = (step) => step.description;
/**
* すべてのステップを順序通りに取得
*/
export const getAllSteps = () => [
WidenOptionsSteps.initialRegistered(),
WidenOptionsSteps.laddered(),
WidenOptionsSteps.analogicalResearchDone(),
WidenOptionsSteps.eliminationTested(),
WidenOptionsSteps.fixed(),
];
/**
* ステップを比較する純粋関数
*/
export const isStep = (step, type) => step.type === type;
//# sourceMappingURL=widen-options-steps.js.map