feat: Add Be and tbd skill, also added Roadmap file

This commit is contained in:
2026-05-10 16:32:12 -04:00
parent 3500ade13f
commit 0bb8885802
29587 changed files with 10611695 additions and 0 deletions

271
Skills/@be/node_modules/jibo-log/lib/dts/Log.d.ts generated vendored Normal file
View File

@@ -0,0 +1,271 @@
/// <reference types="node" />
import { ConsoleHandler, OutputHandler, SyslogHandler } from './output-handlers';
import { formatItem } from './utils';
import { Level, LoggingConfig, Output, OutputPerNamespace } from './types';
import LogOutputs from './LogOutputs';
import events = require('events');
/**
* Log class - centralized logging facility
* @class Log
* @param {string} [namespace=''] The namespace to log to
* @param {Log} [parent] The log parent (prepended to the namespace)
*/
declare class Log {
/**
* Current version of the library.
* @static
* @readonly
* @name Log.version
* @type {string}
*/
static readonly version: string;
/**
* The global logger, with empty namespace
* @static
* @readonly
* @name Log.global
* @type {string}
*/
static readonly global: Log;
/**
* Current version of the Jibo platform release.
* Can be overridden, for instance to be the version of a cloud skill
* instead of a robot
* @static
* @name Log.release
* @type {string}
*/
static release: string;
/**
* Name of the currently running process, sent to syslog in the ProcessName
* header; should be set by each process during its initialization
* @static
* @name Log.processName
* @type {string}
*/
static processName: string;
/**
* The top-level namespace, added to the front of the namespace in
* syslog and file output; should be set by each process during its
* initialization
* @static
* @name Log.topLevelNamespace
* @type {string}
*/
static topLevelNamespace: string;
/**
* The level of each output channel of the global logger
* @static
* @readonly
* @name Log.outputs
* @type {LogOutputs}
*/
static readonly outputs: LogOutputs;
private static _jiboLog;
private static _initialized;
private static _skipLocalConfig;
private static _staticNamespaceLevels;
private static _outputPerNamespace;
private static _outputHandlers;
private static _unhandledExceptionLogger;
private static _uncaughtMap;
private static _localConfigPath;
private static _globalErrorHandler;
private static _localConfig;
/**
* The namespace of this logger instance
* @readonly
* @name Log#namespace
* @type {string}
*/
readonly namespace: string;
/**
* The robot ID, defaulting to the hostname of the current machine
* It is useful to have this public, so a cloud process can set the
* robot ID based on the robot credentials provided upon connection
* @name Log#robotID
* @type {string}
*/
robotID: string;
/**
* For Pegasus logging, each cloud call from a robot includes this ID,
* so the entire transaction can be traced from robot, to Pegasus, and
* back to the robot
* @name Log#transID
* @type {string}
*/
transID: string;
private _outputPerNamespace;
/**
* Load the default logging configuration statically
* @static
* @method Log.initialize
* @return {Promise<void>}
*/
static initialize(): Promise<void>;
/**
* Add an output handler to jibo-log
* @method Log.addOutputHandler
* @param {string} name The name of the output channel
* @param {OutputHandler<Config extends Object>} handler The handler to add
*/
static addOutputHandler<Config extends Object>(name: string, handler: OutputHandler<Config>): void;
/**
* Set the logging configuration from input (e.g. parsed from JSON file)
* @static
* @method Log.loadConfig
* @param {LoggingConfig} loggingConfig The configuration to load
* @return {Promise<void>}
*/
static loadConfig(loggingConfig: LoggingConfig): Promise<void>;
/**
* Generate LoggingConfig for output (e.g. to stringify to JSON file)
* @static
* @method Log.getConfig
* @return {LoggingConfig}
*/
static getConfig(): LoggingConfig;
/**
* Save the current log configuration file to a local logging config file
* If process.env.JIBO_LOG_CONFIG: use that; else...
* On-robot: /var/jibo/t.logging.json
* Off-robot: ~/.jibo/t.logging.json
* @static
* @method Log.saveConfig
* @return {Promise<void>}
*/
static saveConfig(): Promise<void>;
/**
* Set up listener for log-level update notifications
* @static
* @method Log.handleLogLevelNotifications
* @param {events.EventEmitter} notificationsDispatcher Event emitter that emits 'LevelChanged' events
* @param {boolean} [save = false] Whether to save the configuration to disk or not
* @return {Promise<void>}
*/
static handleLogLevelNotifications(notificationsDispatcher: events.EventEmitter, save?: boolean): Promise<void>;
/**
* Flush all log lines that output channels may have cached in memory
* @static
* @method Log.flush
* @return {void}
*/
static flush(): void;
private static readonly _onRobot;
private static _loadConfig(loggingConfig);
private static _loadLocalConfig();
private static _loadLocalConfigOnRobot();
private static _loadLocalConfigOffRobot();
private static _parentNamespace(namespace);
/**
* Whether or not to log globally uncaught exceptions
* @static
* @name Log.logUncaughtExceptions
* @type {boolean}
*/
static logUncaughtExceptions: boolean;
/**
* Whether or not to log globally unhandled promise rejections
* @static
* @name Log.logUnhandledRejections
* @type {boolean}
*/
static logUnhandledRejections: boolean;
private static _levelGreaterOrEqual(levelOne, levelTwo);
constructor(namespace?: string, parent?: Log);
/**
* A reference to the top level logger instance with namespace ''
* @name Log#global
* @type {Log}
*/
readonly global: Log;
/**
* Configuration for the output of this logger
* @readonly
* @name Log#outputs
* @type {LogOutputs}
*/
readonly outputs: LogOutputs;
/**
* Creates a new Log instance with namespace `this.namespace + '/' +
* subNamespace`
* @method Log#createChild
* @param {string} subNamespace New namespace which will be appended to
* the parent namespace
* @return {Log}
*/
createChild(subNamespace: string): Log;
outputPerNamespace: OutputPerNamespace;
/**
* Set the minimum logging level for a given output for this namespace
* This is generally not invoked directly, but by LogOutputs by setting
* one of the properties of the outputs property of a log instance
* e.g. `log.outputs.console = 'debug';`
* @method Log#setLevelForOutput
* @param {Output} output The output for which to set the level
* @param {Level} level The level to which to set the output
* @return {void}
*/
setLevelForOutput(output: Output, level: Level): void;
/**
* Check minimum logging level for each output channel for this log's
* namespace, and log the message if this level is debug or lower
* @method Log#debug
* @param {any[]} ...args The arguments to log
* @return {Log} Instance of log for chaining
*/
debug(...args: any[]): Log;
/**
* Check minimum logging level for each output channel for this log's
* namespace, and log the message if this level is info or lower
* @method Log#info
* @param {any[]} ...args The arguments to log
* @return {Log} Instance of log for chaining
*/
info(...args: any[]): Log;
/**
* Check minimum logging level for each output channel for this log's
* namespace, and log the message if this level is warn or lower
* @method Log#warn
* @param {any[]} ...args The arguments to log
* @return {Log} Instance of log for chaining
*/
warn(...args: any[]): Log;
/**
* Check minimum logging level for each output channel for this log's
* namespace, and log the message if this level isn't none
* @method Log#error
* @param {any[]} ...args The arguments to log
* @return {Log} Instance of log for chaining
*/
error(...args: any[]): Log;
/**
* A synonym for Log#debug
* @method Log#log
* @param {any[]} ...args The arguments to log
* @return {Log} Instance of log for chaining
*/
log(...args: any[]): Log;
/**
* Log the error if it is set
* @method Log#iferr
* @param {Error|String} err The error which is checked and logged if
* truthy
* @param {any[]} [...args] Additional arguments to log along with err
* @return {Log} Instance of log for chaining
*/
iferr(err: any, ...args: any[]): Log;
/**
* Get the minimum logging level for the given output for this namespace.
* If a level isn't set for the namespace, it checks its parent namespace
* and so on until it finds one, or uses the global namespace.
* @method Log#getLevelForOutput
* @param {Output} output The output channel for which to get the level
*/
getLevelForOutput(output: Output): Level;
private _log(level, ...args);
static formatItem: typeof formatItem;
static ConsoleHandler: typeof ConsoleHandler;
static SyslogHandler: typeof SyslogHandler;
}
export default Log;

