@dexto/tools-todo 1.5.8 → 1.6.1

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.
@@ -1,11 +1,10 @@
1
1
  /**
2
2
  * Todo Service Error Codes
3
3
  */
4
- declare enum TodoErrorCode {
4
+ export declare enum TodoErrorCode {
5
5
  SERVICE_NOT_INITIALIZED = "TODO_SERVICE_NOT_INITIALIZED",
6
6
  TODO_LIMIT_EXCEEDED = "TODO_LIMIT_EXCEEDED",
7
7
  INVALID_TODO_STATUS = "TODO_INVALID_TODO_STATUS",
8
8
  DATABASE_ERROR = "TODO_DATABASE_ERROR"
9
9
  }
10
-
11
- export { TodoErrorCode };
10
+ //# sourceMappingURL=error-codes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-codes.d.ts","sourceRoot":"","sources":["../src/error-codes.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,oBAAY,aAAa;IAErB,uBAAuB,iCAAiC;IAGxD,mBAAmB,wBAAwB;IAC3C,mBAAmB,6BAA6B;IAGhD,cAAc,wBAAwB;CACzC"}
package/dist/errors.d.ts CHANGED
@@ -1,15 +1,13 @@
1
- import { DextoRuntimeError } from '@dexto/core';
2
-
3
1
  /**
4
2
  * Todo Service Errors
5
3
  *
6
4
  * Error factory for todo list management operations
7
5
  */
8
-
6
+ import { DextoRuntimeError } from '@dexto/core';
9
7
  /**
10
8
  * Factory class for creating Todo-related errors
11
9
  */
12
- declare class TodoError {
10
+ export declare class TodoError {
13
11
  private constructor();
14
12
  /**
15
13
  * Service not initialized error
@@ -28,5 +26,4 @@ declare class TodoError {
28
26
  */
29
27
  static databaseError(operation: string, cause: string): DextoRuntimeError;
30
28
  }
31
-
32
- export { TodoError };
29
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,iBAAiB,EAAyB,MAAM,aAAa,CAAC;AASvE;;GAEG;AACH,qBAAa,SAAS;IAClB,OAAO;IAIP;;OAEG;IACH,MAAM,CAAC,cAAc,IAAI,iBAAiB;IAW1C;;OAEG;IACH,MAAM,CAAC,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,iBAAiB;IAWzE;;OAEG;IACH,MAAM,CAAC,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,iBAAiB;IAUvD;;OAEG;IACH,MAAM,CAAC,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,iBAAiB;CAS5E"}
package/dist/index.cjs CHANGED
@@ -23,10 +23,10 @@ __export(index_exports, {
23
23
  TodoErrorCode: () => import_error_codes.TodoErrorCode,
24
24
  TodoService: () => import_todo_service.TodoService,
25
25
  createTodoWriteTool: () => import_todo_write_tool.createTodoWriteTool,
26
- todoToolsProvider: () => import_tool_provider.todoToolsProvider
26
+ todoToolsFactory: () => import_tool_factory.todoToolsFactory
27
27
  });
28
28
  module.exports = __toCommonJS(index_exports);
29
- var import_tool_provider = require("./tool-provider.js");
29
+ var import_tool_factory = require("./tool-factory.js");
30
30
  var import_todo_service = require("./todo-service.js");
31
31
  var import_errors = require("./errors.js");
32
32
  var import_error_codes = require("./error-codes.js");
@@ -39,5 +39,5 @@ var import_todo_write_tool = require("./todo-write-tool.js");
39
39
  TodoErrorCode,
40
40
  TodoService,
41
41
  createTodoWriteTool,
42
- todoToolsProvider
42
+ todoToolsFactory
43
43
  });
package/dist/index.d.cts CHANGED
@@ -1,8 +1,231 @@
1
- export { todoToolsProvider } from './tool-provider.cjs';
2
- export { TodoService } from './todo-service.cjs';
3
- export { TodoError } from './errors.cjs';
4
- export { TodoErrorCode } from './error-codes.cjs';
5
- export { TODO_STATUS_VALUES, Todo, TodoConfig, TodoInput, TodoStatus, TodoUpdateResult } from './types.cjs';
6
- export { createTodoWriteTool } from './todo-write-tool.cjs';
7
- import 'zod';
8
- import '@dexto/core';
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/index.d.ts CHANGED
@@ -1,8 +1,14 @@
1
- export { todoToolsProvider } from './tool-provider.js';
1
+ /**
2
+ * @dexto/tools-todo
3
+ *
4
+ * Todo/task tracking tools factory for Dexto agents.
5
+ * Provides the todo_write tool for managing task lists.
6
+ */
7
+ export { todoToolsFactory } from './tool-factory.js';
2
8
  export { TodoService } from './todo-service.js';
