@paged-media/plugin-api 0.2.48-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.
@@ -1174,6 +1206,23 @@ export interface ViewportSurface {
1174
1206
  * `goToPage`, a page deleted under it). Never fires without a host
1175
1207
  * backend. */
1176
1208
  onDidChangeActivePage(listener: (pageId: PageId | null) => void): Disposable;
1209
+ /** Bring a range of a story's text into view: the camera moves to the
1210
+ * page and position where the range is laid out, and with
1211
+ * `select: true` (the default) the range becomes the text selection.
1212
+ * The door an outline, a find result or a diagnostic needs to take the
1213
+ * user TO a piece of text. Offsets are story-relative UTF-16 indices,
1214
+ * `start <= end`; an empty range places the caret. `false` when the
1215
+ * story is unknown, the range is not laid out (overset) or the host
1216
+ * can't navigate: probe `supports("viewport.revealText@1")`. */
1217
+ revealText(range: TextRange, options?: {
1218
+ select?: boolean;
1219
+ }): Promise<boolean>;
1220
+ }
1221
+ /** A range of a story's text, by story id and story-relative offsets. */
1222
+ export interface TextRange {
1223
+ storyId: string;
1224
+ start: number;
1225
+ end: number;
1177
1226
  }
1178
1227
  /** v70 — what `host.render.snapshot` renders. */
1179
1228
  export interface RenderSnapshotOptions {
@@ -1827,6 +1876,12 @@ export interface BundleHost {
1827
1876
  * Capability-gated on `capabilities.workers`. The host facade tracks
1828
1877
  * every spawned worker for automatic teardown on bundle dispose. */
1829
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;
1830
1885
  /** The capability-gated, REFERENCE-ONLY CREDENTIAL STORE (D-11;
1831
1886
  * rfc-credential-store): `set` (host-UI-prompted) / `exists` / `forget`
1832
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, 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.48-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
  }