core
Classes
AgentError
Defined in: packages/nexus-agents/src/core/errors.ts:184
Agent error for agent execution failures.
Extends
Extended by
Constructors
Constructor
new AgentError(message, options?): AgentError;
Defined in: packages/nexus-agents/src/core/errors.ts:185
Parameters
message
string
options?
Partial<Omit<NexusErrorOptions, "code">>
Returns
Overrides
Properties
cause
readonly cause: Error | undefined;
Defined in: packages/nexus-agents/src/core/errors.ts:105
Inherited from
code
readonly code: ErrorCode;
Defined in: packages/nexus-agents/src/core/errors.ts:103
Inherited from
context
readonly context: Record<string, unknown> | undefined;
Defined in: packages/nexus-agents/src/core/errors.ts:104
Inherited from
message
message: string;
Defined in: node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075
Inherited from
name
name: string;
Defined in: node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074
Inherited from
stack?
optional stack?: string;
Defined in: node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076
Inherited from
stackTraceLimit
static stackTraceLimit: number;
Defined in: node_modules/.pnpm/@types+node@25.9.8/node_modules/@types/node/globals.d.ts:67
The Error.stackTraceLimit property specifies the number of stack frames
collected by a stack trace (whether generated by new Error().stack or
Error.captureStackTrace(obj)).
The default value is 10 but may be set to any valid JavaScript number. Changes
will affect any stack trace captured after the value has been changed.
If set to a non-number value, or set to a negative number, stack traces will not capture any frames.
Inherited from
Methods
toJSON()
toJSON(): SerializedError;
Defined in: packages/nexus-agents/src/core/errors.ts:121
Serializes the error to a JSON-safe object.
Returns
Inherited from
captureStackTrace()
static captureStackTrace(targetObject, constructorOpt?): void;
Defined in: node_modules/.pnpm/@types+node@25.9.8/node_modules/@types/node/globals.d.ts:51
Creates a .stack property on targetObject, which when accessed returns
a string representing the location in the code at which
Error.captureStackTrace() was called.
const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack; // Similar to `new Error().stack`
The first line of the trace will be prefixed with
${myObject.name}: ${myObject.message}.
The optional constructorOpt argument accepts a function. If given, all frames
above constructorOpt, including constructorOpt, will be omitted from the
generated stack trace.
The constructorOpt argument is useful for hiding implementation
details of error generation from the user. For instance:
function a() {
b();
}
function b() {
c();
}
function c() {
// Create an error without stack trace to avoid calculating the stack trace twice.
const { stackTraceLimit } = Error;
Error.stackTraceLimit = 0;
const error = new Error();
Error.stackTraceLimit = stackTraceLimit;
// Capture the stack trace above function b
Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
throw error;
}
a();
Parameters
targetObject
object
constructorOpt?
Function
Returns
void
Inherited from
prepareStackTrace()
static prepareStackTrace(err, stackTraces): any;
Defined in: node_modules/.pnpm/@types+node@25.9.8/node_modules/@types/node/globals.d.ts:55
Parameters
err
Error
stackTraces
CallSite[]
Returns
any
See
https://v8.dev/docs/stack-trace-api#customizing-stack-traces
Inherited from
ConfigError
Defined in: packages/nexus-agents/src/core/errors.ts:153
Configuration error for missing or invalid configuration.
Extends
Extended by
Constructors
Constructor
new ConfigError(message, options?): ConfigError;
Defined in: packages/nexus-agents/src/core/errors.ts:154
Parameters
message
string
options?
Partial<Omit<NexusErrorOptions, "code">>
Returns
Overrides
Properties
cause
readonly cause: Error | undefined;
Defined in: packages/nexus-agents/src/core/errors.ts:105
Inherited from
code
readonly code: ErrorCode;
Defined in: packages/nexus-agents/src/core/errors.ts:103
Inherited from
context
readonly context: Record<string, unknown> | undefined;
Defined in: packages/nexus-agents/src/core/errors.ts:104
Inherited from
message
message: string;
Defined in: node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075
Inherited from
name
name: string;
Defined in: node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074
Inherited from
stack?
optional stack?: string;
Defined in: node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076
Inherited from
stackTraceLimit
static stackTraceLimit: number;
Defined in: node_modules/.pnpm/@types+node@25.9.8/node_modules/@types/node/globals.d.ts:67
The Error.stackTraceLimit property specifies the number of stack frames
collected by a stack trace (whether generated by new Error().stack or
Error.captureStackTrace(obj)).
The default value is 10 but may be set to any valid JavaScript number. Changes
will affect any stack trace captured after the value has been changed.
If set to a non-number value, or set to a negative number, stack traces will not capture any frames.
Inherited from
Methods
toJSON()
toJSON(): SerializedError;
Defined in: packages/nexus-agents/src/core/errors.ts:121
Serializes the error to a JSON-safe object.
Returns
Inherited from
captureStackTrace()
static captureStackTrace(targetObject, constructorOpt?): void;
Defined in: node_modules/.pnpm/@types+node@25.9.8/node_modules/@types/node/globals.d.ts:51
Creates a .stack property on targetObject, which when accessed returns
a string representing the location in the code at which
Error.captureStackTrace() was called.
const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack; // Similar to `new Error().stack`
The first line of the trace will be prefixed with
${myObject.name}: ${myObject.message}.
The optional constructorOpt argument accepts a function. If given, all frames
above constructorOpt, including constructorOpt, will be omitted from the
generated stack trace.
The constructorOpt argument is useful for hiding implementation
details of error generation from the user. For instance:
function a() {
b();
}
function b() {
c();
}
function c() {
// Create an error without stack trace to avoid calculating the stack trace twice.
const { stackTraceLimit } = Error;
Error.stackTraceLimit = 0;
const error = new Error();
Error.stackTraceLimit = stackTraceLimit;
// Capture the stack trace above function b
Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
throw error;
}
a();
Parameters
targetObject
object
constructorOpt?
Function
Returns
void
Inherited from
prepareStackTrace()
static prepareStackTrace(err, stackTraces): any;
Defined in: node_modules/.pnpm/@types+node@25.9.8/node_modules/@types/node/globals.d.ts:55
Parameters
err
Error
stackTraces
CallSite[]
Returns
any
See
https://v8.dev/docs/stack-trace-api#customizing-stack-traces
Inherited from
ModelError
Defined in: packages/nexus-agents/src/core/errors.ts:166
Model error for model adapter failures.
Subclasses (e.g., AdapterModelError) can pass a specific ErrorCode to categorize failures more granularly (rate-limited, timeout, etc.).
Extends
Extended by
Constructors
Constructor
new ModelError(message, options?): ModelError;
Defined in: packages/nexus-agents/src/core/errors.ts:167
Parameters
message
string
options?
Partial<NexusErrorOptions>
Returns
Overrides
Properties
cause
readonly cause: Error | undefined;
Defined in: packages/nexus-agents/src/core/errors.ts:105
Inherited from
code
readonly code: ErrorCode;
Defined in: packages/nexus-agents/src/core/errors.ts:103
Inherited from
context
readonly context: Record<string, unknown> | undefined;
Defined in: packages/nexus-agents/src/core/errors.ts:104
Inherited from
message
message: string;
Defined in: node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075
Inherited from
name
name: string;
Defined in: node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074
Inherited from
stack?
optional stack?: string;
Defined in: node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076
Inherited from
stackTraceLimit
static stackTraceLimit: number;
Defined in: node_modules/.pnpm/@types+node@25.9.8/node_modules/@types/node/globals.d.ts:67
The Error.stackTraceLimit property specifies the number of stack frames
collected by a stack trace (whether generated by new Error().stack or
Error.captureStackTrace(obj)).
The default value is 10 but may be set to any valid JavaScript number. Changes
will affect any stack trace captured after the value has been changed.
If set to a non-number value, or set to a negative number, stack traces will not capture any frames.
Inherited from
Methods
toJSON()
toJSON(): SerializedError;
Defined in: packages/nexus-agents/src/core/errors.ts:121
Serializes the error to a JSON-safe object.
Returns
Inherited from
captureStackTrace()
static captureStackTrace(targetObject, constructorOpt?): void;
Defined in: node_modules/.pnpm/@types+node@25.9.8/node_modules/@types/node/globals.d.ts:51
Creates a .stack property on targetObject, which when accessed returns
a string representing the location in the code at which
Error.captureStackTrace() was called.
const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack; // Similar to `new Error().stack`
The first line of the trace will be prefixed with
${myObject.name}: ${myObject.message}.
The optional constructorOpt argument accepts a function. If given, all frames
above constructorOpt, including constructorOpt, will be omitted from the
generated stack trace.
The constructorOpt argument is useful for hiding implementation
details of error generation from the user. For instance:
function a() {
b();
}
function b() {
c();
}
function c() {
// Create an error without stack trace to avoid calculating the stack trace twice.
const { stackTraceLimit } = Error;
Error.stackTraceLimit = 0;
const error = new Error();
Error.stackTraceLimit = stackTraceLimit;
// Capture the stack trace above function b
Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
throw error;
}
a();
Parameters
targetObject
object
constructorOpt?
Function
Returns
void
Inherited from
prepareStackTrace()
static prepareStackTrace(err, stackTraces): any;
Defined in: node_modules/.pnpm/@types+node@25.9.8/node_modules/@types/node/globals.d.ts:55
Parameters
err
Error
stackTraces
CallSite[]
Returns
any
See
https://v8.dev/docs/stack-trace-api#customizing-stack-traces
Inherited from
NexusError
Defined in: packages/nexus-agents/src/core/errors.ts:102
Base error class for all Nexus Agents errors.
Extends
Error
Extended by
ValidationErrorConfigErrorModelErrorAgentErrorWorkflowErrorSecurityErrorTimeoutErrorRateLimitErrorRetryExhaustedErrorStreamErrorStreamCancelledErrorSelectionErrorTokenCountErrorOutcomeStorageErrorMemoryError
Constructors
Constructor
new NexusError(message, options): NexusError;
Defined in: packages/nexus-agents/src/core/errors.ts:107
Parameters
message
string
options
Returns
Overrides
Error.constructor
Properties
cause
readonly cause: Error | undefined;
Defined in: packages/nexus-agents/src/core/errors.ts:105
Overrides
Error.cause
code
readonly code: ErrorCode;
Defined in: packages/nexus-agents/src/core/errors.ts:103
context
readonly context: Record<string, unknown> | undefined;
Defined in: packages/nexus-agents/src/core/errors.ts:104
message
message: string;
Defined in: node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075
Inherited from
Error.message
name
name: string;
Defined in: node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074
Inherited from
Error.name
stack?
optional stack?: string;
Defined in: node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076
Inherited from
Error.stack
stackTraceLimit
static stackTraceLimit: number;
Defined in: node_modules/.pnpm/@types+node@25.9.8/node_modules/@types/node/globals.d.ts:67
The Error.stackTraceLimit property specifies the number of stack frames
collected by a stack trace (whether generated by new Error().stack or
Error.captureStackTrace(obj)).
The default value is 10 but may be set to any valid JavaScript number. Changes
will affect any stack trace captured after the value has been changed.
If set to a non-number value, or set to a negative number, stack traces will not capture any frames.
Inherited from
Error.stackTraceLimit
Methods
toJSON()
toJSON(): SerializedError;
Defined in: packages/nexus-agents/src/core/errors.ts:121
Serializes the error to a JSON-safe object.
Returns
captureStackTrace()
static captureStackTrace(targetObject, constructorOpt?): void;
Defined in: node_modules/.pnpm/@types+node@25.9.8/node_modules/@types/node/globals.d.ts:51
Creates a .stack property on targetObject, which when accessed returns
a string representing the location in the code at which
Error.captureStackTrace() was called.
const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack; // Similar to `new Error().stack`
The first line of the trace will be prefixed with
${myObject.name}: ${myObject.message}.
The optional constructorOpt argument accepts a function. If given, all frames
above constructorOpt, including constructorOpt, will be omitted from the
generated stack trace.
The constructorOpt argument is useful for hiding implementation
details of error generation from the user. For instance:
function a() {
b();
}
function b() {
c();
}
function c() {
// Create an error without stack trace to avoid calculating the stack trace twice.
const { stackTraceLimit } = Error;
Error.stackTraceLimit = 0;
const error = new Error();
Error.stackTraceLimit = stackTraceLimit;
// Capture the stack trace above function b
Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
throw error;
}
a();
Parameters
targetObject
object
constructorOpt?
Function
Returns
void
Inherited from
Error.captureStackTrace
prepareStackTrace()
static prepareStackTrace(err, stackTraces): any;
Defined in: node_modules/.pnpm/@types+node@25.9.8/node_modules/@types/node/globals.d.ts:55
Parameters
err
Error
stackTraces
CallSite[]
Returns
any
See
https://v8.dev/docs/stack-trace-api#customizing-stack-traces
Inherited from
Error.prepareStackTrace
ParseError
Defined in: packages/nexus-agents/src/core/types/workflow.ts:194
Parse error for workflow templates.
Extends
Error
Constructors
Constructor
new ParseError(message, options?): ParseError;
Defined in: packages/nexus-agents/src/core/types/workflow.ts:198
Parameters
message
string
options?
column?
number
line?
number
Returns
Overrides
Error.constructor
Properties
cause?
optional cause?: unknown;
Defined in: node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24
Inherited from
Error.cause
column
readonly column: number | undefined;
Defined in: packages/nexus-agents/src/core/types/workflow.ts:196
line
readonly line: number | undefined;
Defined in: packages/nexus-agents/src/core/types/workflow.ts:195
message
message: string;
Defined in: node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075
Inherited from
Error.message
name
name: string;
Defined in: node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074
Inherited from
Error.name
stack?
optional stack?: string;
Defined in: node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076
Inherited from
Error.stack
stackTraceLimit
static stackTraceLimit: number;
Defined in: node_modules/.pnpm/@types+node@25.9.8/node_modules/@types/node/globals.d.ts:67
The Error.stackTraceLimit property specifies the number of stack frames
collected by a stack trace (whether generated by new Error().stack or
Error.captureStackTrace(obj)).
The default value is 10 but may be set to any valid JavaScript number. Changes
will affect any stack trace captured after the value has been changed.
If set to a non-number value, or set to a negative number, stack traces will not capture any frames.
Inherited from
Error.stackTraceLimit
Methods
captureStackTrace()
static captureStackTrace(targetObject, constructorOpt?): void;
Defined in: node_modules/.pnpm/@types+node@25.9.8/node_modules/@types/node/globals.d.ts:51
Creates a .stack property on targetObject, which when accessed returns
a string representing the location in the code at which
Error.captureStackTrace() was called.
const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack; // Similar to `new Error().stack`
The first line of the trace will be prefixed with
${myObject.name}: ${myObject.message}.
The optional constructorOpt argument accepts a function. If given, all frames
above constructorOpt, including constructorOpt, will be omitted from the
generated stack trace.
The constructorOpt argument is useful for hiding implementation
details of error generation from the user. For instance:
function a() {
b();
}
function b() {
c();
}
function c() {
// Create an error without stack trace to avoid calculating the stack trace twice.
const { stackTraceLimit } = Error;
Error.stackTraceLimit = 0;
const error = new Error();
Error.stackTraceLimit = stackTraceLimit;
// Capture the stack trace above function b
Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
throw error;
}
a();
Parameters
targetObject
object
constructorOpt?
Function
Returns
void
Inherited from
Error.captureStackTrace
prepareStackTrace()
static prepareStackTrace(err, stackTraces): any;
Defined in: node_modules/.pnpm/@types+node@25.9.8/node_modules/@types/node/globals.d.ts:55
Parameters
err
Error
stackTraces
CallSite[]
Returns
any
See
https://v8.dev/docs/stack-trace-api#customizing-stack-traces
Inherited from
Error.prepareStackTrace
RateLimitError
Defined in: packages/nexus-agents/src/core/errors.ts:375
Rate limit error with actionable backoff context. (Source: Issue #996 — Rate limit error surfacing)
Extends
Constructors
Constructor
new RateLimitError(message, options?): RateLimitError;
Defined in: packages/nexus-agents/src/core/errors.ts:380
Parameters
message
string
options?
RateLimitErrorOptions
Returns
Overrides
Properties
cause
readonly cause: Error | undefined;
Defined in: packages/nexus-agents/src/core/errors.ts:105
Inherited from
code
readonly code: ErrorCode;
Defined in: packages/nexus-agents/src/core/errors.ts:103
Inherited from
context
readonly context: Record<string, unknown> | undefined;
Defined in: packages/nexus-agents/src/core/errors.ts:104
Inherited from
message
message: string;
Defined in: node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075
Inherited from
name
name: string;
Defined in: node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074
Inherited from
provider
readonly provider: string | undefined;
Defined in: packages/nexus-agents/src/core/errors.ts:378
retryAfterMs
readonly retryAfterMs: number | undefined;
Defined in: packages/nexus-agents/src/core/errors.ts:376
stack?
optional stack?: string;
Defined in: node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076
Inherited from
windowResetAt
readonly windowResetAt: string | undefined;
Defined in: packages/nexus-agents/src/core/errors.ts:377
stackTraceLimit
static stackTraceLimit: number;
Defined in: node_modules/.pnpm/@types+node@25.9.8/node_modules/@types/node/globals.d.ts:67
The Error.stackTraceLimit property specifies the number of stack frames
collected by a stack trace (whether generated by new Error().stack or
Error.captureStackTrace(obj)).
The default value is 10 but may be set to any valid JavaScript number. Changes
will affect any stack trace captured after the value has been changed.
If set to a non-number value, or set to a negative number, stack traces will not capture any frames.
Inherited from
Methods
toJSON()
toJSON(): SerializedError;
Defined in: packages/nexus-agents/src/core/errors.ts:121
Serializes the error to a JSON-safe object.
Returns
Inherited from
captureStackTrace()
static captureStackTrace(targetObject, constructorOpt?): void;
Defined in: node_modules/.pnpm/@types+node@25.9.8/node_modules/@types/node/globals.d.ts:51
Creates a .stack property on targetObject, which when accessed returns
a string representing the location in the code at which
Error.captureStackTrace() was called.
const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack; // Similar to `new Error().stack`
The first line of the trace will be prefixed with
${myObject.name}: ${myObject.message}.
The optional constructorOpt argument accepts a function. If given, all frames
above constructorOpt, including constructorOpt, will be omitted from the
generated stack trace.
The constructorOpt argument is useful for hiding implementation
details of error generation from the user. For instance:
function a() {
b();
}
function b() {
c();
}
function c() {
// Create an error without stack trace to avoid calculating the stack trace twice.
const { stackTraceLimit } = Error;
Error.stackTraceLimit = 0;
const error = new Error();
Error.stackTraceLimit = stackTraceLimit;
// Capture the stack trace above function b
Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
throw error;
}
a();
Parameters
targetObject
object
constructorOpt?
Function
Returns
void
Inherited from
prepareStackTrace()
static prepareStackTrace(err, stackTraces): any;
Defined in: node_modules/.pnpm/@types+node@25.9.8/node_modules/@types/node/globals.d.ts:55
Parameters
err
Error
stackTraces
CallSite[]
Returns
any
See
https://v8.dev/docs/stack-trace-api#customizing-stack-traces
Inherited from
SecurityError
Defined in: packages/nexus-agents/src/core/errors.ts:341
Security error for security violations.
Extends
Extended by
Constructors
Constructor
new SecurityError(message, options?): SecurityError;
Defined in: packages/nexus-agents/src/core/errors.ts:342
Parameters
message
string
options?
Partial<Omit<NexusErrorOptions, "code">>
Returns
Overrides
Properties
cause
readonly cause: Error | undefined;
Defined in: packages/nexus-agents/src/core/errors.ts:105
Inherited from
code
readonly code: ErrorCode;
Defined in: packages/nexus-agents/src/core/errors.ts:103
Inherited from
context
readonly context: Record<string, unknown> | undefined;
Defined in: packages/nexus-agents/src/core/errors.ts:104
Inherited from
message
message: string;
Defined in: node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075
Inherited from
name
name: string;
Defined in: node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074
Inherited from
stack?
optional stack?: string;
Defined in: node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076
Inherited from
stackTraceLimit
static stackTraceLimit: number;
Defined in: node_modules/.pnpm/@types+node@25.9.8/node_modules/@types/node/globals.d.ts:67
The Error.stackTraceLimit property specifies the number of stack frames
collected by a stack trace (whether generated by new Error().stack or
Error.captureStackTrace(obj)).
The default value is 10 but may be set to any valid JavaScript number. Changes
will affect any stack trace captured after the value has been changed.
If set to a non-number value, or set to a negative number, stack traces will not capture any frames.
Inherited from
Methods
toJSON()
toJSON(): SerializedError;
Defined in: packages/nexus-agents/src/core/errors.ts:121
Serializes the error to a JSON-safe object.
Returns
Inherited from
captureStackTrace()
static captureStackTrace(targetObject, constructorOpt?): void;
Defined in: node_modules/.pnpm/@types+node@25.9.8/node_modules/@types/node/globals.d.ts:51
Creates a .stack property on targetObject, which when accessed returns
a string representing the location in the code at which
Error.captureStackTrace() was called.
const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack; // Similar to `new Error().stack`
The first line of the trace will be prefixed with
${myObject.name}: ${myObject.message}.
The optional constructorOpt argument accepts a function. If given, all frames
above constructorOpt, including constructorOpt, will be omitted from the
generated stack trace.
The constructorOpt argument is useful for hiding implementation
details of error generation from the user. For instance:
function a() {
b();
}
function b() {
c();
}
function c() {
// Create an error without stack trace to avoid calculating the stack trace twice.
const { stackTraceLimit } = Error;
Error.stackTraceLimit = 0;
const error = new Error();
Error.stackTraceLimit = stackTraceLimit;
// Capture the stack trace above function b
Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
throw error;
}
a();
Parameters
targetObject
object
constructorOpt?
Function
Returns
void
Inherited from
prepareStackTrace()
static prepareStackTrace(err, stackTraces): any;
Defined in: node_modules/.pnpm/@types+node@25.9.8/node_modules/@types/node/globals.d.ts:55
Parameters
err
Error
stackTraces
CallSite[]
Returns
any
See
https://v8.dev/docs/stack-trace-api#customizing-stack-traces
Inherited from
TimeoutError
Defined in: packages/nexus-agents/src/core/errors.ts:351
Timeout error for operation timeouts.
Extends
Constructors
Constructor
new TimeoutError(message, options?): TimeoutError;
Defined in: packages/nexus-agents/src/core/errors.ts:352
Parameters
message
string
options?
Partial<Omit<NexusErrorOptions, "code">>
Returns
Overrides
Properties
cause
readonly cause: Error | undefined;
Defined in: packages/nexus-agents/src/core/errors.ts:105
Inherited from
code
readonly code: ErrorCode;
Defined in: packages/nexus-agents/src/core/errors.ts:103
Inherited from
context
readonly context: Record<string, unknown> | undefined;
Defined in: packages/nexus-agents/src/core/errors.ts:104
Inherited from
message
message: string;
Defined in: node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075
Inherited from
name
name: string;
Defined in: node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074
Inherited from
stack?
optional stack?: string;
Defined in: node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076
Inherited from
stackTraceLimit
static stackTraceLimit: number;
Defined in: node_modules/.pnpm/@types+node@25.9.8/node_modules/@types/node/globals.d.ts:67
The Error.stackTraceLimit property specifies the number of stack frames
collected by a stack trace (whether generated by new Error().stack or
Error.captureStackTrace(obj)).
The default value is 10 but may be set to any valid JavaScript number. Changes
will affect any stack trace captured after the value has been changed.
If set to a non-number value, or set to a negative number, stack traces will not capture any frames.
Inherited from
Methods
toJSON()
toJSON(): SerializedError;
Defined in: packages/nexus-agents/src/core/errors.ts:121
Serializes the error to a JSON-safe object.
Returns
Inherited from
captureStackTrace()
static captureStackTrace(targetObject, constructorOpt?): void;
Defined in: node_modules/.pnpm/@types+node@25.9.8/node_modules/@types/node/globals.d.ts:51
Creates a .stack property on targetObject, which when accessed returns
a string representing the location in the code at which
Error.captureStackTrace() was called.
const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack; // Similar to `new Error().stack`
The first line of the trace will be prefixed with
${myObject.name}: ${myObject.message}.
The optional constructorOpt argument accepts a function. If given, all frames
above constructorOpt, including constructorOpt, will be omitted from the
generated stack trace.
The constructorOpt argument is useful for hiding implementation
details of error generation from the user. For instance:
function a() {
b();
}
function b() {
c();
}
function c() {
// Create an error without stack trace to avoid calculating the stack trace twice.
const { stackTraceLimit } = Error;
Error.stackTraceLimit = 0;
const error = new Error();
Error.stackTraceLimit = stackTraceLimit;
// Capture the stack trace above function b
Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
throw error;
}
a();
Parameters
targetObject
object
constructorOpt?
Function
Returns
void
Inherited from
prepareStackTrace()
static prepareStackTrace(err, stackTraces): any;
Defined in: node_modules/.pnpm/@types+node@25.9.8/node_modules/@types/node/globals.d.ts:55
Parameters
err
Error
stackTraces
CallSite[]
Returns
any
See
https://v8.dev/docs/stack-trace-api#customizing-stack-traces
Inherited from
ValidationError
Defined in: packages/nexus-agents/src/core/errors.ts:143
Validation error for invalid inputs or schema violations.
Extends
Constructors
Constructor
new ValidationError(message, options?): ValidationError;
Defined in: packages/nexus-agents/src/core/errors.ts:144
Parameters
message
string
options?
Partial<Omit<NexusErrorOptions, "code">>
Returns
Overrides
Properties
cause
readonly cause: Error | undefined;
Defined in: packages/nexus-agents/src/core/errors.ts:105
Inherited from
code
readonly code: ErrorCode;
Defined in: packages/nexus-agents/src/core/errors.ts:103
Inherited from
context
readonly context: Record<string, unknown> | undefined;
Defined in: packages/nexus-agents/src/core/errors.ts:104
Inherited from
message
message: string;
Defined in: node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075
Inherited from
name
name: string;
Defined in: node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074
Inherited from
stack?
optional stack?: string;
Defined in: node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076
Inherited from
stackTraceLimit
static stackTraceLimit: number;
Defined in: node_modules/.pnpm/@types+node@25.9.8/node_modules/@types/node/globals.d.ts:67
The Error.stackTraceLimit property specifies the number of stack frames
collected by a stack trace (whether generated by new Error().stack or
Error.captureStackTrace(obj)).
The default value is 10 but may be set to any valid JavaScript number. Changes
will affect any stack trace captured after the value has been changed.
If set to a non-number value, or set to a negative number, stack traces will not capture any frames.
Inherited from
Methods
toJSON()
toJSON(): SerializedError;
Defined in: packages/nexus-agents/src/core/errors.ts:121
Serializes the error to a JSON-safe object.
Returns
Inherited from
captureStackTrace()
static captureStackTrace(targetObject, constructorOpt?): void;
Defined in: node_modules/.pnpm/@types+node@25.9.8/node_modules/@types/node/globals.d.ts:51
Creates a .stack property on targetObject, which when accessed returns
a string representing the location in the code at which
Error.captureStackTrace() was called.
const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack; // Similar to `new Error().stack`
The first line of the trace will be prefixed with
${myObject.name}: ${myObject.message}.
The optional constructorOpt argument accepts a function. If given, all frames
above constructorOpt, including constructorOpt, will be omitted from the
generated stack trace.
The constructorOpt argument is useful for hiding implementation
details of error generation from the user. For instance:
function a() {
b();
}
function b() {
c();
}
function c() {
// Create an error without stack trace to avoid calculating the stack trace twice.
const { stackTraceLimit } = Error;
Error.stackTraceLimit = 0;
const error = new Error();
Error.stackTraceLimit = stackTraceLimit;
// Capture the stack trace above function b
Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
throw error;
}
a();
Parameters
targetObject
object
constructorOpt?
Function
Returns
void
Inherited from
prepareStackTrace()
static prepareStackTrace(err, stackTraces): any;
Defined in: node_modules/.pnpm/@types+node@25.9.8/node_modules/@types/node/globals.d.ts:55
Parameters
err
Error
stackTraces
CallSite[]
Returns
any
See
https://v8.dev/docs/stack-trace-api#customizing-stack-traces
Inherited from
WorkflowError
Defined in: packages/nexus-agents/src/core/errors.ts:331
Workflow error for workflow parsing or execution failures.
Extends
Constructors
Constructor
new WorkflowError(message, options?): WorkflowError;
Defined in: packages/nexus-agents/src/core/errors.ts:332
Parameters
message
string
options?
Partial<Omit<NexusErrorOptions, "code">>
Returns
Overrides
Properties
cause
readonly cause: Error | undefined;
Defined in: packages/nexus-agents/src/core/errors.ts:105
Inherited from
code
readonly code: ErrorCode;
Defined in: packages/nexus-agents/src/core/errors.ts:103
Inherited from
context
readonly context: Record<string, unknown> | undefined;
Defined in: packages/nexus-agents/src/core/errors.ts:104
Inherited from
message
message: string;
Defined in: node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075
Inherited from
name
name: string;
Defined in: node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074
Inherited from
stack?
optional stack?: string;
Defined in: node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076
Inherited from
stackTraceLimit
static stackTraceLimit: number;
Defined in: node_modules/.pnpm/@types+node@25.9.8/node_modules/@types/node/globals.d.ts:67
The Error.stackTraceLimit property specifies the number of stack frames
collected by a stack trace (whether generated by new Error().stack or
Error.captureStackTrace(obj)).
The default value is 10 but may be set to any valid JavaScript number. Changes
will affect any stack trace captured after the value has been changed.
If set to a non-number value, or set to a negative number, stack traces will not capture any frames.
Inherited from
Methods
toJSON()
toJSON(): SerializedError;
Defined in: packages/nexus-agents/src/core/errors.ts:121
Serializes the error to a JSON-safe object.
Returns
Inherited from
captureStackTrace()
static captureStackTrace(targetObject, constructorOpt?): void;
Defined in: node_modules/.pnpm/@types+node@25.9.8/node_modules/@types/node/globals.d.ts:51
Creates a .stack property on targetObject, which when accessed returns
a string representing the location in the code at which
Error.captureStackTrace() was called.
const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack; // Similar to `new Error().stack`
The first line of the trace will be prefixed with
${myObject.name}: ${myObject.message}.
The optional constructorOpt argument accepts a function. If given, all frames
above constructorOpt, including constructorOpt, will be omitted from the
generated stack trace.
The constructorOpt argument is useful for hiding implementation
details of error generation from the user. For instance:
function a() {
b();
}
function b() {
c();
}
function c() {
// Create an error without stack trace to avoid calculating the stack trace twice.
const { stackTraceLimit } = Error;
Error.stackTraceLimit = 0;
const error = new Error();
Error.stackTraceLimit = stackTraceLimit;
// Capture the stack trace above function b
Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
throw error;
}
a();
Parameters
targetObject
object
constructorOpt?
Function
Returns
void
Inherited from
prepareStackTrace()
static prepareStackTrace(err, stackTraces): any;
Defined in: node_modules/.pnpm/@types+node@25.9.8/node_modules/@types/node/globals.d.ts:55
Parameters
err
Error
stackTraces
CallSite[]
Returns
any
See
https://v8.dev/docs/stack-trace-api#customizing-stack-traces
Inherited from
Interfaces
AgentMessage
Defined in: packages/nexus-agents/src/core/types/agent.ts:174
Message between agents.
Properties
from
from: string;
Defined in: packages/nexus-agents/src/core/types/agent.ts:178
Sender agent ID
id
id: string;
Defined in: packages/nexus-agents/src/core/types/agent.ts:176
Unique message identifier
payload
payload: unknown;
Defined in: packages/nexus-agents/src/core/types/agent.ts:184
Message payload
timestamp
timestamp: string;
Defined in: packages/nexus-agents/src/core/types/agent.ts:186
Timestamp
to
to: string;
Defined in: packages/nexus-agents/src/core/types/agent.ts:180
Recipient agent ID
type
type: AgentMessageType;
Defined in: packages/nexus-agents/src/core/types/agent.ts:182
Message type
AgentResponse
Defined in: packages/nexus-agents/src/core/types/agent.ts:192
Response to an agent message.
Properties
data?
optional data?: unknown;
Defined in: packages/nexus-agents/src/core/types/agent.ts:198
Response data
error?
optional error?: string;
Defined in: packages/nexus-agents/src/core/types/agent.ts:200
Error message if failed
messageId
messageId: string;
Defined in: packages/nexus-agents/src/core/types/agent.ts:194
Original message ID
status
status: "failed" | "rejected" | "completed" | "accepted";
Defined in: packages/nexus-agents/src/core/types/agent.ts:196
Response status
CompletionRequest
Defined in: packages/nexus-agents/src/core/types/model.ts:98
Request to complete a conversation.
Properties
accessMode?
optional accessMode?: ExecutionAccessMode;
Defined in: packages/nexus-agents/src/core/types/model.ts:121
Host access the call may use (#6754). Absent means 'default'. See
ExecutionAccessMode.
maxTokens?
optional maxTokens?: number;
Defined in: packages/nexus-agents/src/core/types/model.ts:106
Maximum tokens to generate
messages
messages: Message[];
Defined in: packages/nexus-agents/src/core/types/model.ts:100
Conversation messages
model?
optional model?: string;
Defined in: packages/nexus-agents/src/core/types/model.ts:127
Model the caller wants to answer (#6599): a registry id, a CLI alias or a CLI-native id. CLI adapters forward it to the CLI, which resolves it or returns an error; SDK adapters bound to a single model ignore it.
responseFormat?
optional responseFormat?: ResponseFormat;
Defined in: packages/nexus-agents/src/core/types/model.ts:137
Expected response format.
Remarks
Only supported by OpenAI and Ollama adapters. Claude and Gemini adapters will ignore this field. See ResponseFormat for details.
signal?
optional signal?: AbortSignal;
Defined in: packages/nexus-agents/src/core/types/model.ts:155
Cancellation signal (#3036). When the signal aborts, the adapter cancels the in-flight model call. All five concrete adapters (claude, openai, ollama, gemini, openai-compat) honor this by passing the signal to their respective vendor SDK.
Used by withWatchdog to cancel race-loser model calls when the
worker-dispatch timeout wins. Without this, the SDK keeps running
after Promise.race resolves with the timeout — late results land
in OutcomeStore for a decision already discarded.
Typed as AbortSignal | undefined (not AbortSignal?) so adapter
internals that destructure request keep working under
exactOptionalPropertyTypes.
stop?
optional stop?: string[];
Defined in: packages/nexus-agents/src/core/types/model.ts:139
Stop sequences
systemPrompt?
optional systemPrompt?: string;
Defined in: packages/nexus-agents/src/core/types/model.ts:102
System prompt (if not included in messages)
temperature?
optional temperature?: number;
Defined in: packages/nexus-agents/src/core/types/model.ts:104
Sampling temperature (0.0 - 1.0)
timeoutMs?
optional timeoutMs?: number;
Defined in: packages/nexus-agents/src/core/types/model.ts:114
Per-request timeout override in milliseconds. When set, adapters that support it use this instead of their construction-time default — lets a long-running caller (e.g. a consensus vote with a 300s budget) prevent the adapter’s shorter standard timeout from firing first (#3304). Adapters that don’t support per-request timeouts ignore it.
tools?
optional tools?: ToolDefinition[];
Defined in: packages/nexus-agents/src/core/types/model.ts:129
Tools available for the model
workDir?
optional workDir?: string;
Defined in: packages/nexus-agents/src/core/types/model.ts:116
Working directory for CLI adapters; API adapters ignore this field.
CompletionResponse
Defined in: packages/nexus-agents/src/core/types/model.ts:201
Response from a completion request.
Properties
cliStderr?
optional cliStderr?: string;
Defined in: packages/nexus-agents/src/core/types/model.ts:226
Stderr the CLI transport captured while serving this completion, when the adapter is a CLI bridge and the pipe was non-empty (#6094). A sandboxed shell failure inside the CLI’s own tool loop lands here while the model still returns a parsed answer; the voter classifier reads it as the structured “could not read the artifact” signal. Absent for API adapters and for a clean run — never an empty string.
content
content: ContentBlock[];
Defined in: packages/nexus-agents/src/core/types/model.ts:203
Response content blocks
fallbackFrom?
optional fallbackFrom?: string;
Defined in: packages/nexus-agents/src/core/types/model.ts:234
The model the caller asked for, when a CLI bridge answered with a different one from the same family (#6120): the claude adapter substitutes the next registry alias after an out-of-credits envelope. Present only on a substituted response, so the voter path can disclose which model actually voted (#6115). Absent means the requested model answered.
model
model: string;
Defined in: packages/nexus-agents/src/core/types/model.ts:217
Model that generated the response
stopReason
stopReason: StopReason;
Defined in: packages/nexus-agents/src/core/types/model.ts:215
Reason generation stopped
usage?
optional usage?: TokenUsage;
Defined in: packages/nexus-agents/src/core/types/model.ts:213
Token usage statistics, when the vendor reported them.
OPTIONAL on purpose (#4439). Producers used to synthesise 0/0/0 from an
absent vendor report, which is indistinguishable downstream from a real
zero-token call — that fabrication silently defeated the measured-voter
gate (#4436) on every live path. Absence must stay absent; consumers that
need a number should treat undefined as “unknown”, never as zero.
warnings?
optional warnings?: readonly {
param: string;
reason: string;
severity: "behavioral" | "cosmetic";
}[];
Defined in: packages/nexus-agents/src/core/types/model.ts:244
Request params the adapter dropped before sending (#4069, epic #4066 layer 3).
Present (and non-empty) only when a param was silently unsupported — e.g. a
post-Opus-4.6 Claude or OpenAI reasoning model that rejects temperature. The
request still ran (at the provider default); this surfaces what was omitted so
the caller can SEE a behavioral param had no effect. Absent when nothing was
dropped. Typed via the adapter-layer DroppedParam shape, re-declared
structurally here to avoid a core→adapters import cycle.
IAgent
Defined in: packages/nexus-agents/src/core/types/agent.ts:232
Base interface for all agents.
Properties
capabilities
readonly capabilities: readonly AgentCapability[];
Defined in: packages/nexus-agents/src/core/types/agent.ts:243
Agent capabilities
id
readonly id: string;
Defined in: packages/nexus-agents/src/core/types/agent.ts:234
Unique agent identifier
role
readonly role: AgentRole;
Defined in: packages/nexus-agents/src/core/types/agent.ts:237
Agent role
state
readonly state: AgentState;
Defined in: packages/nexus-agents/src/core/types/agent.ts:240
Current state
Methods
cleanup()
cleanup(): Promise<void>;
Defined in: packages/nexus-agents/src/core/types/agent.ts:288
Cleanup agent resources.
Returns
Promise<void>
execute()
execute(task, options?): Promise<Result<TaskResult, AgentError>>;
Defined in: packages/nexus-agents/src/core/types/agent.ts:254
Execute a task.
Parameters
task
Task to execute
options?
Optional execution options (#3016/#3040).
signal cancels the in-flight model call when the caller’s deadline
wins a race; without it, the SDK keeps running to its own 10-minute
timeout after the caller has already discarded the result.
signal?
AbortSignal
Returns
Promise<Result<TaskResult, AgentError>>
Result with TaskResult or AgentError
handleMessage()
handleMessage(msg): Promise<Result<AgentResponse, AgentError>>;
Defined in: packages/nexus-agents/src/core/types/agent.ts:276
Handle an inter-agent message and return a response.
Delivery semantics (#3222). This is a direct, awaited request/response
call: the caller invokes it and holds the returned promise. It is NOT a
queued or broadcast channel — that is the collaboration event bus
(agents/collaboration/event-bus.ts), a fire-and-forget pub/sub with its
own semantics. For this method specifically:
- Ordering is the caller’s responsibility. Sequential
awaits are handled in call order; concurrent calls carry no cross-message ordering guarantee. - Delivery is exactly the method invocation — there is no automatic
retry or redelivery. A returned
err(...)is the caller’s signal to decide whether to retry; the agent does not re-queue the message. - Errors surface as
Result.err, not as a throw for expected conditions; the caller branches on theResult.
Parameters
msg
Message to handle
Returns
Promise<Result<AgentResponse, AgentError>>
Result with AgentResponse, or AgentError on failure (not retried)
initialize()
initialize(ctx): Promise<Result<void, AgentError>>;
Defined in: packages/nexus-agents/src/core/types/agent.ts:283
Initialize the agent with context.
Parameters
ctx
AgentContext
Agent context
Returns
Promise<Result<void, AgentError>>
Result with void or AgentError
ILogger
Defined in: packages/nexus-agents/src/core/logger.ts:39
Logger interface
Properties
setDestination?
optional setDestination?: (destination, filePath?) => void;
Defined in: packages/nexus-agents/src/core/logger.ts:49
Set output destination (stdout, stderr, or file) - optional for backward compatibility
Parameters
destination
LogDestination
filePath?
string
Returns
void
setFormat?
optional setFormat?: (format) => void;
Defined in: packages/nexus-agents/src/core/logger.ts:47
Set output format (json or pretty) - optional for backward compatibility
Parameters
format
LogFormat
Returns
void
Methods
child()
child(context): ILogger;
Defined in: packages/nexus-agents/src/core/logger.ts:44
Parameters
context
Returns
debug()
debug(message, context?): void;
Defined in: packages/nexus-agents/src/core/logger.ts:40
Parameters
message
string
context?
Returns
void
error()
error(
message,
error?,
context?
): void;
Defined in: packages/nexus-agents/src/core/logger.ts:43
Parameters
message
string
error?
Error
context?
Returns
void
info()
info(message, context?): void;
Defined in: packages/nexus-agents/src/core/logger.ts:41
Parameters
message
string
context?
Returns
void
setLevel()
setLevel(level): void;
Defined in: packages/nexus-agents/src/core/logger.ts:45
Parameters
level
Returns
void
warn()
warn(message, context?): void;
Defined in: packages/nexus-agents/src/core/logger.ts:42
Parameters
message
string
context?
Returns
void
IModelAdapter
Defined in: packages/nexus-agents/src/core/types/model.ts:265
Unified interface for all model adapters.
Properties
capabilities
readonly capabilities: readonly ModelCapability[];
Defined in: packages/nexus-agents/src/core/types/model.ts:273
Capabilities this model supports
modelId
readonly modelId: string;
Defined in: packages/nexus-agents/src/core/types/model.ts:270
Model identifier (e.g., ‘claude-sonnet-4’, ‘gpt-4o’)
providerId
readonly providerId: string;
Defined in: packages/nexus-agents/src/core/types/model.ts:267
Provider identifier (e.g., ‘anthropic’, ‘openai’)
Methods
complete()
complete(request): Promise<Result<CompletionResponse, ModelError>>;
Defined in: packages/nexus-agents/src/core/types/model.ts:280
Send a completion request.
Parameters
request
The completion request
Returns
Promise<Result<CompletionResponse, ModelError>>
Result with response or ModelError
countTokens()
countTokens(text): Promise<number>;
Defined in: packages/nexus-agents/src/core/types/model.ts:294
Count tokens in text.
Parameters
text
string
Text to count tokens for
Returns
Promise<number>
Approximate token count
listModels()?
optional listModels(): Promise<readonly ModelMetadata[]>;
Defined in: packages/nexus-agents/src/core/types/model.ts:319
(Optional, #2529) List models served by this adapter’s endpoint.
Implemented by adapters facing OpenAI-compatible endpoints (the
upstream OpenAI API, OpenRouter, vLLM, custom gateways, etc.) —
usually wraps GET /v1/models. Result is the harness-side identity
resolver’s most-trusted signal for “what model is actually being
served behind this adapter.”
Subprocess-CLI adapters (claude / codex / gemini / opencode) leave
this undefined; identity for those falls back to modelId parse.
Implementations should cache the result for ~5 minutes — operators shouldn’t pay round-trip latency on every resolve. Failures (network error, endpoint unsupported, auth missing) should throw so the caller can fall back; do NOT silently return an empty list.
Returns
Promise<readonly ModelMetadata[]>
stream()
stream(request): AsyncIterable<StreamChunk>;
Defined in: packages/nexus-agents/src/core/types/model.ts:287
Stream a completion request.
Parameters
request
The completion request
Returns
AsyncIterable<StreamChunk>
Yields
StreamChunk objects as they arrive
validateConfig()
validateConfig(): Result<void, ConfigError>;
Defined in: packages/nexus-agents/src/core/types/model.ts:300
Validate adapter configuration.
Returns
Result<void, ConfigError>
Ok if valid, ConfigError if invalid
InputDefinition
Defined in: packages/nexus-agents/src/core/types/workflow.ts:33
Workflow input definition.
Properties
default?
optional default?: unknown;
Defined in: packages/nexus-agents/src/core/types/workflow.ts:43
Default value
description?
optional description?: string;
Defined in: packages/nexus-agents/src/core/types/workflow.ts:39
Description
name
name: string;
Defined in: packages/nexus-agents/src/core/types/workflow.ts:35
Input name
required?
optional required?: boolean;
Defined in: packages/nexus-agents/src/core/types/workflow.ts:41
Whether required
type
type: "string" | "number" | "boolean" | "object" | "array";
Defined in: packages/nexus-agents/src/core/types/workflow.ts:37
Input type
IWorkflowEngine
Defined in: packages/nexus-agents/src/core/types/workflow.ts:209
Workflow engine interface.
Methods
cancel()
cancel(executionId): Promise<Result<void, WorkflowError>>;
Defined in: packages/nexus-agents/src/core/types/workflow.ts:259
Cancel a running workflow.
Parameters
executionId
string
Execution ID to cancel
Returns
Promise<Result<void, WorkflowError>>
Result with void or WorkflowError
execute()
execute(
workflow,
inputs,
options?
): Promise<Result<WorkflowResult, WorkflowError>>;
Defined in: packages/nexus-agents/src/core/types/workflow.ts:236
Execute a workflow with inputs.
Parameters
workflow
Workflow definition
inputs
Record<string, unknown>
Input values
options?
Optional execution overrides. phaseTimeoutMs (#3017)
overrides the per-phase execution timeout for this run only — wins
over both workflow.timeout (set in the template YAML) and the
engine’s defaultTimeoutMs. onPhaseComplete (#6162) is called after
each phase settles — the async-job liveness heartbeat for run_workflow.
budget (#4754) caps the run’s total reported token spend: it is checked
before each phase and before each step is dispatched. Steps already in
flight when the ceiling is crossed run to completion — a cap stops new
spend, it cannot recall spend already committed. signal (#6305)
cancels the run: a step not yet dispatched is skipped and the run fails
with Workflow cancelled at the next phase boundary; a step already
running is not interrupted. run_workflow threads cancel_job’s signal
here.
budget?
{
maxTokens: number;
}
budget.maxTokens
number
onPhaseComplete?
() => void
phaseTimeoutMs?
number
signal?
AbortSignal
Returns
Promise<Result<WorkflowResult, WorkflowError>>
Result with WorkflowResult or WorkflowError
getStatus()
getStatus(executionId): ExecutionStatus;
Defined in: packages/nexus-agents/src/core/types/workflow.ts:252
Get execution status.
Parameters
executionId
string
Execution ID to check
Returns
ExecutionStatus
Current execution status
getTemplateByName()
getTemplateByName(name): Promise<WorkflowDefinition | undefined>;
Defined in: packages/nexus-agents/src/core/types/workflow.ts:272
Get a built-in or registered template definition by name.
Parameters
name
string
Template name (e.g., ‘code-review’)
Returns
Promise<WorkflowDefinition | undefined>
The workflow definition, or undefined if not found
listTemplates()
listTemplates(): Promise<WorkflowTemplate[]>;
Defined in: packages/nexus-agents/src/core/types/workflow.ts:265
List available workflow templates.
Returns
Promise<WorkflowTemplate[]>
Array of available templates
loadTemplate()
loadTemplate(path): Promise<Result<WorkflowDefinition, ParseError>>;
Defined in: packages/nexus-agents/src/core/types/workflow.ts:215
Load workflow template from file.
Parameters
path
string
Path to template file
Returns
Promise<Result<WorkflowDefinition, ParseError>>
Result with WorkflowDefinition or ParseError
LogContext
Defined in: packages/nexus-agents/src/core/logger.ts:21
Log context/metadata
Extended by
Indexable
[key: string]: unknown
LogEntry
Defined in: packages/nexus-agents/src/core/logger.ts:26
Structured log entry
Properties
context?
optional context?: LogContext;
Defined in: packages/nexus-agents/src/core/logger.ts:30
error?
optional error?: {
message: string;
name: string;
stack?: string;
};
Defined in: packages/nexus-agents/src/core/logger.ts:31
message
message: string;
name
name: string;
stack?
optional stack?: string;
level
level: LogLevel;
Defined in: packages/nexus-agents/src/core/logger.ts:28
message
message: string;
Defined in: packages/nexus-agents/src/core/logger.ts:29
timestamp
timestamp: string;
Defined in: packages/nexus-agents/src/core/logger.ts:27
Message
Defined in: packages/nexus-agents/src/core/types/model.ts:40
Message in a conversation.
Properties
content
content: string | ContentBlock[];
Defined in: packages/nexus-agents/src/core/types/model.ts:42
role
role: MessageRole;
Defined in: packages/nexus-agents/src/core/types/model.ts:41
NexusErrorOptions
Defined in: packages/nexus-agents/src/core/errors.ts:93
Options for creating a NexusError.
Properties
cause?
optional cause?: Error;
Defined in: packages/nexus-agents/src/core/errors.ts:95
code
code: ErrorCode;
Defined in: packages/nexus-agents/src/core/errors.ts:94
context?
optional context?: Record<string, unknown>;
Defined in: packages/nexus-agents/src/core/errors.ts:96
SerializedError
Defined in: packages/nexus-agents/src/core/errors.ts:81
Serialized error format for JSON output.
Properties
cause?
optional cause?: SerializedError;
Defined in: packages/nexus-agents/src/core/errors.ts:86
code
code: ErrorCode;
Defined in: packages/nexus-agents/src/core/errors.ts:83
context?
optional context?: Record<string, unknown>;
Defined in: packages/nexus-agents/src/core/errors.ts:85
message
message: string;
Defined in: packages/nexus-agents/src/core/errors.ts:84
name
name: string;
Defined in: packages/nexus-agents/src/core/errors.ts:82
stack?
optional stack?: string;
Defined in: packages/nexus-agents/src/core/errors.ts:87
StepResult
Defined in: packages/nexus-agents/src/core/types/workflow.ts:95
Result of step execution.
Properties
durationMs
durationMs: number;
Defined in: packages/nexus-agents/src/core/types/workflow.ts:101
Duration in ms
error?
optional error?: string;
Defined in: packages/nexus-agents/src/core/types/workflow.ts:105
Error message if failed
output
output: unknown;
Defined in: packages/nexus-agents/src/core/types/workflow.ts:99
Step output
status
status: "success" | "failed" | "skipped";
Defined in: packages/nexus-agents/src/core/types/workflow.ts:103
Status
stepId
stepId: string;
Defined in: packages/nexus-agents/src/core/types/workflow.ts:97
Step ID
tokensUsed?
optional tokensUsed?: number;
Defined in: packages/nexus-agents/src/core/types/workflow.ts:114
Real tokens consumed by this step (#4673).
undefined means the step reported no usage — a step that ran no model,
or an adapter that returned none. It does NOT mean zero. That distinction
matters for budgets specifically: silently treating unmeasured as zero
under-counts spend, which is the dangerous direction for a cap.
Task
Defined in: packages/nexus-agents/src/core/types/agent.ts:101
Task to be executed by an agent.
Properties
constraints?
optional constraints?: TaskConstraints;
Defined in: packages/nexus-agents/src/core/types/agent.ts:109
Optional constraints. See TaskConstraints for enforcement status.
context
context: TaskContext;
Defined in: packages/nexus-agents/src/core/types/agent.ts:107
Task context
description
description: string;
Defined in: packages/nexus-agents/src/core/types/agent.ts:105
Task description
id
id: string;
Defined in: packages/nexus-agents/src/core/types/agent.ts:103
Unique task identifier
priority?
optional priority?: number;
Defined in: packages/nexus-agents/src/core/types/agent.ts:114
Priority (higher = more urgent). INFORMATIONAL - Logged but not used for scheduling or execution order.
TaskContext
Defined in: packages/nexus-agents/src/core/types/agent.ts:61
Task context and constraints.
Properties
files?
optional files?: string[];
Defined in: packages/nexus-agents/src/core/types/agent.ts:65
Relevant files
history?
optional history?: TaskHistoryItem[];
Defined in: packages/nexus-agents/src/core/types/agent.ts:67
Previous messages in conversation
metadata?
optional metadata?: Record<string, unknown>;
Defined in: packages/nexus-agents/src/core/types/agent.ts:69
Additional metadata
workingDirectory?
optional workingDirectory?: string;
Defined in: packages/nexus-agents/src/core/types/agent.ts:63
Working directory or scope
TaskResult
Defined in: packages/nexus-agents/src/core/types/agent.ts:157
Result of task execution.
Properties
metadata
metadata: ResultMetadata;
Defined in: packages/nexus-agents/src/core/types/agent.ts:163
Execution metadata
output
output: unknown;
Defined in: packages/nexus-agents/src/core/types/agent.ts:161
Result output
taskId
taskId: string;
Defined in: packages/nexus-agents/src/core/types/agent.ts:159
Task that was executed
TokenUsage
Defined in: packages/nexus-agents/src/core/types/model.ts:161
Token usage statistics.
Properties
cacheCreationInputTokens?
optional cacheCreationInputTokens?: number;
Defined in: packages/nexus-agents/src/core/types/model.ts:190
Input tokens spent WRITING the cache. Billed at roughly 1.25x the uncached rate — the opposite end from a cache read, which is why the two stay separate (#4438).
cachedInputTokens?
optional cachedInputTokens?: number;
Defined in: packages/nexus-agents/src/core/types/model.ts:184
Input tokens READ from an existing prompt cache, when the vendor reports
them separately. Billed at roughly a tenth of the uncached input rate, so
kept out of inputTokens rather than summed into it (#4435).
inputTokens
inputTokens: number;
Defined in: packages/nexus-agents/src/core/types/model.ts:162
inputTokensMeasured?
optional inputTokensMeasured?: boolean;
Defined in: packages/nexus-agents/src/core/types/model.ts:178
Whether inputTokens is a measurement (#4835).
false means the vendor did not report a prompt count on this event, so
inputTokens is a placeholder 0 — and totalTokens is therefore a
LOWER BOUND, not a total. A stream consumer that bills on these numbers
otherwise prices a large-context call at zero prompt cost, which
under-counts in the dangerous direction.
Absent means measured, so no existing producer changes meaning. Where
NOTHING is known, prefer omitting usage entirely — that is the #4439
policy, and the field is already optional on the chunk.
outputTokens
outputTokens: number;
Defined in: packages/nexus-agents/src/core/types/model.ts:163
totalTokens
totalTokens: number;
Defined in: packages/nexus-agents/src/core/types/model.ts:164
ToolDefinition
Defined in: packages/nexus-agents/src/core/types/model.ts:48
Tool definition for function calling.
Properties
description
description: string;
Defined in: packages/nexus-agents/src/core/types/model.ts:50
inputSchema
inputSchema: Record<string, unknown>;
Defined in: packages/nexus-agents/src/core/types/model.ts:51
name
name: string;
Defined in: packages/nexus-agents/src/core/types/model.ts:49
WorkflowDefinition
Defined in: packages/nexus-agents/src/core/types/workflow.ts:75
Workflow definition (loaded from template).
Properties
defaultBudget?
optional defaultBudget?: ContextBudget;
Defined in: packages/nexus-agents/src/core/types/workflow.ts:89
Default context budget for workflow steps (individual steps can override)
description?
optional description?: string;
Defined in: packages/nexus-agents/src/core/types/workflow.ts:81
Description
inputs
inputs: InputDefinition[];
Defined in: packages/nexus-agents/src/core/types/workflow.ts:83
Input definitions
name
name: string;
Defined in: packages/nexus-agents/src/core/types/workflow.ts:77
Workflow name
steps
steps: WorkflowStep[];
Defined in: packages/nexus-agents/src/core/types/workflow.ts:85
Workflow steps
timeout?
optional timeout?: number;
Defined in: packages/nexus-agents/src/core/types/workflow.ts:87
Global timeout in ms
version
version: string;
Defined in: packages/nexus-agents/src/core/types/workflow.ts:79
Version
WorkflowStep
Defined in: packages/nexus-agents/src/core/types/workflow.ts:49
Single step in a workflow.
Properties
action
action: string;
Defined in: packages/nexus-agents/src/core/types/workflow.ts:55
Action to perform
agent
agent: AgentRole;
Defined in: packages/nexus-agents/src/core/types/workflow.ts:53
Agent role to execute this step
condition?
optional condition?: string;
Defined in: packages/nexus-agents/src/core/types/workflow.ts:67
Condition for execution
contextBudget?
optional contextBudget?: Partial<ContextBudget>;
Defined in: packages/nexus-agents/src/core/types/workflow.ts:69
Step-specific context budget override (merges with workflow default)
dependsOn?
optional dependsOn?: string[];
Defined in: packages/nexus-agents/src/core/types/workflow.ts:59
Step dependencies (wait for these to complete)
id
id: string;
Defined in: packages/nexus-agents/src/core/types/workflow.ts:51
Unique step identifier
inputs
inputs: Record<string, unknown>;
Defined in: packages/nexus-agents/src/core/types/workflow.ts:57
Inputs for the step
parallel?
optional parallel?: boolean;
Defined in: packages/nexus-agents/src/core/types/workflow.ts:61
Execute in parallel with dependencies
retries?
optional retries?: number;
Defined in: packages/nexus-agents/src/core/types/workflow.ts:63
Number of retry attempts
timeout?
optional timeout?: number;
Defined in: packages/nexus-agents/src/core/types/workflow.ts:65
Timeout in ms
WorkflowTemplate
Defined in: packages/nexus-agents/src/core/types/workflow.ts:178
Workflow template metadata.
Extended by
Properties
category?
optional category?: string;
Defined in: packages/nexus-agents/src/core/types/workflow.ts:188
Category
description?
optional description?: string;
Defined in: packages/nexus-agents/src/core/types/workflow.ts:184
Description
name
name: string;
Defined in: packages/nexus-agents/src/core/types/workflow.ts:180
Template name
path
path: string;
Defined in: packages/nexus-agents/src/core/types/workflow.ts:186
File path
version
version: string;
Defined in: packages/nexus-agents/src/core/types/workflow.ts:182
Version
Type Aliases
AgentCapability
type AgentCapability = typeof AgentCapability[keyof typeof AgentCapability];
Defined in: packages/nexus-agents/src/core/types/agent.ts:46
Agent capabilities.
AgentMessageType
type AgentMessageType = "task" | "result" | "query" | "feedback" | "status";
Defined in: packages/nexus-agents/src/core/types/agent.ts:169
Inter-agent message types.
AgentRole
type AgentRole =
| "orchestrator"
| "code_expert"
| "architecture_expert"
| "security_expert"
| "documentation_expert"
| "testing_expert"
| "devops_expert"
| "research_expert"
| "pm_expert"
| "ux_expert"
| "infrastructure_expert"
| "qa_expert"
| "data_visualization_expert"
| "thinker"
| "worker"
| "verifier"
| "custom";
Defined in: packages/nexus-agents/src/core/types/agent.ts:19
Predefined agent roles.
AgentState
type AgentState = "idle" | "thinking" | "acting" | "waiting" | "error";
Defined in: packages/nexus-agents/src/core/types/agent.ts:14
Agent state in the lifecycle.
ContentBlock
type ContentBlock =
| {
text: string;
type: "text";
}
| {
id: string;
input: unknown;
name: string;
type: "tool_use";
}
| {
content: string;
is_error?: boolean;
tool_use_id: string;
type: "tool_result";
}
| {
source: {
data: string;
media_type: string;
type: "base64";
};
type: "image";
};
Defined in: packages/nexus-agents/src/core/types/model.ts:31
Content block types in messages and responses.
ErrorCode
type ErrorCode = typeof ErrorCode[keyof typeof ErrorCode];
Defined in: packages/nexus-agents/src/core/errors.ts:10
Error codes for all Nexus Agents errors.
LogLevel
type LogLevel = "debug" | "info" | "warn" | "error";
Defined in: packages/nexus-agents/src/core/logger.ts:12
Log levels in order of severity
MessageRole
type MessageRole = "user" | "assistant" | "system";
Defined in: packages/nexus-agents/src/core/types/model.ts:26
Message role in a conversation.
ModelCapability
type ModelCapability = typeof ModelCapability[keyof typeof ModelCapability];
Defined in: packages/nexus-agents/src/core/types/model.ts:13
Model capabilities supported by adapters.
Result
type Result<T, E> =
| {
ok: true;
value: T;
}
| {
error: E;
ok: false;
};
Defined in: packages/nexus-agents/src/core/result.ts:13
A discriminated union representing either success (Ok) or failure (Err).
Type Parameters
T
T
The success value type
E
E
The error value type
StopReason
type StopReason = "end_turn" | "max_tokens" | "stop_sequence" | "tool_use";
Defined in: packages/nexus-agents/src/core/types/model.ts:196
Reason the model stopped generating.
StreamChunk
type StreamChunk =
| {
contentBlock: ContentBlock;
index: number;
type: "content_block_start";
}
| {
delta: {
text: string;
type: "text_delta";
};
index: number;
type: "content_block_delta";
}
| {
index: number;
type: "content_block_stop";
}
| {
message: {
model: string;
};
type: "message_start";
usage?: TokenUsage;
}
| {
delta: {
stop_reason: StopReason;
};
type: "message_delta";
usage?: TokenUsage;
}
| {
type: "message_stop";
};
Defined in: packages/nexus-agents/src/core/types/model.ts:254
Chunk from a streaming response.
Variables
AgentCapability
const AgentCapability: {
CODE_GENERATION: "code_generation";
CODE_REVIEW: "code_review";
COLLABORATION: "collaboration";
DELEGATION: "delegation";
RESEARCH: "research";
TASK_EXECUTION: "task_execution";
TOOL_USE: "tool_use";
};
Defined in: packages/nexus-agents/src/core/types/agent.ts:46
Agent capabilities.
Type Declaration
CODE_GENERATION
readonly CODE_GENERATION: "code_generation" = 'code_generation';
CODE_REVIEW
readonly CODE_REVIEW: "code_review" = 'code_review';
COLLABORATION
readonly COLLABORATION: "collaboration" = 'collaboration';
DELEGATION
readonly DELEGATION: "delegation" = 'delegation';
RESEARCH
readonly RESEARCH: "research" = 'research';
TASK_EXECUTION
readonly TASK_EXECUTION: "task_execution" = 'task_execution';
TOOL_USE
readonly TOOL_USE: "tool_use" = 'tool_use';
ErrorCode
const ErrorCode: {
AGENT_ACTION_FAILURE: "AGENT_ACTION_FAILURE";
AGENT_ERROR: "AGENT_ERROR";
AGENT_EXECUTION_FAILED: "AGENT_EXECUTION_FAILED";
AGENT_MEMORY_FAILURE: "AGENT_MEMORY_FAILURE";
AGENT_NOT_FOUND: "AGENT_NOT_FOUND";
AGENT_PLANNING_FAILURE: "AGENT_PLANNING_FAILURE";
AGENT_REFLECTION_FAILURE: "AGENT_REFLECTION_FAILURE";
CONFIG_ERROR: "CONFIG_ERROR";
CONFIG_INVALID: "CONFIG_INVALID";
CONFIG_NOT_FOUND: "CONFIG_NOT_FOUND";
INTERNAL_ERROR: "INTERNAL_ERROR";
INVALID_INPUT: "INVALID_INPUT";
MISSING_REQUIRED: "MISSING_REQUIRED";
MODEL_ERROR: "MODEL_ERROR";
MODEL_NOT_FOUND: "MODEL_NOT_FOUND";
MODEL_PARAMETER_UNSUPPORTED: "MODEL_PARAMETER_UNSUPPORTED";
MODEL_RATE_LIMITED: "MODEL_RATE_LIMITED";
MODEL_TIMEOUT: "MODEL_TIMEOUT";
MODEL_UNAVAILABLE: "MODEL_UNAVAILABLE";
PATH_TRAVERSAL: "PATH_TRAVERSAL";
RATE_LIMIT_ERROR: "RATE_LIMIT_ERROR";
SCHEMA_ERROR: "SCHEMA_ERROR";
SECURITY_ERROR: "SECURITY_ERROR";
TIMEOUT_ERROR: "TIMEOUT_ERROR";
UNAUTHORIZED: "UNAUTHORIZED";
VALIDATION_ERROR: "VALIDATION_ERROR";
WORKFLOW_ERROR: "WORKFLOW_ERROR";
WORKFLOW_EXECUTION_FAILED: "WORKFLOW_EXECUTION_FAILED";
WORKFLOW_NOT_FOUND: "WORKFLOW_NOT_FOUND";
WORKFLOW_PARSE_ERROR: "WORKFLOW_PARSE_ERROR";
};
Defined in: packages/nexus-agents/src/core/errors.ts:10
Error codes for all Nexus Agents errors.
Type Declaration
AGENT_ACTION_FAILURE
readonly AGENT_ACTION_FAILURE: "AGENT_ACTION_FAILURE" = 'AGENT_ACTION_FAILURE';
AGENT_ERROR
readonly AGENT_ERROR: "AGENT_ERROR" = 'AGENT_ERROR';
AGENT_EXECUTION_FAILED
readonly AGENT_EXECUTION_FAILED: "AGENT_EXECUTION_FAILED" = 'AGENT_EXECUTION_FAILED';
AGENT_MEMORY_FAILURE
readonly AGENT_MEMORY_FAILURE: "AGENT_MEMORY_FAILURE" = 'AGENT_MEMORY_FAILURE';
AGENT_NOT_FOUND
readonly AGENT_NOT_FOUND: "AGENT_NOT_FOUND" = 'AGENT_NOT_FOUND';
AGENT_PLANNING_FAILURE
readonly AGENT_PLANNING_FAILURE: "AGENT_PLANNING_FAILURE" = 'AGENT_PLANNING_FAILURE';
AGENT_REFLECTION_FAILURE
readonly AGENT_REFLECTION_FAILURE: "AGENT_REFLECTION_FAILURE" = 'AGENT_REFLECTION_FAILURE';
CONFIG_ERROR
readonly CONFIG_ERROR: "CONFIG_ERROR" = 'CONFIG_ERROR';
CONFIG_INVALID
readonly CONFIG_INVALID: "CONFIG_INVALID" = 'CONFIG_INVALID';
CONFIG_NOT_FOUND
readonly CONFIG_NOT_FOUND: "CONFIG_NOT_FOUND" = 'CONFIG_NOT_FOUND';
INTERNAL_ERROR
readonly INTERNAL_ERROR: "INTERNAL_ERROR" = 'INTERNAL_ERROR';
INVALID_INPUT
readonly INVALID_INPUT: "INVALID_INPUT" = 'INVALID_INPUT';
MISSING_REQUIRED
readonly MISSING_REQUIRED: "MISSING_REQUIRED" = 'MISSING_REQUIRED';
MODEL_ERROR
readonly MODEL_ERROR: "MODEL_ERROR" = 'MODEL_ERROR';
MODEL_NOT_FOUND
readonly MODEL_NOT_FOUND: "MODEL_NOT_FOUND" = 'MODEL_NOT_FOUND';
Model is reachable but the requested id no longer exists — typically a
404 from /v1/chat/completions, an Anthropic model_not_found error,
or a vendor “this model has been deprecated” message. Distinct from
MODEL_UNAVAILABLE (transient 502/503 service overload) — this one
means the model is gone, retry won’t help, route to a different id.
Surfaced to the caller as-is: automatic substitution was removed in
#4408 because answering with a model the caller did not request
records the substitute’s outcome under the requested model’s id.
MODEL_PARAMETER_UNSUPPORTED
readonly MODEL_PARAMETER_UNSUPPORTED: "MODEL_PARAMETER_UNSUPPORTED" = 'MODEL_PARAMETER_UNSUPPORTED';
The model rejected a request parameter by name — a 400 that identifies an
unsupported param (e.g. a post-Opus-4.6 Claude or an OpenAI reasoning model
400-ing on temperature). NON-RETRYABLE: retrying an identical request with
the same bad param will 400 again. The offending param name is carried in the
error context.param. Distinct from generic MODEL_ERROR so callers and
telemetry (#4069) can act on the named param.
MODEL_RATE_LIMITED
readonly MODEL_RATE_LIMITED: "MODEL_RATE_LIMITED" = 'MODEL_RATE_LIMITED';
MODEL_TIMEOUT
readonly MODEL_TIMEOUT: "MODEL_TIMEOUT" = 'MODEL_TIMEOUT';
MODEL_UNAVAILABLE
readonly MODEL_UNAVAILABLE: "MODEL_UNAVAILABLE" = 'MODEL_UNAVAILABLE';
PATH_TRAVERSAL
readonly PATH_TRAVERSAL: "PATH_TRAVERSAL" = 'PATH_TRAVERSAL';
RATE_LIMIT_ERROR
readonly RATE_LIMIT_ERROR: "RATE_LIMIT_ERROR" = 'RATE_LIMIT_ERROR';
SCHEMA_ERROR
readonly SCHEMA_ERROR: "SCHEMA_ERROR" = 'SCHEMA_ERROR';
SECURITY_ERROR
readonly SECURITY_ERROR: "SECURITY_ERROR" = 'SECURITY_ERROR';
TIMEOUT_ERROR
readonly TIMEOUT_ERROR: "TIMEOUT_ERROR" = 'TIMEOUT_ERROR';
UNAUTHORIZED
readonly UNAUTHORIZED: "UNAUTHORIZED" = 'UNAUTHORIZED';
VALIDATION_ERROR
readonly VALIDATION_ERROR: "VALIDATION_ERROR" = 'VALIDATION_ERROR';
WORKFLOW_ERROR
readonly WORKFLOW_ERROR: "WORKFLOW_ERROR" = 'WORKFLOW_ERROR';
WORKFLOW_EXECUTION_FAILED
readonly WORKFLOW_EXECUTION_FAILED: "WORKFLOW_EXECUTION_FAILED" = 'WORKFLOW_EXECUTION_FAILED';
WORKFLOW_NOT_FOUND
readonly WORKFLOW_NOT_FOUND: "WORKFLOW_NOT_FOUND" = 'WORKFLOW_NOT_FOUND';
WORKFLOW_PARSE_ERROR
readonly WORKFLOW_PARSE_ERROR: "WORKFLOW_PARSE_ERROR" = 'WORKFLOW_PARSE_ERROR';
logger
const logger: ILogger;
Defined in: packages/nexus-agents/src/core/logger.ts:388
Default logger instance
ModelCapability
const ModelCapability: {
COMPLETION: "completion";
EXTENDED_THINKING: "extended_thinking";
STREAMING: "streaming";
TOOL_USE: "tool_use";
VISION: "vision";
};
Defined in: packages/nexus-agents/src/core/types/model.ts:13
Model capabilities supported by adapters.
Type Declaration
COMPLETION
readonly COMPLETION: "completion" = 'completion';
EXTENDED_THINKING
readonly EXTENDED_THINKING: "extended_thinking" = 'extended_thinking';
STREAMING
readonly STREAMING: "streaming" = 'streaming';
TOOL_USE
readonly TOOL_USE: "tool_use" = 'tool_use';
VISION
readonly VISION: "vision" = 'vision';
Functions
createLogger()
function createLogger(baseContext?): ILogger;
Defined in: packages/nexus-agents/src/core/logger.ts:335
Creates a structured logger with configurable format and destination. (Source: Issue #485 - Wire logging.format and logging.destination)
Parameters
baseContext?
Returns
err()
function err<E>(error): Result<never, E>;
Defined in: packages/nexus-agents/src/core/result.ts:49
Creates a failed Result containing the given error.
Type Parameters
E
E
The error value type
Parameters
error
E
The error value
Returns
Result<never, E>
A Result in the Err state
Example
const result = err(new Error('not found'));
if (!result.ok) {
console.error(result.error.message); // "not found"
}
isErr()
function isErr<T, E>(result): result is { error: E; ok: false };
Defined in: packages/nexus-agents/src/core/result.ts:73
Type guard to check if a Result is in the Err state.
Type Parameters
T
T
The success value type
E
E
The error value type
Parameters
result
Result<T, E>
The Result to check
Returns
result is { error: E; ok: false }
True if the Result is Err
isOk()
function isOk<T, E>(result): result is { ok: true; value: T };
Defined in: packages/nexus-agents/src/core/result.ts:60
Type guard to check if a Result is in the Ok state.
Type Parameters
T
T
The success value type
E
E
The error value type
Parameters
result
Result<T, E>
The Result to check
Returns
result is { ok: true; value: T }
True if the Result is Ok
map()
function map<T, U, E>(result, fn): Result<U, E>;
Defined in: packages/nexus-agents/src/core/result.ts:88
Transforms the success value of a Result using the provided function.
Type Parameters
T
T
The original success value type
U
U
The transformed success value type
E
E
The error value type
Parameters
result
Result<T, E>
The Result to transform
fn
(value) => U
The transformation function
Returns
Result<U, E>
A new Result with the transformed value
mapErr()
function mapErr<T, E, F>(result, fn): Result<T, F>;
Defined in: packages/nexus-agents/src/core/result.ts:104
Transforms the error value of a Result using the provided function.
Type Parameters
T
T
The success value type
E
E
The original error value type
F
F
The transformed error value type
Parameters
result
Result<T, E>
The Result to transform
fn
(error) => F
The transformation function
Returns
Result<T, F>
A new Result with the transformed error
ok()
function ok<T>(value): Result<T, never>;
Defined in: packages/nexus-agents/src/core/result.ts:31
Creates a successful Result containing the given value.
Type Parameters
T
T
The success value type
Parameters
value
T
The success value
Returns
Result<T, never>
A Result in the Ok state
Example
const result = ok(42);
if (result.ok) {
console.log(result.value); // 42
}
sanitize()
function sanitize(text): string;
Defined in: packages/nexus-agents/src/core/logger.ts:142
Sanitizes a string by redacting known secret patterns.
Parameters
text
string
Returns
string
unwrap()
function unwrap<T, E>(result): T;
Defined in: packages/nexus-agents/src/core/result.ts:119
Extracts the success value from a Result.
Type Parameters
T
T
The success value type
E
E
The error value type
Parameters
result
Result<T, E>
The Result to unwrap
Returns
T
The success value
Throws
Throws an Error wrapping the error value if the Result is Err
unwrapOr()
function unwrapOr<T, E>(result, defaultValue): T;
Defined in: packages/nexus-agents/src/core/result.ts:144
Extracts the success value from a Result, or returns a default value.
Type Parameters
T
T
The success value type
E
E
The error value type
Parameters
result
Result<T, E>
The Result to unwrap
defaultValue
T
The default value to return if Err
Returns
T
The success value or the default value
Example
const result = err(new Error('failed'));
const value = unwrapOr(result, 'fallback');
console.log(value); // "fallback"