coaiajs 0.3.0 → 0.3.1

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.
Files changed (175) hide show
  1. package/KINSHIP.md +1 -1
  2. package/README.md +191 -75
  3. package/dist/mcp/config.d.ts.map +1 -0
  4. package/dist/mcp/config.js +0 -2
  5. package/dist/mcp/config.js.map +1 -0
  6. package/dist/mcp/prompts.d.ts.map +1 -0
  7. package/dist/mcp/prompts.js.map +1 -0
  8. package/dist/mcp/resources.d.ts.map +1 -0
  9. package/dist/mcp/resources.js.map +1 -0
  10. package/dist/mcp/server.d.ts.map +1 -0
  11. package/dist/mcp/server.js +1 -1
  12. package/dist/mcp/server.js.map +1 -0
  13. package/dist/mcp/tools/coaiapy-tools.d.ts.map +1 -0
  14. package/dist/mcp/tools/coaiapy-tools.js.map +1 -0
  15. package/dist/mcp/tools/index.d.ts.map +1 -0
  16. package/dist/mcp/tools/index.js.map +1 -0
  17. package/dist/src/audio.d.ts.map +1 -0
  18. package/dist/src/audio.js.map +1 -0
  19. package/dist/src/cli-helpers.d.ts.map +1 -0
  20. package/dist/src/cli-helpers.js.map +1 -0
  21. package/dist/src/cli.d.ts.map +1 -0
  22. package/dist/src/cli.js.map +1 -0
  23. package/dist/src/config.d.ts.map +1 -0
  24. package/dist/src/config.js.map +1 -0
  25. package/dist/src/environment.d.ts.map +1 -0
  26. package/dist/src/environment.js.map +1 -0
  27. package/dist/src/github.d.ts.map +1 -0
  28. package/dist/src/github.js.map +1 -0
  29. package/dist/src/index.d.ts +1 -0
  30. package/dist/src/index.d.ts.map +1 -0
  31. package/dist/src/index.js +1 -0
  32. package/dist/src/index.js.map +1 -0
  33. package/dist/src/langfuse/client.d.ts.map +1 -0
  34. package/dist/src/langfuse/client.js.map +1 -0
  35. package/dist/src/langfuse/comments.d.ts.map +1 -0
  36. package/dist/src/langfuse/comments.js.map +1 -0
  37. package/dist/src/langfuse/datasets.d.ts.map +1 -0
  38. package/dist/src/langfuse/datasets.js.map +1 -0
  39. package/dist/src/langfuse/index.d.ts.map +1 -0
  40. package/dist/src/langfuse/index.js.map +1 -0
  41. package/dist/src/langfuse/media.d.ts.map +1 -0
  42. package/dist/src/langfuse/media.js.map +1 -0
  43. package/dist/src/langfuse/observations.d.ts.map +1 -0
  44. package/dist/src/langfuse/observations.js.map +1 -0
  45. package/dist/src/langfuse/prompts.d.ts.map +1 -0
  46. package/dist/src/langfuse/prompts.js.map +1 -0
  47. package/dist/src/langfuse/scores.d.ts.map +1 -0
  48. package/dist/src/langfuse/scores.js.map +1 -0
  49. package/dist/src/langfuse/traces.d.ts.map +1 -0
  50. package/dist/src/langfuse/traces.js.map +1 -0
  51. package/dist/src/llm.d.ts.map +1 -0
  52. package/dist/src/llm.js.map +1 -0
  53. package/dist/src/narrative/graph-manager.d.ts.map +1 -0
  54. package/dist/src/narrative/graph-manager.js.map +1 -0
  55. package/dist/src/narrative/index.d.ts.map +1 -0
  56. package/dist/src/narrative/index.js.map +1 -0
  57. package/dist/src/narrative/markdown-export.d.ts.map +1 -0
  58. package/dist/src/narrative/markdown-export.js.map +1 -0
  59. package/dist/src/narrative/tool-definitions.d.ts.map +1 -0
  60. package/dist/src/narrative/tool-definitions.js.map +1 -0
  61. package/dist/src/narrative/tool-handlers.d.ts.map +1 -0
  62. package/dist/src/narrative/tool-handlers.js.map +1 -0
  63. package/dist/src/narrative/types.d.ts.map +1 -0
  64. package/dist/src/narrative/types.js.map +1 -0
  65. package/dist/src/narrative/validation.d.ts.map +1 -0
  66. package/dist/src/narrative/validation.js.map +1 -0
  67. package/dist/src/pde/index.d.ts.map +1 -0
  68. package/dist/src/pde/index.js.map +1 -0
  69. package/dist/src/pde/mcp-handlers.d.ts.map +1 -0
  70. package/dist/src/pde/mcp-handlers.js.map +1 -0
  71. package/dist/src/pde/mcp-tools.d.ts.map +1 -0
  72. package/dist/src/pde/mcp-tools.js.map +1 -0
  73. package/dist/src/pde/session-manager.d.ts.map +1 -0
  74. package/dist/src/pde/session-manager.js.map +1 -0
  75. package/dist/src/pde/stc-mapper.d.ts.map +1 -0
  76. package/dist/src/pde/stc-mapper.js.map +1 -0
  77. package/dist/src/pipeline/index.d.ts.map +1 -0
  78. package/dist/src/pipeline/index.js.map +1 -0
  79. package/dist/src/pipeline/template-engine.d.ts.map +1 -0
  80. package/dist/src/pipeline/template-engine.js.map +1 -0
  81. package/dist/src/planning/index.d.ts.map +1 -0
  82. package/dist/src/planning/index.js.map +1 -0
  83. package/dist/src/planning/mcp-handlers.d.ts.map +1 -0
  84. package/dist/src/planning/mcp-handlers.js.map +1 -0
  85. package/dist/src/planning/mcp-tools.d.ts.map +1 -0
  86. package/dist/src/planning/mcp-tools.js.map +1 -0
  87. package/dist/src/planning/plan-parser.d.ts.map +1 -0
  88. package/dist/src/planning/plan-parser.js.map +1 -0
  89. package/dist/src/redis.d.ts.map +1 -0
  90. package/dist/src/redis.js.map +1 -0
  91. package/dist/src/types.d.ts.map +1 -0
  92. package/dist/src/types.js.map +1 -0
  93. package/dist/src/version.d.ts.map +1 -0
  94. package/dist/src/version.js.map +1 -0
  95. package/llms-full.txt +361 -0
  96. package/llms.txt +43 -0
  97. package/package.json +79 -12
  98. package/.claude/settings.local.json +0 -17
  99. package/.claude-plugin/marketplace.json +0 -26
  100. package/articles/academic/NOTES.md +0 -1
  101. package/articles/academic/README.md +0 -1
  102. package/articles/academic/creative-orientation-vs-problem-solving.md +0 -177
  103. package/articles/academic/jsonl-knowledge-graphs-agent-memory.md +0 -142
  104. package/articles/academic/langfuse-observability-llm-pipelines.md +0 -144
  105. package/articles/academic/medicine-wheel-software-architecture.md +0 -163
  106. package/articles/academic/mmot-autonomous-agents.md +0 -156
  107. package/articles/academic/model-context-protocol-interagent.md +0 -161
  108. package/articles/academic/pde-prompt-decomposition.md +0 -186
  109. package/articles/academic/structural-tension-in-ai-agents.md +0 -134
  110. package/articles/reviews/mcp-protocol-design-review.md +0 -170
  111. package/articles/reviews/observability-ai-systems-review.md +0 -176
  112. package/articles/reviews/prompt-engineering-decomposition-review.md +0 -184
  113. package/articles/surveys/agent-orchestration-survey.md +0 -186
  114. package/articles/surveys/knowledge-graph-storage-survey.md +0 -204
  115. package/articles/surveys/structural-tension-methodology-survey.md +0 -154
  116. package/articles/technical/aws-sdk-v3-polly.md +0 -270
  117. package/articles/technical/commander-cli-framework.md +0 -262
  118. package/articles/technical/dotenv-config-patterns.md +0 -360
  119. package/articles/technical/ioredis-vs-redis.md +0 -142
  120. package/articles/technical/langfuse-js-sdk-vs-rest.md +0 -191
  121. package/articles/technical/mcp-sdk-typescript.md +0 -291
  122. package/articles/technical/octokit-github-api.md +0 -293
  123. package/articles/technical/openai-sdk-modern.md +0 -231
  124. package/articles/technical/yaml-parsing-node.md +0 -266
  125. package/articles/technical/zod-runtime-validation.md +0 -212
  126. package/coaiajs-langfuse-claude-plugin/.claude-plugin/marketplace.json +0 -16
  127. package/coaiajs-langfuse-claude-plugin/.claude-plugin/plugin.json +0 -10
  128. package/coaiajs-langfuse-claude-plugin/.mcp.json +0 -8
  129. package/coaiajs-langfuse-claude-plugin/README.md +0 -60
  130. package/mcp/config.ts +0 -225
  131. package/mcp/prompts.ts +0 -131
  132. package/mcp/resources.ts +0 -84
  133. package/mcp/server.ts +0 -519
  134. package/mcp/tools/coaiapy-tools.ts +0 -366
  135. package/mcp/tools/index.ts +0 -4
  136. package/src/audio.ts +0 -76
  137. package/src/cli-helpers.ts +0 -86
  138. package/src/cli.ts +0 -1261
  139. package/src/config.ts +0 -207
  140. package/src/environment.ts +0 -171
  141. package/src/github.ts +0 -143
  142. package/src/index.ts +0 -82
  143. package/src/langfuse/client.ts +0 -105
  144. package/src/langfuse/comments.ts +0 -52
  145. package/src/langfuse/datasets.ts +0 -178
  146. package/src/langfuse/index.ts +0 -37
  147. package/src/langfuse/media.ts +0 -193
  148. package/src/langfuse/observations.ts +0 -155
  149. package/src/langfuse/prompts.ts +0 -157
  150. package/src/langfuse/scores.ts +0 -456
  151. package/src/langfuse/traces.ts +0 -353
  152. package/src/llm.ts +0 -106
  153. package/src/narrative/graph-manager.ts +0 -1358
  154. package/src/narrative/index.ts +0 -188
  155. package/src/narrative/markdown-export.ts +0 -535
  156. package/src/narrative/tool-definitions.ts +0 -635
  157. package/src/narrative/tool-handlers.ts +0 -528
  158. package/src/narrative/types.ts +0 -9
  159. package/src/narrative/validation.ts +0 -179
  160. package/src/pde/index.ts +0 -34
  161. package/src/pde/mcp-handlers.ts +0 -359
  162. package/src/pde/mcp-tools.ts +0 -201
  163. package/src/pde/session-manager.ts +0 -248
  164. package/src/pde/stc-mapper.ts +0 -298
  165. package/src/pipeline/index.ts +0 -7
  166. package/src/pipeline/template-engine.ts +0 -398
  167. package/src/planning/index.ts +0 -32
  168. package/src/planning/mcp-handlers.ts +0 -369
  169. package/src/planning/mcp-tools.ts +0 -155
  170. package/src/planning/plan-parser.ts +0 -587
  171. package/src/redis.ts +0 -111
  172. package/src/types.ts +0 -281
  173. package/src/version.ts +0 -39
  174. package/test/config.test.mjs +0 -93
  175. package/tsconfig.json +0 -26
