initial commit

This commit is contained in:
2026-03-16 13:53:01 +02:00
parent 631dc7df36
commit 81e6e0a7a2
23381 changed files with 8224173 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
/**
* @callback jibo.bt.decorators.Case~CaseConditional
* @returns {boolean} Return `true` to succeed the decorated behavior. `false` otherwise.
*/
/**
* @class Case
* @extends jibo.bt.Decorator
* @memberof jibo.bt.decorators
* @description
* Performs a single check before the behavior it's decorating starts. If that check fails, `Case` fails the
* behavior. Useful for decorating behaviors under a {@link jibo.bt.behaviors.Switch|Switch} behavior.
* @param {Object} options See {@link jibo.bt.Decorator|Decorator} for all options.
* @param {jibo.bt.decorators.Case~CaseConditional} options.conditional Function called every frame.
* Return `false` when you want component to fail.
*/

View File

@@ -0,0 +1,18 @@
/**
* @callback jibo.bt.decorators.FailOnCondition~FailOnConditionConditional
* @extends jibo.bt.Behavior
* @returns {boolean} `true` when you want component to Fail.
*/
/**
* @class FailOnCondition
* @extends jibo.bt.Decorator
* @memberof jibo.bt.decorators
* @description Explicitly interrupts the behavior it's decorating and returns Status.FAILED if the
* conditional evaluates to `true`.
* @param {Object} options See {@link jibo.bt.Decorator|Decorator} for all options.
* @param {Function} [options.init] Function called at the start of this behavior. Used to initialize any
* variables or data.
* @param {jibo.bt.decorators.FailOnCondition~FailOnConditionConditional} options.conditional Function called every frame. Return `true`
* when you want component to fail.
*/

View File

@@ -0,0 +1,15 @@
/**
* @callback jibo.bt.decorators.StartOnAnimEvent~StartOnEventOnReceived
* @argument {AnimationInstance} instance The animation instance the event was dispatched from.
* @argument {Object} payload A payload defined in the `.keys` file.
*/
/**
* @class StartOnAnimEvent
* @extends jibo.bt.Decorator
* @memberof jibo.bt.decorators
* @description
* `StartOnAnimEvent` will begin the execution of its behavior when an animation fires an event from its event layer.
* @param {String} options.eventName - Name of the event this behavior listens for.
* @param {jibo.bt.decorators.StartOnAnimEvent~StartOnEventOnReceived} options.onReceived - Callback for when `eventName` is dispatched.
*/

View File

@@ -0,0 +1,17 @@
/**
* @callback jibo.bt.decorators.StartOnCondition~StartOnConditionConditional
* @returns {Boolean} `true` when you want component to start.
*/
/**
* @class StartOnCondition
* @extends jibo.bt.Decorator
* @memberof jibo.bt.decorators
* @description
* Prevents the behavior it's decorating from starting until its conditional evaluates to
* true.
* @param {Object} options See {@link jibo.bt.Decorator|Decorator} for all options.
* @param {Function} [options.init] Function called at the start of this behavior. Used to initialize any
* variables or data.
* @argument {jibo.bt.decorators.StartOnCondition~StartOnConditionConditional} options.conditional - The conditional to evaluate.
*/

View File

@@ -0,0 +1,11 @@
/**
* @class StartOnEvent
* @extends jibo.bt.Decorator
* @memberof jibo.bt.decorators
* @description
* Prevents the behavior it's decorating from starting until an event is emitter from a behavior tree's
* global `emitter`.
* @param {Object} options See {@link jibo.bt.Decorator|Decorator} for all options.
* @param {String} options.eventName - The name of the event to listen for.
* @param {Function} options.onEvent - called when the event is fired. Any payload with the event is passed in.
*/

View File

@@ -0,0 +1,18 @@
/**
* @callback jibo.bt.decorators.SucceedOnCondition~SucceedOnConditionConditional
* @returns {Boolean} `true` to succeed the decorated behavior. `false` otherwise.
*/
/**
* @class SucceedOnCondition
* @extends jibo.bt.Decorator
* @memberof jibo.bt.decorators
* @description
* Explicitly interrupts the behavior it's decorating and returns Status.SUCCEEDED if the
* conditional evaluates to `true`.
* @param {Object} options See {@link jibo.bt.Decorator|Decorator} for all options.
* @param {Function} [options.init] Function called at the start of this behavior. Used to initialize any
* variables or data.
* @param {jibo.bt.decorators.SucceedOnCondition~SucceedOnConditionConditional} options.conditional Function called every frame. Return `true`
* to force behavior to succeed.
*/

