@dexto/tools-todo 1.6.0 → 1.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.cts +231 -10
- package/dist/todo-write-tool.cjs +6 -1
- package/dist/todo-write-tool.d.ts.map +1 -1
- package/dist/todo-write-tool.js +7 -2
- package/package.json +4 -4
- package/dist/error-codes.d.cts +0 -11
- package/dist/errors.d.cts +0 -32
- package/dist/todo-service.d.cts +0 -54
- package/dist/todo-write-tool.d.cts +0 -60
- package/dist/tool-factory-config.d.cts +0 -29
- package/dist/tool-factory.d.cts +0 -7
- package/dist/types.d.cts +0 -56
package/dist/index.d.cts
CHANGED
|
@@ -1,10 +1,231 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { ToolFactory } from '@dexto/agent-config';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { Database, AgentEventBus, Logger, DextoRuntimeError, ToolExecutionContext, Tool } from '@dexto/core';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Todo Tools Factory
|
|
7
|
+
*
|
|
8
|
+
* Provides task tracking tools by wrapping TodoService.
|
|
9
|
+
* When registered, the factory initializes TodoService and creates the
|
|
10
|
+
* todo_write tool for managing task lists.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Configuration schema for Todo tools factory.
|
|
15
|
+
*/
|
|
16
|
+
declare const TodoToolsConfigSchema: z.ZodObject<{
|
|
17
|
+
type: z.ZodLiteral<"todo-tools">;
|
|
18
|
+
maxTodosPerSession: z.ZodDefault<z.ZodNumber>;
|
|
19
|
+
enableEvents: z.ZodDefault<z.ZodBoolean>;
|
|
20
|
+
}, "strict", z.ZodTypeAny, {
|
|
21
|
+
maxTodosPerSession: number;
|
|
22
|
+
enableEvents: boolean;
|
|
23
|
+
type: "todo-tools";
|
|
24
|
+
}, {
|
|
25
|
+
type: "todo-tools";
|
|
26
|
+
maxTodosPerSession?: number | undefined;
|
|
27
|
+
enableEvents?: boolean | undefined;
|
|
28
|
+
}>;
|
|
29
|
+
type TodoToolsConfig = z.output<typeof TodoToolsConfigSchema>;
|
|
30
|
+
|
|
31
|
+
declare const todoToolsFactory: ToolFactory<TodoToolsConfig>;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Todo Service Types
|
|
35
|
+
*
|
|
36
|
+
* Types for todo list management and workflow tracking
|
|
37
|
+
*/
|
|
38
|
+
/**
|
|
39
|
+
* Valid todo status values
|
|
40
|
+
* Centralized constant to prevent duplication across domains
|
|
41
|
+
*/
|
|
42
|
+
declare const TODO_STATUS_VALUES: readonly ["pending", "in_progress", "completed"];
|
|
43
|
+
/**
|
|
44
|
+
* Todo item status
|
|
45
|
+
*/
|
|
46
|
+
type TodoStatus = (typeof TODO_STATUS_VALUES)[number];
|
|
47
|
+
/**
|
|
48
|
+
* Todo item with system metadata
|
|
49
|
+
*/
|
|
50
|
+
interface Todo {
|
|
51
|
+
id: string;
|
|
52
|
+
sessionId: string;
|
|
53
|
+
content: string;
|
|
54
|
+
activeForm: string;
|
|
55
|
+
status: TodoStatus;
|
|
56
|
+
position: number;
|
|
57
|
+
createdAt: Date;
|
|
58
|
+
updatedAt: Date;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Todo input from tool (without system metadata)
|
|
62
|
+
*/
|
|
63
|
+
interface TodoInput {
|
|
64
|
+
content: string;
|
|
65
|
+
activeForm: string;
|
|
66
|
+
status: TodoStatus;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Todo list update result
|
|
70
|
+
*/
|
|
71
|
+
interface TodoUpdateResult {
|
|
72
|
+
todos: Todo[];
|
|
73
|
+
sessionId: string;
|
|
74
|
+
created: number;
|
|
75
|
+
updated: number;
|
|
76
|
+
deleted: number;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Configuration for TodoService
|
|
80
|
+
*/
|
|
81
|
+
interface TodoConfig {
|
|
82
|
+
/** Maximum todos per session */
|
|
83
|
+
maxTodosPerSession?: number;
|
|
84
|
+
/** Enable real-time events */
|
|
85
|
+
enableEvents?: boolean;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Todo Service
|
|
90
|
+
*
|
|
91
|
+
* Manages todo lists for tracking agent workflow and task progress.
|
|
92
|
+
* Emits events through the AgentEventBus using the service:event pattern.
|
|
93
|
+
*/
|
|
94
|
+
|
|
95
|
+
type TodoEventEmitter = Pick<AgentEventBus, 'emit'>;
|
|
96
|
+
/**
|
|
97
|
+
* TodoService - Manages todo lists for agent workflow tracking
|
|
98
|
+
*/
|
|
99
|
+
declare class TodoService {
|
|
100
|
+
private database;
|
|
101
|
+
private eventBus;
|
|
102
|
+
private logger;
|
|
103
|
+
private config;
|
|
104
|
+
private initialized;
|
|
105
|
+
constructor(database: Database, eventBus: TodoEventEmitter, logger: Logger, config?: TodoConfig);
|
|
106
|
+
/**
|
|
107
|
+
* Initialize the service
|
|
108
|
+
*/
|
|
109
|
+
initialize(): Promise<void>;
|
|
110
|
+
/**
|
|
111
|
+
* Update todos for a session (replaces entire list)
|
|
112
|
+
*/
|
|
113
|
+
updateTodos(sessionId: string, todoInputs: TodoInput[]): Promise<TodoUpdateResult>;
|
|
114
|
+
/**
|
|
115
|
+
* Get todos for a session
|
|
116
|
+
*/
|
|
117
|
+
getTodos(sessionId: string): Promise<Todo[]>;
|
|
118
|
+
/**
|
|
119
|
+
* Generate database key for session todos
|
|
120
|
+
*/
|
|
121
|
+
private getTodosDatabaseKey;
|
|
122
|
+
/**
|
|
123
|
+
* Generate consistent key for todo matching (content + activeForm)
|
|
124
|
+
* Uses JSON encoding to prevent collisions when fields contain delimiters
|
|
125
|
+
*/
|
|
126
|
+
private getTodoKey;
|
|
127
|
+
/**
|
|
128
|
+
* Generate key from TodoInput
|
|
129
|
+
* Uses JSON encoding to prevent collisions when fields contain delimiters
|
|
130
|
+
*/
|
|
131
|
+
private getTodoKeyFromInput;
|
|
132
|
+
/**
|
|
133
|
+
* Validate todo status
|
|
134
|
+
*/
|
|
135
|
+
private validateTodoStatus;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Todo Service Errors
|
|
140
|
+
*
|
|
141
|
+
* Error factory for todo list management operations
|
|
142
|
+
*/
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Factory class for creating Todo-related errors
|
|
146
|
+
*/
|
|
147
|
+
declare class TodoError {
|
|
148
|
+
private constructor();
|
|
149
|
+
/**
|
|
150
|
+
* Service not initialized error
|
|
151
|
+
*/
|
|
152
|
+
static notInitialized(): DextoRuntimeError;
|
|
153
|
+
/**
|
|
154
|
+
* Todo limit exceeded error
|
|
155
|
+
*/
|
|
156
|
+
static todoLimitExceeded(current: number, max: number): DextoRuntimeError;
|
|
157
|
+
/**
|
|
158
|
+
* Invalid todo status error
|
|
159
|
+
*/
|
|
160
|
+
static invalidStatus(status: string): DextoRuntimeError;
|
|
161
|
+
/**
|
|
162
|
+
* Database error
|
|
163
|
+
*/
|
|
164
|
+
static databaseError(operation: string, cause: string): DextoRuntimeError;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Todo Service Error Codes
|
|
169
|
+
*/
|
|
170
|
+
declare enum TodoErrorCode {
|
|
171
|
+
SERVICE_NOT_INITIALIZED = "TODO_SERVICE_NOT_INITIALIZED",
|
|
172
|
+
TODO_LIMIT_EXCEEDED = "TODO_LIMIT_EXCEEDED",
|
|
173
|
+
INVALID_TODO_STATUS = "TODO_INVALID_TODO_STATUS",
|
|
174
|
+
DATABASE_ERROR = "TODO_DATABASE_ERROR"
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Todo Write Tool
|
|
179
|
+
*
|
|
180
|
+
* Manages todo lists for tracking agent progress and workflow organization
|
|
181
|
+
*/
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Zod schema for todo_write tool input
|
|
185
|
+
*/
|
|
186
|
+
declare const TodoWriteInputSchema: z.ZodEffects<z.ZodObject<{
|
|
187
|
+
todos: z.ZodArray<z.ZodObject<{
|
|
188
|
+
content: z.ZodString;
|
|
189
|
+
activeForm: z.ZodString;
|
|
190
|
+
status: z.ZodEnum<["pending", "in_progress", "completed"]>;
|
|
191
|
+
}, "strict", z.ZodTypeAny, {
|
|
192
|
+
status: "pending" | "in_progress" | "completed";
|
|
193
|
+
content: string;
|
|
194
|
+
activeForm: string;
|
|
195
|
+
}, {
|
|
196
|
+
status: "pending" | "in_progress" | "completed";
|
|
197
|
+
content: string;
|
|
198
|
+
activeForm: string;
|
|
199
|
+
}>, "many">;
|
|
200
|
+
}, "strict", z.ZodTypeAny, {
|
|
201
|
+
todos: {
|
|
202
|
+
status: "pending" | "in_progress" | "completed";
|
|
203
|
+
content: string;
|
|
204
|
+
activeForm: string;
|
|
205
|
+
}[];
|
|
206
|
+
}, {
|
|
207
|
+
todos: {
|
|
208
|
+
status: "pending" | "in_progress" | "completed";
|
|
209
|
+
content: string;
|
|
210
|
+
activeForm: string;
|
|
211
|
+
}[];
|
|
212
|
+
}>, {
|
|
213
|
+
todos: {
|
|
214
|
+
status: "pending" | "in_progress" | "completed";
|
|
215
|
+
content: string;
|
|
216
|
+
activeForm: string;
|
|
217
|
+
}[];
|
|
218
|
+
}, {
|
|
219
|
+
todos: {
|
|
220
|
+
status: "pending" | "in_progress" | "completed";
|
|
221
|
+
content: string;
|
|
222
|
+
activeForm: string;
|
|
223
|
+
}[];
|
|
224
|
+
}>;
|
|
225
|
+
/**
|
|
226
|
+
* Create todo_write internal tool
|
|
227
|
+
*/
|
|
228
|
+
type TodoServiceGetter = (context: ToolExecutionContext) => Promise<TodoService>;
|
|
229
|
+
declare function createTodoWriteTool(getTodoService: TodoServiceGetter): Tool<typeof TodoWriteInputSchema>;
|
|
230
|
+
|
|
231
|
+
export { TODO_STATUS_VALUES, type Todo, type TodoConfig, TodoError, TodoErrorCode, type TodoInput, TodoService, type TodoStatus, type TodoUpdateResult, createTodoWriteTool, todoToolsFactory };
|
package/dist/todo-write-tool.cjs
CHANGED
|
@@ -50,7 +50,6 @@ const TodoWriteInputSchema = import_zod.z.object({
|
|
|
50
50
|
function createTodoWriteTool(getTodoService) {
|
|
51
51
|
return (0, import_core.defineTool)({
|
|
52
52
|
id: "todo_write",
|
|
53
|
-
displayName: "Update Todos",
|
|
54
53
|
description: `Track progress on multi-step tasks. Use for:
|
|
55
54
|
- Implementation tasks with 3+ steps (features, refactors, bug fixes)
|
|
56
55
|
- Tasks where the user asks for a plan or breakdown
|
|
@@ -60,6 +59,12 @@ Do NOT use for simple single-file edits, quick questions, or explanations.
|
|
|
60
59
|
|
|
61
60
|
IMPORTANT: This replaces the entire todo list. Always include ALL tasks (pending, in_progress, completed). Only ONE task should be in_progress at a time. Update status as you work: pending \u2192 in_progress \u2192 completed.`,
|
|
62
61
|
inputSchema: TodoWriteInputSchema,
|
|
62
|
+
presentation: {
|
|
63
|
+
describeHeader: (input) => (0, import_core.createLocalToolCallHeader)({
|
|
64
|
+
title: "Update Todos",
|
|
65
|
+
argsText: `${input.todos.length} items`
|
|
66
|
+
})
|
|
67
|
+
},
|
|
63
68
|
async execute(input, context) {
|
|
64
69
|
const resolvedTodoService = await getTodoService(context);
|
|
65
70
|
const sessionId = context.sessionId ?? "default";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"todo-write-tool.d.ts","sourceRoot":"","sources":["../src/todo-write-tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,IAAI,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AA0BrD;;GAEG;AACH,QAAA,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoBrB,CAAC;AAEN;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,EAAE,oBAAoB,KAAK,OAAO,CAAC,WAAW,CAAC,CAAC;AAExF,wBAAgB,mBAAmB,CAC/B,cAAc,EAAE,iBAAiB,GAClC,IAAI,CAAC,OAAO,oBAAoB,CAAC,
|
|
1
|
+
{"version":3,"file":"todo-write-tool.d.ts","sourceRoot":"","sources":["../src/todo-write-tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,IAAI,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AA0BrD;;GAEG;AACH,QAAA,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoBrB,CAAC;AAEN;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,EAAE,oBAAoB,KAAK,OAAO,CAAC,WAAW,CAAC,CAAC;AAExF,wBAAgB,mBAAmB,CAC/B,cAAc,EAAE,iBAAiB,GAClC,IAAI,CAAC,OAAO,oBAAoB,CAAC,CAwCnC"}
|
package/dist/todo-write-tool.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { defineTool } from "@dexto/core";
|
|
2
|
+
import { createLocalToolCallHeader, defineTool } from "@dexto/core";
|
|
3
3
|
import { TODO_STATUS_VALUES } from "./types.js";
|
|
4
4
|
const TodoItemSchema = z.object({
|
|
5
5
|
content: z.string().min(1).describe('Task description in imperative form (e.g., "Fix authentication bug")'),
|
|
@@ -27,7 +27,6 @@ const TodoWriteInputSchema = z.object({
|
|
|
27
27
|
function createTodoWriteTool(getTodoService) {
|
|
28
28
|
return defineTool({
|
|
29
29
|
id: "todo_write",
|
|
30
|
-
displayName: "Update Todos",
|
|
31
30
|
description: `Track progress on multi-step tasks. Use for:
|
|
32
31
|
- Implementation tasks with 3+ steps (features, refactors, bug fixes)
|
|
33
32
|
- Tasks where the user asks for a plan or breakdown
|
|
@@ -37,6 +36,12 @@ Do NOT use for simple single-file edits, quick questions, or explanations.
|
|
|
37
36
|
|
|
38
37
|
IMPORTANT: This replaces the entire todo list. Always include ALL tasks (pending, in_progress, completed). Only ONE task should be in_progress at a time. Update status as you work: pending \u2192 in_progress \u2192 completed.`,
|
|
39
38
|
inputSchema: TodoWriteInputSchema,
|
|
39
|
+
presentation: {
|
|
40
|
+
describeHeader: (input) => createLocalToolCallHeader({
|
|
41
|
+
title: "Update Todos",
|
|
42
|
+
argsText: `${input.todos.length} items`
|
|
43
|
+
})
|
|
44
|
+
},
|
|
40
45
|
async execute(input, context) {
|
|
41
46
|
const resolvedTodoService = await getTodoService(context);
|
|
42
47
|
const sessionId = context.sessionId ?? "default";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dexto/tools-todo",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.2",
|
|
4
4
|
"description": "Todo/task tracking tools factory for Dexto agents",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"nanoid": "^5.0.9",
|
|
22
22
|
"zod": "^3.25.0",
|
|
23
|
-
"@dexto/agent-config": "1.6.
|
|
24
|
-
"@dexto/core": "1.6.
|
|
23
|
+
"@dexto/agent-config": "1.6.2",
|
|
24
|
+
"@dexto/core": "1.6.2"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"tsup": "^8.0.0",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"README.md"
|
|
34
34
|
],
|
|
35
35
|
"scripts": {
|
|
36
|
-
"build": "tsup",
|
|
36
|
+
"build": "tsup && node ../../scripts/clean-tsbuildinfo.mjs && tsc -b tsconfig.json --emitDeclarationOnly",
|
|
37
37
|
"typecheck": "tsc --noEmit",
|
|
38
38
|
"clean": "rm -rf dist"
|
|
39
39
|
}
|
package/dist/error-codes.d.cts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Todo Service Error Codes
|
|
3
|
-
*/
|
|
4
|
-
declare enum TodoErrorCode {
|
|
5
|
-
SERVICE_NOT_INITIALIZED = "TODO_SERVICE_NOT_INITIALIZED",
|
|
6
|
-
TODO_LIMIT_EXCEEDED = "TODO_LIMIT_EXCEEDED",
|
|
7
|
-
INVALID_TODO_STATUS = "TODO_INVALID_TODO_STATUS",
|
|
8
|
-
DATABASE_ERROR = "TODO_DATABASE_ERROR"
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export { TodoErrorCode };
|
package/dist/errors.d.cts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { DextoRuntimeError } from '@dexto/core';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Todo Service Errors
|
|
5
|
-
*
|
|
6
|
-
* Error factory for todo list management operations
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Factory class for creating Todo-related errors
|
|
11
|
-
*/
|
|
12
|
-
declare class TodoError {
|
|
13
|
-
private constructor();
|
|
14
|
-
/**
|
|
15
|
-
* Service not initialized error
|
|
16
|
-
*/
|
|
17
|
-
static notInitialized(): DextoRuntimeError;
|
|
18
|
-
/**
|
|
19
|
-
* Todo limit exceeded error
|
|
20
|
-
*/
|
|
21
|
-
static todoLimitExceeded(current: number, max: number): DextoRuntimeError;
|
|
22
|
-
/**
|
|
23
|
-
* Invalid todo status error
|
|
24
|
-
*/
|
|
25
|
-
static invalidStatus(status: string): DextoRuntimeError;
|
|
26
|
-
/**
|
|
27
|
-
* Database error
|
|
28
|
-
*/
|
|
29
|
-
static databaseError(operation: string, cause: string): DextoRuntimeError;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export { TodoError };
|
package/dist/todo-service.d.cts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { Database, AgentEventBus, Logger } from '@dexto/core';
|
|
2
|
-
import { TodoConfig, TodoInput, TodoUpdateResult, Todo } from './types.cjs';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Todo Service
|
|
6
|
-
*
|
|
7
|
-
* Manages todo lists for tracking agent workflow and task progress.
|
|
8
|
-
* Emits events through the AgentEventBus using the service:event pattern.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
type TodoEventEmitter = Pick<AgentEventBus, 'emit'>;
|
|
12
|
-
/**
|
|
13
|
-
* TodoService - Manages todo lists for agent workflow tracking
|
|
14
|
-
*/
|
|
15
|
-
declare class TodoService {
|
|
16
|
-
private database;
|
|
17
|
-
private eventBus;
|
|
18
|
-
private logger;
|
|
19
|
-
private config;
|
|
20
|
-
private initialized;
|
|
21
|
-
constructor(database: Database, eventBus: TodoEventEmitter, logger: Logger, config?: TodoConfig);
|
|
22
|
-
/**
|
|
23
|
-
* Initialize the service
|
|
24
|
-
*/
|
|
25
|
-
initialize(): Promise<void>;
|
|
26
|
-
/**
|
|
27
|
-
* Update todos for a session (replaces entire list)
|
|
28
|
-
*/
|
|
29
|
-
updateTodos(sessionId: string, todoInputs: TodoInput[]): Promise<TodoUpdateResult>;
|
|
30
|
-
/**
|
|
31
|
-
* Get todos for a session
|
|
32
|
-
*/
|
|
33
|
-
getTodos(sessionId: string): Promise<Todo[]>;
|
|
34
|
-
/**
|
|
35
|
-
* Generate database key for session todos
|
|
36
|
-
*/
|
|
37
|
-
private getTodosDatabaseKey;
|
|
38
|
-
/**
|
|
39
|
-
* Generate consistent key for todo matching (content + activeForm)
|
|
40
|
-
* Uses JSON encoding to prevent collisions when fields contain delimiters
|
|
41
|
-
*/
|
|
42
|
-
private getTodoKey;
|
|
43
|
-
/**
|
|
44
|
-
* Generate key from TodoInput
|
|
45
|
-
* Uses JSON encoding to prevent collisions when fields contain delimiters
|
|
46
|
-
*/
|
|
47
|
-
private getTodoKeyFromInput;
|
|
48
|
-
/**
|
|
49
|
-
* Validate todo status
|
|
50
|
-
*/
|
|
51
|
-
private validateTodoStatus;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export { TodoService };
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { ToolExecutionContext, Tool } from '@dexto/core';
|
|
3
|
-
import { TodoService } from './todo-service.cjs';
|
|
4
|
-
import './types.cjs';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Todo Write Tool
|
|
8
|
-
*
|
|
9
|
-
* Manages todo lists for tracking agent progress and workflow organization
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Zod schema for todo_write tool input
|
|
14
|
-
*/
|
|
15
|
-
declare const TodoWriteInputSchema: z.ZodEffects<z.ZodObject<{
|
|
16
|
-
todos: z.ZodArray<z.ZodObject<{
|
|
17
|
-
content: z.ZodString;
|
|
18
|
-
activeForm: z.ZodString;
|
|
19
|
-
status: z.ZodEnum<["pending", "in_progress", "completed"]>;
|
|
20
|
-
}, "strict", z.ZodTypeAny, {
|
|
21
|
-
status: "pending" | "in_progress" | "completed";
|
|
22
|
-
content: string;
|
|
23
|
-
activeForm: string;
|
|
24
|
-
}, {
|
|
25
|
-
status: "pending" | "in_progress" | "completed";
|
|
26
|
-
content: string;
|
|
27
|
-
activeForm: string;
|
|
28
|
-
}>, "many">;
|
|
29
|
-
}, "strict", z.ZodTypeAny, {
|
|
30
|
-
todos: {
|
|
31
|
-
status: "pending" | "in_progress" | "completed";
|
|
32
|
-
content: string;
|
|
33
|
-
activeForm: string;
|
|
34
|
-
}[];
|
|
35
|
-
}, {
|
|
36
|
-
todos: {
|
|
37
|
-
status: "pending" | "in_progress" | "completed";
|
|
38
|
-
content: string;
|
|
39
|
-
activeForm: string;
|
|
40
|
-
}[];
|
|
41
|
-
}>, {
|
|
42
|
-
todos: {
|
|
43
|
-
status: "pending" | "in_progress" | "completed";
|
|
44
|
-
content: string;
|
|
45
|
-
activeForm: string;
|
|
46
|
-
}[];
|
|
47
|
-
}, {
|
|
48
|
-
todos: {
|
|
49
|
-
status: "pending" | "in_progress" | "completed";
|
|
50
|
-
content: string;
|
|
51
|
-
activeForm: string;
|
|
52
|
-
}[];
|
|
53
|
-
}>;
|
|
54
|
-
/**
|
|
55
|
-
* Create todo_write internal tool
|
|
56
|
-
*/
|
|
57
|
-
type TodoServiceGetter = (context: ToolExecutionContext) => Promise<TodoService>;
|
|
58
|
-
declare function createTodoWriteTool(getTodoService: TodoServiceGetter): Tool<typeof TodoWriteInputSchema>;
|
|
59
|
-
|
|
60
|
-
export { type TodoServiceGetter, createTodoWriteTool };
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Todo Tools Factory
|
|
5
|
-
*
|
|
6
|
-
* Provides task tracking tools by wrapping TodoService.
|
|
7
|
-
* When registered, the factory initializes TodoService and creates the
|
|
8
|
-
* todo_write tool for managing task lists.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Configuration schema for Todo tools factory.
|
|
13
|
-
*/
|
|
14
|
-
declare const TodoToolsConfigSchema: z.ZodObject<{
|
|
15
|
-
type: z.ZodLiteral<"todo-tools">;
|
|
16
|
-
maxTodosPerSession: z.ZodDefault<z.ZodNumber>;
|
|
17
|
-
enableEvents: z.ZodDefault<z.ZodBoolean>;
|
|
18
|
-
}, "strict", z.ZodTypeAny, {
|
|
19
|
-
maxTodosPerSession: number;
|
|
20
|
-
enableEvents: boolean;
|
|
21
|
-
type: "todo-tools";
|
|
22
|
-
}, {
|
|
23
|
-
type: "todo-tools";
|
|
24
|
-
maxTodosPerSession?: number | undefined;
|
|
25
|
-
enableEvents?: boolean | undefined;
|
|
26
|
-
}>;
|
|
27
|
-
type TodoToolsConfig = z.output<typeof TodoToolsConfigSchema>;
|
|
28
|
-
|
|
29
|
-
export { type TodoToolsConfig, TodoToolsConfigSchema };
|
package/dist/tool-factory.d.cts
DELETED
package/dist/types.d.cts
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Todo Service Types
|
|
3
|
-
*
|
|
4
|
-
* Types for todo list management and workflow tracking
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* Valid todo status values
|
|
8
|
-
* Centralized constant to prevent duplication across domains
|
|
9
|
-
*/
|
|
10
|
-
declare const TODO_STATUS_VALUES: readonly ["pending", "in_progress", "completed"];
|
|
11
|
-
/**
|
|
12
|
-
* Todo item status
|
|
13
|
-
*/
|
|
14
|
-
type TodoStatus = (typeof TODO_STATUS_VALUES)[number];
|
|
15
|
-
/**
|
|
16
|
-
* Todo item with system metadata
|
|
17
|
-
*/
|
|
18
|
-
interface Todo {
|
|
19
|
-
id: string;
|
|
20
|
-
sessionId: string;
|
|
21
|
-
content: string;
|
|
22
|
-
activeForm: string;
|
|
23
|
-
status: TodoStatus;
|
|
24
|
-
position: number;
|
|
25
|
-
createdAt: Date;
|
|
26
|
-
updatedAt: Date;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Todo input from tool (without system metadata)
|
|
30
|
-
*/
|
|
31
|
-
interface TodoInput {
|
|
32
|
-
content: string;
|
|
33
|
-
activeForm: string;
|
|
34
|
-
status: TodoStatus;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Todo list update result
|
|
38
|
-
*/
|
|
39
|
-
interface TodoUpdateResult {
|
|
40
|
-
todos: Todo[];
|
|
41
|
-
sessionId: string;
|
|
42
|
-
created: number;
|
|
43
|
-
updated: number;
|
|
44
|
-
deleted: number;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Configuration for TodoService
|
|
48
|
-
*/
|
|
49
|
-
interface TodoConfig {
|
|
50
|
-
/** Maximum todos per session */
|
|
51
|
-
maxTodosPerSession?: number;
|
|
52
|
-
/** Enable real-time events */
|
|
53
|
-
enableEvents?: boolean;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export { TODO_STATUS_VALUES, type Todo, type TodoConfig, type TodoInput, type TodoStatus, type TodoUpdateResult };
|