@alexnetrebskii/hive-agent 0.5.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/README.md +425 -0
- package/dist/agent.d.ts +24 -0
- package/dist/agent.d.ts.map +1 -0
- package/dist/agent.js +277 -0
- package/dist/agent.js.map +1 -0
- package/dist/context.d.ts +52 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +124 -0
- package/dist/context.js.map +1 -0
- package/dist/executor.d.ts +29 -0
- package/dist/executor.d.ts.map +1 -0
- package/dist/executor.js +349 -0
- package/dist/executor.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/prompt.d.ts +31 -0
- package/dist/prompt.d.ts.map +1 -0
- package/dist/prompt.js +84 -0
- package/dist/prompt.js.map +1 -0
- package/dist/providers/index.d.ts +11 -0
- package/dist/providers/index.d.ts.map +1 -0
- package/dist/providers/index.js +8 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/providers/llm/base.d.ts +7 -0
- package/dist/providers/llm/base.d.ts.map +1 -0
- package/dist/providers/llm/base.js +7 -0
- package/dist/providers/llm/base.js.map +1 -0
- package/dist/providers/llm/claude.d.ts +31 -0
- package/dist/providers/llm/claude.d.ts.map +1 -0
- package/dist/providers/llm/claude.js +180 -0
- package/dist/providers/llm/claude.js.map +1 -0
- package/dist/providers/llm/openai.d.ts +25 -0
- package/dist/providers/llm/openai.d.ts.map +1 -0
- package/dist/providers/llm/openai.js +171 -0
- package/dist/providers/llm/openai.js.map +1 -0
- package/dist/providers/logger/base.d.ts +7 -0
- package/dist/providers/logger/base.d.ts.map +1 -0
- package/dist/providers/logger/base.js +7 -0
- package/dist/providers/logger/base.js.map +1 -0
- package/dist/providers/logger/console.d.ts +29 -0
- package/dist/providers/logger/console.d.ts.map +1 -0
- package/dist/providers/logger/console.js +71 -0
- package/dist/providers/logger/console.js.map +1 -0
- package/dist/providers/repository/base.d.ts +7 -0
- package/dist/providers/repository/base.d.ts.map +1 -0
- package/dist/providers/repository/base.js +7 -0
- package/dist/providers/repository/base.js.map +1 -0
- package/dist/providers/repository/memory.d.ts +21 -0
- package/dist/providers/repository/memory.d.ts.map +1 -0
- package/dist/providers/repository/memory.js +50 -0
- package/dist/providers/repository/memory.js.map +1 -0
- package/dist/review.d.ts +68 -0
- package/dist/review.d.ts.map +1 -0
- package/dist/review.js +263 -0
- package/dist/review.js.map +1 -0
- package/dist/todo.d.ts +73 -0
- package/dist/todo.d.ts.map +1 -0
- package/dist/todo.js +320 -0
- package/dist/todo.js.map +1 -0
- package/dist/types.d.ts +257 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/package.json +43 -0
package/dist/review.d.ts
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Review System
|
|
3
|
+
*
|
|
4
|
+
* Provides self-review capabilities for agents to improve quality.
|
|
5
|
+
*/
|
|
6
|
+
import type { Tool, ReviewResult, ReviewConfig } from './types.js';
|
|
7
|
+
/**
|
|
8
|
+
* Default review categories
|
|
9
|
+
*/
|
|
10
|
+
export declare const DEFAULT_REVIEW_CATEGORIES: string[];
|
|
11
|
+
/**
|
|
12
|
+
* Format review result for display
|
|
13
|
+
*/
|
|
14
|
+
export declare function formatReviewResult(review: ReviewResult): string;
|
|
15
|
+
/**
|
|
16
|
+
* ReviewManager class for tracking reviews during execution
|
|
17
|
+
*/
|
|
18
|
+
export declare class ReviewManager {
|
|
19
|
+
private config;
|
|
20
|
+
private currentReview?;
|
|
21
|
+
private reviewHistory;
|
|
22
|
+
constructor(config: ReviewConfig);
|
|
23
|
+
/**
|
|
24
|
+
* Check if review is enabled
|
|
25
|
+
*/
|
|
26
|
+
isEnabled(): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Check if auto-review is enabled
|
|
29
|
+
*/
|
|
30
|
+
isAutoReviewEnabled(): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Check if approval is required after review
|
|
33
|
+
*/
|
|
34
|
+
requiresApproval(): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Get review categories
|
|
37
|
+
*/
|
|
38
|
+
getCategories(): string[];
|
|
39
|
+
/**
|
|
40
|
+
* Get current review result
|
|
41
|
+
*/
|
|
42
|
+
getCurrentReview(): ReviewResult | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* Get review history
|
|
45
|
+
*/
|
|
46
|
+
getHistory(): ReviewResult[];
|
|
47
|
+
/**
|
|
48
|
+
* Submit a review result
|
|
49
|
+
*/
|
|
50
|
+
submitReview(result: Omit<ReviewResult, 'reviewedAt'>): ReviewResult;
|
|
51
|
+
/**
|
|
52
|
+
* Check if the last review passed
|
|
53
|
+
*/
|
|
54
|
+
lastReviewPassed(): boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Clear current review
|
|
57
|
+
*/
|
|
58
|
+
clearCurrentReview(): void;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Create the __review__ tool
|
|
62
|
+
*/
|
|
63
|
+
export declare function createReviewTool(manager: ReviewManager): Tool;
|
|
64
|
+
/**
|
|
65
|
+
* Build review instructions for system prompt
|
|
66
|
+
*/
|
|
67
|
+
export declare function buildReviewInstructions(config: ReviewConfig): string;
|
|
68
|
+
//# sourceMappingURL=review.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"review.d.ts","sourceRoot":"","sources":["../src/review.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACV,IAAI,EACJ,YAAY,EAGZ,YAAY,EACb,MAAM,YAAY,CAAA;AAEnB;;GAEG;AACH,eAAO,MAAM,yBAAyB,UAKrC,CAAA;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAgC/D;AAED;;GAEG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,MAAM,CAAc;IAC5B,OAAO,CAAC,aAAa,CAAC,CAAc;IACpC,OAAO,CAAC,aAAa,CAAqB;gBAE9B,MAAM,EAAE,YAAY;IAOhC;;OAEG;IACH,SAAS,IAAI,OAAO;IAIpB;;OAEG;IACH,mBAAmB,IAAI,OAAO;IAI9B;;OAEG;IACH,gBAAgB,IAAI,OAAO;IAI3B;;OAEG;IACH,aAAa,IAAI,MAAM,EAAE;IAIzB;;OAEG;IACH,gBAAgB,IAAI,YAAY,GAAG,SAAS;IAI5C;;OAEG;IACH,UAAU,IAAI,YAAY,EAAE;IAI5B;;OAEG;IACH,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,YAAY,EAAE,YAAY,CAAC,GAAG,YAAY;IAYpE;;OAEG;IACH,gBAAgB,IAAI,OAAO;IAI3B;;OAEG;IACH,kBAAkB,IAAI,IAAI;CAG3B;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI,CAiI7D;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAyBpE"}
|
package/dist/review.js
ADDED
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Review System
|
|
3
|
+
*
|
|
4
|
+
* Provides self-review capabilities for agents to improve quality.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Default review categories
|
|
8
|
+
*/
|
|
9
|
+
export const DEFAULT_REVIEW_CATEGORIES = [
|
|
10
|
+
'completeness',
|
|
11
|
+
'correctness',
|
|
12
|
+
'quality',
|
|
13
|
+
'security'
|
|
14
|
+
];
|
|
15
|
+
/**
|
|
16
|
+
* Format review result for display
|
|
17
|
+
*/
|
|
18
|
+
export function formatReviewResult(review) {
|
|
19
|
+
const lines = [];
|
|
20
|
+
const statusEmoji = review.passed ? '✅' : '❌';
|
|
21
|
+
lines.push(`${statusEmoji} Review ${review.passed ? 'Passed' : 'Failed'}`);
|
|
22
|
+
lines.push('');
|
|
23
|
+
lines.push(`Summary: ${review.summary}`);
|
|
24
|
+
if (review.issues.length > 0) {
|
|
25
|
+
lines.push('');
|
|
26
|
+
lines.push('Issues:');
|
|
27
|
+
const severityEmoji = {
|
|
28
|
+
info: 'ℹ️',
|
|
29
|
+
warning: '⚠️',
|
|
30
|
+
error: '❌',
|
|
31
|
+
critical: '🚨'
|
|
32
|
+
};
|
|
33
|
+
for (const issue of review.issues) {
|
|
34
|
+
const emoji = severityEmoji[issue.severity];
|
|
35
|
+
lines.push(` ${emoji} [${issue.severity.toUpperCase()}] ${issue.message}`);
|
|
36
|
+
if (issue.suggestion) {
|
|
37
|
+
lines.push(` → Suggestion: ${issue.suggestion}`);
|
|
38
|
+
}
|
|
39
|
+
if (issue.location) {
|
|
40
|
+
lines.push(` → Location: ${issue.location}`);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return lines.join('\n');
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* ReviewManager class for tracking reviews during execution
|
|
48
|
+
*/
|
|
49
|
+
export class ReviewManager {
|
|
50
|
+
config;
|
|
51
|
+
currentReview;
|
|
52
|
+
reviewHistory = [];
|
|
53
|
+
constructor(config) {
|
|
54
|
+
this.config = {
|
|
55
|
+
categories: DEFAULT_REVIEW_CATEGORIES,
|
|
56
|
+
...config
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Check if review is enabled
|
|
61
|
+
*/
|
|
62
|
+
isEnabled() {
|
|
63
|
+
return this.config.enabled;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Check if auto-review is enabled
|
|
67
|
+
*/
|
|
68
|
+
isAutoReviewEnabled() {
|
|
69
|
+
return this.config.autoReview ?? false;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Check if approval is required after review
|
|
73
|
+
*/
|
|
74
|
+
requiresApproval() {
|
|
75
|
+
return this.config.requireApproval ?? false;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Get review categories
|
|
79
|
+
*/
|
|
80
|
+
getCategories() {
|
|
81
|
+
return this.config.categories || DEFAULT_REVIEW_CATEGORIES;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Get current review result
|
|
85
|
+
*/
|
|
86
|
+
getCurrentReview() {
|
|
87
|
+
return this.currentReview;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Get review history
|
|
91
|
+
*/
|
|
92
|
+
getHistory() {
|
|
93
|
+
return this.reviewHistory;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Submit a review result
|
|
97
|
+
*/
|
|
98
|
+
submitReview(result) {
|
|
99
|
+
const review = {
|
|
100
|
+
...result,
|
|
101
|
+
reviewedAt: Date.now()
|
|
102
|
+
};
|
|
103
|
+
this.currentReview = review;
|
|
104
|
+
this.reviewHistory.push(review);
|
|
105
|
+
return review;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Check if the last review passed
|
|
109
|
+
*/
|
|
110
|
+
lastReviewPassed() {
|
|
111
|
+
return this.currentReview?.passed ?? true;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Clear current review
|
|
115
|
+
*/
|
|
116
|
+
clearCurrentReview() {
|
|
117
|
+
this.currentReview = undefined;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Create the __review__ tool
|
|
122
|
+
*/
|
|
123
|
+
export function createReviewTool(manager) {
|
|
124
|
+
const categories = manager.getCategories();
|
|
125
|
+
return {
|
|
126
|
+
name: '__review__',
|
|
127
|
+
description: `Review your work to ensure quality before completing.
|
|
128
|
+
|
|
129
|
+
Use this tool to:
|
|
130
|
+
- Check your work for completeness and correctness
|
|
131
|
+
- Identify potential issues, bugs, or improvements
|
|
132
|
+
- Ensure security best practices are followed
|
|
133
|
+
- Validate that all requirements are met
|
|
134
|
+
|
|
135
|
+
Review Categories: ${categories.join(', ')}
|
|
136
|
+
|
|
137
|
+
Actions:
|
|
138
|
+
- "submit": Submit a review with findings
|
|
139
|
+
- "check": Check if review is required
|
|
140
|
+
- "status": Get current review status
|
|
141
|
+
|
|
142
|
+
Examples:
|
|
143
|
+
- Submit passing review:
|
|
144
|
+
{ "action": "submit", "passed": true, "summary": "All requirements met", "issues": [] }
|
|
145
|
+
|
|
146
|
+
- Submit review with issues:
|
|
147
|
+
{ "action": "submit", "passed": false, "summary": "Found 2 issues", "issues": [
|
|
148
|
+
{ "severity": "error", "message": "Missing input validation", "suggestion": "Add validation for user input" },
|
|
149
|
+
{ "severity": "warning", "message": "No error handling", "location": "api/handler.ts:25" }
|
|
150
|
+
]}
|
|
151
|
+
|
|
152
|
+
- Check status:
|
|
153
|
+
{ "action": "status" }
|
|
154
|
+
|
|
155
|
+
Severity levels:
|
|
156
|
+
- info: Informational, no action required
|
|
157
|
+
- warning: Should be addressed but not blocking
|
|
158
|
+
- error: Must be fixed before completing
|
|
159
|
+
- critical: Severe issue requiring immediate attention`,
|
|
160
|
+
parameters: {
|
|
161
|
+
type: 'object',
|
|
162
|
+
properties: {
|
|
163
|
+
action: {
|
|
164
|
+
type: 'string',
|
|
165
|
+
enum: ['submit', 'check', 'status'],
|
|
166
|
+
description: 'The action to perform'
|
|
167
|
+
},
|
|
168
|
+
passed: {
|
|
169
|
+
type: 'string',
|
|
170
|
+
description: 'Whether the review passed (for "submit" action)'
|
|
171
|
+
},
|
|
172
|
+
summary: {
|
|
173
|
+
type: 'string',
|
|
174
|
+
description: 'Brief summary of the review (for "submit" action)'
|
|
175
|
+
},
|
|
176
|
+
issues: {
|
|
177
|
+
type: 'string',
|
|
178
|
+
description: 'Array of issues found (for "submit" action)'
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
required: ['action']
|
|
182
|
+
},
|
|
183
|
+
execute: async (params) => {
|
|
184
|
+
const { action, passed, summary, issues } = params;
|
|
185
|
+
switch (action) {
|
|
186
|
+
case 'submit': {
|
|
187
|
+
if (typeof passed !== 'boolean') {
|
|
188
|
+
return { success: false, error: '"passed" is required for submit action' };
|
|
189
|
+
}
|
|
190
|
+
if (!summary) {
|
|
191
|
+
return { success: false, error: '"summary" is required for submit action' };
|
|
192
|
+
}
|
|
193
|
+
const review = manager.submitReview({
|
|
194
|
+
passed,
|
|
195
|
+
summary,
|
|
196
|
+
issues: issues || []
|
|
197
|
+
});
|
|
198
|
+
return {
|
|
199
|
+
success: true,
|
|
200
|
+
data: {
|
|
201
|
+
message: formatReviewResult(review),
|
|
202
|
+
review,
|
|
203
|
+
requiresApproval: manager.requiresApproval() && !passed
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
case 'check': {
|
|
208
|
+
return {
|
|
209
|
+
success: true,
|
|
210
|
+
data: {
|
|
211
|
+
enabled: manager.isEnabled(),
|
|
212
|
+
autoReview: manager.isAutoReviewEnabled(),
|
|
213
|
+
requiresApproval: manager.requiresApproval(),
|
|
214
|
+
categories: manager.getCategories(),
|
|
215
|
+
hasCurrentReview: !!manager.getCurrentReview()
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
case 'status': {
|
|
220
|
+
const current = manager.getCurrentReview();
|
|
221
|
+
const history = manager.getHistory();
|
|
222
|
+
return {
|
|
223
|
+
success: true,
|
|
224
|
+
data: {
|
|
225
|
+
currentReview: current,
|
|
226
|
+
message: current ? formatReviewResult(current) : 'No review submitted yet',
|
|
227
|
+
totalReviews: history.length,
|
|
228
|
+
passedCount: history.filter(r => r.passed).length
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
default:
|
|
233
|
+
return { success: false, error: `Unknown action: ${action}` };
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Build review instructions for system prompt
|
|
240
|
+
*/
|
|
241
|
+
export function buildReviewInstructions(config) {
|
|
242
|
+
if (!config.enabled)
|
|
243
|
+
return '';
|
|
244
|
+
const categories = config.categories || DEFAULT_REVIEW_CATEGORIES;
|
|
245
|
+
const lines = [
|
|
246
|
+
'',
|
|
247
|
+
'## Review Requirements',
|
|
248
|
+
'',
|
|
249
|
+
'Before completing a task, you should review your work for quality.',
|
|
250
|
+
`Review categories: ${categories.join(', ')}`,
|
|
251
|
+
''
|
|
252
|
+
];
|
|
253
|
+
if (config.autoReview) {
|
|
254
|
+
lines.push('You MUST perform a self-review before completing any significant task.');
|
|
255
|
+
}
|
|
256
|
+
if (config.requireApproval) {
|
|
257
|
+
lines.push('If your review finds errors or critical issues, you must fix them before completing.');
|
|
258
|
+
}
|
|
259
|
+
lines.push('');
|
|
260
|
+
lines.push('Use the __review__ tool to submit your review findings.');
|
|
261
|
+
return lines.join('\n');
|
|
262
|
+
}
|
|
263
|
+
//# sourceMappingURL=review.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"review.js","sourceRoot":"","sources":["../src/review.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAUH;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,cAAc;IACd,aAAa;IACb,SAAS;IACT,UAAU;CACX,CAAA;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAAoB;IACrD,MAAM,KAAK,GAAa,EAAE,CAAA;IAE1B,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAA;IAC7C,KAAK,CAAC,IAAI,CAAC,GAAG,WAAW,WAAW,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAA;IAC1E,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IACd,KAAK,CAAC,IAAI,CAAC,YAAY,MAAM,CAAC,OAAO,EAAE,CAA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AI,CAAC,EAAE;QAC7C,EAAE;KACH,CAAA;IAED,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;QACtB,KAAK,CAAC,IAAI,CAAC,wEAAwE,CAAC,CAAA;IACtF,CAAC;IAED,IAAI,MAAM,CAAC,eAAe,EAAE,CAAC;QAC3B,KAAK,CAAC,IAAI,CAAC,sFAAsF,CAAC,CAAA;IACpG,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IACd,KAAK,CAAC,IAAI,CAAC,yDAAyD,CAAC,CAAA;IAErE,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACzB,CAAC"}
|
package/dist/todo.d.ts
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Todo List Management
|
|
3
|
+
*
|
|
4
|
+
* Provides todo list functionality for agents to track and execute tasks.
|
|
5
|
+
*/
|
|
6
|
+
import type { Tool, TodoItem, TodoStatus } from './types.js';
|
|
7
|
+
/**
|
|
8
|
+
* Format todo list for display
|
|
9
|
+
*/
|
|
10
|
+
export declare function formatTodoList(todos: TodoItem[]): string;
|
|
11
|
+
/**
|
|
12
|
+
* Create the TodoManager class for tracking todos during execution
|
|
13
|
+
*/
|
|
14
|
+
export declare class TodoManager {
|
|
15
|
+
private items;
|
|
16
|
+
private currentTaskId?;
|
|
17
|
+
/**
|
|
18
|
+
* Get all todo items
|
|
19
|
+
*/
|
|
20
|
+
getAll(): TodoItem[];
|
|
21
|
+
/**
|
|
22
|
+
* Get current task being worked on
|
|
23
|
+
*/
|
|
24
|
+
getCurrentTask(): TodoItem | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* Add a new todo item
|
|
27
|
+
*/
|
|
28
|
+
add(content: string, activeForm?: string): TodoItem;
|
|
29
|
+
/**
|
|
30
|
+
* Set multiple todos at once (replaces existing)
|
|
31
|
+
*/
|
|
32
|
+
setAll(todos: Array<{
|
|
33
|
+
content: string;
|
|
34
|
+
activeForm?: string;
|
|
35
|
+
status?: TodoStatus;
|
|
36
|
+
}>): TodoItem[];
|
|
37
|
+
/**
|
|
38
|
+
* Mark a todo as in progress
|
|
39
|
+
*/
|
|
40
|
+
startTask(id: string): TodoItem | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* Mark a todo as completed and start next
|
|
43
|
+
*/
|
|
44
|
+
completeTask(id: string): {
|
|
45
|
+
completed: TodoItem;
|
|
46
|
+
next?: TodoItem;
|
|
47
|
+
} | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* Complete current task and move to next
|
|
50
|
+
*/
|
|
51
|
+
completeCurrentAndNext(): {
|
|
52
|
+
completed?: TodoItem;
|
|
53
|
+
next?: TodoItem;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Check if all tasks are completed
|
|
57
|
+
*/
|
|
58
|
+
isAllCompleted(): boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Get progress stats
|
|
61
|
+
*/
|
|
62
|
+
getProgress(): {
|
|
63
|
+
total: number;
|
|
64
|
+
completed: number;
|
|
65
|
+
pending: number;
|
|
66
|
+
inProgress: number;
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Create the __todo__ tool
|
|
71
|
+
*/
|
|
72
|
+
export declare function createTodoTool(manager: TodoManager): Tool;
|
|
73
|
+
//# sourceMappingURL=todo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"todo.d.ts","sourceRoot":"","sources":["../src/todo.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAY,MAAM,YAAY,CAAA;AAStE;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,MAAM,CAqBxD;AAED;;GAEG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,KAAK,CAAmC;IAChD,OAAO,CAAC,aAAa,CAAC,CAAQ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