Migrate ordered NPC and location handoff tests to native execution

This commit is contained in:
2026-11-22 04:45:39 +00:00
parent 0ad73ff575
commit 562dfad5cd
9 changed files with 191 additions and 202 deletions

View File

@@ -95,3 +95,19 @@ func nativeSchemaHasProperty(request promptkit.GenerateRequest, property string)
_, found := schema.Properties[property]
return found
}
func nativeJSONInput(request promptkit.GenerateRequest, field string) ([]byte, error) {
for _, message := range request.Prompt.Messages {
for offset := range len(message.Content) {
if message.Content[offset] != '{' {
continue
}
decoder := json.NewDecoder(strings.NewReader(message.Content[offset:]))
var object map[string]json.RawMessage
if decoder.Decode(&object) == nil && object[field] != nil {
return []byte(message.Content[offset : offset+int(decoder.InputOffset())]), nil
}
}
}
return nil, fmt.Errorf("native request has no JSON input with field %q", field)
}