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 Parameter | Default type |
|---|---|
TContext | UnknownContext |
Constructors
Constructor
new Context<TContext>(namespace: string, context: TContext): Context<TContext>;Defined in: packages/kernl/src/context.ts:78
Parameters
| Parameter | Type | Default value |
|---|---|---|
namespace | string | "kernl" |
context | TContext | ... |
Returns
Context<TContext>
Properties
| Property | Type | Description | Defined 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 |
approvals | Map<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 |
context | TContext | The inner context object. | packages/kernl/src/context.ts:21 |
namespace | string | The 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
| Parameter | Type |
|---|---|
callId | string |
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
| Parameter | Type |
|---|---|
callId | string |
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
| Parameter | Type |
|---|---|
self | Context<TContext> |
Returns
string
toJSON()
toJSON(): {
context: any;
};Defined in: packages/kernl/src/context.ts:139
Returns
{
context: any;
}| Name | Type | Defined in |
|---|---|---|
context | any | packages/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