@@ -1,32 +0,0 @@
1
- /**
2
- * Planning module — Plan Parser + Plan→STC transformation
3
- */
4
-
5
- export {
6
- parsePlan,
7
- parsePlanContent,
8
- planToSTC,
9
- exportToJSONL,
10
- decompositionResultToPlan,
11
- } from './plan-parser.js';
12
- export { PLANNING_MCP_TOOLS } from './mcp-tools.js';
13
- export { handlePlanningTool } from './mcp-handlers.js';
14
-
15
- import { handlePlanningTool } from './mcp-handlers.js';
16
- import type { McpToolResult } from '../types.js';
17
-
18
- function firstText(result: McpToolResult): string {
19
- return result.content[0]?.text ?? '';
20
- }
21
-
22
- export async function convertToChart(planPath: string, outputPath?: string): Promise<string> {
23
- return firstText(await handlePlanningTool('plan_to_stc', { planPath, outputPath }));
24
- }
25
-
26
- export async function syncToChart(planPath: string, chartsPath: string): Promise<string> {
27
- return firstText(await handlePlanningTool('sync_plan_to_chart', { planPath, chartsPath }));
28
- }
29
-
30
- export async function syncToPlan(chartsPath: string, planPath: string): Promise<string> {
31
- return firstText(await handlePlanningTool('sync_chart_to_plan', { chartsPath, planPath }));
32
- }
@@ -1,369 +0,0 @@
1
- /**
2
- * Planning MCP tool dispatch — handles each tool by calling plan-parser functions
3
- * Ported from coaia-planning/src/index.ts handler logic
4
- */
5
-
6
- import { promises as fs, readFileSync, existsSync } from 'fs';
7
- import path from 'path';
8
- import type { McpToolResult, DecompositionResult, StoredDecomposition } from '../types.js';
9
- import {
10
- parsePlan,
11
- parsePlanContent,
12
- planToSTC,
13
- exportToJSONL,
14
- decompositionResultToPlan,
15
- } from './plan-parser.js';
16
- import type { StructuralTensionPlan } from '../types.js';
17
-
18
- // Cache for parsed plans
19
- const planCache = new Map<string, StructuralTensionPlan>();
20
-
21
- function getCachedOrParse(planPath: string): Promise<StructuralTensionPlan> {
22
- if (planCache.has(planPath)) {
23
- return Promise.resolve(planCache.get(planPath)!);
24
- }
25
- return parsePlan(planPath).then(parsed => {
26
- planCache.set(planPath, parsed);
27
- return parsed;
28
- });
29
- }
30
-
31
- interface ChartEntity {
32
- name: string;
33
- entityType: string;
34
- observations: string[];
35
- metadata?: Record<string, unknown>;
36
- }
37
-
38
- function loadExistingCharts(chartsPath: string): ChartEntity[] {
39
- try {
40
- if (!existsSync(chartsPath)) return [];
41
- const content = readFileSync(chartsPath, 'utf-8');
42
- return content
43
- .split('\n')
44
- .filter((line: string) => line.trim())
45
- .map((line: string) => JSON.parse(line) as ChartEntity);
46
- } catch {
47
- return [];
48
- }
49
- }
50
-
51
- interface PlanChange {
52
- type: 'new_action' | 'completed_action' | 'modified_outcome' | 'modified_reality';
53
- description: string;
54
- details: string;
55
- }
56
-
57
- function detectPlanChanges(parsed: StructuralTensionPlan, existingCharts: ChartEntity[]): PlanChange[] {
58
- const changes: PlanChange[] = [];
59
- const existingActions = existingCharts
60
- .filter(c => c.entityType === 'action_step')
61
- .map(c => c.observations[0]);
62
-
63
- for (const step of parsed.actionSteps) {
64
- if (!existingActions.includes(step.content)) {
65
- changes.push({
66
- type: 'new_action',
67
- description: step.content,
68
- details: `New action step detected: ${step.content}`,
69
- });
70
- }
71
- }
72
-
73
- return changes;
74
- }
75
-
76
- function chartsToPlan(charts: ChartEntity[]): string {
77
- let md = '';
78
-
79
- const chartEntity = charts.find(c => c.entityType === 'structural_tension_chart');
80
- if (chartEntity) {
81
- const title = chartEntity.name.replace(/_chart$/, '').replace(/_/g, ' ');
82
- md += `# ${title}\n\n`;
83
- }
84
-
85
- const desiredOutcome = charts.find(c => c.entityType === 'desired_outcome');
86
- if (desiredOutcome) {
87
- md += `## Desired Outcome\n\n${desiredOutcome.observations[0]}\n\n`;
88
- }
89
-
90
- const currentReality = charts.find(c => c.entityType === 'current_reality');
91
- if (currentReality) {
92
- md += `## Current Reality\n\n${currentReality.observations[0]}\n\n`;
93
- }
94
-
95
- const actionSteps = charts
96
- .filter(c => c.entityType === 'action_step')
97
- .sort((a, b) => ((a.metadata?.order as number) || 0) - ((b.metadata?.order as number) || 0));
98
-
99
- if (actionSteps.length > 0) {
100
- md += `## Action Steps\n\n`;
101
- for (const step of actionSteps) {
102
- const completed = step.metadata?.completionStatus ? '[x]' : '[ ]';
103
- md += `- ${completed} ${step.observations[0]}\n`;
104
- }
105
- }
106
-
107
- return md;
108
- }
109
-
110
- export async function handlePlanningTool(
111
- name: string,
112
- args: Record<string, unknown>
113
- ): Promise<McpToolResult> {
114
- try {
115
- switch (name) {
116
- case 'parse_plan_structural': {
117
- let parsed: StructuralTensionPlan;
118
-
119
- if (args.planPath) {
120
- const planPath = args.planPath as string;
121
- parsed = await parsePlan(planPath);
122
- planCache.set(planPath, parsed);
123
- } else if (args.planContent) {
124
- parsed = parsePlanContent(args.planContent as string);
125
- } else {
126
- throw new Error('Either planPath or planContent must be provided');
127
- }
128
-
129
- return {
130
- content: [{
131
- type: 'text',
132
- text: JSON.stringify({
133
- success: true,
134
- structuralAnalysis: {
135
- title: parsed.title,
136
- filePath: parsed.filePath,
137
- desiredOutcome: parsed.desiredOutcome ? {
138
- content: parsed.desiredOutcome.content,
139
- confidence: parsed.desiredOutcome.confidence,
140
- } : null,
141
- currentReality: parsed.currentReality ? {
142
- content: parsed.currentReality.content,
143
- confidence: parsed.currentReality.confidence,
144
- } : null,
145
- actionSteps: parsed.actionSteps.map(s => ({
146
- content: s.content,
147
- confidence: s.confidence,
148
- canTelescope: !!s.telescopesInto,
149
- })),
150
- observations: parsed.observations,
151
- },
152
- }, null, 2),
153
- }],
154
- };
155
- }
156
-
157
- case 'plan_to_stc': {
158
- const planPath = args.planPath as string;
159
- const outputPath = (args.outputPath as string) ||
160
- path.join(process.cwd(), `${path.basename(planPath, '.md')}.stc.jsonl`);
161
-
162
- const parsed = await getCachedOrParse(planPath);
163
-
164
- // Override current reality if provided
165
- if (args.currentReality && parsed.currentReality) {
166
- parsed.currentReality.content = args.currentReality as string;
167
- } else if (args.currentReality) {
168
- parsed.currentReality = {
169
- type: 'current_reality',
170
- content: args.currentReality as string,
171
- confidence: 1.0,
172
- sourceLines: { start: 0, end: 0 },
173
- };
174
- }
175
-
176
- const stc = planToSTC(parsed);
177
- const jsonl = exportToJSONL(stc);
178
-
179
- await fs.writeFile(outputPath, jsonl + '\n');
180
-
181
- return {
182
- content: [{
183
- type: 'text',
184
- text: JSON.stringify({
185
- success: true,
186
- chartCreated: {
187
- title: parsed.title,
188
- entitiesCount: stc.entities.length,
189
- relationsCount: stc.relations.length,
190
- outputPath,
191
- hasDesiredOutcome: !!parsed.desiredOutcome,
192
- hasCurrentReality: !!parsed.currentReality,
193
- actionStepsCount: parsed.actionSteps.length,
194
- telescopedCount: parsed.actionSteps.filter(s => s.telescopesInto).length,
195
- },
196
- }, null, 2),
197
- }],
198
- };
199
- }
200
-
201
- case 'sync_plan_to_chart': {
202
- const planPath = args.planPath as string;
203
- const chartsPath = args.chartsPath as string;
204
- const dryRun = args.dryRun as boolean || false;
205
-
206
- const parsed = await getCachedOrParse(planPath);
207
- const existingCharts = loadExistingCharts(chartsPath);
208
- const changes = detectPlanChanges(parsed, existingCharts);
209
-
210
- if (dryRun) {
211
- return {
212
- content: [{
213
- type: 'text',
214
- text: JSON.stringify({ dryRun: true, changes }, null, 2),
215
- }],
216
- };
217
- }
218
-
219
- // Apply changes: regenerate STC and write
220
- const stc = planToSTC(parsed);
221
- const jsonl = exportToJSONL(stc);
222
- await fs.writeFile(chartsPath, jsonl + '\n');
223
-
224
- return {
225
- content: [{
226
- type: 'text',
227
- text: JSON.stringify({ success: true, changesApplied: changes }, null, 2),
228
- }],
229
- };
230
- }
231
-
232
- case 'sync_chart_to_plan': {
233
- const chartsPath = args.chartsPath as string;
234
- const planPath = args.planPath as string;
235
- const dryRun = args.dryRun as boolean || false;
236
-
237
- const charts = loadExistingCharts(chartsPath);
238
- const planContent = chartsToPlan(charts);
239
-
240
- if (dryRun) {
241
- return {
242
- content: [{
243
- type: 'text',
244
- text: JSON.stringify({ dryRun: true, proposedPlanContent: planContent }, null, 2),
245
- }],
246
- };
247
- }
248
-
249
- await fs.writeFile(planPath, planContent);
250
-
251
- return {
252
- content: [{
253
- type: 'text',
254
- text: JSON.stringify({ success: true, planUpdated: planPath }, null, 2),
255
- }],
256
- };
257
- }
258
-
259
- case 'create_plan_trace': {
260
- const planPath = args.planPath as string;
261
- const chartsPath = args.chartsPath as string;
262
- const sessionId = args.sessionId as string | undefined;
263
- const metadata = args.metadata as Record<string, unknown> || {};
264
-
265
- const parsed = await getCachedOrParse(planPath);
266
- const charts = loadExistingCharts(chartsPath);
267
-
268
- const traceData = {
269
- trace_id: `plan-${Date.now()}`,
270
- name: `📋 Plan→STC: ${parsed.title}`,
271
- session_id: sessionId,
272
- input_data: {
273
- plan_title: parsed.title,
274
- plan_path: planPath,
275
- desired_outcome: parsed.desiredOutcome?.content,
276
- current_reality: parsed.currentReality?.content,
277
- action_steps: parsed.actionSteps.map(s => s.content),
278
- },
279
- output_data: {
280
- charts_created: charts.length,
281
- charts_path: chartsPath,
282
- },
283
- metadata: {
284
- ...metadata,
285
- transformation_timestamp: new Date().toISOString(),
286
- tool: 'coaia-planning',
287
- },
288
- };
289
-
290
- return {
291
- content: [{
292
- type: 'text',
293
- text: JSON.stringify({
294
- success: true,
295
- traceData,
296
- note: 'Use Langfuse MCP to create trace with this data',
297
- }, null, 2),
298
- }],
299
- };
300
- }
301
-
302
- case 'pde_to_plan': {
303
- const workdir = (args.workdir as string) || process.cwd();
304
- let decomposition: DecompositionResult;
305
- let originalPrompt: string | undefined = args.original_prompt as string | undefined;
306
-
307
- if (args.pde_id) {
308
- const pdeId = args.pde_id as string;
309
- const pdePath = path.join(workdir, '.pde', `${pdeId}.json`);
310
-
311
- let data: string;
312
- try {
313
- data = await fs.readFile(pdePath, 'utf-8');
314
- } catch {
315
- throw new Error(`PDE decomposition not found: ${pdePath}`);
316
- }
317
-
318
- const stored = JSON.parse(data) as StoredDecomposition;
319
- decomposition = stored.result;
320
- originalPrompt = originalPrompt || stored.prompt;
321
- } else if (args.decomposition_result) {
322
- decomposition = args.decomposition_result as DecompositionResult;
323
- } else {
324
- throw new Error('Either pde_id or decomposition_result must be provided');
325
- }
326
-
327
- const stc = decompositionResultToPlan(decomposition, originalPrompt);
328
- const jsonl = exportToJSONL(stc);
329
-
330
- if (args.outputPath) {
331
- const outPath = path.isAbsolute(args.outputPath as string)
332
- ? args.outputPath as string
333
- : path.resolve(args.outputPath as string);
334
- await fs.writeFile(outPath, jsonl + '\n');
335
- }
336
-
337
- return {
338
- content: [{
339
- type: 'text',
340
- text: JSON.stringify({
341
- success: true,
342
- chartCreated: {
343
- entitiesCount: stc.entities.length,
344
- relationsCount: stc.relations.length,
345
- primaryIntent: `${decomposition.primary.action}: ${decomposition.primary.target}`,
346
- actionStepsCount: decomposition.actionStack.length,
347
- ambiguitiesCount: decomposition.ambiguities.length,
348
- outputPath: args.outputPath || null,
349
- },
350
- jsonl,
351
- }, null, 2),
352
- }],
353
- };
354
- }
355
-
356
- default:
357
- throw new Error(`Unknown planning tool: ${name}`);
358
- }
359
- } catch (error: unknown) {
360
- const errorMessage = error instanceof Error ? error.message : String(error);
361
- return {
362
- content: [{
363
- type: 'text',
364
- text: `Error: ${errorMessage}`,
365
- }],
366
- isError: true,
367
- };
368
- }
369
- }
@@ -1,155 +0,0 @@
1
- /**
2
- * MCP tool definitions for Planning module (6 tools)
3
- * Ported from coaia-planning/src/tools/index.ts
4
- */
5
-
6
- export interface McpToolDef {
7
- name: string;
8
- description: string;
9
- inputSchema: {
10
- type: 'object';
11
- properties: Record<string, unknown>;
12
- required?: string[];
13
- };
14
- }
15
-
16
- export const PLANNING_MCP_TOOLS: McpToolDef[] = [
17
- {
18
- name: 'parse_plan_structural',
19
- description: 'Parse a Claude plan as structural tension chart. Extracts desired outcome, current reality, and action steps (which telescope into sub-charts). Returns confidence scores.',
20
- inputSchema: {
21
- type: 'object',
22
- properties: {
23
- planPath: {
24
- type: 'string',
25
- description: 'Path to the Claude plan markdown file',
26
- },
27
- planContent: {
28
- type: 'string',
29
- description: 'Alternative: raw markdown content (if path not provided)',
30
- },
31
- },
32
- },
33
- },
34
- {
35
- name: 'plan_to_stc',
36
- description: 'Convert plan to structural tension chart (JSONL). Action steps become telescoped STCs with their own desired outcome/current reality.',
37
- inputSchema: {
38
- type: 'object',
39
- properties: {
40
- planPath: {
41
- type: 'string',
42
- description: 'Path to the Claude plan markdown file',
43
- },
44
- currentReality: {
45
- type: 'string',
46
- description: 'Override: provide current reality if not detected in plan',
47
- },
48
- outputPath: {
49
- type: 'string',
50
- description: 'Path to write the STC JSONL (default: <planname>.stc.jsonl)',
51
- },
52
- },
53
- required: ['planPath'],
54
- },
55
- },
56
- {
57
- name: 'sync_plan_to_chart',
58
- description: 'Plan → Chart sync. When plan changes, update the structural tension chart.',
59
- inputSchema: {
60
- type: 'object',
61
- properties: {
62
- planPath: {
63
- type: 'string',
64
- description: 'Path to the Claude plan markdown file',
65
- },
66
- chartsPath: {
67
- type: 'string',
68
- description: 'Path to the charts JSONL file',
69
- },
70
- dryRun: {
71
- type: 'boolean',
72
- description: 'If true, show changes without applying',
73
- },
74
- },
75
- required: ['planPath', 'chartsPath'],
76
- },
77
- },
78
- {
79
- name: 'sync_chart_to_plan',
80
- description: 'Chart → Plan sync. When agents modify chart (observations, completions), regenerate plan markdown.',
81
- inputSchema: {
82
- type: 'object',
83
- properties: {
84
- chartsPath: {
85
- type: 'string',
86
- description: 'Path to the charts JSONL file',
87
- },
88
- planPath: {
89
- type: 'string',
90
- description: 'Path to write the updated plan markdown',
91
- },
92
- dryRun: {
93
- type: 'boolean',
94
- description: 'If true, show proposed plan without writing',
95
- },
96
- },
97
- required: ['chartsPath', 'planPath'],
98
- },
99
- },
100
- {
101
- name: 'create_plan_trace',
102
- description: 'Generate Langfuse trace data for plan→STC transformation.',
103
- inputSchema: {
104
- type: 'object',
105
- properties: {
106
- planPath: {
107
- type: 'string',
108
- description: 'Path to the source plan',
109
- },
110
- chartsPath: {
111
- type: 'string',
112
- description: 'Path to generated charts',
113
- },
114
- sessionId: {
115
- type: 'string',
116
- description: 'Optional Langfuse session ID',
117
- },
118
- metadata: {
119
- type: 'object',
120
- description: 'Additional trace metadata',
121
- },
122
- },
123
- required: ['planPath', 'chartsPath'],
124
- },
125
- },
126
- {
127
- name: 'pde_to_plan',
128
- description: 'Convert a PDE DecompositionResult to a structural tension chart (JSONL). Takes pre-decomposed PDE output and produces coaia-narrative compatible entities and relations.',
129
- inputSchema: {
130
- type: 'object',
131
- properties: {
132
- pde_id: {
133
- type: 'string',
134
- description: 'ID of a stored PDE decomposition in .pde/ folder',
135
- },
136
- decomposition_result: {
137
- type: 'object',
138
- description: 'Alternative: provide DecompositionResult JSON directly',
139
- },
140
- original_prompt: {
141
- type: 'string',
142
- description: 'The original prompt (required if providing decomposition_result)',
143
- },
144
- outputPath: {
145
- type: 'string',
146
- description: 'Path to write the STC JSONL output',
147
- },
148
- workdir: {
149
- type: 'string',
150
- description: 'Working directory containing .pde/ folder (default: cwd)',
151
- },
152
- },
153
- },
154
- },
155
- ];