SypnexAPI

SypnexAPI - Main API class for user applications Provides access to OS features and services in a sandboxed environment

Constructor

new SypnexAPI(appId, helpers)

Create a new SypnexAPI instance
Parameters:
NameTypeDescription
appIdstringUnique identifier for the application
helpersobjectHelper functions provided by the OS environment
Properties
NameTypeAttributesDescription
getAppSettingfunction<optional>
Function to get app settings
getAllAppSettingsfunction<optional>
Function to get all app settings
showNotificationfunction<optional>
Function to show notifications

Members

scaling :object

Access to scaling utilities
Type:
  • object

Methods

_triggerEvent(eventName, data)

Trigger internal events (for app communication)
Parameters:
NameTypeDescription
eventNamestringEvent name
dataanyEvent data

appToScreenCoords(appX, appY, zoomScaleopt) → {object}

Convenience method: Convert app to screen coordinates
Parameters:
NameTypeAttributesDefaultDescription
appXnumberApp X coordinate
appYnumberApp Y coordinate
zoomScalenumber<optional>
1.0Optional zoom scale
Returns:
Screen coordinates
Type: 
object

cleanup()

Internal method called by the OS during app cleanup Executes all registered cleanup hooks

clearLogs(filtersopt) → {Promise.<object>}

Clear logs with optional filtering
Parameters:
NameTypeAttributesDescription
filtersobject<optional>
Filter options
Properties
NameTypeAttributesDescription
componentstring<optional>
Component to clear (core-os, user-apps, plugins, services, all)
datestring<optional>
Specific date to clear (YYYY-MM-DD format) or 'all' for all dates
Returns:
- Clear operation result
Type: 
Promise.<object>

connectSocket(url, options) → {Promise.<boolean>}

Connect to Socket.IO server for this app instance
Parameters:
NameTypeDescription
urlstringSocket.IO server URL (defaults to current origin)
optionsobjectSocket.IO connection options
Returns:
- Connection success status
Type: 
Promise.<boolean>

createHamburgerMenu(container, menuItems, optionsopt) → {object}

Create a hamburger menu with customizable items
Parameters:
NameTypeAttributesDefaultDescription
containerHTMLElementThe container element to append the menu to
menuItemsArrayArray of menu item objects
optionsobject<optional>
{}Configuration options
Properties
NameTypeAttributesDefaultDescription
positionstring<optional>
'right'Position of menu ('left' or 'right')
buttonClassstring<optional>
''Additional CSS classes for the button
menuIdstring<optional>
''Custom ID for the menu (auto-generated if not provided)
Returns:
Object with methods to control the menu
Type: 
object
Example
const menuItems = [
  { icon: 'fas fa-sync-alt', text: 'Refresh', action: () => console.log('Refresh') },
  { icon: 'fas fa-folder-plus', text: 'New Folder', action: () => console.log('New Folder') },
  { type: 'separator' },
  { icon: 'fas fa-upload', text: 'Upload File', action: () => console.log('Upload') }
];

const menu = sypnexAPI.createHamburgerMenu(container, menuItems, { position: 'right' });

createVirtualDirectoryStructure(dirPath) → {Promise.<object>}

Create a directory structure (creates parent directories if needed)
Parameters:
NameTypeDescription
dirPathstringDirectory path to create
Returns:
- Creation result
Type: 
Promise.<object>

createVirtualFile(name, content, parentPath) → {Promise.<object>}

Create a new file
Parameters:
NameTypeDescription
namestringFile name
contentstringFile content
parentPathstringParent directory path (defaults to '/')
Returns:
- Creation result
Type: 
Promise.<object>

createVirtualFolder(name, parentPath) → {Promise.<object>}

Create a new folder
Parameters:
NameTypeDescription
namestringFolder name
parentPathstringParent directory path (defaults to '/')
Returns:
- Creation result
Type: 
Promise.<object>

decrypt(encryptedValue) → {Promise.<(string|null)>}

Decrypt a value that was previously encrypted with the encrypt() method
Parameters:
NameTypeDescription
encryptedValuestringThe encrypted value to decrypt
Returns:
The decrypted value, or null if decryption failed
Type: 
Promise.<(string|null)>
Example
// Decrypt a previously encrypted value
const decrypted = await sypnexAPI.decrypt(encryptedValue);

