-
Notifications
You must be signed in to change notification settings - Fork 401
feat: guide AI to use ReadMediaFile for video analysis instead of manual frame extraction #1370
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
Changes from all commits
8d4dd8b
b3593a8
0644fc1
00c0caa
d83805b
c2637ab
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,7 +28,7 @@ export const TODO_STORE_KEY = 'todo'; | |
| const TODO_LIST_WRITE_REMINDER = | ||
| 'Ensure that you continue to use the todo list to track progress. Mark tasks done immediately after finishing them, and keep exactly one task in_progress when work is underway.'; | ||
|
|
||
| export type TodoStatus = 'pending' | 'in_progress' | 'done'; | ||
| export type TodoStatus = 'pending' | 'in_progress' | 'done' | 'completed'; | ||
|
|
||
| export interface TodoItem { | ||
| readonly title: string; | ||
|
|
@@ -45,7 +45,9 @@ declare module '../../store' { | |
|
|
||
| const TodoItemSchema = z.object({ | ||
| title: z.string().min(1).describe('Short, actionable title for the todo.'), | ||
| status: z.enum(['pending', 'in_progress', 'done']).describe('Current status of the todo.'), | ||
| status: z | ||
| .preprocess((val) => (val === 'completed' ? 'done' : val), z.enum(['pending', 'in_progress', 'done'])) | ||
| .describe('Current status of the todo. Must be exactly one of: pending, in_progress, done. Do NOT use completed or finished.'), | ||
| }); | ||
|
|
||
| export interface TodoListInput { | ||
|
|
@@ -81,6 +83,7 @@ function statusMarker(status: TodoStatus): string { | |
| case 'in_progress': | ||
| return '[in_progress]'; | ||
| case 'done': | ||
| case 'completed': | ||
| return '[done]'; | ||
| default: { | ||
| const _exhaustive: never = status; | ||
|
|
@@ -133,7 +136,10 @@ export class TodoListTool implements BuiltinTool<TodoListInput> { | |
| private setTodos(todos: readonly TodoItem[]): void { | ||
| this.store.set( | ||
| TODO_STORE_KEY, | ||
| todos.map((todo) => ({ title: todo.title, status: todo.status })), | ||
| todos.map((todo) => ({ | ||
|
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.
When a model sends Useful? React with 👍 / 👎. |
||
| title: todo.title, | ||
| status: todo.status === 'completed' ? 'done' : todo.status, | ||
| })), | ||
| ); | ||
| } | ||
| } | ||
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.
With this
z.preprocess, the JSON Schema exposed bytoInputJsonSchema(..., { io: 'input' })describes the preprocess input side forstatusrather than the enum, while the real tool path only runs AJV againsttool.parametersinvalidateExecutableToolArgsand never callsTodoListInputSchema.safeParse. As a result, statuses likefinishedorwipcan pass preflight, andsetTodosstores anything other than the special-casedcompleted, corrupting TodoList state despite the tool contract saying onlypending,in_progress, anddoneare valid.Useful? React with 👍 / 👎.