@haex-space/vault-sdk 2.5.126 → 2.6.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/dist/index.mjs CHANGED
@@ -685,6 +685,12 @@ var EXTERNAL_EVENTS = {
685
685
  /** New external client requesting authorization */
686
686
  AUTHORIZATION_REQUEST: "external:authorization-request"
687
687
  };
688
+ var SHELL_EVENTS = {
689
+ /** PTY output data from a shell session */
690
+ OUTPUT: "shell:output",
691
+ /** Shell session has exited */
692
+ EXIT: "shell:exit"
693
+ };
688
694
 
689
695
  // src/types.ts
690
696
  var DEFAULT_TIMEOUT = 3e4;
@@ -991,6 +997,18 @@ var SPACE_COMMANDS = {
991
997
  listBackends: "extension_space_list_backends"
992
998
  };
993
999
 
1000
+ // src/commands/shell.ts
1001
+ var SHELL_COMMANDS = {
1002
+ /** Create a new PTY shell session */
1003
+ create: "extension_shell_create",
1004
+ /** Write data to a shell session's stdin */
1005
+ write: "extension_shell_write",
1006
+ /** Resize a shell session's terminal */
1007
+ resize: "extension_shell_resize",
1008
+ /** Close a shell session */
1009
+ close: "extension_shell_close"
1010
+ };
1011
+
994
1012
  // src/commands/index.ts
995
1013
  var TAURI_COMMANDS = {
996
1014
  database: DATABASE_COMMANDS,
@@ -1002,7 +1020,8 @@ var TAURI_COMMANDS = {
1002
1020
  extension: EXTENSION_COMMANDS,
1003
1021
  remoteStorage: REMOTE_STORAGE_COMMANDS,
1004
1022
  localsend: LOCALSEND_COMMANDS,
1005
- spaces: SPACE_COMMANDS
1023
+ spaces: SPACE_COMMANDS,
1024
+ shell: SHELL_COMMANDS
1006
1025
  };
1007
1026
 
1008
1027
  // src/api/storage.ts
@@ -1872,6 +1891,71 @@ var SpacesAPI = class {
1872
1891
  }
1873
1892
  };
1874
1893
 
1894
+ // src/api/shell.ts
1895
+ var ShellAPI = class {
1896
+ constructor(sdk) {
1897
+ this.sdk = sdk;
1898
+ }
1899
+ /**
1900
+ * Create a new PTY shell session.
1901
+ * Returns a session ID used for subsequent write/resize/close operations.
1902
+ * Listen for shell output via `sdk.shell.onData()`.
1903
+ */
1904
+ async create(options = {}) {
1905
+ const result = await this.sdk.request(
1906
+ SHELL_COMMANDS.create,
1907
+ { options }
1908
+ );
1909
+ return result.sessionId;
1910
+ }
1911
+ /**
1912
+ * Write data to a shell session's stdin.
1913
+ * Typically used to forward terminal keystrokes.
1914
+ */
1915
+ async write(sessionId, data) {
1916
+ await this.sdk.request(SHELL_COMMANDS.write, { sessionId, data });
1917
+ }
1918
+ /**
1919
+ * Resize a shell session's terminal.
1920
+ * Should be called when the terminal view is resized.
1921
+ */
1922
+ async resize(sessionId, cols, rows) {
1923
+ await this.sdk.request(SHELL_COMMANDS.resize, { sessionId, cols, rows });
1924
+ }
1925
+ /**
1926
+ * Close a shell session.
1927
+ * This terminates the underlying PTY process.
1928
+ */
1929
+ async close(sessionId) {
1930
+ await this.sdk.request(SHELL_COMMANDS.close, { sessionId });
1931
+ }
1932
+ /**
1933
+ * Register a callback for shell output data.
1934
+ * The callback receives output from the PTY's stdout/stderr.
1935
+ */
1936
+ onData(callback) {
1937
+ this.sdk.on("shell:output", callback);
1938
+ }
1939
+ /**
1940
+ * Register a callback for shell session exit.
1941
+ */
1942
+ onExit(callback) {
1943
+ this.sdk.on("shell:exit", callback);
1944
+ }
1945
+ /**
1946
+ * Remove a shell output callback.
1947
+ */
1948
+ offData(callback) {
1949
+ this.sdk.off("shell:output", callback);
1950
+ }
1951
+ /**
1952
+ * Remove a shell exit callback.
1953
+ */
1954
+ offExit(callback) {
1955
+ this.sdk.off("shell:exit", callback);
1956
+ }
1957
+ };
1958
+
1875
1959
  // src/client/tableName.ts
