@haex-space/vault-sdk 2.5.126 → 2.6.1

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.
@@ -246,6 +246,18 @@ var SPACE_COMMANDS = {
246
246
  listBackends: "extension_space_list_backends"
247
247
  };
248
248
 
249
+ // src/commands/shell.ts
250
+ var SHELL_COMMANDS = {
251
+ /** Create a new PTY shell session */
252
+ create: "extension_shell_create",
253
+ /** Write data to a shell session's stdin */
254
+ write: "extension_shell_write",
255
+ /** Resize a shell session's terminal */
256
+ resize: "extension_shell_resize",
257
+ /** Close a shell session */
258
+ close: "extension_shell_close"
259
+ };
260
+
249
261
  // src/api/storage.ts
250
262
  var StorageAPI = class {
251
263
  constructor(client) {
@@ -1138,6 +1150,70 @@ var SpacesAPI = class {
1138
1150
  }
1139
1151
  };
1140
1152
 
1153
+ // src/api/shell.ts
1154
+ var ShellAPI = class {
1155
+ constructor(sdk) {
1156
+ this.sdk = sdk;
1157
+ }
1158
+ /**
1159
+ * Create a new PTY shell session.
1160
+ * Returns a session ID used for subsequent write/resize/close operations.
1161
+ * Listen for shell output via `sdk.shell.onData()`.
1162
+ */
1163
+ async create(options = {}) {
1164
+ return await this.sdk.request(
1165
+ SHELL_COMMANDS.create,
1166
+ { options }
1167
+ );
1168
+ }
1169
+ /**
1170
+ * Write data to a shell session's stdin.
1171
+ * Typically used to forward terminal keystrokes.
1172
+ */
1173
+ async write(sessionId, data) {
1174
+ await this.sdk.request(SHELL_COMMANDS.write, { sessionId, data });
1175
+ }
1176
+ /**
1177
+ * Resize a shell session's terminal.
1178
+ * Should be called when the terminal view is resized.
1179
+ */
1180
+ async resize(sessionId, cols, rows) {
1181
+ await this.sdk.request(SHELL_COMMANDS.resize, { sessionId, cols, rows });
1182
+ }
1183
+ /**
1184
+ * Close a shell session.
1185
+ * This terminates the underlying PTY process.
1186
+ */
1187
+ async close(sessionId) {
1188
+ await this.sdk.request(SHELL_COMMANDS.close, { sessionId });
1189
+ }
1190
+ /**
1191
+ * Register a callback for shell output data.
1192
+ * The callback receives output from the PTY's stdout/stderr.
1193
+ */
1194
+ onData(callback) {
1195
+ this.sdk.on("shell:output", callback);
1196
+ }
1197
+ /**
1198
+ * Register a callback for shell session exit.
1199
+ */
1200
+ onExit(callback) {
1201
+ this.sdk.on("shell:exit", callback);
1202
+ }
1203
+ /**
1204
+ * Remove a shell output callback.
1205
+ */
1206
+ offData(callback) {
1207
+ this.sdk.off("shell:output", callback);
1208
+ }
1209
+ /**
1210
+ * Remove a shell exit callback.
1211
+ */
1212
+ offExit(callback) {
1213
+ this.sdk.off("shell:exit", callback);
1214
+ }
1215
+ };
1216
+
1141
1217
  // src/messages.ts
1142
1218
  var HAEXSPACE_MESSAGE_TYPES = {
1143
1219
  /** Debug message for development/troubleshooting */
@@ -1837,6 +1913,7 @@ var HaexVaultSdk = class {
1837
1913
  this.remoteStorage = new RemoteStorageAPI(this);
1838
1914
  this.localsend = new LocalSendAPI(this);
1839
1915
  this.spaces = new SpacesAPI(this);
1916
+ this.shell = new ShellAPI(this);
1840
1917
  installConsoleForwarding(this.config.debug);
1841
1918
  this.readyPromise = new Promise((resolve) => {
1842
1919
  this.resolveReady = resolve;