@paged-media/plugin-api 0.2.49-canary.0 → 0.2.50-canary.0

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/host.d.ts CHANGED
@@ -5,7 +5,7 @@ import type { AssetSurface } from "./assets";
5
5
  import type { BindingProvider, BindingProviderHandle } from "./binding-provider";
6
6
  import type { ClipboardSurface } from "./clipboard";
7
7
  import type { MutationInput } from "./mutations";
8
- import type { PluginManifest } from "./manifest";
8
+ import type { PluginManifest, WasmArtifact } from "./manifest";
9
9
  import type { SchemaPanelContribution } from "./panel-schema";
10
10
  import type { WidgetSurface } from "./widgets";
11
11
  import type { ObjectModelContribution, ObjectModelHandle, ObjectsSurface } from "./object-model";
@@ -687,6 +687,38 @@ export interface WorkersSurface {
687
687
  * this rather than guessing. */
688
688
  concurrency(): number;
689
689
  }
690
+ /** Where the host serves one declared wasm artifact (`host.modules.resolve`). */
691
+ export interface HostedModule {
692
+ /** Absolute URL of the artifact's bytes. */
693
+ url: string;
694
+ /** Subresource Integrity for the bytes (`sha384-…`), or `null` when
695
+ * neither the manifest nor the host vouches for them. The manifest's own
696
+ * `integrity` wins; a host answer that contradicts it is refused. */
697
+ integrity: string | null;
698
+ /** The declared artifact the answer is for (straight off the manifest). */
699
+ artifact: WasmArtifact;
700
+ }
701
+ /**
702
+ * The MODULE door (ADR 326). Resolves a DECLARED `capabilities.wasm`
703
+ * artifact by `name` to a URL the host serves, with Subresource Integrity.
704
+ * Always present — with no host backend every answer is `null` and
705
+ * `supports("modules@1")` is false; the bundle falls back to its
706
+ * bundle-relative URL (plugin-sdk's `resolveWasm` / `fetchWasm` do the
707
+ * fallback). An undeclared name rejects (capability gate).
708
+ */
709
+ export interface ModulesSurface {
710
+ /** The host's answer for `name`: URL + integrity, or `null` when the host
711
+ * does not serve it. */
712
+ resolve(name: string): Promise<HostedModule | null>;
713
+ /** `resolve(name)`'s URL alone, or `null`. */
714
+ url(name: string): Promise<string | null>;
715
+ /** Fetch the hosted artifact — `fetch(url, { integrity })` when an
716
+ * integrity is known, so a byte that differs fails the fetch instead of
717
+ * reaching `WebAssembly`. `null` when the host does not serve it. Hand
718
+ * the response to `WebAssembly.instantiateStreaming` or to a
719
+ * wasm-bindgen `init({ module_or_path })`. */
720
+ fetch(name: string): Promise<Response | null>;
721
+ }
690
722
  /** The secret a `host.secrets.set` carries (D-11). v1 is a connection
691
723
  * string / token / password as a UTF-8 string — opaque to the contract;
692
724
  * the host stores it under the `ref` and injects it at attach/fetch time.
@@ -1844,6 +1876,12 @@ export interface BundleHost {
1844
1876
  * Capability-gated on `capabilities.workers`. The host facade tracks
1845
1877
  * every spawned worker for automatic teardown on bundle dispose. */
1846
1878
  readonly workers: WorkersSurface;
