@wowok/agent-mcp 2.2.13 → 2.2.15

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 (126) hide show
  1. package/README.md +19 -11
  2. package/dist/index.js +44 -100
  3. package/dist/schema/query/index.js +1 -1
  4. package/dist/schema-query/index.d.ts +29 -0
  5. package/dist/schema-query/index.js +149 -0
  6. package/dist/schemas/account_operation.schema.json +255 -0
  7. package/dist/schemas/guard2file.schema.json +71 -0
  8. package/dist/schemas/index.json +139 -0
  9. package/dist/schemas/local_info_operation.schema.json +142 -0
  10. package/dist/schemas/local_mark_operation.schema.json +119 -0
  11. package/dist/schemas/machineNode2file.schema.json +71 -0
  12. package/dist/schemas/messenger_operation.schema.json +1393 -0
  13. package/dist/schemas/onchain_events.schema.json +113 -0
  14. package/dist/schemas/onchain_operations.schema.json +376 -0
  15. package/dist/schemas/onchain_operations_allocation.schema.json +914 -0
  16. package/dist/schemas/onchain_operations_arbitration.schema.json +1166 -0
  17. package/dist/schemas/onchain_operations_contact.schema.json +853 -0
  18. package/dist/schemas/onchain_operations_demand.schema.json +984 -0
  19. package/dist/schemas/onchain_operations_gen_passport.schema.json +1141 -0
  20. package/dist/schemas/onchain_operations_guard.schema.json +713 -0
  21. package/dist/schemas/onchain_operations_machine.schema.json +1347 -0
  22. package/dist/schemas/onchain_operations_order.schema.json +830 -0
  23. package/dist/schemas/onchain_operations_payment.schema.json +717 -0
  24. package/dist/schemas/onchain_operations_permission.schema.json +1088 -0
  25. package/dist/schemas/onchain_operations_personal.schema.json +1282 -0
  26. package/dist/schemas/onchain_operations_progress.schema.json +751 -0
  27. package/dist/schemas/onchain_operations_repository.schema.json +1572 -0
  28. package/dist/schemas/onchain_operations_reward.schema.json +955 -0
  29. package/dist/schemas/onchain_operations_service.schema.json +1411 -0
  30. package/dist/schemas/onchain_operations_treasury.schema.json +1155 -0
  31. package/dist/schemas/onchain_table_data.schema.json +35 -0
  32. package/dist/schemas/query_toolkit.schema.json +32 -0
  33. package/dist/schemas/schema_query.schema.json +33 -0
  34. package/dist/schemas/wip_file.schema.json +27 -0
  35. package/dist/schemas/wowok_buildin_info.schema.json +487 -0
  36. package/package.json +7 -5
  37. package/dist/docs/index.d.ts +0 -3
  38. package/dist/docs/index.js +0 -2
  39. package/dist/docs/loader.d.ts +0 -12
  40. package/dist/docs/loader.js +0 -177
  41. package/dist/docs/search.d.ts +0 -17
  42. package/dist/docs/search.js +0 -325
  43. package/dist/docs/types.d.ts +0 -55
  44. package/dist/docs/types.js +0 -1
  45. package/docs/README.md +0 -249
  46. package/docs/WIP.md +0 -388
  47. package/docs/WTS.md +0 -536
  48. package/docs/docs/account.md +0 -914
  49. package/docs/docs/allocation.md +0 -635
  50. package/docs/docs/arbitration.md +0 -1804
  51. package/docs/docs/arbitration_state_machine.md +0 -270
  52. package/docs/docs/contact.md +0 -709
  53. package/docs/docs/demand.md +0 -948
  54. package/docs/docs/guard.md +0 -1465
  55. package/docs/docs/localinfo.md +0 -432
  56. package/docs/docs/localmark.md +0 -583
  57. package/docs/docs/machine.md +0 -2490
  58. package/docs/docs/messenger.md +0 -2098
  59. package/docs/docs/onchain_events.md +0 -267
  60. package/docs/docs/order.md +0 -1001
  61. package/docs/docs/payment.md +0 -512
  62. package/docs/docs/permission.md +0 -1438
  63. package/docs/docs/personal.md +0 -742
  64. package/docs/docs/progress.md +0 -1748
  65. package/docs/docs/query.md +0 -467
  66. package/docs/docs/repository.md +0 -1043
  67. package/docs/docs/reward.md +0 -833
  68. package/docs/docs/service.md +0 -2130
  69. package/docs/docs/stage-01-introduction.md +0 -243
  70. package/docs/docs/stage-02-trust.md +0 -302
  71. package/docs/docs/stage-03-collaboration.md +0 -337
  72. package/docs/docs/stage-04-transaction.md +0 -277
  73. package/docs/docs/stage-05-business.md +0 -151
  74. package/docs/docs/stage-06-personal.md +0 -203
  75. package/docs/docs/stage-07-query.md +0 -572
  76. package/docs/docs/stage-08-examples.md +0 -184
  77. package/docs/docs/treasury.md +0 -1149
  78. package/docs/docs/wowok_buildin_info.md +0 -740
  79. package/docs/examples/Insurance/Insurance.md +0 -594
  80. package/docs/examples/Insurance/Insurance_TestResults.md +0 -481
  81. package/docs/examples/Insurance/insurance_complete_guard_v1.json +0 -50
  82. package/docs/examples/MyShop/MyShop.md +0 -1353
  83. package/docs/examples/MyShop/MyShop_TestResults.md +0 -1003
  84. package/docs/examples/MyShop_Advanced/MyShop_Advanced.md +0 -1898
  85. package/docs/examples/MyShop_Advanced/MyShop_Advanced_MerchantSystem_TestResults.md +0 -1297
  86. package/docs/examples/MyShop_Advanced/MyShop_Advanced_OrderFlow_TestResults.md +0 -743
  87. package/docs/examples/MyShop_Advanced/machine_nodes.json +0 -222
  88. package/docs/examples/ThreeBody_Signature/ThreeBody_Signature.md +0 -776
  89. package/docs/examples/ThreeBody_Signature/ThreeBody_Signature_TestResults.md +0 -599
  90. package/docs/examples/Travel/Travel.md +0 -1157
  91. package/docs/examples/Travel/Travel_TestResults.md +0 -743
  92. package/docs/examples/Travel/calc-weather-timestamps.js +0 -8
  93. package/docs/examples/Travel/travel_machine_v2_export.json +0 -104
  94. package/docs/examples/Travel/weather_check_guard_v1.json +0 -51
  95. package/docs/skills/WOWOK.md +0 -650
  96. package/docs/skills/onchain_operations/_common.md +0 -406
  97. package/docs/skills/onchain_operations/_index.md +0 -196
  98. package/docs/skills/onchain_operations/allocation.md +0 -28
  99. package/docs/skills/onchain_operations/arbitration.md +0 -106
  100. package/docs/skills/onchain_operations/contact.md +0 -40
  101. package/docs/skills/onchain_operations/demand.md +0 -53
  102. package/docs/skills/onchain_operations/gen_passport.md +0 -23
  103. package/docs/skills/onchain_operations/guard.md +0 -56
  104. package/docs/skills/onchain_operations/machine.md +0 -89
  105. package/docs/skills/onchain_operations/order.md +0 -56
  106. package/docs/skills/onchain_operations/payment.md +0 -24
  107. package/docs/skills/onchain_operations/permission.md +0 -68
  108. package/docs/skills/onchain_operations/personal.md +0 -58
  109. package/docs/skills/onchain_operations/progress.md +0 -38
  110. package/docs/skills/onchain_operations/repository.md +0 -70
  111. package/docs/skills/onchain_operations/reward.md +0 -38
  112. package/docs/skills/onchain_operations/service.md +0 -78
  113. package/docs/skills/onchain_operations/treasury.md +0 -68
  114. package/docs/skills/schema-account_operation.md +0 -402
  115. package/docs/skills/schema-guard2file.md +0 -153
  116. package/docs/skills/schema-local_info_operation.md +0 -160
  117. package/docs/skills/schema-local_mark_operation.md +0 -148
  118. package/docs/skills/schema-machineNode2file.md +0 -155
  119. package/docs/skills/schema-messenger_operation.md +0 -547
  120. package/docs/skills/schema-onchain_events.md +0 -201
  121. package/docs/skills/schema-onchain_table_data.md +0 -334
  122. package/docs/skills/schema-query_toolkit.md +0 -395
  123. package/docs/skills/schema-wip_file.md +0 -240
  124. package/docs/skills/schema-wowok_buildin_info.md +0 -296
  125. package/docs/wip-examples/three_body.html +0 -57
  126. package/docs/wip-examples/three_body.wip +0 -30
