fix(tools): canonical JSON Schema for chat tools (#138)#139
Merged
Conversation
Convert all 35 chat tool definitions in inc/Chat/Tools/ from the legacy
property-keyed parameter shape to canonical JSON Schema. DM 0.107.0 removes
the auto-normalization layer that previously converted legacy schemas;
extension plugins must ship canonical schemas directly.
Forward-compatible pre-flight: canonical schemas are accepted by both DM
0.103.14 (current production) and DM 0.107.0+ (target). No behavior change
on the current site.
Conversion rules applied:
- Wrap properties under { type: 'object', properties: {...} }.
- Move 'required => true' fields into top-level required[] array of
property names; remove 'required' from individual property defs.
- Drop 'required => false' (no-op in legacy schema).
- Omit 'required' key when no properties are required.
- Preserve 'description', 'enum', and 'items' verbatim.
- PublishInstagram.image_urls keeps its existing items: { type: string }
(array of public image URL strings).
Same pattern as data-machine-events#232 (9 tools). Closes #138.
Contributor
Homeboy Results —
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Data Machine 0.107.0 requires canonical AI tool schemas — the auto-normalization layer that previously converted legacy property-keyed parameter shapes was already removed in DM 0.106.x and is fully gone in 0.107.0. Extension plugins must ship canonical schemas directly or their chat tool calls fail with provider schema-validation errors.
This is a pre-flight fix landed before the DM bump — canonical schemas already work on DM 0.103.14 (current production on extrachill.com), so this PR can ship and deploy independently of the DM upgrade. Same pattern as Extra-Chill/data-machine-events#232 which prefighted the equivalent change across 9 chat tools without disrupting production.
What changed
Converted all 35 chat tool definitions in
inc/Chat/Tools/from the legacy shape:…to canonical JSON Schema:
Files (35 chat tools)
inc/Chat/Tools/:DeleteBluesky.php,DeleteFacebook.php,DeleteInstagram.php,DeleteLinkedIn.php,DeletePinterest.php,DeleteThreads.php,DeleteTwitter.phpFetchReddit.phpPublishBluesky.php,PublishFacebook.php,PublishInstagram.php,PublishLinkedIn.php,PublishPinterest.php,PublishReelInstagram.php,PublishStoryInstagram.php,PublishThreads.php,PublishTwitter.phpReadBluesky.php,ReadFacebook.php,ReadInstagram.php,ReadLinkedIn.php,ReadPinterest.php,ReadThreads.php,ReadTwitter.phpReplyInstagramComment.php,ReplyReddit.phpSubmitReddit.phpUpdateBluesky.php,UpdateFacebook.php,UpdateInstagram.php,UpdateLinkedIn.php,UpdatePinterest.php,UpdateThreads.php,UpdateTwitter.phpVoteReddit.phpConversion rules applied
{ type: 'object', properties: {...} }.required => trueproperties into a top-levelrequired[]array of property names; removerequiredfrom individual property defs.required => falseentirely (no-op in legacy schema).requiredkey when no properties are required (no empty arrays emitted).type: arrayproperty must declareitems. The audit found exactly one such property —PublishInstagram.image_urls— which already had a sane shape and is preserved verbatim:items: { type: 'string' }is the correct shape — the field accepts an array of public image URL strings, not an array of structs. No other tool in the 35 has atype: arrayproperty.description,enum,items) preserved verbatim.Required-fields summary
Tools with required fields:
DeleteBluesky,DeleteTwitter,DeleteFacebook,DeleteInstagram,DeleteLinkedIn,DeletePinterest,DeleteThreads—post_uri(or platform equivalent:tweet_id,post_id,media_id,pin_id, etc.)PublishBluesky,PublishTwitter,PublishFacebook,PublishLinkedIn,PublishThreads—contentPublishInstagram,PublishReelInstagram,PublishStoryInstagram— caption + media URL fields per networkPublishPinterest—title,image_url,board_idReplyInstagramComment—comment_id,messageReplyReddit—parent_id,textSubmitReddit—subreddit,titleUpdateBluesky,UpdateTwitter,UpdateFacebook,UpdateInstagram,UpdateLinkedIn,UpdatePinterest,UpdateThreads—action+ post identifier per networkVoteReddit—thing_id,directionTools with no required fields (all-optional schemas,
requiredkey omitted):FetchReddit, allRead*tools.Out of scope (intentionally)
inc/Handlers/<Network>/<Network>.phpare already canonical (issue fix(tools): canonical JSON Schema for chat tools (DM 0.107.0 pre-flight) #138 confirms this and the spot-check onTwitter.php/Bluesky.phpmatches). No work needed there.Backwards compatibility
Canonical schemas are accepted by both DM 0.103.14 (current production on extrachill.com) and DM 0.107.0+ (target). The legacy normalization path on 0.103.x silently passes canonical schemas through. No behavior change on the current site.
Test plan
php -l) passes on all 35 edited files.homeboy lint --path . --changed-since mainshows zero findings on any of the 35 edited tool files. The only findings (4 total) are pre-existing baseline noise oninc/Abilities/Reddit/FetchRedditAbility.phpfrom the prior Refactor Reddit fetches onto core fresh candidates #136 refactor commit on this branch — unrelated to this changeset.PublishTwitter(string + optional),ReadInstagram(all-optional with enum),DeleteBluesky(single required),PublishInstagram(mixed required + array with items),SubmitReddit(mixed shape),VoteReddit(multi-required) to confirm the transformation is correct and idiomatic.Constraints honored
main, no commits tomain.CHANGELOG.mdedits, no version constant bumps — homeboy owns those.fix:).Closes #138.