Skip to main content

Action System Reference

Components for parsing and handling action tags from AI responses.

EstuaryActionManager

Parses action tags from bot responses and dispatches events.

import { EstuaryActionManager, ParsedAction } from 'estuary-lens-studio-sdk';

Constructor

const manager = new EstuaryActionManager(character);

Methods

MethodParametersDescription
setTargetCharacter()characterSet character to monitor
registerAction()charId, name, desc?Register an action
registerActions()charId, names[]Register multiple actions
unregisterAction()charId, nameUnregister action
isActionRegistered()charId, nameCheck registration
getRegisteredActions()charIdGet registered actions
setActionEnabled()charId, name, enabledEnable/disable action
onAction()name, handlerSubscribe to action
onActions()names[], handlerSubscribe to multiple
onAnyAction()handlerSubscribe to all
startListening()-Start monitoring responses
stopListening()-Stop monitoring
clearHistory()-Clear action history
wasActionTriggered()name, withinMs?Check if triggered
getActionsByName()nameGet actions by name
dispose()-Clean up resources

Properties

PropertyTypeDescription
currentActionParsedAction | nullMost recent action
actionHistoryParsedAction[]All triggered actions
isListeningbooleanMonitoring status
debugLoggingbooleanDebug mode
onlyFinalResponsesbooleanParse only final responses
maxHistorySizenumberMax history entries
strictModebooleanOnly trigger registered

EstuaryActions

Global action event system for easy access from any script.

import { EstuaryActions, ParsedAction } from 'estuary-lens-studio-sdk';

Static Methods

MethodParametersReturnsDescription
on()actionName, handler() => voidSubscribe to action
onAny()handler() => voidSubscribe to all
wasTriggered()actionNamebooleanCheck if triggered
getManager()-EstuaryActionManagerGet manager instance

Static Properties

PropertyTypeDescription
currentActionParsedAction | nullMost recent action
actionHistoryParsedAction[]Action history

Usage Example

// Subscribe to specific action
const unsub = EstuaryActions.on("wave", (action) => {
print(`Wave at ${action.timestamp}`);
});

// Unsubscribe
unsub();

// Subscribe to all actions
EstuaryActions.onAny((action) => {
print(`Action: ${action.name}`);
});

ParsedAction

Represents a parsed action from bot response.

interface ParsedAction {
name: string; // Action name
tag: string; // Full tag text
messageId: string; // Source message ID
timestamp: number; // Detection time
}