@n8n/agents 0.27.4 → 0.28.1
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/index.d.ts +4 -2
- package/dist/index.js +7 -4
- package/dist/index.js.map +1 -1
- package/dist/runtime/guardrails/budget-guardrail.d.ts +27 -0
- package/dist/runtime/guardrails/budget-guardrail.js +71 -0
- package/dist/runtime/guardrails/budget-guardrail.js.map +1 -0
- package/dist/runtime/guardrails/guardrail-runner.d.ts +18 -0
- package/dist/runtime/guardrails/guardrail-runner.js +51 -0
- package/dist/runtime/guardrails/guardrail-runner.js.map +1 -0
- package/dist/runtime/loop/agent-runtime.d.ts +3 -1
- package/dist/runtime/loop/agent-runtime.js +158 -26
- package/dist/runtime/loop/agent-runtime.js.map +1 -1
- package/dist/runtime/loop/generate-sink.js +2 -1
- package/dist/runtime/loop/generate-sink.js.map +1 -1
- package/dist/runtime/loop/hydrate-file-parts.js +14 -6
- package/dist/runtime/loop/hydrate-file-parts.js.map +1 -1
- package/dist/runtime/loop/side-call-cost.d.ts +2 -0
- package/dist/runtime/loop/side-call-cost.js +14 -0
- package/dist/runtime/loop/side-call-cost.js.map +1 -0
- package/dist/runtime/loop/stream-sink.d.ts +3 -1
- package/dist/runtime/loop/stream-sink.js +19 -1
- package/dist/runtime/loop/stream-sink.js.map +1 -1
- package/dist/runtime/mcp/mcp-connection.js +14 -6
- package/dist/runtime/mcp/mcp-connection.js.map +1 -1
- package/dist/runtime/mcp/mcp-tool-resolver.js +1 -0
- package/dist/runtime/mcp/mcp-tool-resolver.js.map +1 -1
- package/dist/runtime/memory/episodic-memory-capture.d.ts +8 -1
- package/dist/runtime/memory/episodic-memory-capture.js +53 -11
- package/dist/runtime/memory/episodic-memory-capture.js.map +1 -1
- package/dist/runtime/memory/episodic-memory-defaults.js +7 -1
- package/dist/runtime/memory/episodic-memory-defaults.js.map +1 -1
- package/dist/runtime/memory/forward-usage.d.ts +2 -0
- package/dist/runtime/memory/forward-usage.js +14 -0
- package/dist/runtime/memory/forward-usage.js.map +1 -0
- package/dist/runtime/memory/memory-orchestrator.d.ts +2 -1
- package/dist/runtime/memory/memory-orchestrator.js +54 -23
- package/dist/runtime/memory/memory-orchestrator.js.map +1 -1
- package/dist/runtime/memory/observation-log-defaults.d.ts +2 -0
- package/dist/runtime/memory/observation-log-defaults.js +36 -32
- package/dist/runtime/memory/observation-log-defaults.js.map +1 -1
- package/dist/runtime/memory/observation-log-observer.d.ts +4 -1
- package/dist/runtime/memory/observation-log-observer.js +48 -14
- package/dist/runtime/memory/observation-log-observer.js.map +1 -1
- package/dist/runtime/memory/observation-log-reflector.d.ts +4 -1
- package/dist/runtime/memory/observation-log-reflector.js +8 -1
- package/dist/runtime/memory/observation-log-reflector.js.map +1 -1
- package/dist/runtime/memory/title-generation.d.ts +5 -2
- package/dist/runtime/memory/title-generation.js +31 -5
- package/dist/runtime/memory/title-generation.js.map +1 -1
- package/dist/runtime/memory/tool-result-memory.js.map +1 -1
- package/dist/runtime/model/message-list.d.ts +1 -1
- package/dist/runtime/model/message-list.js +8 -3
- package/dist/runtime/model/message-list.js.map +1 -1
- package/dist/runtime/streaming/stream-writer-guard.d.ts +2 -0
- package/dist/runtime/streaming/stream-writer-guard.js +8 -4
- package/dist/runtime/streaming/stream-writer-guard.js.map +1 -1
- package/dist/runtime/tools/tool-adapter.js +1 -0
- package/dist/runtime/tools/tool-adapter.js.map +1 -1
- package/dist/runtime/tools/tool-call-executor.js +7 -0
- package/dist/runtime/tools/tool-call-executor.js.map +1 -1
- package/dist/runtime/tools/tool-call-runner.js +21 -3
- package/dist/runtime/tools/tool-call-runner.js.map +1 -1
- package/dist/runtime/tools/tool-result-guard.js.map +1 -1
- package/dist/runtime/tools/untrusted-tool-output.js.map +1 -1
- package/dist/sdk/agent.d.ts +1 -0
- package/dist/sdk/agent.js +12 -1
- package/dist/sdk/agent.js.map +1 -1
- package/dist/sdk/tool.d.ts +6 -0
- package/dist/sdk/tool.js +21 -3
- package/dist/sdk/tool.js.map +1 -1
- package/dist/types/index.d.ts +5 -4
- package/dist/types/index.js.map +1 -1
- package/dist/types/runtime/agent-loop.d.ts +6 -1
- package/dist/types/runtime/tool-execution.d.ts +6 -1
- package/dist/types/sdk/agent.d.ts +33 -2
- package/dist/types/sdk/agent.js +2 -0
- package/dist/types/sdk/agent.js.map +1 -1
- package/dist/types/sdk/guardrail.d.ts +37 -0
- package/dist/types/sdk/mcp.d.ts +14 -5
- package/dist/types/sdk/memory.d.ts +7 -2
- package/dist/types/sdk/observation-log.d.ts +12 -2
- package/dist/types/sdk/tool.d.ts +11 -0
- package/package.json +9 -6
|
@@ -66,7 +66,12 @@ export interface ObservationLogObserverInput {
|
|
|
66
66
|
executionCounter?: AgentExecutionCounter;
|
|
67
67
|
telemetry?: BuiltTelemetry;
|
|
68
68
|
}
|
|
69
|
-
export
|
|
69
|
+
export interface ObservationLogObserveResult {
|
|
70
|
+
text: string;
|
|
71
|
+
usage?: TokenUsage;
|
|
72
|
+
model: string;
|
|
73
|
+
}
|
|
74
|
+
export type ObservationLogObserveFn = (input: ObservationLogObserverInput) => Promise<string | ObservationLogObserveResult>;
|
|
70
75
|
export interface ObservationLogReflectorInput {
|
|
71
76
|
observationScopeId: string;
|
|
72
77
|
now: Date;
|
|
@@ -77,7 +82,12 @@ export interface ObservationLogReflectorInput {
|
|
|
77
82
|
executionCounter?: AgentExecutionCounter;
|
|
78
83
|
telemetry?: BuiltTelemetry;
|
|
79
84
|
}
|
|
80
|
-
export
|
|
85
|
+
export interface ObservationLogReflectResult {
|
|
86
|
+
text: string;
|
|
87
|
+
usage?: TokenUsage;
|
|
88
|
+
model: string;
|
|
89
|
+
}
|
|
90
|
+
export type ObservationLogReflectFn = (input: ObservationLogReflectorInput) => Promise<string | ObservationLogReflectResult>;
|
|
81
91
|
export interface MemoryTaskUsageReport {
|
|
82
92
|
task: ObservationLogTaskKind;
|
|
83
93
|
model: string;
|
package/dist/types/sdk/tool.d.ts
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import type { JSONSchema7 } from 'json-schema';
|
|
2
2
|
import type { ZodType } from 'zod';
|
|
3
3
|
import type { AgentExecutionCounter } from './agent';
|
|
4
|
+
import type { McpToolAnnotations } from './mcp';
|
|
4
5
|
import type { AgentMessage } from './message';
|
|
6
|
+
import type { ApprovalResumePayload } from '../../sdk/tool';
|
|
5
7
|
import type { RuntimeSkillLoader } from '../../skills/types';
|
|
6
8
|
import type { AgentEventData } from '../runtime/event';
|
|
7
9
|
import type { BuiltTelemetry } from '../telemetry';
|
|
8
10
|
import type { JSONObject, JSONValue } from '../utils/json';
|
|
11
|
+
export interface ToolApprovalContext {
|
|
12
|
+
readonly approvedKeys: ReadonlySet<string>;
|
|
13
|
+
getDisplayArgs?(toolName: string, input: unknown): unknown;
|
|
14
|
+
onDecision(grantKey: string, decision: ApprovalResumePayload): Promise<void>;
|
|
15
|
+
}
|
|
9
16
|
export interface ToolSuspendOptions {
|
|
10
17
|
resumeSchema?: ZodType | JSONSchema7;
|
|
11
18
|
continuation?: JSONValue;
|
|
@@ -21,6 +28,7 @@ export interface ToolExecutionContext {
|
|
|
21
28
|
emitEvent?: (event: AgentEventData) => void;
|
|
22
29
|
abortSignal?: AbortSignal;
|
|
23
30
|
executionCounter?: AgentExecutionCounter;
|
|
31
|
+
approvalContext?: ToolApprovalContext;
|
|
24
32
|
onSuspend?: (payload: unknown, options?: ToolSuspendOptions) => void | Promise<void>;
|
|
25
33
|
suspendPayload?: unknown;
|
|
26
34
|
continuation?: JSONValue;
|
|
@@ -36,6 +44,7 @@ export interface ToolContext {
|
|
|
36
44
|
emitEvent?: ToolExecutionContext['emitEvent'];
|
|
37
45
|
abortSignal?: ToolExecutionContext['abortSignal'];
|
|
38
46
|
executionCounter?: ToolExecutionContext['executionCounter'];
|
|
47
|
+
approvalContext?: ToolExecutionContext['approvalContext'];
|
|
39
48
|
}
|
|
40
49
|
export interface InterruptibleToolContext<S = unknown, R = unknown> {
|
|
41
50
|
loadSkill?: ToolExecutionContext['loadSkill'];
|
|
@@ -52,6 +61,7 @@ export interface InterruptibleToolContext<S = unknown, R = unknown> {
|
|
|
52
61
|
emitEvent?: ToolExecutionContext['emitEvent'];
|
|
53
62
|
abortSignal?: ToolExecutionContext['abortSignal'];
|
|
54
63
|
executionCounter?: ToolExecutionContext['executionCounter'];
|
|
64
|
+
approvalContext?: ToolExecutionContext['approvalContext'];
|
|
55
65
|
suspendPayload?: S;
|
|
56
66
|
continuation?: JSONValue;
|
|
57
67
|
resumeSchema?: ToolSuspendOptions['resumeSchema'];
|
|
@@ -85,6 +95,7 @@ export interface BuiltTool {
|
|
|
85
95
|
readonly mcpTool?: boolean;
|
|
86
96
|
readonly mcpServerName?: string;
|
|
87
97
|
readonly mcpToolName?: string;
|
|
98
|
+
readonly mcpAnnotations?: McpToolAnnotations;
|
|
88
99
|
readonly providerOptions?: Record<string, JSONObject>;
|
|
89
100
|
readonly metadata?: Record<string, unknown>;
|
|
90
101
|
readonly editable?: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@n8n/agents",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.28.1",
|
|
4
4
|
"description": "AI agent SDK for n8n's code-first execution engine",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=24.0.0"
|
|
@@ -94,9 +94,9 @@
|
|
|
94
94
|
"@ai-sdk/xai": "^4.0.18",
|
|
95
95
|
"@daytona/sdk": "0.205.1",
|
|
96
96
|
"@modelcontextprotocol/sdk": "1.26.0",
|
|
97
|
-
"@n8n/ai-utilities": "0.
|
|
97
|
+
"@n8n/ai-utilities": "0.36.0",
|
|
98
98
|
"@n8n/sandbox-client": "0.1.1",
|
|
99
|
-
"@n8n/utils": "1.
|
|
99
|
+
"@n8n/utils": "1.50.0",
|
|
100
100
|
"@openrouter/ai-sdk-provider": "^3.0.0",
|
|
101
101
|
"@opentelemetry/exporter-trace-otlp-http": ">=0.50.0",
|
|
102
102
|
"@opentelemetry/sdk-trace-base": "2.7.1",
|
|
@@ -142,8 +142,9 @@
|
|
|
142
142
|
}
|
|
143
143
|
},
|
|
144
144
|
"devDependencies": {
|
|
145
|
+
"@n8n/oxlint-config": "0.0.1",
|
|
145
146
|
"@n8n/typescript-config": "1.12.0",
|
|
146
|
-
"@n8n/vitest-config": "1.
|
|
147
|
+
"@n8n/vitest-config": "1.24.0",
|
|
147
148
|
"@opentelemetry/api": "1.9.1",
|
|
148
149
|
"@opentelemetry/context-async-hooks": "^2.7.1",
|
|
149
150
|
"@pinecone-database/pinecone": "^5.0.2",
|
|
@@ -155,6 +156,8 @@
|
|
|
155
156
|
"dotenv": "17.2.3",
|
|
156
157
|
"cross-env": "^7.0.3",
|
|
157
158
|
"nock": "14.0.14",
|
|
159
|
+
"oxlint": "1.78.0",
|
|
160
|
+
"oxlint-tsgolint": "^0.21.1",
|
|
158
161
|
"pg": "8.21.0",
|
|
159
162
|
"tsx": "^4.19.3",
|
|
160
163
|
"typescript": "7.0.2",
|
|
@@ -181,8 +184,8 @@
|
|
|
181
184
|
"build:unchecked": "rimraf dist && tsc -p tsconfig.build.json --noCheck",
|
|
182
185
|
"format": "biome format --write src examples",
|
|
183
186
|
"format:check": "biome ci src examples",
|
|
184
|
-
"lint": "
|
|
185
|
-
"lint:fix": "
|
|
187
|
+
"lint": "oxlint --quiet",
|
|
188
|
+
"lint:fix": "oxlint --fix",
|
|
186
189
|
"watch": "tsc -p tsconfig.build.json --watch",
|
|
187
190
|
"test": "vitest run",
|
|
188
191
|
"test:unit": "vitest run",
|