From 3e0d9ef9f2a3758a52fba595cd580bcdbe0878a8 Mon Sep 17 00:00:00 2001 From: Aiden Cline <63023139+rekram1-node@users.noreply.github.com> Date: Mon, 19 Oct 2026 01:00:06 -0500 Subject: [PATCH] feat(tui): render todos in the timeline and sidebar (#56948) --- packages/tui/src/component/todo-item.tsx | 27 +++ .../tui/src/feature-plugins/sidebar/todo.tsx | 58 ++++++ .../system/storybook/index.tsx | 2 + .../feature-plugins/system/storybook/todo.tsx | 166 ++++++++++++++++++ packages/tui/src/mini/demo.ts | 20 ++- packages/tui/src/mini/entry.body.ts | 2 + packages/tui/src/mini/scrollback.writer.tsx | 37 ++++ packages/tui/src/mini/theme.ts | 6 + packages/tui/src/mini/tool.ts | 36 ++++ packages/tui/src/mini/types.ts | 13 +- packages/tui/src/plugin/builtins.ts | 2 + packages/tui/src/routes/session/index.tsx | 31 ++++ .../tui/src/routes/session/message-parts.tsx | 1 + packages/tui/src/util/todo.ts | 54 ++++++ services/www/src/docs/content/config.mdx | 14 ++ services/www/src/docs/content/migrate-v1.mdx | 11 ++ 16 files changed, 478 insertions(+), 2 deletions(-) create mode 100644 packages/tui/src/component/todo-item.tsx create mode 100644 packages/tui/src/feature-plugins/sidebar/todo.tsx create mode 100644 packages/tui/src/feature-plugins/system/storybook/todo.tsx create mode 100644 packages/tui/src/util/todo.ts diff --git a/packages/tui/src/component/todo-item.tsx b/packages/tui/src/component/todo-item.tsx new file mode 100644 index 00000000000..e3e0a725138 --- /dev/null +++ b/packages/tui/src/component/todo-item.tsx @@ -0,0 +1,27 @@ +import { TextAttributes } from "@opentui/core" +import type { ResolvedTheme } from "@opencode/theme/tui" +import { todoMarker, type Todo } from "../util/todo" + +export function TodoItem(props: { theme: ResolvedTheme; todo: Todo }) { + const fg = () => { + if (props.todo.status === "in_progress") return props.theme.text.feedback.warning.base + if (props.todo.status === "cancelled") return props.theme.text.faint + return props.theme.text.muted + } + + return ( + + + {todoMarker(props.todo.status)}{" "} + + + {props.todo.content} + + + ) +} diff --git a/packages/tui/src/feature-plugins/sidebar/todo.tsx b/packages/tui/src/feature-plugins/sidebar/todo.tsx new file mode 100644 index 00000000000..d1cf0df2dd1 --- /dev/null +++ b/packages/tui/src/feature-plugins/sidebar/todo.tsx @@ -0,0 +1,58 @@ +import { Plugin } from "@opencode/plugin/tui" +import { createMemo, For, Show } from "solid-js" +import { TodoItem } from "../../component/todo-item" +import { sessionTodos } from "../../util/todo" + +export function SidebarTodo(props: { context: Plugin.Context; sessionID: string }) { + const [view, updateView] = props.context.storage.store("view", { initial: { open: true } }) + const theme = props.context.theme + const list = createMemo(() => + sessionTodos( + props.context.data.session.message.list(props.sessionID), + props.context.data.session.get(props.sessionID)?.revert?.messageID, + ), + ) + const remaining = createMemo( + () => list().filter((item) => item.status === "pending" || item.status === "in_progress").length, + ) + + return ( + 0}> + + { + if (list().length <= 2) return + void updateView((draft) => { + draft.open = !draft.open + }).catch((error) => console.error("Failed to persist todo sidebar state", error)) + }} + > + 2}> + {view.open ? "▼" : "▶"} + + + Todo + 2 && !view.open}> + ({remaining()} remaining) + + + + + {(item) => } + + + + ) +} + +export default Plugin.define({ + id: "opencode.sidebar.todo", + setup(context) { + context.ui.slot({ + append: "sidebar.content", + render: (props) => , + }) + }, +}) diff --git a/packages/tui/src/feature-plugins/system/storybook/index.tsx b/packages/tui/src/feature-plugins/system/storybook/index.tsx index f69e3da68b8..bf6359d85eb 100644 --- a/packages/tui/src/feature-plugins/system/storybook/index.tsx +++ b/packages/tui/src/feature-plugins/system/storybook/index.tsx @@ -8,6 +8,7 @@ import { sessionLocationMissingStory } from "./session-location-missing" import { oneCellSpinnerStory } from "./one-cell-spinner" import { linkClicksStory } from "./link-clicks" import { highlightsStory } from "./highlights" +import { todoStory } from "./todo" /** * A story is a full-screen, fixture-driven simulation of a real production component. Stories own @@ -26,6 +27,7 @@ const stories: Story[] = [ oneCellSpinnerStory, linkClicksStory, highlightsStory, + todoStory, ] function Commands(props: { context: Plugin.Context }) { diff --git a/packages/tui/src/feature-plugins/system/storybook/todo.tsx b/packages/tui/src/feature-plugins/system/storybook/todo.tsx new file mode 100644 index 00000000000..e7fd87d9faf --- /dev/null +++ b/packages/tui/src/feature-plugins/system/storybook/todo.tsx @@ -0,0 +1,166 @@ +import type { Plugin } from "@opencode/plugin/tui" +import type { SessionMessageInfo } from "@opencode/client" +import { useTerminalDimensions } from "@opentui/solid" +import { createMemo, createSignal, For } from "solid-js" +import { SidebarTodo } from "../../sidebar/todo" +import type { TodoStatus } from "../../../util/todo" +import type { Story } from "./index" +import { StoryFooter } from "./footer" + +const statuses: TodoStatus[] = ["pending", "in_progress", "completed", "cancelled"] + +const initial = [ + { content: "Read the existing sidebar plugins", status: "completed" as TodoStatus }, + { content: "Derive the current list from the latest todowrite call", status: "in_progress" as TodoStatus }, + { content: "Render the todowrite tool part like V1", status: "pending" as TodoStatus }, + { content: "Add a database table for todos", status: "cancelled" as TodoStatus }, +] + +function TodoStory(props: { context: Plugin.Context }) { + const dimensions = useTerminalDimensions() + const theme = props.context.theme + const [todos, setTodos] = createSignal(initial) + const [selected, setSelected] = createSignal(0) + const messages = createMemo((): SessionMessageInfo[] => [ + { + id: "fixture-message", + type: "assistant", + agent: "build", + model: { providerID: "fixture", id: "fixture" }, + time: { created: 0, completed: 1 }, + content: [ + { + type: "tool", + id: "fixture-todowrite", + name: "todowrite", + time: { created: 0, completed: 1 }, + state: { + status: "completed", + input: { todos: todos().map((todo) => ({ ...todo, priority: "medium" })) }, + content: [{ type: "text", text: "updated" }], + }, + }, + ], + }, + ]) + const fixture: Plugin.Context = { + ...props.context, + data: { + ...props.context.data, + session: { + ...props.context.data.session, + get: () => undefined, + message: { ...props.context.data.session.message, list: () => messages() }, + }, + }, + } + const cycle = () => + setTodos((list) => + list.map((todo, index) => + index === selected() + ? { ...todo, status: statuses[(statuses.indexOf(todo.status) + 1) % statuses.length] } + : todo, + ), + ) + + props.context.keymap.layer(() => ({ + commands: [ + { + bind: "escape", + title: "Back to storybook", + group: "Storybook", + run: () => props.context.ui.router.navigate({ type: "plugin", name: "storybook" }), + }, + { + bind: "up,k", + title: "Previous todo", + group: "Storybook", + run: () => setSelected((index) => Math.max(0, index - 1)), + }, + { + bind: "down,j", + title: "Next todo", + group: "Storybook", + run: () => setSelected((index) => Math.min(todos().length - 1, index + 1)), + }, + { bind: "s", title: "Cycle status", group: "Storybook", run: cycle }, + { + bind: "a", + title: "Add todo", + group: "Storybook", + run: () => + setTodos((list) => [ + ...list, + { content: `Follow-up task ${list.length + 1} with a longer description that wraps`, status: "pending" }, + ]), + }, + { + bind: "c", + title: "Complete all", + group: "Storybook", + run: () => setTodos((list) => list.map((todo) => ({ ...todo, status: "completed" as TodoStatus }))), + }, + { + bind: "x", + title: "Clear todos", + group: "Storybook", + run: () => { + setTodos([]) + setSelected(0) + }, + }, + { + bind: "r", + title: "Reset", + group: "Storybook", + run: () => { + setTodos(initial) + setSelected(0) + }, + }, + ], + })) + + return ( + + + + Fixture todowrite input + + + {(todo, index) => ( + + {index() === selected() ? "› " : " "} + {todo.status.padEnd(11)} {todo.content} + + )} + + + + + + + + + ) +} + +export const todoStory: Story = { + id: "todo", + title: "Todo sidebar", + render: (context) => , +} diff --git a/packages/tui/src/mini/demo.ts b/packages/tui/src/mini/demo.ts index 8fe7181bb47..1e26ea0da8e 100644 --- a/packages/tui/src/mini/demo.ts +++ b/packages/tui/src/mini/demo.ts @@ -10,7 +10,7 @@ // /permission [kind] → triggers a permission request variant // /form [kind] → triggers a canonical Form request variant // /fmt → emits a specific tool/text type (text, reasoning, shell, -// write, edit, patch, subagent, question, error, mix) +// write, edit, patch, subagent, todo, question, error, mix) // // Demo mode handles permission and Form replies locally, completing or failing // the synthetic tool parts through the same callbacks used by the live footer. @@ -42,6 +42,7 @@ const KINDS = [ "edit", "patch", "subagent", + "todo", "question", "error", "mix", @@ -565,6 +566,17 @@ function emitTask(state: State): void { }) } +function emitTodo(state: State): void { + const todos = [ + { content: "Trigger permission UI", status: "completed" }, + { content: "Trigger question UI", status: "in_progress" }, + { content: "Tune tool formatting", status: "pending" }, + { content: "Rewrite the renderer", status: "cancelled" }, + ] + const ref = make(state, "todowrite", { todos }) + doneTool(state, ref, { output: "1 completed, 1 in progress, 1 pending, 1 cancelled", metadata: { todos } }) +} + function emitQuestionTool(state: State): void { const ref = make(state, "question", { questions: [ @@ -872,6 +884,11 @@ async function emitFmt(state: State, kind: string, body: string, signal?: AbortS return true } + if (kind === "todo") { + emitTodo(state) + return true + } + if (kind === "question") { emitQuestionTool(state) return true @@ -892,6 +909,7 @@ async function emitFmt(state: State, kind: string, body: string, signal?: AbortS emitEdit(state) emitPatch(state) emitTask(state) + emitTodo(state) emitQuestionTool(state) emitError(state, "demo mixed scenario error") return true diff --git a/packages/tui/src/mini/entry.body.ts b/packages/tui/src/mini/entry.body.ts index d4953e07932..8ad134629f3 100644 --- a/packages/tui/src/mini/entry.body.ts +++ b/packages/tui/src/mini/entry.body.ts @@ -95,6 +95,8 @@ function monoBody(body: RunEntryBody): RunEntryBody { if (snapshot.kind === "task") { return textBody([snapshot.title, ...snapshot.rows, snapshot.tail].filter(Boolean).join("\n")) } + // The writer renders todo cards with ASCII markers in mono so wrapped items keep their indent. + if (snapshot.kind === "todo") return body return textBody( ["# Questions", ...snapshot.items.flatMap((item) => [item.question, item.answer]), snapshot.tail] .filter(Boolean) diff --git a/packages/tui/src/mini/scrollback.writer.tsx b/packages/tui/src/mini/scrollback.writer.tsx index d36a06acf7b..f249ec86ca2 100644 --- a/packages/tui/src/mini/scrollback.writer.tsx +++ b/packages/tui/src/mini/scrollback.writer.tsx @@ -1,6 +1,7 @@ import { createScrollbackWriter } from "@opentui/solid" import { MarkdownRenderable, + TextAttributes, TextRenderable, type ColorInput, type ScrollbackRenderContext, @@ -13,6 +14,7 @@ import { entryColor, entryLook, entrySyntax } from "./scrollback.shared" import { toolFiletype, toolStructuredFinal } from "./tool" import { RUN_THEME_FALLBACK, transparent, type RunTheme } from "./theme" import type { EntryLayout, RunEntryBody, ScrollbackOptions, StreamCommit, TurnSummary } from "./types" +import { todoMarker } from "../util/todo" import { PatchDiff } from "../component/patch-diff" export function entryGroupKey(commit: StreamCommit): string | undefined { @@ -118,6 +120,15 @@ export function RunEntryContent(props: { const next = structured() return next?.kind === "task" ? next : undefined }) + const todo_snapshot = createMemo(() => { + const next = structured() + return next?.kind === "todo" ? next : undefined + }) + const todoColor = (status: string) => { + if (status === "in_progress") return theme().block.warning + if (status === "cancelled") return theme().block.faint + return theme().block.muted + } const question_snapshot = createMemo(() => { const next = structured() return next?.kind === "question" ? next : undefined @@ -229,6 +240,32 @@ export function RunEntryContent(props: { + + + + # Todos + + + {todo_snapshot()!.items.map((item) => ( + + + {todoMarker(item.status, props.opts?.mono === true)}{" "} + + + {item.content} + + + ))} + + + diff --git a/packages/tui/src/mini/theme.ts b/packages/tui/src/mini/theme.ts index 74c81a06a1b..8eae9a7009a 100644 --- a/packages/tui/src/mini/theme.ts +++ b/packages/tui/src/mini/theme.ts @@ -49,6 +49,8 @@ export type RunFooterTheme = { export type RunBlockTheme = { text: ColorInput muted: ColorInput + faint: ColorInput + warning: ColorInput syntax?: SyntaxStyle diffRemoved: ColorInput diffAddedBg: ColorInput @@ -177,6 +179,8 @@ function map( block: { text: scrollback(theme.text.base), muted: scrollback(theme.text.muted), + faint: scrollback(theme.text.faint), + warning: scrollback(theme.text.feedback.warning.base), syntax, diffRemoved: scrollback(theme.diff.text.removed), diffAddedBg: scrollback(theme.diff.background.added), @@ -241,6 +245,8 @@ function monoTheme(mode: "dark" | "light"): RunTheme { block: { text: foreground, muted: foreground, + faint: foreground, + warning: foreground, diffRemoved: foreground, diffAddedBg: background, diffRemovedBg: background, diff --git a/packages/tui/src/mini/tool.ts b/packages/tui/src/mini/tool.ts index c2afca93368..e911aef2ecb 100644 --- a/packages/tui/src/mini/tool.ts +++ b/packages/tui/src/mini/tool.ts @@ -27,6 +27,7 @@ import { } from "../util/tool-display" import { formatPath } from "../util/path-format" import { isRecord } from "../util/record" +import { parseTodos, todoMarker } from "../util/todo" import type { RunEntryBody, StreamCommit, ToolSnapshot } from "./types" export { canonicalToolName } from "../util/tool-display" @@ -117,6 +118,7 @@ type ToolName = | "patch" | "batch" | "subagent" + | "todowrite" | "question" | "read" | "glob" @@ -457,6 +459,17 @@ function runPatch(p: ToolProps): ToolInline { } } +function runTodo(p: ToolProps): ToolInline { + return { + icon: "#", + title: "Todos", + mode: "block", + body: parseTodos(p.frame.input.todos) + .map((item) => `${todoMarker(item.status)} ${item.content}`) + .join("\n"), + } +} + function runQuestion(p: ToolProps): ToolInline { const total = list(p.frame.input.questions).length return { @@ -611,6 +624,13 @@ function snapTask(p: ToolProps): ToolSnapshot { } } +function snapTodo(p: ToolProps): ToolSnapshot { + return { + kind: "todo", + items: parseTodos(p.frame.input.todos), + } +} + function snapQuestion(p: ToolProps): ToolSnapshot { const answers = list(p.frame.meta.answers) const items = list<{ question?: string }>(p.frame.input.questions).map((item, i) => { @@ -794,6 +814,10 @@ function scrollTaskFinal(p: ToolProps): string { return `# ${kind} Subagent\n${row}` } +function scrollTodoStart(_: ToolProps): string { + return "" +} + function scrollQuestionStart(_: ToolProps): string { return "" } @@ -970,6 +994,18 @@ const TOOL_RULES = { final: scrollTaskFinal, }, }, + todowrite: { + view: { + output: false, + final: true, + snap: "structured", + }, + run: runTodo, + snap: snapTodo, + scroll: { + start: scrollTodoStart, + }, + }, question: { view: { output: false, diff --git a/packages/tui/src/mini/types.ts b/packages/tui/src/mini/types.ts index 6a51d06be66..45e0e20a9a2 100644 --- a/packages/tui/src/mini/types.ts +++ b/packages/tui/src/mini/types.ts @@ -22,6 +22,7 @@ import type { SessionMessageAssistantTool, } from "@opencode/client/promise" import type { Config } from "../config" +import type { Todo } from "../util/todo" import type { CliRenderer } from "@opentui/core" import type { SessionInbox } from "@opencode/schema/session-inbox" @@ -222,6 +223,11 @@ type ToolTaskSnapshot = { tail: string } +type ToolTodoSnapshot = { + kind: "todo" + items: Todo[] +} + type ToolQuestionSnapshot = { kind: "question" items: Array<{ @@ -231,7 +237,12 @@ type ToolQuestionSnapshot = { tail: string } -export type ToolSnapshot = ToolCodeSnapshot | ToolDiffSnapshot | ToolTaskSnapshot | ToolQuestionSnapshot +export type ToolSnapshot = + | ToolCodeSnapshot + | ToolDiffSnapshot + | ToolTaskSnapshot + | ToolTodoSnapshot + | ToolQuestionSnapshot type MiniToolState = | { diff --git a/packages/tui/src/plugin/builtins.ts b/packages/tui/src/plugin/builtins.ts index c9b86c3fbef..a95db151b16 100644 --- a/packages/tui/src/plugin/builtins.ts +++ b/packages/tui/src/plugin/builtins.ts @@ -4,6 +4,7 @@ import PromptFooter from "../feature-plugins/prompt/footer" import SidebarContext from "../feature-plugins/sidebar/context" import SidebarFooter from "../feature-plugins/sidebar/footer" import SidebarMcp from "../feature-plugins/sidebar/mcp" +import SidebarTodo from "../feature-plugins/sidebar/todo" import DiffViewer from "../feature-plugins/system/diff-viewer" import Notifications from "../feature-plugins/system/notifications" import Plugins from "../feature-plugins/system/plugins" @@ -18,6 +19,7 @@ export const builtins = [ PromptBtw, SidebarContext, SidebarMcp, + SidebarTodo, SidebarFooter, Notifications, Plugins, diff --git a/packages/tui/src/routes/session/index.tsx b/packages/tui/src/routes/session/index.tsx index 0b8228ef871..3403485b31f 100644 --- a/packages/tui/src/routes/session/index.tsx +++ b/packages/tui/src/routes/session/index.tsx @@ -64,6 +64,7 @@ import { useEditorContext } from "../../context/editor" import { useDialog } from "../../ui/dialog" import { DialogSelect } from "../../ui/dialog-select" import { DialogSessionRename } from "../../component/dialog-session-rename" +import { TodoItem } from "../../component/todo-item" import { DialogImagePreview } from "../../component/dialog-image-preview" import { statusLabel } from "../../component/dialog-workspace-file-changes" import { DialogMessage } from "./dialog-message" @@ -120,6 +121,7 @@ import { createSingleFlight } from "../../util/single-flight" import { createDelayedPresence } from "../../util/delayed-presence" import { SessionLocationMissing } from "./location-missing" import { isRecord } from "../../util/record" +import { parseTodos } from "../../util/todo" import { createHistoryPrepend } from "./history" import { context, use, type PendingAction } from "./render-context" import { INLINE_TOOL_ICON_WIDTH, InlineToolRow, ReasoningPart, TextPart, toolDisplay } from "./message-parts" @@ -2464,6 +2466,9 @@ function ToolPart(props: { part: SessionMessageAssistantTool; images?: boolean } + + + @@ -3460,6 +3465,32 @@ function ApplyPatch(props: ToolProps) { ) } +function TodoWrite(props: ToolProps) { + const theme = useTheme() + const todos = createMemo(() => parseTodos(props.input.todos)) + return ( + + 0}> + + + {(todo) => } + + + + + + {props.part.state.status === "error" ? "Todo update failed" : "Cleared todos"} + + + + ) +} + function Question(props: ToolProps) { const theme = useTheme() const questions = createMemo(() => parseQuestions(props.input.questions)) diff --git a/packages/tui/src/routes/session/message-parts.tsx b/packages/tui/src/routes/session/message-parts.tsx index f63ba65250e..65605526c2e 100644 --- a/packages/tui/src/routes/session/message-parts.tsx +++ b/packages/tui/src/routes/session/message-parts.tsx @@ -30,6 +30,7 @@ const toolDisplays = new Set([ "subagent", "execute", "patch", + "todowrite", "question", "skill", ]) diff --git a/packages/tui/src/util/todo.ts b/packages/tui/src/util/todo.ts new file mode 100644 index 00000000000..97e13d99335 --- /dev/null +++ b/packages/tui/src/util/todo.ts @@ -0,0 +1,54 @@ +import type { + SessionMessageAssistantTool, + SessionMessageInfo, + SessionMessageToolStateCompleted, +} from "@opencode/client" +import { isRecord } from "./record" + +export type TodoStatus = "pending" | "in_progress" | "completed" | "cancelled" + +export type Todo = { + content: string + status: TodoStatus +} + +const statuses = new Set(["pending", "in_progress", "completed", "cancelled"]) + +export function parseTodos(value: unknown): Todo[] { + if (!Array.isArray(value)) return [] + return value.flatMap((item) => { + if (!isRecord(item) || typeof item.content !== "string" || !item.content) return [] + return [{ content: item.content, status: statuses.has(item.status) ? (item.status as TodoStatus) : "pending" }] + }) +} + +export function todoMarker(status: TodoStatus, ascii = false) { + if (status === "completed") return ascii ? "[x]" : "[✓]" + if (status === "in_progress") return ascii ? "[>]" : "[•]" + if (status === "cancelled") return "[-]" + return "[ ]" +} + +/** + * The current list is the latest completed `todowrite` input or post-compaction todo reminder, + * after the latest completed compaction and before the revert boundary. An empty list means none. + */ +export function sessionTodos(messages: ReadonlyArray, boundary?: string): Todo[] { + const boundaryIndex = boundary ? messages.findIndex((message) => message.id === boundary) : -1 + const visible = messages.slice(0, boundaryIndex === -1 ? messages.length : boundaryIndex) + const compaction = visible.findLastIndex((message) => message.type === "compaction" && message.status === "completed") + const source = visible + .slice(compaction + 1) + .flatMap((message) => { + if (message.type === "synthetic" && message.metadata?.kind === "todo.reminder") return [message.metadata.todos] + if (message.type !== "assistant") return [] + return message.content + .filter( + (item): item is SessionMessageAssistantTool & { state: SessionMessageToolStateCompleted } => + item.type === "tool" && item.name === "todowrite" && item.state.status === "completed", + ) + .map((item) => item.state.input.todos) + }) + .at(-1) + return parseTodos(source) +} diff --git a/services/www/src/docs/content/config.mdx b/services/www/src/docs/content/config.mdx index 108a8ef9763..314088d13b8 100644 --- a/services/www/src/docs/content/config.mdx +++ b/services/www/src/docs/content/config.mdx @@ -410,6 +410,20 @@ interval and 30-minute active window. See the [warming guide](/warming) for request behavior, customization, and cost considerations. +### Experimental + +Experimental features may change or be removed in a future release. + +Set `todo` to `true` to give agents a `todowrite` tool for tracking multi-step work. + +```jsonc +{ + "experimental": { + "todo": true, + }, +} +``` + ### Skills Add directories or URLs that OpenCode should search for agent skills. diff --git a/services/www/src/docs/content/migrate-v1.mdx b/services/www/src/docs/content/migrate-v1.mdx index 81784e21724..8604e7c4c8b 100644 --- a/services/www/src/docs/content/migrate-v1.mdx +++ b/services/www/src/docs/content/migrate-v1.mdx @@ -123,6 +123,17 @@ V1 groups permission effects by tool. V2 uses one ordered `permissions` array, m Permission actions also changed: `bash` is now `shell`, `task` is now `subagent`, and `write` and `patch` are now `edit`. See [Permissions](/permissions) for the ordered V2 rule format. +Todos are off by default in V2. To turn them on, use the experimental flag. It may change or be removed in a future +release; see [Experimental](/config#experimental). + +```jsonc +{ + "experimental": { + "todo": true, + }, +} +``` + V1 asks before accessing paths outside the project. V2 does not: `external_directory` is allowed by default. To keep the V1 behavior, add `{ "action": "external_directory", "resource": "*", "effect": "ask" }` to `permissions`.