mirror of
https://github.com/anomalyco/opencode.git
synced 2026-05-22 20:05:23 +00:00
chore: remove dead code for todoread tool (#19128)
This commit is contained in:
@@ -148,7 +148,6 @@ export namespace Agent {
|
||||
permission: Permission.merge(
|
||||
defaults,
|
||||
Permission.fromConfig({
|
||||
todoread: "deny",
|
||||
todowrite: "deny",
|
||||
}),
|
||||
user,
|
||||
|
||||
@@ -14,19 +14,7 @@ import type { Argv } from "yargs"
|
||||
|
||||
type AgentMode = "all" | "primary" | "subagent"
|
||||
|
||||
const AVAILABLE_TOOLS = [
|
||||
"bash",
|
||||
"read",
|
||||
"write",
|
||||
"edit",
|
||||
"list",
|
||||
"glob",
|
||||
"grep",
|
||||
"webfetch",
|
||||
"task",
|
||||
"todowrite",
|
||||
"todoread",
|
||||
]
|
||||
const AVAILABLE_TOOLS = ["bash", "read", "write", "edit", "list", "glob", "grep", "webfetch", "task", "todowrite"]
|
||||
|
||||
const AgentCreateCommand = cmd({
|
||||
command: "create",
|
||||
|
||||
@@ -869,7 +869,6 @@ export const GithubRunCommand = cmd({
|
||||
function subscribeSessionEvents() {
|
||||
const TOOL: Record<string, [string, string]> = {
|
||||
todowrite: ["Todo", UI.Style.TEXT_WARNING_BOLD],
|
||||
todoread: ["Todo", UI.Style.TEXT_WARNING_BOLD],
|
||||
bash: ["Bash", UI.Style.TEXT_DANGER_BOLD],
|
||||
edit: ["Edit", UI.Style.TEXT_SUCCESS_BOLD],
|
||||
glob: ["Glob", UI.Style.TEXT_INFO_BOLD],
|
||||
|
||||
@@ -673,7 +673,6 @@ export namespace Config {
|
||||
task: PermissionRule.optional(),
|
||||
external_directory: PermissionRule.optional(),
|
||||
todowrite: PermissionAction.optional(),
|
||||
todoread: PermissionAction.optional(),
|
||||
question: PermissionAction.optional(),
|
||||
webfetch: PermissionAction.optional(),
|
||||
websearch: PermissionAction.optional(),
|
||||
|
||||
@@ -80,11 +80,6 @@ export const TaskTool = Tool.define("task", async (ctx) => {
|
||||
pattern: "*",
|
||||
action: "deny",
|
||||
},
|
||||
{
|
||||
permission: "todoread",
|
||||
pattern: "*",
|
||||
action: "deny",
|
||||
},
|
||||
...(hasTaskPermission
|
||||
? []
|
||||
: [
|
||||
@@ -137,7 +132,6 @@ export const TaskTool = Tool.define("task", async (ctx) => {
|
||||
agent: agent.name,
|
||||
tools: {
|
||||
todowrite: false,
|
||||
todoread: false,
|
||||
...(hasTaskPermission ? {} : { task: false }),
|
||||
...Object.fromEntries((config.experimental?.primary_tools ?? []).map((t) => [t, false])),
|
||||
},
|
||||
|
||||
@@ -16,7 +16,7 @@ export const TodoWriteTool = Tool.define("todowrite", {
|
||||
metadata: {},
|
||||
})
|
||||
|
||||
await Todo.update({
|
||||
Todo.update({
|
||||
sessionID: ctx.sessionID,
|
||||
todos: params.todos,
|
||||
})
|
||||
@@ -29,25 +29,3 @@ export const TodoWriteTool = Tool.define("todowrite", {
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
export const TodoReadTool = Tool.define("todoread", {
|
||||
description: "Use this tool to read your todo list",
|
||||
parameters: z.object({}),
|
||||
async execute(_params, ctx) {
|
||||
await ctx.ask({
|
||||
permission: "todoread",
|
||||
patterns: ["*"],
|
||||
always: ["*"],
|
||||
metadata: {},
|
||||
})
|
||||
|
||||
const todos = await Todo.get(ctx.sessionID)
|
||||
return {
|
||||
title: `${todos.filter((x) => x.status !== "completed").length} todos`,
|
||||
metadata: {
|
||||
todos,
|
||||
},
|
||||
output: JSON.stringify(todos, null, 2),
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
Use this tool to read the current to-do list for the session. This tool should be used proactively and frequently to ensure that you are aware of
|
||||
the status of the current task list. You should make use of this tool as often as possible, especially in the following situations:
|
||||
- At the beginning of conversations to see what's pending
|
||||
- Before starting new tasks to prioritize work
|
||||
- When the user asks about previous tasks or plans
|
||||
- Whenever you're uncertain about what to do next
|
||||
- After completing tasks to update your understanding of remaining work
|
||||
- After every few messages to ensure you're on track
|
||||
|
||||
Usage:
|
||||
- This tool takes in no parameters. So leave the input blank or empty. DO NOT include a dummy object, placeholder string or a key like "input" or "empty". LEAVE IT BLANK.
|
||||
- Returns a list of todo items with their status, priority, and content
|
||||
- Use this information to track progress and plan next steps
|
||||
- If no todos exist yet, an empty list will be returned
|
||||
@@ -73,7 +73,6 @@ test("explore agent denies edit and write", async () => {
|
||||
expect(explore?.mode).toBe("subagent")
|
||||
expect(evalPerm(explore, "edit")).toBe("deny")
|
||||
expect(evalPerm(explore, "write")).toBe("deny")
|
||||
expect(evalPerm(explore, "todoread")).toBe("deny")
|
||||
expect(evalPerm(explore, "todowrite")).toBe("deny")
|
||||
},
|
||||
})
|
||||
@@ -102,7 +101,6 @@ test("general agent denies todo tools", async () => {
|
||||
expect(general).toBeDefined()
|
||||
expect(general?.mode).toBe("subagent")
|
||||
expect(general?.hidden).toBeUndefined()
|
||||
expect(evalPerm(general, "todoread")).toBe("deny")
|
||||
expect(evalPerm(general, "todowrite")).toBe("deny")
|
||||
},
|
||||
})
|
||||
|
||||
@@ -1400,7 +1400,6 @@ test("permission config preserves key order", async () => {
|
||||
external_directory: "ask",
|
||||
read: "allow",
|
||||
todowrite: "allow",
|
||||
todoread: "allow",
|
||||
"thoughts_*": "allow",
|
||||
"reasoning_model_*": "allow",
|
||||
"tools_*": "allow",
|
||||
@@ -1421,7 +1420,6 @@ test("permission config preserves key order", async () => {
|
||||
"external_directory",
|
||||
"read",
|
||||
"todowrite",
|
||||
"todoread",
|
||||
"thoughts_*",
|
||||
"reasoning_model_*",
|
||||
"tools_*",
|
||||
|
||||
Reference in New Issue
Block a user