@n8n/agents 0.8.1 → 0.9.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 +10 -2
- package/dist/index.js +57 -4
- package/dist/index.js.map +1 -1
- package/dist/integrations/langsmith.js +28 -2
- package/dist/integrations/langsmith.js.map +1 -1
- package/dist/runtime/agent-runtime.d.ts +12 -1
- package/dist/runtime/agent-runtime.js +243 -119
- package/dist/runtime/agent-runtime.js.map +1 -1
- package/dist/runtime/episodic-memory-defaults.d.ts +17 -0
- package/dist/runtime/episodic-memory-defaults.js +615 -0
- package/dist/runtime/episodic-memory-defaults.js.map +1 -0
- package/dist/runtime/episodic-memory.d.ts +45 -0
- package/dist/runtime/episodic-memory.js +479 -0
- package/dist/runtime/episodic-memory.js.map +1 -0
- package/dist/runtime/execution-counter.d.ts +9 -0
- package/dist/runtime/execution-counter.js +16 -0
- package/dist/runtime/execution-counter.js.map +1 -0
- package/dist/runtime/fix-tool-call.d.ts +7 -0
- package/dist/runtime/fix-tool-call.js +38 -0
- package/dist/runtime/fix-tool-call.js.map +1 -0
- package/dist/runtime/lazy-ai.d.ts +2 -0
- package/dist/runtime/lazy-ai.js +12 -0
- package/dist/runtime/lazy-ai.js.map +1 -0
- package/dist/runtime/mcp-connection.d.ts +1 -1
- package/dist/runtime/mcp-connection.js +71 -16
- package/dist/runtime/mcp-connection.js.map +1 -1
- package/dist/runtime/memory-lifecycle.d.ts +34 -0
- package/dist/runtime/memory-lifecycle.js +63 -0
- package/dist/runtime/memory-lifecycle.js.map +1 -0
- package/dist/runtime/memory-store.d.ts +22 -7
- package/dist/runtime/memory-store.js +240 -50
- package/dist/runtime/memory-store.js.map +1 -1
- package/dist/runtime/message-list.d.ts +1 -0
- package/dist/runtime/message-list.js +5 -0
- package/dist/runtime/message-list.js.map +1 -1
- package/dist/runtime/messages.js +14 -1
- package/dist/runtime/messages.js.map +1 -1
- package/dist/runtime/model-factory.d.ts +5 -1
- package/dist/runtime/model-factory.js +3 -2
- package/dist/runtime/model-factory.js.map +1 -1
- package/dist/runtime/observation-log-defaults.js +6 -5
- package/dist/runtime/observation-log-defaults.js.map +1 -1
- package/dist/runtime/observation-log-observer.d.ts +7 -13
- package/dist/runtime/observation-log-observer.js +11 -21
- package/dist/runtime/observation-log-observer.js.map +1 -1
- package/dist/runtime/observation-log-reflector.d.ts +5 -5
- package/dist/runtime/observation-log-reflector.js +9 -21
- package/dist/runtime/observation-log-reflector.js.map +1 -1
- package/dist/runtime/scoped-memory-task-runner.d.ts +2 -4
- package/dist/runtime/scoped-memory-task-runner.js +3 -7
- package/dist/runtime/scoped-memory-task-runner.js.map +1 -1
- package/dist/runtime/stream.js +11 -1
- package/dist/runtime/stream.js.map +1 -1
- package/dist/runtime/title-generation.d.ts +5 -2
- package/dist/runtime/title-generation.js +7 -3
- package/dist/runtime/title-generation.js.map +1 -1
- package/dist/runtime/tool-adapter.d.ts +1 -1
- package/dist/runtime/tool-adapter.js +5 -4
- package/dist/runtime/tool-adapter.js.map +1 -1
- package/dist/sdk/agent.d.ts +10 -0
- package/dist/sdk/agent.js +77 -11
- package/dist/sdk/agent.js.map +1 -1
- package/dist/sdk/memory.d.ts +6 -2
- package/dist/sdk/memory.js +57 -3
- package/dist/sdk/memory.js.map +1 -1
- package/dist/sdk/telemetry.d.ts +1 -0
- package/dist/sdk/telemetry.js +7 -0
- package/dist/sdk/telemetry.js.map +1 -1
- package/dist/skills/index.d.ts +6 -0
- package/dist/skills/index.js +29 -0
- package/dist/skills/index.js.map +1 -0
- package/dist/skills/prompt.d.ts +6 -0
- package/dist/skills/prompt.js +49 -0
- package/dist/skills/prompt.js.map +1 -0
- package/dist/skills/registry.d.ts +14 -0
- package/dist/skills/registry.js +380 -0
- package/dist/skills/registry.js.map +1 -0
- package/dist/skills/tools.d.ts +6 -0
- package/dist/skills/tools.js +312 -0
- package/dist/skills/tools.js.map +1 -0
- package/dist/skills/types.d.ts +141 -0
- package/dist/skills/types.js +15 -0
- package/dist/skills/types.js.map +1 -0
- package/dist/skills/validator.d.ts +15 -0
- package/dist/skills/validator.js +336 -0
- package/dist/skills/validator.js.map +1 -0
- package/dist/types/index.d.ts +4 -4
- package/dist/types/index.js +1 -3
- package/dist/types/index.js.map +1 -1
- package/dist/types/runtime/event.d.ts +1 -1
- package/dist/types/sdk/agent-builder.d.ts +4 -1
- package/dist/types/sdk/agent.d.ts +2 -1
- package/dist/types/sdk/memory.d.ts +153 -2
- package/dist/types/sdk/observation-log.d.ts +7 -10
- package/dist/types/sdk/observation-log.js +0 -9
- package/dist/types/sdk/observation-log.js.map +1 -1
- package/dist/types/sdk/observation.d.ts +1 -4
- package/dist/workspace/tools/execute-command.js +2 -0
- package/dist/workspace/tools/execute-command.js.map +1 -1
- package/dist/workspace/types.d.ts +1 -0
- package/dist/workspace/types.js.map +1 -1
- package/package.json +28 -3
|
@@ -1,15 +1,12 @@
|
|
|
1
|
+
import type { AgentExecutionCounter } from './agent';
|
|
1
2
|
import type { AgentDbMessage } from './message';
|
|
2
3
|
export declare const OBSERVATION_LOG_MARKERS: readonly ["critical", "important", "info", "completion"];
|
|
3
4
|
export type ObservationLogMarker = (typeof OBSERVATION_LOG_MARKERS)[number];
|
|
4
5
|
export declare const OBSERVATION_LOG_STATUSES: readonly ["active", "superseded", "dropped"];
|
|
5
6
|
export type ObservationLogStatus = (typeof OBSERVATION_LOG_STATUSES)[number];
|
|
6
|
-
export type ObservationLogScopeKind = 'thread' | 'resource';
|
|
7
7
|
export type ObservationLogTaskKind = 'observer' | 'reflector';
|
|
8
|
-
export declare function createObservationLogThreadScopeId(threadId: string, resourceId: string): string;
|
|
9
|
-
export declare function createObservationLogThreadScopePrefix(threadId: string): string;
|
|
10
8
|
export interface ObservationLogScope {
|
|
11
|
-
|
|
12
|
-
scopeId: string;
|
|
9
|
+
observationScopeId: string;
|
|
13
10
|
}
|
|
14
11
|
export interface ObservationLogTaskLockHandle extends ObservationLogScope {
|
|
15
12
|
taskKind: ObservationLogTaskKind;
|
|
@@ -59,24 +56,24 @@ export interface ObservationLogReflectionResult {
|
|
|
59
56
|
export type TokenCounter = (text: string) => number;
|
|
60
57
|
export declare const estimateObservationTokens: TokenCounter;
|
|
61
58
|
export interface ObservationLogObserverInput {
|
|
62
|
-
|
|
63
|
-
scopeId: string;
|
|
59
|
+
observationScopeId: string;
|
|
64
60
|
now: Date;
|
|
65
61
|
deltaMessages: AgentDbMessage[];
|
|
66
62
|
transcript: string;
|
|
67
63
|
transcriptTokenCount: number;
|
|
68
64
|
observationLogTail: ObservationLogEntry[];
|
|
69
65
|
renderedObservationLogTail: string | null;
|
|
66
|
+
executionCounter?: AgentExecutionCounter;
|
|
70
67
|
}
|
|
71
68
|
export type ObservationLogObserveFn = (input: ObservationLogObserverInput) => Promise<string>;
|
|
72
69
|
export interface ObservationLogReflectorInput {
|
|
73
|
-
|
|
74
|
-
scopeId: string;
|
|
70
|
+
observationScopeId: string;
|
|
75
71
|
now: Date;
|
|
76
72
|
activeObservationLog: ObservationLogEntry[];
|
|
77
73
|
renderedObservationLog: string;
|
|
78
74
|
tokenCount: number;
|
|
79
75
|
tokenBudget: number;
|
|
76
|
+
executionCounter?: AgentExecutionCounter;
|
|
80
77
|
}
|
|
81
78
|
export type ObservationLogReflectFn = (input: ObservationLogReflectorInput) => Promise<string>;
|
|
82
79
|
export interface BuiltObservationLogStore {
|
|
@@ -91,7 +88,7 @@ export interface BuiltObservationLogStore {
|
|
|
91
88
|
applyObservationLogReflection(scope: ObservationLogScope, reflection: ObservationLogReflection): Promise<ObservationLogReflectionResult>;
|
|
92
89
|
}
|
|
93
90
|
export interface BuiltObservationLogTaskLockStore {
|
|
94
|
-
acquireObservationLogTaskLock(
|
|
91
|
+
acquireObservationLogTaskLock(observationScopeId: string, taskKind: ObservationLogTaskKind, opts: {
|
|
95
92
|
ttlMs: number;
|
|
96
93
|
holderId: string;
|
|
97
94
|
}): Promise<ObservationLogTaskLockHandle | null>;
|
|
@@ -1,17 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.estimateObservationTokens = exports.OBSERVATION_LOG_STATUSES = exports.OBSERVATION_LOG_MARKERS = void 0;
|
|
4
|
-
exports.createObservationLogThreadScopeId = createObservationLogThreadScopeId;
|
|
5
|
-
exports.createObservationLogThreadScopePrefix = createObservationLogThreadScopePrefix;
|
|
6
4
|
exports.OBSERVATION_LOG_MARKERS = ['critical', 'important', 'info', 'completion'];
|
|
7
5
|
exports.OBSERVATION_LOG_STATUSES = ['active', 'superseded', 'dropped'];
|
|
8
|
-
const OBSERVATION_LOG_THREAD_SCOPE_PREFIX = 'thread';
|
|
9
|
-
function createObservationLogThreadScopeId(threadId, resourceId) {
|
|
10
|
-
return `${OBSERVATION_LOG_THREAD_SCOPE_PREFIX}:${encodeURIComponent(threadId)}:resource:${encodeURIComponent(resourceId)}`;
|
|
11
|
-
}
|
|
12
|
-
function createObservationLogThreadScopePrefix(threadId) {
|
|
13
|
-
return `${OBSERVATION_LOG_THREAD_SCOPE_PREFIX}:${encodeURIComponent(threadId)}:resource:`;
|
|
14
|
-
}
|
|
15
6
|
const estimateObservationTokens = (text) => Math.ceil(text.length / 4);
|
|
16
7
|
exports.estimateObservationTokens = estimateObservationTokens;
|
|
17
8
|
//# sourceMappingURL=observation-log.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"observation-log.js","sourceRoot":"","sources":["../../../src/types/sdk/observation-log.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"observation-log.js","sourceRoot":"","sources":["../../../src/types/sdk/observation-log.ts"],"names":[],"mappings":";;;AAGa,QAAA,uBAAuB,GAAG,CAAC,UAAU,EAAE,WAAW,EAAE,MAAM,EAAE,YAAY,CAAU,CAAC;AAInF,QAAA,wBAAwB,GAAG,CAAC,QAAQ,EAAE,YAAY,EAAE,SAAS,CAAU,CAAC;AAgE9E,MAAM,yBAAyB,GAAiB,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AAA/E,QAAA,yBAAyB,6BAAsD"}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import type { ObservationLogScopeKind } from './observation-log';
|
|
2
|
-
export type ScopeKind = ObservationLogScopeKind;
|
|
3
1
|
export interface ObservationCursor {
|
|
4
|
-
|
|
5
|
-
scopeId: string;
|
|
2
|
+
observationScopeId: string;
|
|
6
3
|
lastObservedMessageId: string;
|
|
7
4
|
lastObservedAt: Date;
|
|
8
5
|
updatedAt: Date;
|
|
@@ -22,8 +22,10 @@ function createExecuteCommandTool(sandbox) {
|
|
|
22
22
|
if (!sandbox.executeCommand) {
|
|
23
23
|
throw new Error('Sandbox does not support command execution');
|
|
24
24
|
}
|
|
25
|
+
const env = sandbox.getDefaultCommandEnv?.();
|
|
25
26
|
const result = await sandbox.executeCommand(input.command, undefined, {
|
|
26
27
|
cwd: input.cwd,
|
|
28
|
+
...(env ? { env } : {}),
|
|
27
29
|
timeout: input.timeout,
|
|
28
30
|
});
|
|
29
31
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execute-command.js","sourceRoot":"","sources":["../../../src/workspace/tools/execute-command.ts"],"names":[],"mappings":";;AAMA,
|
|
1
|
+
{"version":3,"file":"execute-command.js","sourceRoot":"","sources":["../../../src/workspace/tools/execute-command.ts"],"names":[],"mappings":";;AAMA,4DAsCC;AA5CD,6BAAwB;AAExB,yCAAsC;AAItC,SAAgB,wBAAwB,CAAC,OAAyB;IACjE,OAAO,IAAI,WAAI,CAAC,2BAA2B,CAAC;SAC1C,WAAW,CAAC,wCAAwC,CAAC;SACrD,KAAK,CACL,OAAC,CAAC,MAAM,CAAC;QACR,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,8BAA8B,CAA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
@@ -102,6 +102,7 @@ export interface WorkspaceSandbox {
|
|
|
102
102
|
readonly provider: string;
|
|
103
103
|
status: ProviderStatus;
|
|
104
104
|
getInstructions?(): string;
|
|
105
|
+
getDefaultCommandEnv?(): NodeJS.ProcessEnv;
|
|
105
106
|
executeCommand?(command: string, args?: string[], options?: ExecuteCommandOptions): Promise<CommandResult>;
|
|
106
107
|
readonly processes?: SandboxProcessManager;
|
|
107
108
|
start?(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/workspace/types.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/workspace/types.ts"],"names":[],"mappings":";;;AAyJA,qCAAiE;AAAxD,gHAAA,qBAAqB,OAAA;AAAE,wGAAA,aAAa,OAAA"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@n8n/agents",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"description": "AI agent SDK for n8n's code-first execution engine",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
|
+
"typesVersions": {
|
|
9
|
+
"*": {
|
|
10
|
+
"tool": [
|
|
11
|
+
"dist/sdk/tool.d.ts"
|
|
12
|
+
],
|
|
13
|
+
"catalog": [
|
|
14
|
+
"dist/sdk/catalog.d.ts"
|
|
15
|
+
]
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"types": "./dist/index.d.ts",
|
|
21
|
+
"default": "./dist/index.js"
|
|
22
|
+
},
|
|
23
|
+
"./tool": {
|
|
24
|
+
"types": "./dist/sdk/tool.d.ts",
|
|
25
|
+
"default": "./dist/sdk/tool.js"
|
|
26
|
+
},
|
|
27
|
+
"./catalog": {
|
|
28
|
+
"types": "./dist/sdk/catalog.d.ts",
|
|
29
|
+
"default": "./dist/sdk/catalog.js"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
8
32
|
"files": [
|
|
9
33
|
"dist/**/*",
|
|
10
34
|
"LICENSE.md",
|
|
@@ -12,7 +36,7 @@
|
|
|
12
36
|
],
|
|
13
37
|
"dependencies": {
|
|
14
38
|
"@ai-sdk/amazon-bedrock": "^4.0.95",
|
|
15
|
-
"@ai-sdk/anthropic": "
|
|
39
|
+
"@ai-sdk/anthropic": "3.0.58",
|
|
16
40
|
"@ai-sdk/azure": "^3.0.54",
|
|
17
41
|
"@ai-sdk/cohere": "^3.0.30",
|
|
18
42
|
"@ai-sdk/deepseek": "^2.0.29",
|
|
@@ -27,8 +51,9 @@
|
|
|
27
51
|
"@openrouter/ai-sdk-provider": "^2.8.0",
|
|
28
52
|
"ai": "^6.0.116",
|
|
29
53
|
"ajv": "^8.18.0",
|
|
54
|
+
"yaml": "2.8.3",
|
|
30
55
|
"zod": "3.25.67",
|
|
31
|
-
"@n8n/ai-utilities": "0.
|
|
56
|
+
"@n8n/ai-utilities": "0.17.0"
|
|
32
57
|
},
|
|
33
58
|
"peerDependencies": {
|
|
34
59
|
"@opentelemetry/exporter-trace-otlp-http": ">=0.50.0",
|