Add AI Client connector (XWPENG-20) - #1967
Open
shadyvb wants to merge 5 commits into
Open
Conversation
shadyvb
force-pushed
the
feature/add-ai-client-connector
branch
from
August 21, 2026 11:54
51dfd34 to
496a047
Compare
Register a bundled Stream connector that listens to wp_ai_client_before/ after_generate_result and writes activity records with provider, model, token counts (input/output/thought), duration, and extended metadata. - Single opt-in toggle (log_prompt_and_response_text) for full prompt/ response capture, disabled by default with PII warning - wp_stream_ai_client_log_prompt / log_response filters for redaction - List table first-line summary preview for multiline entries - PHPUnit coverage for logging, toggles, filters, and graceful no-op - Docs, changelog, connectors.md regen; gitignore .ai/ local tooling
shadyvb
force-pushed
the
feature/add-ai-client-connector
branch
from
August 21, 2026 11:54
496a047 to
f4132b0
Compare
shadyvb
marked this pull request as ready for review
August 21, 2026 11:55
bartoszgadomski
requested changes
Aug 26, 2026
bartoszgadomski
left a comment
Member
There was a problem hiding this comment.
Nice work @shadyvb! I left inline comments, please take a look.
… and PII warnings match Stream's existing patterns. Truncated summaries now show an ellipsis, log templates stay translatable without early escaping, and operators are warned that stored prompt text may be forwarded to alerts or webhooks.
…display. The connector deliberately renders tokens as %4$d/%6$d/%5$d; align PHPUnit expectations with that summary format so CI passes.
Resolve changelog conflict by keeping [Unreleased] AI Client entries above the 4.4.0 release notes from develop.
bartoszgadomski
left a comment
Member
There was a problem hiding this comment.
Follow-up notes after the review-response commits.
… stripping Refs: XWPENG-20
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.
Fixes XWPENG-20.
Adds a bundled AI Client connector to Stream that listens to WordPress AI Client
before/after_generate_resulthooks and writes audit records for each generation. Records include acting user, timestamp, provider, model, input/output/thinking token counts, duration, finish reason, and extended metadata. Full prompt and response text capture is supported via a single opt-in setting (log_prompt_and_response_text), disabled by default with a PII warning. Developer filterswp_stream_ai_client_log_promptandwp_stream_ai_client_log_responseallow redaction or omission of stored text. The Stream list table shows only the first line of multiline summaries so token/metadata rows stay scannable when prompt/response logging is enabled.Checklist
contributing.md).Release Changelog
Release Checklist
developbranch.readme.txt.stream.php.Stable taginreadme.txt.classes/class-plugin.php.Test plan
wp_stream_ai_client_log_prompt/wp_stream_ai_client_log_responseto redact text; confirm stored values reflect the filter output.WP_AI_Client_Event_Dispatcher, confirm Stream loads with no fatals and no AI records are written.vendor/bin/phpunit --filter Connector_AI_Clientandvendor/bin/phpunit --filter Test_List_Table.