3
9
  export { TodoError } from './errors.js';
4
10
  export { TodoErrorCode } from './error-codes.js';
5
- export { TODO_STATUS_VALUES, Todo, TodoConfig, TodoInput, TodoStatus, TodoUpdateResult } from './types.js';
11
+ export type { Todo, TodoInput, TodoStatus, TodoUpdateResult, TodoConfig } from './types.js';
12
+ export { TODO_STATUS_VALUES } from './types.js';
6
13
  export { createTodoWriteTool } from './todo-write-tool.js';
7
- import 'zod';
8
- import '@dexto/core';
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAGrD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGjD,YAAY,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC5F,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAGhD,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC"}
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { todoToolsProvider } from "./tool-provider.js";
1
+ import { todoToolsFactory } from "./tool-factory.js";
2
2
  import { TodoService } from "./todo-service.js";
3
3
  import { TodoError } from "./errors.js";
4
4
  import { TodoErrorCode } from "./error-codes.js";
@@ -10,5 +10,5 @@ export {
10
10
  TodoErrorCode,
11
11
  TodoService,
12
12
  createTodoWriteTool,
13
- todoToolsProvider
13
+ todoToolsFactory
14
14
  };
@@ -1,23 +1,22 @@
1
- import { Database, AgentEventBus, IDextoLogger } from '@dexto/core';
2
- import { TodoConfig, TodoInput, TodoUpdateResult, Todo } from './types.js';
3
-
4
1
  /**
5
2
  * Todo Service
6
3
  *
7
4
  * Manages todo lists for tracking agent workflow and task progress.
8
5
  * Emits events through the AgentEventBus using the service:event pattern.
9
6
  */
10
-
7
+ import type { Database, AgentEventBus, Logger } from '@dexto/core';
8
+ import type { Todo, TodoInput, TodoUpdateResult, TodoConfig } from './types.js';
9
+ type TodoEventEmitter = Pick<AgentEventBus, 'emit'>;
11
10
  /**
12
11
  * TodoService - Manages todo lists for agent workflow tracking
13
12
  */