1879
+ /** The MODULE door (ADR 326): resolve a DECLARED `capabilities.wasm`
1880
+ * artifact through the host — a URL it serves (a first-party module host,
1881
+ * immutable per version) plus Subresource Integrity. Always present; with
1882
+ * no host backend every answer is `null` (load the bundle-relative copy)
1883
+ * and `supports("modules@1")` is false. An undeclared name rejects. */
1884
+ readonly modules: ModulesSurface;
1847
1885
  /** The capability-gated, REFERENCE-ONLY CREDENTIAL STORE (D-11;
1848
1886
  * rfc-credential-store): `set` (host-UI-prompted) / `exists` / `forget`
1849
1887
  * a `credentialRef` — and DELIBERATELY NO `get` (secret bytes never
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export type { PluginId, PluginManifest, PluginCapabilities, PluginContributions, NetworkCapability, DataProvidersCapability, StorageCapability, WasmArtifact, WasmPurpose, WorkersCapability, SecretsCapability, DocumentsCapability, GpuCapability, ObjectModelDeclaration, } from "./manifest";
2
2
  export type { Address, Selector, PropertyPathName, PageItemKind, StyleFamily, ParsedAddress, AddressKind, ValueType, StructField, ValueTypeKind, PropertySchema, ContentSchema, ObjectErrorCode, ObjectValue, ObjectOp, PartChange, ObjectWrite, ObjectQuery, ObjectPredicate, ObjectKindContribution, TypedCommandContribution, ObjectModelContribution, ObjectModelHandle, ObjectWriteResult, ObjectCommandResult, ObjectChange, ObjectKindInfo, ObjectCommandInfo, ObjectsSurface, ListEdit, StructEdit, ValueEdit, } from "./object-model";
3
3
  export type { BundleHandle, PagedBundle } from "./bundle";
4
- export type { BundleHost, ContributionSurface, SceneLayerSurface, SceneLayerSubmitResult, SceneImage, SceneImageTile, SceneImageSubmitOptions, WillSaveEvent, ToolsSurface, ToolSettingValue, ImagesSurface, ImageResourceClaimOptions, TileBytes, WorkersSurface, BundleWorker, SpawnWorkerOptions, SecretsSurface, SecretMaterial, DocumentSurface, MutateWithBytesOptions, SelectionSurface, ViewportSurface, TextRange, RenderSurface, RenderSnapshotOptions, RenderedPage, TextSurface, TextMetrics, TextCaret, FrameChainLink, PlanarFace, PlanarRegionsResult, StoryContent, ParagraphContent, RunContent, OverlaySurface, OverlayLayer, ShellSurface, FilePickerOptions, PickedFile, SaveFileOptions, StorageSurface, BlobSurface, BlobUsage, PartsSurface, NativeDocumentSurface, DocumentsSurface, OpenDocumentOptions, OpenDocumentResult, NetworkSurface, ConsentResult, DataProvidersSurface, DataProviderRegistration, DataProviderHandle, DataProviderInfo, DataProviderSnapshot, ProviderSchema, ProviderField, ProviderRecordSet, DiagnosticsSurface, JournalSurface, JournalRecord, BindingsSurface, Diagnostic, DocumentChangeEvent, DocumentOpenedEvent, MutationOutcome, Disposable, PluginLogger, EditContextContribution, ObjectTypeContribution, EditContextCandidate, EnteredEditContext, ContentPointerEvent, ContentWheelEvent, EditContextDescriptor, ObjectTypeDescriptor, PluginMetadataEnvelope, ObjectTypeBaker, BakeContext, MenuContribution, } from "./host";
4
+ export type { BundleHost, ContributionSurface, SceneLayerSurface, SceneLayerSubmitResult, SceneImage, SceneImageTile, SceneImageSubmitOptions, WillSaveEvent, ToolsSurface, ToolSettingValue, ImagesSurface, ImageResourceClaimOptions, TileBytes, WorkersSurface, BundleWorker, SpawnWorkerOptions, ModulesSurface, HostedModule, SecretsSurface, SecretMaterial, DocumentSurface, MutateWithBytesOptions, SelectionSurface, ViewportSurface, TextRange, RenderSurface, RenderSnapshotOptions, RenderedPage, TextSurface, TextMetrics, TextCaret, FrameChainLink, PlanarFace, PlanarRegionsResult, StoryContent, ParagraphContent, RunContent, OverlaySurface, OverlayLayer, ShellSurface, FilePickerOptions, PickedFile, SaveFileOptions, StorageSurface, BlobSurface, BlobUsage, PartsSurface, NativeDocumentSurface, DocumentsSurface, OpenDocumentOptions, OpenDocumentResult, NetworkSurface, ConsentResult, DataProvidersSurface, DataProviderRegistration, DataProviderHandle, DataProviderInfo, DataProviderSnapshot, ProviderSchema, ProviderField, ProviderRecordSet, DiagnosticsSurface, JournalSurface, JournalRecord, BindingsSurface, Diagnostic, DocumentChangeEvent, DocumentOpenedEvent, MutationOutcome, Disposable, PluginLogger, EditContextContribution, ObjectTypeContribution, EditContextCandidate, EnteredEditContext, ContentPointerEvent, ContentWheelEvent, EditContextDescriptor, ObjectTypeDescriptor, PluginMetadataEnvelope, ObjectTypeBaker, BakeContext, MenuContribution, } from "./host";
5
5
  export type { PanelSchema, PanelSchemaSection, PanelSchemaRow, SchemaPanelContribution, SchemaPanelRenderer, SchemaPanelRendererProps, WidgetValueBinding, BindingRef, SchemaGate, WidgetCollectionBinding, SchemaRowAction, SchemaListAction, SchemaListSpec, PanelSchemaWidgetRow, PanelSchemaPropertyRow, PropertyFieldAddress, PropertyFieldStyle, PropertyFieldOption, PropertySubField, PropertyListPresentation, } from "./panel-schema";
6
6
  export type { WidgetSurface, ColorPickerProps, CodeEditorProps, CodeEditorDiagnostic, CodeEditorLanguage, PropertyFieldProps, PropertyFrameProps, PropertyFieldTarget, } from "./widgets";
7
7
  export type { BindingTarget, BindingPropertyRequest, BindingPropertyWrite, BindingCollectionRequest, BindingRead, BindingResolved, BindingDecline, BindingWrite, BindingCollection, BindingOp, BindingProvider, BindingProviderScope, BindingProviderHandle, BindingReadResult, BindingWriteResult, BindingCollectionResult, ActiveBindingProvider, } from "./binding-provider";
@@ -289,6 +289,13 @@ export interface WasmArtifact {
289
289
  * be ≤ the host's hard per-artifact ceiling; the loader enforces the
290
290
  * stricter of the two. */