View File

@@ -0,0 +1,43 @@
import Log from './Log';
import { Level } from './types';
/**
* LogOutputs class - logging level for each output channel
* @class LogOutputs
* @param {Log} [_log] The log on which this is the outputs property
* @param {string} [_namespace?] Defaults to the log's namespace, but overridable
*/
declare class LogOutputs {
private _log;
constructor(_log: Log);
/**
* Set the logging level for all output channels at once
* @name LogOutputs#all
* @type {Level}
*/
all: Level | keyof typeof Level;
/**
* The logging level for the console output channel
* @name LogOutputs#console
* @type {Level}
*/
console: Level | keyof typeof Level;
/**
* The logging level for the file output channel
* @name LogOutputs#file
* @type {Level}
*/
file: Level | keyof typeof Level;
/**
* The logging level for the Pegasus output channel
* @name LogOutputs#pegasus
* @type {Level}
*/
pegasus: Level | keyof typeof Level;
/**
* The logging level for the syslog output channel
* @name LogOutputs#syslog
* @type {Level}
*/
syslog: Level | keyof typeof Level;
}
export default LogOutputs;

View File

@@ -0,0 +1,7 @@
declare class Singletons {
static enforce<T>(candidate: {
new (): T;
}): Function;
static enforce(candidate: Function): Function;
}
export default Singletons;

