@pantion/mcp-server 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/dist/feature-set.d.ts +14 -0
- package/dist/feature-set.d.ts.map +1 -0
- package/dist/feature-set.js +38 -0
- package/dist/feature-set.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +56 -0
- package/dist/index.js.map +1 -0
- package/dist/prompts/convergence-prompts.d.ts +4 -0
- package/dist/prompts/convergence-prompts.d.ts.map +1 -0
- package/dist/prompts/convergence-prompts.js +76 -0
- package/dist/prompts/convergence-prompts.js.map +1 -0
- package/dist/prompts/index.d.ts +4 -0
- package/dist/prompts/index.d.ts.map +1 -0
- package/dist/prompts/index.js +7 -0
- package/dist/prompts/index.js.map +1 -0
- package/dist/prompts/workflow-prompts.d.ts +9 -0
- package/dist/prompts/workflow-prompts.d.ts.map +1 -0
- package/dist/prompts/workflow-prompts.js +249 -0
- package/dist/prompts/workflow-prompts.js.map +1 -0
- package/dist/resources/canon-resources.d.ts +4 -0
- package/dist/resources/canon-resources.d.ts.map +1 -0
- package/dist/resources/canon-resources.js +160 -0
- package/dist/resources/canon-resources.js.map +1 -0
- package/dist/server.d.ts +9 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +47 -0
- package/dist/server.js.map +1 -0
- package/dist/tools/amend.d.ts +4 -0
- package/dist/tools/amend.d.ts.map +1 -0
- package/dist/tools/amend.js +106 -0
- package/dist/tools/amend.js.map +1 -0
- package/dist/tools/approve.d.ts +4 -0
- package/dist/tools/approve.d.ts.map +1 -0
- package/dist/tools/approve.js +60 -0
- package/dist/tools/approve.js.map +1 -0
- package/dist/tools/check-convergence.d.ts +4 -0
- package/dist/tools/check-convergence.d.ts.map +1 -0
- package/dist/tools/check-convergence.js +50 -0
- package/dist/tools/check-convergence.js.map +1 -0
- package/dist/tools/check.d.ts +4 -0
- package/dist/tools/check.d.ts.map +1 -0
- package/dist/tools/check.js +190 -0
- package/dist/tools/check.js.map +1 -0
- package/dist/tools/create-skill.d.ts +4 -0
- package/dist/tools/create-skill.d.ts.map +1 -0
- package/dist/tools/create-skill.js +58 -0
- package/dist/tools/create-skill.js.map +1 -0
- package/dist/tools/decompose.d.ts +4 -0
- package/dist/tools/decompose.d.ts.map +1 -0
- package/dist/tools/decompose.js +56 -0
- package/dist/tools/decompose.js.map +1 -0
- package/dist/tools/index.d.ts +4 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +47 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/list-canons.d.ts +4 -0
- package/dist/tools/list-canons.d.ts.map +1 -0
- package/dist/tools/list-canons.js +28 -0
- package/dist/tools/list-canons.js.map +1 -0
- package/dist/tools/migrate.d.ts +4 -0
- package/dist/tools/migrate.d.ts.map +1 -0
- package/dist/tools/migrate.js +38 -0
- package/dist/tools/migrate.js.map +1 -0
- package/dist/tools/onboard.d.ts +4 -0
- package/dist/tools/onboard.d.ts.map +1 -0
- package/dist/tools/onboard.js +27 -0
- package/dist/tools/onboard.js.map +1 -0
- package/dist/tools/reconverge.d.ts +4 -0
- package/dist/tools/reconverge.d.ts.map +1 -0
- package/dist/tools/reconverge.js +68 -0
- package/dist/tools/reconverge.js.map +1 -0
- package/dist/tools/reject.d.ts +4 -0
- package/dist/tools/reject.d.ts.map +1 -0
- package/dist/tools/reject.js +57 -0
- package/dist/tools/reject.js.map +1 -0
- package/dist/tools/reskill.d.ts +4 -0
- package/dist/tools/reskill.d.ts.map +1 -0
- package/dist/tools/reskill.js +63 -0
- package/dist/tools/reskill.js.map +1 -0
- package/dist/tools/resume.d.ts +4 -0
- package/dist/tools/resume.d.ts.map +1 -0
- package/dist/tools/resume.js +56 -0
- package/dist/tools/resume.js.map +1 -0
- package/dist/tools/reverse.d.ts +4 -0
- package/dist/tools/reverse.d.ts.map +1 -0
- package/dist/tools/reverse.js +32 -0
- package/dist/tools/reverse.js.map +1 -0
- package/dist/tools/save-canon.d.ts +4 -0
- package/dist/tools/save-canon.d.ts.map +1 -0
- package/dist/tools/save-canon.js +97 -0
- package/dist/tools/save-canon.js.map +1 -0
- package/dist/tools/start.d.ts +4 -0
- package/dist/tools/start.d.ts.map +1 -0
- package/dist/tools/start.js +83 -0
- package/dist/tools/start.js.map +1 -0
- package/dist/tools/translate.d.ts +4 -0
- package/dist/tools/translate.d.ts.map +1 -0
- package/dist/tools/translate.js +102 -0
- package/dist/tools/translate.js.map +1 -0
- package/dist/tools/update.d.ts +4 -0
- package/dist/tools/update.d.ts.map +1 -0
- package/dist/tools/update.js +42 -0
- package/dist/tools/update.js.map +1 -0
- package/dist/utils/response.d.ts +12 -0
- package/dist/utils/response.d.ts.map +1 -0
- package/dist/utils/response.js +18 -0
- package/dist/utils/response.js.map +1 -0
- package/package.json +37 -0
- package/protocol/commands/amend.md +188 -0
- package/protocol/commands/build.md +90 -0
- package/protocol/commands/check.md +255 -0
- package/protocol/commands/create-skill.md +81 -0
- package/protocol/commands/decompose.md +230 -0
- package/protocol/commands/dialog.md +173 -0
- package/protocol/commands/help.md +121 -0
- package/protocol/commands/migrate.md +173 -0
- package/protocol/commands/onboard.md +210 -0
- package/protocol/commands/quick.md +170 -0
- package/protocol/commands/redialog.md +252 -0
- package/protocol/commands/reskill.md +73 -0
- package/protocol/commands/resume.md +148 -0
- package/protocol/commands/reverse.md +312 -0
- package/protocol/commands/start.md +220 -0
- package/protocol/commands/translate.md +157 -0
- package/protocol/commands/update.md +205 -0
- package/protocol/commands/validate.md +137 -0
- package/protocol/core-advanced.md +188 -0
- package/protocol/core.md +273 -0
- package/protocol/pantion-future-prompt.md +88 -0
- package/protocol/pantion-intent.md +78 -0
- package/protocol/templates/acceptance-tests.md +116 -0
- package/protocol/templates/behavior-map.md +135 -0
- package/protocol/templates/traceability-map.md +56 -0
- package/skills/image/convergence-rules.md +55 -0
- package/skills/image/prompts/convergence-intro.md +25 -0
- package/skills/image/prompts/translate-intro.md +37 -0
- package/skills/image/skill.json +12 -0
- package/skills/image/translate.md +67 -0
- package/skills/skill-builder/convergence-rules.md +64 -0
- package/skills/skill-builder/prompts/convergence-intro.md +21 -0
- package/skills/skill-builder/prompts/translate-intro.md +17 -0
- package/skills/skill-builder/skill.json +10 -0
- package/skills/skill-builder/translate.md +46 -0
- package/skills/software/convergence-rules.md +29 -0
- package/skills/software/prompts/convergence-intro.md +22 -0
- package/skills/software/prompts/translate-intro.md +19 -0
- package/skills/software/skill.json +12 -0
- package/skills/software/translate.md +74 -0
- package/skills/software-brownfield/convergence-rules.md +109 -0
- package/skills/software-brownfield/prompts/convergence-intro.md +26 -0
- package/skills/software-brownfield/prompts/translate-intro.md +13 -0
- package/skills/software-brownfield/skill.json +12 -0
- package/skills/software-brownfield/translate.md +56 -0
- package/souls/beginner/rules.md +34 -0
- package/souls/beginner/soul.json +6 -0
- package/souls/default/rules.md +25 -0
- package/souls/default/soul.json +6 -0
- package/souls/young/rules.md +67 -0
- package/souls/young/soul.json +6 -0
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { resolve } from 'node:path';
|
|
3
|
+
import { readFileSafe, canonDir, validateCanonFile, assertSafeName, readCanonIndex, extractHumanStamp, extractCanonMetadata, } from '@pantion/core';
|
|
4
|
+
import { success, error } from '../utils/response.js';
|
|
5
|
+
/**
|
|
6
|
+
* Compute the readiness label from the 12-category score.
|
|
7
|
+
*/
|
|
8
|
+
function readinessLabel(score) {
|
|
9
|
+
if (score >= 9)
|
|
10
|
+
return 'ready';
|
|
11
|
+
if (score >= 6)
|
|
12
|
+
return 'almost';
|
|
13
|
+
return 'idea';
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Compute the readiness verdict: can an agent build this without further interaction?
|
|
17
|
+
*/
|
|
18
|
+
function agentReadinessTest(result) {
|
|
19
|
+
const reasons = [];
|
|
20
|
+
if (result.openQuestions.length > 0) {
|
|
21
|
+
reasons.push(`${result.openQuestions.length} open question(s) remain`);
|
|
22
|
+
}
|
|
23
|
+
if (result.categories) {
|
|
24
|
+
const fails = result.categories.filter((c) => c.status === 'fail');
|
|
25
|
+
for (const f of fails) {
|
|
26
|
+
reasons.push(`${f.name}: ${f.detail ?? 'not satisfied'}`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
if (!result.stamp) {
|
|
30
|
+
reasons.push('No convergence stamp found');
|
|
31
|
+
}
|
|
32
|
+
else if (result.stamp.type === 'draft') {
|
|
33
|
+
reasons.push('Canon is still a DRAFT');
|
|
34
|
+
}
|
|
35
|
+
return { ready: reasons.length === 0, reasons };
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Check traceability: compare traceability.md with actual files on disk.
|
|
39
|
+
*/
|
|
40
|
+
function checkFileSync(canonName, projectPath) {
|
|
41
|
+
const dir = canonDir(projectPath);
|
|
42
|
+
const traceabilityPath = resolve(dir, canonName, 'traceability.md');
|
|
43
|
+
const traceability = readFileSafe(traceabilityPath);
|
|
44
|
+
const issues = [];
|
|
45
|
+
if (!traceability) {
|
|
46
|
+
issues.push('traceability.md not found');
|
|
47
|
+
return { inSync: false, issues };
|
|
48
|
+
}
|
|
49
|
+
// Extract referenced file paths from traceability (lines with file paths)
|
|
50
|
+
const fileRefs = traceability.match(/(?:spec\/|canon\/)[^\s|)]+/g) ?? [];
|
|
51
|
+
for (const ref of fileRefs) {
|
|
52
|
+
const fullPath = resolve(projectPath, ref);
|
|
53
|
+
if (!readFileSafe(fullPath)) {
|
|
54
|
+
issues.push(`Referenced file missing: ${ref}`);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return { inSync: issues.length === 0, issues };
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Check hierarchical consistency for architect canons.
|
|
61
|
+
*/
|
|
62
|
+
function checkHierarchical(canonName, projectPath) {
|
|
63
|
+
const dir = canonDir(projectPath);
|
|
64
|
+
const issues = [];
|
|
65
|
+
// Read the architect canon dialog
|
|
66
|
+
const architectDialog = readFileSafe(resolve(dir, canonName, 'dialog.md'));
|
|
67
|
+
if (!architectDialog) {
|
|
68
|
+
issues.push('Architect dialog not found');
|
|
69
|
+
return { issues };
|
|
70
|
+
}
|
|
71
|
+
// Read all canons to find components and interfaces
|
|
72
|
+
const allCanons = readCanonIndex(projectPath);
|
|
73
|
+
const components = allCanons.filter((c) => c.type === 'component');
|
|
74
|
+
const interfaces = allCanons.filter((c) => c.type === 'interface');
|
|
75
|
+
if (components.length === 0 && interfaces.length === 0) {
|
|
76
|
+
issues.push('No component or interface canons found — decomposition may be incomplete');
|
|
77
|
+
}
|
|
78
|
+
// Check each component has a dialog file
|
|
79
|
+
for (const comp of components) {
|
|
80
|
+
const compDialog = readFileSafe(resolve(dir, comp.name, 'dialog.md'));
|
|
81
|
+
if (!compDialog) {
|
|
82
|
+
issues.push(`Component canon "${comp.name}" has no dialog file`);
|
|
83
|
+
}
|
|
84
|
+
if (comp.openQuestions.length > 0) {
|
|
85
|
+
issues.push(`Component "${comp.name}" has ${comp.openQuestions.length} open question(s)`);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
// Check each interface has a dialog file
|
|
89
|
+
for (const iface of interfaces) {
|
|
90
|
+
const ifaceDialog = readFileSafe(resolve(dir, iface.name, 'dialog.md'));
|
|
91
|
+
if (!ifaceDialog) {
|
|
92
|
+
issues.push(`Interface canon "${iface.name}" has no dialog file`);
|
|
93
|
+
}
|
|
94
|
+
if (iface.openQuestions.length > 0) {
|
|
95
|
+
issues.push(`Interface "${iface.name}" has ${iface.openQuestions.length} open question(s)`);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return { issues };
|
|
99
|
+
}
|
|
100
|
+
export function registerCheck(server, context) {
|
|
101
|
+
server.tool('pantion_check', 'Run structural quality checks on an existing canon. Validates convergence elements, stamp format, completeness, and agent readiness. Returns scorecard with categories, readiness verdict, and optional hierarchical consistency checks.', {
|
|
102
|
+
canon_name: z.string().describe('Name of the canon to check'),
|
|
103
|
+
project_path: z.string().optional().describe('Project directory (defaults to server project path)'),
|
|
104
|
+
}, async ({ canon_name, project_path }) => {
|
|
105
|
+
try {
|
|
106
|
+
const projectPath = project_path ?? context.projectPath;
|
|
107
|
+
assertSafeName(canon_name);
|
|
108
|
+
const dir = canonDir(projectPath);
|
|
109
|
+
const dialogPath = resolve(dir, canon_name, 'dialog.md');
|
|
110
|
+
const content = readFileSafe(dialogPath);
|
|
111
|
+
if (!content) {
|
|
112
|
+
return success({
|
|
113
|
+
issues: [{ severity: 'error', message: `Canon dialog not found: ${dialogPath}` }],
|
|
114
|
+
score: 0,
|
|
115
|
+
readiness: 'idea',
|
|
116
|
+
agent_ready: false,
|
|
117
|
+
agent_ready_reasons: ['Canon dialog not found'],
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
const result = validateCanonFile(content);
|
|
121
|
+
// Scorecard: count passing categories (0-12)
|
|
122
|
+
const score = result.score ?? 0;
|
|
123
|
+
const readiness = readinessLabel(score);
|
|
124
|
+
// Agent readiness test
|
|
125
|
+
const { ready: agentReady, reasons: agentReadyReasons } = agentReadinessTest(result);
|
|
126
|
+
// File sync check
|
|
127
|
+
const fileSync = checkFileSync(canon_name, projectPath);
|
|
128
|
+
if (!fileSync.inSync) {
|
|
129
|
+
for (const issue of fileSync.issues) {
|
|
130
|
+
result.issues.push({ severity: 'warning', message: `File sync: ${issue}` });
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
// Hierarchical checks if this is an architect canon
|
|
134
|
+
let hierarchical;
|
|
135
|
+
if (result.stamp?.canonType === 'architect') {
|
|
136
|
+
hierarchical = checkHierarchical(canon_name, projectPath);
|
|
137
|
+
for (const issue of hierarchical.issues) {
|
|
138
|
+
result.issues.push({ severity: 'warning', message: `Hierarchical: ${issue}` });
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
// HUMAN STAMP check
|
|
142
|
+
const humanStamp = extractHumanStamp(content);
|
|
143
|
+
const humanStampStatus = humanStamp?.status ?? 'PENDING';
|
|
144
|
+
if (humanStampStatus !== 'APPROVED' && humanStampStatus !== 'AUTO-APPROVED') {
|
|
145
|
+
result.issues.push({
|
|
146
|
+
severity: 'warning',
|
|
147
|
+
message: `HUMAN STAMP is ${humanStampStatus} — canon must be approved before translation`,
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
// Total outcome: combine validator outcome with HUMAN STAMP status
|
|
151
|
+
const validatorOutcome = result.totalOutcome ?? 'FAIL';
|
|
152
|
+
let totalOutcome = validatorOutcome;
|
|
153
|
+
if (humanStampStatus !== 'APPROVED' && humanStampStatus !== 'AUTO-APPROVED') {
|
|
154
|
+
// HUMAN STAMP not authorized — downgrade to at most WARN
|
|
155
|
+
if (totalOutcome === 'PASS')
|
|
156
|
+
totalOutcome = 'WARN';
|
|
157
|
+
}
|
|
158
|
+
// Check result summary for passing to save-canon
|
|
159
|
+
const totalCategories = result.categories?.length ?? 0;
|
|
160
|
+
const checkResultSummary = `${totalOutcome} (${score}/${totalCategories})`;
|
|
161
|
+
// Canon metadata (server-generated, if present)
|
|
162
|
+
const canonMetadata = extractCanonMetadata(content);
|
|
163
|
+
return success({
|
|
164
|
+
issues: result.issues,
|
|
165
|
+
score,
|
|
166
|
+
total_outcome: totalOutcome,
|
|
167
|
+
check_result_summary: checkResultSummary,
|
|
168
|
+
readiness,
|
|
169
|
+
agent_ready: agentReady,
|
|
170
|
+
agent_ready_reasons: agentReady ? undefined : agentReadyReasons,
|
|
171
|
+
categories: result.categories,
|
|
172
|
+
stamp_status: result.stamp ? result.stamp.type : undefined,
|
|
173
|
+
human_stamp_status: humanStampStatus,
|
|
174
|
+
open_questions: result.openQuestions.length > 0 ? result.openQuestions : undefined,
|
|
175
|
+
file_sync: fileSync.inSync ? 'in_sync' : 'out_of_sync',
|
|
176
|
+
file_sync_issues: fileSync.issues.length > 0 ? fileSync.issues : undefined,
|
|
177
|
+
hierarchical: hierarchical ? {
|
|
178
|
+
issues: hierarchical.issues.length > 0 ? hierarchical.issues : undefined,
|
|
179
|
+
status: hierarchical.issues.length === 0 ? 'consistent' : 'issues_found',
|
|
180
|
+
} : undefined,
|
|
181
|
+
canon_metadata: canonMetadata ?? undefined,
|
|
182
|
+
semantic_check_instruction: 'As the client LLM, answer the following question about this canon: "Name the top 3 reasons why this canon might not yet be fully converged. If there are none, explain why not." Include your answer in the check output.',
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
catch (err) {
|
|
186
|
+
return error(err instanceof Error ? err.message : String(err));
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
//# sourceMappingURL=check.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check.js","sourceRoot":"","sources":["../../src/tools/check.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,YAAY,EACZ,QAAQ,EACR,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAEtD;;GAEG;AACH,SAAS,cAAc,CAAC,KAAa;IACnC,IAAI,KAAK,IAAI,CAAC;QAAE,OAAO,OAAO,CAAC;IAC/B,IAAI,KAAK,IAAI,CAAC;QAAE,OAAO,QAAQ,CAAC;IAChC,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;GAEG;AACH,SAAS,kBAAkB,CAAC,MAAwB;IAClD,MAAM,OAAO,GAAa,EAAE,CAAC;IAE7B,IAAI,MAAM,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACpC,OAAO,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,aAAa,CAAC,MAAM,0BAA0B,CAAC,CAAC;IACzE,CAAC;IAED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AAS;gBACb,cAAc,EAAE,aAAa,IAAI,SAAS;gBAC1C,0BAA0B,EAAE,2NAA2N;aACxP,CAAC,CAAC;QACH,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,KAAK,CAAC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;QACjE,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-skill.d.ts","sourceRoot":"","sources":["../../src/tools/create-skill.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAWlD,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,aAAa,GAAG,IAAI,CA6DnF"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { getSkill, assembleSystemPrompt, createSession, saveSession, getSoul, assertSafeName, } from '@pantion/core';
|
|
3
|
+
import { success, error } from '../utils/response.js';
|
|
4
|
+
export function registerCreateSkill(server, context) {
|
|
5
|
+
server.tool('pantion_create-skill', 'Start a new skill creation dialog using the skill-builder meta-skill. Converges on domain knowledge to produce a complete Pantion skill.', {
|
|
6
|
+
skill_name: z.string().describe('Name for the new skill (e.g. "music-production", "legal-contract")'),
|
|
7
|
+
project_path: z.string().optional().describe('Project directory (defaults to server project path)'),
|
|
8
|
+
soul: z.string().optional().describe('Interaction style (e.g. "default", "beginner")'),
|
|
9
|
+
}, async ({ skill_name, project_path, soul }) => {
|
|
10
|
+
try {
|
|
11
|
+
assertSafeName(skill_name);
|
|
12
|
+
const projectPath = project_path ?? context.projectPath;
|
|
13
|
+
// Load the skill-builder meta-skill
|
|
14
|
+
const skillBuilder = getSkill('skill-builder', projectPath, context.skillsDir);
|
|
15
|
+
if (!skillBuilder) {
|
|
16
|
+
return error('Skill-builder meta-skill not found. Ensure it is installed in skills/skill-builder/.');
|
|
17
|
+
}
|
|
18
|
+
// Load soul (default if not specified)
|
|
19
|
+
const soulObj = soul
|
|
20
|
+
? getSoul(soul, projectPath, context.soulsDir)
|
|
21
|
+
: getSoul('default', projectPath, context.soulsDir);
|
|
22
|
+
// Assemble convergence instructions using skill-builder rules
|
|
23
|
+
const convergenceInstructions = assembleSystemPrompt({
|
|
24
|
+
mode: 'start',
|
|
25
|
+
skillRules: skillBuilder.convergenceRules,
|
|
26
|
+
soulRules: soulObj?.rules,
|
|
27
|
+
protocolDir: context.protocolDir,
|
|
28
|
+
});
|
|
29
|
+
// Create a session marked as skill creation
|
|
30
|
+
const sessionName = `create-skill-${skill_name}`;
|
|
31
|
+
const session = createSession(projectPath, sessionName, convergenceInstructions);
|
|
32
|
+
session.skill = 'skill-builder';
|
|
33
|
+
session.canonType = 'skill';
|
|
34
|
+
session.targetSkillName = skill_name;
|
|
35
|
+
if (soulObj)
|
|
36
|
+
session.soul = soulObj.manifest.name;
|
|
37
|
+
saveSession(projectPath, session);
|
|
38
|
+
return success({
|
|
39
|
+
session_id: session.id,
|
|
40
|
+
skill_name,
|
|
41
|
+
meta_skill: {
|
|
42
|
+
name: skillBuilder.manifest.name,
|
|
43
|
+
displayName: skillBuilder.manifest.displayName,
|
|
44
|
+
},
|
|
45
|
+
soul: soulObj ? {
|
|
46
|
+
name: soulObj.manifest.name,
|
|
47
|
+
displayName: soulObj.manifest.displayName,
|
|
48
|
+
} : null,
|
|
49
|
+
convergence_instructions: convergenceInstructions,
|
|
50
|
+
first_question: `I'm going to help you create a new Pantion skill called "${skill_name}". This skill will teach Pantion how to converge in your domain.\n\nLet's start: what domain does this skill cover, and what does it need to know that a general-purpose agent would miss?`,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
catch (err) {
|
|
54
|
+
return error(err instanceof Error ? err.message : String(err));
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=create-skill.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-skill.js","sourceRoot":"","sources":["../../src/tools/create-skill.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EACL,QAAQ,EACR,oBAAoB,EACpB,aAAa,EACb,WAAW,EACX,OAAO,EACP,cAAc,GACf,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAEtD,MAAM,UAAU,mBAAmB,CAAC,MAAiB,EAAE,OAAsB;IAC3E,MAAM,CAAC,IAAI,CACT,sBAAsB,EACtB,0IAA0I,EAC1I;QACE,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,oEAAoE,CAAC;QACrG,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,qDAAqD,CAAC;QACnG,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,gDAAgD,CAAC;KACvF,EACD,KAAK,EAAE,EAAE,UAAU,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,EAAE;QAC3C,IAAI,CAAC;YACH,cAAc,CAAC,UAAU,CAAC,CAAC;YAC3B,MAAM,WAAW,GAAG,YAAY,IAAI,OAAO,CAAC,WAAW,CAAC;YAExD,oCAAoC;YACpC,MAAM,YAAY,GAAG,QAAQ,CAAC,eAAe,EAAE,WAAW,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;YAC/E,IAAI,CAAC,YAAY,EAAE,CAAC;gBAClB,OAAO,KAAK,CAAC,sFAAsF,CAAC,CAAC;YACvG,CAAC;YAED,uCAAuC;YACvC,MAAM,OAAO,GAAG,I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U,4LAA4L;aACnR,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,KAAK,CAAC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;QACjE,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decompose.d.ts","sourceRoot":"","sources":["../../src/tools/decompose.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAalD,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,aAAa,GAAG,IAAI,CA8DjF"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { resolve } from 'node:path';
|
|
3
|
+
import { readFileSafe, canonDir, extractConvergenceStamp, assembleSystemPrompt, createSession, saveSession, assertSafeName, } from '@pantion/core';
|
|
4
|
+
import { success, error } from '../utils/response.js';
|
|
5
|
+
export function registerDecompose(server, context) {
|
|
6
|
+
server.tool('pantion_decompose', 'Decompose a converged canon into subsystems (architect, interface, and component canons). The canon must be CONVERGED before decomposition.', {
|
|
7
|
+
canon_name: z.string().describe('Name of the canon to decompose'),
|
|
8
|
+
project_path: z.string().optional().describe('Project directory (defaults to server project path)'),
|
|
9
|
+
}, async ({ canon_name, project_path }) => {
|
|
10
|
+
try {
|
|
11
|
+
const projectPath = project_path ?? context.projectPath;
|
|
12
|
+
assertSafeName(canon_name);
|
|
13
|
+
const dir = canonDir(projectPath);
|
|
14
|
+
const dialogPath = resolve(dir, canon_name, 'dialog.md');
|
|
15
|
+
const dialog = readFileSafe(dialogPath);
|
|
16
|
+
if (!dialog) {
|
|
17
|
+
return error(`Canon dialog not found: ${dialogPath}`);
|
|
18
|
+
}
|
|
19
|
+
const stamp = extractConvergenceStamp(dialog);
|
|
20
|
+
if (!stamp) {
|
|
21
|
+
return error('No convergence stamp found. The canon must be CONVERGED before decomposition.');
|
|
22
|
+
}
|
|
23
|
+
if (stamp.type === 'draft') {
|
|
24
|
+
return error('Canon is still a DRAFT. Use pantion_resume to finish converging first, then decompose.');
|
|
25
|
+
}
|
|
26
|
+
// Extract inference policy from stamp
|
|
27
|
+
const inferencePolicy = stamp.inferencePolicy;
|
|
28
|
+
// Assemble decompose system prompt
|
|
29
|
+
const convergenceInstructions = assembleSystemPrompt({
|
|
30
|
+
mode: 'decompose',
|
|
31
|
+
existingDialog: dialog,
|
|
32
|
+
canonName: canon_name,
|
|
33
|
+
protocolDir: context.protocolDir,
|
|
34
|
+
inferencePolicy: inferencePolicy === 'strict' ? 'strict' : undefined,
|
|
35
|
+
});
|
|
36
|
+
// Create a new session for the decomposition work
|
|
37
|
+
const session = createSession(projectPath, `decompose-${canon_name}`, convergenceInstructions);
|
|
38
|
+
session.canonName = canon_name;
|
|
39
|
+
saveSession(projectPath, session);
|
|
40
|
+
// Extract the raw STATUS value from the stamp for display
|
|
41
|
+
const statusMatch = stamp.raw.match(/STATUS:\s*(.+)/);
|
|
42
|
+
const displayStatus = statusMatch ? statusMatch[1].trim() : stamp.type;
|
|
43
|
+
return success({
|
|
44
|
+
dialog,
|
|
45
|
+
current_status: displayStatus,
|
|
46
|
+
session_id: session.id,
|
|
47
|
+
convergence_instructions: convergenceInstructions,
|
|
48
|
+
message: `Canon "${canon_name}" loaded for decomposition. Status: ${displayStatus}. Follow the decomposition protocol to split into architect, interface, and component canons.`,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
catch (err) {
|
|
52
|
+
return error(err instanceof Error ? err.message : String(err));
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=decompose.js.map
|
|
@@ -0,0 +1 @@
|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CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;QACjE,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AA0ClD,wBAAgB,aAAa,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,aAAa,GAAG,IAAI,CAM7E"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { isToolEnabled } from '../feature-set.js';
|
|
2
|
+
import { registerStart } from './start.js';
|
|
3
|
+
import { registerCheckConvergence } from './check-convergence.js';
|
|
4
|
+
import { registerSaveCanon } from './save-canon.js';
|
|
5
|
+
import { registerTranslate } from './translate.js';
|
|
6
|
+
import { registerCheck } from './check.js';
|
|
7
|
+
import { registerAmend } from './amend.js';
|
|
8
|
+
import { registerResume } from './resume.js';
|
|
9
|
+
import { registerListCanons } from './list-canons.js';
|
|
10
|
+
import { registerReconverge } from './reconverge.js';
|
|
11
|
+
import { registerCreateSkill } from './create-skill.js';
|
|
12
|
+
import { registerReskill } from './reskill.js';
|
|
13
|
+
import { registerDecompose } from './decompose.js';
|
|
14
|
+
import { registerReverse } from './reverse.js';
|
|
15
|
+
import { registerOnboard } from './onboard.js';
|
|
16
|
+
import { registerUpdate } from './update.js';
|
|
17
|
+
import { registerMigrate } from './migrate.js';
|
|
18
|
+
import { registerApprove } from './approve.js';
|
|
19
|
+
import { registerReject } from './reject.js';
|
|
20
|
+
const TOOL_REGISTRY = [
|
|
21
|
+
['pantion_start', registerStart],
|
|
22
|
+
['pantion_check-convergence', registerCheckConvergence],
|
|
23
|
+
['pantion_save-canon', registerSaveCanon],
|
|
24
|
+
['pantion_translate', registerTranslate],
|
|
25
|
+
['pantion_check', registerCheck],
|
|
26
|
+
['pantion_amend', registerAmend],
|
|
27
|
+
['pantion_resume', registerResume],
|
|
28
|
+
['pantion_redialog', registerReconverge],
|
|
29
|
+
['pantion_list-canons', registerListCanons],
|
|
30
|
+
['pantion_create-skill', registerCreateSkill],
|
|
31
|
+
['pantion_reskill', registerReskill],
|
|
32
|
+
['pantion_decompose', registerDecompose],
|
|
33
|
+
['pantion_reverse', registerReverse],
|
|
34
|
+
['pantion_onboard', registerOnboard],
|
|
35
|
+
['pantion_update', registerUpdate],
|
|
36
|
+
['pantion_migrate', registerMigrate],
|
|
37
|
+
['pantion_approve', registerApprove],
|
|
38
|
+
['pantion_reject', registerReject],
|
|
39
|
+
];
|
|
40
|
+
export function registerTools(server, context) {
|
|
41
|
+
for (const [name, register] of TOOL_REGISTRY) {
|
|
42
|
+
if (isToolEnabled(name)) {
|
|
43
|
+
register(server, context);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAA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AU,aAAa,CAAC,MAAiB,EAAE,OAAsB;IACrE,KAAK,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,aAAa,EAAE,CAAC;QAC7C,IAAI,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC;YACxB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC5B,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-canons.d.ts","sourceRoot":"","sources":["../../src/tools/list-canons.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAIlD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,aAAa,GAAG,IAAI,CA4BlF"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { readCanonIndex } from '@pantion/core';
|
|
3
|
+
import { success, error } from '../utils/response.js';
|
|
4
|
+
export function registerListCanons(server, context) {
|
|
5
|
+
server.tool('pantion_list-canons', 'List all canons in a project. Scans the canon/ directory and returns metadata for each canon.', {
|
|
6
|
+
project_path: z.string().optional().describe('Project directory (defaults to server project path)'),
|
|
7
|
+
}, async ({ project_path }) => {
|
|
8
|
+
try {
|
|
9
|
+
const projectPath = project_path ?? context.projectPath;
|
|
10
|
+
const canons = readCanonIndex(projectPath);
|
|
11
|
+
return success({
|
|
12
|
+
canons: canons.map((c) => ({
|
|
13
|
+
name: c.name,
|
|
14
|
+
type: c.type,
|
|
15
|
+
status: c.status,
|
|
16
|
+
date: c.date,
|
|
17
|
+
has_summary: c.hasSummary,
|
|
18
|
+
open_questions: c.openQuestions,
|
|
19
|
+
human_stamp_status: c.humanStampStatus ?? 'PENDING',
|
|
20
|
+
})),
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
catch (err) {
|
|
24
|
+
return error(err instanceof Error ? err.message : String(err));
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=list-canons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-canons.js","sourceRoot":"","sources":["../../src/tools/list-canons.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAEtD,MAAM,UAAU,kBAAkB,CAAC,MAAiB,EAAE,OAAsB;IAC1E,MAAM,CAAC,IAAI,CACT,qBAAqB,EACrB,+FAA+F,EAC/F;QACE,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,qDAAqD,CAAC;KACpG,EACD,KAAK,EAAE,EAAE,YAAY,EAAE,EAAE,EAAE;QACzB,IAAI,CAAC;YACL,MAAM,WAAW,GAAG,YAAY,IAAI,OAAO,CAAC,WAAW,CAAC;YACxD,MAAM,MAAM,GAAG,cAAc,CAAC,WAAW,CAAC,CAAC;YAE3C,OAAO,OAAO,CAAC;gBACb,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;oBACzB,IAAI,EAAE,CAAC,CAAC,IAAI;oBACZ,IAAI,EAAE,CAAC,CAAC,IAAI;oBACZ,MAAM,EAAE,CAAC,CAAC,MAAM;oBAChB,IAAI,EAAE,CAAC,CAAC,IAAI;oBACZ,WAAW,EAAE,CAAC,CAAC,UAAU;oBACzB,cAAc,EAAE,CAAC,CAAC,aAAa;oBAC/B,kBAAkB,EAAE,CAAC,CAAC,gBAAgB,IAAI,SAAS;iBACpD,CAAC,CAAC;aACJ,CAAC,CAAC;QACH,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,KAAK,CAAC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;QACjE,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrate.d.ts","sourceRoot":"","sources":["../../src/tools/migrate.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAWlD,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,aAAa,GAAG,IAAI,CA0C/E"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { assembleSystemPrompt, readCanonIndex, createSession, saveSession, } from '@pantion/core';
|
|
3
|
+
import { success, error } from '../utils/response.js';
|
|
4
|
+
export function registerMigrate(server, context) {
|
|
5
|
+
server.tool('pantion_migrate', 'Migrate an existing project to the current protocol version. Detects version mismatches, evaluates canons for compatibility, and provides migration instructions.', {
|
|
6
|
+
project_path: z.string().optional().describe('Project directory (defaults to server project path)'),
|
|
7
|
+
}, async ({ project_path }) => {
|
|
8
|
+
try {
|
|
9
|
+
const projectPath = project_path ?? context.projectPath;
|
|
10
|
+
const canons = readCanonIndex(projectPath);
|
|
11
|
+
if (canons.length === 0) {
|
|
12
|
+
return error('No canons found in this project. Nothing to migrate.');
|
|
13
|
+
}
|
|
14
|
+
const convergenceInstructions = assembleSystemPrompt({
|
|
15
|
+
mode: 'migrate',
|
|
16
|
+
protocolDir: context.protocolDir,
|
|
17
|
+
});
|
|
18
|
+
const session = createSession(projectPath, `migrate-${Date.now()}`, convergenceInstructions);
|
|
19
|
+
saveSession(projectPath, session);
|
|
20
|
+
return success({
|
|
21
|
+
session_id: session.id,
|
|
22
|
+
canons: canons.map((c) => ({
|
|
23
|
+
name: c.name,
|
|
24
|
+
type: c.type,
|
|
25
|
+
status: c.status,
|
|
26
|
+
date: c.date,
|
|
27
|
+
open_questions: c.openQuestions,
|
|
28
|
+
})),
|
|
29
|
+
convergence_instructions: convergenceInstructions,
|
|
30
|
+
message: `Migration session started. Found ${canons.length} canon(s). Follow the migrate protocol: detect version mismatches, evaluate canons, perform 3-level migration.`,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
catch (err) {
|
|
34
|
+
return error(err instanceof Error ? err.message : String(err));
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=migrate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrate.js","sourceRoot":"","sources":["../../src/tools/migrate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EACL,oBAAoB,EAEpB,cAAc,EACd,aAAa,EACb,WAAW,GACZ,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAEtD,MAAM,UAAU,eAAe,CAAC,MAAiB,EAAE,OAAsB;IACvE,MAAM,CAAC,IAAI,CACT,iBAAiB,EACjB,mKAAmK,EACnK;QACE,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,qDAAqD,CAAC;KACpG,EACD,KAAK,EAAE,EAAE,YAAY,EAAE,EAAE,EAAE;QACzB,IAAI,CAAC;YACL,MAAM,WAAW,GAAG,YAAY,IAAI,OAAO,CAAC,WAAW,CAAC;YAExD,MAAM,MAAM,GAAG,cAAc,CAAC,WAAW,CAAC,CAAC;YAE3C,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACxB,OAAO,KAAK,CAAC,sDAAsD,CAAC,CAAC;YACvE,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aAAa,GAAG,IAAI,CA6B/E"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { assembleSystemPrompt, createSession, saveSession, } from '@pantion/core';
|
|
3
|
+
import { success, error } from '../utils/response.js';
|
|
4
|
+
export function registerOnboard(server, context) {
|
|
5
|
+
server.tool('pantion_onboard', 'Add Pantion to an existing project. Guides the user through three strategies: forward-only, full reverse, or partial canonization.', {
|
|
6
|
+
project_path: z.string().optional().describe('Project directory (defaults to server project path)'),
|
|
7
|
+
}, async ({ project_path }) => {
|
|
8
|
+
try {
|
|
9
|
+
const projectPath = project_path ?? context.projectPath;
|
|
10
|
+
const convergenceInstructions = assembleSystemPrompt({
|
|
11
|
+
mode: 'onboard',
|
|
12
|
+
protocolDir: context.protocolDir,
|
|
13
|
+
});
|
|
14
|
+
const session = createSession(projectPath, `onboard-${Date.now()}`, convergenceInstructions);
|
|
15
|
+
saveSession(projectPath, session);
|
|
16
|
+
return success({
|
|
17
|
+
session_id: session.id,
|
|
18
|
+
convergence_instructions: convergenceInstructions,
|
|
19
|
+
message: `Onboarding session started. Follow the onboard protocol: explore the project, present the three strategies (forward-only, full reverse, partial), and execute the chosen strategy.`,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
catch (err) {
|
|
23
|
+
return error(err instanceof Error ? err.message : String(err));
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=onboard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"onboard.js","sourceRoot":"","sources":["../../src/tools/onboard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EACL,oBAAoB,EACpB,aAAa,EACb,WAAW,GACZ,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAEtD,MAAM,UAAU,eAAe,C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