@dexto/tools-todo 1.5.8 → 1.6.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.
@@ -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,10 @@
1
- export { todoToolsProvider } from './tool-provider.cjs';
1
+ export { todoToolsFactory } from './tool-factory.cjs';
2
2
  export { TodoService } from './todo-service.cjs';
3
3
  export { TodoError } from './errors.cjs';
4
4
  export { TodoErrorCode } from './error-codes.cjs';
5
5
  export { TODO_STATUS_VALUES, Todo, TodoConfig, TodoInput, TodoStatus, TodoUpdateResult } from './types.cjs';
6
6
  export { createTodoWriteTool } from './todo-write-tool.cjs';
7
+ import '@dexto/agent-config';
8
+ import './tool-factory-config.cjs';
7
9
  import 'zod';
8
10
  import '@dexto/core';
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,4 +1,4 @@
1
- import { Database, AgentEventBus, IDextoLogger } from '@dexto/core';
1
+ import { Database, AgentEventBus, Logger } from '@dexto/core';
2
2
  import { TodoConfig, TodoInput, TodoUpdateResult, Todo } from './types.cjs';
3
3
 
4
4
  /**
@@ -8,6 +8,7 @@ import { TodoConfig, TodoInput, TodoUpdateResult, Todo } from './types.cjs';
8
8
  * Emits events through the AgentEventBus using the service:event pattern.
9
9
  */
10
10
 
11
+ type TodoEventEmitter = Pick<AgentEventBus, 'emit'>;
11
12
  /**
12
13
  * TodoService - Manages todo lists for agent workflow tracking
13
14
  */
@@ -17,7 +18,7 @@ declare class TodoService {
17
18
  private logger;
18
19
  private config;
19
20
  private initialized;
20
- constructor(database: Database, eventBus: AgentEventBus, logger: IDextoLogger, config?: TodoConfig);
21
+ constructor(database: Database, eventBus: TodoEventEmitter, logger: Logger, config?: TodoConfig);
21
22
  /**
22
23
  * Initialize the service
23
24
  */
@@ -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,11 +45,12 @@ 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",
53
+ displayName: "Update Todos",
52
54
  description: `Track progress on multi-step tasks. Use for:
53
55
  - Implementation tasks with 3+ steps (features, refactors, bug fixes)
54
56
  - Tasks where the user asks for a plan or breakdown
@@ -58,16 +60,17 @@ Do NOT use for simple single-file edits, quick questions, or explanations.
58
60
 
59
61
  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
62
  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);
63
+ async execute(input, context) {
64
+ const resolvedTodoService = await getTodoService(context);
65
+ const sessionId = context.sessionId ?? "default";
66
+ await resolvedTodoService.initialize();
67
+ const result = await resolvedTodoService.updateTodos(sessionId, input.todos);
65
68
  const completed = result.todos.filter((t) => t.status === "completed").length;
66
69
  const inProgress = result.todos.filter((t) => t.status === "in_progress").length;
67
70
  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` : ""}`;
71
+ return `Updated todos: ${completed}/${result.todos.length} completed${inProgress > 0 ? `, 1 in progress` : ""}${pending > 0 ? `, ${pending} pending` : ""}`;
69
72
  }
70
- };
73
+ });
71
74
  }
72
75
  // Annotate the CommonJS export names for ESM import in node:
73
76
  0 && (module.exports = {
@@ -1,16 +1,60 @@
1
- import { InternalTool } from '@dexto/core';
1
+ import { z } from 'zod';
2
+ import { ToolExecutionContext, Tool } from '@dexto/core';
2
3
  import { TodoService } from './todo-service.cjs';
3
4
  import './types.cjs';
4
5
 
5
6
  /**
6
7
  * Todo Write Tool
7
8
  *
8
- * Manages task lists for tracking agent progress and workflow organization
9
+ * Manages todo lists for tracking agent progress and workflow organization
9
10
  */
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
+ }>;
11
54
  /**
12
55
  * Create todo_write internal tool
13
56
  */
14
- declare function createTodoWriteTool(todoService: TodoService): InternalTool;
57
+ type TodoServiceGetter = (context: ToolExecutionContext) => Promise<TodoService>;
58
+ declare function createTodoWriteTool(getTodoService: TodoServiceGetter): Tool<typeof TodoWriteInputSchema>;
15
59
 
16
- export { createTodoWriteTool };
60
+ export { type TodoServiceGetter, createTodoWriteTool };
@@ -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,CAiCnC"}
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod";
2
+ import { 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,11 +22,12 @@ 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",
30
+ displayName: "Update Todos",
29
31
  description: `Track progress on multi-step tasks. Use for:
30
32
  - Implementation tasks with 3+ steps (features, refactors, bug fixes)
31
33
  - Tasks where the user asks for a plan or breakdown
@@ -35,16 +37,17 @@ Do NOT use for simple single-file edits, quick questions, or explanations.
35
37
 
36
38
  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
39
  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);
40
+ async execute(input, context) {
41
+ const resolvedTodoService = await getTodoService(context);
42
+ const sessionId = context.sessionId ?? "default";
43
+ await resolvedTodoService.initialize();
44
+ const result = await resolvedTodoService.updateTodos(sessionId, input.todos);
42
45
  const completed = result.todos.filter((t) => t.status === "completed").length;
43
46
  const inProgress = result.todos.filter((t) => t.status === "in_progress").length;
44
47
  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` : ""}`;
48
+ return `Updated todos: ${completed}/${result.todos.length} completed${inProgress > 0 ? `, 1 in progress` : ""}${pending > 0 ? `, ${pending} pending` : ""}`;
46
49
  }
47
- };
50
+ });
48
51
  }
49
52
  export {
50
53
  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
+ });
@@ -1,16 +1,15 @@
1
1
  import { z } from 'zod';
2
- import { CustomToolProvider } from '@dexto/core';
3
2
 
4
3
  /**
5
- * Todo Tools Provider
4
+ * Todo Tools Factory
6
5
  *
7
6
  * Provides task tracking tools by wrapping TodoService.
8
- * When registered, the provider initializes TodoService and creates the
7
+ * When registered, the factory initializes TodoService and creates the
9
8
  * todo_write tool for managing task lists.
10
9
  */
11
10
 
12
11
  /**
13
- * Configuration schema for Todo tools provider.
12
+ * Configuration schema for Todo tools factory.
14
13
  */
15
14
  declare const TodoToolsConfigSchema: z.ZodObject<{
16
15
  type: z.ZodLiteral<"todo-tools">;
@@ -26,14 +25,5 @@ declare const TodoToolsConfigSchema: z.ZodObject<{
26
25
  enableEvents?: boolean | undefined;
27
26
  }>;
28
27
  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
28
 
39
- export { todoToolsProvider };
29
+ export { type TodoToolsConfig, TodoToolsConfigSchema };
@@ -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,7 @@
1
+ import { ToolFactory } from '@dexto/agent-config';
2
+ import { TodoToolsConfig } from './tool-factory-config.cjs';
3
+ import 'zod';
4
+
5
+ declare const todoToolsFactory: ToolFactory<TodoToolsConfig>;
6
+
7
+ export { todoToolsFactory };
@@ -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.0",
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/agent-config": "1.6.0",
24
+ "@dexto/core": "1.6.0"
24
25
  },
25
26
  "devDependencies": {
26
27
  "tsup": "^8.0.0",
@@ -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,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
- };