View File

@@ -0,0 +1,27 @@
import { Level } from './types';
declare const _default: {
staticNamespaceLevels: boolean;
logUncaughtExceptions: boolean;
logUnhandledRejections: boolean;
stackTraceLimit: number;
skipLocalConfig: boolean;
outputs: {
console: {
outputFileAndLine: boolean;
outputLevel: boolean;
};
syslog: {
port: number;
target: string;
outputFileAndLine: boolean;
};
};
namespaces: {
'': {
console: Level;
file: Level;
syslog: Level;
};
};
};
export default _default;

6
Skills/@be/node_modules/jibo-log/lib/dts/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,6 @@
import { ConsoleConfig, FileConfig, OutputHandler, SyslogConfig } from './output-handlers';
import { Level, LevelPerOutput, LoggingConfig, Output, OutputPerNamespace, OutputsConfig } from './types';
import LogImport from './Log';
import LogOutputs from './LogOutputs';
declare const Log: typeof LogImport;
export { ConsoleConfig, FileConfig, Level, LevelPerOutput, Log, LoggingConfig, LogOutputs, Output, OutputHandler, OutputPerNamespace, OutputsConfig, SyslogConfig };

View File

@@ -0,0 +1,38 @@
import { Level } from '../types';
import OutputHandler from './OutputHandler';
/**
* Console output configuration
* @interface ConsoleConfig
*/
export interface ConsoleConfig {
/**
* Whether or not to add the filename and line number to each line logged
* @name ConsoleConfig#outputFileAndLine
* @type {boolean}
*/
outputFileAndLine?: boolean;
/**
* Whether or not to add the logging level to each line logged
* @name ConsoleConfig#outputLevel
* @type {boolean}
*/
outputLevel?: boolean;
/**
* Whether or not to add the robot ID and pegasus transaction ID to each
* line logged
* @name ConsoleConfig#outputRobotAndTransIDs
* @type {boolean}
*/
outputRobotAndTransIDs?: boolean;
}
/**
* Output channel that logs to global.console or equivalent interface
* @class ConsoleHandler
* @extends OutputHandler
* @param {Console} [console = global.console] You may pass a alternative console
*/
export default class ConsoleHandler extends OutputHandler<ConsoleConfig> {
private _console;
constructor(_console?: Console);
write(timestamp: Date, robotID: string, transID: string, processName: string, release: string, namespace: string, level: Level, ...args: any[]): void;
}

View File

