@gotza02/seq-thinking 1.1.22 → 1.1.24

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 (38) hide show
  1. package/README.md +234 -89
  2. package/SYSTEM_INSTRUCTIONS.md +35 -35
  3. package/dist/__tests__/agents/base-agent.js +215 -0
  4. package/dist/__tests__/agents/specialist-agent.js +75 -0
  5. package/dist/__tests__/specialist-agent.test.js +653 -30
  6. package/dist/__tests__/types/index.js +278 -0
  7. package/dist/__tests__/utils/llm-adapter.js +93 -0
  8. package/dist/__tests__/utils/logger.js +48 -0
  9. package/dist/constants.d.ts +69 -0
  10. package/dist/constants.d.ts.map +1 -0
  11. package/dist/constants.js +96 -0
  12. package/dist/constants.js.map +1 -0
  13. package/dist/index.d.ts +2 -0
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +2 -0
  16. package/dist/index.js.map +1 -1
  17. package/dist/mcp-server.js +1 -1
  18. package/dist/utils/llm-adapter.d.ts +4 -4
  19. package/dist/utils/llm-adapter.d.ts.map +1 -1
  20. package/dist/utils/llm-adapter.js +25 -23
  21. package/dist/utils/llm-adapter.js.map +1 -1
  22. package/dist/utils/persistence.d.ts +17 -0
  23. package/dist/utils/persistence.d.ts.map +1 -1
  24. package/dist/utils/persistence.js +60 -5
  25. package/dist/utils/persistence.js.map +1 -1
  26. package/dist/validation/index.d.ts +6 -0
  27. package/dist/validation/index.d.ts.map +1 -0
  28. package/dist/validation/index.js +6 -0
  29. package/dist/validation/index.js.map +1 -0
  30. package/dist/validation/schemas.d.ts +793 -0
  31. package/dist/validation/schemas.d.ts.map +1 -0
  32. package/dist/validation/schemas.js +340 -0
  33. package/dist/validation/schemas.js.map +1 -0
  34. package/dist/validation/schemas.test.d.ts +6 -0
  35. package/dist/validation/schemas.test.d.ts.map +1 -0
  36. package/dist/validation/schemas.test.js +171 -0
  37. package/dist/validation/schemas.test.js.map +1 -0
  38. package/package.json +7 -6
package/README.md CHANGED
@@ -1,42 +1,43 @@
1
1
  # MCP Sequential Thinking with Swarm Coordination
2
2
 