// Handle decryption failure
if (decrypted === null) {
    console.error("Failed to decrypt value");
}

(async) deleteSetting(key) → {Promise.<boolean>}

Delete an application setting
Parameters:
NameTypeDescription
keystringSetting key to delete
Returns:
True if deleted successfully, false otherwise
Type: 
Promise.<boolean>

deleteVirtualItem(itemPath) → {Promise.<object>}

Delete a file or directory
Parameters:
NameTypeDescription
itemPathstringPath to the item to delete
Returns:
- Deletion result
Type: 
Promise.<object>

detectAppScale() → {number}

Convenience method: Detect current app scale
Returns:
Scale factor
Type: 
number

encrypt(value) → {Promise.<(string|null)>}

Encrypt a value using the system's encryption service
Parameters:
NameTypeDescription
valuestring | objectThe value to encrypt (will be JSON.stringify'd if object)
Returns:
The encrypted value as a string, or null if encryption failed
Type: 
Promise.<(string|null)>
Example
// Encrypt a simple string
const encrypted = await sypnexAPI.encrypt("my secret data");

// Encrypt an object
const encryptedObj = await sypnexAPI.encrypt({username: "john", password: "secret"});

eventToKeyString(event) → {string}

Convert keyboard event to standardized key string
Parameters:
NameTypeDescription
eventKeyboardEventThe keyboard event
Returns:
Standardized key string
Type: 
string

(async) getAllSettings() → {Promise.<object>}

Get all application settings
Returns:
Object containing all app settings
Type: 
Promise.<object>

getAppId() → {string}

Get the application ID
Returns:
The application identifier
Type: 
string

(async) getAppMetadata() → {Promise.<(object|null)>}

Get metadata for this application
Returns:
Application metadata or null if error
Type: 
Promise.<(object|null)>

getAppWindow() → {Object}

Get the isolated window object for this app with automatic property tracking Returns the same window proxy instance for subsequent calls (singleton pattern). All properties assigned to this window proxy will be automatically cleaned up when the app is closed, preventing memory leaks and conflicts.
Returns:
Window proxy object that tracks property assignments
Type: 
Object
Example
// Instead of: window.myData = { ... }
// Use:
const appWindow = sypnexAPI.getAppWindow();
appWindow.myData = { ... }; // This will be automatically cleaned up

// Multiple calls return the same proxy:
const w1 = sypnexAPI.getAppWindow();
const w2 = sypnexAPI.getAppWindow();
console.log(w1 === w2); // true

// The proxy behaves exactly like window for reading:
appWindow.document.getElementById('myId'); // Works normally
appWindow.localStorage.getItem('key');    // Works normally

(async) getAvailableApps() → {Promise.<object>}

Get available applications from the registry
Returns:
- Available applications data
Type: 
Promise.<object>

(async) getInstalledApps() → {Promise.<Array>}

Get list of installed applications
Returns:
- Array of installed applications
Type: 
Promise.<Array>

getKeyboardStats() → {object}

Get keyboard shortcut statistics
Returns:
Statistics about registered shortcuts
Type: 
object

getLogDates() → {Promise.<object>}

Get available log dates for each component
Returns:
- Available dates by component
Type: 
Promise.<object>

getLogStats() → {Promise.<object>}

Get logging system statistics
Returns:
- Logging statistics
Type: 
Promise.<object>

getMyLogs(filtersopt) → {Promise.<object>}

Get logs for the current app (convenience method)
Parameters:
NameTypeAttributesDescription
filtersobject<optional>
Additional filter options
Returns:
- Log entries for this app
Type: 
Promise.<object>

(async) getPreference(category, key, defaultValueopt) → {Promise.<*>}

Get a user preference value
Parameters:
NameTypeAttributesDefaultDescription
categorystringPreference category
keystringPreference key
defaultValue*<optional>
nullDefault value if preference not found
Returns:
The preference value or default value
Type: 
Promise.<*>

getScaledBoundingClientRect(element) → {object}

Convenience method: Get scaled element bounds
Parameters:
NameTypeDescription
elementElementDOM element
Returns:
Scaled bounding rectangle
Type: 
object

getScaledMouseCoords(e) → {object}

Convenience method: Get scaled mouse coordinates
Parameters:
NameTypeDescription
eEventMouse event
Returns:
Scaled coordinates
Type: 
object

(async) getServices() → {Promise.<Array>}

Get a list of all available services
Throws:
If the request fails
Type
Error
Returns:
Array of service objects
Type: 
Promise.<Array>
Example
const services = await sypnexAPI.getServices();
console.log(services); // [{ id: "service1", name: "Service 1", running: true }, ...]

(async) getSetting(key, defaultValueopt) → {Promise.<*>}

Get an application setting
Parameters:
NameTypeAttributesDefaultDescription
keystringSetting key to retrieve
defaultValue*<optional>
nullDefault value if setting not found
Returns:
The setting value or default value
Type: 
Promise.<*>

getSocket() → {object|null}

Get the Socket.IO instance
Returns:
- Socket.IO instance or null
Type: 
object | null

getSocketState() → {object}

Get Socket.IO connection state
Returns:
- Connection state object
Type: 
object

getStats() → {object}

Get statistics about registered shortcuts
Returns:
Statistics object
Type: 
object

getSypnexApps() → {Object}

Get access to the global SypnexApps tracker
Returns:
- The window.sypnexApps object containing app tracking info
Type: 
Object

getSypnexOS() → {Object}

Get access to the global SypnexOS apps registry
Returns:
- The window.sypnexOS object containing apps Map and other OS functions
Type: 
Object

getVirtualFileStats() → {Promise.<object>}

Get virtual file system statistics
Returns:
- System statistics
Type: 
Promise.<object>

getVirtualFileUrl(filePath) → {string}

Serve a file directly (for binary files, images, etc.)
Parameters:
NameTypeDescription
filePathstringPath to the file
Returns:
- Direct URL to serve the file
Type: 
string

getVirtualItemInfo(itemPath) → {Promise.<object>}

Get information about a file or directory
Parameters:
NameTypeDescription
itemPathstringPath to the item
Returns:
- Item information
Type: 
Promise.<object>

(async) getWindowState() → {Promise.<(object|null)>}

Get the saved window state for this application
Returns:
Window state object or null if not found
Type: 
Promise.<(object|null)>

(async) init() → {Promise.<void>}

Initialize the SypnexAPI instance Checks for required helper functions and sets up the API
Returns:
Type: 
Promise.<void>

initScaleDetection(onScaleChangeopt) → {MutationObserver}

Convenience method: Initialize scale detection
Parameters:
NameTypeAttributesDescription
onScaleChangefunction<optional>
Callback for scale changes
Returns:
Observer instance
Type: 
MutationObserver

initializeWindowManager()

Initialize the window management system

(async) installApp(appId, optionsopt) → {Promise.<object>}

Install an application from the registry
Parameters:
NameTypeAttributesDefaultDescription
appIdstringApplication ID to install
optionsobject<optional>
{}Installation options
Properties
NameTypeAttributesDescription
versionstring<optional>
Specific version to install (defaults to latest)
Returns:
- Installation result
Type: 
Promise.<object>

isInitialized() → {boolean}

Check if the SypnexAPI has been initialized
Returns:
True if initialized, false otherwise
Type: 
boolean

isSocketConnected() → {boolean}

Check if Socket.IO is connected
Returns:
- Connection status
Type: 
boolean

joinRoom(roomName) → {boolean}

Join a Socket.IO room
Parameters:
NameTypeDescription
roomNamestringRoom to join
Returns:
- Success status
Type: 
boolean

leaveRoom(roomName) → {boolean}

Leave a Socket.IO room
Parameters:
NameTypeDescription
roomNamestringRoom to leave
Returns:
- Success status
Type: 
boolean

listVirtualFiles(path) → {Promise.<object>}

List files and directories in a path
Parameters:
NameTypeDescription
pathstringDirectory path (defaults to '/')
Returns:
- Directory contents
Type: 
Promise.<object>

(async) llmComplete(options) → {Promise.<object>}

Complete a chat conversation using any supported LLM provider Translates OpenAI format to provider-specific format and normalizes response
Parameters:
NameTypeDescription
optionsobjectConfiguration options
Properties
NameTypeAttributesDefaultDescription
providerstringProvider: 'openai', 'anthropic', 'google', 'ollama'
endpointstringAPI endpoint URL
apiKeystring<optional>
API key (not needed for Ollama)
modelstringModel name
messagesArrayMessages array in OpenAI format
temperaturenumber<optional>
0.7Temperature (0-1)
maxTokensnumber<optional>
1000Maximum tokens to generate
streamboolean<optional>
falseWhether to stream response
Returns:
Normalized response: {content, usage, model, provider}
Type: 
Promise.<object>

loadLibrary(url, options) → {Promise.<any>}

Load a library from CDN
Parameters:
NameTypeDescription
urlstringCDN URL of the library
optionsobjectLoading options
Returns:
- Loaded library or true if successful
Type: 
Promise.<any>

logCritical(message, detailsopt) → {Promise.<object>}

Convenience method to write critical log
Parameters:
NameTypeAttributesDescription
messagestringLog message
detailsobject<optional>
Additional details
Returns:
- Write result
Type: 
Promise.<object>

logDebug(message, detailsopt) → {Promise.<object>}

Convenience method to write debug log
Parameters:
NameTypeAttributesDescription
messagestringLog message
detailsobject<optional>
Additional details
Returns:
- Write result
Type: 
Promise.<object>

logError(message, detailsopt) → {Promise.<object>}

Convenience method to write error log
Parameters:
NameTypeAttributesDescription
messagestringLog message
detailsobject<optional>
Additional details
Returns:
- Write result
Type: 
Promise.<object>

logInfo(message, detailsopt) → {Promise.<object>}

Convenience method to write info log
Parameters:
NameTypeAttributesDescription
messagestringLog message
detailsobject<optional>
Additional details
Returns:
- Write result
Type: 
Promise.<object>

logWarn(message, detailsopt) → {Promise.<object>}

Convenience method to write warning log
Parameters:
NameTypeAttributesDescription
messagestringLog message
detailsobject<optional>
Additional details
Returns:
- Write result
Type: 
Promise.<object>

off(eventName, callback)

Remove Socket.IO event listener
Parameters:
NameTypeDescription
eventNamestringEvent name
callbackfunctionCallback function to remove

on(eventName, callback)

Listen for Socket.IO events
Parameters:
NameTypeDescription
eventNamestringEvent name to listen for
callbackfunctionCallback function

onBeforeClose(cleanupFunction, descriptionopt)

Register a cleanup function to be called when the app is closed Use this for custom cleanup like stopping game loops, disposing WebGL contexts, etc.
Parameters:
NameTypeAttributesDefaultDescription
cleanupFunctionfunctionFunction to call during app cleanup
descriptionstring<optional>
User cleanupOptional description for debugging
Example
// For Three.js apps
sypnexAPI.onBeforeClose(() => {
    if (renderer) {
        renderer.dispose();
        renderer.domElement = null;
    }
    if (animationId) {
        cancelAnimationFrame(animationId);
    }
}, 'Three.js cleanup');

// For game loops
sypnexAPI.onBeforeClose(() => {
    gameRunning = false;
    if (gameLoopInterval) {
        clearInterval(gameLoopInterval);
    }
}, 'Game loop cleanup');

ping() → {Promise.<number>}

Send a ping to test connection
Returns:
- Ping time in milliseconds
Type: 
Promise.<number>

(async) proxyDELETE(url, optionsopt) → {Promise.<object>}

Make a DELETE request through the proxy
Parameters:
NameTypeAttributesDefaultDescription
urlstringTarget URL
optionsobject<optional>
{}Additional options
Properties
NameTypeAttributesDefaultDescription
headersobject<optional>
{}HTTP headers
timeoutnumber<optional>
30Request timeout in seconds
Returns:
- Response data
Type: 
Promise.<object>

(async) proxyGET(url, optionsopt) → {Promise.<object>}

Make a GET request through the proxy
Parameters:
NameTypeAttributesDefaultDescription
urlstringTarget URL
optionsobject<optional>
{}Additional options
Properties
NameTypeAttributesDefaultDescription
headersobject<optional>
{}HTTP headers
timeoutnumber<optional>
30Request timeout in seconds
Returns:
- Response data
Type: 
Promise.<object>

(async) proxyHTTP(options) → {Promise.<object>}

Proxy an HTTP request through the system (tries direct CORS, falls back to proxy)
Parameters:
NameTypeDescription
optionsobjectHTTP request options
Properties
NameTypeAttributesDefaultDescription
urlstringTarget URL for the request
methodstring<optional>
'GET'HTTP method (GET, POST, PUT, DELETE, etc.)
headersobject<optional>
{}HTTP headers to send
body*<optional>
Request body (will be JSON stringified if object)
timeoutnumber<optional>
30Request timeout in seconds
followRedirectsboolean<optional>
trueWhether to follow redirects
forceProxyboolean<optional>
falseForce use of backend proxy instead of direct CORS
Returns:
- Response data in proxy format for compatibility
Type: 
Promise.<object>

(async) proxyJSON(url, optionsopt) → {Promise.<object>}

Make a JSON API request through the proxy
Parameters:
NameTypeAttributesDefaultDescription
urlstringTarget URL
optionsobject<optional>
{}Request options
Properties
NameTypeAttributesDefaultDescription
methodstring<optional>
'GET'HTTP method
dataobject<optional>
JSON data to send
headersobject<optional>
{}Additional headers
timeoutnumber<optional>
30Request timeout in seconds
Returns:
- Parsed JSON response
Type: 
Promise.<object>

(async) proxyPOST(url, body, optionsopt) → {Promise.<object>}

Make a POST request through the proxy
Parameters:
NameTypeAttributesDefaultDescription
urlstringTarget URL
body*Request body
optionsobject<optional>
{}Additional options
Properties
NameTypeAttributesDefaultDescription
headersobject<optional>
{}HTTP headers
timeoutnumber<optional>
30Request timeout in seconds
Returns:
- Response data
Type: 
Promise.<object>

(async) proxyPUT(url, body, optionsopt) → {Promise.<object>}

Make a PUT request through the proxy
Parameters:
NameTypeAttributesDefaultDescription
urlstringTarget URL
body*Request body
optionsobject<optional>
{}Additional options
Properties
NameTypeAttributesDefaultDescription
headersobject<optional>
{}HTTP headers
timeoutnumber<optional>
30Request timeout in seconds
Returns:
- Response data
Type: 
Promise.<object>

readLogs(filtersopt) → {Promise.<object>}

Read logs with filtering options
Parameters:
NameTypeAttributesDescription
filtersobject<optional>
Filter options
Properties
NameTypeAttributesDescription
componentstring<optional>
Component to filter by (core-os, user-apps, plugins, services, all)
levelstring<optional>
Log level to filter by (debug, info, warn, error, critical, all)
datestring<optional>
Date to filter by (YYYY-MM-DD format, defaults to today)
limitnumber<optional>
Maximum number of logs to return (default: 100)
sourcestring<optional>
Source to filter by (app name, plugin name, etc.)
Returns:
- Log entries and metadata
Type: 
Promise.<object>

readVirtualFile(filePath) → {Promise.<object>}

Read a file's content
Parameters:
NameTypeDescription
filePathstringPath to the file
Returns:
- File data
Type: 
Promise.<object>

readVirtualFileBlob(filePath) → {Promise.<Blob>}

Get a file's content as Blob (for binary files, images, etc.)
Parameters:
NameTypeDescription
filePathstringPath to the file
Returns:
- File content as Blob
Type: 
Promise.<Blob>

readVirtualFileJSON(filePath) → {Promise.<object>}

Get a file's content as JSON
Parameters:
NameTypeDescription
filePathstringPath to the file
Returns:
- Parsed JSON content
Type: 
Promise.<object>

readVirtualFileText(filePath) → {Promise.<string>}

Get a file's content as text
Parameters:
NameTypeDescription
filePathstringPath to the file
Returns:
- File content as text
Type: 
Promise.<string>

(async) refreshAppRegistry() → {Promise.<object>}

Refresh the application registry cache
Returns:
- Refresh result
Type: 
Promise.<object>

(async) refreshAppVersionsCache() → {Promise.<boolean>}

Request the OS to refresh the latest app versions cache Useful when an app knows it has been updated or wants to force a cache refresh
Returns:
True if refresh was successful, false otherwise
Type: 
Promise.<boolean>

registerKeyboardShortcuts(shortcuts, config)

Register keyboard shortcuts for this application
Parameters:
NameTypeDescription
shortcutsobjectObject mapping key strings to handler functions
configobjectConfiguration options
Properties
NameTypeDescription
preventDefaultbooleanWhether to prevent default behavior (default: true)
stopPropagationbooleanWhether to stop event propagation (default: false)
Example
this.registerKeyboardShortcuts({
    'f': () => this.toggleFullscreen(),
    'escape': () => this.exitFullscreen(),
    'space': () => this.pausePlay(),
    'ctrl+s': () => this.save()
});

removeCleanupHook(cleanupFunction)

Remove a previously registered cleanup function
Parameters:
NameTypeDescription
cleanupFunctionfunctionThe function to remove

(async) saveWindowState(state) → {Promise.<boolean>}

Save the window state for this application
Parameters:
NameTypeDescription
stateobjectWindow state object to save
Returns:
True if saved successfully, false otherwise
Type: 
Promise.<boolean>

screenToAppCoords(screenX, screenY, zoomScaleopt) → {object}

Convenience method: Convert screen to app coordinates
Parameters:
NameTypeAttributesDefaultDescription
screenXnumberScreen X coordinate
screenYnumberScreen Y coordinate
zoomScalenumber<optional>
1.0Optional zoom scale
Returns:
App coordinates
Type: 
object

sendMessage(event, data, room) → {boolean}

Send a message via Socket.IO
Parameters:
NameTypeDescription
eventstringEvent name
dataanyData to send
roomstringRoom to send to (optional)
Returns:
- Success status
Type: 
boolean

setAutoReconnect(enabled)

Enable or disable auto-reconnect
Parameters:
NameTypeDescription
enabledbooleanWhether to enable auto-reconnect

setHealthCheckInterval(intervalMs)

Set health check interval
Parameters:
NameTypeDescription
intervalMsnumberInterval in milliseconds

setHealthChecks(enabled)

Enable or disable health checks
Parameters:
NameTypeDescription
enabledbooleanWhether to enable health checks

(async) setPreference(category, key, value) → {Promise.<boolean>}

Set a user preference value
Parameters:
NameTypeDescription
categorystringPreference category
keystringPreference key
value*Value to store
Returns:
True if saved successfully, false otherwise
Type: 
Promise.<boolean>

setReconnectConfig(config)

Set auto-reconnect configuration
Parameters:
NameTypeDescription
configobjectReconnect configuration

(async) setSetting(key, value) → {Promise.<boolean>}

Set an application setting
Parameters:
NameTypeDescription
keystringSetting key to set
value*Value to store
Returns:
True if saved successfully, false otherwise
Type: 
Promise.<boolean>

(async) showConfirmation(title, message, optionsopt) → {Promise.<boolean>}

Show a confirmation dialog with standard OS styling
Parameters:
NameTypeAttributesDefaultDescription
titlestringDialog title
messagestringDialog message
optionsobject<optional>
{}Configuration options
Properties
NameTypeAttributesDefaultDescription
confirmTextstring<optional>
'Yes'Text for confirm button
cancelTextstring<optional>
'No'Text for cancel button
typestring<optional>
'warning'Dialog type: 'warning', 'danger', 'info'
iconstring<optional>
'fas fa-exclamation-triangle'FontAwesome icon class
Returns:
True if confirmed, false if cancelled
Type: 
Promise.<boolean>

showFileExplorer(options) → {Promise.<string>}

Show a file explorer modal for selecting files or directories
Parameters:
NameTypeDescription
optionsobjectConfiguration options
Properties
NameTypeDescription
modestring'open' for loading files, 'save' for saving files
titlestringModal title
initialPathstringStarting directory path
fileNamestringDefault filename for save mode
fileExtensionstringRequired file extension (e.g., '.txt')
onSelectfunctionCallback when file is selected
onCancelfunctionCallback when modal is cancelled
Returns:
- Selected file path or null if cancelled
Type: 
Promise.<string>

showFileUploadModal(title, message, optionsopt) → {Promise.<(File|null)>}

Show a file upload modal
Parameters:
NameTypeAttributesDefaultDescription
titlestringModal title
messagestringModal message/label
optionsobject<optional>
{}Configuration options
Properties
NameTypeAttributesDefaultDescription
confirmTextstring<optional>
'Upload'Text for confirm button
cancelTextstring<optional>
'Cancel'Text for cancel button
iconstring<optional>
'fas fa-upload'FontAwesome icon class
acceptstring<optional>
'*'File accept types
Returns:
Selected file if confirmed, null if cancelled
Type: 
Promise.<(File|null)>

showInputModal(title, message, optionsopt) → {Promise.<(string|null)>}

Show an input modal for getting text input from user
Parameters:
NameTypeAttributesDefaultDescription
titlestringModal title
messagestringModal message/label
optionsobject<optional>
{}Configuration options
Properties
NameTypeAttributesDefaultDescription
placeholderstring<optional>
''Input placeholder text
defaultValuestring<optional>
''Default input value
confirmTextstring<optional>
'Create'Text for confirm button
cancelTextstring<optional>
'Cancel'Text for cancel button
iconstring<optional>
'fas fa-edit'FontAwesome icon class
inputTypestring<optional>
'text'Input type: 'text', 'textarea'
Returns:
Input value if confirmed, null if cancelled
Type: 
Promise.<(string|null)>

(async) startService(serviceId) → {Promise.<void>}

Start a specific service by ID
Parameters:
NameTypeDescription
serviceIdstringThe ID of the service to start
Throws:
If the request fails
Type
Error
Returns:
Type: 
Promise.<void>
Example
await sypnexAPI.startService("my-service-id");

(async) stopService(serviceId) → {Promise.<void>}

Stop a specific service by ID
Parameters:
NameTypeDescription
serviceIdstringThe ID of the service to stop
Throws:
If the request fails
Type
Error
Returns:
Type: 
Promise.<void>
Example
await sypnexAPI.stopService("my-service-id");

(async) uninstallApp(appId) → {Promise.<object>}

Uninstall an application
Parameters:
NameTypeDescription
appIdstringApplication ID to uninstall
Returns:
- Uninstallation result
Type: 
Promise.<object>

unregisterApp(appId)

Unregister all shortcuts for an application
Parameters:
NameTypeDescription
appIdstringApplication identifier

(async) updateApp(appId, downloadUrl) → {Promise.<object>}

Update a specific application to the latest version
Parameters:
NameTypeDescription
appIdstringApplication ID to update
downloadUrlstringDownload URL for the app update (required)
Returns:
- Update result
Type: 
Promise.<object>

uploadVirtualFile(file, parentPath) → {Promise.<object>}

Upload a file from the host system
Parameters:
NameTypeDescription
fileFileFile object from input element
parentPathstringParent directory path (defaults to '/')
Returns:
- Upload result
Type: 
Promise.<object>

uploadVirtualFileChunked(file, parentPath, progressCallback) → {Object}

Upload a file with real progress tracking based on actual upload progress
Parameters:
NameTypeDescription
fileFileFile object from input element
parentPathstringParent directory path (defaults to '/')
progressCallbackfunctionCallback for progress updates (percent)
Returns:
- Object with promise and abort method { promise: Promise, abort: Function }
Type: 
Object

virtualItemExists(itemPath) → {Promise.<boolean>}

Check if a file or directory exists
Parameters:
NameTypeDescription
itemPathstringPath to the item
Returns:
- Whether the item exists
Type: 
Promise.<boolean>

writeLog(logData) → {Promise.<object>}

Write a log entry
Parameters:
NameTypeDescription
logDataobjectLog entry data
Properties
NameTypeAttributesDescription
levelstringLog level (debug, info, warn, error, critical)
messagestringLog message
componentstringComponent type (core-os, user-apps, plugins, services)
sourcestring<optional>
Source identifier (app name, plugin name, etc.)
detailsobject<optional>
Additional details object
Returns:
- Write result
Type: 
Promise.<object>

writeVirtualFile(filePath, content) → {Promise.<object>}

Write content to a file (creates or overwrites)
Parameters:
NameTypeDescription
filePathstringPath to the file
contentstringFile content
Returns:
- Write result
Type: 
Promise.<object>

writeVirtualFileBinary(filePath, binaryData) → {Promise.<object>}

Write binary content to a file using the upload endpoint
Parameters:
NameTypeDescription
filePathstringPath to the file
binaryDataUint8Array | BlobBinary data to write
Returns:
- Write result
Type: 
Promise.<object>

writeVirtualFileJSON(filePath, data) → {Promise.<object>}

Write JSON content to a file
Parameters:
NameTypeDescription
filePathstringPath to the file
dataobjectJSON data to write
Returns:
- Write result
Type: 
Promise.<object>