mcp-taskflow 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/CHANGELOG.md +13 -0
- package/LICENSE.md +21 -0
- package/README.md +275 -0
- package/dist/config/pathResolver.d.ts +33 -0
- package/dist/config/pathResolver.d.ts.map +1 -0
- package/dist/config/pathResolver.js +130 -0
- package/dist/config/pathResolver.js.map +1 -0
- package/dist/data/fileOperations.d.ts +43 -0
- package/dist/data/fileOperations.d.ts.map +1 -0
- package/dist/data/fileOperations.js +248 -0
- package/dist/data/fileOperations.js.map +1 -0
- package/dist/data/memoryStore.d.ts +86 -0
- package/dist/data/memoryStore.d.ts.map +1 -0
- package/dist/data/memoryStore.js +216 -0
- package/dist/data/memoryStore.js.map +1 -0
- package/dist/data/rulesStore.d.ts +63 -0
- package/dist/data/rulesStore.d.ts.map +1 -0
- package/dist/data/rulesStore.js +196 -0
- package/dist/data/rulesStore.js.map +1 -0
- package/dist/data/schemas.d.ts +840 -0
- package/dist/data/schemas.d.ts.map +1 -0
- package/dist/data/schemas.js +265 -0
- package/dist/data/schemas.js.map +1 -0
- package/dist/data/taskSearchService.d.ts +110 -0
- package/dist/data/taskSearchService.d.ts.map +1 -0
- package/dist/data/taskSearchService.js +165 -0
- package/dist/data/taskSearchService.js.map +1 -0
- package/dist/data/taskStore.d.ts +192 -0
- package/dist/data/taskStore.d.ts.map +1 -0
- package/dist/data/taskStore.js +347 -0
- package/dist/data/taskStore.js.map +1 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +86 -0
- package/dist/index.js.map +1 -0
- package/dist/prompts/index.d.ts +12 -0
- package/dist/prompts/index.d.ts.map +1 -0
- package/dist/prompts/index.js +17 -0
- package/dist/prompts/index.js.map +1 -0
- package/dist/prompts/projectPromptBuilder.d.ts +13 -0
- package/dist/prompts/projectPromptBuilder.d.ts.map +1 -0
- package/dist/prompts/projectPromptBuilder.js +29 -0
- package/dist/prompts/projectPromptBuilder.js.map +1 -0
- package/dist/prompts/researchPromptBuilder.d.ts +10 -0
- package/dist/prompts/researchPromptBuilder.d.ts.map +1 -0
- package/dist/prompts/researchPromptBuilder.js +20 -0
- package/dist/prompts/researchPromptBuilder.js.map +1 -0
- package/dist/prompts/taskPromptBuilders.d.ts +87 -0
- package/dist/prompts/taskPromptBuilders.d.ts.map +1 -0
- package/dist/prompts/taskPromptBuilders.js +529 -0
- package/dist/prompts/taskPromptBuilders.js.map +1 -0
- package/dist/prompts/templateEngine.d.ts +102 -0
- package/dist/prompts/templateEngine.d.ts.map +1 -0
- package/dist/prompts/templateEngine.js +145 -0
- package/dist/prompts/templateEngine.js.map +1 -0
- package/dist/prompts/templateLoader.d.ts +61 -0
- package/dist/prompts/templateLoader.d.ts.map +1 -0
- package/dist/prompts/templateLoader.js +129 -0
- package/dist/prompts/templateLoader.js.map +1 -0
- package/dist/prompts/templates/v1/templates_en/analyzeTask/index.md +65 -0
- package/dist/prompts/templates/v1/templates_en/analyzeTask/iteration.md +12 -0
- package/dist/prompts/templates/v1/templates_en/clearAllTasks/backupInfo.md +1 -0
- package/dist/prompts/templates/v1/templates_en/clearAllTasks/cancel.md +7 -0
- package/dist/prompts/templates/v1/templates_en/clearAllTasks/empty.md +5 -0
- package/dist/prompts/templates/v1/templates_en/clearAllTasks/index.md +5 -0
- package/dist/prompts/templates/v1/templates_en/clearAllTasks/result.md +7 -0
- package/dist/prompts/templates/v1/templates_en/clearAllTasks/success.md +5 -0
- package/dist/prompts/templates/v1/templates_en/deleteTask/completed.md +5 -0
- package/dist/prompts/templates/v1/templates_en/deleteTask/index.md +5 -0
- package/dist/prompts/templates/v1/templates_en/deleteTask/notFound.md +5 -0
- package/dist/prompts/templates/v1/templates_en/deleteTask/result.md +5 -0
- package/dist/prompts/templates/v1/templates_en/deleteTask/success.md +5 -0
- package/dist/prompts/templates/v1/templates_en/executeTask/analysisResult.md +3 -0
- package/dist/prompts/templates/v1/templates_en/executeTask/complexity.md +15 -0
- package/dist/prompts/templates/v1/templates_en/executeTask/dependencies.md +3 -0
- package/dist/prompts/templates/v1/templates_en/executeTask/dependencyTasks.md +3 -0
- package/dist/prompts/templates/v1/templates_en/executeTask/implementationGuide.md +3 -0
- package/dist/prompts/templates/v1/templates_en/executeTask/index.md +39 -0
- package/dist/prompts/templates/v1/templates_en/executeTask/notes.md +1 -0
- package/dist/prompts/templates/v1/templates_en/executeTask/relatedFilesSummary.md +5 -0
- package/dist/prompts/templates/v1/templates_en/executeTask/verificationCriteria.md +3 -0
- package/dist/prompts/templates/v1/templates_en/getTaskDetail/complatedSummary.md +5 -0
- package/dist/prompts/templates/v1/templates_en/getTaskDetail/dependencies.md +1 -0
- package/dist/prompts/templates/v1/templates_en/getTaskDetail/error.md +3 -0
- package/dist/prompts/templates/v1/templates_en/getTaskDetail/implementationGuide.md +3 -0
- package/dist/prompts/templates/v1/templates_en/getTaskDetail/index.md +25 -0
- package/dist/prompts/templates/v1/templates_en/getTaskDetail/notFound.md +3 -0
- package/dist/prompts/templates/v1/templates_en/getTaskDetail/notes.md +1 -0
- package/dist/prompts/templates/v1/templates_en/getTaskDetail/relatedFiles.md +3 -0
- package/dist/prompts/templates/v1/templates_en/getTaskDetail/verificationCriteria.md +3 -0
- package/dist/prompts/templates/v1/templates_en/initProjectRules/index.md +81 -0
- package/dist/prompts/templates/v1/templates_en/listTasks/index.md +7 -0
- package/dist/prompts/templates/v1/templates_en/listTasks/notFound.md +3 -0
- package/dist/prompts/templates/v1/templates_en/listTasks/taskDetails.md +13 -0
- package/dist/prompts/templates/v1/templates_en/planTask/hasThought.md +4 -0
- package/dist/prompts/templates/v1/templates_en/planTask/index.md +96 -0
- package/dist/prompts/templates/v1/templates_en/planTask/noThought.md +4 -0
- package/dist/prompts/templates/v1/templates_en/planTask/tasks.md +17 -0
- package/dist/prompts/templates/v1/templates_en/processThought/complatedThought.md +6 -0
- package/dist/prompts/templates/v1/templates_en/processThought/index.md +13 -0
- package/dist/prompts/templates/v1/templates_en/processThought/moreThought.md +1 -0
- package/dist/prompts/templates/v1/templates_en/queryTask/index.md +24 -0
- package/dist/prompts/templates/v1/templates_en/queryTask/notFound.md +15 -0
- package/dist/prompts/templates/v1/templates_en/queryTask/taskDetails.md +5 -0
- package/dist/prompts/templates/v1/templates_en/reflectTask/index.md +57 -0
- package/dist/prompts/templates/v1/templates_en/researchMode/index.md +95 -0
- package/dist/prompts/templates/v1/templates_en/researchMode/previousState.md +9 -0
- package/dist/prompts/templates/v1/templates_en/splitTasks/index.md +34 -0
- package/dist/prompts/templates/v1/templates_en/splitTasks/taskDetails.md +12 -0
- package/dist/prompts/templates/v1/templates_en/tests/basic.md +1 -0
- package/dist/prompts/templates/v1/templates_en/toolsDescription/analyzeTask.md +1 -0
- package/dist/prompts/templates/v1/templates_en/toolsDescription/clearAllTasks.md +1 -0
- package/dist/prompts/templates/v1/templates_en/toolsDescription/deleteTask.md +1 -0
- package/dist/prompts/templates/v1/templates_en/toolsDescription/executeTask.md +1 -0
- package/dist/prompts/templates/v1/templates_en/toolsDescription/getTaskDetail.md +1 -0
- package/dist/prompts/templates/v1/templates_en/toolsDescription/initProjectRules.md +1 -0
- package/dist/prompts/templates/v1/templates_en/toolsDescription/listTasks.md +1 -0
- package/dist/prompts/templates/v1/templates_en/toolsDescription/planTask.md +3 -0
- package/dist/prompts/templates/v1/templates_en/toolsDescription/processThought.md +1 -0
- package/dist/prompts/templates/v1/templates_en/toolsDescription/queryTask.md +1 -0
- package/dist/prompts/templates/v1/templates_en/toolsDescription/reflectTask.md +1 -0
- package/dist/prompts/templates/v1/templates_en/toolsDescription/researchMode.md +1 -0
- package/dist/prompts/templates/v1/templates_en/toolsDescription/splitTasks.md +83 -0
- package/dist/prompts/templates/v1/templates_en/toolsDescription/updateTask.md +1 -0
- package/dist/prompts/templates/v1/templates_en/toolsDescription/verifyTask.md +37 -0
- package/dist/prompts/templates/v1/templates_en/updateTaskContent/emptyUpdate.md +5 -0
- package/dist/prompts/templates/v1/templates_en/updateTaskContent/fileDetails.md +1 -0
- package/dist/prompts/templates/v1/templates_en/updateTaskContent/index.md +7 -0
- package/dist/prompts/templates/v1/templates_en/updateTaskContent/notFound.md +5 -0
- package/dist/prompts/templates/v1/templates_en/updateTaskContent/success.md +9 -0
- package/dist/prompts/templates/v1/templates_en/updateTaskContent/successDetails.md +3 -0
- package/dist/prompts/templates/v1/templates_en/updateTaskContent/validation.md +5 -0
- package/dist/prompts/templates/v1/templates_en/verifyTask/index.md +19 -0
- package/dist/prompts/templates/v1/templates_en/verifyTask/noPass.md +12 -0
- package/dist/prompts/thoughtPromptBuilder.d.ts +11 -0
- package/dist/prompts/thoughtPromptBuilder.d.ts.map +1 -0
- package/dist/prompts/thoughtPromptBuilder.js +30 -0
- package/dist/prompts/thoughtPromptBuilder.js.map +1 -0
- package/dist/server/container.d.ts +111 -0
- package/dist/server/container.d.ts.map +1 -0
- package/dist/server/container.js +135 -0
- package/dist/server/container.js.map +1 -0
- package/dist/server/logger.d.ts +98 -0
- package/dist/server/logger.d.ts.map +1 -0
- package/dist/server/logger.js +295 -0
- package/dist/server/logger.js.map +1 -0
- package/dist/server/mcpServer.d.ts +162 -0
- package/dist/server/mcpServer.d.ts.map +1 -0
- package/dist/server/mcpServer.js +236 -0
- package/dist/server/mcpServer.js.map +1 -0
- package/dist/tools/project/index.d.ts +7 -0
- package/dist/tools/project/index.d.ts.map +1 -0
- package/dist/tools/project/index.js +7 -0
- package/dist/tools/project/index.js.map +1 -0
- package/dist/tools/project/projectTools.d.ts +17 -0
- package/dist/tools/project/projectTools.d.ts.map +1 -0
- package/dist/tools/project/projectTools.js +73 -0
- package/dist/tools/project/projectTools.js.map +1 -0
- package/dist/tools/research/index.d.ts +7 -0
- package/dist/tools/research/index.d.ts.map +1 -0
- package/dist/tools/research/index.js +7 -0
- package/dist/tools/research/index.js.map +1 -0
- package/dist/tools/research/researchTools.d.ts +16 -0
- package/dist/tools/research/researchTools.d.ts.map +1 -0
- package/dist/tools/research/researchTools.js +41 -0
- package/dist/tools/research/researchTools.js.map +1 -0
- package/dist/tools/task/index.d.ts +8 -0
- package/dist/tools/task/index.d.ts.map +1 -0
- package/dist/tools/task/index.js +8 -0
- package/dist/tools/task/index.js.map +1 -0
- package/dist/tools/task/taskTools.d.ts +32 -0
- package/dist/tools/task/taskTools.d.ts.map +1 -0
- package/dist/tools/task/taskTools.js +542 -0
- package/dist/tools/task/taskTools.js.map +1 -0
- package/dist/tools/thought/index.d.ts +7 -0
- package/dist/tools/thought/index.d.ts.map +1 -0
- package/dist/tools/thought/index.js +7 -0
- package/dist/tools/thought/index.js.map +1 -0
- package/dist/tools/thought/thoughtTools.d.ts +16 -0
- package/dist/tools/thought/thoughtTools.d.ts.map +1 -0
- package/dist/tools/thought/thoughtTools.js +47 -0
- package/dist/tools/thought/thoughtTools.js.map +1 -0
- package/docs/API.md +32 -0
- package/docs/ARCHITECTURE.md +44 -0
- package/docs/COMPATIBILITY_REPORT.md +26 -0
- package/docs/PERFORMANCE.md +66 -0
- package/package.json +77 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
Break down complex tasks into independent subtasks, establishing dependencies and priorities.
|
|
2
|
+
|
|
3
|
+
## 1. **Granularity Control (Required Reading)**
|
|
4
|
+
|
|
5
|
+
- ### **Minimum Viable Task**
|
|
6
|
+
|
|
7
|
+
Each subtask should be completable and verifiable by a single developer within **1–2 working days** (approximately 8–16 hours).
|
|
8
|
+
|
|
9
|
+
- ### **Maximum Complexity Limitation**
|
|
10
|
+
|
|
11
|
+
A single subtask should not span multiple technical domains such as **frontend**, **backend**, and **database**.
|
|
12
|
+
If cross-domain work is required, split it into multiple subtasks.
|
|
13
|
+
|
|
14
|
+
- ### **Recommended Number of Tasks**
|
|
15
|
+
|
|
16
|
+
Avoid splitting into more than **10 subtasks** at once.
|
|
17
|
+
If more are needed, submit them in prioritized batches (6–8 tasks per batch).
|
|
18
|
+
|
|
19
|
+
- ### **Recommended Task Length**
|
|
20
|
+
|
|
21
|
+
Each split should not exceed **5,000 characters**.
|
|
22
|
+
If it does, divide and submit in multiple batches.
|
|
23
|
+
|
|
24
|
+
- ### **Depth Limitation**
|
|
25
|
+
The task tree should not exceed **3 levels**:
|
|
26
|
+
- **Level 1**: Functional Modules
|
|
27
|
+
- **Level 2**: Main Processes
|
|
28
|
+
- **Level 3**: Key Steps
|
|
29
|
+
|
|
30
|
+
## 2. **Task Splitting Example**
|
|
31
|
+
|
|
32
|
+
- Identify **core functionality points**, and create a subtask for each.
|
|
33
|
+
- Annotate each subtask with:
|
|
34
|
+
- **Input/Output**
|
|
35
|
+
- **Acceptance Criteria**
|
|
36
|
+
- If needed, provide **pseudocode**:
|
|
37
|
+
- Only outline high-level logic and key steps.
|
|
38
|
+
- Avoid providing complete source code.
|
|
39
|
+
- Check **dependencies** between subtasks and specify them in the `dependencies` field.
|
|
40
|
+
- If the task involves interface design, always provide a complete and consistent definition, including:
|
|
41
|
+
|
|
42
|
+
- Function/class/schema definitions (including names, parameters, return values)
|
|
43
|
+
- Data types, usage descriptions, and optional/required status for each item
|
|
44
|
+
- Error handling methods and expected exception scenarios
|
|
45
|
+
- Dependency and naming conventions (if any)
|
|
46
|
+
- Sample data and usage examples
|
|
47
|
+
|
|
48
|
+
This ensures consistency, readability, and development precision between tasks.
|
|
49
|
+
|
|
50
|
+
## 3. **Dependencies and Prioritization**
|
|
51
|
+
|
|
52
|
+
- Mark each subtask with its `dependencies` list.
|
|
53
|
+
- Automatically compute and enforce execution order based on the dependency graph to prioritize the **critical path**.
|
|
54
|
+
|
|
55
|
+
## 4. **Update Mode Explanation (`updateMode`)**
|
|
56
|
+
|
|
57
|
+
When you need to create a new task that is not related to the current task list, be sure to use `clearAllTasks` to avoid task confusion.
|
|
58
|
+
|
|
59
|
+
- `append`: Keep existing unfinished tasks and add new ones.
|
|
60
|
+
- `overwrite`: Delete all unfinished tasks, keep completed ones.
|
|
61
|
+
- `selective`: Smart-match and update tasks by name.
|
|
62
|
+
- `clearAllTasks`: Clear all tasks and automatically back up the current list.
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## 5. **Strict JSON Rules**
|
|
67
|
+
|
|
68
|
+
- ### **No Comments Allowed**
|
|
69
|
+
|
|
70
|
+
JSON does not support comments.
|
|
71
|
+
Any use of `#` or `//` will cause parsing failures.
|
|
72
|
+
|
|
73
|
+
- ### **Proper Escaping Required**
|
|
74
|
+
All special characters (e.g., double quotes `\"`, backslashes `\\`) must be properly escaped,
|
|
75
|
+
or they will be considered invalid.
|
|
76
|
+
|
|
77
|
+
## 6. **Important Notes**
|
|
78
|
+
|
|
79
|
+
These tasks will be executed by low-intelligence models, so please follow the guidelines below:
|
|
80
|
+
|
|
81
|
+
- `Clear and Explicit Instructions`: This prevents the model from producing incorrect or inconsistent architecture/code styles. Provide clear commands or specifications.
|
|
82
|
+
- `Encapsulated Interfaces`: Each task runs independently. Define the interfaces clearly — such as function names, parameters, return values — so that other task-executing models can easily understand how to interact with or integrate these functions.
|
|
83
|
+
- `Dependencies`: If there are dependencies between tasks, define the interaction interfaces first. Tasks do not need to know each other's implementation, but must know how to interact with one another.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Update task content, including name, description and notes, dependent tasks, related files, implementation guide, and verification criteria, completed tasks only allow updating summary and related files
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
## Verify Task
|
|
2
|
+
|
|
3
|
+
Please comprehensively check and score according to the requirements in verificationCriteria,
|
|
4
|
+
If you are missing or have forgotten the verificationCriteria content, please use `get_task_detail` to obtain it.
|
|
5
|
+
|
|
6
|
+
Please score according to the following rules:
|
|
7
|
+
|
|
8
|
+
### Verification Standards
|
|
9
|
+
|
|
10
|
+
1. **Requirements Compliance(30%)** - Functionality completeness, constraint adherence, edge case handling
|
|
11
|
+
2. **Technical Quality(30%)** - Architectural consistency, code robustness, implementation elegance
|
|
12
|
+
3. **Integration Compatibility(20%)** - System integration, interoperability, compatibility maintenance
|
|
13
|
+
4. **Performance Scalability(20%)** - Performance optimization, load adaptability, resource management
|
|
14
|
+
|
|
15
|
+
### score Parameter Guidelines
|
|
16
|
+
|
|
17
|
+
Provide overall score and rating, assessment of each standard, issues and suggestions, and final conclusion.
|
|
18
|
+
|
|
19
|
+
**Must use the following format to provide scoring results (for system parsing):**
|
|
20
|
+
|
|
21
|
+
```Scoring
|
|
22
|
+
score: [number from 0-100]
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### summary Parameter Guidelines
|
|
26
|
+
|
|
27
|
+
If the score is equal to or greater than 80 points, please provide a task summary
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
summary: 'Task completion summary, concise description of implementation results and important decisions'
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
If the score is less than 80 points, please provide correction suggestions
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
summary: 'List task issues and correction suggestions'
|
|
37
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
- **Related Files:** {fileType} ({fileCount}): {filesList}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
**Please strictly follow the guidelines below**
|
|
2
|
+
|
|
3
|
+
## Task Completion Confirmation
|
|
4
|
+
|
|
5
|
+
Task "{{taskName}}" (ID: `{{taskId}}`) has been successfully marked as completed.
|
|
6
|
+
|
|
7
|
+
**Task Summary:** {{taskSummary}}
|
|
8
|
+
|
|
9
|
+
## Task Summary Requirements
|
|
10
|
+
|
|
11
|
+
Please provide a summary of this completed task, including the following key points:
|
|
12
|
+
|
|
13
|
+
1. Task objectives and main accomplishments
|
|
14
|
+
2. Key points of the implemented solution
|
|
15
|
+
3. Major challenges encountered and solutions
|
|
16
|
+
|
|
17
|
+
**Important Note:**
|
|
18
|
+
Please provide the task summary in the current response. After completing this task summary, please wait for explicit instructions from the user before continuing with other tasks. Do not automatically start executing the next task.
|
|
19
|
+
If the user requests continuous task execution, please use the "execute_task" tool to start executing the next task.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
**Please strictly follow the guidelines below**
|
|
2
|
+
|
|
3
|
+
## Verification Failed
|
|
4
|
+
|
|
5
|
+
Task "{name}" (ID: `{id}`) verification failed
|
|
6
|
+
|
|
7
|
+
### Correction Suggestions
|
|
8
|
+
|
|
9
|
+
{summary}
|
|
10
|
+
|
|
11
|
+
**Important Note:**
|
|
12
|
+
Please attempt to fix the issues and call `verify_task` again to re-verify the task
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prompt builder for structured thinking tool (process_thought).
|
|
3
|
+
* Supports metacognitive reasoning and chain-of-thought processing.
|
|
4
|
+
*
|
|
5
|
+
* @module prompts/thoughtPromptBuilder
|
|
6
|
+
*/
|
|
7
|
+
export declare class ProcessThoughtPromptBuilder {
|
|
8
|
+
build(thought: string, thoughtNumber: number, totalThoughts: number, stage: string, nextThoughtNeeded: boolean, tags?: string[], axiomsUsed?: string[], assumptionsChallenged?: string[]): Promise<string>;
|
|
9
|
+
private formatList;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=thoughtPromptBuilder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thoughtPromptBuilder.d.ts","sourceRoot":"","sources":["../../src/prompts/thoughtPromptBuilder.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,qBAAa,2BAA2B;IAChC,KAAK,CACT,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,MAAM,EACrB,aAAa,EAAE,MAAM,EACrB,KAAK,EAAE,MAAM,EACb,iBAAiB,EAAE,OAAO,EAC1B,IAAI,CAAC,EAAE,MAAM,EAAE,EACf,UAAU,CAAC,EAAE,MAAM,EAAE,EACrB,qBAAqB,CAAC,EAAE,MAAM,EAAE,GAC/B,OAAO,CAAC,MAAM,CAAC;IAelB,OAAO,CAAC,UAAU;CAMnB"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prompt builder for structured thinking tool (process_thought).
|
|
3
|
+
* Supports metacognitive reasoning and chain-of-thought processing.
|
|
4
|
+
*
|
|
5
|
+
* @module prompts/thoughtPromptBuilder
|
|
6
|
+
*/
|
|
7
|
+
import { loadTemplate } from './templateLoader.js';
|
|
8
|
+
import { render } from './templateEngine.js';
|
|
9
|
+
export class ProcessThoughtPromptBuilder {
|
|
10
|
+
async build(thought, thoughtNumber, totalThoughts, stage, nextThoughtNeeded, tags, axiomsUsed, assumptionsChallenged) {
|
|
11
|
+
const template = await loadTemplate('processThought/index.md');
|
|
12
|
+
return render(template, {
|
|
13
|
+
thought,
|
|
14
|
+
thoughtNumber,
|
|
15
|
+
totalThoughts,
|
|
16
|
+
stage,
|
|
17
|
+
nextThoughtNeeded: nextThoughtNeeded ? 'yes' : 'no',
|
|
18
|
+
tags: tags ? tags.join(', ') : 'none',
|
|
19
|
+
axioms: axiomsUsed ? this.formatList(axiomsUsed) : 'none',
|
|
20
|
+
assumptions: assumptionsChallenged ? this.formatList(assumptionsChallenged) : 'none'
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
formatList(items) {
|
|
24
|
+
if (items.length === 0) {
|
|
25
|
+
return 'none';
|
|
26
|
+
}
|
|
27
|
+
return items.map((item, index) => `${index + 1}. ${item}`).join('\n');
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=thoughtPromptBuilder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thoughtPromptBuilder.js","sourceRoot":"","sources":["../../src/prompts/thoughtPromptBuilder.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,MAAM,OAAO,2BAA2B;IACtC,KAAK,CAAC,KAAK,CACT,OAAe,EACf,aAAqB,EACrB,aAAqB,EACrB,KAAa,EACb,iBAA0B,EAC1B,IAAe,EACf,UAAqB,EACrB,qBAAgC;QAEhC,MAAM,QAAQ,GAAG,MAAM,YAAY,CAAC,yBAAyB,CAAC,CAAC;QAE/D,OAAO,MAAM,CAAC,QAAQ,EAAE;YACtB,OAAO;YACP,aAAa;YACb,aAAa;YACb,KAAK;YACL,iBAAiB,EAAE,iBAAiB,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI;YACnD,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM;YACrC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,MAAM;YACzD,WAAW,EAAE,qBAAqB,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,MAAM;SACrF,CAAC,CAAC;IACL,CAAC;IAEO,UAAU,CAAC,KAAe;QAChC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACvB,OAAO,MAAM,CAAC;QAChB,CAAC;QACD,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,GAAG,KAAK,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACxE,CAAC;CACF"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dependency Injection Container
|
|
3
|
+
*
|
|
4
|
+
* Manual dependency injection implementation for the MCP server.
|
|
5
|
+
* All services are singletons - created once per container.
|
|
6
|
+
*/
|
|
7
|
+
import type { Logger } from 'pino';
|
|
8
|
+
import { TaskStore } from '../data/taskStore.js';
|
|
9
|
+
import { MemoryStore } from '../data/memoryStore.js';
|
|
10
|
+
import { RulesStore } from '../data/rulesStore.js';
|
|
11
|
+
import { TaskSearchService } from '../data/taskSearchService.js';
|
|
12
|
+
/**
|
|
13
|
+
* Service container holding all application services
|
|
14
|
+
*
|
|
15
|
+
* All services are singletons - created once and reused
|
|
16
|
+
*/
|
|
17
|
+
export interface ServiceContainer {
|
|
18
|
+
readonly logger: Logger;
|
|
19
|
+
readonly taskStore: TaskStore;
|
|
20
|
+
readonly memoryStore: MemoryStore;
|
|
21
|
+
readonly rulesStore: RulesStore;
|
|
22
|
+
readonly taskSearchService: TaskSearchService;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Container options for configuration
|
|
26
|
+
*/
|
|
27
|
+
export interface ContainerOptions {
|
|
28
|
+
/**
|
|
29
|
+
* Data directory for persistence (optional override for testing)
|
|
30
|
+
*/
|
|
31
|
+
readonly dataDir?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Logger instance (optional override for testing)
|
|
34
|
+
*/
|
|
35
|
+
readonly logger?: Logger;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Create and configure the service container
|
|
39
|
+
*
|
|
40
|
+
* This is the "Composition Root" - the single place where all
|
|
41
|
+
* dependencies are wired together.
|
|
42
|
+
*
|
|
43
|
+
* @param options - Container configuration options
|
|
44
|
+
* @returns Configured service container with all singleton services
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```typescript
|
|
48
|
+
* // Production usage
|
|
49
|
+
* const container = createContainer();
|
|
50
|
+
* const server = createMcpServer(container);
|
|
51
|
+
*
|
|
52
|
+
* // Test usage with overrides
|
|
53
|
+
* const container = createContainer({
|
|
54
|
+
* dataDir: '/tmp/test-data',
|
|
55
|
+
* logger: testLogger
|
|
56
|
+
* });
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
export declare function createContainer(options?: ContainerOptions): ServiceContainer;
|
|
60
|
+
/**
|
|
61
|
+
* Initialize the global container
|
|
62
|
+
*
|
|
63
|
+
* Should be called once at application startup.
|
|
64
|
+
*
|
|
65
|
+
* @param options - Container configuration options
|
|
66
|
+
* @returns The initialized global container
|
|
67
|
+
* @throws Error if already initialized
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```typescript
|
|
71
|
+
* // In main entry point
|
|
72
|
+
* const container = initializeGlobalContainer();
|
|
73
|
+
* const server = createMcpServer(container);
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
export declare function initializeGlobalContainer(options?: ContainerOptions): ServiceContainer;
|
|
77
|
+
/**
|
|
78
|
+
* Get the global container instance
|
|
79
|
+
*
|
|
80
|
+
* @returns The global container
|
|
81
|
+
* @throws Error if not initialized
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```typescript
|
|
85
|
+
* const container = getGlobalContainer();
|
|
86
|
+
* const tasks = await container.taskStore.getAllAsync();
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
export declare function getGlobalContainer(): ServiceContainer;
|
|
90
|
+
/**
|
|
91
|
+
* Reset the global container (for testing)
|
|
92
|
+
*
|
|
93
|
+
* This allows tests to create fresh containers without
|
|
94
|
+
* shared state between test runs.
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* ```typescript
|
|
98
|
+
* // In test teardown
|
|
99
|
+
* afterEach(() => {
|
|
100
|
+
* resetGlobalContainer();
|
|
101
|
+
* });
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
export declare function resetGlobalContainer(): void;
|
|
105
|
+
/**
|
|
106
|
+
* Check if global container is initialized
|
|
107
|
+
*
|
|
108
|
+
* @returns True if initialized, false otherwise
|
|
109
|
+
*/
|
|
110
|
+
export declare function hasGlobalContainer(): boolean;
|
|
111
|
+
//# sourceMappingURL=container.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../../src/server/container.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAEnC,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEjE;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAClC,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC,QAAQ,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;CAC/C;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAE1B;;OAEG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,eAAe,CAC7B,OAAO,GAAE,gBAAqB,GAC7B,gBAAgB,CAsBlB;AAkBD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,GAAE,gBAAqB,GAC7B,gBAAgB,CASlB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,IAAI,gBAAgB,CAQrD;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,oBAAoB,IAAI,IAAI,CAE3C;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,IAAI,OAAO,CAE5C"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dependency Injection Container
|
|
3
|
+
*
|
|
4
|
+
* Manual dependency injection implementation for the MCP server.
|
|
5
|
+
* All services are singletons - created once per container.
|
|
6
|
+
*/
|
|
7
|
+
import { getLogger } from './logger.js';
|
|
8
|
+
import { TaskStore } from '../data/taskStore.js';
|
|
9
|
+
import { MemoryStore } from '../data/memoryStore.js';
|
|
10
|
+
import { RulesStore } from '../data/rulesStore.js';
|
|
11
|
+
import { TaskSearchService } from '../data/taskSearchService.js';
|
|
12
|
+
/**
|
|
13
|
+
* Create and configure the service container
|
|
14
|
+
*
|
|
15
|
+
* This is the "Composition Root" - the single place where all
|
|
16
|
+
* dependencies are wired together.
|
|
17
|
+
*
|
|
18
|
+
* @param options - Container configuration options
|
|
19
|
+
* @returns Configured service container with all singleton services
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* // Production usage
|
|
24
|
+
* const container = createContainer();
|
|
25
|
+
* const server = createMcpServer(container);
|
|
26
|
+
*
|
|
27
|
+
* // Test usage with overrides
|
|
28
|
+
* const container = createContainer({
|
|
29
|
+
* dataDir: '/tmp/test-data',
|
|
30
|
+
* logger: testLogger
|
|
31
|
+
* });
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export function createContainer(options = {}) {
|
|
35
|
+
const { dataDir, logger = getLogger() } = options;
|
|
36
|
+
// Create data layer services
|
|
37
|
+
// All accept optional dataDir for test isolation
|
|
38
|
+
const taskStore = new TaskStore(dataDir);
|
|
39
|
+
const memoryStore = new MemoryStore(dataDir);
|
|
40
|
+
const rulesStore = new RulesStore(dataDir);
|
|
41
|
+
// Create service layer services
|
|
42
|
+
// TaskSearchService is stateless - no dependencies needed
|
|
43
|
+
const taskSearchService = new TaskSearchService();
|
|
44
|
+
// Return immutable container
|
|
45
|
+
// Services are created once and reused (singleton lifetime)
|
|
46
|
+
return Object.freeze({
|
|
47
|
+
logger,
|
|
48
|
+
taskStore,
|
|
49
|
+
memoryStore,
|
|
50
|
+
rulesStore,
|
|
51
|
+
taskSearchService,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Global container instance (optional)
|
|
56
|
+
*
|
|
57
|
+
* While we support a global instance for convenience,
|
|
58
|
+
* prefer explicit dependency passing in production code.
|
|
59
|
+
*
|
|
60
|
+
* Use this only for:
|
|
61
|
+
* - Simple scripts
|
|
62
|
+
* - Top-level initialization
|
|
63
|
+
*
|
|
64
|
+
* Don't use this for:
|
|
65
|
+
* - Service implementations (use constructor injection)
|
|
66
|
+
* - Deep in the call stack (prefer explicit passing)
|
|
67
|
+
*/
|
|
68
|
+
let globalContainer = null;
|
|
69
|
+
/**
|
|
70
|
+
* Initialize the global container
|
|
71
|
+
*
|
|
72
|
+
* Should be called once at application startup.
|
|
73
|
+
*
|
|
74
|
+
* @param options - Container configuration options
|
|
75
|
+
* @returns The initialized global container
|
|
76
|
+
* @throws Error if already initialized
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```typescript
|
|
80
|
+
* // In main entry point
|
|
81
|
+
* const container = initializeGlobalContainer();
|
|
82
|
+
* const server = createMcpServer(container);
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
export function initializeGlobalContainer(options = {}) {
|
|
86
|
+
if (globalContainer !== null) {
|
|
87
|
+
throw new Error('Global container already initialized. Call resetGlobalContainer() first if reinitializing.');
|
|
88
|
+
}
|
|
89
|
+
globalContainer = createContainer(options);
|
|
90
|
+
return globalContainer;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Get the global container instance
|
|
94
|
+
*
|
|
95
|
+
* @returns The global container
|
|
96
|
+
* @throws Error if not initialized
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```typescript
|
|
100
|
+
* const container = getGlobalContainer();
|
|
101
|
+
* const tasks = await container.taskStore.getAllAsync();
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
export function getGlobalContainer() {
|
|
105
|
+
if (globalContainer === null) {
|
|
106
|
+
throw new Error('Global container not initialized. Call initializeGlobalContainer() first.');
|
|
107
|
+
}
|
|
108
|
+
return globalContainer;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Reset the global container (for testing)
|
|
112
|
+
*
|
|
113
|
+
* This allows tests to create fresh containers without
|
|
114
|
+
* shared state between test runs.
|
|
115
|
+
*
|
|
116
|
+
* @example
|
|
117
|
+
* ```typescript
|
|
118
|
+
* // In test teardown
|
|
119
|
+
* afterEach(() => {
|
|
120
|
+
* resetGlobalContainer();
|
|
121
|
+
* });
|
|
122
|
+
* ```
|
|
123
|
+
*/
|
|
124
|
+
export function resetGlobalContainer() {
|
|
125
|
+
globalContainer = null;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Check if global container is initialized
|
|
129
|
+
*
|
|
130
|
+
* @returns True if initialized, false otherwise
|
|
131
|
+
*/
|
|
132
|
+
export function hasGlobalContainer() {
|
|
133
|
+
return globalContainer !== null;
|
|
134
|
+
}
|
|
135
|
+
//# sourceMappingURL=container.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"container.js","sourceRoot":"","sources":["../../src/server/container.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AA8BjE;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,eAAe,CAC7B,UAA4B,EAAE;IAE9B,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS,EAAE,EAAE,GAAG,OAAO,CAAC;IAElD,6BAA6B;IAC7B,iDAAiD;IACjD,MAAM,SAAS,GAAG,IAAI,SAAS,CAAC,OAAO,CAAC,CAAC;IACzC,MAAM,WAAW,GAAG,IAAI,WAAW,CAAC,OAAO,CAAC,CAAC;IAC7C,MAAM,UAAU,GAAG,IAAI,UAAU,CAAC,OAAO,CAAC,CAAC;IAE3C,gCAAgC;IAChC,0DAA0D;IAC1D,MAAM,iBAAiB,GAAG,IAAI,iBAAiB,EAAE,CAAC;IAElD,6BAA6B;IAC7B,4DAA4D;IAC5D,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,MAAM;QACN,SAAS;QACT,WAAW;QACX,UAAU;QACV,iBAAiB;KAClB,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,IAAI,eAAe,GAA4B,IAAI,CAAC;AAEpD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,yBAAyB,CACvC,UAA4B,EAAE;IAE9B,IAAI,eAAe,KAAK,IAAI,EAAE,CAAC;QAC7B,MAAM,IAAI,KAAK,CACb,4FAA4F,CAC7F,CAAC;IACJ,CAAC;IAED,eAAe,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;IAC3C,OAAO,eAAe,CAAC;AACzB,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,kBAAkB;IAChC,IAAI,eAAe,KAAK,IAAI,EAAE,CAAC;QAC7B,MAAM,IAAI,KAAK,CACb,2EAA2E,CAC5E,CAAC;IACJ,CAAC;IAED,OAAO,eAAe,CAAC;AACzB,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,oBAAoB;IAClC,eAAe,GAAG,IAAI,CAAC;AACzB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,kBAAkB;IAChC,OAAO,eAAe,KAAK,IAAI,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logging Infrastructure with Pino
|
|
3
|
+
*
|
|
4
|
+
* Provides structured logging with:
|
|
5
|
+
* - Sensitive data redaction
|
|
6
|
+
* - Correlation IDs
|
|
7
|
+
* - Environment-aware formatting
|
|
8
|
+
* - Error serialization
|
|
9
|
+
*/
|
|
10
|
+
import { type Logger } from 'pino';
|
|
11
|
+
export type { Logger } from 'pino';
|
|
12
|
+
/**
|
|
13
|
+
* Get or create the root logger
|
|
14
|
+
*
|
|
15
|
+
* Singleton pattern ensures consistent configuration across application
|
|
16
|
+
*/
|
|
17
|
+
export declare function getLogger(): Logger;
|
|
18
|
+
/**
|
|
19
|
+
* Create child logger with correlation ID
|
|
20
|
+
*
|
|
21
|
+
* Child loggers inherit parent configuration but can add context.
|
|
22
|
+
* Correlation IDs enable request tracing across async operations.
|
|
23
|
+
*
|
|
24
|
+
* @param correlationId - Optional correlation ID (generates UUID if not provided)
|
|
25
|
+
* @param context - Additional context to include in all logs
|
|
26
|
+
* @returns Child logger with correlation context
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```typescript
|
|
30
|
+
* const logger = createLogger();
|
|
31
|
+
* logger.info('Processing request');
|
|
32
|
+
*
|
|
33
|
+
* // Later in async operation:
|
|
34
|
+
* logger.debug({ taskId: '123' }, 'Task created');
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export declare function createLogger(correlationId?: string, context?: Record<string, unknown>): Logger;
|
|
38
|
+
/**
|
|
39
|
+
* Create logger with automatic context
|
|
40
|
+
*
|
|
41
|
+
* Factory function for dependency injection pattern.
|
|
42
|
+
* Each module can create its own logger with appropriate context.
|
|
43
|
+
*
|
|
44
|
+
* @param moduleName - Name of the module (e.g., 'TaskStore', 'MCPServer')
|
|
45
|
+
* @returns Logger configured for the module
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```typescript
|
|
49
|
+
* export class TaskStore {
|
|
50
|
+
* private readonly logger = createModuleLogger('TaskStore');
|
|
51
|
+
*
|
|
52
|
+
* async createAsync(task: TaskItem): Promise<TaskItem> {
|
|
53
|
+
* this.logger.info({ taskId: task.id }, 'Creating task');
|
|
54
|
+
* // ... implementation
|
|
55
|
+
* }
|
|
56
|
+
* }
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
export declare function createModuleLogger(moduleName: string): Logger;
|
|
60
|
+
/**
|
|
61
|
+
* Log and rethrow error with context
|
|
62
|
+
*
|
|
63
|
+
* Utility for consistent error logging before rethrowing.
|
|
64
|
+
*
|
|
65
|
+
* @param logger - Logger instance
|
|
66
|
+
* @param error - Error to log
|
|
67
|
+
* @param context - Additional context about the error
|
|
68
|
+
* @param message - Custom error message
|
|
69
|
+
* @throws The original error after logging
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```typescript
|
|
73
|
+
* try {
|
|
74
|
+
* await riskyOperation();
|
|
75
|
+
* } catch (error) {
|
|
76
|
+
* logAndThrow(logger, error, { taskId }, 'Failed to create task');
|
|
77
|
+
* }
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
export declare function logAndThrow(logger: Logger, error: unknown, context: Record<string, unknown>, message: string): never;
|
|
81
|
+
/**
|
|
82
|
+
* Sanitize log data before logging
|
|
83
|
+
*
|
|
84
|
+
* Use this to sanitize data that may contain sensitive information
|
|
85
|
+
* before passing to logger.
|
|
86
|
+
*
|
|
87
|
+
* @param data - Data to sanitize
|
|
88
|
+
* @returns Sanitized copy of data
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```typescript
|
|
92
|
+
* const userData = { name: 'Alice', password: 'secret123' };
|
|
93
|
+
* logger.info(sanitizeLogData(userData), 'User logged in');
|
|
94
|
+
* // Logs: { name: 'Alice', password: '[REDACTED]' }
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
97
|
+
export declare function sanitizeLogData<T>(data: T): T;
|
|
98
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/server/logger.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAa,EAAE,KAAK,MAAM,EAAsB,MAAM,MAAM,CAAC;AAI7D,YAAY,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AA4MnC;;;;GAIG;AACH,wBAAgB,SAAS,IAAI,MAAM,CAKlC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,YAAY,CAC1B,aAAa,CAAC,EAAE,MAAM,EACtB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAChC,MAAM,CASR;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAE7D;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,WAAW,CACzB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,OAAO,EAAE,MAAM,GACd,KAAK,CAaP;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,CAE7C"}
|