AIDK API Reference / aidk/jsx / ModelOptionsComponent
Class: ModelOptionsComponent ​
Defined in: packages/core/src/jsx/components/model.tsx:169
ModelOptions component for configuring how content is transformed for model input.
Sets message transformation configuration, role mapping, and other model options that affect how ephemeral content (grounding) and event messages are formatted.
Example ​
<ModelOptions
messageTransformation={{
roleMapping: {
event: 'user',
ephemeral: 'user',
},
delimiters: {
event: '[Event]',
ephemeral: '[Context]',
useDelimiters: true,
},
}}
/>Extends ​
Constructors ​
Constructor ​
new ModelOptionsComponent(props: ModelOptionsProps): ModelOptionsComponent;Defined in: packages/core/src/component/component.ts:331
Parameters ​
| Parameter | Type |
|---|---|
props | ModelOptionsProps |
Returns ​
ModelOptionsComponent
Inherited from ​
Properties ​
| Property | Modifier | Type | Default value | Inherited from | Defined in |
|---|---|---|---|---|---|
hooks | static | Record<string, ComponentHookMiddleware<any>[]> | {} | Component.hooks | packages/core/src/component/component.ts:319 |
props | public | ModelOptionsProps | undefined | Component.props | packages/core/src/component/component.ts:328 |
state | public | { } | undefined | Component.state | packages/core/src/component/component.ts:329 |
tags | static | string[] | [] | Component.tags | packages/core/src/component/component.ts:320 |
Accessors ​
hooks ​
Get Signature ​
get hooks(): ComponentHookRegistry;Defined in: packages/core/src/component/component.ts:324
Returns ​
Inherited from ​
Methods ​
getState() ​
getState<T>(key: never): T;Defined in: packages/core/src/component/component.ts:370
Legacy state management - use signals instead for better reactivity.
Type Parameters ​
| Type Parameter | Default type |
|---|---|
T | unknown |
Parameters ​
| Parameter | Type |
|---|---|
key | never |
Returns ​
T
Deprecated ​
Consider using signals for component state
Inherited from ​
onAfterCompile() ​
onAfterCompile(
_com: ContextObjectModel,
_compiled: CompiledStructure,
_state: TickState,
_ctx: AfterCompileContext): void;Defined in: packages/core/src/component/component.ts:389
Called after each compilation pass, before the final render is applied. Use this to inspect the compiled structure and potentially request re-compilation if state changes are needed (e.g., context summarization, tool adjustments).
The compilation loop continues until no component calls com.requestRecompile() or the maximum iteration limit is reached.
Parameters ​
| Parameter | Type |
|---|---|
_com | ContextObjectModel |
_compiled | CompiledStructure |
_state | TickState |
_ctx | AfterCompileContext |
Returns ​
void
Inherited from ​
onComplete() ​
onComplete(_com: ContextObjectModel, _finalState: COMInput): void;Defined in: packages/core/src/component/component.ts:396
Called after the entire execution completes (all ticks finished). At this point, the final COMInput is available. Use this for final state processing, persistence, reporting, side effects, etc. Called before onUnmount.
Note: This is for side effects only, not rendering. Rendering should happen in render(). Model outputs are automatically included in the final COM state.
Parameters ​
| Parameter | Type |
|---|---|
_com | ContextObjectModel |
_finalState | COMInput |
Returns ​
void
Inherited from ​
onError() ​
onError(_com: ContextObjectModel, _state: TickState): void | RecoveryAction;Defined in: packages/core/src/component/component.ts:397
Called when an error occurs during engine execution. Components can use this to handle errors and potentially recover.
Parameters ​
| Parameter | Type |
|---|---|
_com | ContextObjectModel |
_state | TickState |
Returns ​
void | RecoveryAction
RecoveryAction to indicate whether to continue execution, or void/undefined to let error propagate
Inherited from ​
onMessage() ​
onMessage(
_com: ContextObjectModel,
_message: ExecutionMessage,
_state: TickState): void | Promise<void>;Defined in: packages/core/src/component/component.ts:402
Called immediately when a message is sent to the running execution.
Messages can arrive via:
- CompileSession.sendMessage() - Direct programmatic injection
- ExecutionHandle.send() - Via handle reference
- Channel events with type='message' - From client
This hook is called immediately when the message arrives, not at tick boundaries. Use com.abort() to interrupt execution if needed, or update state for the next tick. Messages are also available in TickState.queuedMessages during render.
Parameters ​
| Parameter | Type |
|---|---|
_com | ContextObjectModel |
_message | ExecutionMessage |
_state | TickState |
Returns ​
void | Promise<void>
Example ​
class InteractiveAgent extends Component {
onMessage(com, message, state) {
if (message.type === 'stop') {
com.abort('User requested stop');
} else if (message.type === 'feedback') {
com.setState('userFeedback', message.content);
}
}
}Inherited from ​
onMount() ​
onMount(_com: ContextObjectModel): void;Defined in: packages/core/src/component/component.ts:378
Called when the component is mounted to the engine. Use this to register static resources like tools.
Parameters ​
| Parameter | Type |
|---|---|
_com | ContextObjectModel |
Returns ​
void
Inherited from ​
onStart() ​
onStart(_com: ContextObjectModel): void;Defined in: packages/core/src/component/component.ts:387
Called once before the first tick, after the COM is created. Use this for initialization that needs to happen before execution starts.
Parameters ​
| Parameter | Type |
|---|---|
_com | ContextObjectModel |
Returns ​
void
Inherited from ​
onTickEnd() ​
onTickEnd(_com: ContextObjectModel, _state: TickState): void;Defined in: packages/core/src/component/component.ts:395
Called after model execution completes for this tick. At this point, current is available (contains model outputs from this tick). Use this for per-tick processing, validation, or side effects. Note: Model outputs are automatically included in the next tick's previous.
Parameters ​
| Parameter | Type |
|---|---|
_com | ContextObjectModel |
_state | TickState |
Returns ​
void
Inherited from ​
onTickStart() ​
onTickStart(_com: ContextObjectModel, _state: TickState): void;Defined in: packages/core/src/component/component.ts:388
Parameters ​
| Parameter | Type |
|---|---|
_com | ContextObjectModel |
_state | TickState |
Returns ​
void
Inherited from ​
onUnmount() ​
onUnmount(_com: ContextObjectModel): void;Defined in: packages/core/src/component/component.ts:383
Called when the component is unmounted from the engine.
Parameters ​
| Parameter | Type |
|---|---|
_com | ContextObjectModel |
Returns ​
void
Inherited from ​
render() ​
render(com: ContextObjectModel): Element | null;Defined in: packages/core/src/jsx/components/model.tsx:170
Declaratively render context for the current tick. Components should interact with the COM to compose the context. OR return a Virtual DOM tree (JSX.Element) to be rendered by the Engine.
Parameters ​
| Parameter | Type |
|---|---|
com | ContextObjectModel |
Returns ​
Element | null
Overrides ​
setState() ​
setState(partial: Partial<S>): void;Defined in: packages/core/src/component/component.ts:362
Legacy state management - use signals instead for better reactivity.
Parameters ​
| Parameter | Type |
|---|---|
partial | Partial<S> |
Returns ​
void
Deprecated ​
Consider using signals for component state