1876
1960
  function validatePublicKey(publicKey) {
1877
1961
  if (!publicKey || typeof publicKey !== "string" || publicKey.trim() === "") {
@@ -2497,6 +2581,7 @@ var HaexVaultSdk = class {
2497
2581
  this.remoteStorage = new RemoteStorageAPI(this);
2498
2582
  this.localsend = new LocalSendAPI(this);
2499
2583
  this.spaces = new SpacesAPI(this);
2584
+ this.shell = new ShellAPI(this);
2500
2585
  installConsoleForwarding(this.config.debug);
2501
2586
  this.readyPromise = new Promise((resolve) => {
2502
2587
  this.resolveReady = resolve;
@@ -3452,6 +3537,6 @@ function createHaexVaultSdk(config = {}) {
3452
3537
  return new HaexVaultSdk(config);
3453
3538
  }
3454
3539
 
3455
- export { COSE_ALGORITHM, DEFAULT_TIMEOUT, DatabaseAPI, EXTERNAL_EVENTS, ErrorCode, ExternalConnectionErrorCode, ExternalConnectionState, FilesystemAPI, HAEXSPACE_MESSAGE_TYPES, HAEXTENSION_EVENTS, HaexVaultSdk, HaexVaultSdkError, KEY_AGREEMENT_ALGO, LOCALSEND_EVENTS, LocalSendAPI, PermissionErrorCode, PermissionStatus, PermissionsAPI, RemoteStorageAPI, SIGNING_ALGO, SPACE_COMMANDS, SpacesAPI, TABLE_SEPARATOR, TAURI_COMMANDS, WebAPI, arrayBufferToBase64, base58btcDecode, base58btcEncode, base64ToArrayBuffer, canExternalClientSendRequests, createHaexVaultSdk, decryptCrdtData, decryptPrivateKeyAsync, decryptSpaceNameAsync, decryptString, decryptVaultKey, decryptVaultName, decryptWithPrivateKeyAsync, deriveKeyFromPassword, didKeyToPublicKeyAsync, encryptCrdtData, encryptPrivateKeyAsync, encryptSpaceNameAsync, encryptString, encryptVaultKey, encryptWithPublicKeyAsync, exportKeyPairAsync, exportPrivateKeyAsync, exportPublicKeyAsync, exportPublicKeyCoseAsync, exportUserKeypairAsync, generateCredentialId, generateIdentityAsync, generatePasskeyPairAsync, generateSpaceKey, generateUserKeypairAsync, generateVaultKey, getTableName, hexToBytes, importPrivateKeyAsync, importPrivateKeyForKeyAgreementAsync, importPublicKeyAsync, importPublicKeyForKeyAgreementAsync, importUserPrivateKeyAsync, importUserPublicKeyAsync, installBaseTag, installCookiePolyfill, installHistoryPolyfill, installLocalStoragePolyfill, installPolyfills, installSessionStoragePolyfill, isExternalClientConnected, isPermissionDeniedError, isPermissionError, isPermissionPromptError, publicKeyToDidKeyAsync, signClaimPresentationAsync, signRecordAsync, signSpaceChallengeAsync, signWithPasskeyAsync, sortObjectKeysRecursively, unwrapKey, verifyClaimPresentationAsync, verifyExtensionSignature, verifyRecordSignatureAsync, verifySpaceChallengeAsync, verifyWithPasskeyAsync, wrapKey };
3540
+ export { COSE_ALGORITHM, DEFAULT_TIMEOUT, DatabaseAPI, EXTERNAL_EVENTS, ErrorCode, ExternalConnectionErrorCode, ExternalConnectionState, FilesystemAPI, HAEXSPACE_MESSAGE_TYPES, HAEXTENSION_EVENTS, HaexVaultSdk, HaexVaultSdkError, KEY_AGREEMENT_ALGO, LOCALSEND_EVENTS, LocalSendAPI, PermissionErrorCode, PermissionStatus, PermissionsAPI, RemoteStorageAPI, SHELL_EVENTS, SIGNING_ALGO, SPACE_COMMANDS, ShellAPI, SpacesAPI, TABLE_SEPARATOR, TAURI_COMMANDS, WebAPI, arrayBufferToBase64, base58btcDecode, base58btcEncode, base64ToArrayBuffer, canExternalClientSendRequests, createHaexVaultSdk, decryptCrdtData, decryptPrivateKeyAsync, decryptSpaceNameAsync, decryptString, decryptVaultKey, decryptVaultName, decryptWithPrivateKeyAsync, deriveKeyFromPassword, didKeyToPublicKeyAsync, encryptCrdtData, encryptPrivateKeyAsync, encryptSpaceNameAsync, encryptString, encryptVaultKey, encryptWithPublicKeyAsync, exportKeyPairAsync, exportPrivateKeyAsync, exportPublicKeyAsync, exportPublicKeyCoseAsync, exportUserKeypairAsync, generateCredentialId, generateIdentityAsync, generatePasskeyPairAsync, generateSpaceKey, generateUserKeypairAsync, generateVaultKey, getTableName, hexToBytes, importPrivateKeyAsync, importPrivateKeyForKeyAgreementAsync, importPublicKeyAsync, importPublicKeyForKeyAgreementAsync, importUserPrivateKeyAsync, importUserPublicKeyAsync, installBaseTag, installCookiePolyfill, installHistoryPolyfill, installLocalStoragePolyfill, installPolyfills, installSessionStoragePolyfill, isExternalClientConnected, isPermissionDeniedError, isPermissionError, isPermissionPromptError, publicKeyToDidKeyAsync, signClaimPresentationAsync, signRecordAsync, signSpaceChallengeAsync, signWithPasskeyAsync, sortObjectKeysRecursively, unwrapKey, verifyClaimPresentationAsync, verifyExtensionSignature, verifyRecordSignatureAsync, verifySpaceChallengeAsync, verifyWithPasskeyAsync, wrapKey };
3456
3541
  //# sourceMappingURL=index.mjs.map
3457
3542
  //# sourceMappingURL=index.mjs.map