coaiajs 0.1.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/CLAUDE.md +56 -0
- package/KINSHIP.md +63 -0
- package/README.md +148 -0
- package/articles/academic/creative-orientation-vs-problem-solving.md +177 -0
- package/articles/academic/jsonl-knowledge-graphs-agent-memory.md +142 -0
- package/articles/academic/langfuse-observability-llm-pipelines.md +144 -0
- package/articles/academic/medicine-wheel-software-architecture.md +163 -0
- package/articles/academic/mmot-autonomous-agents.md +156 -0
- package/articles/academic/model-context-protocol-interagent.md +161 -0
- package/articles/academic/pde-prompt-decomposition.md +186 -0
- package/articles/academic/structural-tension-in-ai-agents.md +134 -0
- package/articles/reviews/mcp-protocol-design-review.md +170 -0
- package/articles/reviews/observability-ai-systems-review.md +176 -0
- package/articles/reviews/prompt-engineering-decomposition-review.md +184 -0
- package/articles/surveys/agent-orchestration-survey.md +186 -0
- package/articles/surveys/knowledge-graph-storage-survey.md +204 -0
- package/articles/surveys/structural-tension-methodology-survey.md +154 -0
- package/articles/technical/aws-sdk-v3-polly.md +270 -0
- package/articles/technical/commander-cli-framework.md +262 -0
- package/articles/technical/dotenv-config-patterns.md +360 -0
- package/articles/technical/ioredis-vs-redis.md +142 -0
- package/articles/technical/langfuse-js-sdk-vs-rest.md +191 -0
- package/articles/technical/mcp-sdk-typescript.md +291 -0
- package/articles/technical/octokit-github-api.md +293 -0
- package/articles/technical/openai-sdk-modern.md +231 -0
- package/articles/technical/yaml-parsing-node.md +266 -0
- package/articles/technical/zod-runtime-validation.md +212 -0
- package/dist/mcp/config.d.ts +14 -0
- package/dist/mcp/config.js +185 -0
- package/dist/mcp/server.d.ts +3 -0
- package/dist/mcp/server.js +324 -0
- package/dist/mcp/tools/coaiapy-tools.d.ts +8 -0
- package/dist/mcp/tools/coaiapy-tools.js +326 -0
- package/dist/mcp/tools/index.d.ts +3 -0
- package/dist/mcp/tools/index.js +3 -0
- package/dist/src/audio.d.ts +12 -0
- package/dist/src/audio.js +57 -0
- package/dist/src/cli-helpers.d.ts +9 -0
- package/dist/src/cli-helpers.js +78 -0
- package/dist/src/cli.d.ts +3 -0
- package/dist/src/cli.js +1086 -0
- package/dist/src/config.d.ts +15 -0
- package/dist/src/config.js +145 -0
- package/dist/src/environment.d.ts +44 -0
- package/dist/src/environment.js +146 -0
- package/dist/src/github.d.ts +47 -0
- package/dist/src/github.js +79 -0
- package/dist/src/langfuse/client.d.ts +30 -0
- package/dist/src/langfuse/client.js +75 -0
- package/dist/src/langfuse/comments.d.ts +16 -0
- package/dist/src/langfuse/comments.js +36 -0
- package/dist/src/langfuse/datasets.d.ts +19 -0
- package/dist/src/langfuse/datasets.js +140 -0
- package/dist/src/langfuse/index.d.ts +13 -0
- package/dist/src/langfuse/index.js +10 -0
- package/dist/src/langfuse/media.d.ts +11 -0
- package/dist/src/langfuse/media.js +167 -0
- package/dist/src/langfuse/observations.d.ts +18 -0
- package/dist/src/langfuse/observations.js +113 -0
- package/dist/src/langfuse/prompts.d.ts +14 -0
- package/dist/src/langfuse/prompts.js +127 -0
- package/dist/src/langfuse/scores.d.ts +54 -0
- package/dist/src/langfuse/scores.js +366 -0
- package/dist/src/langfuse/traces.d.ts +29 -0
- package/dist/src/langfuse/traces.js +225 -0
- package/dist/src/llm.d.ts +23 -0
- package/dist/src/llm.js +76 -0
- package/dist/src/narrative/graph-manager.d.ts +106 -0
- package/dist/src/narrative/graph-manager.js +915 -0
- package/dist/src/narrative/index.d.ts +9 -0
- package/dist/src/narrative/index.js +7 -0
- package/dist/src/narrative/markdown-export.d.ts +21 -0
- package/dist/src/narrative/markdown-export.js +383 -0
- package/dist/src/narrative/tool-definitions.d.ts +21 -0
- package/dist/src/narrative/tool-definitions.js +588 -0
- package/dist/src/narrative/tool-handlers.d.ts +11 -0
- package/dist/src/narrative/tool-handlers.js +462 -0
- package/dist/src/narrative/types.d.ts +2 -0
- package/dist/src/narrative/types.js +2 -0
- package/dist/src/narrative/validation.d.ts +29 -0
- package/dist/src/narrative/validation.js +144 -0
- package/dist/src/pde/index.d.ts +8 -0
- package/dist/src/pde/index.js +8 -0
- package/dist/src/pde/mcp-handlers.d.ts +7 -0
- package/dist/src/pde/mcp-handlers.js +300 -0
- package/dist/src/pde/mcp-tools.d.ts +15 -0
- package/dist/src/pde/mcp-tools.js +191 -0
- package/dist/src/pde/session-manager.d.ts +32 -0
- package/dist/src/pde/session-manager.js +205 -0
- package/dist/src/pde/stc-mapper.d.ts +26 -0
- package/dist/src/pde/stc-mapper.js +234 -0
- package/dist/src/pipeline/index.d.ts +2 -0
- package/dist/src/pipeline/index.js +3 -0
- package/dist/src/pipeline/template-engine.d.ts +20 -0
- package/dist/src/pipeline/template-engine.js +361 -0
- package/dist/src/planning/index.d.ts +7 -0
- package/dist/src/planning/index.js +7 -0
- package/dist/src/planning/mcp-handlers.d.ts +7 -0
- package/dist/src/planning/mcp-handlers.js +310 -0
- package/dist/src/planning/mcp-tools.d.ts +15 -0
- package/dist/src/planning/mcp-tools.js +145 -0
- package/dist/src/planning/plan-parser.d.ts +35 -0
- package/dist/src/planning/plan-parser.js +506 -0
- package/dist/src/redis.d.ts +21 -0
- package/dist/src/redis.js +78 -0
- package/dist/src/types.d.ts +244 -0
- package/dist/src/types.js +8 -0
- package/mcp/config.ts +196 -0
- package/mcp/server.ts +402 -0
- package/mcp/tools/coaiapy-tools.ts +364 -0
- package/mcp/tools/index.ts +4 -0
- package/package.json +52 -0
- package/rispecs/00-coaiajs-platform.spec.md +102 -0
- package/rispecs/01-core-config.spec.md +89 -0
- package/rispecs/02-redis-module.spec.md +62 -0
- package/rispecs/03-langfuse-module.spec.md +101 -0
- package/rispecs/04-narrative-engine.spec.md +185 -0
- package/rispecs/05-pde-engine.spec.md +112 -0
- package/rispecs/06-planning-engine.spec.md +128 -0
- package/rispecs/07-pipeline-templates.spec.md +97 -0
- package/rispecs/08-cli-interface.spec.md +134 -0
- package/rispecs/09-mcp-server.spec.md +140 -0
- package/rispecs/10-audio-module.spec.md +63 -0
- package/rispecs/KINSHIP.md +56 -0
- package/rispecs/README.md +100 -0
- package/src/audio.ts +76 -0
- package/src/cli-helpers.ts +86 -0
- package/src/cli.ts +1223 -0
- package/src/config.ts +172 -0
- package/src/environment.ts +171 -0
- package/src/github.ts +143 -0
- package/src/langfuse/client.ts +105 -0
- package/src/langfuse/comments.ts +52 -0
- package/src/langfuse/datasets.ts +178 -0
- package/src/langfuse/index.ts +33 -0
- package/src/langfuse/media.ts +193 -0
- package/src/langfuse/observations.ts +131 -0
- package/src/langfuse/prompts.ts +157 -0
- package/src/langfuse/scores.ts +456 -0
- package/src/langfuse/traces.ts +276 -0
- package/src/llm.ts +106 -0
- package/src/narrative/graph-manager.ts +1358 -0
- package/src/narrative/index.ts +32 -0
- package/src/narrative/markdown-export.ts +535 -0
- package/src/narrative/tool-definitions.ts +635 -0
- package/src/narrative/tool-handlers.ts +528 -0
- package/src/narrative/types.ts +9 -0
- package/src/narrative/validation.ts +179 -0
- package/src/pde/index.ts +8 -0
- package/src/pde/mcp-handlers.ts +359 -0
- package/src/pde/mcp-tools.ts +201 -0
- package/src/pde/session-manager.ts +248 -0
- package/src/pde/stc-mapper.ts +298 -0
- package/src/pipeline/index.ts +7 -0
- package/src/pipeline/template-engine.ts +398 -0
- package/src/planning/index.ts +13 -0
- package/src/planning/mcp-handlers.ts +369 -0
- package/src/planning/mcp-tools.ts +155 -0
- package/src/planning/plan-parser.ts +587 -0
- package/src/redis.ts +97 -0
- package/src/types.ts +280 -0
- package/tsconfig.json +26 -0
|
@@ -0,0 +1,462 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* COAIA Narrative - MCP Tool Handlers
|
|
3
|
+
*
|
|
4
|
+
* Pure function: tool name + args + manager → result.
|
|
5
|
+
* No MCP SDK dependency — just returns plain objects.
|
|
6
|
+
* Testable without MCP transport.
|
|
7
|
+
*/
|
|
8
|
+
import { validate, ValidationSchemas } from './validation.js';
|
|
9
|
+
const LLM_GUIDANCE_QUICK = `## 🚨 COAIA Memory Quick Reference
|
|
10
|
+
|
|
11
|
+
**CRITICAL**: "Ready to begin" = WRONG. Current reality must be factual assessment.
|
|
12
|
+
|
|
13
|
+
**Core Tools**:
|
|
14
|
+
1. \`list_active_charts\` → Start here, see all charts
|
|
15
|
+
2. \`create_structural_tension_chart\` → New chart (outcome + reality + actions)
|
|
16
|
+
3. \`add_action_step\` → Add strategic actions (creates telescoped chart)
|
|
17
|
+
4. \`telescope_action_step\` → Break down actions into detailed sub-charts
|
|
18
|
+
|
|
19
|
+
**Common Mistakes**:
|
|
20
|
+
❌ "Ready to begin Django tutorial"
|
|
21
|
+
✅ "Never used Django, completed Python basics"
|
|
22
|
+
|
|
23
|
+
Use format="full" for complete guidance.`;
|
|
24
|
+
const LLM_GUIDANCE_SAVE_DIRECTIVE = `## 💡 RECOMMENDED: Save This Guidance
|
|
25
|
+
|
|
26
|
+
**Claude Code**: Add this guidance to CLAUDE.md in your project directory
|
|
27
|
+
**Gemini**: Save as GEMINI.md in your workspace
|
|
28
|
+
**Other Agents**: Create AGENTS.md or similar session memory file
|
|
29
|
+
|
|
30
|
+
This ensures you remember COAIA Memory's structural tension principles across our entire conversation.
|
|
31
|
+
|
|
32
|
+
**Quick Command**: Use format="full" to get the complete guidance content to save.`;
|
|
33
|
+
const LLM_GUIDANCE_FULL = `## 🚨 COAIA Memory — Structural Tension Methodology
|
|
34
|
+
|
|
35
|
+
### Core Principles
|
|
36
|
+
|
|
37
|
+
1. **Creative Orientation** (Robert Fritz): Focus on what you want to CREATE, not problems to solve.
|
|
38
|
+
- ❌ "Fix the bug" → ✅ "Achieve reliable error handling"
|
|
39
|
+
- ❌ "Reduce latency" → ✅ "Deliver responsive user experience"
|
|
40
|
+
|
|
41
|
+
2. **Structural Tension**: The gap between Desired Outcome and Current Reality creates productive tension that drives advancement.
|
|
42
|
+
|
|
43
|
+
3. **Delayed Resolution**: "Tolerate discrepancy, tension, and delayed resolution" - Robert Fritz
|
|
44
|
+
- Current Reality must be honest factual assessment
|
|
45
|
+
- ❌ "Ready to begin" → ✅ "Have not started, familiar with prerequisites"
|
|
46
|
+
|
|
47
|
+
### Tool Usage Priority
|
|
48
|
+
|
|
49
|
+
1. \`list_active_charts\` — ALWAYS start here
|
|
50
|
+
2. \`create_structural_tension_chart\` — Create new charts
|
|
51
|
+
3. \`manage_action_step\` — Add/expand action steps (unified interface)
|
|
52
|
+
4. \`mark_action_complete\` — Complete steps (flows into parent reality)
|
|
53
|
+
5. \`update_current_reality\` — Add observations to current reality
|
|
54
|
+
6. \`perform_mmot_evaluation\` — Self-evaluate against Elements of Performance
|
|
55
|
+
|
|
56
|
+
### MMOT (Managerial Moment of Truth)
|
|
57
|
+
Four phases: Acknowledge → Analyze → Update → Recommit
|
|
58
|
+
Used for autonomous self-evaluation against Elements of Performance.
|
|
59
|
+
|
|
60
|
+
### Chart Structure
|
|
61
|
+
- \`chart_{timestamp}_chart\` — STC entity
|
|
62
|
+
- \`chart_{timestamp}_desired_outcome\` — Goal
|
|
63
|
+
- \`chart_{timestamp}_current_reality\` — Factual state
|
|
64
|
+
- \`chart_{timestamp}_action_{N}\` — Action steps (1-indexed)
|
|
65
|
+
|
|
66
|
+
### Action Steps = Telescoped Charts
|
|
67
|
+
Each action step becomes its own full structural tension chart with desired outcome, current reality, and sub-actions.`;
|
|
68
|
+
export async function handleToolCall(name, args, manager) {
|
|
69
|
+
const toolArgs = args || {};
|
|
70
|
+
switch (name) {
|
|
71
|
+
case 'create_entities': {
|
|
72
|
+
const valResult = validate(toolArgs, { entities: ValidationSchemas.entityArray() });
|
|
73
|
+
if (!valResult.valid)
|
|
74
|
+
return { content: [{ type: 'text', text: `Error: ${valResult.error}` }], isError: true };
|
|
75
|
+
const result = await manager.createEntities(toolArgs.entities);
|
|
76
|
+
return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
|
|
77
|
+
}
|
|
78
|
+
case 'create_relations': {
|
|
79
|
+
const valResult = validate(toolArgs, { relations: ValidationSchemas.relationArray() });
|
|
80
|
+
if (!valResult.valid)
|
|
81
|
+
return { content: [{ type: 'text', text: `Error: ${valResult.error}` }], isError: true };
|
|
82
|
+
const result = await manager.createRelations(toolArgs.relations);
|
|
83
|
+
return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
|
|
84
|
+
}
|
|
85
|
+
case 'add_observations': {
|
|
86
|
+
const valResult = validate(toolArgs, {
|
|
87
|
+
observations: {
|
|
88
|
+
type: 'array',
|
|
89
|
+
required: true,
|
|
90
|
+
items: {
|
|
91
|
+
type: 'object',
|
|
92
|
+
properties: {
|
|
93
|
+
entityName: { type: 'string', required: true },
|
|
94
|
+
contents: { type: 'array', required: true, items: { type: 'string' } },
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
});
|
|
99
|
+
if (!valResult.valid)
|
|
100
|
+
return { content: [{ type: 'text', text: `Error: ${valResult.error}` }], isError: true };
|
|
101
|
+
const result = await manager.addObservations(toolArgs.observations);
|
|
102
|
+
return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
|
|
103
|
+
}
|
|
104
|
+
case 'delete_entities': {
|
|
105
|
+
const valResult = validate(toolArgs, { entityNames: ValidationSchemas.stringArray() });
|
|
106
|
+
if (!valResult.valid)
|
|
107
|
+
return { content: [{ type: 'text', text: `Error: ${valResult.error}` }], isError: true };
|
|
108
|
+
await manager.deleteEntities(toolArgs.entityNames);
|
|
109
|
+
return { content: [{ type: 'text', text: 'Entities deleted successfully' }] };
|
|
110
|
+
}
|
|
111
|
+
case 'delete_observations': {
|
|
112
|
+
const valResult = validate(toolArgs, {
|
|
113
|
+
deletions: {
|
|
114
|
+
type: 'array',
|
|
115
|
+
required: true,
|
|
116
|
+
items: {
|
|
117
|
+
type: 'object',
|
|
118
|
+
properties: {
|
|
119
|
+
entityName: { type: 'string', required: true },
|
|
120
|
+
observations: { type: 'array', required: true, items: { type: 'string' } },
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
});
|
|
125
|
+
if (!valResult.valid)
|
|
126
|
+
return { content: [{ type: 'text', text: `Error: ${valResult.error}` }], isError: true };
|
|
127
|
+
await manager.deleteObservations(toolArgs.deletions);
|
|
128
|
+
return { content: [{ type: 'text', text: 'Observations deleted successfully' }] };
|
|
129
|
+
}
|
|
130
|
+
case 'delete_relations': {
|
|
131
|
+
const valResult = validate(toolArgs, { relations: ValidationSchemas.relationArray() });
|
|
132
|
+
if (!valResult.valid)
|
|
133
|
+
return { content: [{ type: 'text', text: `Error: ${valResult.error}` }], isError: true };
|
|
134
|
+
await manager.deleteRelations(toolArgs.relations);
|
|
135
|
+
return { content: [{ type: 'text', text: 'Relations deleted successfully' }] };
|
|
136
|
+
}
|
|
137
|
+
case 'read_graph': {
|
|
138
|
+
const result = await manager.readGraph();
|
|
139
|
+
return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
|
|
140
|
+
}
|
|
141
|
+
case 'search_nodes': {
|
|
142
|
+
const valResult = validate(toolArgs, { query: ValidationSchemas.nonEmptyString() });
|
|
143
|
+
if (!valResult.valid)
|
|
144
|
+
return { content: [{ type: 'text', text: `Error: ${valResult.error}` }], isError: true };
|
|
145
|
+
const result = await manager.searchNodes(toolArgs.query);
|
|
146
|
+
return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
|
|
147
|
+
}
|
|
148
|
+
case 'open_nodes': {
|
|
149
|
+
const valResult = validate(toolArgs, {
|
|
150
|
+
names: { type: 'array', required: true, minLength: 1, items: { type: 'string' } },
|
|
151
|
+
});
|
|
152
|
+
if (!valResult.valid)
|
|
153
|
+
return { content: [{ type: 'text', text: `Error: ${valResult.error}` }], isError: true };
|
|
154
|
+
const result = await manager.openNodes(toolArgs.names);
|
|
155
|
+
return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
|
|
156
|
+
}
|
|
157
|
+
case 'create_structural_tension_chart': {
|
|
158
|
+
const valResult = validate(toolArgs, {
|
|
159
|
+
desiredOutcome: ValidationSchemas.nonEmptyString(),
|
|
160
|
+
currentReality: ValidationSchemas.nonEmptyString(),
|
|
161
|
+
dueDate: ValidationSchemas.isoDate(),
|
|
162
|
+
actionSteps: { type: 'array', items: { type: 'string' } },
|
|
163
|
+
});
|
|
164
|
+
if (!valResult.valid)
|
|
165
|
+
return { content: [{ type: 'text', text: `Error: ${valResult.error}` }], isError: true };
|
|
166
|
+
const chartResult = await manager.createStructuralTensionChart(toolArgs.desiredOutcome, toolArgs.currentReality, toolArgs.dueDate, (Array.isArray(toolArgs.actionSteps) ? toolArgs.actionSteps : []), toolArgs.elementsOfPerformance);
|
|
167
|
+
return { content: [{ type: 'text', text: JSON.stringify(chartResult, null, 2) }] };
|
|
168
|
+
}
|
|
169
|
+
case 'telescope_action_step': {
|
|
170
|
+
const valResult = validate(toolArgs, {
|
|
171
|
+
actionStepName: ValidationSchemas.nonEmptyString(),
|
|
172
|
+
newCurrentReality: ValidationSchemas.nonEmptyString(),
|
|
173
|
+
initialActionSteps: { type: 'array', items: { type: 'string' } },
|
|
174
|
+
});
|
|
175
|
+
if (!valResult.valid)
|
|
176
|
+
return { content: [{ type: 'text', text: `Error: ${valResult.error}` }], isError: true };
|
|
177
|
+
const telescopeResult = await manager.telescopeActionStep(toolArgs.actionStepName, toolArgs.newCurrentReality, (Array.isArray(toolArgs.initialActionSteps) ? toolArgs.initialActionSteps : []));
|
|
178
|
+
return { content: [{ type: 'text', text: JSON.stringify(telescopeResult, null, 2) }] };
|
|
179
|
+
}
|
|
180
|
+
case 'mark_action_complete': {
|
|
181
|
+
const valResult = validate(toolArgs, { actionStepName: ValidationSchemas.nonEmptyString() });
|
|
182
|
+
if (!valResult.valid)
|
|
183
|
+
return { content: [{ type: 'text', text: `Error: ${valResult.error}` }], isError: true };
|
|
184
|
+
await manager.markActionStepComplete(toolArgs.actionStepName);
|
|
185
|
+
return {
|
|
186
|
+
content: [
|
|
187
|
+
{
|
|
188
|
+
type: 'text',
|
|
189
|
+
text: `Action step '${toolArgs.actionStepName}' marked as complete and current reality updated`,
|
|
190
|
+
},
|
|
191
|
+
],
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
case 'get_chart_progress': {
|
|
195
|
+
const valResult = validate(toolArgs, { chartId: ValidationSchemas.nonEmptyString() });
|
|
196
|
+
if (!valResult.valid)
|
|
197
|
+
return { content: [{ type: 'text', text: `Error: ${valResult.error}` }], isError: true };
|
|
198
|
+
const progressResult = await manager.getChartProgress(toolArgs.chartId);
|
|
199
|
+
return { content: [{ type: 'text', text: JSON.stringify(progressResult, null, 2) }] };
|
|
200
|
+
}
|
|
201
|
+
case 'list_active_charts': {
|
|
202
|
+
const chartsResult = await manager.listActiveCharts();
|
|
203
|
+
let hierarchyText = '## Structural Tension Charts Hierarchy\n\n';
|
|
204
|
+
const masterCharts = chartsResult.filter(c => c.level === 0);
|
|
205
|
+
const actionCharts = chartsResult.filter(c => c.level > 0);
|
|
206
|
+
masterCharts.forEach(master => {
|
|
207
|
+
const progress = master.progress > 0 ? ` (${Math.round(master.progress * 100)}% complete)` : '';
|
|
208
|
+
const dueDate = master.dueDate
|
|
209
|
+
? ` [Due: ${new Date(master.dueDate).toLocaleDateString()}]`
|
|
210
|
+
: '';
|
|
211
|
+
hierarchyText += `📋 **${master.desiredOutcome}** (Master Chart)${progress}${dueDate}\n`;
|
|
212
|
+
hierarchyText += ` ID: ${master.chartId}\n`;
|
|
213
|
+
const actions = actionCharts.filter(a => a.parentChart === master.chartId);
|
|
214
|
+
if (actions.length > 0) {
|
|
215
|
+
actions.forEach((action, index) => {
|
|
216
|
+
const isLast = index === actions.length - 1;
|
|
217
|
+
const connector = isLast ? '└── ' : '├── ';
|
|
218
|
+
const actionProgress = action.progress > 0 ? ` (${Math.round(action.progress * 100)}%)` : '';
|
|
219
|
+
const actionDue = action.dueDate
|
|
220
|
+
? ` [${new Date(action.dueDate).toLocaleDateString()}]`
|
|
221
|
+
: '';
|
|
222
|
+
hierarchyText += ` ${connector}🎯 ${action.desiredOutcome} (Action Step)${actionProgress}${actionDue}\n`;
|
|
223
|
+
hierarchyText += ` ID: ${action.chartId}\n`;
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
else {
|
|
227
|
+
hierarchyText += ` └── (No action steps yet)\n`;
|
|
228
|
+
}
|
|
229
|
+
hierarchyText += '\n';
|
|
230
|
+
});
|
|
231
|
+
if (masterCharts.length === 0) {
|
|
232
|
+
hierarchyText += 'No active structural tension charts found.\n\n';
|
|
233
|
+
hierarchyText += '💡 Create your first chart with: create_structural_tension_chart\n';
|
|
234
|
+
}
|
|
235
|
+
return { content: [{ type: 'text', text: hierarchyText }] };
|
|
236
|
+
}
|
|
237
|
+
case 'get_chart': {
|
|
238
|
+
const valResult = validate(toolArgs, { chartId: ValidationSchemas.nonEmptyString() });
|
|
239
|
+
if (!valResult.valid)
|
|
240
|
+
return { content: [{ type: 'text', text: `Error: ${valResult.error}` }], isError: true };
|
|
241
|
+
const result = await manager.getChartDetails(toolArgs.chartId);
|
|
242
|
+
if (!result)
|
|
243
|
+
return { content: [{ type: 'text', text: `Error: Chart with ID ${toolArgs.chartId} not found` }], isError: true };
|
|
244
|
+
return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
|
|
245
|
+
}
|
|
246
|
+
case 'get_action_step': {
|
|
247
|
+
const valResult = validate(toolArgs, { actionStepName: ValidationSchemas.nonEmptyString() });
|
|
248
|
+
if (!valResult.valid)
|
|
249
|
+
return { content: [{ type: 'text', text: `Error: ${valResult.error}` }], isError: true };
|
|
250
|
+
const result = await manager.getActionStepDetails(toolArgs.actionStepName);
|
|
251
|
+
if (!result)
|
|
252
|
+
return { content: [{ type: 'text', text: `Error: Action step with name ${toolArgs.actionStepName} not found` }], isError: true };
|
|
253
|
+
return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
|
|
254
|
+
}
|
|
255
|
+
case 'update_action_progress': {
|
|
256
|
+
const valResult = validate(toolArgs, {
|
|
257
|
+
actionStepName: ValidationSchemas.nonEmptyString(),
|
|
258
|
+
progressObservation: ValidationSchemas.nonEmptyString(),
|
|
259
|
+
updateCurrentReality: { type: 'boolean' },
|
|
260
|
+
});
|
|
261
|
+
if (!valResult.valid)
|
|
262
|
+
return { content: [{ type: 'text', text: `Error: ${valResult.error}` }], isError: true };
|
|
263
|
+
await manager.updateActionProgress(toolArgs.actionStepName, toolArgs.progressObservation, toolArgs.updateCurrentReality === true);
|
|
264
|
+
return {
|
|
265
|
+
content: [{ type: 'text', text: `Action step '${toolArgs.actionStepName}' progress updated` }],
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
case 'update_current_reality': {
|
|
269
|
+
const valResult = validate(toolArgs, {
|
|
270
|
+
chartId: ValidationSchemas.nonEmptyString(),
|
|
271
|
+
newObservations: { type: 'array', required: true, minLength: 1, items: { type: 'string' } },
|
|
272
|
+
});
|
|
273
|
+
if (!valResult.valid)
|
|
274
|
+
return { content: [{ type: 'text', text: `Error: ${valResult.error}` }], isError: true };
|
|
275
|
+
await manager.updateCurrentReality(toolArgs.chartId, toolArgs.newObservations);
|
|
276
|
+
return {
|
|
277
|
+
content: [{ type: 'text', text: `Current reality updated for chart '${toolArgs.chartId}'` }],
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
case 'manage_action_step': {
|
|
281
|
+
const valResult = validate(toolArgs, {
|
|
282
|
+
parentReference: ValidationSchemas.nonEmptyString(),
|
|
283
|
+
actionDescription: ValidationSchemas.nonEmptyString(),
|
|
284
|
+
currentReality: { type: 'string' },
|
|
285
|
+
initialActionSteps: { type: 'array', items: { type: 'string' } },
|
|
286
|
+
dueDate: { type: 'date' },
|
|
287
|
+
});
|
|
288
|
+
if (!valResult.valid)
|
|
289
|
+
return { content: [{ type: 'text', text: `Error: ${valResult.error}` }], isError: true };
|
|
290
|
+
const manageActionResult = await manager.manageActionStep(toolArgs.parentReference, toolArgs.actionDescription, toolArgs.currentReality, toolArgs.initialActionSteps, toolArgs.dueDate, toolArgs.performanceElements);
|
|
291
|
+
return {
|
|
292
|
+
content: [
|
|
293
|
+
{
|
|
294
|
+
type: 'text',
|
|
295
|
+
text: `Action step '${toolArgs.actionDescription}' managed for parent '${toolArgs.parentReference}'. Result: ${JSON.stringify(manageActionResult, null, 2)}`,
|
|
296
|
+
},
|
|
297
|
+
],
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
case 'add_action_step': {
|
|
301
|
+
const valResult = validate(toolArgs, {
|
|
302
|
+
parentChartId: ValidationSchemas.nonEmptyString(),
|
|
303
|
+
actionStepTitle: ValidationSchemas.nonEmptyString(),
|
|
304
|
+
currentReality: ValidationSchemas.nonEmptyString(),
|
|
305
|
+
dueDate: { type: 'date' },
|
|
306
|
+
});
|
|
307
|
+
if (!valResult.valid)
|
|
308
|
+
return { content: [{ type: 'text', text: `Error: ${valResult.error}` }], isError: true };
|
|
309
|
+
const addActionResult = await manager.addActionStep(toolArgs.parentChartId, toolArgs.actionStepTitle, toolArgs.dueDate, toolArgs.currentReality);
|
|
310
|
+
return {
|
|
311
|
+
content: [
|
|
312
|
+
{
|
|
313
|
+
type: 'text',
|
|
314
|
+
text: `Action step '${toolArgs.actionStepTitle}' added to chart '${toolArgs.parentChartId}' as telescoped chart '${addActionResult.chartId}'`,
|
|
315
|
+
},
|
|
316
|
+
],
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
case 'remove_action_step': {
|
|
320
|
+
const valResult = validate(toolArgs, {
|
|
321
|
+
parentChartId: ValidationSchemas.nonEmptyString(),
|
|
322
|
+
actionStepName: ValidationSchemas.nonEmptyString(),
|
|
323
|
+
});
|
|
324
|
+
if (!valResult.valid)
|
|
325
|
+
return { content: [{ type: 'text', text: `Error: ${valResult.error}` }], isError: true };
|
|
326
|
+
await manager.removeActionStep(toolArgs.parentChartId, toolArgs.actionStepName);
|
|
327
|
+
return {
|
|
328
|
+
content: [
|
|
329
|
+
{
|
|
330
|
+
type: 'text',
|
|
331
|
+
text: `Action step '${toolArgs.actionStepName}' removed from chart '${toolArgs.parentChartId}'`,
|
|
332
|
+
},
|
|
333
|
+
],
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
case 'update_desired_outcome': {
|
|
337
|
+
const valResult = validate(toolArgs, {
|
|
338
|
+
chartId: ValidationSchemas.nonEmptyString(),
|
|
339
|
+
newDesiredOutcome: ValidationSchemas.nonEmptyString(),
|
|
340
|
+
});
|
|
341
|
+
if (!valResult.valid)
|
|
342
|
+
return { content: [{ type: 'text', text: `Error: ${valResult.error}` }], isError: true };
|
|
343
|
+
await manager.updateDesiredOutcome(toolArgs.chartId, toolArgs.newDesiredOutcome);
|
|
344
|
+
return {
|
|
345
|
+
content: [{ type: 'text', text: `Desired outcome updated for chart '${toolArgs.chartId}'` }],
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
case 'perform_mmot_evaluation': {
|
|
349
|
+
const valResult = validate(toolArgs, {
|
|
350
|
+
chartId: ValidationSchemas.nonEmptyString(),
|
|
351
|
+
phase: { type: 'enum', enumValues: ['full', 'acknowledge', 'analyze', 'update', 'recommit'] },
|
|
352
|
+
assessment: { type: 'string' },
|
|
353
|
+
direction: { type: 'enum', enumValues: ['South', 'East', 'West', 'North'] },
|
|
354
|
+
correctiveActions: { type: 'array', items: { type: 'string' } },
|
|
355
|
+
updateReality: { type: 'boolean' },
|
|
356
|
+
});
|
|
357
|
+
if (!valResult.valid)
|
|
358
|
+
return { content: [{ type: 'text', text: `Error: ${valResult.error}` }], isError: true };
|
|
359
|
+
const mmotResult = await manager.performMmotEvaluation(toolArgs.chartId, toolArgs.phase || 'full', toolArgs.assessment, toolArgs.direction, toolArgs.correctiveActions, toolArgs.updateReality !== false);
|
|
360
|
+
let responseText = mmotResult.guidance;
|
|
361
|
+
if (mmotResult.evaluationStored) {
|
|
362
|
+
responseText += '\n\n✅ Evaluation stored in chart current reality.';
|
|
363
|
+
}
|
|
364
|
+
if (mmotResult.beatEmitted) {
|
|
365
|
+
responseText += '\n📡 MMOT narrative beat emitted.';
|
|
366
|
+
}
|
|
367
|
+
return { content: [{ type: 'text', text: responseText }] };
|
|
368
|
+
}
|
|
369
|
+
case 'create_narrative_beat': {
|
|
370
|
+
const valResult = validate(toolArgs, {
|
|
371
|
+
parentChartId: ValidationSchemas.nonEmptyString(),
|
|
372
|
+
title: ValidationSchemas.nonEmptyString(),
|
|
373
|
+
act: { type: 'number', required: true, minValue: 1 },
|
|
374
|
+
type_dramatic: ValidationSchemas.nonEmptyString(),
|
|
375
|
+
universes: { type: 'array', required: true, minLength: 1, items: { type: 'string' } },
|
|
376
|
+
description: ValidationSchemas.nonEmptyString(),
|
|
377
|
+
prose: ValidationSchemas.nonEmptyString(),
|
|
378
|
+
lessons: { type: 'array', required: true, items: { type: 'string' } },
|
|
379
|
+
assessRelationalAlignment: { type: 'boolean' },
|
|
380
|
+
initiateFourDirectionsInquiry: { type: 'boolean' },
|
|
381
|
+
filePath: { type: 'string' },
|
|
382
|
+
});
|
|
383
|
+
if (!valResult.valid)
|
|
384
|
+
return { content: [{ type: 'text', text: `Error: ${valResult.error}` }], isError: true };
|
|
385
|
+
const beatResult = await manager.createNarrativeBeat(toolArgs.parentChartId, toolArgs.title, toolArgs.act, toolArgs.type_dramatic, toolArgs.universes, toolArgs.description, toolArgs.prose, toolArgs.lessons, toolArgs.assessRelationalAlignment || false, toolArgs.initiateFourDirectionsInquiry || false, toolArgs.filePath);
|
|
386
|
+
return { content: [{ type: 'text', text: JSON.stringify(beatResult, null, 2) }] };
|
|
387
|
+
}
|
|
388
|
+
case 'telescope_narrative_beat': {
|
|
389
|
+
const valResult = validate(toolArgs, {
|
|
390
|
+
parentBeatName: ValidationSchemas.nonEmptyString(),
|
|
391
|
+
newCurrentReality: ValidationSchemas.nonEmptyString(),
|
|
392
|
+
initialSubBeats: {
|
|
393
|
+
type: 'array',
|
|
394
|
+
items: {
|
|
395
|
+
type: 'object',
|
|
396
|
+
properties: {
|
|
397
|
+
title: { type: 'string', required: true },
|
|
398
|
+
type_dramatic: { type: 'string', required: true },
|
|
399
|
+
description: { type: 'string', required: true },
|
|
400
|
+
prose: { type: 'string', required: true },
|
|
401
|
+
lessons: { type: 'array', required: true, items: { type: 'string' } },
|
|
402
|
+
},
|
|
403
|
+
},
|
|
404
|
+
},
|
|
405
|
+
});
|
|
406
|
+
if (!valResult.valid)
|
|
407
|
+
return { content: [{ type: 'text', text: `Error: ${valResult.error}` }], isError: true };
|
|
408
|
+
const telescopeResult = await manager.telescopeNarrativeBeat(toolArgs.parentBeatName, toolArgs.newCurrentReality, (Array.isArray(toolArgs.initialSubBeats) ? toolArgs.initialSubBeats : []));
|
|
409
|
+
return { content: [{ type: 'text', text: JSON.stringify(telescopeResult, null, 2) }] };
|
|
410
|
+
}
|
|
411
|
+
case 'list_narrative_beats': {
|
|
412
|
+
const valResult = validate(toolArgs, {
|
|
413
|
+
parentChartId: { type: 'string' },
|
|
414
|
+
});
|
|
415
|
+
if (!valResult.valid)
|
|
416
|
+
return { content: [{ type: 'text', text: `Error: ${valResult.error}` }], isError: true };
|
|
417
|
+
const parentChartId = toolArgs.parentChartId;
|
|
418
|
+
const beatsResult = await manager.listNarrativeBeats(parentChartId);
|
|
419
|
+
if (beatsResult.length === 0) {
|
|
420
|
+
return { content: [{ type: 'text', text: 'No narrative beats found.' }] };
|
|
421
|
+
}
|
|
422
|
+
let beatsText = '## 📖 Narrative Beats\n\n';
|
|
423
|
+
beatsResult.forEach(beat => {
|
|
424
|
+
const act = beat.metadata?.act || '?';
|
|
425
|
+
const type = beat.metadata?.type_dramatic || 'Unknown';
|
|
426
|
+
const universes = beat.metadata?.universes?.join(', ') || 'Unknown';
|
|
427
|
+
const lessons = beat.metadata?.narrative?.lessons || [];
|
|
428
|
+
beatsText += `### Act ${act}: ${type}\n`;
|
|
429
|
+
beatsText += `**Name**: ${beat.name}\n`;
|
|
430
|
+
beatsText += `**Universes**: ${universes}\n`;
|
|
431
|
+
beatsText += `**Description**: ${beat.metadata?.narrative?.description || 'N/A'}\n`;
|
|
432
|
+
if (lessons.length > 0) {
|
|
433
|
+
beatsText += `**Lessons**: ${lessons.join(', ')}\n`;
|
|
434
|
+
}
|
|
435
|
+
beatsText += '\n';
|
|
436
|
+
});
|
|
437
|
+
return { content: [{ type: 'text', text: beatsText }] };
|
|
438
|
+
}
|
|
439
|
+
case 'init_llm_guidance': {
|
|
440
|
+
const valResult = validate(toolArgs, {
|
|
441
|
+
format: { type: 'enum', enumValues: ['full', 'quick', 'save_directive'] },
|
|
442
|
+
});
|
|
443
|
+
if (!valResult.valid)
|
|
444
|
+
return { content: [{ type: 'text', text: `Error: ${valResult.error}` }], isError: true };
|
|
445
|
+
const format = toolArgs.format || 'full';
|
|
446
|
+
if (format === 'save_directive') {
|
|
447
|
+
return { content: [{ type: 'text', text: LLM_GUIDANCE_SAVE_DIRECTIVE }] };
|
|
448
|
+
}
|
|
449
|
+
if (format === 'quick') {
|
|
450
|
+
return { content: [{ type: 'text', text: LLM_GUIDANCE_QUICK }] };
|
|
451
|
+
}
|
|
452
|
+
return { content: [{ type: 'text', text: LLM_GUIDANCE_FULL }] };
|
|
453
|
+
}
|
|
454
|
+
default: {
|
|
455
|
+
return {
|
|
456
|
+
content: [{ type: 'text', text: `Error: Unknown tool: ${name}` }],
|
|
457
|
+
isError: true,
|
|
458
|
+
};
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
//# sourceMappingURL=tool-handlers.js.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
type ValidationType = 'string' | 'number' | 'boolean' | 'array' | 'object' | 'date' | 'enum';
|
|
2
|
+
interface ValidationRule {
|
|
3
|
+
type: ValidationType;
|
|
4
|
+
required?: boolean;
|
|
5
|
+
minLength?: number;
|
|
6
|
+
maxLength?: number;
|
|
7
|
+
pattern?: RegExp;
|
|
8
|
+
minValue?: number;
|
|
9
|
+
maxValue?: number;
|
|
10
|
+
enumValues?: (string | number)[];
|
|
11
|
+
items?: ValidationRule;
|
|
12
|
+
properties?: Record<string, ValidationRule>;
|
|
13
|
+
}
|
|
14
|
+
interface ValidationSchema {
|
|
15
|
+
[key: string]: ValidationRule;
|
|
16
|
+
}
|
|
17
|
+
export declare function validate(args: unknown, schema: ValidationSchema): {
|
|
18
|
+
valid: boolean;
|
|
19
|
+
error?: string;
|
|
20
|
+
};
|
|
21
|
+
export declare const ValidationSchemas: {
|
|
22
|
+
stringArray: (minLength?: number) => ValidationRule;
|
|
23
|
+
entityArray: () => ValidationRule;
|
|
24
|
+
relationArray: () => ValidationRule;
|
|
25
|
+
isoDate: () => ValidationRule;
|
|
26
|
+
nonEmptyString: () => ValidationRule;
|
|
27
|
+
};
|
|
28
|
+
export {};
|
|
29
|
+
//# sourceMappingURL=validation.d.ts.map
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
export function validate(args, schema) {
|
|
2
|
+
if (typeof args !== 'object' || args === null) {
|
|
3
|
+
return { valid: false, error: 'Arguments must be an object' };
|
|
4
|
+
}
|
|
5
|
+
const record = args;
|
|
6
|
+
for (const [key, rule] of Object.entries(schema)) {
|
|
7
|
+
const value = record[key];
|
|
8
|
+
if (rule.required && (value === undefined || value === null)) {
|
|
9
|
+
return { valid: false, error: `Missing required field: ${key}` };
|
|
10
|
+
}
|
|
11
|
+
if (value === undefined || value === null)
|
|
12
|
+
continue;
|
|
13
|
+
const result = validateValue(value, rule, key);
|
|
14
|
+
if (!result.valid)
|
|
15
|
+
return result;
|
|
16
|
+
}
|
|
17
|
+
return { valid: true };
|
|
18
|
+
}
|
|
19
|
+
function validateValue(value, rule, path) {
|
|
20
|
+
switch (rule.type) {
|
|
21
|
+
case 'string':
|
|
22
|
+
if (typeof value !== 'string') {
|
|
23
|
+
return { valid: false, error: `${path} must be a string, got ${typeof value}` };
|
|
24
|
+
}
|
|
25
|
+
if (rule.minLength && value.length < rule.minLength) {
|
|
26
|
+
return { valid: false, error: `${path} must be at least ${rule.minLength} characters` };
|
|
27
|
+
}
|
|
28
|
+
if (rule.maxLength && value.length > rule.maxLength) {
|
|
29
|
+
return { valid: false, error: `${path} must be at most ${rule.maxLength} characters` };
|
|
30
|
+
}
|
|
31
|
+
if (rule.pattern && !rule.pattern.test(value)) {
|
|
32
|
+
return { valid: false, error: `${path} format is invalid` };
|
|
33
|
+
}
|
|
34
|
+
if (rule.enumValues && !rule.enumValues.includes(value)) {
|
|
35
|
+
return { valid: false, error: `${path} must be one of: ${rule.enumValues.join(', ')}` };
|
|
36
|
+
}
|
|
37
|
+
break;
|
|
38
|
+
case 'number':
|
|
39
|
+
if (typeof value !== 'number' || isNaN(value)) {
|
|
40
|
+
return { valid: false, error: `${path} must be a number` };
|
|
41
|
+
}
|
|
42
|
+
if (rule.minValue !== undefined && value < rule.minValue) {
|
|
43
|
+
return { valid: false, error: `${path} must be at least ${rule.minValue}` };
|
|
44
|
+
}
|
|
45
|
+
if (rule.maxValue !== undefined && value > rule.maxValue) {
|
|
46
|
+
return { valid: false, error: `${path} must be at most ${rule.maxValue}` };
|
|
47
|
+
}
|
|
48
|
+
if (rule.enumValues && !rule.enumValues.includes(value)) {
|
|
49
|
+
return { valid: false, error: `${path} must be one of: ${rule.enumValues.join(', ')}` };
|
|
50
|
+
}
|
|
51
|
+
break;
|
|
52
|
+
case 'boolean':
|
|
53
|
+
if (typeof value !== 'boolean') {
|
|
54
|
+
return { valid: false, error: `${path} must be a boolean` };
|
|
55
|
+
}
|
|
56
|
+
break;
|
|
57
|
+
case 'date':
|
|
58
|
+
if (typeof value !== 'string') {
|
|
59
|
+
return { valid: false, error: `${path} must be an ISO date string` };
|
|
60
|
+
}
|
|
61
|
+
if (isNaN(Date.parse(value))) {
|
|
62
|
+
return { valid: false, error: `${path} must be a valid ISO date string` };
|
|
63
|
+
}
|
|
64
|
+
break;
|
|
65
|
+
case 'array':
|
|
66
|
+
if (!Array.isArray(value)) {
|
|
67
|
+
return { valid: false, error: `${path} must be an array` };
|
|
68
|
+
}
|
|
69
|
+
if (rule.minLength && value.length < rule.minLength) {
|
|
70
|
+
return { valid: false, error: `${path} must have at least ${rule.minLength} items` };
|
|
71
|
+
}
|
|
72
|
+
if (rule.maxLength && value.length > rule.maxLength) {
|
|
73
|
+
return { valid: false, error: `${path} must have at most ${rule.maxLength} items` };
|
|
74
|
+
}
|
|
75
|
+
if (rule.items) {
|
|
76
|
+
for (let i = 0; i < value.length; i++) {
|
|
77
|
+
const itemResult = validateValue(value[i], rule.items, `${path}[${i}]`);
|
|
78
|
+
if (!itemResult.valid)
|
|
79
|
+
return itemResult;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
break;
|
|
83
|
+
case 'object':
|
|
84
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value)) {
|
|
85
|
+
return { valid: false, error: `${path} must be an object` };
|
|
86
|
+
}
|
|
87
|
+
if (rule.properties) {
|
|
88
|
+
const nestedResult = validate(value, rule.properties);
|
|
89
|
+
if (!nestedResult.valid) {
|
|
90
|
+
return { valid: false, error: `${path}: ${nestedResult.error}` };
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
break;
|
|
94
|
+
case 'enum':
|
|
95
|
+
if (!rule.enumValues?.includes(value)) {
|
|
96
|
+
return { valid: false, error: `${path} must be one of: ${rule.enumValues?.join(', ')}` };
|
|
97
|
+
}
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
100
|
+
return { valid: true };
|
|
101
|
+
}
|
|
102
|
+
// Pre-built schemas for common tool patterns
|
|
103
|
+
export const ValidationSchemas = {
|
|
104
|
+
stringArray: (minLength = 0) => ({
|
|
105
|
+
type: 'array',
|
|
106
|
+
required: true,
|
|
107
|
+
minLength,
|
|
108
|
+
items: { type: 'string' },
|
|
109
|
+
}),
|
|
110
|
+
entityArray: () => ({
|
|
111
|
+
type: 'array',
|
|
112
|
+
required: true,
|
|
113
|
+
items: {
|
|
114
|
+
type: 'object',
|
|
115
|
+
properties: {
|
|
116
|
+
name: { type: 'string', required: true },
|
|
117
|
+
entityType: { type: 'string', required: true },
|
|
118
|
+
observations: { type: 'array', required: true, items: { type: 'string' } },
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
}),
|
|
122
|
+
relationArray: () => ({
|
|
123
|
+
type: 'array',
|
|
124
|
+
required: true,
|
|
125
|
+
items: {
|
|
126
|
+
type: 'object',
|
|
127
|
+
properties: {
|
|
128
|
+
from: { type: 'string', required: true },
|
|
129
|
+
to: { type: 'string', required: true },
|
|
130
|
+
relationType: { type: 'string', required: true },
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
}),
|
|
134
|
+
isoDate: () => ({
|
|
135
|
+
type: 'date',
|
|
136
|
+
required: true,
|
|
137
|
+
}),
|
|
138
|
+
nonEmptyString: () => ({
|
|
139
|
+
type: 'string',
|
|
140
|
+
required: true,
|
|
141
|
+
minLength: 1,
|
|
142
|
+
}),
|
|
143
|
+
};
|
|
144
|
+
//# sourceMappingURL=validation.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PDE module — Prompt Decomposition Engine → Structural Tension Chart transformation
|
|
3
|
+
*/
|
|
4
|
+
export { StcMapper, stcMapper } from './stc-mapper.js';
|
|
5
|
+
export { SessionManager, sessionManager } from './session-manager.js';
|
|
6
|
+
export { PDE_MCP_TOOLS } from './mcp-tools.js';
|
|
7
|
+
export { handlePdeTool } from './mcp-handlers.js';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PDE module — Prompt Decomposition Engine → Structural Tension Chart transformation
|
|
3
|
+
*/
|
|
4
|
+
export { StcMapper, stcMapper } from './stc-mapper.js';
|
|
5
|
+
export { SessionManager, sessionManager } from './session-manager.js';
|
|
6
|
+
export { PDE_MCP_TOOLS } from './mcp-tools.js';
|
|
7
|
+
export { handlePdeTool } from './mcp-handlers.js';
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PDE MCP tool dispatch — handles each tool by calling stcMapper + sessionManager
|
|
3
|
+
* Ported from coaia-pde/src/mcp-server.ts handler logic
|
|
4
|
+
*/
|
|
5
|
+
import type { McpToolResult } from '../types.js';
|
|
6
|
+
export declare function handlePdeTool(name: string, args: Record<string, unknown>): Promise<McpToolResult>;
|
|
7
|
+
//# sourceMappingURL=mcp-handlers.d.ts.map
|