@floegence/redevplugin-ui 0.0.0-dev

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.
@@ -0,0 +1,665 @@
1
+ export type BridgeLifecycleEvent = {
2
+ type: "ready";
3
+ } | {
4
+ type: "visible";
5
+ } | {
6
+ type: "hidden";
7
+ } | {
8
+ type: "dispose";
9
+ };
10
+ export declare const pluginPlatformErrorCodes: readonly ["PLUGIN_INVALID_REQUEST", "PLUGIN_MANIFEST_INVALID", "PLUGIN_PACKAGE_INVALID", "PLUGIN_PACKAGE_TOO_LARGE", "PLUGIN_PACKAGE_PATH_FORBIDDEN", "PLUGIN_SIGNATURE_INVALID", "PLUGIN_TRUST_STATE_DENIED", "PLUGIN_TRUST_VERIFICATION_REQUIRED", "PLUGIN_TRUST_VERIFICATION_INVALID", "PLUGIN_DISABLED", "PLUGIN_DISABLED_BY_POLICY", "PLUGIN_PERMISSION_DENIED", "PLUGIN_CONFIRMATION_REQUIRED", "PLUGIN_CONFIRMATION_INVALID", "PLUGIN_TOKEN_EXPIRED", "PLUGIN_TOKEN_REPLAY", "PLUGIN_GATEWAY_TOKEN_INVALID", "PLUGIN_GATEWAY_TOKEN_REPLAYED", "PLUGIN_GATEWAY_TOKEN_CHANNEL_MISMATCH", "PLUGIN_ASSET_TICKET_INVALID", "PLUGIN_ASSET_SESSION_INVALID", "PLUGIN_STREAM_TICKET_INVALID", "PLUGIN_STREAM_CANCELLED", "PLUGIN_LEASE_INVALID", "PLUGIN_LEASE_REPLAYED", "PLUGIN_GRANT_INVALID", "PLUGIN_STORAGE_QUOTA_EXCEEDED", "PLUGIN_OPERATION_BLOCKED", "PLUGIN_OPERATION_NOT_FOUND", "PLUGIN_OPERATION_NOT_CANCELABLE", "PLUGIN_NETWORK_TARGET_DENIED", "PLUGIN_NETWORK_RATE_LIMITED", "PLUGIN_RUNTIME_UNAVAILABLE", "PLUGIN_RUNTIME_VERSION_MISMATCH", "PLUGIN_JSON_LIMIT_EXCEEDED", "PLUGIN_CONTRACT_MISMATCH", "PLUGIN_CSRF_REQUIRED", "PLUGIN_RETAINED_DATA_CLEANUP_FAILED", "PLUGIN_RETAINED_DATA_BIND_FAILED"];
11
+ export declare const pluginBridgeErrorCodes: readonly ["PLUGIN_INVALID_REQUEST", "PLUGIN_MANIFEST_INVALID", "PLUGIN_PACKAGE_INVALID", "PLUGIN_PACKAGE_TOO_LARGE", "PLUGIN_PACKAGE_PATH_FORBIDDEN", "PLUGIN_SIGNATURE_INVALID", "PLUGIN_TRUST_STATE_DENIED", "PLUGIN_TRUST_VERIFICATION_REQUIRED", "PLUGIN_TRUST_VERIFICATION_INVALID", "PLUGIN_DISABLED", "PLUGIN_DISABLED_BY_POLICY", "PLUGIN_PERMISSION_DENIED", "PLUGIN_CONFIRMATION_REQUIRED", "PLUGIN_CONFIRMATION_INVALID", "PLUGIN_TOKEN_EXPIRED", "PLUGIN_TOKEN_REPLAY", "PLUGIN_GATEWAY_TOKEN_INVALID", "PLUGIN_GATEWAY_TOKEN_REPLAYED", "PLUGIN_GATEWAY_TOKEN_CHANNEL_MISMATCH", "PLUGIN_ASSET_TICKET_INVALID", "PLUGIN_ASSET_SESSION_INVALID", "PLUGIN_STREAM_TICKET_INVALID", "PLUGIN_STREAM_CANCELLED", "PLUGIN_LEASE_INVALID", "PLUGIN_LEASE_REPLAYED", "PLUGIN_GRANT_INVALID", "PLUGIN_STORAGE_QUOTA_EXCEEDED", "PLUGIN_OPERATION_BLOCKED", "PLUGIN_OPERATION_NOT_FOUND", "PLUGIN_OPERATION_NOT_CANCELABLE", "PLUGIN_NETWORK_TARGET_DENIED", "PLUGIN_NETWORK_RATE_LIMITED", "PLUGIN_RUNTIME_UNAVAILABLE", "PLUGIN_RUNTIME_VERSION_MISMATCH", "PLUGIN_JSON_LIMIT_EXCEEDED", "PLUGIN_CONTRACT_MISMATCH", "PLUGIN_CSRF_REQUIRED", "PLUGIN_RETAINED_DATA_CLEANUP_FAILED", "PLUGIN_RETAINED_DATA_BIND_FAILED", "PLUGIN_CONFIRMATION_REJECTED", "PLUGIN_BRIDGE_TIMEOUT", "PLUGIN_BRIDGE_DISPOSED", "PLUGIN_BRIDGE_HANDSHAKE_FAILED", "PLUGIN_BRIDGE_HANDSHAKE_REQUIRED"];
12
+ export declare const pluginClientErrorCodes: readonly ["PLUGIN_INVALID_REQUEST", "PLUGIN_MANIFEST_INVALID", "PLUGIN_PACKAGE_INVALID", "PLUGIN_PACKAGE_TOO_LARGE", "PLUGIN_PACKAGE_PATH_FORBIDDEN", "PLUGIN_SIGNATURE_INVALID", "PLUGIN_TRUST_STATE_DENIED", "PLUGIN_TRUST_VERIFICATION_REQUIRED", "PLUGIN_TRUST_VERIFICATION_INVALID", "PLUGIN_DISABLED", "PLUGIN_DISABLED_BY_POLICY", "PLUGIN_PERMISSION_DENIED", "PLUGIN_CONFIRMATION_REQUIRED", "PLUGIN_CONFIRMATION_INVALID", "PLUGIN_TOKEN_EXPIRED", "PLUGIN_TOKEN_REPLAY", "PLUGIN_GATEWAY_TOKEN_INVALID", "PLUGIN_GATEWAY_TOKEN_REPLAYED", "PLUGIN_GATEWAY_TOKEN_CHANNEL_MISMATCH", "PLUGIN_ASSET_TICKET_INVALID", "PLUGIN_ASSET_SESSION_INVALID", "PLUGIN_STREAM_TICKET_INVALID", "PLUGIN_STREAM_CANCELLED", "PLUGIN_LEASE_INVALID", "PLUGIN_LEASE_REPLAYED", "PLUGIN_GRANT_INVALID", "PLUGIN_STORAGE_QUOTA_EXCEEDED", "PLUGIN_OPERATION_BLOCKED", "PLUGIN_OPERATION_NOT_FOUND", "PLUGIN_OPERATION_NOT_CANCELABLE", "PLUGIN_NETWORK_TARGET_DENIED", "PLUGIN_NETWORK_RATE_LIMITED", "PLUGIN_RUNTIME_UNAVAILABLE", "PLUGIN_RUNTIME_VERSION_MISMATCH", "PLUGIN_JSON_LIMIT_EXCEEDED", "PLUGIN_CONTRACT_MISMATCH", "PLUGIN_CSRF_REQUIRED", "PLUGIN_RETAINED_DATA_CLEANUP_FAILED", "PLUGIN_RETAINED_DATA_BIND_FAILED", "PLUGIN_CONFIRMATION_REJECTED", "PLUGIN_BRIDGE_TIMEOUT", "PLUGIN_BRIDGE_DISPOSED", "PLUGIN_BRIDGE_HANDSHAKE_FAILED", "PLUGIN_BRIDGE_HANDSHAKE_REQUIRED", "PLUGIN_PLATFORM_REQUEST_FAILED", "PLUGIN_STREAM_FAILED"];
13
+ export type PluginPlatformErrorCode = typeof pluginPlatformErrorCodes[number];
14
+ export type PluginBridgeErrorCode = typeof pluginBridgeErrorCodes[number];
15
+ export type PluginClientErrorCode = typeof pluginClientErrorCodes[number];
16
+ export type PluginBridgeHandshake = {
17
+ type: "redevplugin.bridge.handshake";
18
+ plugin_id: string;
19
+ surface_id: string;
20
+ surface_instance_id: string;
21
+ active_fingerprint: string;
22
+ bridge_nonce: string;
23
+ ui_protocol_version: "plugin-ui-v1";
24
+ };
25
+ export type PluginBridgeTokenRequest = {
26
+ bridge_channel_id: string;
27
+ handshake: PluginBridgeHandshake;
28
+ handshake_transcript_sha256: string;
29
+ };
30
+ export type PluginBridgeRequest = {
31
+ id: string;
32
+ method: string;
33
+ params?: unknown;
34
+ };
35
+ export type PluginBridgeResponse = {
36
+ type: "redevplugin.bridge.response";
37
+ id: string;
38
+ ok: true;
39
+ data?: unknown;
40
+ } | {
41
+ type: "redevplugin.bridge.response";
42
+ id: string;
43
+ ok: false;
44
+ error_code: string;
45
+ error: string;
46
+ };
47
+ export type PluginBridgeCallMessage = {
48
+ type: "redevplugin.bridge.call";
49
+ request: PluginBridgeRequest;
50
+ };
51
+ export type PluginBridgeMessage = PluginBridgeHandshake | PluginBridgeCallMessage;
52
+ export type PluginBridgeLifecycleMessage = {
53
+ type: "redevplugin.bridge.lifecycle";
54
+ event: BridgeLifecycleEvent;
55
+ };
56
+ export type PluginSurfaceBootstrap = {
57
+ pluginId: string;
58
+ surfaceId: string;
59
+ surfaceInstanceId: string;
60
+ activeFingerprint: string;
61
+ bridgeNonce: string;
62
+ parentOrigin: string;
63
+ };
64
+ export type PluginBridgeClientOptions = {
65
+ timeoutMs?: number;
66
+ target?: WindowLike;
67
+ receiver?: WindowLike;
68
+ };
69
+ export declare const defaultPluginSurfaceReloadMax = 2;
70
+ export declare const defaultPluginSurfaceReloadWindowMs = 30000;
71
+ export type PluginSurfaceReloadLimiterOptions = {
72
+ maxReloads?: number;
73
+ windowMs?: number;
74
+ now?: () => number;
75
+ };
76
+ export type PluginSurfaceReloadDecision = {
77
+ allowed: true;
78
+ attempt: number;
79
+ remaining: number;
80
+ windowStartedAtMs: number;
81
+ } | {
82
+ allowed: false;
83
+ attempt: number;
84
+ remaining: 0;
85
+ windowStartedAtMs: number;
86
+ nextRetryAtMs: number;
87
+ reason: "reload_limit_exceeded";
88
+ };
89
+ export type PluginSurfaceReloadState = {
90
+ reloads: number;
91
+ remaining: number;
92
+ windowStartedAtMs?: number;
93
+ nextRetryAtMs?: number;
94
+ };
95
+ export type WindowLike = {
96
+ postMessage(message: unknown, targetOrigin: string): void;
97
+ addEventListener?(type: "message", listener: (event: MessageEventLike) => void): void;
98
+ removeEventListener?(type: "message", listener: (event: MessageEventLike) => void): void;
99
+ };
100
+ export type MessageEventLike = {
101
+ origin: string;
102
+ data: unknown;
103
+ source?: WindowLike | null;
104
+ };
105
+ export declare class PluginBridgeError extends Error {
106
+ readonly errorCode: string;
107
+ readonly data?: unknown;
108
+ readonly details?: unknown;
109
+ constructor(errorCode: string, message: string, data?: unknown, details?: unknown);
110
+ }
111
+ export declare function pluginBridgeHandshakeTranscriptSHA256(handshake: PluginBridgeHandshake, bridgeChannelID: string): Promise<string>;
112
+ export declare class PluginSurfaceReloadLimiter {
113
+ #private;
114
+ readonly maxReloads: number;
115
+ readonly windowMs: number;
116
+ constructor(options?: PluginSurfaceReloadLimiterOptions);
117
+ recordCrash(nowMs?: number): PluginSurfaceReloadDecision;
118
+ recordHealthyLoad(): void;
119
+ reset(): void;
120
+ get state(): PluginSurfaceReloadState;
121
+ }
122
+ export declare class PluginBridgeClient {
123
+ #private;
124
+ readonly bootstrap: PluginSurfaceBootstrap;
125
+ readonly timeoutMs: number;
126
+ constructor(bootstrap: PluginSurfaceBootstrap, options?: PluginBridgeClientOptions);
127
+ handshake(): void;
128
+ call<T = unknown>(method: string, params?: unknown): Promise<T>;
129
+ onLifecycle(handler: (event: BridgeLifecycleEvent) => void): () => void;
130
+ dispose(): void;
131
+ }
132
+ export type PluginSurfaceHostBootstrap = {
133
+ pluginId: string;
134
+ pluginInstanceId: string;
135
+ surfaceId: string;
136
+ surfaceInstanceId: string;
137
+ activeFingerprint: string;
138
+ bridgeNonce: string;
139
+ ownerSessionHash?: string;
140
+ ownerUserHash?: string;
141
+ sessionChannelIdHash?: string;
142
+ };
143
+ export type PluginSurfaceHostOptions = {
144
+ bootstrap: PluginSurfaceHostBootstrap;
145
+ iframeOrigin: string;
146
+ iframeWindow: WindowLike;
147
+ parentWindow?: WindowLike;
148
+ bridgeChannelId?: string;
149
+ fetch?: FetchLike;
150
+ apiBaseURL?: string;
151
+ ownerSessionHashHeader?: string;
152
+ confirm?: PluginConfirmationHandler;
153
+ onError?: (error: PluginBridgeError) => void;
154
+ };
155
+ export type PluginConfirmationHandler = (intent: PluginConfirmationIntent) => Promise<PluginConfirmationDecision> | PluginConfirmationDecision;
156
+ export declare const pluginRiskPlanSchemaVersion: "redevplugin.capability.risk_plan.v1";
157
+ export type PluginRiskSeverity = "info" | "low" | "medium" | "high" | "critical";
158
+ export type PluginRiskEffect = "read" | "write" | "execute" | "delete" | "admin";
159
+ export type PluginRiskFlag = {
160
+ id: string;
161
+ severity: PluginRiskSeverity;
162
+ summary: string;
163
+ description?: string;
164
+ requires_confirmation?: boolean;
165
+ requires_admin?: boolean;
166
+ data_loss_risk?: boolean;
167
+ destructive?: boolean;
168
+ };
169
+ export type PluginRiskPlan = {
170
+ schema_version: typeof pluginRiskPlanSchemaVersion;
171
+ capability_id?: string;
172
+ binding_id?: string;
173
+ method?: string;
174
+ target_method?: string;
175
+ action?: string;
176
+ effect?: PluginRiskEffect;
177
+ resource_ref?: string;
178
+ resource_display_name?: string;
179
+ summary: string;
180
+ risk_flags: PluginRiskFlag[];
181
+ requires_confirmation?: boolean;
182
+ requires_admin?: boolean;
183
+ data_loss_risk?: boolean;
184
+ destructive?: boolean;
185
+ deny_reason?: string;
186
+ details?: Record<string, unknown>;
187
+ };
188
+ export type PluginConfirmationPlan = PluginRiskPlan | Record<string, unknown>;
189
+ export declare function isPluginRiskPlan(plan: unknown): plan is PluginRiskPlan;
190
+ export type PluginConfirmationIntent = {
191
+ requestId: string;
192
+ method: string;
193
+ params?: Record<string, unknown>;
194
+ requestHash: string;
195
+ planHash: string;
196
+ plan?: PluginConfirmationPlan;
197
+ confirmationTokenId: string;
198
+ };
199
+ export type PluginConfirmationDecision = boolean | {
200
+ confirmed: boolean;
201
+ };
202
+ export type FetchLike = (input: string, init: FetchInitLike) => Promise<FetchResponseLike>;
203
+ export type FetchInitLike = {
204
+ method: string;
205
+ headers: Record<string, string>;
206
+ body?: string;
207
+ credentials?: "same-origin" | "include" | "omit";
208
+ };
209
+ export type FetchResponseLike = {
210
+ ok: boolean;
211
+ status: number;
212
+ json(): Promise<unknown>;
213
+ };
214
+ export type StreamFetchLike = (input: string, init?: StreamFetchInitLike) => Promise<StreamFetchResponseLike>;
215
+ export type StreamFetchInitLike = {
216
+ method?: string;
217
+ headers?: Record<string, string>;
218
+ credentials?: "same-origin" | "include" | "omit";
219
+ };
220
+ export type StreamFetchResponseLike = {
221
+ ok: boolean;
222
+ status: number;
223
+ text(): Promise<string>;
224
+ json?(): Promise<unknown>;
225
+ };
226
+ export type PluginGatewayTokenResult = {
227
+ plugin_gateway_token: string;
228
+ plugin_gateway_token_id: string;
229
+ issued_at?: string;
230
+ expires_at?: string;
231
+ };
232
+ export type PluginMethodResult<T = unknown> = {
233
+ data?: T;
234
+ operation_id?: string;
235
+ stream_id?: string;
236
+ stream_ticket?: string;
237
+ stream_ticket_id?: string;
238
+ confirmation_required?: boolean;
239
+ confirmation_token_id?: string;
240
+ request_hash?: string;
241
+ };
242
+ export type PluginStreamEvent = {
243
+ stream_id: string;
244
+ sequence: number;
245
+ kind: string;
246
+ data?: string;
247
+ error?: string;
248
+ at: string;
249
+ };
250
+ export type ReadPluginStreamOptions = {
251
+ streamId?: string;
252
+ streamTicket?: string;
253
+ result?: PluginMethodResult;
254
+ fetch?: StreamFetchLike;
255
+ apiBaseURL?: string;
256
+ };
257
+ export type PluginConfirmationResult = {
258
+ confirmation_id: string;
259
+ confirmation_token_id: string;
260
+ request_hash: string;
261
+ plan_hash: string;
262
+ plan?: PluginConfirmationPlan;
263
+ expires_at?: string;
264
+ };
265
+ export type PluginPlatformClientOptions = {
266
+ fetch?: FetchLike;
267
+ apiBaseURL?: string;
268
+ ownerSessionHashHeader?: string;
269
+ };
270
+ export type PluginCatalogRecord = Record<string, unknown>;
271
+ export type PluginCatalogResult = {
272
+ plugins?: PluginCatalogRecord[];
273
+ [key: string]: unknown;
274
+ };
275
+ export type PluginCompatibilityMatrix = {
276
+ redevplugin_go_version: string;
277
+ redevplugin_ui_version: string;
278
+ redevplugin_runtime_version: string;
279
+ plugin_host_protocol_version: string;
280
+ rust_ipc_version: string;
281
+ wasm_abi_version: string;
282
+ manifest_schema_version: string;
283
+ package_signature_schema_version: string;
284
+ token_ticket_schema_version: string;
285
+ bridge_schema_version: string;
286
+ target_classifier_version: string;
287
+ network_grant_schema_version: string;
288
+ plugin_platform_openapi_version: string;
289
+ compatibility_schema_version: string;
290
+ worker_invocation_schema_version: string;
291
+ error_codes_schema_version: string;
292
+ [key: string]: unknown;
293
+ };
294
+ export type PluginContractArtifact = {
295
+ id: string;
296
+ path: string;
297
+ version: string;
298
+ sha256: string;
299
+ [key: string]: unknown;
300
+ };
301
+ export type PluginCompatibilityManifest = {
302
+ schema_version: string;
303
+ matrix: PluginCompatibilityMatrix;
304
+ contracts: PluginContractArtifact[];
305
+ [key: string]: unknown;
306
+ };
307
+ export type PluginTrustState = "bundled" | "verified" | "unsigned_local" | "untrusted" | "needs_review" | "blocked_security";
308
+ export type PluginEnableState = "disabled" | "enabled" | "disabled_by_policy";
309
+ export type PluginRetainedDataRecordState = "retained" | "expired" | "bound" | "deleted" | "delete_failed_retryable";
310
+ export type PluginRetainedDataState = "none" | PluginRetainedDataRecordState;
311
+ export type PluginRecord = {
312
+ plugin_instance_id: string;
313
+ publisher_id?: string;
314
+ plugin_id: string;
315
+ version: string;
316
+ active_fingerprint: string;
317
+ package_hash?: string;
318
+ manifest_hash?: string;
319
+ entries_hash?: string;
320
+ trust_state: PluginTrustState | string;
321
+ enable_state: PluginEnableState | string;
322
+ disabled_reason?: string;
323
+ retained_data_state?: PluginRetainedDataState | string;
324
+ policy_revision?: number;
325
+ management_revision?: number;
326
+ revoke_epoch?: number;
327
+ manifest?: Record<string, unknown>;
328
+ package_entries?: Array<Record<string, unknown>>;
329
+ version_history?: Array<Record<string, unknown>>;
330
+ installed_at?: string;
331
+ enabled_at?: string;
332
+ updated_at?: string;
333
+ deleted_at?: string;
334
+ metadata?: Record<string, string>;
335
+ [key: string]: unknown;
336
+ };
337
+ export type PluginInstallRequest = {
338
+ package_base64: string;
339
+ trust_state?: PluginTrustState | string;
340
+ plugin_instance_id?: string;
341
+ };
342
+ export type PluginUpdateRequest = {
343
+ plugin_instance_id: string;
344
+ package_base64: string;
345
+ trust_state?: PluginTrustState | string;
346
+ };
347
+ export type PluginDowngradeRequest = {
348
+ plugin_instance_id: string;
349
+ version?: string;
350
+ package_hash?: string;
351
+ };
352
+ export type PluginEnableRequest = {
353
+ plugin_instance_id: string;
354
+ };
355
+ export type PluginDisableRequest = {
356
+ plugin_instance_id: string;
357
+ reason?: string;
358
+ };
359
+ export type PluginUninstallRequest = {
360
+ plugin_instance_id: string;
361
+ delete_data: boolean;
362
+ };
363
+ export type PluginOpenSurfaceRequest = {
364
+ plugin_instance_id: string;
365
+ surface_id: string;
366
+ surface_instance_id?: string;
367
+ owner_session_hash?: string;
368
+ owner_user_hash?: string;
369
+ session_channel_id_hash?: string;
370
+ sandbox_origin?: string;
371
+ };
372
+ export type PluginSurfaceBootstrapResult = {
373
+ plugin_id: string;
374
+ plugin_instance_id: string;
375
+ surface_id: string;
376
+ surface_instance_id: string;
377
+ active_fingerprint: string;
378
+ owner_session_hash?: string;
379
+ session_channel_id_hash?: string;
380
+ asset_ticket: string;
381
+ asset_ticket_id: string;
382
+ bridge_nonce: string;
383
+ issued_at: string;
384
+ expires_at: string;
385
+ };
386
+ export type PluginRuntimeTarget = {
387
+ os?: string;
388
+ arch?: string;
389
+ };
390
+ export type PluginRuntimeStartRequest = {
391
+ target?: PluginRuntimeTarget;
392
+ };
393
+ export type PluginRuntimeHealth = {
394
+ runtime_instance_id: string;
395
+ runtime_generation_id: string;
396
+ runtime_version?: string;
397
+ rust_ipc_version?: string;
398
+ wasm_abi_version?: string;
399
+ ready: boolean;
400
+ };
401
+ export type PluginRuntimeStopResult = {
402
+ stopped: boolean;
403
+ };
404
+ export type PluginRuntimeRefreshResult = {
405
+ refreshed_plugins: PluginRecord[];
406
+ };
407
+ export type PluginSettingsField = {
408
+ key: string;
409
+ type: string;
410
+ label: string;
411
+ scope: string;
412
+ default?: unknown;
413
+ secret_ref?: string;
414
+ options?: string[];
415
+ validation?: Record<string, unknown>;
416
+ };
417
+ export type PluginSettingsSchema = {
418
+ plugin_instance_id: string;
419
+ schema_version: number;
420
+ migration?: Record<string, unknown>;
421
+ fields: PluginSettingsField[];
422
+ settings_revision: number;
423
+ };
424
+ export type PluginSettingsSnapshot = {
425
+ plugin_instance_id: string;
426
+ schema_version: number;
427
+ settings_revision: number;
428
+ values: Record<string, unknown>;
429
+ updated_at: string;
430
+ };
431
+ export type PluginOperationRecord = {
432
+ operation_id: string;
433
+ plugin_id?: string;
434
+ plugin_instance_id: string;
435
+ method: string;
436
+ effect?: string;
437
+ execution: string;
438
+ surface_instance_id?: string;
439
+ session_channel_id_hash?: string;
440
+ bridge_channel_id?: string;
441
+ status: string;
442
+ disable_behavior?: string;
443
+ uninstall_behavior?: string;
444
+ reason?: string;
445
+ created_at: string;
446
+ updated_at: string;
447
+ cancel_requested_at?: string;
448
+ orphaned_at?: string;
449
+ };
450
+ export type PluginOperationList = {
451
+ operations?: PluginOperationRecord[];
452
+ [key: string]: unknown;
453
+ };
454
+ export type PluginIntentRecord = {
455
+ plugin_id: string;
456
+ plugin_instance_id: string;
457
+ publisher_id: string;
458
+ display_name: string;
459
+ version: string;
460
+ active_fingerprint: string;
461
+ intent_id: string;
462
+ method: string;
463
+ effect: string;
464
+ execution: string;
465
+ payload_schema?: Record<string, unknown>;
466
+ };
467
+ export type PluginIntentList = {
468
+ intents?: PluginIntentRecord[];
469
+ [key: string]: unknown;
470
+ };
471
+ export type PluginIntentListOptions = {
472
+ intent_id?: string;
473
+ plugin_instance_id?: string;
474
+ };
475
+ export type PluginIntentInvokeRequest = {
476
+ plugin_instance_id?: string;
477
+ intent_id: string;
478
+ params?: Record<string, unknown>;
479
+ owner_session_hash?: string;
480
+ owner_user_hash?: string;
481
+ session_channel_id_hash?: string;
482
+ };
483
+ export type PluginPermissionGrant = {
484
+ plugin_instance_id: string;
485
+ permission_id: string;
486
+ granted_by?: string;
487
+ granted_at?: string;
488
+ revoked_by?: string;
489
+ revoked_at?: string;
490
+ reason?: string;
491
+ expires_at?: string;
492
+ [key: string]: unknown;
493
+ };
494
+ export type PluginPermissionList = {
495
+ permissions?: PluginPermissionGrant[];
496
+ [key: string]: unknown;
497
+ };
498
+ export type PluginPermissionGrantRequest = {
499
+ plugin_instance_id: string;
500
+ permission_id: string;
501
+ granted_by?: string;
502
+ expires_at?: string;
503
+ };
504
+ export type PluginPermissionRevokeRequest = {
505
+ plugin_instance_id: string;
506
+ permission_id: string;
507
+ revoked_by?: string;
508
+ reason?: string;
509
+ };
510
+ export type PluginDataExportRequest = {
511
+ plugin_instance_id: string;
512
+ include_secrets?: boolean;
513
+ };
514
+ export type PluginDataExportResult = {
515
+ archive_ref?: string;
516
+ settings_archive_ref?: string;
517
+ };
518
+ export type PluginDataImportRequest = {
519
+ plugin_instance_id: string;
520
+ archive_ref?: string;
521
+ settings_archive_ref?: string;
522
+ delete_existing?: boolean;
523
+ };
524
+ export type PluginRetainedDataRecord = {
525
+ retained_id: string;
526
+ source_plugin_instance_id: string;
527
+ bound_plugin_instance_id?: string;
528
+ publisher_id: string;
529
+ plugin_id: string;
530
+ version: string;
531
+ package_hash: string;
532
+ manifest_hash: string;
533
+ state: PluginRetainedDataRecordState | string;
534
+ storage_retained?: boolean;
535
+ settings_retained?: boolean;
536
+ browser_site_retained?: boolean;
537
+ usage_bytes?: number;
538
+ delete_after?: string;
539
+ delete_error?: string;
540
+ metadata?: Record<string, string>;
541
+ retained_at?: string;
542
+ updated_at?: string;
543
+ bound_at?: string;
544
+ deleted_at?: string;
545
+ last_accessed_at?: string;
546
+ [key: string]: unknown;
547
+ };
548
+ export type PluginRetainedDataListOptions = {
549
+ publisher_id?: string;
550
+ plugin_id?: string;
551
+ source_plugin_instance_id?: string;
552
+ state?: PluginRetainedDataRecordState | string;
553
+ };
554
+ export type PluginRetainedDataList = {
555
+ retained_data?: PluginRetainedDataRecord[];
556
+ [key: string]: unknown;
557
+ };
558
+ export type PluginRetainedDataBindRequest = {
559
+ retained_id: string;
560
+ target_plugin_instance_id: string;
561
+ };
562
+ export type PluginRetainedDataCleanupRequest = {
563
+ retry_failed?: boolean;
564
+ max_records?: number;
565
+ };
566
+ export type PluginRetainedDataCleanupResult = {
567
+ deleted?: PluginRetainedDataRecord[];
568
+ failed?: PluginRetainedDataRecord[];
569
+ [key: string]: unknown;
570
+ };
571
+ export type PluginSecretRefRequest = {
572
+ plugin_instance_id: string;
573
+ secret_ref: string;
574
+ scope: string;
575
+ };
576
+ export type PluginAuditEvent = {
577
+ type: string;
578
+ plugin_id?: string;
579
+ plugin_instance_id?: string;
580
+ occurred_at?: string;
581
+ details?: Record<string, unknown>;
582
+ [key: string]: unknown;
583
+ };
584
+ export type PluginAuditEventList = {
585
+ audit_events?: PluginAuditEvent[];
586
+ [key: string]: unknown;
587
+ };
588
+ export type PluginAuditListOptions = {
589
+ plugin_id?: string;
590
+ plugin_instance_id?: string;
591
+ type?: string;
592
+ limit?: number;
593
+ };
594
+ export type PluginDiagnosticEvent = {
595
+ type: string;
596
+ severity?: string;
597
+ plugin_id?: string;
598
+ plugin_instance_id?: string;
599
+ surface_instance_id?: string;
600
+ occurred_at?: string;
601
+ details?: Record<string, unknown>;
602
+ [key: string]: unknown;
603
+ };
604
+ export type PluginDiagnosticEventList = {
605
+ diagnostic_events?: PluginDiagnosticEvent[];
606
+ [key: string]: unknown;
607
+ };
608
+ export type PluginDiagnosticListOptions = {
609
+ plugin_id?: string;
610
+ plugin_instance_id?: string;
611
+ surface_instance_id?: string;
612
+ type?: string;
613
+ severity?: string;
614
+ limit?: number;
615
+ };
616
+ export declare class PluginPlatformClient {
617
+ #private;
618
+ constructor(options?: PluginPlatformClientOptions);
619
+ catalog(): Promise<PluginCatalogResult>;
620
+ getCompatibility(): Promise<PluginCompatibilityManifest>;
621
+ installPlugin(request: PluginInstallRequest): Promise<PluginRecord>;
622
+ updatePlugin(request: PluginUpdateRequest): Promise<PluginRecord>;
623
+ downgradePlugin(request: PluginDowngradeRequest): Promise<PluginRecord>;
624
+ enablePlugin(pluginInstanceIdOrRequest: string | PluginEnableRequest): Promise<PluginRecord>;
625
+ disablePlugin(request: PluginDisableRequest): Promise<PluginRecord>;
626
+ uninstallPlugin(request: PluginUninstallRequest): Promise<PluginRecord>;
627
+ openSurface(request: PluginOpenSurfaceRequest): Promise<PluginSurfaceBootstrapResult>;
628
+ startRuntime(request?: PluginRuntimeStartRequest): Promise<PluginRuntimeHealth>;
629
+ stopRuntime(): Promise<PluginRuntimeStopResult>;
630
+ refreshEnabledRuntimeState(): Promise<PluginRuntimeRefreshResult>;
631
+ runtimeHealth(): Promise<PluginRuntimeHealth>;
632
+ getSettingsSchema(pluginInstanceId: string): Promise<PluginSettingsSchema>;
633
+ getSettings(pluginInstanceId: string): Promise<PluginSettingsSnapshot>;
634
+ patchSettings(pluginInstanceId: string, values: Record<string, unknown>): Promise<PluginSettingsSnapshot>;
635
+ listOperations(pluginInstanceId?: string): Promise<PluginOperationList>;
636
+ getOperation(operationId: string): Promise<PluginOperationRecord>;
637
+ cancelOperation(operationId: string, reason?: string): Promise<PluginOperationRecord>;
638
+ listIntents(options?: PluginIntentListOptions): Promise<PluginIntentList>;
639
+ invokeIntent<T = unknown>(request: PluginIntentInvokeRequest): Promise<PluginMethodResult<T>>;
640
+ exportData(request: PluginDataExportRequest): Promise<PluginDataExportResult>;
641
+ importData(request: PluginDataImportRequest): Promise<Record<string, unknown>>;
642
+ listRetainedData(options?: PluginRetainedDataListOptions): Promise<PluginRetainedDataList>;
643
+ deleteRetainedData(retainedId: string): Promise<PluginRetainedDataRecord>;
644
+ bindRetainedData(request: PluginRetainedDataBindRequest): Promise<PluginRetainedDataRecord>;
645
+ cleanupExpiredRetainedData(request?: PluginRetainedDataCleanupRequest): Promise<PluginRetainedDataCleanupResult>;
646
+ listPermissions(pluginInstanceId?: string, activeOnly?: boolean): Promise<PluginPermissionList>;
647
+ grantPermission(request: PluginPermissionGrantRequest): Promise<PluginPermissionGrant>;
648
+ revokePermission(request: PluginPermissionRevokeRequest): Promise<PluginPermissionGrant>;
649
+ bindSecret(request: PluginSecretRefRequest): Promise<Record<string, unknown>>;
650
+ testSecret(request: PluginSecretRefRequest): Promise<Record<string, unknown>>;
651
+ deleteSecret(request: PluginSecretRefRequest): Promise<Record<string, unknown>>;
652
+ listAuditEvents(options?: PluginAuditListOptions): Promise<PluginAuditEventList>;
653
+ listDiagnosticEvents(options?: PluginDiagnosticListOptions): Promise<PluginDiagnosticEventList>;
654
+ }
655
+ export declare class PluginSurfaceHost {
656
+ #private;
657
+ readonly bootstrap: PluginSurfaceHostBootstrap;
658
+ readonly iframeOrigin: string;
659
+ readonly bridgeChannelId: string;
660
+ constructor(options: PluginSurfaceHostOptions);
661
+ sendLifecycle(event: BridgeLifecycleEvent): void;
662
+ dispose(): void;
663
+ }
664
+ export declare function readPluginStream(options: ReadPluginStreamOptions): Promise<PluginStreamEvent[]>;
665
+ export declare function decodePluginStreamText(event: PluginStreamEvent): string;