@floegence/redevplugin-ui 0.4.3 → 0.6.5

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/surface.d.ts CHANGED
@@ -1,9 +1,10 @@
1
- import { PluginBridgeError } from "./errors.js";
1
+ import { PluginBridgeError, type PluginMutationOutcome } from "./errors.js";
2
2
  import { pluginUIProtocolVersion } from "./contracts.gen.js";
3
- import { type OpaqueSurfaceAllowedTag } from "./opaque-surface-policy.gen.js";
4
3
  import { type FetchLike } from "./http.js";
5
4
  import { type PluginSurfaceScope } from "./surface-scope.js";
6
- export declare const opaqueSurfaceDocumentSchemaVersion: "redevplugin.opaque_surface_document.v2";
5
+ import { type PluginUIVNode } from "./ui-reconciler.js";
6
+ export type { PluginUIAttributeValue, PluginUIElementVNode, PluginUIPatchOperation, PluginUIVNode, } from "./ui-reconciler.js";
7
+ export declare const opaqueSurfaceDocumentSchemaVersion: "redevplugin.opaque_surface_document.v3";
7
8
  export declare const pluginRiskPlanSchemaVersion: "redevplugin.capability.risk_plan.v1";
8
9
  export type PluginJSONValue = null | boolean | number | string | PluginJSONValue[] | PluginJSONObject;