291
291
  maxBytes?: number;
292
+ /** Optional Subresource Integrity of the shipped bytes
293
+ * (`sha384-<base64>`; `sha256-` / `sha512-` are accepted). Stamped at
294
+ * build time by `paged-plugin integrity <bundle-dir>`; the CLI fails a
295
+ * manifest whose stamp does not match the file next to it. When present
296
+ * it is what `host.modules` hands `fetch(url, { integrity })` — the
297
+ * bundle vouches for its own bytes, wherever the host serves them. */
298
+ integrity?: string;
292
299
  }
293
300
  export interface PluginContributions {
294
301
  /** Tool ids the bundle registers. Must be namespaced by `id`. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paged-media/plugin-api",
3
- "version": "0.2.49-canary.0",
3
+ "version": "0.2.50-canary.0",
4
4
  "description": "The Paged plugin contract: manifest, bundle lifecycle, the BundleHost surface, and the contribution + engine wire types. Type-only.",
5
5
  "license": "MPL-2.0 OR LicenseRef-PMEL",
6
6
  "type": "module",
@@ -240,6 +240,11 @@
240
240
  "minimum": 1,
241
241
  "maximum": 100000000,
242
242
  "description": "Per-artifact byte ceiling (tightens, never widens, the host cap). Host cap: 100 MB, the app-wide envelope (whole editor + every plugin, 2026-08-19). Enforced as a SUM by the editor's scripts/wasm-budget.mjs; this per-artifact value is a hard upper stop a manifest may only tighten."
243
+ },
244
+ "integrity": {
245
+ "type": "string",
246
+ "pattern": "^sha(256|384|512)-[A-Za-z0-9+/]+={0,2}$",
247
+ "description": "Subresource Integrity of the shipped bytes (sha384- recommended). Stamped by `paged-plugin integrity`; the CLI fails a stamp that does not match the file. host.modules passes it to fetch (ADR 326)."
243
248
  }
244
249
  }
245
250
  }