View File

@@ -0,0 +1,44 @@
/**
* @class EmbeddedListenEmitter
* @description Passed to the {@link jibo.bt.decorators.SucceedOnEmbedded~OnResult} function of the {@link jibo.bt.decorators.SucceedOnEmbedded|SucceedOnEmbedded} behavior.
* @extends EventEmitter
* @memberof jibo.bt
*/
/**
* @typedef {Object} jibo.bt.decorators.SucceedOnEmbedded~Options
*/
/**
* Called when the {@link jibo.bt.EmbeddedListenEmitter|EmbeddedListenEmitter} is constructed.
* @callback jibo.bt.decorators.SucceedOnEmbedded~OnResult
* @param {jibo.bt.EmbeddedListenEmitter} listener Use this instance to listen for listen events.
*/
/**
* @class SucceedOnEmbedded
* @extends jibo.bt.Decorator
* @memberof jibo.bt.decorators
* @description Succeeds the behavior its decorating when the specified audio phrase is spotted.
* @param {Object} options See {@link jibo.bt.Decorator|Decorator} for all options.
* @param {jibo.bt.decorators.SucceedOnEmbedded.Rules} options.rule The embedded rule to listen for.
* @param {jibo.bt.decorators.SucceedOnEmbedded~OnResult} options.onResult Called and passed a {@link jibo.bt.EmbeddedListenEmitter|EmbeddedListenEmitter} object. Events are
* fired from the emitter at certain points in this behavior's lifecycle.
*/
/**
* Embedded listen rule types.
* @name jibo.bt.decorators.SucceedOnEmbedded.Rules
* @property {String} HEY_jibo Listen for "Hey, Jibo"
* @static
* @enum {String}
*/
/** Listen for "Hey Jibo" */
/**
* Fired when the phrase is spotted.
* @event jibo.bt.EmbeddedListenEmitter#hey-jibo
* @param {Object} result Reference to the behavior's result.
* @param {Array} speakers Text independent speaker ID results.
*/

View File

@@ -0,0 +1,11 @@
/**
* @class SucceedOnEvent
* @extends jibo.bt.Decorator
* @memberof jibo.bt.decorators
* @description
* Succeeds the behavior it's decorating when an event is emitter from a behavior tree's
* global `emitter`.
* @param {Object} options See {@link jibo.bt.Decorator|Decorator} for all options.
* @param {String} options.eventName - The name of the event to listen for.
* @param {Function} options.onEvent - Called when the event is fired. Any payload with the event is passed in.
*/

View File

@@ -0,0 +1,31 @@
/**
* @typedef {Object} jibo.bt.decorators.SucceedOnListen~Options
* @property {boolean} heyJibo Listen for "Hey, Jibo" first.
* @property {boolean} detectEnd Listen for end of speech.
* @property {boolean} incremental Return incremental ASR results as they are streamed from the cloud.
* @property {String} authenticateSpeaker Authenticates against that person.
*/
/**
* Function that returns the options object.
* @callback jibo.bt.decorators.SucceedOnListen~GetOptions
* @returns {jibo.bt.decorators.SucceedOnListen~Options}
*/
/**
* Called when the {@link jibo.bt.behaviors.ListenEmitter|ListenEmitter} is constructed.
* @callback jibo.bt.decorators.SucceedOnListen~OnResult
* @param {jibo.bt.ListenEmitter} listener Use this instance to listen for listen events.
*/
/**
* @class SucceedOnListen
* @extends jibo.bt.Decorator
* @memberof jibo.bt.decorators
* @description Performs audio speech recognition and applies and parses the results according to a rules file.
* @param {Object} options See {@link jibo.bt.Decorator|Decorator} for all options.
* @param {jibo.bt.decorators.SucceedOnListen~GetOptions} options.getOptions Returns the options object.
* @param {String} options.rule Path the to `.rule` file. This assumes the path starts at `${project}/rules`.
* @param {jibo.bt.decorators.SucceedOnListen~OnResult} options.onResult Called and passed a {@link jibo.bt.behaviors.ListenEmitter|ListenEmitter} object. Events are fired from the Listener
* at certain points in this behavior's lifecycle.
*/

View File