3
- [![Version](https://img.shields.io/badge/version-1.1.22-blue.svg)](https://www.npmjs.com/package/@gotza02/seq-thinking)
3
+ [![Version](https://img.shields.io/badge/version-1.1.24-blue.svg)](https://www.npmjs.com/package/@gotza02/seq-thinking)
4
4
  [![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
5
5
  [![Node.js](https://img.shields.io/badge/node-%3E%3D18.0.0-brightgreen.svg)](https://nodejs.org/)
6
6
 
7
- **Advanced Sequential Thinking MCP Server** with integrated Swarm Intelligence. This tool empowers your AI environment with structured reasoning, self-correction, and a coordinated team of specialized agents, leveraging your existing local LLM CLI tools.
7
+ **Advanced Sequential Thinking MCP Server** ที่มาพร้อมกับ Swarm Intelligence แบบบูรณาการ เครื่องมือนี้ช่วยเพิ่มประสิทธิภาพให้กับสภาพแวดล้อม AI ของคุณด้วยการให้เหตุผลแบบมีโครงสร้าง การแก้ไขตนเอง และทีมเอเจนต์เฉพาะทางที่ประสานงานกัน โดยใช้ประโยชน์จากเครื่องมือ CLI ของ LLM ในเครื่องที่มีอยู่แล้ว
8
8
 
9
- ## 🚀 Key Features
9
+ ## 🚀 คุณสมบัติหลัก
10
10
 
11
- * **🧠 Advanced Sequential Thinking**: Supports branching, merging, and pruning of thought paths.
12
- * **🤖 Swarm Intelligence**: Coordinates specialized agents (**Reasoner**, **Critic**, **Synthesizer**, **Meta-Reasoner**, **Specialist**) with Mutex-based concurrency control to prevent race conditions.
13
- * **🔌 BYO-LLM (Bring Your Own LLM)**: Connects directly to **Gemini**, **Claude**, **Kimi**, and **OpenCode** via their CLI tools—no extra API keys required if you're already logged in.
14
- * **🔄 Auto-Fallback & Robustness**: Automatically switches providers if one fails (e.g., `gemini` -> `claude`). Includes retry logic for resilient task execution.
15
- * **💾 Persistence & Recovery**: Automatically saves sessions, agent states, and tasks to disk. Includes a Recovery System that restores interrupted tasks to a pending state on restart.
16
- * **🔍 Self-Correction**: Proactively detects logical fallacies and confidence dips, triggering corrective actions.
11
+ * **🧠 Advanced Sequential Thinking**: รองรับการแตกกิ่ง การรวมกัน และการตัดแต่งเส้นทางการคิด
12
+ * **🤖 Swarm Intelligence**: ประสานงานเอเจนต์เฉพาะทาง (**Reasoner**, **Critic**, **Synthesizer**, **Meta-Reasoner**, **Specialist**) พร้อมการควบคุมการทำงานพร้อมกันแบบ Mutex เพื่อป้องกันปัญหา race condition
13
+ * **🔌 BYO-LLM (Bring Your Own LLM)**: เชื่อมต่อโดยตรงกับ **Gemini**, **Claude**, **Kimi**, และ **OpenCode** ผ่าน CLI tools ของพวกเขา—ไม่ต้องใช้ API keys เพิ่มเติมหากคุณล็อกอินอยู่แล้ว
14
+ * **🔄 Auto-Fallback และความทนทาน**: สลับผู้ให้บริการอัตโนมัติหากผู้ใดผู้หนึ่งล้มเหลว (เช่น `gemini` -> `claude`) รวมถึงลอจิกการ retry สำหรับการดำเนินการงานที่ยืดหยุ่น
15
+ * **💾 การเก็บข้อมูลและการกู้คืน**: บันทึกเซสชัน สถานะเอเจนต์ และงานไปยังดิสก์อัตโนมัติ รวมถึงระบบกู้คืนที่คืนค่างานที่ถูกขัดจังหวะให้กลับสู่สถานะ pending เมื่อรีสตาร์ท
16
+ * **🔍 การแก้ไขตนเอง**: ตรวจจับ logical fallacies และการลดลงของความมั่นใจแบบ proactive พร้อมกระตุ้นการดำเนินการแก้ไข
17
+ * **🛡️ Security-First**: ป้องกัน Shell Injection และ Path Traversal ด้วยการใช้ execFile และ Zod validation
17
18
 
18
- ## 📦 Quick Start (NPX)
19
+ ## 📦 เริ่มต้นใช้งานอย่างรวดเร็ว (NPX)
19
20
 
20
- You can run this MCP server directly using `npx` without cloning the repository. This is the recommended method.
21
+ คุณสามารถรัน MCP server นี้ได้โดยตรงโดยใช้ `npx` โดยไม่ต้อง clone repository วิธีนี้เป็นวิธีที่แนะนำ
21
22
 
22
- **Prerequisites:** Node.js v18 or higher.
23
+ **ข้อกำหนดเบื้องต้น:** Node.js v18 หรือสูงกว่า
23
24
 
24
25
  ```bash
25
- npx -y @gotza02/seq-thinking
26
+ npx -y @gotza02/seq-thinking@latest
26
27
  ```
27
28
 
28
- ## ⚙️ MCP Configuration
29
+ ## ⚙️ การตั้งค่า MCP
29
30
 
30
- To use this tool with MCP clients (like **Claude Desktop**, **Cline**, or **Cursor**), add the following configuration to your settings file.
31
+ หากต้องการใช้เครื่องมือนี้กับ MCP clients (เช่น **Claude Desktop**, **Cline**, หรือ **Cursor**) ให้เพิ่มการตั้งค่าต่อไปนี้ลงในไฟล์ settings ของคุณ
31
32
 
32
- **For Claude Desktop** (`~/Library/Application Support/Claude/claude_desktop_config.json` on macOS, or `%APPDATA%\Claude\claude_desktop_config.json` on Windows):
33
+ **สำหรับ Claude Desktop** (`~/Library/Application Support/Claude/claude_desktop_config.json` บน macOS หรือ `%APPDATA%\Claude\claude_desktop_config.json` บน Windows):
33
34
 
34
35
  ```json
35
36
  {
36
37
  "mcpServers": {
37
38
  "advanced-thinking": {
38
39
  "command": "npx",
39
- "args": ["-y", "@gotza02/seq-thinking"],
40
+ "args": ["-y", "@gotza02/seq-thinking@latest"],
40
41
  "env": {
41
42
  "provider": "gemini,claude",
42
43
  "MOCK_LLM": "false",
@@ -48,141 +49,285 @@ To use this tool with MCP clients (like **Claude Desktop**, **Cline**, or **Curs
48
49
  }
49
50
  ```
50
51
 
51
- ### Environment Variables
52
+ **สำหรับ Cline** (`~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json`):
52
53
 
53
- | Variable | Description | Default | Example |
54
+ ```json
55
+ {
56
+ "mcpServers": {
57
+ "advanced-thinking": {
58
+ "command": "npx",
59
+ "args": ["-y", "@gotza02/seq-thinking@latest"],
60
+ "env": {
61
+ "provider": "gemini,claude,kimi",
62
+ "MOCK_LLM": "false",
63
+ "LOG_LEVEL": "INFO",
64
+ "MCP_DATA_DIR": "./data"
65
+ },
66
+ "disabled": false,
67
+ "autoApprove": []
68
+ }
69
+ }
70
+ }
71
+ ```
72
+
73
+ ### ตัวแปรสภาพแวดล้อม (Environment Variables)
74
+
75
+ | ตัวแปร | คำอธิบาย | ค่าเริ่มต้น | ตัวอย่าง |
54
76
  |----------|-------------|---------|---------|
55
- | `provider` | Comma-separated list of LLM CLIs to use. The system tries them in order. | `gemini` | `gemini,claude,kimi` |
56
- | `MOCK_LLM` | If `true`, returns mock responses (for testing without API costs). | `false` | `true` |
57
- | `LOG_LEVEL` | Logging verbosity (`DEBUG`, `INFO`, `WARN`, `ERROR`). | `INFO` | `DEBUG` |
58
- | `MCP_DATA_DIR` | Custom directory for session/agent persistence. | `./data` | `/home/user/mcp-data` |
59
- | `TMPDIR` | If `MCP_DATA_DIR` is not set, data will be stored in `$TMPDIR/data`. | `./` | `/tmp` |
77
+ | `provider` | รายการ LLM CLIs ที่คั่นด้วยจุลภาค ระบบจะลองใช้ตามลำดับ | `gemini` | `gemini,claude,kimi` |
78
+ | `MOCK_LLM` | หากเป็น `true` จะคืนค่า mock responses (สำหรับการทดสอบโดยไม่มีค่าใช้จ่าย API) | `false` | `true` |
79
+ | `LOG_LEVEL` | ระดับความละเอียดของการบันทึก (`DEBUG`, `INFO`, `WARN`, `ERROR`) | `INFO` | `DEBUG` |
80
+ | `MCP_DATA_DIR` | ไดเรกทอรีที่กำหนดเองสำหรับการเก็บข้อมูลเซสชัน/เอเจนต์ | `./data` | `/home/user/mcp-data` |
81
+ | `TMPDIR` | หากไม่ได้ตั้งค่า `MCP_DATA_DIR` ข้อมูลจะถูกเก็บใน `$TMPDIR/data` | `./` | `/tmp` |
60
82
 
61
- **Supported CLI Tools:**
62
- * **Gemini:** Requires `gemini` CLI installed and authenticated.
63
- * **Claude:** Requires `claude` (Claude Code) CLI installed and authenticated.
64
- * **Kimi:** Requires `kimi` (Kimi Code CLI) installed and authenticated.
65
- * **OpenCode:** Requires `opencode` CLI.
83
+ **เครื่องมือ CLI ที่รองรับ:**
84
+ * **Gemini:** ต้องติดตั้ง `gemini` CLI และยืนยันตัวตนแล้ว
85
+ * **Claude:** ต้องติดตั้ง `claude` (Claude Code) CLI และยืนยันตัวตนแล้ว
86
+ * **Kimi:** ต้องติดตั้ง `kimi` (Kimi Code CLI) และยืนยันตัวตนแล้ว
87
+ * **OpenCode:** ต้องติดตั้ง `opencode` CLI
66
88
 
67
- ## 🛠️ Usage
89
+ ## 🛠️ การใช้งาน
68
90
 
69
- This server provides two main tools to your AI client:
91
+ เซิร์ฟเวอร์นี้ให้บริการเครื่องมือหลัก 2 อย่างแก่ AI client ของคุณ:
70
92
 
71
93
  ### 1. `advanced_sequential_thinking`
72
- The core thinking engine.
73
- * **Operations:** `initialize`, `add_thought`, `branch_thought`, `self_correct`, `complete_session`, etc.
74
- * **Use Case:** Deep, step-by-step problem solving with ability to backtrack.
94
+ เครื่องยนต์การคิดหลัก
95
+
96
+ **Operations:**
97
+ | Operation | คำอธิบาย |
98
+ |-----------|---------|
99
+ | `initialize` | สร้างเซสชันการคิดใหม่ |
100
+ | `add_thought` | เพิ่มความคิดลงในเซสชัน |
101
+ | `branch_thought` | สร้างกิ่งการคิดใหม่ (parallel hypothesis) |
102
+ | `merge_branches` | รวมกิ่งกลับเข้าด้วยกัน |
103
+ | `prune_branch` | ตัดกิ่งที่ไม่จำเป็น |
104
+ | `revise_thought` | แก้ไขความคิดเดิม |
105
+ | `self_correct` | ตรวจสอบและแก้ไข logical fallacies |
106
+ | `add_meta_thought` | เพิ่มความคิดเชิงเมตา |
107
+ | `delegate_to_swarm` | มอบหมายให้ Swarm Agents ประมวลผล |
108
+ | `complete_session` | ปิดเซสชัน |
109
+
110
+ **กรณีใช้งาน:** การแก้ปัญหาเชิงลึกแบบเป็นขั้นตอนพร้อมความสามารถในการย้อนกลับ
75
111
 
76
112
  ### 2. `swarm_agent_coordination`
77
- The workforce manager.
78
- * **Operations:** `register_agent`, `assign_task`, `reach_consensus`, `resolve_conflict`.
79
- * **Use Case:** Delegating sub-tasks to specialized "virtual experts" (e.g., asking a "Critic" agent to review a plan).
113
+ ผู้จัดการทีมงาน Swarm Agents
114
+
115
+ **Agent Types:**
116
+ | Type | บทบาท | ความสามารถ |
117
+ |------|-------|-----------|
118
+ | **Reasoner** | ให้เหตุผล | Chain of Thought, Tree of Thought, Analogical, Abductive |
119
+ | **Critic** | ตรวจสอบ | Logical, Factual, Bias, Safety |
120
+ | **Synthesizer** | สังเคราะห์ | Consensus, Creative, Conflict Resolution |
121
+ | **Meta-Reasoning** | คิดเชิงเมตา | วิเคราะห์กระบวนการคิด |
122
+ | **Specialist** | ผู้เชี่ยวชาญ | ตาม capabilities ที่กำหนด |
123
+ | **Utility** | ทั่วไป | งานทั่วไปที่ไม่ต้องการความเชี่ยวชาญพิเศษ |
124
+
125
+ **Operations:**
126
+ - `register_agent` - ลงทะเบียน agent ใหม่
127
+ - `assign_task` - มอบหมายงานให้ agent
128
+ - `reach_consensus` - ให้ agents ลงมติร่วมกัน
129
+ - `identify_conflict` - ระบุความขัดแย้ง
130
+ - `resolve_conflict` - แก้ไขความขัดแย้ง
131
+ - `broadcast_message` - ส่งข้อความ broadcast
132
+ - `send_direct_message` - ส่งข้อความโดยตรง
133
+ - `get_swarm_stats` - ดูสถิติ swarm
134
+
135
+ **กรณีใช้งาน:** มอบหมายงานย่อยให้กับ "ผู้เชี่ยวชาญเสมือน" เฉพาะทาง (เช่น ขอให้เอเจนต์ "Critic" ตรวจสอบแผน)
136
+
137
+ ## 🏗️ สถาปัตยกรรม
138
+
139
+ ```
140
+ ┌─────────────────────────────────────────────────────────────────────┐
141
+ │ MCP Server Layer │
142
+ │ ┌─────────────────────────┐ ┌─────────────────────────────────┐ │
143
+ │ │ Sequential Thinking │ │ Swarm Coordination │ │
144
+ │ │ - SessionManager │ │ - AgentRegistry │ │
145
+ │ │ - ThoughtGraph (DAG) │ │ - TaskQueueManager │ │
146
+ │ │ - MetaReasoningEngine │ │ - MessageBroker │ │
147
+ │ │ - SelfCorrectionEngine │ │ - ConsensusEngine │ │
148
+ │ │ - AdaptiveGranularity │ │ - ConflictResolver │ │
149
+ │ └─────────────────────────┘ └─────────────────────────────────┘ │
150
+ └─────────────────────────────────────────────────────────────────────┘
151
+
152
+ ┌─────────────────────┼───────────────────────┐
153
+ ▼ ▼ ▼
154
+ ┌──────────────────┐ ┌──────────────────┐ ┌──────────────────┐
155
+ │ Persistence │ │ Mutex/Locking │ │ LLM Adapter │
156
+ │ (Disk Storage) │ │ (Concurrency) │ │ (Multi-Provider) │
157
+ └──────────────────┘ └──────────────────┘ └──────────────────┘
158
+ ```
159
+
160
+ ### องค์ประกอบสำคัญ
161
+
162
+ | Component | หน้าที่ |
163
+ |-----------|---------|
164
+ | **ThoughtGraph** | จัดการโครงสร้าง DAG (Directed Acyclic Graph) ของความคิด |
165
+ | **SessionManager** | จัดการเซสชัน พร้อมบันทึกและโหลดกลับอัตโนมัติ |
166
+ | **SwarmCoordinator** | ประสานงาน agents ทั้งหมด |
167
+ | **AgentRegistry** | ลงทะเบียนและค้นหา agents ตามความสามารถ |
168
+ | **TaskQueueManager** | จัดการคิวงานพร้อม Task Journaling และ Recovery |
169
+ | **Mutex** | ป้องกัน race conditions ในการมอบหมายงาน |
170
+ | **LLMAdapter** | เชื่อมต่อกับ CLI tools (Gemini, Claude, Kimi, OpenCode) |
80
171
 
81
- ## 👨‍💻 Development & Local Installation
172
+ ## 👨‍💻 การพัฒนาและการติดตั้งในเครื่อง
82
173
 
83
- If you want to modify the code or contribute:
174
+ หากคุณต้องการแก้ไขโค้ดหรือมีส่วนร่วม:
84
175
 
85
176
  ```bash
86
- # Clone the repository
177
+ # Clone repository
87
178
  git clone https://github.com/yourusername/mcp-sequential-thinking.git
88
179
  cd mcp-sequential-thinking
89
180
 
90
- # Install dependencies
181
+ # ติดตั้ง dependencies
91
182
  npm install
92
183
 
93
- # Build the project
184
+ # Build โปรเจกต์
94
185
  npm run build
95
186
 
96
- # Run tests
187
+ # รันการทดสอบ
97
188
  export MOCK_LLM=true
98
189
  npm test
190
+
191
+ # รันในโหมด development
192
+ npm run dev
193
+ ```
194
+
195
+ ## 🐛 การแก้ไขปัญหา (Troubleshooting)
196
+
197
+ ### ปัญหา: `kimi chat` หรือ `No such command 'chat'`
198
+
199
+ **สาเหตุ:** ใช้เวอร์ชันเก่าที่ยังใช้คำสั่ง `kimi chat` (ซึ่งไม่มีใน Kimi CLI)
200
+
201
+ **แก้ไข:**
202
+ ```bash
203
+ # 1. อัปเดตเป็นเวอร์ชันล่าสุด
204
+ npx -y @gotza02/seq-thinking@latest
205
+
206
+ # 2. หรือล้าง cache ของ npx
207
+ npx clear-npx-cache
208
+
209
+ # 3. หรือใช้โค้ดในเครื่องโดยตรง
210
+ node cli.js
211
+ ```
212
+
213
+ ### ปัญหา: Multiple MCP Server Processes
214
+
215
+ **สาเหตุ:** มีหลาย process รันอยู่พร้อมกัน
216
+
217
+ **แก้ไข:**
218
+ ```bash
219
+ # หยุดทุก seq-thinking processes
220
+ pkill -f "seq-thinking"
221
+
222
+ # ตรวจสอบอีกครั้ง
223
+ ps aux | grep seq-thinking
224
+ ```
225
+
226
+ ### ปัญหา: Provider ไม่ทำงาน
227
+
228
+ **สาเหตุ:** CLI tool ไม่ได้ติดตั้งหรือไม่ได้ login
229
+
230
+ **แก้ไข:**
231
+ ```bash
232
+ # ตรวจสอบว่า CLI ติดตั้งแล้ว
233
+ which gemini # หรือ claude, kimi, opencode
234
+
235
+ # ทดสอบด้วย Mock mode
236
+ export MOCK_LLM=true
237
+ npx -y @gotza02/seq-thinking
99
238
  ```
100
239
 
101
- ## 🏗️ Architecture
240
+ ## 📝 ประวัติการเปลี่ยนแปลง (Changelog)
102
241
 
103
- The system is built on a modular architecture:
104
- * **Orchestration Layer:** Manages state, flow control, and error handling.
105
- * **Swarm Coordinator:** Assigns tasks based on agent capabilities and availability.
106
- * **Thought Graph:** A directed acyclic graph (DAG) representing the reasoning process.
107
- * **LLM Adapter:** A unified interface for communicating with various CLI-based models.
242
+ ### v1.1.24 (2026-02-04)
243
+ - **เอกสาร:** อัปเดต README ด้วยรายละเอียดเพิ่มเติมเกี่ยวกับ Architecture, Swarm Agent Types, และ Troubleshooting
244
+ - **เอกสาร:** เพิ่มตัวอย่างการตั้งค่าสำหรับ Cline
245
+ - **ปรับปรุง:** เพิ่มความชัดเจนในการใช้ `@latest` tag สำหรับ npx
108
246
 
109
- ## 📝 Changelog
247
+ ### v1.1.23 (2026-02-04)
248
+ - **Security (สำคัญ):** แก้ไขช่องโหว่ Shell Injection โดยใช้ execFile แทน exec
249
+ - **Security (สำคัญ):** แก้ไขช่องโหว่ Path Traversal โดยเพิ่มการตรวจสอบ ID
250
+ - **คุณสมบัติ:** สร้างระบบ Zod Validation สำหรับตรวจสอบ inputs ทั้งหมด
251
+ - **คุณสมบัติ:** รวมค่าคงที่ทั้งหมดไว้ใน constants.ts
252
+ - **แก้ไข:** แก้ไข version mismatch (1.1.21 → 1.1.22)
253
+ - **ปรับปรุง:** เพิ่ม Unit Tests สำหรับ SpecialistAgent จาก 3 เป็น 38 tests
254
+ - **เอกสาร:** เพิ่มเอกสาร API Reference (docs/API.md)
110
255
 
111
256
  ### v1.1.22 (2026-02-04)
112
- - **Fix (Critical):** Implemented input sanitization in `handleSequentialThinking` to strip hallucinated XML tags (e.g., `<arg_key>`) from operation strings. This resolves "Unknown operation" errors when the LLM malforms tool arguments.
257
+ - **แก้ไข (สำคัญ):** ใช้งาน input sanitization ใน `handleSequentialThinking` เพื่อลบ XML tags ที่เกิดจาก hallucination (เช่น `<arg_key>`) ออกจากสตริง operation แก้ไขข้อผิดพลาด "Unknown operation" เมื่อ LLM สร้าง arguments ของเครื่องมือผิดรูปแบบ
113
258
 
114
259
  ### v1.1.21 (2026-02-04)
115
- - **Fix (Swarm):** Significantly improved technical robustness of Swarm Agent Delegation.
116
- - **Improvement:** Added comprehensive logging across the task lifecycle (submission, assignment, execution).
117
- - **Improvement:** Enhanced error handling in `delegate_to_swarm` operation to capture and report execution exceptions.
118
- - **Fix:** Fixed a bug where failed agent execution wasn't properly triggering the reassignment logic.
260
+ - **แก้ไข (Swarm):** ปรับปรุงความทนทานทางเทคนิคของ Swarm Agent Delegation อย่างมาก
261
+ - **ปรับปรุง:** เพิ่มการบันทึกอย่างครอบคลุมตลอดวงจรชีวิตของงาน (submission, assignment, execution)
262
+ - **ปรับปรุง:** ปรับปรุงการจัดการข้อผิดพลาดใน operation `delegate_to_swarm` เพื่อจับและรายงานข้อยกเว้นการดำเนินการ
263
+ - **แก้ไข:** แก้ไขบั๊กที่การดำเนินการของเอเจนต์ล้มเหลวไม่ได้กระตุ้นลอจิกการมอบหมายใหม่
119
264
 
120
265
  ### v1.1.20 (2026-02-04)
121
- - **Fix (Kimi):** Updated `kimi` CLI integration to use the correct non-interactive syntax (`kimi --quiet --prompt`). Fixes issues where `kimi chat` was failing due to incorrect command structure.
266
+ - **แก้ไข (Kimi):** อัปเดตการบูรณาการ `kimi` CLI ให้ใช้ syntax แบบ non-interactive ที่ถูกต้อง (`kimi --quiet --prompt`) แก้ไขปัญหาที่ `kimi chat` ล้มเหลวเนื่องจากโครงสร้างคำสั่งไม่ถูกต้อง
122
267
 
123
268
  ### v1.1.19 (2026-02-04)
124
- - **Feature (Persistence):** Implemented Task Journaling and Recovery System. Interrupted tasks (e.g., due to crash/restart) are now automatically restored to a PENDING state.
125
- - **Feature (Concurrency):** Added Mutex-based locking to Swarm Coordinator to prevent race conditions during task assignment and execution.
126
- - **Improvement:** Enhanced `TaskQueueManager` with integrated persistence logic.
269
+ - **คุณสมบัติ (Persistence):** ใช้งานระบบ Task Journaling และ Recovery งานที่ถูกขัดจังหวะ (เช่น เนื่องจาก crash/restart) จะถูกกู้คืนให้กลับสู่สถานะ PENDING โดยอัตโนมัติ
270
+ - **คุณสมบัติ (Concurrency):** เพิ่ม Mutex-based locking ให้กับ Swarm Coordinator เพื่อป้องกัน race conditions ระหว่างการมอบหมายและดำเนินการงาน
271
+ - **ปรับปรุง:** ปรับปรุง `TaskQueueManager` ด้วยลอจิกการเก็บข้อมูลแบบบูรณาการ
127
272
 
128
273
  ### v1.1.18 (2026-02-03)
129
- - **Fix:** Critical fix for binary distribution. Restored `cli.js` entry point to ensure compatibility with `npx` and global installation.
130
- - **Improvement:** More robust main module detection for ESM.
274
+ - **แก้ไข:** แก้ไขสำคัญสำหรับการกระจาย binary คืนค่า entry point `cli.js` เพื่อให้เข้ากันได้กับ `npx` และการติดตั้งแบบ global
275
+ - **ปรับปรุง:** ตรวจจับโมดูลหลักที่แข็งแกร่งขึ้นสำหรับ ESM
131
276
 
132
277
  ### v1.1.17 (2026-02-03)
133
- - **Improvement:** Optimized data directory logic to default to `./data` in the current directory even if `TMPDIR` is present (common in CLI environments), while still allowing `TMPDIR` and `MCP_DATA_DIR` overrides.
278
+ - **ปรับปรุง:** ปรับปรุงลอจิกไดเรกทอรีข้อมูลให้ค่าเริ่มต้นเป็น `./data` ในไดเรกทอรีปัจจุบัน แม้ว่าจะมี `TMPDIR` (พบบ่อยในสภาพแวดล้อม CLI) ในขณะที่ยังอนุญาตให้ override ด้วย `TMPDIR` และ `MCP_DATA_DIR` ได้
134
279
 
135
280
  ### v1.1.16 (2026-02-03)
136
- - **Feature:** Added support for `MCP_DATA_DIR` and `TMPDIR` environment variables for flexible data persistence locations.
281
+ - **คุณสมบัติ:** เพิ่มการรองรับตัวแปรสภาพแวดล้อม `MCP_DATA_DIR` และ `TMPDIR` สำหรับตำแหน่งการเก็บข้อมูลที่ยืดหยุ่น
137
282
 
138
283
  ### v1.1.15 (2026-02-03)
139
- - **Feature:** Added support for `LOG_LEVEL` environment variable.
140
- - **Improvement:** Better constructor initialization for `MCPServer`.
284
+ - **คุณสมบัติ:** เพิ่มการรองรับตัวแปรสภาพแวดล้อม `LOG_LEVEL`
285
+ - **ปรับปรุง:** การเริ่มต้น constructor ที่ดีขึ้นสำหรับ `MCPServer`
141
286
 
142
287
  ### v1.1.14 (2026-02-03)
143
- - **Fix:** Improved robustness of `register_agent` operation.
144
- - **Fix:** Added aliasing for `type` field to `agentType` to support legacy/confused AI client calls.
145
- - **Fix:** Added support for extracting `capabilities` from a nested `payload` object.
288
+ - **แก้ไข:** ปรับปรุงความทนทานของ operation `register_agent`
289
+ - **แก้ไข:** เพิ่ม aliasing สำหรับฟิลด์ `type` เป็น `agentType` เพื่อรองรับการเรียกจาก AI client รุ่นเก่า/สับสน
290
+ - **แก้ไข:** เพิ่มการรองรับการดึง `capabilities` จากออบเจกต์ `payload` ที่ซ้อนอยู่
146
291
 
147
292
  ### v1.1.13 (2026-02-03)
148
- - **Feature:** Added `SpecialistAgent` type to swarm coordination.
149
- - **Fix:** Added support for `specialist` and `utility` agent types in `register_agent` operation.
150
- - **Fix:** Enhanced capability normalization allowing `string[]` when registering agents.
293
+ - **คุณสมบัติ:** เพิ่มประเภท `SpecialistAgent` ให้กับ swarm coordination
294
+ - **แก้ไข:** เพิ่มการรองรับประเภทเอเจนต์ `specialist` และ `utility` ใน operation `register_agent`
295
+ - **แก้ไข:** ปรับปรุงการปรับค่า capabilities ให้รองรับ `string[]` เมื่อลงทะเบียนเอเจนต์
151
296
 
152
297
  ### v1.1.12 (2026-02-03)
153
- - **Fix:** Corrected module resolution issues in binary entry point.
154
- - **Cleanup:** Removed redundant root-level CLI files.
155
- - **Improvement:** Optimized `package.json` for reliable `npx` distribution.
298
+ - **แก้ไข:** แก้ไขปัญหาการแก้ไขโมดูลใน entry point แบบ binary
299
+ - **Cleanup:** ลบไฟล์ CLI ระดับ root ที่ซ้ำซ้อน
300
+ - **ปรับปรุง:** ปรับปรุง `package.json` สำหรับการกระจาย `npx` ที่เชื่อถือได้
156
301
 
157
302
  ### v1.1.11 (2026-02-03)
158
- - **Fix:** Final fix for binary distribution issues.
303
+ - **แก้ไข:** แก้ไขสุดท้ายสำหรับปัญหาการกระจาย binary
159
304
 
160
305
  ### v1.1.10 (2026-02-03)
161
- - **Fix:** Refactored binary distribution to ensure reliable `npx` execution.
306
+ - **แก้ไข:** ปรับโครงสร้างการกระจาย binary เพื่อให้การดำเนินการ `npx` เชื่อถือได้
162
307
 
163
308
  ### v1.1.9 (2026-02-03)
164
- - **Fix:** Added multiple bin aliases to improve `npx` compatibility.
309
+ - **แก้ไข:** เพิ่ม bin aliases หลายอันเพื่อปรับปรุงความเข้ากันได้กับ `npx`
165
310
 
166
311
  ### v1.1.8 (2026-02-03)
167
- - **Fix:** Restored standard bin configuration.
312
+ - **แก้ไข:** คืนค่าการตั้งค่า bin มาตรฐาน
168
313
 
169
314
  ### v1.1.7 (2026-02-03)
170
- - **Fix:** Corrected bin path in package.json to ensure `npx` execution compatibility.
315
+ - **แก้ไข:** แก้ไข bin path ใน package.json เพื่อให้เข้ากันได้กับการดำเนินการ `npx`
171
316
 
172
317
  ### v1.1.5 (2026-02-03)
173
- - **Doc:** Updated README to prioritize `npx` usage for easier installation.
174
- - **Doc:** Updated MCP configuration examples to use `npx` command.
318
+ - **เอกสาร:** อัปเดต README เพื่อให้ความสำคัญกับการใช้งาน `npx` เพื่อการติดตั้งที่ง่ายขึ้น
319
+ - **เอกสาร:** อัปเดตตัวอย่างการตั้งค่า MCP ให้ใช้คำสั่ง `npx`
175
320
 
176
321
  ### v1.1.4 (2026-02-03)
177
- - **Fix:** Fixed a critical bug in `MetaReasoningAgent` that caused crashes when analyzing thoughts with missing confidence data.
178
- - **Improvement:** Enhanced robustness of `overall` confidence calculation across all agents.
179
- - **Doc:** Updated README with comprehensive usage and testing instructions.
322
+ - **แก้ไข:** แก้ไขบั๊กสำคัญใน `MetaReasoningAgent` ที่ทำให้เกิดการ crash เมื่อวิเคราะห์ thoughts ที่ขาดข้อมูล confidence
323
+ - **ปรับปรุง:** ปรับปรุงความทนทานของการคำนวณ confidence `overall` ในเอเจนต์ทั้งหมด
324
+ - **เอกสาร:** อัปเดต README ด้วยคำแนะนำการใช้งานและการทดสอบที่ครอบคลุม
180
325
 
181
326
  ### v1.1.3 (2026-02-03)
182
- - **Feature:** Multi-Provider Auto-Fallback.
183
- - **Feature:** Dynamic Provider Selection per task.
184
- - **Refactor:** Replaced console logs with structured `Logger`.
327
+ - **คุณสมบัติ:** Multi-Provider Auto-Fallback
328
+ - **คุณสมบัติ:** Dynamic Provider Selection ต่องาน
329
+ - **ปรับโครงสร้าง:** แทนที่ console logs ด้วย `Logger` แบบมีโครงสร้าง
185
330
 
186
- ## 📄 License
331
+ ## 📄 ใบอนุญาต
187
332
 
188
- MIT License - see [LICENSE](LICENSE) file for details.
333
+ MIT License - ดูรายละเอียดในไฟล์ [LICENSE](LICENSE)
@@ -1,50 +1,50 @@
1
- # AI System Instructions for MCP Sequential Thinking
1
+ # คำแนะนำระบบ AI สำหรับ MCP Sequential Thinking
2
2
 
3
- This document provides instructions for AI models (like Gemini or Claude) on how to effectively utilize this MCP server to solve complex problems.
3
+ เอกสารนี้ให้คำแนะนำสำหรับโมเดล AI (เช่น Gemini หรือ Claude) เกี่ยวกับวิธีการใช้งาน MCP server นี้อย่างมีประสิทธิภาพเพื่อแก้ไขปัญหาที่ซับซ้อน
4
4
 
5
- ## 1. When to Use These Tools
5
+ ## 1. เมื่อใดควรใช้เครื่องมือเหล่านี้
6
6
 
7
- You should invoke the `advanced_sequential_thinking` tool when:
8
- - The user's request is complex, ambiguous, or requires multi-step planning.
9
- - You need to explore multiple hypotheses or alternative solutions.
10
- - You need to perform self-correction or verify your own reasoning.
11
- - The task requires a "System 2" thinking approach (deliberative and analytical).
7
+ คุณควรเรียกใช้เครื่องมือ `advanced_sequential_thinking` เมื่อ:
8
+ - คำขอของผู้ใช้มีความซับซ้อน คลุมเครือ หรือต้องการการวางแผนหลายขั้นตอน
9
+ - คุณต้องสำรวจสมมติฐานหรือทางเลือกอื่นหลายๆ อย่าง
10
+ - คุณต้องดำเนินการแก้ไขตนเองหรือตรวจสอบการให้เหตุผลของตนเอง
11
+ - งานต้องการวิธีการคิดแบบ "System 2" (การพิจารณาอย่างรอบคอบและวิเคราะห์)
12
12
 
13
- ## 2. Decision Logic for Tools
13
+ ## 2. ตรรกะการตัดสินใจสำหรับเครื่องมือ
14
14
 
15
- | tool | Use Case |
15
+ | เครื่องมือ | กรณีการใช้งาน |
16
16
  |------|----------|
17
- | `advanced_sequential_thinking` | Core reasoning, branching, and meta-reflection. |
18
- | `swarm_agent_coordination` | Delegating specific sub-tasks to specialized agents (e.g., Fact-checking, Code Critique). |
17
+ | `advanced_sequential_thinking` | การให้เหตุผลหลัก การแบ่งกิ่ง และการทบทวนเชิงเมตา |
18
+ | `swarm_agent_coordination` | มอบหมายงานย่อยเฉพาะทางให้กับเอเจนต์ผู้เชี่ยวชาญ (เช่น การตรวจสอบข้อเท็จจริง การวิจารณ์โค้ด) |
19
19
 
20
- ## 3. Recommended Workflow
20
+ ## 3. ขั้นตอนการทำงานที่แนะนำ
21
21
 
22
- ### Phase A: Initialization
23
- 1. **Initialize**: Create a session with a clear `topic`.
24
- 2. **Adjust Granularity**: Check if the topic is complex enough to require high detail.
22
+ ### เฟส A: การเริ่มต้น
23
+ 1. **initialize**: สร้างเซสชันด้วย `topic` ที่ชัดเจน
24
+ 2. **adjust_granularity**: ตรวจสอบว่าหัวข้อมีความซับซ้อนเพียงพอที่ต้องการรายละเอียดสูงหรือไม่
25
25
 
26
- ### Phase B: Iterative Reasoning
27
- 1. **Add Thoughts**: Progress step-by-step. Use `thoughtType` (analysis, hypothesis, etc.) correctly.
28
- 2. **Branching**: If you reach a decision point with multiple viable paths, use `branch_thought` to explore them in parallel.
29
- 3. **Self-Correction**: Periodically call `self_correct` or `add_meta_thought` to reflect on your progress.
26
+ ### เฟส B: การให้เหตุผลแบบทำซ้ำ
27
+ 1. **add_thought**: ดำเนินการทีละขั้นตอน ใช้ `thoughtType` (analysis, hypothesis, ฯลฯ) ให้ถูกต้อง
28
+ 2. **branch_thought**: หากคุณถึงจุดตัดสินใจที่มีหลายเส้นทางที่เป็นไปได้ ให้ใช้ `branch_thought` เพื่อสำรวจพร้อมกัน
29
+ 3. **self_correct**: เรียกใช้ `self_correct` หรือ `add_meta_thought` เป็นระยะเพื่อทบทวนความคืบหน้าของคุณ
30
30
 
31
- ### Phase C: Swarm Delegation (Optional)
32
- 1. **Register Agents**: If you need specialized help, register a `critic` or `reasoner`.
33
- 2. **Delegate**: Use `delegate_to_swarm` to let another "brain" analyze a specific thought.
34
- 3. **Consensus**: Use `reach_consensus` if multiple agents have different outputs.
31
+ ### เฟส C: การมอบหมายให้ Swarm (เลือกใช้)
32
+ 1. **register_agent**: หากคุณต้องการความช่วยเหลือเฉพาะทาง ให้ลงทะเบียน `critic` หรือ `reasoner`
33
+ 2. **delegate_to_swarm**: ใช้ `delegate_to_swarm` เพื่อให้ "สมอง" อื่นวิเคราะห์ความคิดเฉพาะข้อ
34
+ 3. **reach_consensus**: ใช้ `reach_consensus` หากเอเจนต์หลายตัวมีผลลัพธ์ที่แตกต่างกัน
35
35
 
36
- ### Phase D: Conclusion
37
- 1. **Merge**: Combine successful branches using `merge_branches`.
38
- 2. **Complete**: Finalize the session and present the consolidated result to the user.
36
+ ### เฟส D: การสรุป
37
+ 1. **merge_branches**: รวมกิ่งที่ประสบความสำเร็จโดยใช้ `merge_branches`
38
+ 2. **complete**: สรุปเซสชันและนำเสนอผลลัพธ์ที่รวบรวมให้กับผู้ใช้
39
39
 
40
- ## 4. Best Practices for the AI
40
+ ## 4. แนวทางปฏิบัติที่ดีที่สุดสำหรับ AI
41
41
 
42
- - **Maintain Context**: Keep track of the `sessionId`. Use it for all related thoughts.
43
- - **Calibrate Confidence**: Be honest about confidence levels. If confidence drops below 0.5, explicitly use a `self_correction` thought.
44
- - **Label Everything**: Use `tags` and `thoughtType` diligently. This helps the system (and the user) understand your mental map.
45
- - **Meta-Reflection**: Don't just think; think about *how* you are thinking. If you get stuck, use `add_meta_thought` to analyze the pattern.
42
+ - **รักษาบริบท**: ติดตาม `sessionId` ใช้งานสำหรับความคิดที่เกี่ยวข้องทั้งหมด
43
+ - **ปรับเทียบความมั่นใจ**: แสดงความซื่อสัตย์เกี่ยวกับระดับความมั่นใจ หากความมั่นใจต่ำกว่า 0.5 ให้ใช้ความคิด `self_correction` อย่างชัดเจน
44
+ - **ติดป้ายทุกอย่าง**: ใช้ `tags` และ `thoughtType` อย่างขยัน สิ่งนี้ช่วยให้ระบบ (และผู้ใช้) เข้าใจแผนที่ความคิดของคุณ
45
+ - **การทบทวนเชิงเมตา**: ไม่เพียงแค่คิด แต่ต้องคิดถึง *วิธี* ที่คุณกำลังคิด หากคุณติดขัด ให้ใช้ `add_meta_thought` เพื่อวิเคราะห์รูปแบบ
46
46
 
47
- ## 5. System Prompt Template
47
+ ## 5. เทมเพลตคำสั่งระบบ
48
48
 
49
- When using this MCP server, you may internalize this instruction:
50
- > "I will use the Sequential Thinking MCP to map out my reasoning process. I will treat complex problems as a graph of thoughts, allowing myself to branch, backtrack, and consult specialized swarm agents when needed to ensure the highest quality output."
49
+ เมื่อใช้ MCP server นี้ คุณอาจทำให้คำสั่งนี้เป็นส่วนหนึ่งของตนเอง:
50
+ > "ฉันจะใช้ Sequential Thinking MCP เพื่อสร้างแผนที่กระบวนการให้เหตุผลของฉัน ฉันจะถือปัญหาที่ซับซ้อนเป็นกราฟของความคิด อนุญาตให้ตนเองแบ่งกิ่ง ย้อนกลับ และปรึกษาเอเจนต์ swarm ผู้เชี่ยวชาญเมื่อจำเป็นเพื่อให้ได้ผลลัพธ์ที่มีคุณภาพสูงสุด"