A simple SDK for building G-Assist plugins in Node.js.
- Node.js 14.0 or later
Copy gassist-sdk.js to your plugin folder, or:
npm install ./path/to/sdk/nodejsconst { Plugin } = require('./gassist-sdk');
const plugin = new Plugin('my-plugin', '1.0.0', 'My awesome plugin');
// Register a command
plugin.command('greet', (args) => {
const name = args.name || 'World';
return `Hello, ${name}!`;
});
// Run the plugin
plugin.run();plugin.command('function_name', (args) => {
// Access arguments
const param = args.param || 'default';
// Return result (string, object, etc.)
return { result: 'value' };
});plugin.command('fetch_data', async (args) => {
const response = await fetch(args.url);
const data = await response.json();
return data;
});plugin.command('long_operation', (args) => {
plugin.stream('Starting...\n');
// do work
plugin.stream('50% complete...\n');
// do more work
plugin.stream('Done!\n');
return ''; // All output was streamed
});plugin.command('start_chat', (args) => {
plugin.setKeepSession(true);
return 'Chat started! Type "exit" to leave.';
});
plugin.command('on_input', (args) => {
const content = args.content;
if (content.toLowerCase() === 'exit') {
plugin.setKeepSession(false);
return 'Goodbye!';
}
plugin.setKeepSession(true);
return `You said: ${content}`;
});node plugin.jsCreate manifest.json alongside your plugin:
{
"manifestVersion": 1,
"name": "my-plugin",
"version": "1.0.0",
"description": "My Node.js plugin",
"executable": "node plugin.js",
"persistent": true,
"protocol_version": "2.0",
"functions": [
{
"name": "greet",
"description": "Greet the user",
"tags": ["hello", "greet"],
"properties": {
"name": {
"type": "string",
"description": "Name to greet"
}
}
}
]
}Plugin logs are written to:
%PROGRAMDATA%\NVIDIA Corporation\nvtopps\rise\plugins\<plugin-name>\<plugin-name>.log
const plugin = new Plugin(name, version, description);plugin.command(name, handler)- Register a command handlerplugin.stream(data)- Send streaming dataplugin.setKeepSession(keep)- Set passthrough modeplugin.log(message)- Write to log fileplugin.run()- Start the plugin main loop
This SDK implements Protocol V2 (JSON-RPC 2.0) with length-prefixed framing.
See PROTOCOL_V2.md in the Python SDK for full protocol documentation.