@wp-playground/remote 3.1.61 → 3.1.62
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/blueprints-worker.d.ts +8 -2
- package/lib/boot-playground-remote.d.ts +4 -0
- package/lib/config.d.ts +5 -10
- package/lib/connect-shared-runtime.d.ts +1 -1
- package/lib/connect-wordpress-origin.d.ts +10 -3
- package/lib/playground-client.d.ts +5 -1
- package/lib/playground-worker-endpoint.d.ts +2 -4
- package/lib/webmcp-frame-bridge.d.ts +6 -1
- package/lib/wordpress-bridge-path.d.ts +17 -0
- package/package.json +2 -2
- package/lib/wordpress-origin.d.ts +0 -9
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import type { EmscriptenDownloadMonitor } from '@php-wasm/progress';
|
|
2
2
|
import { PlaygroundWorkerEndpoint, type WorkerBootOptions } from './playground-worker-endpoint';
|
|
3
|
+
import type { PHP } from '@php-wasm/universal';
|
|
3
4
|
export declare class PlaygroundWorkerEndpointBlueprints extends PlaygroundWorkerEndpoint {
|
|
4
5
|
constructor(monitor: EmscriptenDownloadMonitor, privateReady: () => void, privateError: (error: Error) => void);
|
|
5
6
|
private ready;
|
|
6
7
|
private failed;
|
|
7
|
-
/** Boot PHP
|
|
8
|
-
boot({ scope,
|
|
8
|
+
/** Boot PHP for the build-configured WordPress origin and this site's mounts. */
|
|
9
|
+
boot({ scope, mounts, wpVersion, wordPressZip, sqliteDriverVersion, phpVersion, sapiName, extensions, withNetworking, shouldInstallWordPress, wordpressInstallMode, blueprint, corsProxyUrl, pathAliases, }: WorkerBootOptions): Promise<void>;
|
|
10
|
+
/**
|
|
11
|
+
* Migrates mounted site data once per public URL and saves it before recording
|
|
12
|
+
* completion. New sites only need the record for their first save.
|
|
13
|
+
*/
|
|
14
|
+
protected migrateSiteUrl(php: PHP, siteUrl: string): Promise<void>;
|
|
9
15
|
}
|
|
@@ -11,6 +11,10 @@ export declare const serviceWorkerUrl: URL;
|
|
|
11
11
|
* origin configured, the rendered WordPress iframe uses wordPressSiteUrl; this
|
|
12
12
|
* document and PHP do not move.
|
|
13
13
|
*
|
|
14
|
+
* Finish activating the app service worker before starting PHP's module worker.
|
|
15
|
+
* WebKit can interrupt that worker's script download if a service-worker update
|
|
16
|
+
* takes over during the download, leaving the embed on its "Try again" screen.
|
|
17
|
+
*
|
|
14
18
|
* The returned API's boot() method starts PHP and connects HTTP requests to it.
|
|
15
19
|
* With separate origins it creates a hidden WordPress-origin request iframe;
|
|
16
20
|
* with one origin a dedicated runtime uses the existing service-worker listener.
|
package/lib/config.d.ts
CHANGED
|
@@ -5,18 +5,13 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export declare const playgroundOrigin: string;
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
* Render every WordPress page on the build-configured sandbox, regardless of
|
|
9
|
+
* feature flags. PHP, OPFS, and picked directory handles stay on the app origin.
|
|
10
|
+
* For example, playground.wordpress.net runs PHP while wpsandbox.wordpress.net
|
|
11
|
+
* serves its WordPress pages. Query parameters must not move those pages back
|
|
12
|
+
* onto the app origin, where their scripts could directly read saved files.
|
|
11
13
|
* Loopback development offers the remote server's existing port; standalone and
|
|
12
14
|
* custom hosts without a configured sandbox keep one origin.
|
|
13
15
|
*/
|
|
14
|
-
export declare const wordPressSandboxOrigin: string;
|
|
15
|
-
/**
|
|
16
|
-
* Select once for this document. remote.html sends its choice in PHP boot options.
|
|
17
|
-
* Helper and thumbnail documents already on the sandbox origin keep
|
|
18
|
-
* that origin even though ordinary WordPress URLs do not contain the flag.
|
|
19
|
-
* Service workers route by their own origin, never by a tab's startup flag.
|
|
20
|
-
*/
|
|
21
16
|
export declare const wordPressSiteUrl: string;
|
|
22
17
|
export declare const DOCROOT = "/wordpress";
|
|
@@ -5,7 +5,7 @@ export type SharedRuntimeAPI = PlaygroundWorkerEndpoint & {
|
|
|
5
5
|
finishSharedRuntimeInitialization(): Promise<void>;
|
|
6
6
|
};
|
|
7
7
|
/**
|
|
8
|
-
* Join this site's shared PHP worker
|
|
8
|
+
* Join this site's shared PHP worker using the build-configured WordPress origin.
|
|
9
9
|
* Sandbox sessions use the HTTP helper, not a direct app-service-worker port.
|
|
10
10
|
*/
|
|
11
11
|
export declare function connectSharedRuntime(scope: string, version: string, clientVersion: string, onProgress?: (caption: string) => void): Promise<{
|
|
@@ -4,7 +4,7 @@ import type { PlaygroundWorkerEndpoint } from './playground-worker-endpoint';
|
|
|
4
4
|
* Connect WordPress HTTP requests on a separate origin to this app-origin PHP worker.
|
|
5
5
|
*
|
|
6
6
|
* For example, remote.html on playground.wordpress.net runs PHP, but the visible
|
|
7
|
-
* WordPress iframe loads
|
|
7
|
+
* WordPress iframe loads wpsandbox.wordpress.net/scope:site-a/. The WordPress
|
|
8
8
|
* service worker cannot message remote.html directly: it can only reach windows
|
|
9
9
|
* on its own origin. This function creates a hidden WordPress-origin iframe as
|
|
10
10
|
* a sibling of the visible WordPress iframe. Requests take this path:
|
|
@@ -24,9 +24,16 @@ import type { PlaygroundWorkerEndpoint } from './playground-worker-endpoint';
|
|
|
24
24
|
* and listener remain for the lifetime of remote.html. If no ready message arrives
|
|
25
25
|
* within 30 seconds, both are removed and the promise rejects.
|
|
26
26
|
*
|
|
27
|
+
* The helper URL includes the buildVersion of the app loading this iframe.
|
|
28
|
+
* A WordPress worker installed during a previous visit may still be running.
|
|
29
|
+
* If the URL names a different buildVersion, that worker must let the request
|
|
30
|
+
* reach the server rather than generate HTML naming its own release's script,
|
|
31
|
+
* which the server may no longer serve. The deployed helper then registers
|
|
32
|
+
* the deployed WordPress worker and waits for it to activate.
|
|
33
|
+
*
|
|
27
34
|
* After connection, reject app-service-worker HTTP requests for this scope with
|
|
28
|
-
* 404.
|
|
29
|
-
*
|
|
35
|
+
* 404. Returning this site's HTML there would let its scripts run on the app
|
|
36
|
+
* origin with app storage access, bypassing the sandbox origin entirely.
|
|
30
37
|
* The rejection listener lasts with remote.html and survives worker restarts.
|
|
31
38
|
*
|
|
32
39
|
* The scope selects a PHP instance; it does not prove which WordPress page made
|
|
@@ -66,8 +66,12 @@ export interface WebClientMixin extends ProgressReceiver {
|
|
|
66
66
|
*
|
|
67
67
|
* @param name The tool name as announced by `onWebMCPToolsChanged`.
|
|
68
68
|
* @param args The tool input.
|
|
69
|
+
* @param callId An optional identifier used to cancel this call. Use a fresh ID
|
|
70
|
+
* for each invocation; an already-pending ID is rejected.
|
|
69
71
|
*/
|
|
70
|
-
callWebMCPTool(name: string, args: Record<string, unknown
|
|
72
|
+
callWebMCPTool(name: string, args: Record<string, unknown>, callId?: string): Promise<unknown>;
|
|
73
|
+
/** Signals cancellation to a pending tool inside the WordPress document. */
|
|
74
|
+
cancelWebMCPTool(callId: string): Promise<void>;
|
|
71
75
|
/**
|
|
72
76
|
* The onDownloadProgress event listener.
|
|
73
77
|
*/
|
|
@@ -13,8 +13,6 @@ export interface MountDescriptor {
|
|
|
13
13
|
initialSyncDirection: 'opfs-to-memfs' | 'memfs-to-opfs';
|
|
14
14
|
}
|
|
15
15
|
export type WorkerBootOptions = {
|
|
16
|
-
/** remote.html selects this from its startup flag, not the cached worker URL. */
|
|
17
|
-
useWordPressSandbox?: boolean;
|
|
18
16
|
wpVersion?: string;
|
|
19
17
|
/** A caller-provided WordPress archive used instead of downloading one. */
|
|
20
18
|
wordPressZip?: File;
|
|
@@ -73,8 +71,8 @@ export declare abstract class PlaygroundWorkerEndpoint extends PHPWorker {
|
|
|
73
71
|
private emailParsingQueue;
|
|
74
72
|
protected downloadMonitor: EmscriptenDownloadMonitor;
|
|
75
73
|
constructor(monitor: EmscriptenDownloadMonitor);
|
|
76
|
-
/**
|
|
77
|
-
protected computeSiteUrl(scope: string
|
|
74
|
+
/** Give PHP the same public WordPress origin used by its iframe and HTTP helper. */
|
|
75
|
+
protected computeSiteUrl(scope: string): string;
|
|
78
76
|
/**
|
|
79
77
|
* Create the PHP runtime pool and route siteUrl requests into its WordPress files.
|
|
80
78
|
*
|
|
@@ -12,11 +12,16 @@ export interface WebMCPToolDescriptor {
|
|
|
12
12
|
annotations?: {
|
|
13
13
|
readOnlyHint?: boolean;
|
|
14
14
|
destructiveHint?: boolean;
|
|
15
|
+
consequentialHint?: boolean;
|
|
16
|
+
untrustedContentHint?: boolean;
|
|
17
|
+
debugging?: boolean;
|
|
15
18
|
};
|
|
16
19
|
}
|
|
17
20
|
export interface WebMCPFrameBridge {
|
|
18
21
|
subscribe(listener: (tools: WebMCPToolDescriptor[]) => void): void;
|
|
19
|
-
|
|
22
|
+
/** Use a fresh call ID for each invocation; pending duplicates are rejected. */
|
|
23
|
+
callTool(name: string, args: Record<string, unknown>, callId?: string): Promise<unknown>;
|
|
24
|
+
cancelTool(callId: string): void;
|
|
20
25
|
}
|
|
21
26
|
/**
|
|
22
27
|
* Mirrors the WordPress document's WebMCP tools into this frame and forwards
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Give each app build its own helper document URL.
|
|
3
|
+
*
|
|
4
|
+
* For example, a browser can still run release A's WordPress worker after
|
|
5
|
+
* release B is deployed. A's helper HTML names A's script, which B may no longer
|
|
6
|
+
* serve. Including B's buildVersion in the helper path lets that request reach
|
|
7
|
+
* the server, so the deployed helper can load its script and update the worker
|
|
8
|
+
* before PHP startup finishes.
|
|
9
|
+
*/
|
|
10
|
+
export declare function getWordPressBridgePath(buildVersion: string): string;
|
|
11
|
+
/**
|
|
12
|
+
* Recognize the unversioned /wordpress-bridge.html and its build-version aliases.
|
|
13
|
+
* Servers map every alias to the deployed release's wordpress-bridge.html file;
|
|
14
|
+
* the version cannot select a historical release, an app document, or PHP.
|
|
15
|
+
* Git builds use a hexadecimal commit ID; builds outside Git use a timestamp.
|
|
16
|
+
*/
|
|
17
|
+
export declare function isWordPressBridgePath(pathname: string): boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wp-playground/remote",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.62",
|
|
4
4
|
"description": "WordPress Playground remote host",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -25,5 +25,5 @@
|
|
|
25
25
|
"access": "public",
|
|
26
26
|
"directory": "../../../dist/packages/playground/remote"
|
|
27
27
|
},
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "8c52f103f3ce30668994c0e75c2c530b82097a5e"
|
|
29
29
|
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Select the configured sandbox for ?reprint; never take a hostname from its value.
|
|
3
|
-
*
|
|
4
|
-
* For example, app/remote.html?reprint selects the sandbox. A WordPress page
|
|
5
|
-
* already on that sandbox keeps it without putting ?reprint on every navigation.
|
|
6
|
-
* Other app documents use the app origin.
|
|
7
|
-
* The presence of the flag enables the sandbox, even for ?reprint=0.
|
|
8
|
-
*/
|
|
9
|
-
export declare function selectWordPressOrigin(context: URL, appOrigin: string, sandboxOrigin: string): string;
|