@@ -1,177 +0,0 @@
1
- import * as fs from "fs";
2
- import * as path from "path";
3
- import { fileURLToPath } from "url";
4
- const __filename = fileURLToPath(import.meta.url);
5
- const __dirname = path.dirname(__filename);
6
- const DOCS_PATHS = {
7
- skills: path.join(__dirname, "../../docs/skills"),
8
- examples: path.join(__dirname, "../../docs/examples"),
9
- };
10
- function getDocsPath(type) {
11
- return DOCS_PATHS[type];
12
- }
13
- function extractTitle(content, filename) {
14
- const h1Match = content.match(/^#\s+(.+)$/m);
15
- if (h1Match) {
16
- return h1Match[1].trim();
17
- }
18
- return filename.replace(/\.md$/, "").replace(/[_-]/g, " ");
19
- }
20
- function determineCategory(filePath, content) {
21
- const normalizedPath = filePath.toLowerCase();
22
- if (normalizedPath.includes("examples")) {
23
- return "example";
24
- }
25
- if (normalizedPath.includes("onchain_operations")) {
26
- return "operation-schema";
27
- }
28
- if (normalizedPath.match(/schema-.*\.md$/)) {
29
- return "tool-schema";
30
- }
31
- if (normalizedPath.includes("_common.md") || normalizedPath.includes("_index.md")) {
32
- return "common";
33
- }
34
- if (normalizedPath.includes("wowok.md")) {
35
- return "skill-overview";
36
- }
37
- return "common";
38
- }
39
- function extractTags(content) {
40
- const tags = [];
41
- const keywordsMatch = content.match(/keywords?:\s*([^\n]+)/i);
42
- if (keywordsMatch) {
43
- const keywords = keywordsMatch[1]
44
- .split(/[,;]/)
45
- .map((k) => k.trim().toLowerCase())
46
- .filter((k) => k.length > 0);
47
- tags.push(...keywords);
48
- }
49
- const operationTypes = [
50
- "service", "machine", "progress", "repository", "arbitration",
51
- "contact", "treasury", "reward", "allocation", "permission",
52
- "guard", "personal", "payment", "demand", "order", "gen_passport"
53
- ];
54
- for (const op of operationTypes) {
55
- const regex = new RegExp(`\\b${op}\\b`, "i");
56
- if (regex.test(content)) {
57
- tags.push(op);
58
- }
59
- }
60
- return [...new Set(tags)];
61
- }
62
- function loadDocument(filePath, basePath) {
63
- try {
64
- const content = fs.readFileSync(filePath, "utf-8");
65
- const relativePath = path.relative(basePath, filePath);
66
- const filename = path.basename(filePath);
67
- const stats = fs.statSync(filePath);
68
- return {
69
- id: relativePath.replace(/\\/g, "/"),
70
- path: filePath,
71
- title: extractTitle(content, filename),
72
- content,
73
- category: determineCategory(filePath, content),
74
- tags: extractTags(content),
75
- lastModified: stats.mtimeMs,
76
- };
77
- }
78
- catch (error) {
79
- console.error(`Failed to load document: ${filePath}`, error);
80
- return null;
81
- }
82
- }
83
- function findMarkdownFiles(dir) {
84
- const files = [];
85
- try {
86
- const entries = fs.readdirSync(dir, { withFileTypes: true });
87
- for (const entry of entries) {
88
- const fullPath = path.join(dir, entry.name);
89
- if (entry.isDirectory()) {
90
- files.push(...findMarkdownFiles(fullPath));
91
- }
92
- else if (entry.name.endsWith(".md")) {
93
- files.push(fullPath);
94
- }
95
- }
96
- }
97
- catch (error) {
98
- console.warn(`Cannot read directory: ${dir}`);
99
- }
100
- return files;
101
- }
102
- function loadSkillsDocs() {
103
- const skillsPath = getDocsPath("skills");
104
- const files = findMarkdownFiles(skillsPath);
105
- return files
106
- .map((file) => loadDocument(file, skillsPath))
107
- .filter((doc) => doc !== null);
108
- }
109
- function loadExamplesDocs() {
110
- const examplesPath = getDocsPath("examples");
111
- const files = findMarkdownFiles(examplesPath);
112
- return files
113
- .map((file) => loadDocument(file, examplesPath))
114
- .filter((doc) => doc !== null);
115
- }
116
- function buildIndex(documents) {
117
- const index = {
118
- operations: new Map(),
119
- tools: new Map(),
120
- examples: new Map(),
121
- guides: new Map(),
122
- all: documents,
123
- };
124
- for (const doc of documents) {
125
- if (doc.category === "operation-schema") {
126
- const operationMatch = doc.id.match(/onchain_operations\/(.+)\.md$/);
127
- if (operationMatch && !operationMatch[1].startsWith("_")) {
128
- index.operations.set(operationMatch[1], doc);
129
- }
130
- }
131
- if (doc.category === "tool-schema") {
132
- const toolMatch = doc.id.match(/schema-(.+)\.md$/);
133
- if (toolMatch) {
134
- index.tools.set(toolMatch[1], doc);
135
- }
136
- }
137
- if (doc.category === "example") {
138
- const exampleMatch = doc.id.match(/^([^/]+)\//);
139
- if (exampleMatch) {
140
- const exampleName = exampleMatch[1];
141
- if (!index.examples.has(exampleName)) {
142
- index.examples.set(exampleName, []);
143
- }
144
- index.examples.get(exampleName).push(doc);
145
- }
146
- }
147
- if (doc.category === "common" || doc.category === "skill-overview") {
148
- const guideKey = doc.id.replace(/\.md$/, "");
149
- index.guides.set(guideKey, doc);
150
- }
151
- }
152
- return index;
153
- }
154
- export function loadAllDocuments() {
155
- const skillsDocs = loadSkillsDocs();
156
- const examplesDocs = loadExamplesDocs();
157
- const allDocs = [...skillsDocs, ...examplesDocs];
158
- const index = buildIndex(allDocs);
159
- return { documents: allDocs, index };
160
- }
161
- export function isDocumentationAvailable() {
162
- const skillsPath = getDocsPath("skills");
163
- const examplesPath = getDocsPath("examples");
164
- return fs.existsSync(skillsPath) && fs.existsSync(examplesPath);
165
- }
166
- export function getDocStats() {
167
- const skillsPath = getDocsPath("skills");
168
- const examplesPath = getDocsPath("examples");
169
- const skillsFiles = fs.existsSync(skillsPath) ? findMarkdownFiles(skillsPath).length : 0;
170
- const examplesFiles = fs.existsSync(examplesPath) ? findMarkdownFiles(examplesPath).length : 0;
171
- return {
172
- total: skillsFiles + examplesFiles,
173
- skills: skillsFiles,
174
- examples: examplesFiles,
175
- available: fs.existsSync(skillsPath) && fs.existsSync(examplesPath),
176
- };
177
- }
@@ -1,17 +0,0 @@
1
- import type { Document, DocumentIndex, SearchResult, SchemaInfo, ExampleInfo, LearnRequest, LearnResponse } from "./types.js";
2
- export declare function searchDocuments(index: DocumentIndex, query: string, limit?: number): SearchResult[];
3
- export declare function getOperationSchema(index: DocumentIndex, operationType: string): SchemaInfo | null;
4
- export declare function getToolSchema(index: DocumentIndex, toolName: string): SchemaInfo | null;
5
- export declare function getExampleInfo(index: DocumentIndex, exampleName: string): ExampleInfo | null;
6
- export declare function getGuide(index: DocumentIndex, topic: string): Document | null;
7
- export declare function listOperations(index: DocumentIndex): Array<{
8
- name: string;
9
- title: string;
10
- description: string;
11
- }>;
12
- export declare function listExamples(index: DocumentIndex): Array<{
13
- name: string;
14
- title: string;
15
- docCount: number;
16
- }>;
17
- export declare function processLearnRequest(index: DocumentIndex, request: LearnRequest): LearnResponse;
@@ -1,325 +0,0 @@
1
- function calculateScore(document, query) {
2
- const lowerQuery = query.toLowerCase();
3
- const lowerTitle = document.title.toLowerCase();
4
- const lowerContent = document.content.toLowerCase();
5
- const lowerTags = document.tags.map((t) => t.toLowerCase());
6
- let score = 0;
7
- if (lowerTitle === lowerQuery) {
8
- score += 100;
9
- }
10
- else if (lowerTitle.includes(lowerQuery)) {
11
- score += 50;
12
- }
13
- if (lowerTags.some((tag) => tag === lowerQuery)) {
14
- score += 40;
15
- }
16
- if (lowerTags.some((tag) => tag.includes(lowerQuery))) {
17
- score += 20;
18
- }
19
- const contentMatches = (lowerContent.match(new RegExp(lowerQuery, "g")) || []).length;
20
- score += Math.min(contentMatches * 5, 30);
21
- if (document.category === "operation-schema" && lowerQuery.match(/^(service|guard|machine|order)$/)) {
22
- score += 10;
23
- }
24
- return score;
25
- }
26
- function extractSnippets(content, query, maxSnippets = 3) {
27
- const lowerContent = content.toLowerCase();
28
- const lowerQuery = query.toLowerCase();
29
- const snippets = [];
30
- const sentences = content.split(/[.!?\n]+/);
31
- for (const sentence of sentences) {
32
- if (sentence.toLowerCase().includes(lowerQuery) && sentence.trim().length > 20) {
33
- snippets.push(sentence.trim());
34
- if (snippets.length >= maxSnippets)
35
- break;
36
- }
37
- }
38
- return snippets;
39
- }
40
- export function searchDocuments(index, query, limit = 5) {
41
- const results = [];
42
- for (const doc of index.all) {
43
- const score = calculateScore(doc, query);
44
- if (score > 0) {
45
- results.push({
46
- document: doc,
47
- score,
48
- matches: extractSnippets(doc.content, query),
49
- });
50
- }
51
- }
52
- results.sort((a, b) => b.score - a.score);
53
- return results.slice(0, limit);
54
- }
55
- export function getOperationSchema(index, operationType) {
56
- const doc = index.operations.get(operationType.toLowerCase());
57
- if (!doc)
58
- return null;
59
- const descMatch = doc.content.match(/>\s*([^\n]+)/);
60
- const description = descMatch ? descMatch[1].trim() : "";
61
- const schemaMatch = doc.content.match(/##\s*Data Schema\s*([\s\S]*?)(?=##|$)/);
62
- const dataSchema = schemaMatch ? schemaMatch[1].trim() : undefined;
63
- const relatedOps = [];
64
- for (const [opName] of index.operations) {
65
- if (opName !== operationType && doc.content.toLowerCase().includes(opName.toLowerCase())) {
66
- relatedOps.push(opName);
67
- }
68
- }
69
- return {
70
- operationType,
71
- title: doc.title,
72
- description,
73
- dataSchema,
74
- relatedOperations: relatedOps.slice(0, 5),
75
- };
76
- }
77
- export function getToolSchema(index, toolName) {
78
- const doc = index.tools.get(toolName.toLowerCase());
79
- if (!doc)
80
- return null;
81
- const descMatch = doc.content.match(/>\s*([^\n]+)/);
82
- const description = descMatch ? descMatch[1].trim() : "";
83
- return {
84
- toolName,
85
- title: doc.title,
86
- description,
87
- };
88
- }
89
- export function getExampleInfo(index, exampleName) {
90
- const docs = index.examples.get(exampleName);
91
- if (!docs || docs.length === 0)
92
- return null;
93
- const mainDoc = docs.find((d) => d.id.toLowerCase().includes(".md") && !d.id.toLowerCase().includes("test")) || docs[0];
94
- const descMatch = mainDoc.content.match(/##\s*Overview\s*([\s\S]*?)(?=##|$)/);
95
- const description = descMatch
96
- ? descMatch[1].trim().slice(0, 200) + "..."
97
- : mainDoc.content.slice(0, 200) + "...";
98
- const testResults = docs.find((d) => d.id.toLowerCase().includes("testresult"));
99
- return {
100
- name: exampleName,
101
- title: mainDoc.title,
102
- description,
103
- documents: docs,
104
- testResults,
105
- };
106
- }
107
- export function getGuide(index, topic) {
108
- let doc = index.guides.get(topic.toLowerCase());
109
- if (doc)
110
- return doc;
111
- const prefixes = ["", "_", "onchain_operations/", "schema-"];
112
- for (const prefix of prefixes) {
113
- doc = index.guides.get(`${prefix}${topic.toLowerCase()}`);
114
- if (doc)
115
- return doc;
116
- }
117
- for (const [key, value] of index.guides) {
118
- if (key.includes(topic.toLowerCase())) {
119
- return value;
120
- }
121
- }
122
- return null;
123
- }
124
- export function listOperations(index) {
125
- const operations = [];
126
- for (const [name, doc] of index.operations) {
127
- const descMatch = doc.content.match(/>\s*([^\n]+)/);
128
- const description = descMatch ? descMatch[1].trim() : "";
129
- operations.push({
130
- name,
131
- title: doc.title,
132
- description,
133
- });
134
- }
135
- return operations.sort((a, b) => a.name.localeCompare(b.name));
136
- }
137
- export function listExamples(index) {
138
- const examples = [];
139
- for (const [name, docs] of index.examples) {
140
- const mainDoc = docs.find((d) => !d.id.toLowerCase().includes("test")) || docs[0];
141
- examples.push({
142
- name,
143
- title: mainDoc.title,
144
- docCount: docs.length,
145
- });
146
- }
147
- return examples.sort((a, b) => a.name.localeCompare(b.name));
148
- }
149
- export function processLearnRequest(index, request) {
150
- switch (request.action) {
151
- case "search": {
152
- if (!request.query) {
153
- return {
154
- success: false,
155
- action: "search",
156
- data: null,
157
- message: "Search query is required",
158
- };
159
- }
160
- const results = searchDocuments(index, request.query);
161
- if (results.length === 0) {
162
- return {
163
- success: true,
164
- action: "search",
165
- data: [],
166
- message: `No documents found for "${request.query}"`,
167
- suggestions: ["Try a different keyword", "Use 'list_operations' to see available operations", "Use 'list_examples' to see available examples"],
168
- };
169
- }
170
- return {
171
- success: true,
172
- action: "search",
173
- data: results.map((r) => ({
174
- title: r.document.title,
175
- category: r.document.category,
176
- path: r.document.id,
177
- score: r.score,
178
- snippets: r.matches,
179
- })),
180
- message: `Found ${results.length} document(s) for "${request.query}"`,
181
- };
182
- }
183
- case "get_schema": {
184
- const opType = request.operationType || request.topic;
185
- const toolName = request.toolName;
186
- if (opType) {
187
- const schema = getOperationSchema(index, opType);
188
- if (!schema) {
189
- return {
190
- success: false,
191
- action: "get_schema",
192
- data: null,
193
- message: `Operation schema not found: ${opType}`,
194
- suggestions: Array.from(index.operations.keys()).slice(0, 5),
195
- };
196
- }
197
- return {
198
- success: true,
199
- action: "get_schema",
200
- data: schema,
201
- message: `Schema for operation: ${opType}`,
202
- };
203
- }
204
- if (toolName) {
205
- const schema = getToolSchema(index, toolName);
206
- if (!schema) {
207
- return {
208
- success: false,
209
- action: "get_schema",
210
- data: null,
211
- message: `Tool schema not found: ${toolName}`,
212
- suggestions: Array.from(index.tools.keys()).slice(0, 5),
213
- };
214
- }
215
- return {
216
- success: true,
217
- action: "get_schema",
218
- data: schema,
219
- message: `Schema for tool: ${toolName}`,
220
- };
221
- }
222
- return {
223
- success: false,
224
- action: "get_schema",
225
- data: null,
226
- message: "operationType or toolName is required",
227
- };
228
- }
229
- case "learn_example": {
230
- const exampleName = request.example || request.topic;
231
- if (!exampleName) {
232
- return {
233
- success: false,
234
- action: "learn_example",
235
- data: null,
236
- message: "Example name is required",
237
- };
238
- }
239
- const info = getExampleInfo(index, exampleName);
240
- if (!info) {
241
- const available = listExamples(index);
242
- return {
243
- success: false,
244
- action: "learn_example",
245
- data: null,
246
- message: `Example not found: ${exampleName}`,
247
- suggestions: available.map((e) => e.name),
248
- };
249
- }
250
- return {
251
- success: true,
252
- action: "learn_example",
253
- data: {
254
- name: info.name,
255
- title: info.title,
256
- description: info.description,
257
- documents: info.documents.map((d) => ({
258
- title: d.title,
259
- path: d.id,
260
- category: d.category,
261
- })),
262
- hasTestResults: !!info.testResults,
263
- },
264
- message: `Example: ${info.title}`,
265
- };
266
- }
267
- case "guide": {
268
- const topic = request.topic || request.query;
269
- if (!topic) {
270
- return {
271
- success: false,
272
- action: "guide",
273
- data: null,
274
- message: "Topic is required",
275
- };
276
- }
277
- const doc = getGuide(index, topic);
278
- if (!doc) {
279
- return {
280
- success: false,
281
- action: "guide",
282
- data: null,
283
- message: `Guide not found: ${topic}`,
284
- suggestions: ["Try 'WOWOK' for overview", "Try '_index' for operations index", "Use 'search' to find relevant content"],
285
- };
286
- }
287
- return {
288
- success: true,
289
- action: "guide",
290
- data: {
291
- title: doc.title,
292
- category: doc.category,
293
- content: doc.content,
294
- tags: doc.tags,
295
- },
296
- message: `Guide: ${doc.title}`,
297
- };
298
- }
299
- case "list_operations": {
300
- const operations = listOperations(index);
301
- return {
302
- success: true,
303
- action: "list_operations",
304
- data: operations,
305
- message: `Available operations: ${operations.length}`,
306
- };
307
- }
308
- case "list_examples": {
309
- const examples = listExamples(index);
310
- return {
311
- success: true,
312
- action: "list_examples",
313
- data: examples,
314
- message: `Available examples: ${examples.length}`,
315
- };
316
- }
317
- default:
318
- return {
319
- success: false,
320
- action: request.action,
321
- data: null,
322
- message: `Unknown action: ${request.action}`,
323
- };
324
- }
325
- }
@@ -1,55 +0,0 @@
1
- export interface Document {
2
- id: string;
3
- path: string;
4
- title: string;
5
- content: string;
6
- category: DocumentCategory;
7
- tags: string[];
8
- lastModified: number;
9
- }
10
- export type DocumentCategory = "skill-overview" | "operation-schema" | "tool-schema" | "example" | "common";
11
- export interface DocumentIndex {
12
- operations: Map<string, Document>;
13
- tools: Map<string, Document>;
14
- examples: Map<string, Document[]>;
15
- guides: Map<string, Document>;
16
- all: Document[];
17
- }
18
- export interface SearchResult {
19
- document: Document;
20
- score: number;
21
- matches: string[];
22
- }
23
- export interface SchemaInfo {
24
- operationType?: string;
25
- toolName?: string;
26
- title: string;
27
- description: string;
28
- dataSchema?: string;
29
- examples?: string[];
30
- relatedOperations?: string[];
31
- }
32
- export interface ExampleInfo {
33
- name: string;
34
- title: string;
35
- description: string;
36
- documents: Document[];
37
- testResults?: Document;
38
- }
39
- export type LearnAction = "search" | "get_schema" | "learn_example" | "guide" | "list_operations" | "list_examples";
40
- export interface LearnRequest {
41
- action: LearnAction;
42
- topic?: string;
43
- query?: string;
44
- example?: string;
45
- operationType?: string;
46
- toolName?: string;
47
- }
48
- export interface LearnResponse {
49
- [key: string]: unknown;
50
- success: boolean;
51
- action: LearnAction;
52
- data: unknown;
53
- message: string;
54
- suggestions?: string[];
55
- }
@@ -1 +0,0 @@
1
- export {};