kernl

Class: Context<TContext>

Defined in: packages/kernl/src/context.ts:12

A propagation mechanism which carries execution-scoped values across API boundaries and between logically associated execution units.

Type Parameters

Type ParameterDefault type
TContextUnknownContext

Constructors

Constructor

new Context<TContext>(namespace: string, context: TContext): Context<TContext>;

Defined in: packages/kernl/src/context.ts:78

Parameters

ParameterTypeDefault value
namespacestring"kernl"
contextTContext...

Returns

Context<TContext>

Properties

PropertyTypeDescriptionDefined in
agent?Agent<any, any>The agent executing this context. Set by the thread during execution. NOTE: Primarily used by system tools (e.g., memory) that need agent access. Uses any to avoid invariance issues when composing toolkits.packages/kernl/src/context.ts:30
approvalsMap<string, ApprovalStatus>Map of tool call IDs to their approval status. (TEMPORARY) Used until the actions system is refined.packages/kernl/src/context.ts:40
contextTContextThe inner context object.packages/kernl/src/context.ts:21
namespacestringThe namespace that this context belongs to.packages/kernl/src/context.ts:16

Methods

approve()

approve(callId: string): void;

Defined in: packages/kernl/src/context.ts:46

Approve a tool call by its call ID. (TEMPORARY) Used until the actions system is refined.

Parameters

ParameterType
callIdstring

Returns

void


md()

md(): string;

Defined in: packages/kernl/src/context.ts:120

Render the context object as a markdown string:

Returns

string


reject()

reject(callId: string): void;

Defined in: packages/kernl/src/context.ts:54

Reject a tool call by its call ID. (TEMPORARY) Used until the actions system is refined.

Parameters

ParameterType
callIdstring

Returns

void


render()

render(self: Context<TContext>): string;

Defined in: packages/kernl/src/context.ts:90

Renders the context as a prompt using the default format selected. Kernel would inject this info automatically, but exposed in case of control

Parameters

ParameterType
selfContext<TContext>

Returns

string


toJSON()

toJSON(): {
  context: any;
};

Defined in: packages/kernl/src/context.ts:139

Returns

{
  context: any;
}
NameTypeDefined in
contextanypackages/kernl/src/context.ts:140

yaml()

yaml(): string;

Defined in: packages/kernl/src/context.ts:135

Render the context object as a yaml string:

context: user: name: John email: john@gmail.com org: id: org_235234523 name: Acme Corp.

Returns

string

On this page