@@ -0,0 +1,64 @@
import { Level } from '../types';
import OutputHandler from './OutputHandler';
/**
* Filesystem output configuration
* @interface FileConfig
*/
export interface FileConfig {
/**
* The filename to write to write
* @name FileConfig#filename
* @type {string}
*/
filename: string;
/**
* The file size at which to rotate the log
* Accepts a positive integer followed by one of these possible letters:
* B: Bytes
* K: KiloBytes
* M: MegaBytes
* G: GigaBytes
* @name FileConfig#size
* @type {string}
*/
size?: string;
/**
* The time interval at which to rotate
* Accepts a positive integer followed by one of these possible letters:
* s: seconds. Accepts integer divider of 60.
* m: minutes. Accepts integer divider of 60.
* h: hours. Accepts integer divider of 24.
* d: days
* @name FileConfig#interval
* @type {string}
*/
interval?: string;
/**
* Whether or not to gzip compress logs after they are rotated
* @name FileConfig#compress
* @type {boolean}
*/
compress?: boolean;
/**
* Whether or not to add the filename and line number to each line logged
* @name FileConfig#outputFileAndLine
* @type {boolean}
*/
outputFileAndLine?: boolean;
}
/**
* Output channel that logs to the filesystem
* @class FileHandler
*/
export default class FileHandler extends OutputHandler<FileConfig> {
private _stream;
constructor();
write(time: Date, robotID: string, transID: string, processName: string, release: string, namespace: string, level: Level, ...args: any[]): void;
/**
* The filesystem output configuration for this handler
* @name FileHandler#config
* @type {FileConfig}
*/
config: FileConfig;
private _createStream();
}

View File

@@ -0,0 +1,34 @@
import { Level } from '../types';
/**
* OutputHandler class - logging to global.console
* @abstract
* @class ConsoleHandler
* @extends OutputHandler
*/
export default abstract class OutputHandler<Config extends Object> {
protected _config: Config;
/**
* Write to the target output channel
* @method OutputHandler#write
* @param {Date} timestamp The time that the log event occurred
* @param {string} robotID The friendly-name of the robot
* @param {string} transID The Jetstream transaction ID, if available
* @param {string} processName The name of the process doing the logging
* @param {string} release The full-stack release version of the robot
* @param {string} namespace The Log namespace
* @param {Level} level The level of logging
* @param {any[]} ...args The arguments to log
*/
abstract write(timestamp: Date, robotID: string, transID: string, processName: string, release: string, namespace: string, level: Level, ...args: any[]): void;
/**
* The output configuration for this handler
* @name OutputHandler#config
* @type {Config}
*/
config: Config;
/**
* Flush any log lines this handler caches; default to no behavior
* @return {Promise<void>} Resolves when the flush is complete
*/
flush(): Promise<void>;
}

View File

@@ -0,0 +1,46 @@
import { Level } from '../types';
import OutputHandler from './OutputHandler';
/**
* Syslog output configuration
* @interface SyslogConfig
*/
export interface SyslogConfig {
/**
* The port number on which to talk to syslog
* @name SyslogConfig#port
* @type {number}
*/
port?: number;
/**
* The target hostname or IP address on which to log
* @name SyslogConfig#target
* @type {string}
*/
target?: string;
/**
* Whether or not to add the filename and line number to each line logged
* @name SyslogConfig#outputFileAndLine
* @type {boolean}
*/
outputFileAndLine?: boolean;
}
/**
* Output channel that logs to syslog (/var/log/messages)
* Only enabled on linux/arm (e.g. Jibo robot)
* @class SyslogHandler
*/
export default class SyslogHandler extends OutputHandler<SyslogConfig> {
private _enabled;
private _client;
private static _toStructuredData(err);
private static _getStackFrames(err);
constructor();
write(date: Date, robotID: string, transID: string, processName: string, release: string, namespace: string, level: Level, ...args: any[]): Promise<void>;
/**
* The syslog output configuration for this handler
* @name SyslogHandler#config
* @type {SyslogConfig}
*/
config: SyslogConfig;
private _createClient();
}

View File

@@ -0,0 +1,9 @@
import ConsoleHandler, { ConsoleConfig } from './ConsoleHandler';
import FileHandler, { FileConfig } from './FileHandler';
import OutputHandler from './OutputHandler';
import SyslogHandler, { SyslogConfig } from './SyslogHandler';
export interface OutputHandlers {
[key: string]: OutputHandler<Object>;
}
export declare const outputHandlers: OutputHandlers;
export { ConsoleConfig, ConsoleHandler, FileConfig, FileHandler, OutputHandler, SyslogConfig, SyslogHandler };

