fix(core): harden unified tool runtime (#31171)

This commit is contained in:
Kit Langton
2026-06-06 21:55:34 -04:00
committed by GitHub
parent 48c26fa039
commit eb9a683b40
35 changed files with 435 additions and 237 deletions
+6 -6
View File
@@ -9,16 +9,16 @@ import { Tools } from "./tools"
export const name = "todowrite"
export const Parameters = Schema.Struct({
export const Input = Schema.Struct({
todos: Schema.Array(SessionTodo.Info).annotate({ description: "The updated todo list" }),
})
export const Success = Schema.Struct({
export const Output = Schema.Struct({
todos: Schema.Array(SessionTodo.Info),
})
export type Success = typeof Success.Type
export type Output = typeof Output.Type
export const toModelOutput = (output: Success) => JSON.stringify(output.todos, null, 2)
export const toModelOutput = (output: Output) => JSON.stringify(output.todos, null, 2)
export const layer = Layer.effectDiscard(
Effect.gen(function* () {
@@ -31,8 +31,8 @@ export const layer = Layer.effectDiscard(
[name]: Tool.make({
description:
"Create and maintain a structured task list for the current coding session. Use it to track progress during multi-step work and keep todo statuses current.",
input: Parameters,
output: Success,
input: Input,
output: Output,
toModelOutput: ({ output }) => [toolText({ type: "text", text: toModelOutput(output) })],
execute: (input, context) =>
Effect.gen(function* () {