File tree Expand file tree Collapse file tree 15 files changed +32
-19
lines changed
packages/agent-runtime/src/tools/handlers/tool Expand file tree Collapse file tree 15 files changed +32
-19
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import z from 'zod/v4'
22
33import {
44 $getNativeToolCallExampleString ,
5- emptyToolResultSchema ,
5+ textToolResultSchema ,
66} from '../utils'
77
88import type { $ToolParams } from '../../constants'
@@ -35,5 +35,5 @@ export const addMessageParams = {
3535 endsAgentStep,
3636 description,
3737 inputSchema,
38- outputSchema : emptyToolResultSchema ( ) ,
38+ outputSchema : textToolResultSchema ( ) ,
3939} satisfies $ToolParams
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import z from 'zod/v4'
22
33import {
44 $getNativeToolCallExampleString ,
5- emptyToolResultSchema ,
5+ textToolResultSchema ,
66} from '../utils'
77
88import type { $ToolParams } from '../../constants'
@@ -53,5 +53,5 @@ export const endTurnParams = {
5353 endsAgentStep,
5454 description,
5555 inputSchema,
56- outputSchema : emptyToolResultSchema ( ) ,
56+ outputSchema : textToolResultSchema ( ) ,
5757} satisfies $ToolParams
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import z from 'zod/v4'
22
33import {
44 $getNativeToolCallExampleString ,
5- emptyToolResultSchema ,
5+ textToolResultSchema ,
66} from '../utils'
77
88import type { $ToolParams } from '../../constants'
@@ -40,5 +40,5 @@ export const setMessagesParams = {
4040 endsAgentStep,
4141 description,
4242 inputSchema,
43- outputSchema : emptyToolResultSchema ( ) ,
43+ outputSchema : textToolResultSchema ( ) ,
4444} satisfies $ToolParams
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import z from 'zod/v4'
22
33import {
44 $getNativeToolCallExampleString ,
5- emptyToolResultSchema ,
5+ textToolResultSchema ,
66} from '../utils'
77
88import type { $ToolParams } from '../../constants'
@@ -51,5 +51,5 @@ export const spawnAgentInlineParams = {
5151 endsAgentStep,
5252 description,
5353 inputSchema,
54- outputSchema : emptyToolResultSchema ( ) ,
54+ outputSchema : textToolResultSchema ( ) ,
5555} satisfies $ToolParams
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import z from 'zod/v4'
22
33import {
44 $getNativeToolCallExampleString ,
5- emptyToolResultSchema ,
5+ textToolResultSchema ,
66} from '../utils'
77
88import type { $ToolParams } from '../../constants'
@@ -57,5 +57,5 @@ export const taskCompletedParams = {
5757 endsAgentStep,
5858 description,
5959 inputSchema,
60- outputSchema : emptyToolResultSchema ( ) ,
60+ outputSchema : textToolResultSchema ( ) ,
6161} satisfies $ToolParams
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import z from 'zod/v4'
22
33import {
44 $getNativeToolCallExampleString ,
5- emptyToolResultSchema ,
5+ textToolResultSchema ,
66} from '../utils'
77
88import type { $ToolParams } from '../../constants'
@@ -52,5 +52,5 @@ export const thinkDeeplyParams = {
5252 endsAgentStep,
5353 description,
5454 inputSchema,
55- outputSchema : emptyToolResultSchema ( ) ,
55+ outputSchema : textToolResultSchema ( ) ,
5656} satisfies $ToolParams
Original file line number Diff line number Diff line change @@ -64,3 +64,15 @@ export function jsonToolResultSchema<T extends JSONValue>(
6464export function emptyToolResultSchema ( ) {
6565 return z . tuple ( [ ] )
6666}
67+
68+ /** Generates the zod schema for a simple text tool result. */
69+ export function textToolResultSchema ( ) {
70+ return z . tuple ( [
71+ z . object ( {
72+ type : z . literal ( 'json' ) ,
73+ value : z . object ( {
74+ message : z . string ( ) ,
75+ } ) ,
76+ } ) satisfies z . ZodType < ToolResultOutput > ,
77+ ] )
78+ }
Original file line number Diff line number Diff line change @@ -107,6 +107,7 @@ async function codebuff({
107107}
108108
109109if ( require . main === module ) {
110+ console . log ( 'npm-app index loaded' )
110111 const program = new Command ( )
111112
112113 program . name ( 'codebuff' ) . version ( npmAppVersion || '0.0.0' )
Original file line number Diff line number Diff line change @@ -30,5 +30,5 @@ export const handleAddMessage = (async (params: {
3030 : assistantMessage ( toolCall . input . content ) ,
3131 )
3232
33- return { output : [ ] }
33+ return { output : [ { type : 'json' , value : { message : 'Message added.' } } ] }
3434} ) satisfies CodebuffToolHandlerFunction < 'add_message' >
Original file line number Diff line number Diff line change @@ -11,5 +11,5 @@ export const handleEndTurn = (async (params: {
1111 const { previousToolCallFinished } = params
1212
1313 await previousToolCallFinished
14- return { output : [ ] }
14+ return { output : [ { type : 'json' , value : { message : 'Turn ended.' } } ] }
1515} ) satisfies CodebuffToolHandlerFunction < 'end_turn' >
You can’t perform that action at this time.
0 commit comments