@floegence/redevplugin-ui 0.7.27 → 1.0.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.
@@ -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 PluginSurfaceContext, 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 PluginMethodResult, type ReDevPluginSurfaceTransport } from "./surface.js";
4
4
  import { type PluginSurfaceScope } from "./surface-scope.js";
5
5
  export type PluginPlatformClientOptions = {
6
6
  fetch?: FetchLike;
@@ -30,19 +30,12 @@ export type PluginEnableState = PluginRecord["enable_state"];
30
30
  export type PluginPackageHashSet = PlatformSchemas["PackageHashSet"];
31
31
  export type PluginReleaseRef = PlatformSchemas["PluginReleaseRef"];
32
32
  export type PluginInstallReleaseRefRequest = PlatformSchemas["InstallReleaseRefRequest"];
33
- export type PluginStartReleaseInstallOperationRequest = PlatformSchemas["StartReleaseInstallOperationRequest"];
34
- export type PluginReleaseInstallOperation = PlatformSchemas["ReleaseInstallOperation"];
35
- export type PluginReleaseInstallOperationList = PlatformSchemas["ReleaseInstallOperationList"];
36
- export type PluginWatchReleaseInstallOperationOptions = PluginRequestOptions & {
37
- onUpdate?: (operation: PluginReleaseInstallOperation) => void;
38
- };
39
33
  export type PluginUpdateReleaseRefRequest = PlatformSchemas["UpdateReleaseRefRequest"];
40
34
  export type PluginInspectExternalPackageRequest = PlatformSchemas["InspectExternalPackageRequest"];
41
35
  export type PluginUploadedExternalPackageIntent = PlatformSchemas["ExternalPackageIntentRequest"];
42
36
  export type PluginExternalPackageInspection = PlatformSchemas["ExternalPackageInspection"];
43
- export type PluginCommitExternalPackageRequest = PlatformSchemas["CommitExternalPackageRequest"];
44
- export type PluginQueryExternalPackageCommitRequest = PlatformSchemas["QueryExternalPackageCommitRequest"];
45
- export type PluginExternalPackageCommitResult = PlatformSchemas["ExternalPackageCommitResult"];
37
+ export type PluginInstallInspectedPackageRequest = PlatformSchemas["InstallInspectedPackageRequest"];
38
+ export type PluginInstalledExternalPackage = PlatformSchemas["InstalledExternalPackage"];
46
39
  export type PluginDowngradeRequest = PlatformSchemas["DowngradeRequest"];
47
40
  export type PluginEnableRequest = PlatformSchemas["EnableRequest"];
48
41
  export type PluginDisableRequest = PlatformSchemas["DisableRequest"];
@@ -71,7 +64,8 @@ export type PluginRuntimeLimits = Readonly<PlatformSchemas["RuntimeLimits"]>;
71
64
  export type PluginRuntimeHealth = PlatformSchemas["PluginRuntimeHealth"];
72
65
  export type PluginRuntimeShardHealth = PlatformSchemas["PluginRuntimeShardHealth"];
73
66
  export type PluginRuntimeStopResult = PlatformSchemas["PluginRuntimeStopResult"];
74
- export type PluginRuntimeRefreshResult = PlatformSchemas["PluginRuntimeRefreshResult"];
67
+ export type PluginRecoverySnapshot = PlatformSchemas["RecoverySnapshot"];
68
+ export type PluginRecoveryResult = PlatformSchemas["PluginRecoveryResult"];
75
69
  export type PluginSettingsField = PlatformSchemas["PluginSettingsField"];
76
70
  export type PluginSettingsSchema = PlatformSchemas["PluginSettingsSchema"];
77
71
  export type PluginSettingsSnapshot = PlatformSchemas["PluginSettingsSnapshot"];
@@ -85,10 +79,13 @@ export type PluginSettingsPatchRequest = PluginSettingsPatchBase & ({
85
79
  remove: [string, ...string[]];
86
80
  });
87
81
  export type PluginCapabilityContractPin = PlatformSchemas["HostCapabilityPinV1"];
88
- export type PluginPublicOperationBinding = PlatformSchemas["PublicOperationBinding"];
89
- export type PluginOperationRecord = PlatformSchemas["OperationRecord"];
90
- export type PluginOperationList = PlatformSchemas["PluginOperationList"];
91
- export type PluginOperationListOptions = PlatformSchemas["ListOperationsQueryRequest"];
82
+ export type PluginExecution = PlatformSchemas["Execution"];
83
+ export type PluginEvent = PlatformSchemas["Event"];
84
+ export type PluginStartReleaseInstallExecutionRequest = PlatformSchemas["StartReleaseInstallExecutionRequest"];
85
+ export type PluginExecutionList = PlatformSchemas["ExecutionList"];
86
+ export type PluginExecutionEventList = PlatformSchemas["ExecutionEventList"];
87
+ export type PluginExecutionListOptions = PlatformSchemas["ListExecutionsRequest"];
88
+ export type PluginExecutionEventListOptions = PlatformSchemas["ListExecutionEventsRequest"];
92
89
  export type PluginIntentRecord = PlatformSchemas["PluginIntentRecord"];
93
90
  export type PluginIntentList = PlatformSchemas["PluginIntentList"];
94
91
  export type PluginIntentListOptions = PlatformSchemas["ListIntentsQueryRequest"];
@@ -135,15 +132,9 @@ export declare class PluginPlatformClient {
135
132
  features(options?: PluginRequestOptions): Promise<PluginFeatures>;
136
133
  getCompatibility(options?: PluginRequestOptions): Promise<PluginCompatibilityManifest>;
137
134
  installReleaseRef(request: PluginInstallReleaseRefRequest, options?: PluginRequestOptions): Promise<PluginRecord>;
138
- startReleaseInstallOperation(request: PluginStartReleaseInstallOperationRequest, options?: PluginRequestOptions): Promise<PluginReleaseInstallOperation>;
139
- listReleaseInstallOperations(options?: PluginRequestOptions): Promise<PluginReleaseInstallOperationList>;
140
- getReleaseInstallOperation(operationId: string, options?: PluginRequestOptions): Promise<PluginReleaseInstallOperation>;
141
- getReleaseInstallOperationByRequest(requestId: string, options?: PluginRequestOptions): Promise<PluginReleaseInstallOperation>;
142
- watchReleaseInstallOperation(operationId: string, options?: PluginWatchReleaseInstallOperationOptions): Promise<PluginReleaseInstallOperation>;
143
135
  inspectExternalPackage(request: PluginInspectExternalPackageRequest, options?: PluginRequestOptions): Promise<PluginExternalPackageInspection>;
144
136
  inspectUploadedExternalPackage(intent: PluginUploadedExternalPackageIntent, packageBlob: Blob, options?: PluginRequestOptions): Promise<PluginExternalPackageInspection>;
145
- commitExternalPackage(request: PluginCommitExternalPackageRequest, options?: PluginRequestOptions): Promise<PluginExternalPackageCommitResult>;
146
- queryExternalPackageCommit(request: PluginQueryExternalPackageCommitRequest, options?: PluginRequestOptions): Promise<PluginExternalPackageCommitResult>;
137
+ installInspectedPackage(request: PluginInstallInspectedPackageRequest, options?: PluginRequestOptions): Promise<PluginInstalledExternalPackage>;
147
138
  updateReleaseRef(request: PluginUpdateReleaseRefRequest, options?: PluginRequestOptions): Promise<PluginRecord>;
148
139
  downgradePlugin(request: PluginDowngradeRequest, options?: PluginRequestOptions): Promise<PluginRecord>;
149
140
  enablePlugin(request: PluginEnableRequest, options?: PluginRequestOptions): Promise<PluginRecord>;
@@ -153,16 +144,19 @@ export declare class PluginPlatformClient {
153
144
  revokeSessionScope(options?: PluginRequestOptions): Promise<PluginSessionScopeRevokeResult>;
154
145
  startRuntime(request: PluginRuntimeStartRequest, options?: PluginRequestOptions): Promise<PluginRuntimeHealth>;
155
146
  stopRuntime(options?: PluginRequestOptions): Promise<PluginRuntimeStopResult>;
156
- refreshEnabledRuntimeState(options?: PluginRequestOptions): Promise<PluginRuntimeRefreshResult>;
147
+ recoverEnabled(options?: PluginRequestOptions): Promise<PluginRecoverySnapshot>;
148
+ retryRecovery(pluginInstanceId: string, options?: PluginRequestOptions): Promise<PluginRecoveryResult>;
157
149
  runtimeHealth(options?: PluginRequestOptions): Promise<PluginRuntimeHealth>;
158
150
  getSettingsSchema(pluginInstanceId: string, scope: PluginResourceScopeKind, options?: PluginRequestOptions): Promise<PluginSettingsSchema>;
159
151
  getSettings(pluginInstanceId: string, scope: PluginResourceScopeKind, options?: PluginRequestOptions): Promise<PluginSettingsSnapshot>;
160
152
  patchSettings(pluginInstanceId: string, request: PluginSettingsPatchRequest, options?: PluginRequestOptions): Promise<PluginSettingsSnapshot>;
161
- listOperations(options?: PluginOperationListOptions, requestOptions?: PluginRequestOptions): Promise<PluginOperationList>;
162
- getOperation(operationId: string, options?: PluginRequestOptions): Promise<PluginOperationRecord>;
163
- cancelOperation(operationId: string, reason?: string, options?: PluginRequestOptions): Promise<PluginOperationRecord>;
153
+ listExecutions(options?: PluginExecutionListOptions, requestOptions?: PluginRequestOptions): Promise<PluginExecutionList>;
154
+ startReleaseInstallExecution(request: PluginStartReleaseInstallExecutionRequest, options?: PluginRequestOptions): Promise<PluginExecution>;
155
+ getExecution(executionID: string, options?: PluginRequestOptions): Promise<PluginExecution>;
156
+ cancelExecution(executionID: string, reason?: string, options?: PluginRequestOptions): Promise<PluginExecution>;
157
+ listExecutionEvents(executionID: string, request: PluginExecutionEventListOptions, options?: PluginRequestOptions): Promise<PluginExecutionEventList>;
164
158
  listIntents(options?: PluginIntentListOptions, requestOptions?: PluginRequestOptions): Promise<PluginIntentList>;
165
- invokeIntent<T = unknown>(request: PluginIntentInvokeRequest, options?: PluginRequestOptions): Promise<PluginTrustedMethodResult<T>>;
159
+ invokeIntent<T = unknown>(request: PluginIntentInvokeRequest, options?: PluginRequestOptions): Promise<PluginMethodResult<T>>;
166
160
  exportData(request: PluginDataExportRequest, options?: PluginRequestOptions): Promise<PluginDataExportResult>;
167
161
  deleteDataExport(request: PluginDataExportDeleteRequest, options?: PluginRequestOptions): Promise<PluginDataExportDeleteResult>;
168
162
  importData(request: PluginDataImportRequest, options?: PluginRequestOptions): Promise<PluginRecord>;
package/dist/platform.js CHANGED
@@ -41,36 +41,6 @@ export class PluginPlatformClient {
41
41
  installReleaseRef(request, options = {}) {
42
42
  return this.#requestMutation("POST", "/_redevplugin/api/plugins/install-release-ref", request, options);
43
43
  }
44
- async startReleaseInstallOperation(request, options = {}) {
45
- try {
46
- return await this.#requestMutation("POST", "/_redevplugin/api/plugins/release-install-operations", request, options);
47
- }
48
- catch (error) {
49
- if (!(error instanceof PluginTransportError) || error.mutationOutcome !== "unknown" || options.signal?.aborted) {
50
- throw error;
51
- }
52
- return this.getReleaseInstallOperationByRequest(request.request_id, options);
53
- }
54
- }
55
- listReleaseInstallOperations(options = {}) {
56
- return this.#requestGet("/_redevplugin/api/plugins/release-install-operations", options);
57
- }
58
- getReleaseInstallOperation(operationId, options = {}) {
59
- return this.#requestGet(`/_redevplugin/api/plugins/release-install-operations/${encodeURIComponent(operationId)}`, options);
60
- }
61
- getReleaseInstallOperationByRequest(requestId, options = {}) {
62
- return this.#requestGet(`/_redevplugin/api/plugins/release-install-operations/by-request/${encodeURIComponent(requestId)}`, options);
63
- }
64
- async watchReleaseInstallOperation(operationId, options = {}) {
65
- for (;;) {
66
- const operation = await this.getReleaseInstallOperation(operationId, options);
67
- options.onUpdate?.(operation);
68
- if (operation.status === "succeeded" || operation.status === "failed") {
69
- return operation;
70
- }
71
- await waitForReleaseInstallPoll(operation.retry_after_ms, options.signal);
72
- }
73
- }
74
44
  async inspectExternalPackage(request, options = {}) {
75
45
  const inspection = await this.#requestMutation("POST", "/_redevplugin/api/plugins/external-packages/inspect", request, options);
76
46
  this.#externalInspectionTargets.set(inspection.inspection_id, inspection.intent.plugin_instance_id ?? "");
@@ -91,34 +61,18 @@ export class PluginPlatformClient {
91
61
  this.#externalInspectionTargets.set(inspection.inspection_id, update ? canonicalIntent.plugin_instance_id : "");
92
62
  return inspection;
93
63
  }
94
- async commitExternalPackage(request, options = {}) {
64
+ async installInspectedPackage(request, options = {}) {
95
65
  const target = this.#externalInspectionTargets.get(request.inspection_id);
96
66
  let result;
97
67
  try {
98
- result = await this.#requestMutation("POST", "/_redevplugin/api/plugins/external-packages/commit", request, options);
68
+ result = await this.#requestMutation("POST", "/_redevplugin/api/plugins/external-packages/install", request, options);
99
69
  }
100
70
  catch (error) {
101
- await this.#handleMutationFailure(error, target || undefined, "External package commit and local surface teardown failed");
71
+ await this.#handleMutationFailure(error, target || undefined, "External package install and local surface teardown failed");
102
72
  throw error;
103
73
  }
104
- if (result.status === "committed") {
105
- await disposePluginSurfaceScope(this.#surfaceScope, result.plugin.plugin_instance_id);
106
- this.#externalInspectionTargets.delete(request.inspection_id);
107
- }
108
- else if (result.status === "failed") {
109
- this.#externalInspectionTargets.delete(request.inspection_id);
110
- }
111
- return result;
112
- }
113
- async queryExternalPackageCommit(request, options = {}) {
114
- const result = await this.#requestQuery("/_redevplugin/api/plugins/external-packages/commit/query", request, options);
115
- if (result.status === "committed") {
116
- await disposePluginSurfaceScope(this.#surfaceScope, result.plugin.plugin_instance_id);
117
- this.#externalInspectionTargets.delete(request.inspection_id);
118
- }
119
- else if (result.status === "failed") {
120
- this.#externalInspectionTargets.delete(request.inspection_id);
121
- }
74
+ await disposePluginSurfaceScope(this.#surfaceScope, result.plugin.plugin_instance_id);
75
+ this.#externalInspectionTargets.delete(request.inspection_id);
122
76
  return result;
123
77
  }
124
78
  updateReleaseRef(request, options = {}) {
@@ -193,8 +147,11 @@ export class PluginPlatformClient {
193
147
  stopRuntime(options = {}) {
194
148
  return this.#requestMutation("POST", "/_redevplugin/api/plugins/runtime/stop", {}, options);
195
149
  }
196
- refreshEnabledRuntimeState(options = {}) {
197
- return this.#requestMutation("POST", "/_redevplugin/api/plugins/runtime/refresh-enabled", {}, options);
150
+ recoverEnabled(options = {}) {
151
+ return this.#requestMutation("POST", "/_redevplugin/api/plugins/runtime/recover-enabled", {}, options);
152
+ }
153
+ retryRecovery(pluginInstanceId, options = {}) {
154
+ return this.#requestMutation("POST", "/_redevplugin/api/plugins/runtime/recover/retry", { plugin_instance_id: pluginInstanceId }, options);
198
155
  }
199
156
  runtimeHealth(options = {}) { return this.#requestQuery("/_redevplugin/api/plugins/runtime/health/query", {}, options); }
200
157
  getSettingsSchema(pluginInstanceId, scope, options = {}) {
@@ -206,14 +163,20 @@ export class PluginPlatformClient {
206
163
  patchSettings(pluginInstanceId, request, options = {}) {
207
164
  return this.#mutatePluginAt("PATCH", `/_redevplugin/api/plugins/${encodeURIComponent(pluginInstanceId)}/settings`, pluginInstanceId, request, options);
208
165
  }
209
- listOperations(options = {}, requestOptions = {}) {
210
- return this.#requestQuery("/_redevplugin/api/plugins/operations/query", options, requestOptions);
166
+ listExecutions(options = {}, requestOptions = {}) {
167
+ return this.#requestQuery("/_redevplugin/api/plugins/executions/query", options, requestOptions);
211
168
  }
212
- getOperation(operationId, options = {}) {
213
- return this.#requestQuery(`/_redevplugin/api/plugins/operations/${encodeURIComponent(operationId)}/query`, {}, options);
169
+ startReleaseInstallExecution(request, options = {}) {
170
+ return this.#requestMutation("POST", "/_redevplugin/api/plugins/executions/release-installs", request, options);
214
171
  }
215
- cancelOperation(operationId, reason, options = {}) {
216
- return this.#requestMutation("POST", `/_redevplugin/api/plugins/operations/${encodeURIComponent(operationId)}/cancel`, reason ? { reason } : {}, options);
172
+ getExecution(executionID, options = {}) {
173
+ return this.#requestQuery(`/_redevplugin/api/plugins/executions/${encodeURIComponent(executionID)}/query`, {}, options);
174
+ }
175
+ cancelExecution(executionID, reason, options = {}) {
176
+ return this.#requestMutation("POST", `/_redevplugin/api/plugins/executions/${encodeURIComponent(executionID)}/cancel`, reason ? { reason } : {}, options);
177
+ }
178
+ listExecutionEvents(executionID, request, options = {}) {
179
+ return this.#requestQuery(`/_redevplugin/api/plugins/executions/${encodeURIComponent(executionID)}/events/query`, request, options);
217
180
  }
218
181
  listIntents(options = {}, requestOptions = {}) {
219
182
  return this.#requestQuery("/_redevplugin/api/plugins/intents/query", options, requestOptions);
@@ -358,16 +321,6 @@ export class PluginPlatformClient {
358
321
  }, operation);
359
322
  return readPlatformResponse(response);
360
323
  }
361
- async #requestGet(path, options) {
362
- const operation = `GET ${path}`;
363
- const response = await dispatchQueryRequest(this.#fetch, this.#apiBaseURL + path, {
364
- method: "GET",
365
- headers: { "Accept": "application/json" },
366
- credentials: "same-origin",
367
- signal: options.signal,
368
- }, operation);
369
- return readPlatformResponse(response);
370
- }
371
324
  async #requestMutation(method, path, body, options) {
372
325
  const operation = `${method} ${path}`;
373
326
  assertMutationDispatchable(options.signal, operation);
@@ -408,25 +361,6 @@ export class PluginPlatformClient {
408
361
  return readMutationPlatformResponse(response);
409
362
  }
410
363
  }
411
- function waitForReleaseInstallPoll(retryAfterMs, signal) {
412
- const delayMs = Number.isFinite(retryAfterMs)
413
- ? Math.min(10_000, Math.max(250, Math.trunc(retryAfterMs)))
414
- : 500;
415
- if (signal?.aborted) {
416
- return Promise.reject(new PluginTransportError("Plugin release install observation was aborted", signal.reason));
417
- }
418
- return new Promise((resolve, reject) => {
419
- const timeout = setTimeout(() => {
420
- signal?.removeEventListener("abort", onAbort);
421
- resolve();
422
- }, delayMs);
423
- const onAbort = () => {
424
- clearTimeout(timeout);
425
- reject(new PluginTransportError("Plugin release install observation was aborted", signal?.reason));
426
- };
427
- signal?.addEventListener("abort", onAbort, { once: true });
428
- });
429
- }
430
364
  function canonicalUploadedExternalPackageIntent(intent) {
431
365
  if (typeof intent !== "object" || intent === null || Array.isArray(intent)) {
432
366
  throw new TypeError("uploaded external package intent must be a closed install or update object");
@@ -469,12 +403,9 @@ const sessionScopeCountKeys = [
469
403
  "asset_sessions",
470
404
  "plugin_gateway_tokens",
471
405
  "confirmation_tokens",
472
- "stream_tickets",
473
406
  "handle_grants",
474
407
  "confirmations",
475
- "operations",
476
- "streams",
477
- "runtime_executions",
408
+ "executions",
478
409
  "active_network_requests",
479
410
  "sockets",
480
411
  "network_streams",
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, PluginOperationProgress, PluginSurfaceContext, PluginStreamTerminalStatus, PluginUIActionEvent, PluginUIAttributeValue, PluginUIElementVNode, PluginUIPatchOperation, PluginUIVNode, } from "./surface.js";
5
- export type { PluginCapabilitySchema, PluginCapabilityEffect, PluginCapabilityOperationContract, PluginCapabilityStreamContract, PluginCapabilitySyncContract, PluginCapabilityStreamEvent, PluginCapabilityStreamReadResult, PluginOperation, PluginOperationTerminalStatus, PluginOperationWaitOptions, PluginStream, } from "./capability-client.js";
4
+ export type { BridgeLifecycleEvent, MessagePortLike, PluginBridgeClientOptions, PluginBridgeRequestOptions, PluginCanvasAccessibilityState, PluginCanvasInputEvent, PluginCanvasKeyEvent, PluginCanvasPointerEvent, PluginCanvasResizeEvent, PluginCanvasSurface, PluginJSONObject, PluginJSONValue, PluginMethodResult, PluginExecutionFailureCode, PluginExecutionSnapshot, PluginExecutionProgress, PluginExecutionEvent, PluginExecutionEventList, PluginSurfaceContext, PluginUIActionEvent, PluginUIAttributeValue, PluginUIElementVNode, PluginUIPatchOperation, PluginUIVNode, } from "./surface.js";
5
+ export type { PluginCapabilitySchema, PluginCapabilityEffect, PluginCapabilityOperationContract, PluginCapabilityStreamContract, PluginCapabilitySyncContract, PluginCapabilityStreamEvent, PluginCapabilityStreamReadResult, PluginExecution, PluginExecutionTerminalStatus, PluginExecutionWaitOptions, PluginStream, } from "./capability-client.js";
package/dist/surface.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { PluginBridgeError, type PluginMutationOutcome } from "./errors.js";
2
+ import { pluginUIProtocolVersion } from "./contracts.gen.js";
2
3
  import { type FetchLike } from "./http.js";
3
4
  import { type PluginSurfaceScope } from "./surface-scope.js";
4
5
  import { type PluginUIVNode } from "./ui-reconciler.js";
@@ -9,7 +10,7 @@ export type PluginJSONValue = null | boolean | number | string | PluginJSONValue
9
10
  export type PluginJSONObject = {
10
11
  [key: string]: PluginJSONValue;
11
12
  };
12
- export type PluginUIProtocolVersion = "plugin-ui-v5" | "plugin-ui-v6" | "plugin-ui-v7";
13
+ export type PluginUIProtocolVersion = typeof pluginUIProtocolVersion;
13
14
  export declare const pluginSurfaceContextSchemaVersion: "redevplugin.surface_context.v1";
14
15
  export type PluginSurfaceContext = Readonly<{
15
16
  schema_version: typeof pluginSurfaceContextSchemaVersion;
@@ -141,75 +142,71 @@ export type PluginCanvasPointerEvent = {
141
142
  export type PluginCanvasInputEvent = PluginCanvasFocusEvent | PluginCanvasResizeEvent | PluginCanvasKeyEvent | PluginCanvasPointerEvent;
142
143
  export type PluginMethodResult<T = unknown> = {
143
144
  data: T;
144
- operation_id?: string;
145
- stream_handle?: string;
145
+ execution_id?: string;
146
146
  confirmation_required?: boolean;
147
147
  confirmation_token_id?: string;
148
148
  request_hash?: string;
149
149
  };
150
- export type PluginTrustedMethodResult<T = unknown> = Omit<PluginMethodResult<T>, "stream_handle"> & {
151
- stream_id?: string;
152
- stream_ticket?: string;
153
- stream_ticket_id?: string;
154
- stream_expires_at?: string;
155
- };
156
- export type PluginStreamEvent = {
150
+ export type PluginExecutionEvent = {
151
+ execution_id: string;
157
152
  sequence: number;
158
- kind: string;
159
- data?: string;
160
- error?: string;
161
- at: string;
162
- };
163
- export type PluginStreamTerminalStatus = "closed" | "canceled" | "failed" | "orphaned_after_disable" | "orphaned_after_uninstall";
164
- export type PluginStreamReadResult = {
165
- events: PluginStreamEvent[];
166
- done: false;
167
- retry_after_ms: number;
168
- } | {
169
- events: PluginStreamEvent[];
170
- done: true;
171
- terminal_status: PluginStreamTerminalStatus;
172
- retry_after_ms: 0;
153
+ kind: "progress" | "data" | "diagnostic" | "terminal";
154
+ payload?: PluginJSONObject;
155
+ error?: {
156
+ code: string;
157
+ message: string;
158
+ };
159
+ };
160
+ export type PluginExecutionEventList = {
161
+ execution_id: string;
162
+ events: PluginExecutionEvent[];
163
+ cursor: number;
173
164
  };
174
165
  export type PluginExecutionFailureCode = "adapter_failed" | "contract_invalid" | "platform_failed" | "quota_exceeded" | "runtime_failed";
175
- export type PluginOperationProgress = {
166
+ export type PluginExecutionProgress = {
176
167
  revision: number;
177
168
  phase: string;
178
169
  completed_units?: number;
179
170
  total_units?: number;
180
171
  unit?: string;
181
172
  };
182
- type PluginOperationSnapshotActive = {
183
- operation_id: string;
173
+ type PluginExecutionSnapshotActive = {
174
+ execution_id: string;
175
+ plugin_instance_id: string;
176
+ kind: "operation" | "subscription";
184
177
  status: "running" | "cancel_requested";
178
+ cursor: number;
185
179
  cancelable: boolean;
186
180
  created_at: string;
187
181
  updated_at: string;
188
- retry_after_ms: number;
189
- progress?: PluginOperationProgress;
190
- };
191
- type PluginOperationSnapshotTerminal = {
192
- operation_id: string;
193
- status: "completed" | "canceled" | "orphaned_after_disable" | "orphaned_after_uninstall";
182
+ progress?: PluginExecutionProgress;
183
+ };
184
+ type PluginExecutionSnapshotTerminal = {
185
+ execution_id: string;
186
+ plugin_instance_id: string;
187
+ kind: "operation" | "subscription";
188
+ status: "completed" | "canceled" | "orphaned";
189
+ cursor: number;
194
190
  cancelable: boolean;
195
191
  created_at: string;
196
192
  updated_at: string;
197
- retry_after_ms: number;
198
193
  terminal_at: string;
199
- progress?: PluginOperationProgress;
194
+ progress?: PluginExecutionProgress;
200
195
  };
201
- type PluginOperationSnapshotFailed = {
202
- operation_id: string;
196
+ type PluginExecutionSnapshotFailed = {
197
+ execution_id: string;
198
+ plugin_instance_id: string;
199
+ kind: "operation" | "subscription";
203
200
  status: "failed";
201
+ cursor: number;
204
202
  cancelable: boolean;
205
203
  created_at: string;
206
204
  updated_at: string;
207
- retry_after_ms: number;
208
205
  terminal_at: string;
209
206
  failure_code: PluginExecutionFailureCode;
210
- progress?: PluginOperationProgress;
207
+ progress?: PluginExecutionProgress;
211
208
  };
212
- export type PluginOperationSnapshot = PluginOperationSnapshotActive | PluginOperationSnapshotTerminal | PluginOperationSnapshotFailed;
209
+ export type PluginExecutionSnapshot = PluginExecutionSnapshotActive | PluginExecutionSnapshotTerminal | PluginExecutionSnapshotFailed;
213
210
  export type PluginRiskSeverity = "info" | "low" | "medium" | "high" | "critical";
214
211
  export type PluginRiskEffect = "read" | "write" | "execute" | "delete" | "admin";
215
212
  export type PluginRiskFlag = {
@@ -291,9 +288,9 @@ export declare class PluginBridgeClient {
291
288
  constructor(options?: PluginBridgeClientOptions);
292
289
  ready(): Promise<void>;
293
290
  call<T = unknown>(method: string, params?: PluginJSONObject, options?: PluginBridgeRequestOptions): Promise<T>;
294
- readStream(streamHandle: string, options?: PluginBridgeRequestOptions): Promise<PluginStreamReadResult>;
295
- cancelOperation(operationID: string, reason?: string, options?: PluginBridgeRequestOptions): Promise<void>;
296
- operationSnapshot(operationID: string, options?: PluginBridgeRequestOptions): Promise<PluginOperationSnapshot>;
291
+ executionEvents(executionID: string, afterCursor: number, options?: PluginBridgeRequestOptions): Promise<PluginExecutionEventList>;
292
+ cancelExecution(executionID: string, reason?: string, options?: PluginBridgeRequestOptions): Promise<void>;
293
+ executionSnapshot(executionID: string, options?: PluginBridgeRequestOptions): Promise<PluginExecutionSnapshot>;
297
294
  context(): PluginSurfaceContext | undefined;
298
295
  onContext(handler: (context: PluginSurfaceContext) => void): () => void;
299
296
  render(tree: PluginUIVNode): Promise<void>;
@@ -342,7 +339,7 @@ export declare class PluginSurfaceReloadLimiter {
342
339
  get state(): PluginSurfaceReloadState;
343
340
  }
344
341
  export declare function isPluginRiskPlan(plan: unknown): plan is PluginRiskPlan;
345
- export declare function decodePluginStreamText(event: PluginStreamEvent): string;
342
+ export declare function decodePluginEventText(event: PluginExecutionEvent): string;
346
343
  export declare function trustedParentBridgeHandshakeTranscriptSHA256(handshake: TrustedParentBridgeHandshake, bridgeChannelID: string): Promise<string>;
347
344
  export type OpaqueSurfaceStyle = {
348
345
  path: string;