14
- declare class TodoService {
13
+ export declare class TodoService {
15
14
  private database;
16
15
  private eventBus;
17
16
  private logger;
18
17
  private config;
19
18
  private initialized;
20
- constructor(database: Database, eventBus: AgentEventBus, logger: IDextoLogger, config?: TodoConfig);
19
+ constructor(database: Database, eventBus: TodoEventEmitter, logger: Logger, config?: TodoConfig);
21
20
  /**
22
21
  * Initialize the service
23
22
  */
@@ -49,5 +48,5 @@ declare class TodoService {
49
48
  */
50
49
  private validateTodoStatus;
51
50
  }
52
-
53
- export { TodoService };
51
+ export {};
52
+ //# sourceMappingURL=todo-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"todo-service.d.ts","sourceRoot":"","sources":["../src/todo-service.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGnE,OAAO,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,gBAAgB,EAAE,UAAU,EAAc,MAAM,YAAY,CAAC;AAM5F,KAAK,gBAAgB,GAAG,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;AAEpD;;GAEG;AACH,qBAAa,WAAW;IACpB,OAAO,CAAC,QAAQ,CAAW;IAC3B,OAAO,CAAC,QAAQ,CAAmB;IACnC,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,MAAM,CAAuB;IACrC,OAAO,CAAC,WAAW,CAAkB;gBAGjC,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,gBAAgB,EAC1B,MAAM,EAAE,MAAM,EACd,MAAM,GAAE,UAAe;IAW3B;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAUjC;;OAEG;IACG,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAgGxF;;OAEG;IACG,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAoBlD;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAI3B;;;OAGG;IACH,OAAO,CAAC,UAAU;IAIlB;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IAI3B;;OAEG;IACH,OAAO,CAAC,kBAAkB;CAK7B"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * TodoService Unit Tests
3
+ */
4
+ export {};
5
+ //# sourceMappingURL=todo-service.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"todo-service.test.d.ts","sourceRoot":"","sources":["../src/todo-service.test.ts"],"names":[],"mappings":"AAAA;;GAEG"}
@@ -22,6 +22,7 @@ __export(todo_write_tool_exports, {
22
22
  });
23
23
  module.exports = __toCommonJS(todo_write_tool_exports);
24
24
  var import_zod = require("zod");
25
+ var import_core = require("@dexto/core");
25
26
  var import_types = require("./types.js");
26
27
  const TodoItemSchema = import_zod.z.object({
27
28
  content: import_zod.z.string().min(1).describe('Task description in imperative form (e.g., "Fix authentication bug")'),
@@ -44,10 +45,10 @@ const TodoWriteInputSchema = import_zod.z.object({
44
45
  });
45
46
  }
46
47
  }).describe(
47
- "Manage task list for current session. Replaces the entire todo list with the provided tasks."
48
+ "Manage todo list for current session. Replaces the entire todo list with the provided items."
48
49
  );
49
- function createTodoWriteTool(todoService) {
50
- return {
50
+ function createTodoWriteTool(getTodoService) {
51
+ return (0, import_core.defineTool)({
51
52
  id: "todo_write",
52
53
  description: `Track progress on multi-step tasks. Use for:
53
54
  - Implementation tasks with 3+ steps (features, refactors, bug fixes)
@@ -58,16 +59,23 @@ Do NOT use for simple single-file edits, quick questions, or explanations.
58
59
 
59
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.`,
60
61
  inputSchema: TodoWriteInputSchema,
61
- execute: async (input, context) => {
62
- const validatedInput = TodoWriteInputSchema.parse(input);
63
- const sessionId = context?.sessionId ?? "default";
64
- const result = await todoService.updateTodos(sessionId, validatedInput.todos);
62
+ presentation: {
63
+ describeHeader: (input) => (0, import_core.createLocalToolCallHeader)({
64
+ title: "Update Todos",
65
+ argsText: `${input.todos.length} items`
66
+ })
67
+ },
68
+ async execute(input, context) {
69
+ const resolvedTodoService = await getTodoService(context);
70
+ const sessionId = context.sessionId ?? "default";
71
+ await resolvedTodoService.initialize();
72
+ const result = await resolvedTodoService.updateTodos(sessionId, input.todos);
65
73
  const completed = result.todos.filter((t) => t.status === "completed").length;
66
74
  const inProgress = result.todos.filter((t) => t.status === "in_progress").length;
67
75
  const pending = result.todos.filter((t) => t.status === "pending").length;
68
- return `Updated tasks: ${completed}/${result.todos.length} completed${inProgress > 0 ? `, 1 in progress` : ""}${pending > 0 ? `, ${pending} pending` : ""}`;
76
+ return `Updated todos: ${completed}/${result.todos.length} completed${inProgress > 0 ? `, 1 in progress` : ""}${pending > 0 ? `, ${pending} pending` : ""}`;
69
77
  }
70
- };
78
+ });
71
79
  }
72
80
  // Annotate the CommonJS export names for ESM import in node:
73
81
  0 && (module.exports = {
@@ -1,16 +1,57 @@
1
- import { InternalTool } from '@dexto/core';
2
- import { TodoService } from './todo-service.js';
3
- import './types.js';
4
-
5
1
  /**
6
2
  * Todo Write Tool
7
3
  *
8
- * Manages task lists for tracking agent progress and workflow organization
4
+ * Manages todo lists for tracking agent progress and workflow organization
9
5
  */
10
-
6
+ import { z } from 'zod';
7
+ import type { Tool, ToolExecutionContext } from '@dexto/core';
8
+ import type { TodoService } from './todo-service.js';
9
+ /**
10
+ * Zod schema for todo_write tool input
11
+ */
12
+ declare const TodoWriteInputSchema: z.ZodEffects<z.ZodObject<{
13
+ todos: z.ZodArray<z.ZodObject<{
14
+ content: z.ZodString;
15
+ activeForm: z.ZodString;
16
+ status: z.ZodEnum<["pending", "in_progress", "completed"]>;
17
+ }, "strict", z.ZodTypeAny, {
18
+ status: "pending" | "in_progress" | "completed";
19
+ content: string;
20
+ activeForm: string;
21
+ }, {
22
+ status: "pending" | "in_progress" | "completed";
23
+ content: string;
24
+ activeForm: string;
25
+ }>, "many">;
26
+ }, "strict", z.ZodTypeAny, {
27
+ todos: {
28
+ status: "pending" | "in_progress" | "completed";
29
+ content: string;
30
+ activeForm: string;
31
+ }[];
32
+ }, {
33
+ todos: {
34
+ status: "pending" | "in_progress" | "completed";
35
+ content: string;
36
+ activeForm: string;
37
+ }[];
38
+ }>, {
39
+ todos: {
40
+ status: "pending" | "in_progress" | "completed";
41
+ content: string;
42
+ activeForm: string;
43
+ }[];
44
+ }, {
45
+ todos: {
46
+ status: "pending" | "in_progress" | "completed";
47
+ content: string;
48
+ activeForm: string;
49
+ }[];
50
+ }>;
11
51
  /**
12
52
  * Create todo_write internal tool
13
53
  */
14
- declare function createTodoWriteTool(todoService: TodoService): InternalTool;
15
-
16
- export { createTodoWriteTool };
54
+ export type TodoServiceGetter = (context: ToolExecutionContext) => Promise<TodoService>;
55
+ export declare function createTodoWriteTool(getTodoService: TodoServiceGetter): Tool<typeof TodoWriteInputSchema>;
56
+ export {};
57
+ //# sourceMappingURL=todo-write-tool.d.ts.map
@@ -0,0 +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,CAwCnC"}
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod";
2
+ import { createLocalToolCallHeader, defineTool } from "@dexto/core";
2
3
  import { TODO_STATUS_VALUES } from "./types.js";
3
4
  const TodoItemSchema = z.object({
4
5
  content: z.string().min(1).describe('Task description in imperative form (e.g., "Fix authentication bug")'),
@@ -21,10 +22,10 @@ const TodoWriteInputSchema = z.object({
21
22
  });
22
23
  }
23
24
  }).describe(
24
- "Manage task list for current session. Replaces the entire todo list with the provided tasks."
25
+ "Manage todo list for current session. Replaces the entire todo list with the provided items."
25
26
  );
26
- function createTodoWriteTool(todoService) {
27
- return {
27
+ function createTodoWriteTool(getTodoService) {
28
+ return defineTool({
28
29
  id: "todo_write",
29
30
  description: `Track progress on multi-step tasks. Use for:
30
31
  - Implementation tasks with 3+ steps (features, refactors, bug fixes)
@@ -35,16 +36,23 @@ Do NOT use for simple single-file edits, quick questions, or explanations.
35
36
 
36
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.`,
37
38
  inputSchema: TodoWriteInputSchema,
38
- execute: async (input, context) => {
39
- const validatedInput = TodoWriteInputSchema.parse(input);
40
- const sessionId = context?.sessionId ?? "default";
41
- const result = await todoService.updateTodos(sessionId, validatedInput.todos);
39
+ presentation: {
40
+ describeHeader: (input) => createLocalToolCallHeader({
41
+ title: "Update Todos",
42
+ argsText: `${input.todos.length} items`
43
+ })
44
+ },
45
+ async execute(input, context) {
46
+ const resolvedTodoService = await getTodoService(context);
47
+ const sessionId = context.sessionId ?? "default";
48
+ await resolvedTodoService.initialize();
49
+ const result = await resolvedTodoService.updateTodos(sessionId, input.todos);
42
50
  const completed = result.todos.filter((t) => t.status === "completed").length;
43
51
  const inProgress = result.todos.filter((t) => t.status === "in_progress").length;
44
52
  const pending = result.todos.filter((t) => t.status === "pending").length;
45
- return `Updated tasks: ${completed}/${result.todos.length} completed${inProgress > 0 ? `, 1 in progress` : ""}${pending > 0 ? `, ${pending} pending` : ""}`;
53
+ return `Updated todos: ${completed}/${result.todos.length} completed${inProgress > 0 ? `, 1 in progress` : ""}${pending > 0 ? `, ${pending} pending` : ""}`;
46
54
  }
47
- };
55
+ });
48
56
  }
49
57
  export {
50
58
  createTodoWriteTool
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var tool_factory_config_exports = {};
20
+ __export(tool_factory_config_exports, {
21
+ TodoToolsConfigSchema: () => TodoToolsConfigSchema
22
+ });
23
+ module.exports = __toCommonJS(tool_factory_config_exports);
24
+ var import_zod = require("zod");
25
+ const DEFAULT_MAX_TODOS_PER_SESSION = 100;
26
+ const DEFAULT_ENABLE_EVENTS = true;
27
+ const TodoToolsConfigSchema = import_zod.z.object({
28
+ type: import_zod.z.literal("todo-tools"),
29
+ maxTodosPerSession: import_zod.z.number().int().positive().default(DEFAULT_MAX_TODOS_PER_SESSION).describe(`Maximum todos per session (default: ${DEFAULT_MAX_TODOS_PER_SESSION})`),
30
+ enableEvents: import_zod.z.boolean().default(DEFAULT_ENABLE_EVENTS).describe("Enable real-time events for todo updates")
31
+ }).strict();
32
+ // Annotate the CommonJS export names for ESM import in node:
33
+ 0 && (module.exports = {
34
+ TodoToolsConfigSchema
35
+ });
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Todo Tools Factory
3
+ *
4
+ * Provides task tracking tools by wrapping TodoService.
5
+ * When registered, the factory initializes TodoService and creates the
6
+ * todo_write tool for managing task lists.
7
+ */
8
+ import { z } from 'zod';
9
+ /**
10
+ * Configuration schema for Todo tools factory.
11
+ */
12
+ export declare const TodoToolsConfigSchema: z.ZodObject<{
13
+ type: z.ZodLiteral<"todo-tools">;
14
+ maxTodosPerSession: z.ZodDefault<z.ZodNumber>;
15
+ enableEvents: z.ZodDefault<z.ZodBoolean>;
16
+ }, "strict", z.ZodTypeAny, {
17
+ maxTodosPerSession: number;
18
+ enableEvents: boolean;
19
+ type: "todo-tools";
20
+ }, {
21
+ type: "todo-tools";
22
+ maxTodosPerSession?: number | undefined;
23
+ enableEvents?: boolean | undefined;
24
+ }>;
25
+ export type TodoToolsConfig = z.output<typeof TodoToolsConfigSchema>;
26
+ //# sourceMappingURL=tool-factory-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-factory-config.d.ts","sourceRoot":"","sources":["../src/tool-factory-config.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB;;GAEG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;EAcrB,CAAC;AAEd,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { z } from "zod";
2
+ const DEFAULT_MAX_TODOS_PER_SESSION = 100;
3
+ const DEFAULT_ENABLE_EVENTS = true;
4
+ const TodoToolsConfigSchema = z.object({
5
+ type: z.literal("todo-tools"),
6
+ maxTodosPerSession: z.number().int().positive().default(DEFAULT_MAX_TODOS_PER_SESSION).describe(`Maximum todos per session (default: ${DEFAULT_MAX_TODOS_PER_SESSION})`),
7
+ enableEvents: z.boolean().default(DEFAULT_ENABLE_EVENTS).describe("Enable real-time events for todo updates")
8
+ }).strict();
9
+ export {
10
+ TodoToolsConfigSchema
11
+ };
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var tool_factory_exports = {};
20
+ __export(tool_factory_exports, {
21
+ todoToolsFactory: () => todoToolsFactory
22
+ });
23
+ module.exports = __toCommonJS(tool_factory_exports);
24
+ var import_core = require("@dexto/core");
25
+ var import_todo_service = require("./todo-service.js");
26
+ var import_todo_write_tool = require("./todo-write-tool.js");
27
+ var import_tool_factory_config = require("./tool-factory-config.js");
28
+ const todoToolsFactory = {
29
+ configSchema: import_tool_factory_config.TodoToolsConfigSchema,
30
+ metadata: {
31
+ displayName: "Todo Tools",
32
+ description: "Todo tracking and workflow management (todo_write)",
33
+ category: "workflow"
34
+ },
35
+ create: (config) => {
36
+ let todoService;
37
+ const getTodoService = async (context) => {
38
+ if (todoService) {
39
+ return todoService;
40
+ }
41
+ const logger = context.logger;
42
+ const database = context.storage?.database;
43
+ if (!database) {
44
+ throw import_core.ToolError.configInvalid(
45
+ "todo-tools requires ToolExecutionContext.storage.database"
46
+ );
47
+ }
48
+ const agent = context.agent;
49
+ if (!agent) {
50
+ throw import_core.ToolError.configInvalid("todo-tools requires ToolExecutionContext.agent");
51
+ }
52
+ todoService = new import_todo_service.TodoService(database, agent, logger, {
53
+ maxTodosPerSession: config.maxTodosPerSession,
54
+ enableEvents: config.enableEvents
55
+ });
56
+ return todoService;
57
+ };
58
+ return [(0, import_todo_write_tool.createTodoWriteTool)(getTodoService)];
59
+ }
60
+ };
61
+ // Annotate the CommonJS export names for ESM import in node:
62
+ 0 && (module.exports = {
63
+ todoToolsFactory
64
+ });
@@ -0,0 +1,4 @@
1
+ import type { ToolFactory } from '@dexto/agent-config';
2
+ import { type TodoToolsConfig } from './tool-factory-config.js';
3
+ export declare const todoToolsFactory: ToolFactory<TodoToolsConfig>;
4
+ //# sourceMappingURL=tool-factory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-factory.d.ts","sourceRoot":"","sources":["../src/tool-factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAKvD,OAAO,EAAyB,KAAK,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAEvF,eAAO,MAAM,gBAAgB,EAAE,WAAW,CAAC,eAAe,CAsCzD,CAAC"}
@@ -0,0 +1,40 @@
1
+ import { ToolError } from "@dexto/core";
2
+ import { TodoService } from "./todo-service.js";
3
+ import { createTodoWriteTool } from "./todo-write-tool.js";
4
+ import { TodoToolsConfigSchema } from "./tool-factory-config.js";
5
+ const todoToolsFactory = {
6
+ configSchema: TodoToolsConfigSchema,
7
+ metadata: {
8
+ displayName: "Todo Tools",
9
+ description: "Todo tracking and workflow management (todo_write)",
10
+ category: "workflow"
11
+ },
12
+ create: (config) => {
13
+ let todoService;
14
+ const getTodoService = async (context) => {
15
+ if (todoService) {
16
+ return todoService;
17
+ }
18
+ const logger = context.logger;
19
+ const database = context.storage?.database;
20
+ if (!database) {
21
+ throw ToolError.configInvalid(
22
+ "todo-tools requires ToolExecutionContext.storage.database"
23
+ );
24
+ }
25
+ const agent = context.agent;
26
+ if (!agent) {
27
+ throw ToolError.configInvalid("todo-tools requires ToolExecutionContext.agent");
28
+ }
29
+ todoService = new TodoService(database, agent, logger, {
30
+ maxTodosPerSession: config.maxTodosPerSession,
31
+ enableEvents: config.enableEvents
32
+ });
33
+ return todoService;
34
+ };
35
+ return [createTodoWriteTool(getTodoService)];
36
+ }
37
+ };
38
+ export {
39
+ todoToolsFactory
40
+ };
package/dist/types.d.ts CHANGED
@@ -7,15 +7,15 @@
7
7
  * Valid todo status values
8
8
  * Centralized constant to prevent duplication across domains
9
9
  */
10
- declare const TODO_STATUS_VALUES: readonly ["pending", "in_progress", "completed"];
10
+ export declare const TODO_STATUS_VALUES: readonly ["pending", "in_progress", "completed"];
11
11
  /**
12
12
  * Todo item status
13
13
  */
14
- type TodoStatus = (typeof TODO_STATUS_VALUES)[number];
14
+ export type TodoStatus = (typeof TODO_STATUS_VALUES)[number];
15
15
  /**
16
16
  * Todo item with system metadata
17
17
  */
18
- interface Todo {
18
+ export interface Todo {
19
19
  id: string;
20
20
  sessionId: string;
21
21
  content: string;
@@ -28,7 +28,7 @@ interface Todo {
28
28
  /**
29
29
  * Todo input from tool (without system metadata)
30
30
  */
31
- interface TodoInput {
31
+ export interface TodoInput {
32
32
  content: string;
33
33
  activeForm: string;
34
34
  status: TodoStatus;
@@ -36,7 +36,7 @@ interface TodoInput {
36
36
  /**
37
37
  * Todo list update result
38
38
  */
39
- interface TodoUpdateResult {
39
+ export interface TodoUpdateResult {
40
40
  todos: Todo[];
41
41
  sessionId: string;
42
42
  created: number;
@@ -46,11 +46,10 @@ interface TodoUpdateResult {
46
46
  /**
47
47
  * Configuration for TodoService
48
48
  */
49
- interface TodoConfig {
49
+ export interface TodoConfig {
50
50
  /** Maximum todos per session */
51
51
  maxTodosPerSession?: number;
52
52
  /** Enable real-time events */
53
53
  enableEvents?: boolean;
54
54
  }
55
-
56
- export { TODO_STATUS_VALUES, type Todo, type TodoConfig, type TodoInput, type TodoStatus, type TodoUpdateResult };
55
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;GAGG;AACH,eAAO,MAAM,kBAAkB,kDAAmD,CAAC;AAEnF;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE7D;;GAEG;AACH,MAAM,WAAW,IAAI;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,UAAU,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,UAAU,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC7B,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACvB,gCAAgC;IAChC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,8BAA8B;IAC9B,YAAY,CAAC,EAAE,OAAO,CAAC;CAC1B"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dexto/tools-todo",
3
- "version": "1.5.8",
4
- "description": "Todo/task tracking tools provider for Dexto agents",
3
+ "version": "1.6.1",
4
+ "description": "Todo/task tracking tools factory for Dexto agents",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",
@@ -20,7 +20,8 @@
20
20
  "dependencies": {
21
21
  "nanoid": "^5.0.9",
22
22
  "zod": "^3.25.0",
23
- "@dexto/core": "1.5.8"
23
+ "@dexto/core": "1.6.1",
24
+ "@dexto/agent-config": "1.6.1"
24
25
  },
25
26
  "devDependencies": {
26
27
  "tsup": "^8.0.0",
@@ -32,7 +33,7 @@
32
33
  "README.md"
33
34
  ],
34
35
  "scripts": {
35
- "build": "tsup",
36
+ "build": "tsup && node ../../scripts/clean-tsbuildinfo.mjs && tsc -b tsconfig.json --emitDeclarationOnly",
36
37
  "typecheck": "tsc --noEmit",
37
38
  "clean": "rm -rf dist"
38
39
  }
@@ -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 };
@@ -1,53 +0,0 @@
1
- import { Database, AgentEventBus, IDextoLogger } 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
- /**
12
- * TodoService - Manages todo lists for agent workflow tracking
13
- */
14
- declare class TodoService {
15
- private database;
16
- private eventBus;
17
- private logger;
18
- private config;
19
- private initialized;
20
- constructor(database: Database, eventBus: AgentEventBus, logger: IDextoLogger, config?: TodoConfig);
21
- /**
22
- * Initialize the service
23
- */
24
- initialize(): Promise<void>;
25
- /**
26
- * Update todos for a session (replaces entire list)
27
- */
28
- updateTodos(sessionId: string, todoInputs: TodoInput[]): Promise<TodoUpdateResult>;
29
- /**
30
- * Get todos for a session
31
- */
32
- getTodos(sessionId: string): Promise<Todo[]>;
33
- /**
34
- * Generate database key for session todos
35
- */
36
- private getTodosDatabaseKey;
37
- /**
38
- * Generate consistent key for todo matching (content + activeForm)
39
- * Uses JSON encoding to prevent collisions when fields contain delimiters
40
- */
41
- private getTodoKey;
42
- /**
43
- * Generate key from TodoInput
44
- * Uses JSON encoding to prevent collisions when fields contain delimiters
45
- */
46
- private getTodoKeyFromInput;
47
- /**
48
- * Validate todo status
49
- */
50
- private validateTodoStatus;
51
- }
52
-
53
- export { TodoService };
@@ -1,16 +0,0 @@
1
- import { InternalTool } from '@dexto/core';
2
- import { TodoService } from './todo-service.cjs';
3
- import './types.cjs';
4
-
5
- /**
6
- * Todo Write Tool
7
- *
8
- * Manages task lists for tracking agent progress and workflow organization
9
- */
10
-
11
- /**
12
- * Create todo_write internal tool
13
- */
14
- declare function createTodoWriteTool(todoService: TodoService): InternalTool;
15
-
16
- export { createTodoWriteTool };
@@ -1,68 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var tool_provider_exports = {};
20
- __export(tool_provider_exports, {
21
- todoToolsProvider: () => todoToolsProvider
22
- });
23
- module.exports = __toCommonJS(tool_provider_exports);
24
- var import_zod = require("zod");
25
- var import_todo_service = require("./todo-service.js");
26
- var import_todo_write_tool = require("./todo-write-tool.js");
27
- const DEFAULT_MAX_TODOS_PER_SESSION = 100;
28
- const DEFAULT_ENABLE_EVENTS = true;
29
- const TodoToolsConfigSchema = import_zod.z.object({
30
- type: import_zod.z.literal("todo-tools"),
31
- maxTodosPerSession: import_zod.z.number().int().positive().default(DEFAULT_MAX_TODOS_PER_SESSION).describe(`Maximum todos per session (default: ${DEFAULT_MAX_TODOS_PER_SESSION})`),
32
- enableEvents: import_zod.z.boolean().default(DEFAULT_ENABLE_EVENTS).describe("Enable real-time events for todo updates")
33
- }).strict();
34
- const todoToolsProvider = {
35
- type: "todo-tools",
36
- configSchema: TodoToolsConfigSchema,
37
- create: (config, context) => {
38
- const { logger, agent, services } = context;
39
- logger.debug("Creating TodoService for todo tools");
40
- const storageManager = services?.storageManager;
41
- if (!storageManager) {
42
- throw new Error(
43
- "TodoService requires storageManager service. Ensure it is available in ToolCreationContext."
44
- );
45
- }
46
- const database = storageManager.getDatabase();
47
- const eventBus = agent.agentEventBus;
48
- const todoService = new import_todo_service.TodoService(database, eventBus, logger, {
49
- maxTodosPerSession: config.maxTodosPerSession,
50
- enableEvents: config.enableEvents
51
- });
52
- todoService.initialize().catch((error) => {
53
- const message = error instanceof Error ? error.message : String(error);
54
- logger.error(`TodoToolsProvider.create: Failed to initialize TodoService: ${message}`);
55
- });
56
- logger.debug("TodoService created - initialization will complete on first tool use");
57
- return [(0, import_todo_write_tool.createTodoWriteTool)(todoService)];
58
- },
59
- metadata: {
60
- displayName: "Todo Tools",
61
- description: "Task tracking and workflow management (todo_write)",
62
- category: "workflow"
63
- }
64
- };
65
- // Annotate the CommonJS export names for ESM import in node:
66
- 0 && (module.exports = {
67
- todoToolsProvider
68
- });
@@ -1,39 +0,0 @@
1
- import { z } from 'zod';
2
- import { CustomToolProvider } from '@dexto/core';
3
-
4
- /**
5
- * Todo Tools Provider
6
- *
7
- * Provides task tracking tools by wrapping TodoService.
8
- * When registered, the provider initializes TodoService and creates the
9
- * todo_write tool for managing task lists.
10
- */
11
-
12
- /**
13
- * Configuration schema for Todo tools provider.
14
- */
15
- declare const TodoToolsConfigSchema: z.ZodObject<{
16
- type: z.ZodLiteral<"todo-tools">;
17
- maxTodosPerSession: z.ZodDefault<z.ZodNumber>;
18
- enableEvents: z.ZodDefault<z.ZodBoolean>;
19
- }, "strict", z.ZodTypeAny, {
20
- maxTodosPerSession: number;
21
- enableEvents: boolean;
22
- type: "todo-tools";
23
- }, {
24
- type: "todo-tools";
25
- maxTodosPerSession?: number | undefined;
26
- enableEvents?: boolean | undefined;
27
- }>;
28
- type TodoToolsConfig = z.output<typeof TodoToolsConfigSchema>;
29
- /**
30
- * Todo tools provider.
31
- *
32
- * Wraps TodoService and provides the todo_write tool for managing task lists.
33
- *
34
- * When registered via customToolRegistry, TodoService is automatically
35
- * initialized and the todo_write tool becomes available to the agent.
36
- */
37
- declare const todoToolsProvider: CustomToolProvider<'todo-tools', TodoToolsConfig>;
38
-
39
- export { todoToolsProvider };
@@ -1,39 +0,0 @@
1
- import { z } from 'zod';
2
- import { CustomToolProvider } from '@dexto/core';
3
-
4
- /**
5
- * Todo Tools Provider
6
- *
7
- * Provides task tracking tools by wrapping TodoService.
8
- * When registered, the provider initializes TodoService and creates the
9
- * todo_write tool for managing task lists.
10
- */
11
-
12
- /**
13
- * Configuration schema for Todo tools provider.
14
- */
15
- declare const TodoToolsConfigSchema: z.ZodObject<{
16
- type: z.ZodLiteral<"todo-tools">;
17
- maxTodosPerSession: z.ZodDefault<z.ZodNumber>;
18
- enableEvents: z.ZodDefault<z.ZodBoolean>;
19
- }, "strict", z.ZodTypeAny, {
20
- maxTodosPerSession: number;
21
- enableEvents: boolean;
22
- type: "todo-tools";
23
- }, {
24
- type: "todo-tools";
25
- maxTodosPerSession?: number | undefined;
26
- enableEvents?: boolean | undefined;
27
- }>;
28
- type TodoToolsConfig = z.output<typeof TodoToolsConfigSchema>;
29
- /**
30
- * Todo tools provider.
31
- *
32
- * Wraps TodoService and provides the todo_write tool for managing task lists.
33
- *
34
- * When registered via customToolRegistry, TodoService is automatically
35
- * initialized and the todo_write tool becomes available to the agent.
36
- */
37
- declare const todoToolsProvider: CustomToolProvider<'todo-tools', TodoToolsConfig>;
38
-
39
- export { todoToolsProvider };
@@ -1,44 +0,0 @@
1
- import { z } from "zod";
2
- import { TodoService } from "./todo-service.js";
3
- import { createTodoWriteTool } from "./todo-write-tool.js";
4
- const DEFAULT_MAX_TODOS_PER_SESSION = 100;
5
- const DEFAULT_ENABLE_EVENTS = true;
6
- const TodoToolsConfigSchema = z.object({
7
- type: z.literal("todo-tools"),
8
- maxTodosPerSession: z.number().int().positive().default(DEFAULT_MAX_TODOS_PER_SESSION).describe(`Maximum todos per session (default: ${DEFAULT_MAX_TODOS_PER_SESSION})`),
9
- enableEvents: z.boolean().default(DEFAULT_ENABLE_EVENTS).describe("Enable real-time events for todo updates")
10
- }).strict();
11
- const todoToolsProvider = {
12
- type: "todo-tools",
13
- configSchema: TodoToolsConfigSchema,
14
- create: (config, context) => {
15
- const { logger, agent, services } = context;
16
- logger.debug("Creating TodoService for todo tools");
17
- const storageManager = services?.storageManager;
18
- if (!storageManager) {
19
- throw new Error(
20
- "TodoService requires storageManager service. Ensure it is available in ToolCreationContext."
21
- );
22
- }
23
- const database = storageManager.getDatabase();
24
- const eventBus = agent.agentEventBus;
25
- const todoService = new TodoService(database, eventBus, logger, {
26
- maxTodosPerSession: config.maxTodosPerSession,
27
- enableEvents: config.enableEvents
28
- });
29
- todoService.initialize().catch((error) => {
30
- const message = error instanceof Error ? error.message : String(error);
31
- logger.error(`TodoToolsProvider.create: Failed to initialize TodoService: ${message}`);
32
- });
33
- logger.debug("TodoService created - initialization will complete on first tool use");
34
- return [createTodoWriteTool(todoService)];
35
- },
36
- metadata: {
37
- displayName: "Todo Tools",
38
- description: "Task tracking and workflow management (todo_write)",
39
- category: "workflow"
40
- }
41
- };
42
- export {
43
- todoToolsProvider
44
- };
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 };