Skip to content

Commit 50d8f9d

Browse files
chubes4claude
andauthored
Complete browser SDK v1 contract: honor onClientConnected + expose granular ops (#1585)
* Honor onClientConnected in startBrowserPreview startBrowserPreview accepted an onClientConnected option but never invoked it, so consumers passing the callback never received the Playground client and had to rely on the resolved value — which is a result envelope, not the client itself. Invoke options.onClientConnected(client) with the connected Playground client so the documented callback contract works. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * Expose ensureDirectory/writeFile/runRecipe on browser SDK v1 facade The browser SDK v1 facade promoted only part of the granular WordPress operation set to the top level (setFrontendAdminBarVisible, runBrowserSessionRecipe, consumeContainedSiteSync), leaving consumers that resolve operations flat as v1.<op> unable to find ensureDirectory, writeFile, and runRecipe (only reachable via v1.methods). Promote the remaining operations the preview materializer relies on so the v1 surface is consistent. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Chris Huber <chris.huber@a8c.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 50c6658 commit 50d8f9d

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

packages/wordpress-plugin/assets/browser-runtime.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -674,6 +674,10 @@
674674
};
675675
const client = await startPlaygroundWeb( request );
676676

677+
if ( typeof options.onClientConnected === 'function' ) {
678+
options.onClientConnected( client );
679+
}
680+
677681
return {
678682
schema: 'wp-codebox/browser-preview-start-result/v1',
679683
success: true,
@@ -708,6 +712,9 @@
708712
startBrowserPreview: ( input, options = {} ) => api.startBrowserPreview( input, options ),
709713
aggregateFanoutOutputs: ( input ) => api.aggregateFanoutOutputs( input ),
710714
validateBrowserRuntimeMaterialization: ( client, session, options = {} ) => api.validateBrowserRuntimeMaterialization( client, session, options ),
715+
ensureDirectory: ( client, args = {}, options = {} ) => api.ensureDirectory( client, args, options ),
716+
writeFile: ( client, args = {}, options = {} ) => api.writeFile( client, args, options ),
717+
runRecipe: ( client, recipe, taskPayload, options = {} ) => api.runRecipe( client, recipe, taskPayload, options ),
711718
normalizeResult: normalizeOperationResult,
712719
result: browserSdkResult,
713720
executableBrowserSession: api.executableBrowserSession,

0 commit comments

Comments
 (0)