indusagi 0.12.9 → 0.12.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/agent/index.d.ts +2 -0
- package/dist/agent/index.d.ts.map +1 -1
- package/dist/agent/index.js +3 -0
- package/dist/agent/index.js.map +1 -1
- package/dist/agent/messages.d.ts +77 -0
- package/dist/agent/messages.d.ts.map +1 -0
- package/dist/agent/messages.js +116 -0
- package/dist/agent/messages.js.map +1 -0
- package/dist/agent/session-manager.d.ts +448 -0
- package/dist/agent/session-manager.d.ts.map +1 -0
- package/dist/agent/session-manager.js +1228 -0
- package/dist/agent/session-manager.js.map +1 -0
- package/dist/agent/tools/index.d.ts +32 -29
- package/dist/agent/tools/index.d.ts.map +1 -1
- package/dist/agent/tools/index.js +1 -1
- package/dist/agent/tools/index.js.map +1 -1
- package/dist/agent/tools/task-types.d.ts +74 -0
- package/dist/agent/tools/task-types.d.ts.map +1 -0
- package/dist/agent/tools/task-types.js +8 -0
- package/dist/agent/tools/task-types.js.map +1 -0
- package/dist/agent/tools/task.d.ts +66 -8
- package/dist/agent/tools/task.d.ts.map +1 -1
- package/dist/agent/tools/task.js +165 -17
- package/dist/agent/tools/task.js.map +1 -1
- package/dist/agent/tools/todo-store.d.ts +65 -12
- package/dist/agent/tools/todo-store.d.ts.map +1 -1
- package/dist/agent/tools/todo-store.js +115 -15
- package/dist/agent/tools/todo-store.js.map +1 -1
- package/dist/agent/tools/todo-types.d.ts +73 -0
- package/dist/agent/tools/todo-types.d.ts.map +1 -0
- package/dist/agent/tools/todo-types.js +8 -0
- package/dist/agent/tools/todo-types.js.map +1 -0
- package/dist/agent/tools/todo.d.ts +53 -6
- package/dist/agent/tools/todo.d.ts.map +1 -1
- package/dist/agent/tools/todo.js +62 -2
- package/dist/agent/tools/todo.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"todo.d.ts","sourceRoot":"","sources":["../../../src/agent/tools/todo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAG7C,OAAO,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"todo.d.ts","sourceRoot":"","sources":["../../../src/agent/tools/todo.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAG7C,OAAO,EAAE,SAAS,EAAkC,MAAM,iBAAiB,CAAC;AAC5E,OAAO,KAAK,EAAwB,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAG7E,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAC7G,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAQ5E,QAAA,MAAM,cAAc,yCAAkB,CAAC;AACvC,QAAA,MAAM,eAAe;;;;;;;;EAQnB,CAAC;AAgBH;;;;GAIG;AACH,wBAAgB,kBAAkB,CACjC,KAAK,EAAE,SAAS,GACd,SAAS,CAAC,OAAO,cAAc,EAAE,eAAe,CAAC,CAcnD;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAClC,KAAK,EAAE,SAAS,GACd,SAAS,CAAC,OAAO,eAAe,EAAE,eAAe,CAAC,CA0BpD;AAKD,mDAAmD;AACnD,eAAO,MAAM,YAAY,qEAAmC,CAAC;AAE7D,oDAAoD;AACpD,eAAO,MAAM,aAAa;;;;;;;;oBAAoC,CAAC"}
|
package/dist/agent/tools/todo.js
CHANGED
|
@@ -1,8 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Todo Tools - Read and write todo lists
|
|
3
|
+
*
|
|
4
|
+
* @module agent/tools/todo
|
|
5
|
+
* @description
|
|
6
|
+
* Provides tools for managing todo lists. The todos are stored in a TodoStore
|
|
7
|
+
* which can optionally persist to external storage (e.g., session entries).
|
|
8
|
+
*
|
|
9
|
+
* ## Architecture
|
|
10
|
+
*
|
|
11
|
+
* Two tools are provided:
|
|
12
|
+
* - `todoread`: Read the current todo list
|
|
13
|
+
* - `todowrite`: Update the todo list
|
|
14
|
+
*
|
|
15
|
+
* Both tools share the same TodoStore instance for consistency.
|
|
16
|
+
*
|
|
17
|
+
* ## Usage
|
|
18
|
+
*
|
|
19
|
+
* ### Simple mode
|
|
20
|
+
* ```typescript
|
|
21
|
+
* import { todoReadTool, todoWriteTool } from "indusagi/agent";
|
|
22
|
+
* // Uses default in-memory store
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* ### With custom store (persistent mode)
|
|
26
|
+
* ```typescript
|
|
27
|
+
* import { createTodoReadTool, createTodoWriteTool, TodoStore } from "indusagi/agent";
|
|
28
|
+
*
|
|
29
|
+
* const store = new TodoStore({
|
|
30
|
+
* persist: (todos) => sessionManager.appendCustomEntry('todo', { todos }),
|
|
31
|
+
* load: () => loadFromSession(),
|
|
32
|
+
* });
|
|
33
|
+
*
|
|
34
|
+
* const todoReadTool = createTodoReadTool(store);
|
|
35
|
+
* const todoWriteTool = createTodoWriteTool(store);
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
1
38
|
import { StringEnum } from "../../ai/index.js";
|
|
2
39
|
import { Type } from "@sinclair/typebox";
|
|
3
40
|
import { TodoStore } from "./todo-store.js";
|
|
41
|
+
export { TodoStore, TODO_PRIORITIES, TODO_STATUSES } from "./todo-store.js";
|
|
4
42
|
const TodoItemSchema = Type.Object({
|
|
5
|
-
content: Type.String({ description: "Brief description of task" }),
|
|
43
|
+
content: Type.String({ description: "Brief description of the task" }),
|
|
6
44
|
status: StringEnum(["pending", "in_progress", "completed", "cancelled"]),
|
|
7
45
|
priority: StringEnum(["high", "medium", "low"]),
|
|
8
46
|
});
|
|
@@ -10,14 +48,27 @@ const TodoReadSchema = Type.Object({});
|
|
|
10
48
|
const TodoWriteSchema = Type.Object({
|
|
11
49
|
todos: Type.Array(TodoItemSchema, { description: "The updated todo list" }),
|
|
12
50
|
search: Type.Optional(Type.String({ description: "Optional query to filter todos after update" })),
|
|
13
|
-
status: Type.Optional(StringEnum(["pending", "in_progress", "completed", "cancelled"]
|
|
51
|
+
status: Type.Optional(StringEnum(["pending", "in_progress", "completed", "cancelled"], {
|
|
52
|
+
description: "Filter by status after update",
|
|
53
|
+
})),
|
|
14
54
|
});
|
|
55
|
+
/**
|
|
56
|
+
* Format todos as JSON string
|
|
57
|
+
*/
|
|
15
58
|
function formatTodos(todos) {
|
|
16
59
|
return JSON.stringify(todos, null, 2);
|
|
17
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* Count incomplete (non-completed) todos
|
|
63
|
+
*/
|
|
18
64
|
function countIncomplete(todos) {
|
|
19
65
|
return todos.filter((todo) => todo.status !== "completed").length;
|
|
20
66
|
}
|
|
67
|
+
/**
|
|
68
|
+
* Create a todo read tool
|
|
69
|
+
* @param store - The TodoStore to read from
|
|
70
|
+
* @returns The todoread tool
|
|
71
|
+
*/
|
|
21
72
|
export function createTodoReadTool(store) {
|
|
22
73
|
return {
|
|
23
74
|
name: "todoread",
|
|
@@ -33,6 +84,11 @@ export function createTodoReadTool(store) {
|
|
|
33
84
|
},
|
|
34
85
|
};
|
|
35
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* Create a todo write tool
|
|
89
|
+
* @param store - The TodoStore to write to
|
|
90
|
+
* @returns The todowrite tool
|
|
91
|
+
*/
|
|
36
92
|
export function createTodoWriteTool(store) {
|
|
37
93
|
return {
|
|
38
94
|
name: "todowrite",
|
|
@@ -42,6 +98,7 @@ export function createTodoWriteTool(store) {
|
|
|
42
98
|
execute: async (_toolCallId, { todos, search, status }) => {
|
|
43
99
|
const typedTodos = todos;
|
|
44
100
|
store.setTodos(typedTodos);
|
|
101
|
+
// Get todos and apply filters
|
|
45
102
|
let selected = store.getTodos();
|
|
46
103
|
if (typeof search === "string" && search.trim()) {
|
|
47
104
|
selected = store.find(search.trim());
|
|
@@ -56,7 +113,10 @@ export function createTodoWriteTool(store) {
|
|
|
56
113
|
},
|
|
57
114
|
};
|
|
58
115
|
}
|
|
116
|
+
// Default store for simple mode
|
|
59
117
|
const defaultStore = new TodoStore();
|
|
118
|
+
/** Default todo read tool using in-memory store */
|
|
60
119
|
export const todoReadTool = createTodoReadTool(defaultStore);
|
|
120
|
+
/** Default todo write tool using in-memory store */
|
|
61
121
|
export const todoWriteTool = createTodoWriteTool(defaultStore);
|
|
62
122
|
//# sourceMappingURL=todo.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"todo.js","sourceRoot":"","sources":["../../../src/agent/tools/todo.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"todo.js","sourceRoot":"","sources":["../../../src/agent/tools/todo.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,SAAS,EAAkC,MAAM,iBAAiB,CAAC;AAK5E,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAE5E,MAAM,cAAc,GAAG,IAAI,CAAC,MAAM,CAAC;IAClC,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,+BAA+B,EAAE,CAAC;IACtE,MAAM,EAAE,UAAU,CAAC,CAAC,SAAS,EAAE,aAAa,EAAE,WAAW,EAAE,WAAW,CAAU,CAAC;IACjF,QAAQ,EAAE,UAAU,CAAC,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,CAAU,CAAC;CACxD,CAAC,CAAC;AAEH,MAAM,cAAc,GAAG,IAAI,CAAC,MAAM,CAAC,EAAE,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