Skip to content

Commit 549f540

Browse files
authored
v1.8.0 - Update Stream Behavior (#62)
1 parent 1eb8880 commit 549f540

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pompeii-labs/magma",
3-
"version": "1.7.7",
3+
"version": "1.8.0",
44
"description": "The Typescript framework to build AI agents quickly and easily",
55
"keywords": [
66
"Agents",

src/agent.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,14 @@ type AgentProps = MagmaProviderConfig & {
4545
verbose?: boolean;
4646
messageContext?: number;
4747
stream?: boolean;
48+
sessionId?: string;
4849
};
4950

5051
export class MagmaAgent {
5152
verbose?: boolean;
5253
stream: boolean = false;
54+
public sessionId: string;
55+
5356
private providerConfig: MagmaProviderConfig = {
5457
provider: 'openai',
5558
model: 'gpt-4.1',
@@ -65,6 +68,7 @@ export class MagmaAgent {
6568
this.messageContext = args?.messageContext ?? 20;
6669
this.verbose = args?.verbose ?? false;
6770
this.stream = args?.stream ?? false;
71+
this.sessionId = args?.sessionId ?? '';
6872

6973
args ??= {
7074
provider: 'anthropic',
@@ -101,7 +105,15 @@ export class MagmaAgent {
101105
* Optional method to receive input from the user
102106
* @param message message object received from the user - type to be defined by extending class
103107
*/
104-
public async receive?(message: any): Promise<void> {}
108+
public async receive?(message: any): Promise<void> { }
109+
110+
/**
111+
* Sends data to the connected client depending on the medium (ws, SSE, etc)
112+
* @param message any data object to be sent to the client
113+
*/
114+
public async send(message: Record<string, any>): Promise<void> { }
115+
116+
public async onWsClose(code: number, reason?: string): Promise<void> { }
105117

106118
public async cleanup(): Promise<void> {
107119
try {

0 commit comments

Comments
 (0)