View File

@@ -0,0 +1,13 @@
/**
* A level of logging output, debug/info/warn/error, or none
* @typedef Level
*/
declare enum Level {
none = "none",
debug = "debug",
info = "info",
warn = "warn",
error = "error",
}
export default Level;
export declare const levelOrder: Level[];

View File

@@ -0,0 +1,15 @@
import Level from './Level';
/**
* Map of output level for each output channel.
* OutputPerNamespace maps namespaces to these.
* @interface LevelPerOutput
*/
export default interface LevelPerOutput {
/**
* The output to map to the {Level}. Specify one of these for each output
* channel you'd like to configure.
* @name LevelPerOutput#output
* @type {Level}
*/
[output: string]: Level | keyof typeof Level;
}

View File

@@ -0,0 +1,51 @@
import OutputsConfig from './OutputsConfig';
import OutputPerNamespace from './OutputPerNamespace';
/**
* Logging configuration, top-level, for import from/export to JSON
* @interface LoggingConfig
*/
export default interface LoggingConfig {
/**
* Whether to store outputs per namespace static or per instance
* Set to true on robot, false for cloud skills
* @name LoggingConfig#staticNamespaceLevels
* @type {boolean}
*/
staticNamespaceLevels?: boolean;
/**
* Whether or not to log globally uncaught exceptions
* @name LoggingConfig#logUncaughtExceptions
* @type {boolean}
*/
logUncaughtExceptions?: boolean;
/**
* Whether or not to log globally unhandled promise rejections
* @name LoggingConfig#logUnhandledRejections
* @type {boolean}
*/
logUnhandledRejections?: boolean;
/**
* Depth of stack traces when logging errors
* @name LoggingConfig#stackTraceLimit
* @type {number}
*/
stackTraceLimit?: number;
/**
* Whether or not to skip loading local logging configuration (for tests)
* @name LoggingConfig#skipLocalConfig
* @type {boolean}
*/
skipLocalConfig?: boolean;
/**
* Configurations for each output channel
* @name LoggingConfig#outputs
* @type {OutputsConfig}
*/
outputs?: OutputsConfig;
/**
* Map of logging levels for each output channel for specified namespaces
* @name LoggingConfig#namespaces
* @type {OutputPerNamespace}
*/
namespaces?: OutputPerNamespace;
}

View File

@@ -0,0 +1,15 @@
/**
* A logging output channel, console/syslog/file
* @name Output
* @type enum
* @prop console 'console'
* @prop syslog 'syslog'
* @prop file 'file'
*/
declare enum Output {
console = "console",
file = "file",
pegasus = "pegasus",
syslog = "syslog",
}
export default Output;

View File

@@ -0,0 +1,15 @@
import LevelPerOutput from './LevelPerOutput';
/**
* Map of logging configurations for each namespace.
* The namespace configs are stored flat, e.g. 'parent' and 'parent/child'
* @interface OutputPerNamespace
*/
export default interface OutputPerNamespace {
/**
* The namespace to map to {LevelPerOutput}. Specify one of these for each
* namespace you'd like to configure.
* @name OutputPerNamespace#namespace
* @type {LevelPerOutput}
*/
[namespace: string]: LevelPerOutput;
}

View File

@@ -0,0 +1,32 @@
import { ConsoleConfig } from '../output-handlers/ConsoleHandler';
import { FileConfig } from '../output-handlers/FileHandler';
import { SyslogConfig } from '../output-handlers/SyslogHandler';
/**
* Configurations for each output channel
* @interface OutputsConfig
*/
interface OutputsConfig {
/**
* Console output channel confguration
* @name OutputsConfig.console
* @type {ConsoleConfig}
*/
console?: ConsoleConfig;
/**
* Filesystem output channel confguration
* @name OutputsConfig.file
* @type {FileConfig}
*/
file?: FileConfig;
/**
* Syslog output channel confguration
* @name OutputsConfig.syslog
* @type {SyslogConfig}
*/
syslog?: SyslogConfig;
/**
* Allow other arbitrary output handlers to be added
*/
[name: string]: Object;
}
export default OutputsConfig;

