-
Notifications
You must be signed in to change notification settings - Fork 3.3k
feat: task lists #6906
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
uinstinct
wants to merge
15
commits into
continuedev:main
Choose a base branch
from
uinstinct:task-lists
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+396
−2
Open
feat: task lists #6906
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
3576f76
add taskmanager
uinstinct cfe397a
add gui for showing task list
uinstinct 459c25a
poll for the task list
uinstinct c1c043e
remove task functionality
uinstinct b799c5a
update functionality
uinstinct 99a94dd
run specific task
uinstinct aaf1553
Merge branch 'main' into task-lists
uinstinct 4ce7c77
Merge branch 'main' into task-lists
uinstinct 00077eb
remove direct task list update and remove ui actions
uinstinct 319bc84
get the session from messenger
uinstinct 1d78265
use listeners to listen for task events
uinstinct df41f72
enhance prompt
uinstinct f54ed57
Merge branch 'main' into task-lists
uinstinct 53f49ae
Merge branch 'main' into task-lists
uinstinct 87b9c97
move tasks state to ui reducer and mount in parallel listeners
uinstinct File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
import { v4 as uuidv4 } from "uuid"; | ||
import { TaskInfo } from "../.."; | ||
import type { FromCoreProtocol, ToCoreProtocol } from "../../protocol"; | ||
import type { IMessenger } from "../../protocol/messenger"; | ||
|
||
export enum TaskStatus { | ||
Pending = "pending", | ||
Completed = "completed", | ||
} | ||
|
||
export interface TaskEvent { | ||
type: "add" | "update" | "remove"; | ||
tasks: TaskInfo[]; | ||
} | ||
|
||
export class TaskManager { | ||
private taskMap = new Map<TaskInfo["task_id"], TaskInfo>(); | ||
|
||
constructor( | ||
private messenger: IMessenger<ToCoreProtocol, FromCoreProtocol>, | ||
) {} | ||
|
||
private emitEvent(eventType: TaskEvent["type"]): void { | ||
this.messenger.send("taskEvent", { | ||
type: eventType, | ||
tasks: this.list(), | ||
}); | ||
} | ||
|
||
add(name: string, description: string) { | ||
const taskId = uuidv4(); | ||
const task: TaskInfo = { | ||
task_id: taskId, | ||
name, | ||
description, | ||
status: TaskStatus.Pending, | ||
metadata: { | ||
createdAt: new Date().toISOString(), | ||
updatedAt: new Date().toISOString(), | ||
}, | ||
}; | ||
this.taskMap.set(taskId, task); | ||
|
||
this.emitEvent("add"); | ||
|
||
return taskId; | ||
} | ||
|
||
update(taskId: TaskInfo["task_id"], name: string, description: string) { | ||
const previousTask = this.taskMap.get(taskId); | ||
if (!previousTask) { | ||
throw new Error(`Task with id "${taskId}" not found`); | ||
} | ||
|
||
const updatedTask: TaskInfo = { | ||
...previousTask, | ||
name, | ||
description, | ||
metadata: { | ||
...previousTask.metadata, | ||
updatedAt: new Date().toISOString(), | ||
}, | ||
}; | ||
|
||
this.taskMap.set(taskId, updatedTask); | ||
|
||
this.emitEvent("update"); | ||
} | ||
|
||
remove(taskId: TaskInfo["task_id"]) { | ||
const task = this.taskMap.get(taskId); | ||
if (!task) { | ||
return; | ||
} | ||
|
||
this.taskMap.delete(taskId); | ||
|
||
this.emitEvent("remove"); | ||
} | ||
|
||
list() { | ||
return Array.from(this.taskMap.values()); | ||
} | ||
|
||
setTaskStatus(taskId: TaskInfo["task_id"], status: TaskStatus) { | ||
if (!this.taskMap.has(taskId)) { | ||
throw new Error(`Task with id "${taskId}" not found`); | ||
} | ||
this.taskMap.set(taskId, { | ||
...this.taskMap.get(taskId)!, | ||
status, | ||
}); | ||
} | ||
|
||
getTaskById(taskId: TaskInfo["task_id"]) { | ||
if (!this.taskMap.has(taskId)) { | ||
throw new Error(`Task with id "${taskId}" not found`); | ||
} | ||
return this.taskMap.get(taskId)!; | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { Session } from "../.."; | ||
import type { FromCoreProtocol, ToCoreProtocol } from "../../protocol"; | ||
import type { IMessenger } from "../../protocol/messenger"; | ||
import { TaskManager } from "./TaskManager"; | ||
|
||
// in memory storage for storing individual task lists | ||
const taskManagers = new Map<Session["sessionId"], TaskManager>(); | ||
|
||
export async function getSessionTaskManager( | ||
messenger: IMessenger<ToCoreProtocol, FromCoreProtocol>, | ||
) { | ||
const sessionId = await messenger.request("getCurrentSessionId", undefined); | ||
if (taskManagers.has(sessionId)) { | ||
return taskManagers.get(sessionId)!; | ||
} | ||
const newManager = new TaskManager(messenger); | ||
taskManagers.set(sessionId, newManager); | ||
return newManager; | ||
} | ||
|
||
export async function fetchTaskList( | ||
messenger: IMessenger<ToCoreProtocol, FromCoreProtocol>, | ||
) { | ||
return (await getSessionTaskManager(messenger)).list(); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import { Tool } from "../.."; | ||
import { BUILT_IN_GROUP_NAME, BuiltInToolNames } from "../builtIn"; | ||
|
||
export const taskListTool: Tool = { | ||
type: "function", | ||
displayTitle: "Task List Manager", | ||
wouldLikeTo: "manage tasks", | ||
isCurrently: "managing tasks", | ||
hasAlready: "managed tasks", | ||
readonly: false, | ||
isInstant: false, | ||
group: BUILT_IN_GROUP_NAME, | ||
function: { | ||
name: BuiltInToolNames.TaskList, | ||
description: `A comprehensive task management tool for organizing, tracking, and executing work in a structured queue-based system. | ||
This tool helps manage complex workflows by breaking them down into manageable tasks that can be tracked and executed systematically. | ||
|
||
When to use this tool: | ||
- Breaking down complex multi-step work into organized tasks | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should consider making this a bit more concise, this is a lot of tokens for a tool description |
||
- Planning and tracking progress on development projects | ||
- Managing sequences of related changes across a codebase | ||
- Coordinating multiple tasks that need to be completed in order | ||
- Organizing work that benefits from structured planning and execution | ||
- Tracking completion status of various development activities | ||
- Managing task dependencies and workflow organization | ||
|
||
Key features: | ||
- Add new tasks with detailed descriptions and context | ||
- List all current tasks with their status and details | ||
- Update existing tasks with new information or status changes | ||
- Start/execute tasks by marking them in progress | ||
|
||
Task management workflow: | ||
1. Use 'add' to create new tasks with clear names and detailed descriptions | ||
2. Use 'list' to view all current tasks and their status | ||
3. Use 'runTask' to begin working on a specific task | ||
4. Use 'update' to modify task details | ||
|
||
Best practices: | ||
- Create tasks that represent meaningful units of work | ||
- Use descriptive names that clearly indicate the task purpose | ||
- Include detailed descriptions with context, requirements, and acceptance criteria | ||
- Start tasks manually one by one rather than automatic queue processing | ||
|
||
Parameters explained: | ||
- action: The specific operation to perform (add, list, update, run_task) | ||
- name: Short, descriptive task name (required for add/update operations) | ||
- description: Detailed task description with context and requirements (required for add/update) | ||
- task_id: Unique identifier for the task (required for update/remove/run_task operations) | ||
|
||
The tool automatically handles task ID generation, status tracking, and GUI updates. | ||
Task IDs are managed internally and should not be exposed to users in normal interactions.`, | ||
parameters: { | ||
type: "object", | ||
required: ["action"], | ||
properties: { | ||
action: { | ||
type: "string", | ||
enum: ["add", "list", "update", "run_task"], | ||
description: "The specific action to perform on the task list.", | ||
}, | ||
name: { | ||
type: "string", | ||
description: | ||
"A short, descriptive name for the task. Required when adding or updating a task. Should clearly indicate the task purpose.", | ||
}, | ||
description: { | ||
type: "string", | ||
description: | ||
"A detailed description of the task including context, requirements, and acceptance criteria. Required when adding or updating a task.", | ||
}, | ||
task_id: { | ||
type: "string", | ||
description: | ||
"The unique identifier of the task to operate on. Required when updating or running a specific task. Should not be exposed to users.", | ||
}, | ||
}, | ||
}, | ||
}, | ||
}; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be better to make this a class for testing but not that important
But should add tests