@voltius/plugin-types 0.23.0 → 0.25.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.
Files changed (2) hide show
  1. package/index.d.ts +122 -1
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -111,7 +111,44 @@ export type PluginAuditAction =
111
111
  // what actually reached the host. Must be on the server's CLIENT_WHITELIST
112
112
  // before any client that emits it ships, or the team rows are 400ed and
113
113
  // silently dropped.
114
- | "agent.plugin_tool_run";
114
+ | "agent.plugin_tool_run"
115
+ // Team membership and terminal sharing (P7). Membership is not an object
116
+ // edit, so these do not reuse agent.object_*: the trail has to stay
117
+ // filterable by what happened to a team.
118
+ | "agent.member_invited"
119
+ | "agent.member_removed"
120
+ | "agent.member_role_changed"
121
+ | "agent.session_shared"
122
+ | "agent.session_unshared"
123
+ | "agent.control_granted";
124
+
125
+ export type DomainResult<T> = { ok: true; result: T } | { ok: false; error: string };
126
+
127
+ export interface PluginTeam {
128
+ id: string; name: string; ownerTier: string; myRoles: string[]; myRoleIds: string[]; vaultStatus: string;
129
+ }
130
+
131
+ export type PluginTeamMember =
132
+ | { state: "member"; userId: string; displayName: string; roles: string[]; roleIds: string[]; isOnline: boolean }
133
+ | { state: "pending"; invitationId: string; displayName: string; roles: string[]; isOnline: false };
134
+
135
+ export interface PluginMemberKeyState {
136
+ userId: string; displayName: string; hasPublicKey: boolean; hasWrappedKey: boolean;
137
+ }
138
+
139
+ export interface PluginTeamKeyStatus {
140
+ teamId: string; vaultStatus: string; iHoldKey: boolean; members: PluginMemberKeyState[];
141
+ }
142
+
143
+ export interface PluginSharedSession {
144
+ multiplayerSessionId: string;
145
+ localSessionId: string | null;
146
+ connectionName: string;
147
+ isHost: boolean;
148
+ participants: { userId: string; displayName: string }[];
149
+ controlHolder: string;
150
+ controlRequester: string | null;
151
+ }
115
152
 
116
153
 
117
154
 
@@ -277,6 +314,32 @@ export interface PluginHostPing {
277
314
  latencyMs?: number;
278
315
  }
279
316
 
317
+ export type PluginPanePosition = "left" | "right" | "top" | "bottom";
318
+
319
+ export interface PluginPane {
320
+ paneId: string;
321
+ sessionId: string;
322
+ connectionName: string;
323
+ active: boolean;
324
+ maximized: boolean;
325
+ }
326
+
327
+ /** A titlebar item: a split tab with one entry per pane, or a standalone
328
+ * session projected as a single-pane tab so callers read one uniform list. */
329
+ export interface PluginPaneTab {
330
+ tabId: string;
331
+ kind: "split" | "session";
332
+ active: boolean;
333
+ panes: PluginPane[];
334
+ broadcastActive: boolean;
335
+ layout: PaneNode | null;
336
+ }
337
+
338
+ /** `tab` is null when the write left no tab behind (the last split collapsed). */
339
+ export type PluginPaneResult =
340
+ | { ok: true; tab: PluginPaneTab | null }
341
+ | { ok: false; error: string };
342
+
280
343
  /**
281
344
  * A SAVED port-forwarding rule: a shape, not a live listener. Opening one is
282
345
  * `portForwards.start`, which needs an open session to hang the tunnel on.
@@ -971,6 +1034,64 @@ export interface PluginAPI {
971
1034
  pingStatus(): PluginHostPing[];
972
1035
  };
973
1036
 
1037
+ /**
1038
+ * The terminal tab and pane layout (requires panes:read / panes:write).
1039
+ *
1040
+ * Ungated deliberately: these rearrange tabs and destroy nothing, which is
1041
+ * strictly less than the ungated sessions:write, and detaching a pane leaves
1042
+ * the session open. Writes never throw — they return a PluginPaneResult whose
1043
+ * `error` says why, because every underlying store method fails silently.
1044
+ */
1045
+ panes: {
1046
+ list(): PluginPaneTab[];
1047
+ split(input: { sessionId: string; targetSessionId: string; position: PluginPanePosition }): PluginPaneResult;
1048
+ move(input: { sessionId: string; targetSessionId: string; position: PluginPanePosition }): PluginPaneResult;
1049
+ detach(sessionId: string): PluginPaneResult;
1050
+ focus(sessionId: string, maximize?: boolean): PluginPaneResult;
1051
+ };
1052
+
1053
+ /**
1054
+ * Teams, members and vault-key distribution (requires team:read / team:write).
1055
+ *
1056
+ * Writes are bounded by the caller's own server-side role bits: a member
1057
+ * without PERM_MANAGE_MEMBERS is refused by the server, not by this layer.
1058
+ * `keyStatus` reports the window where a member can be keyed but has not
1059
+ * been yet, and never repairs it.
1060
+ */
1061
+ team: {
1062
+ list(): Promise<PluginTeam[]>;
1063
+ members(teamId: string): Promise<PluginTeamMember[]>;
1064
+ /** Every team the caller can see when `teamId` is omitted. */
1065
+ keyStatus(teamId?: string): Promise<PluginTeamKeyStatus[]>;
1066
+ /** Exactly one of `email` or `userId`. */
1067
+ invite(input: { teamId: string; email?: string; userId?: string; role?: string }):
1068
+ Promise<DomainResult<{ status: "pending" | "already_member" | "invited"; key: PluginMemberKeyState | null }>>;
1069
+ removeMember(teamId: string, userId: string): Promise<DomainResult<null>>;
1070
+ /** Replaces every role the member holds with `role`, a role id or role name
1071
+ * as reported by `list` and `members`. An unresolvable role is refused
1072
+ * before any role is removed. */
1073
+ setMemberRole(teamId: string, userId: string, role: string): Promise<DomainResult<null>>;
1074
+ };
1075
+
1076
+ /**
1077
+ * Live terminal sharing (requires sharing:read / sharing:write).
1078
+ *
1079
+ * Team-scoped only: the invite-link path mints a bearer token and is not
1080
+ * exposed. Writes return a DomainResult rather than throwing.
1081
+ */
1082
+ sharing: {
1083
+ list(): Promise<PluginSharedSession[]>;
1084
+ /** Why `share` would refuse this session, or null when it may proceed —
1085
+ * callable before an approval is asked for, so a doomed share raises no
1086
+ * card and records nothing. */
1087
+ shareRefusal(sessionId: string): string | null;
1088
+ share(input: { sessionId: string; vaultIds: string[]; allowedRoles?: string[] }):
1089
+ Promise<DomainResult<{ multiplayerSessionId: string }>>;
1090
+ unshare(sessionId: string): Promise<DomainResult<null>>;
1091
+ /** Only approves a control request the participant already made. */
1092
+ handoffControl(sessionId: string, userId: string): Promise<DomainResult<null>>;
1093
+ };
1094
+
974
1095
  /**
975
1096
  * The state of the user's own configuration sync (requires sync:read).
976
1097
  * Distinct from the plugin-scoped `sync` domain above, which is a plugin's
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voltius/plugin-types",
3
- "version": "0.23.0",
3
+ "version": "0.25.0",
4
4
  "description": "TypeScript definitions for the Voltius plugin API",
5
5
  "types": "index.d.ts",
6
6
  "files": [