@n8n/agents 0.5.2 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/build.tsbuildinfo +1 -1
- package/dist/runtime/agent-runtime.d.ts +7 -0
- package/dist/runtime/agent-runtime.js +135 -110
- package/dist/runtime/agent-runtime.js.map +1 -1
- package/dist/runtime/event-bus.d.ts +1 -0
- package/dist/runtime/event-bus.js +4 -0
- package/dist/runtime/event-bus.js.map +1 -1
- package/dist/runtime/run-state.js.map +1 -1
- package/dist/sdk/agent.d.ts +9 -6
- package/dist/sdk/agent.js +124 -29
- package/dist/sdk/agent.js.map +1 -1
- package/dist/types/runtime/event.d.ts +7 -1
- package/dist/types/runtime/event.js.map +1 -1
- package/dist/types/sdk/agent.d.ts +2 -1
- package/package.json +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AgentPersistenceOptions } from '../sdk/agent';
|
|
1
2
|
import type { AgentMessage, ContentToolResult } from '../sdk/message';
|
|
2
3
|
export declare const enum AgentEvent {
|
|
3
4
|
AgentStart = "agent_start",
|
|
@@ -8,7 +9,11 @@ export declare const enum AgentEvent {
|
|
|
8
9
|
ToolExecutionEnd = "tool_execution_end",
|
|
9
10
|
Error = "error"
|
|
10
11
|
}
|
|
11
|
-
export type
|
|
12
|
+
export type SharedAgentEventData = {
|
|
13
|
+
runId: string;
|
|
14
|
+
persistence?: AgentPersistenceOptions;
|
|
15
|
+
};
|
|
16
|
+
export type AgentEventSpecificData = {
|
|
12
17
|
type: AgentEvent.AgentStart;
|
|
13
18
|
} | {
|
|
14
19
|
type: AgentEvent.AgentEnd;
|
|
@@ -35,6 +40,7 @@ export type AgentEventData = {
|
|
|
35
40
|
message: string;
|
|
36
41
|
error: unknown;
|
|
37
42
|
};
|
|
43
|
+
export type AgentEventData = SharedAgentEventData & AgentEventSpecificData;
|
|
38
44
|
export type AgentEventHandler = (data: AgentEventData) => void;
|
|
39
45
|
export interface AgentMiddleware {
|
|
40
46
|
on: (event: AgentEvent, handler: AgentEventHandler) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event.js","sourceRoot":"","sources":["../../../src/types/runtime/event.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"event.js","sourceRoot":"","sources":["../../../src/types/runtime/event.ts"],"names":[],"mappings":";;;AAGA,IAAkB,UAQjB;AARD,WAAkB,UAAU;IAC3B,wCAA0B,CAAA;IAC1B,oCAAsB,CAAA;IACtB,sCAAwB,CAAA;IACxB,kCAAoB,CAAA;IACpB,yDAA2C,CAAA;IAC3C,qDAAuC,CAAA;IACvC,6BAAe,CAAA;AAChB,CAAC,EARiB,UAAU,0BAAV,UAAU,QAQ3B"}
|
|
@@ -117,10 +117,12 @@ export interface GenerateResult {
|
|
|
117
117
|
resumeSchema?: JsonSchema7Type;
|
|
118
118
|
}>;
|
|
119
119
|
error?: unknown;
|
|
120
|
+
getState(): SerializableAgentState;
|
|
120
121
|
}
|
|
121
122
|
export interface StreamResult {
|
|
122
123
|
runId: string;
|
|
123
124
|
stream: ReadableStream<StreamChunk>;
|
|
125
|
+
getState(): SerializableAgentState;
|
|
124
126
|
}
|
|
125
127
|
export interface ResumeOptions {
|
|
126
128
|
runId: string;
|
|
@@ -132,7 +134,6 @@ export interface BuiltAgent {
|
|
|
132
134
|
stream(input: AgentMessage[] | string, options?: RunOptions & ExecutionOptions): Promise<StreamResult>;
|
|
133
135
|
on(event: AgentEvent, handler: AgentEventHandler): void;
|
|
134
136
|
asTool(description: string): BuiltTool;
|
|
135
|
-
getState(): SerializableAgentState;
|
|
136
137
|
abort(): void;
|
|
137
138
|
resume(method: 'generate', data: unknown, options: ResumeOptions & ExecutionOptions): Promise<GenerateResult>;
|
|
138
139
|
resume(method: 'stream', data: unknown, options: ResumeOptions & ExecutionOptions): Promise<StreamResult>;
|