9
10
  export type PluginJSONObject = {
@@ -26,7 +27,7 @@ export type TrustedParentBridgeHandshake = {
26
27
  active_fingerprint: string;
27
28
  bridge_nonce: string;
28
29
  asset_session_nonce: string;
29
- plugin_state_version: number;
30
+ management_revision: number;
30
31
  revoke_epoch: number;
31
32
  ui_protocol_version: typeof pluginUIProtocolVersion;
32
33
  };
@@ -53,6 +54,7 @@ export type PluginBridgeResponse = {
53
54
  error_code: string;
54
55
  error: string;
55
56
  error_details?: PluginJSONObject;
57
+ mutation_outcome?: PluginMutationOutcome;
56
58
  };
57
59
  export type PluginBridgeCancelMessage = {
58
60
  type: "redevplugin.bridge.cancel";
@@ -70,6 +72,9 @@ export type PluginBridgeLifecycleAckMessage = {
70
72
  export type PluginUIActionEvent = {
71
73
  action: string;
72
74
  event: "click" | "input" | "change" | "submit" | "escape";
75
+ targetKey: string;
76
+ editRevision: number;
77
+ isComposing: boolean;
73
78
  value?: string;
74
79
  checked?: boolean;
75
80
  form_data?: Record<string, string>;
@@ -117,13 +122,6 @@ export type PluginCanvasPointerEvent = {
117
122
  pressure: number;
118
123
  };
119
124
  export type PluginCanvasInputEvent = PluginCanvasFocusEvent | PluginCanvasResizeEvent | PluginCanvasKeyEvent | PluginCanvasPointerEvent;
120
- export type PluginUIAttributeValue = string | number | boolean;
121
- export type PluginUIVNode = string | {
122
- type: "element";
123
- tag: OpaqueSurfaceAllowedTag;
124
- attributes?: Record<string, PluginUIAttributeValue>;
125
- children?: PluginUIVNode[];
126
- };
127
125
  export type PluginMethodResult<T = unknown> = {
128
126
  data: T;
129
127
  operation_id?: string;
@@ -227,16 +225,19 @@ export type PluginBridgeClientOptions = {
227
225
  port?: MessagePortLike;
228
226
  surfaceHandle?: string;
229
227
  };
228
+ export type PluginBridgeRequestOptions = {
229
+ signal?: AbortSignal;
230
+ };
230
231
  export declare class PluginBridgeClient {
231
232
  #private;
232
233
  readonly surfaceHandle: string;
233
234
  readonly timeoutMs: number;
234
235
  constructor(options?: PluginBridgeClientOptions);
235
236
  ready(): Promise<void>;
236
- call<T = unknown>(method: string, params?: PluginJSONObject): Promise<T>;
237
- readStream(streamHandle: string): Promise<PluginStreamReadResult>;
238
- cancelOperation(operationID: string, reason?: string): Promise<void>;
239
- render(tree: PluginUIVNode | PluginUIVNode[]): Promise<void>;
237
+ call<T = unknown>(method: string, params?: PluginJSONObject, options?: PluginBridgeRequestOptions): Promise<T>;
238
+ readStream(streamHandle: string, options?: PluginBridgeRequestOptions): Promise<PluginStreamReadResult>;
239
+ cancelOperation(operationID: string, reason?: string, options?: PluginBridgeRequestOptions): Promise<void>;
240
+ render(tree: PluginUIVNode): Promise<void>;
240
241
  openCanvas(canvasId: string): Promise<PluginCanvasSurface>;
241
242
  updateCanvasAccessibility(canvasId: string, state: PluginCanvasAccessibilityState): Promise<void>;
242
243
  loadImageAsset(assetId: string): Promise<ImageBitmap>;
@@ -322,7 +323,7 @@ export type PluginSurfacePreparationResult = {
322
323
  asset_session_nonce: string;
323
324
  entry_path: string;
324
325
  entry_sha256: string;
325
- plugin_state_version: number;
326
+ management_revision: number;
326
327
  revoke_epoch: number;
327
328
  issued_at: string;
328
329
  expires_at: string;
@@ -340,7 +341,7 @@ export type PluginSurfaceHostBootstrap = {
340
341
  entrySHA256: string;
341
342
  assetTicket: string;
342
343
  assetSessionNonce: string;
343
- pluginStateVersion: number;
344
+ managementRevision: number;
344
345
  revokeEpoch: number;
345
346
  runtimeGenerationId: string;
346
347
  };
@@ -348,6 +349,22 @@ export type PluginSurfaceOpeningProgress = {
348
349
  phase: "opening";
349
350
  elapsedMs: number;
350
351
  };
352
+ export type PluginSurfaceHost = {
353
+ readonly element: HTMLIFrameElement;
354
+ readonly surfaceInstanceId: string;
355
+ sendLifecycle(event: Exclude<BridgeLifecycleEvent, {
356
+ type: "ready" | "dispose";
357
+ }>): void;
358
+ close(): Promise<PluginSurfaceCloseResult>;
359
+ dispose(): Promise<void>;
360
+ };
361
+ export type PreparedPluginSurfaceHost = PluginSurfaceHost & {
362
+ readonly bootstrap: PluginSurfaceHostBootstrap;
363
+ readonly bridgeChannelId: string;
364
+ readonly frameGenerationId: string;
365
+ readonly surfaceHandle: string;
366
+ open(): Promise<void>;
367
+ };
351
368
  export type PluginSurfaceHostOptions = {
352
369
  bootstrap: PluginSurfaceHostBootstrap;
353
370
  hostTransport: ReDevPluginSurfaceTransport;
@@ -361,6 +378,13 @@ export type PluginSurfaceHostOptions = {
361
378
  onOpeningProgress?: (progress: PluginSurfaceOpeningProgress) => void;
362
379
  onError?: (error: PluginBridgeError) => void;
363
380
  };
381
+ type PluginSurfaceOpeningRequest = {
382
+ pluginInstanceId: string;
383
+ surfaceScope: PluginSurfaceScope;
384
+ signal?: AbortSignal;
385
+ abortError: () => Error;
386
+ open: () => Promise<PluginSurfaceHostOptions>;
387
+ };
364
388
  declare const redevPluginSurfaceTransportBrand: unique symbol;
365
389
  export type ReDevPluginSurfaceTransport = {
366
390
  readonly [redevPluginSurfaceTransportBrand]: true;
@@ -373,21 +397,30 @@ export declare function createReDevPluginSurfaceTransport(options?: ReDevPluginS
373
397
  export type OpaquePluginBootstrapHTMLOptions = {
374
398
  scriptNonce?: string;
375
399
  };
400
+ export type PluginSurfaceQuiesceResult = {
401
+ outcome: "acknowledged" | "not_ready" | "timed_out";
402
+ durationMs: number;
403
+ };
404
+ export type PluginSurfaceCloseResult = {
405
+ quiesce: PluginSurfaceQuiesceResult;
406
+ revokeDurationMs: number;
407
+ totalDurationMs: number;
408
+ };
376
409
  export declare function createOpaquePluginBootstrapHTML(options?: OpaquePluginBootstrapHTMLOptions): string;
377
- export declare class PluginSurfaceHost {
410
+ export declare function createPreparedPluginSurfaceHost(options: PluginSurfaceHostOptions): PreparedPluginSurfaceHost;
411
+ export type PluginSurfaceSlotState = "empty" | "opening" | "ready" | "error" | "disposed";
412
+ export type PluginSurfaceSlotOptions = {
413
+ stage: HTMLElement;
414
+ onStateChange?: (state: PluginSurfaceSlotState, error?: PluginBridgeError) => void;
415
+ onSurfaceClosed?: (result: PluginSurfaceCloseResult) => void;
416
+ };
417
+ export declare function openPluginSurfaceInSlot(slot: PluginSurfaceSlot, request: PluginSurfaceOpeningRequest): Promise<PluginSurfaceHost>;
418
+ export declare function openPreparedPluginSurfaceInSlot(slot: PluginSurfaceSlot, options: PluginSurfaceHostOptions | PromiseLike<PluginSurfaceHostOptions>): Promise<PluginSurfaceHost>;
419
+ export declare class PluginSurfaceSlot {
378
420
  #private;
379
- readonly element: HTMLIFrameElement;
380
- readonly bootstrap: PluginSurfaceHostBootstrap;
381
- readonly bridgeChannelId: string;
382
- readonly frameGenerationId: string;
383
- readonly surfaceHandle: string;
384
- static create(options: PluginSurfaceHostOptions): PluginSurfaceHost;
421
+ readonly element: HTMLElement;
422
+ static create(options: PluginSurfaceSlotOptions): PluginSurfaceSlot;
385
423
  private constructor();
386
- open(): Promise<void>;
387
- sendLifecycle(event: Exclude<BridgeLifecycleEvent, {
388
- type: "ready" | "dispose";
389
- }>): void;
390
- close(): Promise<void>;
391
- dispose(): void;
424
+ close(): Promise<PluginSurfaceCloseResult | undefined>;
425
+ dispose(): Promise<void>;
392
426
  }
393
- export {};