@floegence/redevplugin-ui 0.6.19 → 0.6.20
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/dist/contracts.gen.d.ts +35 -31
- package/dist/contracts.gen.js +32 -32
- package/dist/openapi.gen.d.ts +50 -33
- package/dist/platform.d.ts +2 -1
- package/dist/plugin.d.ts +1 -1
- package/dist/surface.d.ts +34 -1
- package/dist/surface.js +156 -13
- package/dist/trusted-parent.d.ts +2 -2
- package/dist/trusted-parent.js +1 -1
- package/package.json +2 -2
package/dist/contracts.gen.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export declare const pluginUIProtocolVersion: "plugin-ui-
|
|
2
|
-
export declare const pluginHostProtocolVersion: "plugin-host-
|
|
3
|
-
export declare const bridgeSchemaVersion: "bridge-
|
|
1
|
+
export declare const pluginUIProtocolVersion: "plugin-ui-v7";
|
|
2
|
+
export declare const pluginHostProtocolVersion: "plugin-host-v9";
|
|
3
|
+
export declare const bridgeSchemaVersion: "bridge-v7";
|
|
4
4
|
export declare const tokenTicketSchemaVersion: "token-ticket-v4";
|
|
5
5
|
export declare const redevPluginContractVersions: {
|
|
6
|
-
readonly plugin_ui_protocol_version: "plugin-ui-
|
|
7
|
-
readonly supported_plugin_ui_protocol_versions: readonly ["plugin-ui-v5", "plugin-ui-v6"];
|
|
6
|
+
readonly plugin_ui_protocol_version: "plugin-ui-v7";
|
|
7
|
+
readonly supported_plugin_ui_protocol_versions: readonly ["plugin-ui-v5", "plugin-ui-v6", "plugin-ui-v7"];
|
|
8
8
|
readonly plugin_ui_transport_mappings: readonly [{
|
|
9
9
|
readonly plugin_ui_protocol_version: "plugin-ui-v5";
|
|
10
10
|
readonly opaque_surface_transport_schema_version: "opaque-surface-transport-v4";
|
|
@@ -13,13 +13,17 @@ export declare const redevPluginContractVersions: {
|
|
|
13
13
|
readonly plugin_ui_protocol_version: "plugin-ui-v6";
|
|
14
14
|
readonly opaque_surface_transport_schema_version: "opaque-surface-transport-v5";
|
|
15
15
|
readonly bridge_schema_version: "bridge-v6";
|
|
16
|
+
}, {
|
|
17
|
+
readonly plugin_ui_protocol_version: "plugin-ui-v7";
|
|
18
|
+
readonly opaque_surface_transport_schema_version: "opaque-surface-transport-v6";
|
|
19
|
+
readonly bridge_schema_version: "bridge-v7";
|
|
16
20
|
}];
|
|
17
|
-
readonly plugin_host_protocol_version: "plugin-host-
|
|
21
|
+
readonly plugin_host_protocol_version: "plugin-host-v9";
|
|
18
22
|
readonly rust_ipc_version: "rust-ipc-v6";
|
|
19
23
|
readonly wasm_abi_version: "redevplugin-wasm-worker-v2";
|
|
20
|
-
readonly manifest_schema_version: "manifest-
|
|
24
|
+
readonly manifest_schema_version: "manifest-v7";
|
|
21
25
|
readonly package_signature_schema_version: "package-signature-v1";
|
|
22
|
-
readonly release_metadata_schema_version: "release-metadata-
|
|
26
|
+
readonly release_metadata_schema_version: "release-metadata-v7";
|
|
23
27
|
readonly release_root_delegation_schema_version: "release-root-delegation-v1";
|
|
24
28
|
readonly release_source_policy_schema_version: "release-source-policy-v2";
|
|
25
29
|
readonly release_source_policy_pointer_schema_version: "release-source-policy-pointer-v1";
|
|
@@ -34,17 +38,17 @@ export declare const redevPluginContractVersions: {
|
|
|
34
38
|
readonly release_signing_ledger_receipt_schema_version: "release-signing-ledger-receipt-v1";
|
|
35
39
|
readonly release_signing_ledger_evidence_schema_version: "release-signing-ledger-evidence-v1";
|
|
36
40
|
readonly token_ticket_schema_version: "token-ticket-v4";
|
|
37
|
-
readonly bridge_schema_version: "bridge-
|
|
41
|
+
readonly bridge_schema_version: "bridge-v7";
|
|
38
42
|
readonly opaque_surface_document_schema_version: "opaque-surface-document-v3";
|
|
39
|
-
readonly opaque_surface_transport_schema_version: "opaque-surface-transport-
|
|
43
|
+
readonly opaque_surface_transport_schema_version: "opaque-surface-transport-v6";
|
|
40
44
|
readonly target_classifier_version: "target-classifier-v2";
|
|
41
45
|
readonly network_grant_schema_version: "network-grant-v2";
|
|
42
46
|
readonly resource_scope_schema_version: "resource-scope-v1";
|
|
43
47
|
readonly session_scope_schema_version: "session-scope-v1";
|
|
44
48
|
readonly session_scope_maintenance_schema_version: "session-scope-maintenance-v1";
|
|
45
|
-
readonly plugin_platform_openapi_version: "plugin-platform-
|
|
46
|
-
readonly compatibility_manifest_version: "redevplugin.compatibility.
|
|
47
|
-
readonly compatibility_schema_version: "compatibility-manifest-
|
|
49
|
+
readonly plugin_platform_openapi_version: "plugin-platform-v10";
|
|
50
|
+
readonly compatibility_manifest_version: "redevplugin.compatibility.v12";
|
|
51
|
+
readonly compatibility_schema_version: "compatibility-manifest-v12";
|
|
48
52
|
readonly worker_invocation_schema_version: "worker-invocation-v3";
|
|
49
53
|
readonly host_capability_contract_schema_version: "host-capability-contract-v1";
|
|
50
54
|
readonly host_capability_pin_schema_version: "host-capability-pin-v1";
|
|
@@ -76,9 +80,9 @@ export type ReDevPluginContractArtifact = {
|
|
|
76
80
|
};
|
|
77
81
|
export declare const redevPluginContractArtifacts: readonly [{
|
|
78
82
|
readonly id: "compatibility-manifest-schema";
|
|
79
|
-
readonly path: "spec/plugin/compatibility-manifest-
|
|
80
|
-
readonly version: "compatibility-manifest-
|
|
81
|
-
readonly sha256: "
|
|
83
|
+
readonly path: "spec/plugin/compatibility-manifest-v12.schema.json";
|
|
84
|
+
readonly version: "compatibility-manifest-v12";
|
|
85
|
+
readonly sha256: "e8b2536da3c2285c982464d9822cd501cea1418ef2276ce93d417df83eb41f47";
|
|
82
86
|
}, {
|
|
83
87
|
readonly id: "contract-registry-schema";
|
|
84
88
|
readonly path: "spec/plugin/contract-registry-v2.schema.json";
|
|
@@ -121,14 +125,14 @@ export declare const redevPluginContractArtifacts: readonly [{
|
|
|
121
125
|
readonly sha256: "88cbc1d63afb7e289ca4f8b7c76f702b8d20156f7722c1b71f3ab9138a240a5e";
|
|
122
126
|
}, {
|
|
123
127
|
readonly id: "iframe-bridge-schema";
|
|
124
|
-
readonly path: "spec/plugin/bridge-
|
|
125
|
-
readonly version: "bridge-
|
|
126
|
-
readonly sha256: "
|
|
128
|
+
readonly path: "spec/plugin/bridge-v7.schema.json";
|
|
129
|
+
readonly version: "bridge-v7";
|
|
130
|
+
readonly sha256: "f4b5f04870b58e8e2363aaba98b273adccef3a3e9ac1eb1a2dbbc3fb4c71b300";
|
|
127
131
|
}, {
|
|
128
132
|
readonly id: "manifest-schema";
|
|
129
|
-
readonly path: "spec/plugin/manifest-
|
|
130
|
-
readonly version: "manifest-
|
|
131
|
-
readonly sha256: "
|
|
133
|
+
readonly path: "spec/plugin/manifest-v7.schema.json";
|
|
134
|
+
readonly version: "manifest-v7";
|
|
135
|
+
readonly sha256: "af73ffd8ccedcb149198f847b68ed6fc23e51366122915c7129473f9fde68e35";
|
|
132
136
|
}, {
|
|
133
137
|
readonly id: "network-grant-schema";
|
|
134
138
|
readonly path: "spec/plugin/network-grant-v2.schema.json";
|
|
@@ -141,9 +145,9 @@ export declare const redevPluginContractArtifacts: readonly [{
|
|
|
141
145
|
readonly sha256: "63419ff5b5a8890e14f97ca29aaae175b93daff61d4567c5bdff7f6e6a9e7450";
|
|
142
146
|
}, {
|
|
143
147
|
readonly id: "opaque-surface-transport-schema";
|
|
144
|
-
readonly path: "spec/plugin/opaque-surface-transport-
|
|
145
|
-
readonly version: "opaque-surface-transport-
|
|
146
|
-
readonly sha256: "
|
|
148
|
+
readonly path: "spec/plugin/opaque-surface-transport-v6.schema.json";
|
|
149
|
+
readonly version: "opaque-surface-transport-v6";
|
|
150
|
+
readonly sha256: "8f2af2669edc9413020c26765ee3f1986ef63a7d0803466861d8cdae3977ccff";
|
|
147
151
|
}, {
|
|
148
152
|
readonly id: "owner-scope-inventory-registry";
|
|
149
153
|
readonly path: "spec/plugin/owner-scope-inventories-v1.json";
|
|
@@ -191,9 +195,9 @@ export declare const redevPluginContractArtifacts: readonly [{
|
|
|
191
195
|
readonly sha256: "4d9979f5205ec047895b64c995312c588d998bb1c1448f6c9c559f1b7ab0d796";
|
|
192
196
|
}, {
|
|
193
197
|
readonly id: "plugin-platform-openapi";
|
|
194
|
-
readonly path: "spec/openapi/plugin-platform-
|
|
195
|
-
readonly version: "plugin-platform-
|
|
196
|
-
readonly sha256: "
|
|
198
|
+
readonly path: "spec/openapi/plugin-platform-v10.yaml";
|
|
199
|
+
readonly version: "plugin-platform-v10";
|
|
200
|
+
readonly sha256: "28a7311167249ec0cec1e0f2593e481c99d84c6ab0da673eb2f8e9832c243e49";
|
|
197
201
|
}, {
|
|
198
202
|
readonly id: "process-containment-schema";
|
|
199
203
|
readonly path: "spec/plugin/process-containment-v1.schema.json";
|
|
@@ -206,9 +210,9 @@ export declare const redevPluginContractArtifacts: readonly [{
|
|
|
206
210
|
readonly sha256: "0aced01a8d409953d5075a799ac273cae79e285ac82debe93ac4d8b706571ad1";
|
|
207
211
|
}, {
|
|
208
212
|
readonly id: "release-metadata-schema";
|
|
209
|
-
readonly path: "spec/plugin/release-metadata-
|
|
210
|
-
readonly version: "release-metadata-
|
|
211
|
-
readonly sha256: "
|
|
213
|
+
readonly path: "spec/plugin/release-metadata-v7.schema.json";
|
|
214
|
+
readonly version: "release-metadata-v7";
|
|
215
|
+
readonly sha256: "d9ceac9b8dd52288172bbe5d4dc2f158e2354ad4fe1f071617f6ba9309e21ebf";
|
|
212
216
|
}, {
|
|
213
217
|
readonly id: "release-revocation-pointer-schema";
|
|
214
218
|
readonly path: "spec/plugin/release-revocation-pointer-v1.schema.json";
|
package/dist/contracts.gen.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
// Code generated by scripts/generate_contract_registry.mjs; DO NOT EDIT.
|
|
2
|
-
export const pluginUIProtocolVersion = "plugin-ui-
|
|
3
|
-
export const pluginHostProtocolVersion = "plugin-host-
|
|
4
|
-
export const bridgeSchemaVersion = "bridge-
|
|
2
|
+
export const pluginUIProtocolVersion = "plugin-ui-v7";
|
|
3
|
+
export const pluginHostProtocolVersion = "plugin-host-v9";
|
|
4
|
+
export const bridgeSchemaVersion = "bridge-v7";
|
|
5
5
|
export const tokenTicketSchemaVersion = "token-ticket-v4";
|
|
6
6
|
export const redevPluginContractVersions = {
|
|
7
|
-
"plugin_ui_protocol_version": "plugin-ui-
|
|
8
|
-
"supported_plugin_ui_protocol_versions": ["plugin-ui-v5", "plugin-ui-v6"],
|
|
9
|
-
"plugin_ui_transport_mappings": [{ "plugin_ui_protocol_version": "plugin-ui-v5", "opaque_surface_transport_schema_version": "opaque-surface-transport-v4", "bridge_schema_version": "bridge-v5" }, { "plugin_ui_protocol_version": "plugin-ui-v6", "opaque_surface_transport_schema_version": "opaque-surface-transport-v5", "bridge_schema_version": "bridge-v6" }],
|
|
10
|
-
"plugin_host_protocol_version": "plugin-host-
|
|
7
|
+
"plugin_ui_protocol_version": "plugin-ui-v7",
|
|
8
|
+
"supported_plugin_ui_protocol_versions": ["plugin-ui-v5", "plugin-ui-v6", "plugin-ui-v7"],
|
|
9
|
+
"plugin_ui_transport_mappings": [{ "plugin_ui_protocol_version": "plugin-ui-v5", "opaque_surface_transport_schema_version": "opaque-surface-transport-v4", "bridge_schema_version": "bridge-v5" }, { "plugin_ui_protocol_version": "plugin-ui-v6", "opaque_surface_transport_schema_version": "opaque-surface-transport-v5", "bridge_schema_version": "bridge-v6" }, { "plugin_ui_protocol_version": "plugin-ui-v7", "opaque_surface_transport_schema_version": "opaque-surface-transport-v6", "bridge_schema_version": "bridge-v7" }],
|
|
10
|
+
"plugin_host_protocol_version": "plugin-host-v9",
|
|
11
11
|
"rust_ipc_version": "rust-ipc-v6",
|
|
12
12
|
"wasm_abi_version": "redevplugin-wasm-worker-v2",
|
|
13
|
-
"manifest_schema_version": "manifest-
|
|
13
|
+
"manifest_schema_version": "manifest-v7",
|
|
14
14
|
"package_signature_schema_version": "package-signature-v1",
|
|
15
|
-
"release_metadata_schema_version": "release-metadata-
|
|
15
|
+
"release_metadata_schema_version": "release-metadata-v7",
|
|
16
16
|
"release_root_delegation_schema_version": "release-root-delegation-v1",
|
|
17
17
|
"release_source_policy_schema_version": "release-source-policy-v2",
|
|
18
18
|
"release_source_policy_pointer_schema_version": "release-source-policy-pointer-v1",
|
|
@@ -27,17 +27,17 @@ export const redevPluginContractVersions = {
|
|
|
27
27
|
"release_signing_ledger_receipt_schema_version": "release-signing-ledger-receipt-v1",
|
|
28
28
|
"release_signing_ledger_evidence_schema_version": "release-signing-ledger-evidence-v1",
|
|
29
29
|
"token_ticket_schema_version": "token-ticket-v4",
|
|
30
|
-
"bridge_schema_version": "bridge-
|
|
30
|
+
"bridge_schema_version": "bridge-v7",
|
|
31
31
|
"opaque_surface_document_schema_version": "opaque-surface-document-v3",
|
|
32
|
-
"opaque_surface_transport_schema_version": "opaque-surface-transport-
|
|
32
|
+
"opaque_surface_transport_schema_version": "opaque-surface-transport-v6",
|
|
33
33
|
"target_classifier_version": "target-classifier-v2",
|
|
34
34
|
"network_grant_schema_version": "network-grant-v2",
|
|
35
35
|
"resource_scope_schema_version": "resource-scope-v1",
|
|
36
36
|
"session_scope_schema_version": "session-scope-v1",
|
|
37
37
|
"session_scope_maintenance_schema_version": "session-scope-maintenance-v1",
|
|
38
|
-
"plugin_platform_openapi_version": "plugin-platform-
|
|
39
|
-
"compatibility_manifest_version": "redevplugin.compatibility.
|
|
40
|
-
"compatibility_schema_version": "compatibility-manifest-
|
|
38
|
+
"plugin_platform_openapi_version": "plugin-platform-v10",
|
|
39
|
+
"compatibility_manifest_version": "redevplugin.compatibility.v12",
|
|
40
|
+
"compatibility_schema_version": "compatibility-manifest-v12",
|
|
41
41
|
"worker_invocation_schema_version": "worker-invocation-v3",
|
|
42
42
|
"host_capability_contract_schema_version": "host-capability-contract-v1",
|
|
43
43
|
"host_capability_pin_schema_version": "host-capability-pin-v1",
|
|
@@ -64,9 +64,9 @@ export const redevPluginContractVersions = {
|
|
|
64
64
|
export const redevPluginContractArtifacts = [
|
|
65
65
|
{
|
|
66
66
|
id: "compatibility-manifest-schema",
|
|
67
|
-
path: "spec/plugin/compatibility-manifest-
|
|
68
|
-
version: "compatibility-manifest-
|
|
69
|
-
sha256: "
|
|
67
|
+
path: "spec/plugin/compatibility-manifest-v12.schema.json",
|
|
68
|
+
version: "compatibility-manifest-v12",
|
|
69
|
+
sha256: "e8b2536da3c2285c982464d9822cd501cea1418ef2276ce93d417df83eb41f47",
|
|
70
70
|
},
|
|
71
71
|
{
|
|
72
72
|
id: "contract-registry-schema",
|
|
@@ -118,15 +118,15 @@ export const redevPluginContractArtifacts = [
|
|
|
118
118
|
},
|
|
119
119
|
{
|
|
120
120
|
id: "iframe-bridge-schema",
|
|
121
|
-
path: "spec/plugin/bridge-
|
|
122
|
-
version: "bridge-
|
|
123
|
-
sha256: "
|
|
121
|
+
path: "spec/plugin/bridge-v7.schema.json",
|
|
122
|
+
version: "bridge-v7",
|
|
123
|
+
sha256: "f4b5f04870b58e8e2363aaba98b273adccef3a3e9ac1eb1a2dbbc3fb4c71b300",
|
|
124
124
|
},
|
|
125
125
|
{
|
|
126
126
|
id: "manifest-schema",
|
|
127
|
-
path: "spec/plugin/manifest-
|
|
128
|
-
version: "manifest-
|
|
129
|
-
sha256: "
|
|
127
|
+
path: "spec/plugin/manifest-v7.schema.json",
|
|
128
|
+
version: "manifest-v7",
|
|
129
|
+
sha256: "af73ffd8ccedcb149198f847b68ed6fc23e51366122915c7129473f9fde68e35",
|
|
130
130
|
},
|
|
131
131
|
{
|
|
132
132
|
id: "network-grant-schema",
|
|
@@ -142,9 +142,9 @@ export const redevPluginContractArtifacts = [
|
|
|
142
142
|
},
|
|
143
143
|
{
|
|
144
144
|
id: "opaque-surface-transport-schema",
|
|
145
|
-
path: "spec/plugin/opaque-surface-transport-
|
|
146
|
-
version: "opaque-surface-transport-
|
|
147
|
-
sha256: "
|
|
145
|
+
path: "spec/plugin/opaque-surface-transport-v6.schema.json",
|
|
146
|
+
version: "opaque-surface-transport-v6",
|
|
147
|
+
sha256: "8f2af2669edc9413020c26765ee3f1986ef63a7d0803466861d8cdae3977ccff",
|
|
148
148
|
},
|
|
149
149
|
{
|
|
150
150
|
id: "owner-scope-inventory-registry",
|
|
@@ -202,9 +202,9 @@ export const redevPluginContractArtifacts = [
|
|
|
202
202
|
},
|
|
203
203
|
{
|
|
204
204
|
id: "plugin-platform-openapi",
|
|
205
|
-
path: "spec/openapi/plugin-platform-
|
|
206
|
-
version: "plugin-platform-
|
|
207
|
-
sha256: "
|
|
205
|
+
path: "spec/openapi/plugin-platform-v10.yaml",
|
|
206
|
+
version: "plugin-platform-v10",
|
|
207
|
+
sha256: "28a7311167249ec0cec1e0f2593e481c99d84c6ab0da673eb2f8e9832c243e49",
|
|
208
208
|
},
|
|
209
209
|
{
|
|
210
210
|
id: "process-containment-schema",
|
|
@@ -220,9 +220,9 @@ export const redevPluginContractArtifacts = [
|
|
|
220
220
|
},
|
|
221
221
|
{
|
|
222
222
|
id: "release-metadata-schema",
|
|
223
|
-
path: "spec/plugin/release-metadata-
|
|
224
|
-
version: "release-metadata-
|
|
225
|
-
sha256: "
|
|
223
|
+
path: "spec/plugin/release-metadata-v7.schema.json",
|
|
224
|
+
version: "release-metadata-v7",
|
|
225
|
+
sha256: "d9ceac9b8dd52288172bbe5d4dc2f158e2354ad4fe1f071617f6ba9309e21ebf",
|
|
226
226
|
},
|
|
227
227
|
{
|
|
228
228
|
id: "release-revocation-pointer-schema",
|
package/dist/openapi.gen.d.ts
CHANGED
|
@@ -1376,7 +1376,7 @@ export interface components {
|
|
|
1376
1376
|
PluginCatalogResult: {
|
|
1377
1377
|
plugins: components["schemas"]["PluginRecord"][];
|
|
1378
1378
|
};
|
|
1379
|
-
PluginCompatibilityManifest: components["schemas"]["
|
|
1379
|
+
PluginCompatibilityManifest: components["schemas"]["CompatibilityManifestV12"];
|
|
1380
1380
|
PluginOperationList: {
|
|
1381
1381
|
operations: components["schemas"]["OperationRecord"][];
|
|
1382
1382
|
next_cursor?: string;
|
|
@@ -2040,7 +2040,7 @@ export interface components {
|
|
|
2040
2040
|
update_eligibility?: components["schemas"]["ExternalPackageUpdateEligibility"];
|
|
2041
2041
|
security_summary?: components["schemas"]["ExternalPackageSecuritySummary"];
|
|
2042
2042
|
capability_contracts?: components["schemas"]["CapabilityContractPin"][];
|
|
2043
|
-
manifest: components["schemas"]["ManifestV5"] | components["schemas"]["
|
|
2043
|
+
manifest: components["schemas"]["ManifestV5"] | components["schemas"]["ManifestV7"];
|
|
2044
2044
|
package_entries: components["schemas"]["PackageEntry"][];
|
|
2045
2045
|
runtime_requirement?: components["schemas"]["RuntimeRequirement"];
|
|
2046
2046
|
/** Format: date-time */
|
|
@@ -2078,7 +2078,7 @@ export interface components {
|
|
|
2078
2078
|
policy_revision: number;
|
|
2079
2079
|
management_revision: number;
|
|
2080
2080
|
revoke_epoch: number;
|
|
2081
|
-
manifest: components["schemas"]["ManifestV5"] | components["schemas"]["
|
|
2081
|
+
manifest: components["schemas"]["ManifestV5"] | components["schemas"]["ManifestV7"];
|
|
2082
2082
|
package_entries: components["schemas"]["PackageEntry"][];
|
|
2083
2083
|
runtime_requirement?: components["schemas"]["RuntimeRequirement"];
|
|
2084
2084
|
version_history?: components["schemas"]["PluginVersion"][];
|
|
@@ -2204,7 +2204,7 @@ export interface components {
|
|
|
2204
2204
|
plugin_instance_id: string;
|
|
2205
2205
|
plugin_version: components["schemas"]["StrictSemVer"];
|
|
2206
2206
|
/** @enum {string} */
|
|
2207
|
-
ui_protocol_version: "plugin-ui-v5" | "plugin-ui-v6";
|
|
2207
|
+
ui_protocol_version: "plugin-ui-v5" | "plugin-ui-v6" | "plugin-ui-v7";
|
|
2208
2208
|
surface_id: string;
|
|
2209
2209
|
surface_instance_id: string;
|
|
2210
2210
|
active_fingerprint: string;
|
|
@@ -2251,7 +2251,7 @@ export interface components {
|
|
|
2251
2251
|
management_revision: number;
|
|
2252
2252
|
revoke_epoch: number;
|
|
2253
2253
|
/** @enum {string} */
|
|
2254
|
-
ui_protocol_version: "plugin-ui-v5" | "plugin-ui-v6";
|
|
2254
|
+
ui_protocol_version: "plugin-ui-v5" | "plugin-ui-v6" | "plugin-ui-v7";
|
|
2255
2255
|
};
|
|
2256
2256
|
TrustedParentBridgeTokenRequest: {
|
|
2257
2257
|
handshake: components["schemas"]["TrustedParentBridgeHandshake"];
|
|
@@ -2322,6 +2322,7 @@ export interface components {
|
|
|
2322
2322
|
/** Format: date-time */
|
|
2323
2323
|
updated_at: string;
|
|
2324
2324
|
retry_after_ms: number;
|
|
2325
|
+
progress?: components["schemas"]["OperationProgress"];
|
|
2325
2326
|
} | {
|
|
2326
2327
|
operation_id: string;
|
|
2327
2328
|
/** @enum {string} */
|
|
@@ -2334,6 +2335,7 @@ export interface components {
|
|
|
2334
2335
|
retry_after_ms: number;
|
|
2335
2336
|
/** Format: date-time */
|
|
2336
2337
|
terminal_at: string;
|
|
2338
|
+
progress?: components["schemas"]["OperationProgress"];
|
|
2337
2339
|
} | {
|
|
2338
2340
|
operation_id: string;
|
|
2339
2341
|
/** @constant */
|
|
@@ -2348,7 +2350,15 @@ export interface components {
|
|
|
2348
2350
|
terminal_at: string;
|
|
2349
2351
|
/** @enum {string} */
|
|
2350
2352
|
failure_code: "adapter_failed" | "contract_invalid" | "platform_failed" | "quota_exceeded" | "runtime_failed";
|
|
2353
|
+
progress?: components["schemas"]["OperationProgress"];
|
|
2351
2354
|
};
|
|
2355
|
+
OperationProgress: {
|
|
2356
|
+
revision: number;
|
|
2357
|
+
phase: string;
|
|
2358
|
+
completed_units?: number;
|
|
2359
|
+
total_units?: number;
|
|
2360
|
+
unit?: string;
|
|
2361
|
+
} & (unknown & unknown);
|
|
2352
2362
|
RejectSurfaceConfirmationRequest: {
|
|
2353
2363
|
plugin_instance_id: string;
|
|
2354
2364
|
bridge_channel_id: string;
|
|
@@ -2560,6 +2570,7 @@ export interface components {
|
|
|
2560
2570
|
orphaned_at?: string;
|
|
2561
2571
|
/** Format: date-time */
|
|
2562
2572
|
terminal_at?: string;
|
|
2573
|
+
progress?: components["schemas"]["OperationProgress"];
|
|
2563
2574
|
} & ({
|
|
2564
2575
|
/** @constant */
|
|
2565
2576
|
status: "failed";
|
|
@@ -2766,17 +2777,18 @@ export interface components {
|
|
|
2766
2777
|
counts: components["schemas"]["SessionScopeV1RevokeCounts"];
|
|
2767
2778
|
};
|
|
2768
2779
|
SessionScopeV1PublicRevokeResult: components["schemas"]["SessionScopeV1CompleteRevokeResult"] | components["schemas"]["SessionScopeV1IncompleteRevokeResult"];
|
|
2769
|
-
|
|
2780
|
+
CompatibilityManifestV12: {
|
|
2770
2781
|
/** @constant */
|
|
2771
|
-
schema_version: "redevplugin.compatibility.
|
|
2782
|
+
schema_version: "redevplugin.compatibility.v12";
|
|
2772
2783
|
package_set: components["schemas"]["PlatformPackageSetV1"];
|
|
2773
2784
|
matrix: {
|
|
2774
2785
|
/** @constant */
|
|
2775
|
-
plugin_ui_protocol_version: "plugin-ui-
|
|
2786
|
+
plugin_ui_protocol_version: "plugin-ui-v7";
|
|
2776
2787
|
/** @constant */
|
|
2777
2788
|
supported_plugin_ui_protocol_versions: [
|
|
2778
2789
|
"plugin-ui-v5",
|
|
2779
|
-
"plugin-ui-v6"
|
|
2790
|
+
"plugin-ui-v6",
|
|
2791
|
+
"plugin-ui-v7"
|
|
2780
2792
|
];
|
|
2781
2793
|
/** @constant */
|
|
2782
2794
|
plugin_ui_transport_mappings: [
|
|
@@ -2789,20 +2801,25 @@ export interface components {
|
|
|
2789
2801
|
plugin_ui_protocol_version: "plugin-ui-v6";
|
|
2790
2802
|
opaque_surface_transport_schema_version: "opaque-surface-transport-v5";
|
|
2791
2803
|
bridge_schema_version: "bridge-v6";
|
|
2804
|
+
},
|
|
2805
|
+
{
|
|
2806
|
+
plugin_ui_protocol_version: "plugin-ui-v7";
|
|
2807
|
+
opaque_surface_transport_schema_version: "opaque-surface-transport-v6";
|
|
2808
|
+
bridge_schema_version: "bridge-v7";
|
|
2792
2809
|
}
|
|
2793
2810
|
];
|
|
2794
2811
|
/** @constant */
|
|
2795
|
-
plugin_host_protocol_version: "plugin-host-
|
|
2812
|
+
plugin_host_protocol_version: "plugin-host-v9";
|
|
2796
2813
|
/** @constant */
|
|
2797
2814
|
rust_ipc_version: "rust-ipc-v6";
|
|
2798
2815
|
/** @constant */
|
|
2799
2816
|
wasm_abi_version: "redevplugin-wasm-worker-v2";
|
|
2800
2817
|
/** @constant */
|
|
2801
|
-
manifest_schema_version: "manifest-
|
|
2818
|
+
manifest_schema_version: "manifest-v7";
|
|
2802
2819
|
/** @constant */
|
|
2803
2820
|
package_signature_schema_version: "package-signature-v1";
|
|
2804
2821
|
/** @constant */
|
|
2805
|
-
release_metadata_schema_version: "release-metadata-
|
|
2822
|
+
release_metadata_schema_version: "release-metadata-v7";
|
|
2806
2823
|
/** @constant */
|
|
2807
2824
|
release_root_delegation_schema_version: "release-root-delegation-v1";
|
|
2808
2825
|
/** @constant */
|
|
@@ -2832,11 +2849,11 @@ export interface components {
|
|
|
2832
2849
|
/** @constant */
|
|
2833
2850
|
token_ticket_schema_version: "token-ticket-v4";
|
|
2834
2851
|
/** @constant */
|
|
2835
|
-
bridge_schema_version: "bridge-
|
|
2852
|
+
bridge_schema_version: "bridge-v7";
|
|
2836
2853
|
/** @constant */
|
|
2837
2854
|
opaque_surface_document_schema_version: "opaque-surface-document-v3";
|
|
2838
2855
|
/** @constant */
|
|
2839
|
-
opaque_surface_transport_schema_version: "opaque-surface-transport-
|
|
2856
|
+
opaque_surface_transport_schema_version: "opaque-surface-transport-v6";
|
|
2840
2857
|
/** @constant */
|
|
2841
2858
|
target_classifier_version: "target-classifier-v2";
|
|
2842
2859
|
/** @constant */
|
|
@@ -2848,9 +2865,9 @@ export interface components {
|
|
|
2848
2865
|
/** @constant */
|
|
2849
2866
|
session_scope_maintenance_schema_version: "session-scope-maintenance-v1";
|
|
2850
2867
|
/** @constant */
|
|
2851
|
-
plugin_platform_openapi_version: "plugin-platform-
|
|
2868
|
+
plugin_platform_openapi_version: "plugin-platform-v10";
|
|
2852
2869
|
/** @constant */
|
|
2853
|
-
compatibility_schema_version: "compatibility-manifest-
|
|
2870
|
+
compatibility_schema_version: "compatibility-manifest-v12";
|
|
2854
2871
|
/** @constant */
|
|
2855
2872
|
worker_invocation_schema_version: "worker-invocation-v3";
|
|
2856
2873
|
/** @constant */
|
|
@@ -2897,9 +2914,9 @@ export interface components {
|
|
|
2897
2914
|
quarantine_cleanup_schema_version: "quarantine-cleanup-v1";
|
|
2898
2915
|
};
|
|
2899
2916
|
contract_set_sha256: string;
|
|
2900
|
-
contracts: components["schemas"]["
|
|
2917
|
+
contracts: components["schemas"]["CompatibilityManifestV12Contract"][];
|
|
2901
2918
|
};
|
|
2902
|
-
|
|
2919
|
+
CompatibilityManifestV12Contract: {
|
|
2903
2920
|
id: string;
|
|
2904
2921
|
path: string;
|
|
2905
2922
|
version: string;
|
|
@@ -3199,9 +3216,9 @@ export interface components {
|
|
|
3199
3216
|
HostCapabilityPinV1ArtifactRef: string;
|
|
3200
3217
|
HostCapabilityPinV1Sha256: string;
|
|
3201
3218
|
HostCapabilityPinV1DecimalEpoch: string;
|
|
3202
|
-
|
|
3219
|
+
ManifestV7: {
|
|
3203
3220
|
/** @constant */
|
|
3204
|
-
schema_version: "redevplugin.manifest.
|
|
3221
|
+
schema_version: "redevplugin.manifest.v7";
|
|
3205
3222
|
publisher: {
|
|
3206
3223
|
publisher_id: string;
|
|
3207
3224
|
display_name?: string;
|
|
@@ -3209,12 +3226,12 @@ export interface components {
|
|
|
3209
3226
|
plugin: {
|
|
3210
3227
|
plugin_id: string;
|
|
3211
3228
|
display_name: string;
|
|
3212
|
-
version: components["schemas"]["
|
|
3229
|
+
version: components["schemas"]["ManifestV7Semver"];
|
|
3213
3230
|
/** @constant */
|
|
3214
3231
|
api_version: "plugin-v1";
|
|
3215
|
-
min_runtime_version: components["schemas"]["
|
|
3232
|
+
min_runtime_version: components["schemas"]["ManifestV7Semver"];
|
|
3216
3233
|
/** @constant */
|
|
3217
|
-
ui_protocol_version: "plugin-ui-
|
|
3234
|
+
ui_protocol_version: "plugin-ui-v7";
|
|
3218
3235
|
};
|
|
3219
3236
|
surfaces: {
|
|
3220
3237
|
surface_id: string;
|
|
@@ -3278,13 +3295,13 @@ export interface components {
|
|
|
3278
3295
|
uninstall_behavior?: "cancel_then_block_delete" | "force_cleanup_allowed";
|
|
3279
3296
|
ack_timeout_ms?: number;
|
|
3280
3297
|
} & (unknown & unknown);
|
|
3281
|
-
request_schema?: components["schemas"]["
|
|
3298
|
+
request_schema?: components["schemas"]["ManifestV7MethodSchema"] & {
|
|
3282
3299
|
/** @constant */
|
|
3283
3300
|
type: "object";
|
|
3284
3301
|
/** @constant */
|
|
3285
3302
|
additionalProperties: false;
|
|
3286
3303
|
};
|
|
3287
|
-
response_schema?: components["schemas"]["
|
|
3304
|
+
response_schema?: components["schemas"]["ManifestV7MethodSchema"] & {
|
|
3288
3305
|
/** @constant */
|
|
3289
3306
|
type: "object";
|
|
3290
3307
|
/** @constant */
|
|
@@ -3347,26 +3364,26 @@ export interface components {
|
|
|
3347
3364
|
payload_schema?: Record<string, never>;
|
|
3348
3365
|
}[];
|
|
3349
3366
|
};
|
|
3350
|
-
|
|
3351
|
-
|
|
3367
|
+
ManifestV7Semver: string;
|
|
3368
|
+
ManifestV7MethodSchema: false | (({
|
|
3352
3369
|
description?: string;
|
|
3353
3370
|
readOnly?: boolean;
|
|
3354
3371
|
writeOnly?: boolean;
|
|
3355
3372
|
$ref?: string;
|
|
3356
3373
|
type?: ("null" | "boolean" | "object" | "array" | "number" | "integer" | "string") | ("null" | "boolean" | "object" | "array" | "number" | "integer" | "string")[];
|
|
3357
3374
|
properties?: {
|
|
3358
|
-
[key: string]: components["schemas"]["
|
|
3375
|
+
[key: string]: components["schemas"]["ManifestV7MethodSchema"];
|
|
3359
3376
|
};
|
|
3360
3377
|
patternProperties?: {
|
|
3361
|
-
[key: string]: components["schemas"]["
|
|
3378
|
+
[key: string]: components["schemas"]["ManifestV7MethodSchema"];
|
|
3362
3379
|
};
|
|
3363
3380
|
required?: string[];
|
|
3364
3381
|
/** @constant */
|
|
3365
3382
|
additionalProperties?: false;
|
|
3366
|
-
items?: components["schemas"]["
|
|
3367
|
-
allOf?: components["schemas"]["
|
|
3368
|
-
anyOf?: components["schemas"]["
|
|
3369
|
-
oneOf?: components["schemas"]["
|
|
3383
|
+
items?: components["schemas"]["ManifestV7MethodSchema"];
|
|
3384
|
+
allOf?: components["schemas"]["ManifestV7MethodSchema"][];
|
|
3385
|
+
anyOf?: components["schemas"]["ManifestV7MethodSchema"][];
|
|
3386
|
+
oneOf?: components["schemas"]["ManifestV7MethodSchema"][];
|
|
3370
3387
|
enum?: unknown[];
|
|
3371
3388
|
const?: unknown;
|
|
3372
3389
|
default?: unknown;
|
package/dist/platform.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type FetchLike } from "./http.js";
|
|
2
2
|
import type { components } from "./openapi.gen.js";
|
|
3
|
-
import { type PluginConfirmationHandler, type PluginSurfaceHost, type PluginSurfaceOpeningProgress, type PluginSurfaceInteractionEvent, type PluginSurfaceReloadLimiter, type PluginSurfaceSlot, type PluginTrustedMethodResult, type ReDevPluginSurfaceTransport } from "./surface.js";
|
|
3
|
+
import { type PluginConfirmationHandler, type PluginSurfaceHost, type PluginSurfaceContext, type PluginSurfaceOpeningProgress, type PluginSurfaceInteractionEvent, type PluginSurfaceReloadLimiter, type PluginSurfaceSlot, type PluginTrustedMethodResult, type ReDevPluginSurfaceTransport } from "./surface.js";
|
|
4
4
|
import { type PluginSurfaceScope } from "./surface-scope.js";
|
|
5
5
|
export type PluginPlatformClientOptions = {
|
|
6
6
|
fetch?: FetchLike;
|
|
@@ -52,6 +52,7 @@ export type PluginOpenSurfaceInSlotOptions = PluginRequestOptions & {
|
|
|
52
52
|
onOpeningProgress?: (progress: PluginSurfaceOpeningProgress) => void;
|
|
53
53
|
onInteraction?: (event: PluginSurfaceInteractionEvent) => void;
|
|
54
54
|
onError?: (error: import("./errors.js").PluginBridgeError) => void;
|
|
55
|
+
surfaceContext?: PluginSurfaceContext;
|
|
55
56
|
};
|
|
56
57
|
export type PluginSessionScopeRevokeCounts = Readonly<PlatformSchemas["SessionScopeRevokeCounts"]>;
|
|
57
58
|
export type PluginSessionScopeRevokeResult = Readonly<PlatformSchemas["SessionScopeRevokeCompleteResult"]>;
|
package/dist/plugin.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { PluginBridgeClient } from "./surface.js";
|
|
2
2
|
export { PluginBridgeError } from "./errors.js";
|
|
3
3
|
export { callCapabilityOperation, callCapabilityStream, callCapabilitySync, isCapabilityBusinessError, } from "./capability-client.js";
|
|
4
|
-
export type { BridgeLifecycleEvent, MessagePortLike, PluginBridgeClientOptions, PluginBridgeRequestOptions, PluginCanvasAccessibilityState, PluginCanvasInputEvent, PluginCanvasKeyEvent, PluginCanvasPointerEvent, PluginCanvasResizeEvent, PluginCanvasSurface, PluginJSONObject, PluginJSONValue, PluginMethodResult, PluginExecutionFailureCode, PluginOperationSnapshot, PluginStreamTerminalStatus, PluginUIActionEvent, PluginUIAttributeValue, PluginUIElementVNode, PluginUIPatchOperation, PluginUIVNode, } from "./surface.js";
|
|
4
|
+
export type { BridgeLifecycleEvent, MessagePortLike, PluginBridgeClientOptions, PluginBridgeRequestOptions, PluginCanvasAccessibilityState, PluginCanvasInputEvent, PluginCanvasKeyEvent, PluginCanvasPointerEvent, PluginCanvasResizeEvent, PluginCanvasSurface, PluginJSONObject, PluginJSONValue, PluginMethodResult, PluginExecutionFailureCode, PluginOperationSnapshot, PluginOperationProgress, PluginSurfaceContext, PluginStreamTerminalStatus, PluginUIActionEvent, PluginUIAttributeValue, PluginUIElementVNode, PluginUIPatchOperation, PluginUIVNode, } from "./surface.js";
|
|
5
5
|
export type { PluginCapabilitySchema, PluginCapabilityEffect, PluginCapabilityOperationContract, PluginCapabilityStreamContract, PluginCapabilitySyncContract, PluginCapabilityStreamEvent, PluginCapabilityStreamReadResult, PluginOperation, PluginOperationTerminalStatus, PluginOperationWaitOptions, PluginStream, } from "./capability-client.js";
|
package/dist/surface.d.ts
CHANGED
|
@@ -9,7 +9,24 @@ export type PluginJSONValue = null | boolean | number | string | PluginJSONValue
|
|
|
9
9
|
export type PluginJSONObject = {
|
|
10
10
|
[key: string]: PluginJSONValue;
|
|
11
11
|
};
|
|
12
|
-
export type PluginUIProtocolVersion = "plugin-ui-v5" | "plugin-ui-v6";
|
|
12
|
+
export type PluginUIProtocolVersion = "plugin-ui-v5" | "plugin-ui-v6" | "plugin-ui-v7";
|
|
13
|
+
export declare const pluginSurfaceContextSchemaVersion: "redevplugin.surface_context.v1";
|
|
14
|
+
export type PluginSurfaceContext = Readonly<{
|
|
15
|
+
schema_version: typeof pluginSurfaceContextSchemaVersion;
|
|
16
|
+
revision: number;
|
|
17
|
+
appearance: Readonly<{
|
|
18
|
+
color_scheme: "light" | "dark";
|
|
19
|
+
colors: Readonly<Record<"canvas" | "surface" | "surface_elevated" | "text" | "text_muted" | "border" | "accent" | "accent_text" | "success" | "warning" | "danger" | "focus", string>>;
|
|
20
|
+
}>;
|
|
21
|
+
locale: Readonly<{
|
|
22
|
+
language_tag: string;
|
|
23
|
+
direction: "ltr" | "rtl";
|
|
24
|
+
}>;
|
|
25
|
+
}>;
|
|
26
|
+
export type PluginBridgeContextMessage = {
|
|
27
|
+
type: "redevplugin.bridge.context";
|
|
28
|
+
context: PluginSurfaceContext;
|
|
29
|
+
};
|
|
13
30
|
export type BridgeLifecycleEvent = {
|
|
14
31
|
type: "ready";
|
|
15
32
|
} | {
|
|
@@ -155,6 +172,13 @@ export type PluginStreamReadResult = {
|
|
|
155
172
|
retry_after_ms: 0;
|
|
156
173
|
};
|
|
157
174
|
export type PluginExecutionFailureCode = "adapter_failed" | "contract_invalid" | "platform_failed" | "quota_exceeded" | "runtime_failed";
|
|
175
|
+
export type PluginOperationProgress = {
|
|
176
|
+
revision: number;
|
|
177
|
+
phase: string;
|
|
178
|
+
completed_units?: number;
|
|
179
|
+
total_units?: number;
|
|
180
|
+
unit?: string;
|
|
181
|
+
};
|
|
158
182
|
type PluginOperationSnapshotActive = {
|
|
159
183
|
operation_id: string;
|
|
160
184
|
status: "running" | "cancel_requested";
|
|
@@ -162,6 +186,7 @@ type PluginOperationSnapshotActive = {
|
|
|
162
186
|
created_at: string;
|
|
163
187
|
updated_at: string;
|
|
164
188
|
retry_after_ms: number;
|
|
189
|
+
progress?: PluginOperationProgress;
|
|
165
190
|
};
|
|
166
191
|
type PluginOperationSnapshotTerminal = {
|
|
167
192
|
operation_id: string;
|
|
@@ -171,6 +196,7 @@ type PluginOperationSnapshotTerminal = {
|
|
|
171
196
|
updated_at: string;
|
|
172
197
|
retry_after_ms: number;
|
|
173
198
|
terminal_at: string;
|
|
199
|
+
progress?: PluginOperationProgress;
|
|
174
200
|
};
|
|
175
201
|
type PluginOperationSnapshotFailed = {
|
|
176
202
|
operation_id: string;
|
|
@@ -181,6 +207,7 @@ type PluginOperationSnapshotFailed = {
|
|
|
181
207
|
retry_after_ms: number;
|
|
182
208
|
terminal_at: string;
|
|
183
209
|
failure_code: PluginExecutionFailureCode;
|
|
210
|
+
progress?: PluginOperationProgress;
|
|
184
211
|
};
|
|
185
212
|
export type PluginOperationSnapshot = PluginOperationSnapshotActive | PluginOperationSnapshotTerminal | PluginOperationSnapshotFailed;
|
|
186
213
|
export type PluginRiskSeverity = "info" | "low" | "medium" | "high" | "critical";
|
|
@@ -267,6 +294,8 @@ export declare class PluginBridgeClient {
|
|
|
267
294
|
readStream(streamHandle: string, options?: PluginBridgeRequestOptions): Promise<PluginStreamReadResult>;
|
|
268
295
|
cancelOperation(operationID: string, reason?: string, options?: PluginBridgeRequestOptions): Promise<void>;
|
|
269
296
|
operationSnapshot(operationID: string, options?: PluginBridgeRequestOptions): Promise<PluginOperationSnapshot>;
|
|
297
|
+
context(): PluginSurfaceContext | undefined;
|
|
298
|
+
onContext(handler: (context: PluginSurfaceContext) => void): () => void;
|
|
270
299
|
render(tree: PluginUIVNode): Promise<void>;
|
|
271
300
|
openCanvas(canvasId: string): Promise<PluginCanvasSurface>;
|
|
272
301
|
updateCanvasAccessibility(canvasId: string, state: PluginCanvasAccessibilityState): Promise<void>;
|
|
@@ -376,6 +405,7 @@ export type PluginSurfaceHostBootstrap = {
|
|
|
376
405
|
revokeEpoch: number;
|
|
377
406
|
runtimeGenerationId: string;
|
|
378
407
|
};
|
|
408
|
+
export type PluginSurfaceHostContext = PluginSurfaceContext;
|
|
379
409
|
export type PluginSurfaceOpeningProgress = {
|
|
380
410
|
phase: "opening";
|
|
381
411
|
elapsedMs: number;
|
|
@@ -395,6 +425,7 @@ export type PluginSurfaceHost = {
|
|
|
395
425
|
sendLifecycle(event: Exclude<BridgeLifecycleEvent, {
|
|
396
426
|
type: "ready" | "dispose";
|
|
397
427
|
}>): void;
|
|
428
|
+
updateContext(context: PluginSurfaceContext): void;
|
|
398
429
|
close(): Promise<PluginSurfaceCloseResult>;
|
|
399
430
|
dispose(): Promise<void>;
|
|
400
431
|
};
|
|
@@ -418,6 +449,7 @@ export type PluginSurfaceHostOptions = {
|
|
|
418
449
|
onOpeningProgress?: (progress: PluginSurfaceOpeningProgress) => void;
|
|
419
450
|
onInteraction?: (event: PluginSurfaceInteractionEvent) => void;
|
|
420
451
|
onError?: (error: PluginBridgeError) => void;
|
|
452
|
+
surfaceContext?: PluginSurfaceContext;
|
|
421
453
|
};
|
|
422
454
|
type PluginSurfaceOpeningRequest = {
|
|
423
455
|
pluginInstanceId: string;
|
|
@@ -473,3 +505,4 @@ export declare class PluginSurfaceSlot {
|
|
|
473
505
|
close(): Promise<PluginSurfaceCloseResult | undefined>;
|
|
474
506
|
dispose(): Promise<void>;
|
|
475
507
|
}
|
|
508
|
+
export declare function normalizePluginSurfaceContext(value: unknown): PluginSurfaceContext;
|
package/dist/surface.js
CHANGED
|
@@ -7,6 +7,7 @@ import { defaultPluginSurfaceScope, registerPluginSurface, } from "./surface-sco
|
|
|
7
7
|
import { PluginUIReconcileError, reconcileValidatedPluginUITrees, validatePluginUITree, } from "./ui-reconciler.js";
|
|
8
8
|
export const opaqueSurfaceDocumentSchemaVersion = "redevplugin.opaque_surface_document.v3";
|
|
9
9
|
export const pluginRiskPlanSchemaVersion = "redevplugin.capability.risk_plan.v1";
|
|
10
|
+
export const pluginSurfaceContextSchemaVersion = "redevplugin.surface_context.v1";
|
|
10
11
|
const opaquePluginBridgeGlobalKey = "__redevpluginWorkerBridge";
|
|
11
12
|
const maxPendingPluginBridgeRequests = 256;
|
|
12
13
|
const maxPluginBridgeMessageBytes = opaqueSurfaceRenderLimits.max_message_bytes;
|
|
@@ -49,6 +50,8 @@ export class PluginBridgeClient {
|
|
|
49
50
|
#actionHandlers = new Map();
|
|
50
51
|
#canvasInputHandlers = new Map();
|
|
51
52
|
#lifecycleHandlers = new Set();
|
|
53
|
+
#contextHandlers = new Set();
|
|
54
|
+
#context;
|
|
52
55
|
#ready = false;
|
|
53
56
|
#readyPromise;
|
|
54
57
|
#resolveReady;
|
|
@@ -188,6 +191,26 @@ export class PluginBridgeClient {
|
|
|
188
191
|
return snapshot;
|
|
189
192
|
});
|
|
190
193
|
}
|
|
194
|
+
context() {
|
|
195
|
+
this.#assertActive();
|
|
196
|
+
return this.#context;
|
|
197
|
+
}
|
|
198
|
+
onContext(handler) {
|
|
199
|
+
this.#assertActive();
|
|
200
|
+
if (typeof handler !== "function") {
|
|
201
|
+
throw new PluginBridgeError("PLUGIN_INVALID_REQUEST", "Plugin surface context subscription is invalid");
|
|
202
|
+
}
|
|
203
|
+
this.#contextHandlers.add(handler);
|
|
204
|
+
if (this.#context) {
|
|
205
|
+
try {
|
|
206
|
+
handler(this.#context);
|
|
207
|
+
}
|
|
208
|
+
catch {
|
|
209
|
+
// A plugin context observer cannot disrupt bridge delivery.
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
return () => this.#contextHandlers.delete(handler);
|
|
213
|
+
}
|
|
191
214
|
render(tree) {
|
|
192
215
|
this.#assertActive();
|
|
193
216
|
let validated;
|
|
@@ -295,6 +318,8 @@ export class PluginBridgeClient {
|
|
|
295
318
|
this.#actionHandlers.clear();
|
|
296
319
|
this.#canvasInputHandlers.clear();
|
|
297
320
|
this.#lifecycleHandlers.clear();
|
|
321
|
+
this.#contextHandlers.clear();
|
|
322
|
+
this.#context = undefined;
|
|
298
323
|
for (const waiter of this.#pendingRender?.waiters ?? [])
|
|
299
324
|
waiter.reject(disposedError);
|
|
300
325
|
this.#pendingRender = undefined;
|
|
@@ -498,6 +523,21 @@ export class PluginBridgeClient {
|
|
|
498
523
|
pending.reject(new PluginBridgeError(data.error_code, data.error, undefined, data.error_details, data.mutation_outcome));
|
|
499
524
|
return;
|
|
500
525
|
}
|
|
526
|
+
if (isPluginBridgeContextMessage(data)) {
|
|
527
|
+
const context = normalizePluginSurfaceContext(data.context);
|
|
528
|
+
if (this.#context && context.revision <= this.#context.revision)
|
|
529
|
+
return;
|
|
530
|
+
this.#context = context;
|
|
531
|
+
for (const handler of this.#contextHandlers) {
|
|
532
|
+
try {
|
|
533
|
+
handler(context);
|
|
534
|
+
}
|
|
535
|
+
catch {
|
|
536
|
+
// A plugin context observer cannot disrupt bridge delivery.
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
return;
|
|
540
|
+
}
|
|
501
541
|
if (isLifecycleMessage(data)) {
|
|
502
542
|
if (data.event.type === "ready" && !this.#ready) {
|
|
503
543
|
this.#ready = true;
|
|
@@ -732,8 +772,8 @@ export function createOpaquePluginBootstrapHTML(options = {}) {
|
|
|
732
772
|
throw new Error("scriptNonce must contain 8-128 URL-safe characters");
|
|
733
773
|
}
|
|
734
774
|
const uiProtocolVersion = options.uiProtocolVersion ?? pluginUIProtocolVersion;
|
|
735
|
-
if (uiProtocolVersion !== "plugin-ui-v5" && uiProtocolVersion !== "plugin-ui-v6") {
|
|
736
|
-
throw new Error("uiProtocolVersion must be plugin-ui-v5 or plugin-ui-
|
|
775
|
+
if (uiProtocolVersion !== "plugin-ui-v5" && uiProtocolVersion !== "plugin-ui-v6" && uiProtocolVersion !== "plugin-ui-v7") {
|
|
776
|
+
throw new Error("uiProtocolVersion must be plugin-ui-v5, plugin-ui-v6, or plugin-ui-v7");
|
|
737
777
|
}
|
|
738
778
|
const csp = [
|
|
739
779
|
"default-src 'none'",
|
|
@@ -863,6 +903,15 @@ export function createOpaquePluginBootstrapHTML(options = {}) {
|
|
|
863
903
|
const validWorker = (value) => exactKeys(value, ["path", "sha256", "type", "content"]) && validPath(value.path) && validDigest(value.sha256) && value.type === "classic" && typeof value.content === "string" && value.content.length <= 4194304;
|
|
864
904
|
const validAsset = (value) => exactKeys(value, ["binding_id", "logical_ids", "path", "sha256", "size", "content_type"]) && validOpaqueHandle(value.binding_id, "asset") && Array.isArray(value.logical_ids) && value.logical_ids.length > 0 && value.logical_ids.length <= 16 && value.logical_ids.every(validResourceIdentifier) && new Set(value.logical_ids).size === value.logical_ids.length && validPath(value.path) && validDigest(value.sha256) && Number.isSafeInteger(value.size) && value.size >= 0 && value.size <= maxLazyAssetBytes && typeof value.content_type === "string" && value.content_type.length > 0 && value.content_type.length <= 256;
|
|
865
905
|
const validDocument = (value) => isRecord(value) && Object.keys(value).every((key) => ["schema_version", "entry_path", "entry_sha256", "title", "language", "direction", "body_html", "styles", "worker", "assets", "critical_bytes"].includes(key)) && value.schema_version === documentSchema && validPath(value.entry_path) && validDigest(value.entry_sha256) && (value.title === undefined || (typeof value.title === "string" && value.title.length <= 256)) && (value.language === undefined || (typeof value.language === "string" && value.language.length <= 64)) && (value.direction === undefined || ["ltr", "rtl", "auto"].includes(value.direction)) && typeof value.body_html === "string" && value.body_html.length <= 4194304 && Array.isArray(value.styles) && value.styles.every(validStyle) && validWorker(value.worker) && Array.isArray(value.assets) && value.assets.length <= maxLazyAssetCount && value.assets.every(validAsset) && new Set(value.assets.map((asset) => asset.binding_id)).size === value.assets.length && new Set(value.assets.map((asset) => asset.path)).size === value.assets.length && new Set(value.assets.flatMap((asset) => asset.logical_ids)).size === value.assets.reduce((total, asset) => total + asset.logical_ids.length, 0) && value.assets.reduce((total, asset) => total + asset.size, 0) <= maxLazyAssetBytes && Number.isSafeInteger(value.critical_bytes) && value.critical_bytes >= 0 && value.critical_bytes <= maxCriticalDocumentBytes;
|
|
906
|
+
const contextColorKeys = ["canvas", "surface", "surface_elevated", "text", "text_muted", "border", "accent", "accent_text", "success", "warning", "danger", "focus"];
|
|
907
|
+
const validContextColor = (value) => typeof value === "string" && /^#[0-9a-fA-F]{6}(?:[0-9a-fA-F]{2})?$/.test(value);
|
|
908
|
+
const validSurfaceContext = (value) => {
|
|
909
|
+
if (!isRecord(value) || !exactKeys(value, ["schema_version", "revision", "appearance", "locale"]) || value.schema_version !== "redevplugin.surface_context.v1" || !Number.isSafeInteger(value.revision) || value.revision < 1) return false;
|
|
910
|
+
if (!isRecord(value.appearance) || !exactKeys(value.appearance, ["color_scheme", "colors"]) || !["light", "dark"].includes(value.appearance.color_scheme) || !isRecord(value.appearance.colors) || !exactKeys(value.appearance.colors, contextColorKeys) || contextColorKeys.some((key) => !validContextColor(value.appearance.colors[key]))) return false;
|
|
911
|
+
if (!isRecord(value.locale) || !exactKeys(value.locale, ["language_tag", "direction"]) || typeof value.locale.language_tag !== "string" || value.locale.language_tag.length < 2 || value.locale.language_tag.length > 64 || !["ltr", "rtl"].includes(value.locale.direction)) return false;
|
|
912
|
+
try { if (typeof Intl !== "undefined" && Intl.getCanonicalLocales(value.locale.language_tag).length !== 1) return false; } catch { return false; }
|
|
913
|
+
return true;
|
|
914
|
+
};
|
|
866
915
|
let accepted = false;
|
|
867
916
|
let initialized = false;
|
|
868
917
|
let parentPort;
|
|
@@ -872,6 +921,7 @@ export function createOpaquePluginBootstrapHTML(options = {}) {
|
|
|
872
921
|
let frameGenerationID = "";
|
|
873
922
|
let surfaceHandle = "";
|
|
874
923
|
let currentDocument;
|
|
924
|
+
let currentContext;
|
|
875
925
|
let workerReady = false;
|
|
876
926
|
let workerHeartbeatSequence = 0;
|
|
877
927
|
let workerHeartbeatPendingID;
|
|
@@ -1069,6 +1119,12 @@ export function createOpaquePluginBootstrapHTML(options = {}) {
|
|
|
1069
1119
|
document.head.append(style);
|
|
1070
1120
|
}
|
|
1071
1121
|
};
|
|
1122
|
+
const applySurfaceContext = (context) => {
|
|
1123
|
+
document.documentElement.lang = context.locale.language_tag;
|
|
1124
|
+
document.documentElement.dir = context.locale.direction;
|
|
1125
|
+
document.documentElement.style.colorScheme = context.appearance.color_scheme;
|
|
1126
|
+
for (const [key, value] of Object.entries(context.appearance.colors)) document.documentElement.style.setProperty("--redevplugin-color-" + key.replaceAll("_", "-"), value);
|
|
1127
|
+
};
|
|
1072
1128
|
const applyWorkerAttribute = (element, tag, name, attributeValue) => {
|
|
1073
1129
|
const lower = name.toLowerCase();
|
|
1074
1130
|
if (!validAttribute(tag, name, attributeValue)) throw new Error("plugin render attribute is not allowed");
|
|
@@ -1963,6 +2019,7 @@ export function createOpaquePluginBootstrapHTML(options = {}) {
|
|
|
1963
2019
|
workerPort.addEventListener("message", onWorkerMessage);
|
|
1964
2020
|
workerPort.start();
|
|
1965
2021
|
worker.postMessage({ type: "redevplugin.worker.initialize", surface_handle: surfaceHandle, ui_protocol_version: protocolVersion, port_roles: ["runtime_control", "plugin_bridge"] }, [controlChannel.port2, pluginChannel.port2]);
|
|
2022
|
+
if (currentContext) sendWorker({ type: "redevplugin.bridge.context", context: currentContext });
|
|
1966
2023
|
};
|
|
1967
2024
|
const validCall = (value) => exactKeys(value, ["type", "request"]) && value.type === "redevplugin.bridge.call" && isRecord(value.request) && Object.keys(value.request).every((key) => ["id", "method", "params"].includes(key)) && typeof value.request.id === "string" && value.request.id.length <= 128 && typeof value.request.method === "string" && /^[A-Za-z0-9._:-]{1,256}$/.test(value.request.method) && (value.request.params === undefined || isRecord(value.request.params));
|
|
1968
2025
|
const requestID = (value, expectedKind) => {
|
|
@@ -2255,7 +2312,7 @@ export function createOpaquePluginBootstrapHTML(options = {}) {
|
|
|
2255
2312
|
}
|
|
2256
2313
|
if (exactKeys(message, ["type", "id", "operation_id"]) && message.type === "redevplugin.bridge.operation.snapshot" &&
|
|
2257
2314
|
typeof message.id === "string" && validOpaqueHandle(message.operation_id, "operation")) {
|
|
2258
|
-
if (protocolVersion !== "plugin-ui-v6") return rejectWorkerRequest(message.id, "plugin operation observation requires plugin-ui-v6");
|
|
2315
|
+
if (protocolVersion !== "plugin-ui-v6" && protocolVersion !== "plugin-ui-v7") return rejectWorkerRequest(message.id, "plugin operation observation requires plugin-ui-v6 or plugin-ui-v7");
|
|
2259
2316
|
if (!acceptWorkerRequest(message.id, "operation")) return rejectWorkerRequest(message.id, "duplicate, replayed, or excessive plugin request");
|
|
2260
2317
|
const retryAfterMS = operationSnapshotRateLimit(message.operation_id, message.id);
|
|
2261
2318
|
if (retryAfterMS > 0) {
|
|
@@ -2327,11 +2384,14 @@ export function createOpaquePluginBootstrapHTML(options = {}) {
|
|
|
2327
2384
|
const onParentMessage = async (event) => {
|
|
2328
2385
|
const message = event.data;
|
|
2329
2386
|
if (!initialized) {
|
|
2330
|
-
|
|
2387
|
+
const initKeys = ["type", "frame_generation_id", "surface_handle", "document"];
|
|
2388
|
+
if (protocolVersion === "plugin-ui-v7") initKeys.push("context");
|
|
2389
|
+
if (!isRecord(message) || !Object.keys(message).every((key) => initKeys.includes(key)) || !initKeys.slice(0, 4).every((key) => Object.prototype.hasOwnProperty.call(message, key)) || message.type !== "redevplugin.surface.initialize" || message.frame_generation_id !== frameGenerationID || !validOpaqueHandle(message.surface_handle, "surface") || !validDocument(message.document) || (protocolVersion === "plugin-ui-v7" && message.context !== undefined && !validSurfaceContext(message.context))) return fail("invalid private initialize message");
|
|
2331
2390
|
initialized = true;
|
|
2332
2391
|
surfaceHandle = message.surface_handle;
|
|
2333
2392
|
currentDocument = message.document;
|
|
2334
|
-
|
|
2393
|
+
currentContext = protocolVersion === "plugin-ui-v7" ? message.context : undefined;
|
|
2394
|
+
try { applyStaticDocument(currentDocument); if (currentContext) applySurfaceContext(currentContext); startWorker(currentDocument); }
|
|
2335
2395
|
catch (error) { return fail(error); }
|
|
2336
2396
|
requestAnimationFrame(() => requestAnimationFrame(() => {
|
|
2337
2397
|
sendParent({ type: "redevplugin.surface.first_paint" });
|
|
@@ -2339,6 +2399,13 @@ export function createOpaquePluginBootstrapHTML(options = {}) {
|
|
|
2339
2399
|
}));
|
|
2340
2400
|
return;
|
|
2341
2401
|
}
|
|
2402
|
+
if (protocolVersion === "plugin-ui-v7" && isRecord(message) && exactKeys(message, ["type", "frame_generation_id", "surface_handle", "context"]) && message.type === "redevplugin.surface.context" && message.frame_generation_id === frameGenerationID && message.surface_handle === surfaceHandle && validSurfaceContext(message.context)) {
|
|
2403
|
+
if (currentContext && message.context.revision <= currentContext.revision) return;
|
|
2404
|
+
currentContext = message.context;
|
|
2405
|
+
applySurfaceContext(currentContext);
|
|
2406
|
+
sendWorker({ type: "redevplugin.bridge.context", context: currentContext });
|
|
2407
|
+
return;
|
|
2408
|
+
}
|
|
2342
2409
|
if (message && message.type === "redevplugin.bridge.response" && typeof message.id === "string" && pendingWorkerRequests.has(message.id) && withinLimit(message)) {
|
|
2343
2410
|
if (operationSnapshotRequests.has(message.id)) completeOperationSnapshotRequest(message.id);
|
|
2344
2411
|
else completeWorkerRequest(message.id);
|
|
@@ -2395,6 +2462,7 @@ class PluginSurfaceHostImplementation {
|
|
|
2395
2462
|
#transport;
|
|
2396
2463
|
#createMessageChannel;
|
|
2397
2464
|
#bridgeReady = false;
|
|
2465
|
+
#rendererInitialized = false;
|
|
2398
2466
|
#loadTimeoutMs;
|
|
2399
2467
|
#requestTimeoutMs;
|
|
2400
2468
|
#leaseRenewalLeadMs;
|
|
@@ -2415,6 +2483,7 @@ class PluginSurfaceHostImplementation {
|
|
|
2415
2483
|
#assetSession;
|
|
2416
2484
|
#assetSessionID;
|
|
2417
2485
|
#document;
|
|
2486
|
+
#surfaceContext;
|
|
2418
2487
|
#assets = new Map();
|
|
2419
2488
|
#streamCredentials = new Map();
|
|
2420
2489
|
#pendingRequestControllers = new Map();
|
|
@@ -2466,6 +2535,7 @@ class PluginSurfaceHostImplementation {
|
|
|
2466
2535
|
this.#onOpeningProgress = options.onOpeningProgress;
|
|
2467
2536
|
this.#onInteraction = options.onInteraction;
|
|
2468
2537
|
this.#onError = options.onError;
|
|
2538
|
+
this.#surfaceContext = options.surfaceContext === undefined ? undefined : normalizePluginSurfaceContext(options.surfaceContext);
|
|
2469
2539
|
hardenPluginSurfaceFrame(this.#iframe);
|
|
2470
2540
|
this.#unregisterSurfaceScope = registerPluginSurface(options.surfaceScope ?? defaultPluginSurfaceScope, this.bootstrap.pluginInstanceId, () => this.#disposeLocal(), () => this.#invalidateLocal());
|
|
2471
2541
|
}
|
|
@@ -2547,12 +2617,14 @@ class PluginSurfaceHostImplementation {
|
|
|
2547
2617
|
const token = await this.#mintBridgeToken();
|
|
2548
2618
|
this.#assertActive();
|
|
2549
2619
|
this.#applyLease(token);
|
|
2550
|
-
this.#postToRenderer({
|
|
2620
|
+
this.#postToRenderer(removeUndefined({
|
|
2551
2621
|
type: "redevplugin.surface.initialize",
|
|
2552
2622
|
frame_generation_id: this.frameGenerationId,
|
|
2553
2623
|
surface_handle: this.surfaceHandle,
|
|
2554
2624
|
document: preparation.document,
|
|
2555
|
-
|
|
2625
|
+
context: this.bootstrap.uiProtocolVersion === "plugin-ui-v7" ? this.#surfaceContext : undefined,
|
|
2626
|
+
}));
|
|
2627
|
+
this.#rendererInitialized = true;
|
|
2556
2628
|
await Promise.all([signals.firstPaint.promise, signals.workerReady.promise]);
|
|
2557
2629
|
this.#assertActive();
|
|
2558
2630
|
this.#bridgeReady = true;
|
|
@@ -2567,6 +2639,20 @@ class PluginSurfaceHostImplementation {
|
|
|
2567
2639
|
this.#assertReady();
|
|
2568
2640
|
this.#postToRenderer({ type: "redevplugin.bridge.lifecycle", event });
|
|
2569
2641
|
}
|
|
2642
|
+
updateContext(context) {
|
|
2643
|
+
this.#assertActive();
|
|
2644
|
+
if (this.bootstrap.uiProtocolVersion !== "plugin-ui-v7") {
|
|
2645
|
+
throw new PluginBridgeError("PLUGIN_UI_PROTOCOL_UNSUPPORTED", "Plugin surface context requires plugin-ui-v7");
|
|
2646
|
+
}
|
|
2647
|
+
const normalized = normalizePluginSurfaceContext(context);
|
|
2648
|
+
if (this.#surfaceContext && normalized.revision <= this.#surfaceContext.revision) {
|
|
2649
|
+
throw new PluginBridgeError("PLUGIN_INVALID_REQUEST", "Plugin surface context revision must increase monotonically");
|
|
2650
|
+
}
|
|
2651
|
+
this.#surfaceContext = normalized;
|
|
2652
|
+
if (this.#port && this.#rendererInitialized) {
|
|
2653
|
+
this.#postToRenderer({ type: "redevplugin.surface.context", frame_generation_id: this.frameGenerationId, surface_handle: this.surfaceHandle, context: normalized });
|
|
2654
|
+
}
|
|
2655
|
+
}
|
|
2570
2656
|
close() {
|
|
2571
2657
|
if (this.#disposed) {
|
|
2572
2658
|
const result = {
|
|
@@ -2631,6 +2717,7 @@ class PluginSurfaceHostImplementation {
|
|
|
2631
2717
|
this.#unregisterSurfaceScope = undefined;
|
|
2632
2718
|
this.#ready = false;
|
|
2633
2719
|
this.#bridgeReady = false;
|
|
2720
|
+
this.#rendererInitialized = false;
|
|
2634
2721
|
if (this.#leaseRenewalTimer)
|
|
2635
2722
|
clearTimeout(this.#leaseRenewalTimer);
|
|
2636
2723
|
this.#leaseRenewalTimer = undefined;
|
|
@@ -2964,8 +3051,8 @@ class PluginSurfaceHostImplementation {
|
|
|
2964
3051
|
}
|
|
2965
3052
|
}
|
|
2966
3053
|
async #handleOperationSnapshot(message) {
|
|
2967
|
-
if (this.bootstrap.uiProtocolVersion !== "plugin-ui-v6") {
|
|
2968
|
-
this.#postError(message.id, "PLUGIN_UI_PROTOCOL_UNSUPPORTED", "Plugin operation observation requires plugin-ui-v6");
|
|
3054
|
+
if (this.bootstrap.uiProtocolVersion !== "plugin-ui-v6" && this.bootstrap.uiProtocolVersion !== "plugin-ui-v7") {
|
|
3055
|
+
this.#postError(message.id, "PLUGIN_UI_PROTOCOL_UNSUPPORTED", "Plugin operation observation requires plugin-ui-v6 or plugin-ui-v7");
|
|
2969
3056
|
return;
|
|
2970
3057
|
}
|
|
2971
3058
|
const controller = this.#registerPendingRequest(message.id);
|
|
@@ -3326,6 +3413,7 @@ class PluginSurfaceHostImplementation {
|
|
|
3326
3413
|
return;
|
|
3327
3414
|
this.#ready = false;
|
|
3328
3415
|
this.#bridgeReady = false;
|
|
3416
|
+
this.#rendererInitialized = false;
|
|
3329
3417
|
this.#openSignals?.firstPaint.reject(error);
|
|
3330
3418
|
this.#openSignals?.workerReady.reject(error);
|
|
3331
3419
|
this.#reportError(error);
|
|
@@ -3960,7 +4048,7 @@ function validateHostBootstrap(bootstrap) {
|
|
|
3960
4048
|
throw new PluginBridgeError("PLUGIN_CONTRACT_MISMATCH", "Plugin surface bootstrap is incomplete");
|
|
3961
4049
|
}
|
|
3962
4050
|
}
|
|
3963
|
-
if (bootstrap.uiProtocolVersion !== "plugin-ui-v5" && bootstrap.uiProtocolVersion !== "plugin-ui-v6") {
|
|
4051
|
+
if (bootstrap.uiProtocolVersion !== "plugin-ui-v5" && bootstrap.uiProtocolVersion !== "plugin-ui-v6" && bootstrap.uiProtocolVersion !== "plugin-ui-v7") {
|
|
3964
4052
|
throw new PluginBridgeError("PLUGIN_CONTRACT_MISMATCH", "Plugin surface UI protocol is unsupported");
|
|
3965
4053
|
}
|
|
3966
4054
|
if (!Number.isSafeInteger(bootstrap.managementRevision) || bootstrap.managementRevision < 1 ||
|
|
@@ -4056,6 +4144,50 @@ function isOpaqueSurfaceDocument(value) {
|
|
|
4056
4144
|
new Set(value.assets.map((asset) => asset.path)).size === value.assets.length &&
|
|
4057
4145
|
Number.isSafeInteger(value.critical_bytes) && Number(value.critical_bytes) >= 0 && Number(value.critical_bytes) <= 8 * 1024 * 1024;
|
|
4058
4146
|
}
|
|
4147
|
+
function isPluginBridgeContextMessage(value) {
|
|
4148
|
+
return hasExactKeys(value, ["type", "context"]) && value.type === "redevplugin.bridge.context" && isPluginSurfaceContext(value.context);
|
|
4149
|
+
}
|
|
4150
|
+
function isPluginSurfaceContext(value) {
|
|
4151
|
+
if (!isRecord(value) || !hasExactKeys(value, ["schema_version", "revision", "appearance", "locale"]) || value.schema_version !== pluginSurfaceContextSchemaVersion ||
|
|
4152
|
+
!Number.isSafeInteger(value.revision) || Number(value.revision) < 1)
|
|
4153
|
+
return false;
|
|
4154
|
+
const appearance = value.appearance;
|
|
4155
|
+
const locale = value.locale;
|
|
4156
|
+
if (!isRecord(appearance) || !hasExactKeys(appearance, ["color_scheme", "colors"]) ||
|
|
4157
|
+
(appearance.color_scheme !== "light" && appearance.color_scheme !== "dark") || !isRecord(appearance.colors))
|
|
4158
|
+
return false;
|
|
4159
|
+
const colors = appearance.colors;
|
|
4160
|
+
if (!hasExactKeys(colors, surfaceContextColorKeys) || surfaceContextColorKeys.some((key) => !validSurfaceContextColor(colors[key])) ||
|
|
4161
|
+
!isRecord(locale) || !hasExactKeys(locale, ["language_tag", "direction"]) || typeof locale.language_tag !== "string" ||
|
|
4162
|
+
locale.language_tag.length < 2 || locale.language_tag.length > 64 || (locale.direction !== "ltr" && locale.direction !== "rtl"))
|
|
4163
|
+
return false;
|
|
4164
|
+
try {
|
|
4165
|
+
return typeof Intl === "undefined" || Intl.getCanonicalLocales(locale.language_tag).length === 1;
|
|
4166
|
+
}
|
|
4167
|
+
catch {
|
|
4168
|
+
return false;
|
|
4169
|
+
}
|
|
4170
|
+
}
|
|
4171
|
+
const surfaceContextColorKeys = ["canvas", "surface", "surface_elevated", "text", "text_muted", "border", "accent", "accent_text", "success", "warning", "danger", "focus"];
|
|
4172
|
+
const surfaceContextColorPattern = new RegExp("^#[0-9a-fA-F]{6}(?:[0-9a-fA-F]{2})?$");
|
|
4173
|
+
const operationProgressPhasePattern = new RegExp("^[A-Za-z0-9._:-]{1,128}$");
|
|
4174
|
+
const operationProgressUnitPattern = new RegExp("^[A-Za-z0-9._:-]{1,64}$");
|
|
4175
|
+
function validSurfaceContextColor(value) {
|
|
4176
|
+
return typeof value === "string" && surfaceContextColorPattern.test(value);
|
|
4177
|
+
}
|
|
4178
|
+
export function normalizePluginSurfaceContext(value) {
|
|
4179
|
+
if (!isPluginSurfaceContext(value)) {
|
|
4180
|
+
throw new PluginBridgeError("PLUGIN_INVALID_REQUEST", "Plugin surface context is invalid");
|
|
4181
|
+
}
|
|
4182
|
+
const languageTag = Intl.getCanonicalLocales(value.locale.language_tag)[0];
|
|
4183
|
+
const colors = Object.fromEntries(surfaceContextColorKeys.map((key) => [key, String(value.appearance.colors[key]).toLowerCase()]));
|
|
4184
|
+
return Object.freeze({
|
|
4185
|
+
schema_version: pluginSurfaceContextSchemaVersion,
|
|
4186
|
+
revision: Number(value.revision),
|
|
4187
|
+
appearance: Object.freeze({ color_scheme: value.appearance.color_scheme, colors: Object.freeze(colors) }),
|
|
4188
|
+
locale: Object.freeze({ language_tag: languageTag, direction: value.locale.direction }),
|
|
4189
|
+
});
|
|
4190
|
+
}
|
|
4059
4191
|
function isBridgeCallMessage(value) {
|
|
4060
4192
|
return hasExactKeys(value, ["type", "request"]) &&
|
|
4061
4193
|
value.type === "redevplugin.bridge.call" &&
|
|
@@ -4096,14 +4228,25 @@ function isPluginOperationSnapshot(value) {
|
|
|
4096
4228
|
!validDateTime(value.created_at) || !validDateTime(value.updated_at))
|
|
4097
4229
|
return false;
|
|
4098
4230
|
const common = ["operation_id", "status", "cancelable", "created_at", "updated_at", "retry_after_ms"];
|
|
4231
|
+
const withProgress = (keys) => hasAllowedKeys(value, [...keys, "progress"]) && (value.progress === undefined || validOperationProgress(value.progress));
|
|
4099
4232
|
if (value.status === "running" || value.status === "cancel_requested")
|
|
4100
|
-
return
|
|
4233
|
+
return withProgress(common);
|
|
4101
4234
|
if (["completed", "canceled", "orphaned_after_disable", "orphaned_after_uninstall"].includes(String(value.status))) {
|
|
4102
|
-
return
|
|
4235
|
+
return withProgress([...common, "terminal_at"]) && validDateTime(value.terminal_at);
|
|
4103
4236
|
}
|
|
4104
|
-
return value.status === "failed" &&
|
|
4237
|
+
return value.status === "failed" && withProgress([...common, "terminal_at", "failure_code"]) &&
|
|
4105
4238
|
validDateTime(value.terminal_at) && ["adapter_failed", "contract_invalid", "platform_failed", "quota_exceeded", "runtime_failed"].includes(String(value.failure_code));
|
|
4106
4239
|
}
|
|
4240
|
+
function validOperationProgress(value) {
|
|
4241
|
+
if (!isRecord(value) || !hasAllowedKeys(value, ["revision", "phase", "completed_units", "total_units", "unit"]) ||
|
|
4242
|
+
!Number.isSafeInteger(value.revision) || Number(value.revision) < 1 || typeof value.phase !== "string" || !operationProgressPhasePattern.test(value.phase) ||
|
|
4243
|
+
(value.unit !== undefined && (typeof value.unit !== "string" || !operationProgressUnitPattern.test(value.unit))) ||
|
|
4244
|
+
(value.completed_units !== undefined && (!Number.isSafeInteger(value.completed_units) || Number(value.completed_units) < 0)) ||
|
|
4245
|
+
(value.total_units !== undefined && (!Number.isSafeInteger(value.total_units) || Number(value.total_units) < 0)) ||
|
|
4246
|
+
(value.completed_units === undefined) !== (value.total_units === undefined))
|
|
4247
|
+
return false;
|
|
4248
|
+
return value.completed_units === undefined || Number(value.completed_units) <= Number(value.total_units);
|
|
4249
|
+
}
|
|
4107
4250
|
function validDateTime(value) {
|
|
4108
4251
|
return typeof value === "string" && value.length > 0 && Number.isFinite(Date.parse(value));
|
|
4109
4252
|
}
|
package/dist/trusted-parent.d.ts
CHANGED
|
@@ -2,6 +2,6 @@ export * from "./contracts.gen.js";
|
|
|
2
2
|
export * from "./errors.js";
|
|
3
3
|
export * from "./platform.js";
|
|
4
4
|
export { PluginSurfaceScope, createPluginSurfaceScope } from "./surface-scope.js";
|
|
5
|
-
export { PluginSurfaceReloadLimiter, PluginSurfaceSlot, createReDevPluginSurfaceTransport, defaultPluginSurfaceReloadMax, defaultPluginSurfaceReloadWindowMs, isPluginRiskPlan, opaqueSurfaceDocumentSchemaVersion, pluginRiskPlanSchemaVersion, trustedParentBridgeHandshakeTranscriptSHA256, } from "./surface.js";
|
|
6
|
-
export type { BridgeLifecycleEvent, MessageChannelLike, MessageEventLike, MessagePortLike, OpaqueSurfaceAsset, OpaqueSurfaceDocument, OpaqueSurfaceStyle, OpaqueSurfaceWorker, PluginConfirmationDecision, PluginConfirmationHandler, PluginConfirmationIntent, PluginConfirmationPlan, PluginMethodResult, PluginRiskEffect, PluginRiskFlag, PluginRiskPlan, PluginRiskSeverity, PluginStreamEvent, PluginSurfaceHost, PluginSurfaceCloseResult, PluginSurfaceOpeningProgress, PluginSurfaceInteractionEvent, PluginSurfaceInteractionKind, PluginSurfaceQuiesceResult, PluginSurfaceRevocationReconciliation, PluginSurfacePreparationResult, PluginSurfaceReloadDecision, PluginSurfaceReloadLimiterOptions, PluginSurfaceReloadState, PluginSurfaceSlotOptions, PluginSurfaceSlotState, PluginTrustedMethodResult, ReDevPluginSurfaceTransport, ReDevPluginSurfaceTransportOptions, TrustedParentBridgeHandshake, TrustedParentBridgeTokenRequest, WindowLike, } from "./surface.js";
|
|
5
|
+
export { PluginSurfaceReloadLimiter, PluginSurfaceSlot, createReDevPluginSurfaceTransport, defaultPluginSurfaceReloadMax, defaultPluginSurfaceReloadWindowMs, isPluginRiskPlan, opaqueSurfaceDocumentSchemaVersion, pluginSurfaceContextSchemaVersion, pluginRiskPlanSchemaVersion, trustedParentBridgeHandshakeTranscriptSHA256, } from "./surface.js";
|
|
6
|
+
export type { BridgeLifecycleEvent, MessageChannelLike, MessageEventLike, MessagePortLike, OpaqueSurfaceAsset, OpaqueSurfaceDocument, OpaqueSurfaceStyle, OpaqueSurfaceWorker, PluginConfirmationDecision, PluginConfirmationHandler, PluginConfirmationIntent, PluginConfirmationPlan, PluginMethodResult, PluginRiskEffect, PluginRiskFlag, PluginRiskPlan, PluginRiskSeverity, PluginStreamEvent, PluginSurfaceHost, PluginSurfaceCloseResult, PluginSurfaceOpeningProgress, PluginSurfaceInteractionEvent, PluginSurfaceInteractionKind, PluginSurfaceQuiesceResult, PluginSurfaceRevocationReconciliation, PluginSurfacePreparationResult, PluginSurfaceContext, PluginSurfaceReloadDecision, PluginSurfaceReloadLimiterOptions, PluginSurfaceReloadState, PluginSurfaceSlotOptions, PluginSurfaceSlotState, PluginTrustedMethodResult, ReDevPluginSurfaceTransport, ReDevPluginSurfaceTransportOptions, TrustedParentBridgeHandshake, TrustedParentBridgeTokenRequest, WindowLike, } from "./surface.js";
|
|
7
7
|
export type { FetchInitLike, FetchLike, FetchResponseLike, PlatformResponse } from "./http.js";
|
package/dist/trusted-parent.js
CHANGED
|
@@ -2,4 +2,4 @@ export * from "./contracts.gen.js";
|
|
|
2
2
|
export * from "./errors.js";
|
|
3
3
|
export * from "./platform.js";
|
|
4
4
|
export { PluginSurfaceScope, createPluginSurfaceScope } from "./surface-scope.js";
|
|
5
|
-
export { PluginSurfaceReloadLimiter, PluginSurfaceSlot, createReDevPluginSurfaceTransport, defaultPluginSurfaceReloadMax, defaultPluginSurfaceReloadWindowMs, isPluginRiskPlan, opaqueSurfaceDocumentSchemaVersion, pluginRiskPlanSchemaVersion, trustedParentBridgeHandshakeTranscriptSHA256, } from "./surface.js";
|
|
5
|
+
export { PluginSurfaceReloadLimiter, PluginSurfaceSlot, createReDevPluginSurfaceTransport, defaultPluginSurfaceReloadMax, defaultPluginSurfaceReloadWindowMs, isPluginRiskPlan, opaqueSurfaceDocumentSchemaVersion, pluginSurfaceContextSchemaVersion, pluginRiskPlanSchemaVersion, trustedParentBridgeHandshakeTranscriptSHA256, } from "./surface.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@floegence/redevplugin-ui",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.20",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"dist"
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@floegence/redevplugin-contracts": "0.6.
|
|
35
|
+
"@floegence/redevplugin-contracts": "0.6.20"
|
|
36
36
|
},
|
|
37
37
|
"publishConfig": {
|
|
38
38
|
"access": "public"
|