@@ -0,0 +1,47 @@
/**
* @class ListenEmitter
* @description Used to listen for cloud events.
* @extends EventEmitter
* @memberof jibo.bt
*/
/**
* @typedef {Object} jibo.bt.decorators.SucceedOnListenJs~Options
* @property {boolean} heyJibo Listen for "Hey, Jibo" first.
* @property {boolean} detectEnd Listen for end of speech.
* @property {boolean} incremental Return incremental ASR results as they are streamed from the cloud.
* @property {String} authenticateSpeaker Authenticates against that person.
*/
/**
* Function that returns the options object.
* @callback jibo.bt.decorators.SucceedOnListenJs~GetOptions
* @returns {jibo.bt.decorators.SucceedOnListenJs~Options}
*/
/**
* Called when the {@link jibo.bt.behaviors.ListenEmitter|ListenEmitter} is constructed.
* @callback jibo.bt.decorators.SucceedOnListenJs~OnResult
* @param {jibo.bt.ListenEmitter} listener Use this instance to listen for listen events.
*/
/**
* @class SucceedOnListenJs
* @extends jibo.bt.Decorator
* @memberof jibo.bt.decorators
* @description Performs audio speech recognition and applies and parses the results according to a rules file.
* @param {Object} options See {@link jibo.bt.Decorator|Decorator} for all options.
* @param {jibo.bt.decorators.SucceedOnListenJs~GetOptions} options.getOptions Returns the options object.
* @param {Function} options.getRule This function returns a string representation of a rule. Use this decorator to dynamically generate rules files instead
* of loading a rule file from disk.
* @param {jibo.bt.decorators.SucceedOnListenJs~OnResult} options.onResult Called and passed a {@link jibo.bt.behaviors.ListenEmitter|ListenEmitter} object. Events are fired from the Listener
* at certain points in this behavior's lifecycle.
*/
/**
* Definition of the reusable dialog listen behavior class
*/
/**
* Only gets called when stopped from Behavior tree
*/

View File

@@ -0,0 +1,8 @@
/**
* @class TimeoutFail
* @extends jibo.bt.Decorator
* @memberof jibo.bt.decorators
* @description Forces the behavior it's decorating to fail after the specified amount of time.
* @param {Object} options See {@link jibo.bt.Decorator|Decorator} for all options.
* @param {number} options.timeout - Time in milliseconds until `TimeoutFail` forces the behavior it's decorarting to fail.
*/

View File

@@ -0,0 +1,9 @@
/**
* @class TimeoutSucceed
* @extends jibo.bt.Decorator
* @memberof jibo.bt.decorators
* @description
* Forces the behavior it's decorating to succeed after the specified amount of time.
* @param {Object} options See {@link jibo.bt.Decorator|Decorator} for all options.
* @param {number} options.timeout - Time in milliseconds until `TimeoutSucceed` forces the behavior it's decorating to succeed.
*/

View File

@@ -0,0 +1,14 @@
/**
* @callback jibo.bt.decorators.TimeoutSucceedJs~GetTime
* @returns {number} Time in milliseconds.
*/
/**
* @class TimeoutSucceedJs
* @extends jibo.bt.Decorator
* @memberof jibo.bt.decorators
* @description
* `TimeoutSucceedJs` forces the behavior it's decorating to succeed after the specified amount of time.
* @param {Object} options See {@link jibo.bt.Decorator|Decorator} for all options.
* @param {jibo.bt.decorators.TimeoutSucceedJs~GetTime} options.getTime - Time in milliseconds until `TimeoutJs` forces the behavior it's decorating to succeed.
*/

View File

@@ -0,0 +1,17 @@
/**
* @callback jibo.bt.decorators.WhileCondition~Conditional
* @returns {boolean} `true` when you want component to restart.
*/
/**
* @class WhileCondition
* @extends jibo.bt.Decorator
* @memberof jibo.bt.decorators
* @description When `WhileCondition`'s component succeeds, `WhileCondition`
* will evaluate its conditional. If it evaluates to `true`, `WhileCondition` will
* start its component again. If the conditional evaluates to `false`, `WhileCondition`
* returns the status of its component.
* @param {Object} options See {@link jibo.bt.Decorator|Decorator} for all options.
* @param {Function} [options.init] - Initialization function.
* @param {jibo.bt.decorators.WhileCondition~Conditional} options.conditional - The conditional to evaluate.
*/

View File

@@ -0,0 +1,4 @@
/**
* Behavior Tree decorator classes.
* @namespace jibo.bt.decorators
*/