@@ -2,7 +2,32 @@ import { describe, expect, it } from "vitest";
22import { HEARTBEAT_RESPONSE_TOOL_NAME } from "../../auto-reply/heartbeat-tool-response.js" ;
33import { createHeartbeatResponseTool } from "./heartbeat-response-tool.js" ;
44
5+ function readSchemaProperty ( schema : unknown , key : string ) : Record < string , unknown > {
6+ const root = schema as { properties ?: Record < string , unknown > } ;
7+ const property = root . properties ?. [ key ] ;
8+ expect ( property ) . toBeTruthy ( ) ;
9+ return property as Record < string , unknown > ;
10+ }
11+
512describe ( "createHeartbeatResponseTool" , ( ) => {
13+ it ( "uses flat enum schemas for provider portability" , ( ) => {
14+ const tool = createHeartbeatResponseTool ( ) ;
15+
16+ const outcome = readSchemaProperty ( tool . parameters , "outcome" ) ;
17+ const priority = readSchemaProperty ( tool . parameters , "priority" ) ;
18+
19+ expect ( outcome ) . toMatchObject ( {
20+ type : "string" ,
21+ enum : [ "no_change" , "progress" , "done" , "blocked" , "needs_attention" ] ,
22+ } ) ;
23+ expect ( priority ) . toMatchObject ( {
24+ type : "string" ,
25+ enum : [ "low" , "normal" , "high" ] ,
26+ } ) ;
27+ expect ( outcome ) . not . toHaveProperty ( "anyOf" ) ;
28+ expect ( priority ) . not . toHaveProperty ( "anyOf" ) ;
29+ } ) ;
30+
631 it ( "records a quiet heartbeat outcome" , async ( ) => {
732 const tool = createHeartbeatResponseTool ( ) ;
833
0 commit comments