@voltius/plugin-types 0.17.0 → 0.18.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/index.d.ts +42 -1
- package/package.json +1 -1
- package/ui.d.ts +19 -0
package/index.d.ts
CHANGED
|
@@ -87,6 +87,16 @@ export interface AppTheme {
|
|
|
87
87
|
|
|
88
88
|
export type Locale = "en" | "fr" | "ru" | "zh";
|
|
89
89
|
|
|
90
|
+
export type PluginAuditAction =
|
|
91
|
+
| "agent.grant_created"
|
|
92
|
+
| "agent.grant_revoked"
|
|
93
|
+
| "agent.mode_changed"
|
|
94
|
+
| "agent.session_opened"
|
|
95
|
+
| "agent.session_closed"
|
|
96
|
+
| "agent.command_run"
|
|
97
|
+
| "agent.action_denied";
|
|
98
|
+
|
|
99
|
+
|
|
90
100
|
|
|
91
101
|
// ─── Types exposés aux plugins ─────────────────────────────────────────────
|
|
92
102
|
|
|
@@ -215,6 +225,19 @@ export interface GlobalPanel {
|
|
|
215
225
|
component: React.FC<{ open: boolean; onClose: () => void }>;
|
|
216
226
|
}
|
|
217
227
|
|
|
228
|
+
/** Controls the panel it was returned from. Calling it disposes, as before. */
|
|
229
|
+
export interface GlobalPanelHandle {
|
|
230
|
+
(): void;
|
|
231
|
+
/** Host-prefixed id, e.g. "ai-agent:drawer". */
|
|
232
|
+
readonly id: string;
|
|
233
|
+
open(): void;
|
|
234
|
+
close(): void;
|
|
235
|
+
toggle(): void;
|
|
236
|
+
isOpen(): boolean;
|
|
237
|
+
/** Width (px) the app shell reserves while this panel is docked. */
|
|
238
|
+
setDockedWidth(width: number): void;
|
|
239
|
+
}
|
|
240
|
+
|
|
218
241
|
export interface PluginSession {
|
|
219
242
|
id: string;
|
|
220
243
|
connectionId: string;
|
|
@@ -497,6 +520,24 @@ export interface PluginAPI {
|
|
|
497
520
|
delete(key: string): Promise<void>;
|
|
498
521
|
};
|
|
499
522
|
|
|
523
|
+
// Audit — record what this plugin did (requires "audit")
|
|
524
|
+
audit: {
|
|
525
|
+
/**
|
|
526
|
+
* Record an action against the connection it targets. A team-vault
|
|
527
|
+
* connection additionally posts to that team's server; "local", unknown
|
|
528
|
+
* and deleted ids fail closed to the on-device sink.
|
|
529
|
+
*
|
|
530
|
+
* `localMetadata` never leaves the device. Never pass captured terminal
|
|
531
|
+
* output to either channel.
|
|
532
|
+
*/
|
|
533
|
+
record(
|
|
534
|
+
connectionId: string | null,
|
|
535
|
+
action: PluginAuditAction,
|
|
536
|
+
metadata?: Record<string, unknown>,
|
|
537
|
+
localMetadata?: Record<string, unknown>,
|
|
538
|
+
): void;
|
|
539
|
+
};
|
|
540
|
+
|
|
500
541
|
// Themes (requires "themes")
|
|
501
542
|
themes: {
|
|
502
543
|
register(theme: PluginTheme): void;
|
|
@@ -514,7 +555,7 @@ export interface PluginAPI {
|
|
|
514
555
|
registerSettingsPage(page: SettingsPage): () => void;
|
|
515
556
|
registerRightPanelSection(section: RightPanelSection): () => void;
|
|
516
557
|
/** Mount a global, shell-level panel (not session-scoped). Returns cleanup. */
|
|
517
|
-
registerGlobalPanel(panel: GlobalPanel):
|
|
558
|
+
registerGlobalPanel(panel: GlobalPanel): GlobalPanelHandle;
|
|
518
559
|
/** Contribute a full-screen mobile view for `screen.kind`. Uninstalling or
|
|
519
560
|
* disabling the plugin removes it, same as registerRightPanelSection does
|
|
520
561
|
* on desktop. Returns cleanup. */
|
package/package.json
CHANGED
package/ui.d.ts
CHANGED
|
@@ -2,8 +2,27 @@
|
|
|
2
2
|
// the host's own instances — see the build script in package.json.
|
|
3
3
|
declare module "@voltius/ui" {
|
|
4
4
|
import type { ComponentType, ReactNode } from "react";
|
|
5
|
+
import type { PluginAPI, PluginSession } from "@voltius/plugin-types";
|
|
5
6
|
export const Icon: ComponentType<{ icon: string; width?: number | string; className?: string }>;
|
|
6
7
|
export const InfoTooltip: ComponentType<{ text: string; children?: ReactNode }>;
|
|
7
8
|
export const BottomSheet: ComponentType<{ title?: string; onClose: () => void; children?: ReactNode }>;
|
|
8
9
|
export function useAutosave<T>(value: T, save: (v: T) => void | Promise<void>, delayMs?: number): void;
|
|
10
|
+
export function useT(api: PluginAPI): PluginAPI["i18n"]["t"];
|
|
11
|
+
export function useSessionById(api: PluginAPI, sessionId: string): PluginSession | null;
|
|
12
|
+
export const ConnectionAvatar: ComponentType<{
|
|
13
|
+
connection: {
|
|
14
|
+
connection_type?: "ssh" | "serial" | "ftp";
|
|
15
|
+
serial_port?: string;
|
|
16
|
+
icon?: string;
|
|
17
|
+
distro?: string;
|
|
18
|
+
};
|
|
19
|
+
size: number;
|
|
20
|
+
}>;
|
|
21
|
+
export const ConfirmModal: ComponentType<{
|
|
22
|
+
title: string;
|
|
23
|
+
message: string;
|
|
24
|
+
confirmLabel?: string;
|
|
25
|
+
onConfirm: () => void;
|
|
26
|
+
onCancel: () => void;
|
|
27
|
+
}>;
|
|
9
28
|
}
|