View File

@@ -0,0 +1,7 @@
import Level from './Level';
import LevelPerOutput from './LevelPerOutput';
import LoggingConfig from './LoggingConfig';
import Output from './Output';
import OutputPerNamespace from './OutputPerNamespace';
import OutputsConfig from './OutputsConfig';
export { Level, LevelPerOutput, LoggingConfig, Output, OutputPerNamespace, OutputsConfig };

View File

@@ -0,0 +1,6 @@
/// <reference types="node" />
import stream = require('stream');
export default class NullStream extends stream.Writable {
constructor(opts?: any);
_write(chunk: any, encoding: string, cb: Function): boolean;
}

View File

@@ -0,0 +1,39 @@
/**
* @fileOverview
*
* Created on 5/12/16.
* @author Siggi Orn <siggi@jibo.com>
*/
export interface Callback<T> {
(error?: any, data?: T): any;
}
export interface NonStandardCallback<T> {
(data?: T): any;
}
export declare class PromiseUtils {
/**
* Returns promise that succeeds when the first input promise succeeds
* If all input promises fail, then the returned promise fails.
* @param {Promise<T>[]} promises
* @returns {Promise<T>}
*/
static firstToSucceed<T>(promises: Promise<T>[]): Promise<T>;
/**
* A method that allows you to convert a 'callback' async function to
* a promise async function. The only requirement is that the callback
* signature must be of type (error: any, data?:any)
* @param {Function.<Callback>} func
* @returns {Promise<any>}
*/
static promisify<T>(func: (cb: Callback<T>) => any): Promise<T>;
/**
* A method that allows you to convert a 'callback' async function to
* a promise async function. The only requirement is that the callback
* signature must be of type (data?:any)
* @param {Function.<NonStandardCallback>} func
* @param {boolean} [firstParamError=true] Must be set to false if first argument in callback
* will not be an error message but the data itself
* @returns {Promise<any>}
*/
static promisify<T>(func: (cb: NonStandardCallback<T>) => any, firstParamError: boolean): Promise<T>;
}

View File

@@ -0,0 +1,7 @@
/**
* Format the passed item as a single-line string for logging (i.e. syslog)
* @function formatItem
* @param args {any[]} Item to format
* @return {string} Formatted line, ready for logging
*/
export declare function formatItem(item: any): string;

View File

@@ -0,0 +1,4 @@
export declare type PlatformVersion = {
version: string;
};
export default function getPlatformVersion(): PlatformVersion;

View File

@@ -0,0 +1,29 @@
export declare type ErrorHandler = (...args: any[]) => void;
/**
* Utility class to handle globally-uncaught exceptions and globally-unhandled
* promise rejections
* @class GlobalErrorHandler
* @param {string|Error} handleError Callback where errors are sent
*/
export declare class GlobalErrorHandler {
private _loggingUncaughtExceptions;
private _loggingUnhandledRejections;
private _handleError;
constructor(handleError: ErrorHandler);
private _uncaughtExceptionProcessLogger(error?);
private _uncaughtExceptionWindowLogger(message, filename?, lineno?, colno?, error?);
/**
* Whether or not to log globally uncaught exceptions
* @name GlobalErrorHandler.logUncaughtExceptions
* @type {boolean}
*/
logUncaughtExceptions: boolean;
private _unhandledRejectionProcessLogger(error?);
private _unhandledRejectionWindowLogger(event);
/**
* Whether or not to log globally unhandled promise rejections
* @name GlobalErrorHandler.logUnhandledRejections
* @type {boolean}
*/
logUnhandledRejections: boolean;
}

View File

@@ -0,0 +1,5 @@
import { formatItem } from './formatting';
import { GlobalErrorHandler } from './global-errors';
import NullStream from './NullStream';
import { PromiseUtils } from './PromiseUtils';
export { formatItem, GlobalErrorHandler, NullStream, PromiseUtils };