@n8n/agents 0.5.2 → 0.7.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.
Files changed (114) hide show
  1. package/dist/build.tsbuildinfo +1 -1
  2. package/dist/index.d.ts +12 -8
  3. package/dist/index.js +10 -3
  4. package/dist/index.js.map +1 -1
  5. package/dist/integrations/langsmith.d.ts +2 -0
  6. package/dist/integrations/langsmith.js +117 -2
  7. package/dist/integrations/langsmith.js.map +1 -1
  8. package/dist/runtime/agent-runtime.d.ts +6 -0
  9. package/dist/runtime/agent-runtime.js +291 -80
  10. package/dist/runtime/agent-runtime.js.map +1 -1
  11. package/dist/runtime/event-bus.d.ts +2 -0
  12. package/dist/runtime/event-bus.js +7 -0
  13. package/dist/runtime/event-bus.js.map +1 -1
  14. package/dist/runtime/json-value.d.ts +2 -0
  15. package/dist/runtime/json-value.js +43 -0
  16. package/dist/runtime/json-value.js.map +1 -0
  17. package/dist/runtime/memory-store.d.ts +40 -2
  18. package/dist/runtime/memory-store.js +138 -3
  19. package/dist/runtime/memory-store.js.map +1 -1
  20. package/dist/runtime/message-list.d.ts +5 -0
  21. package/dist/runtime/message-list.js +47 -0
  22. package/dist/runtime/message-list.js.map +1 -1
  23. package/dist/runtime/messages.d.ts +0 -2
  24. package/dist/runtime/messages.js +127 -101
  25. package/dist/runtime/messages.js.map +1 -1
  26. package/dist/runtime/model-factory.js +117 -34
  27. package/dist/runtime/model-factory.js.map +1 -1
  28. package/dist/runtime/provider-credentials.d.ts +167 -0
  29. package/dist/runtime/provider-credentials.js +34 -0
  30. package/dist/runtime/provider-credentials.js.map +1 -0
  31. package/dist/runtime/run-state.js.map +1 -1
  32. package/dist/runtime/runtime-helpers.d.ts +3 -4
  33. package/dist/runtime/runtime-helpers.js +6 -32
  34. package/dist/runtime/runtime-helpers.js.map +1 -1
  35. package/dist/runtime/stream.js +25 -43
  36. package/dist/runtime/stream.js.map +1 -1
  37. package/dist/runtime/strip-orphaned-tool-messages.js +1 -25
  38. package/dist/runtime/strip-orphaned-tool-messages.js.map +1 -1
  39. package/dist/runtime/title-generation.d.ts +12 -3
  40. package/dist/runtime/title-generation.js +72 -3
  41. package/dist/runtime/title-generation.js.map +1 -1
  42. package/dist/runtime/tool-adapter.d.ts +1 -1
  43. package/dist/runtime/tool-adapter.js +3 -2
  44. package/dist/runtime/tool-adapter.js.map +1 -1
  45. package/dist/runtime/working-memory.d.ts +1 -1
  46. package/dist/runtime/working-memory.js +1 -1
  47. package/dist/runtime/working-memory.js.map +1 -1
  48. package/dist/sdk/agent.d.ts +19 -15
  49. package/dist/sdk/agent.js +22 -201
  50. package/dist/sdk/agent.js.map +1 -1
  51. package/dist/sdk/eval.d.ts +0 -3
  52. package/dist/sdk/eval.js +4 -9
  53. package/dist/sdk/eval.js.map +1 -1
  54. package/dist/sdk/provider-capabilities.js +4 -2
  55. package/dist/sdk/provider-capabilities.js.map +1 -1
  56. package/dist/sdk/provider-tools.d.ts +17 -2
  57. package/dist/sdk/provider-tools.js +19 -0
  58. package/dist/sdk/provider-tools.js.map +1 -1
  59. package/dist/sdk/telemetry.d.ts +2 -0
  60. package/dist/sdk/telemetry.js +6 -0
  61. package/dist/sdk/telemetry.js.map +1 -1
  62. package/dist/sdk/tool.d.ts +17 -10
  63. package/dist/sdk/tool.js +34 -0
  64. package/dist/sdk/tool.js.map +1 -1
  65. package/dist/sdk/verify.js +1 -4
  66. package/dist/sdk/verify.js.map +1 -1
  67. package/dist/storage/base-memory.d.ts +64 -0
  68. package/dist/storage/base-memory.js +54 -0
  69. package/dist/storage/base-memory.js.map +1 -0
  70. package/dist/storage/postgres-memory.d.ts +33 -16
  71. package/dist/storage/postgres-memory.js +46 -25
  72. package/dist/storage/postgres-memory.js.map +1 -1
  73. package/dist/storage/sqlite-memory.d.ts +16 -6
  74. package/dist/storage/sqlite-memory.js +16 -10
  75. package/dist/storage/sqlite-memory.js.map +1 -1
  76. package/dist/types/index.d.ts +4 -2
  77. package/dist/types/index.js +3 -1
  78. package/dist/types/index.js.map +1 -1
  79. package/dist/types/runtime/event.d.ts +2 -2
  80. package/dist/types/sdk/agent-builder.d.ts +0 -3
  81. package/dist/types/sdk/agent.d.ts +63 -25
  82. package/dist/types/sdk/credential-provider.d.ts +2 -3
  83. package/dist/types/sdk/memory.d.ts +23 -2
  84. package/dist/types/sdk/message.d.ts +11 -10
  85. package/dist/types/sdk/observation.d.ts +100 -0
  86. package/dist/types/sdk/observation.js +5 -0
  87. package/dist/types/sdk/observation.js.map +1 -0
  88. package/dist/types/sdk/tool-descriptor.d.ts +13 -0
  89. package/dist/types/sdk/{schema.js → tool-descriptor.js} +1 -1
  90. package/dist/types/sdk/tool-descriptor.js.map +1 -0
  91. package/dist/types/sdk/tool.d.ts +8 -3
  92. package/dist/types/telemetry.d.ts +1 -0
  93. package/dist/utils/parse.d.ts +10 -0
  94. package/dist/utils/parse.js +26 -0
  95. package/dist/utils/parse.js.map +1 -0
  96. package/dist/utils/zod.d.ts +1 -1
  97. package/dist/utils/zod.js.map +1 -1
  98. package/dist/workspace/tools/batch-str-replace-file.d.ts +3 -0
  99. package/dist/workspace/tools/batch-str-replace-file.js +67 -0
  100. package/dist/workspace/tools/batch-str-replace-file.js.map +1 -0
  101. package/dist/workspace/tools/str-replace-file.d.ts +3 -0
  102. package/dist/workspace/tools/str-replace-file.js +51 -0
  103. package/dist/workspace/tools/str-replace-file.js.map +1 -0
  104. package/dist/workspace/tools/workspace-tools.js +4 -0
  105. package/dist/workspace/tools/workspace-tools.js.map +1 -1
  106. package/package.json +17 -8
  107. package/dist/codegen/generate-agent-code.d.ts +0 -2
  108. package/dist/codegen/generate-agent-code.js +0 -197
  109. package/dist/codegen/generate-agent-code.js.map +0 -1
  110. package/dist/sdk/from-schema.d.ts +0 -15
  111. package/dist/sdk/from-schema.js +0 -218
  112. package/dist/sdk/from-schema.js.map +0 -1
  113. package/dist/types/sdk/schema.d.ts +0 -99
  114. package/dist/types/sdk/schema.js.map +0 -1
@@ -1,218 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isSuspendResult = isSuspendResult;
4
- exports.fromSchema = fromSchema;
5
- const mcp_client_1 = require("./mcp-client");
6
- const memory_1 = require("./memory");
7
- const tool_1 = require("./tool");
8
- const SUSPEND_MARKER = Symbol.for('n8n.agent.suspend');
9
- function isSuspendResult(value) {
10
- return (typeof value === 'object' &&
11
- value !== null &&
12
- value[SUSPEND_MARKER] === true);
13
- }
14
- async function fromSchema(agent, schema, options) {
15
- const { handlerExecutor } = options;
16
- applyModel(agent, schema.model);
17
- if (schema.credential !== null) {
18
- agent.credential(schema.credential);
19
- }
20
- if (schema.instructions !== null) {
21
- agent.instructions(schema.instructions);
22
- }
23
- await applyTools(agent, schema.tools, handlerExecutor);
24
- await applyProviderTools(agent, schema.providerTools, handlerExecutor);
25
- applyConfig(agent, schema.config);
26
- applyMemory(agent, schema);
27
- applyGuardrails(agent, schema.guardrails);
28
- applyEvals(agent, schema.evaluations, handlerExecutor);
29
- await applyStructuredOutput(agent, schema.config.structuredOutput, handlerExecutor);
30
- if (options.credentialProvider) {
31
- agent.credentialProvider(options.credentialProvider);
32
- }
33
- await applyMcpServers(agent, schema.mcp, handlerExecutor);
34
- await applyTelemetry(agent, schema.telemetry, handlerExecutor);
35
- }
36
- function applyModel(agent, model) {
37
- if (model.provider && model.name) {
38
- agent.model(model.provider, model.name);
39
- }
40
- else if (model.name) {
41
- agent.model(model.name);
42
- }
43
- }
44
- async function applyTools(agent, tools, executor) {
45
- const addedTools = new Set();
46
- for (const ts of tools) {
47
- if (addedTools.has(ts.name)) {
48
- throw new Error(`Schema has multiple definitions of tool ${ts.name}`);
49
- }
50
- addedTools.add(ts.name);
51
- if (!ts.editable) {
52
- agent.tool({
53
- name: ts.name,
54
- description: ts.description,
55
- __workflowTool: true,
56
- workflowName: ts.name,
57
- });
58
- continue;
59
- }
60
- const schemas = {};
61
- if (ts.suspendSchemaSource) {
62
- schemas.suspend = await executor.evaluateSchema(ts.suspendSchemaSource);
63
- }
64
- if (ts.resumeSchemaSource) {
65
- schemas.resume = await executor.evaluateSchema(ts.resumeSchemaSource);
66
- }
67
- const builtTool = buildToolFromSchema(ts, executor, schemas);
68
- agent.tool(builtTool);
69
- }
70
- }
71
- async function applyProviderTools(agent, providerTools, executor) {
72
- for (const pt of providerTools) {
73
- if (pt.source) {
74
- const evaluated = (await executor.evaluateExpression(pt.source));
75
- agent.providerTool({
76
- name: evaluated.name,
77
- args: evaluated.args ?? {},
78
- });
79
- }
80
- else {
81
- agent.providerTool({
82
- name: pt.name,
83
- args: {},
84
- });
85
- }
86
- }
87
- }
88
- function applyConfig(agent, config) {
89
- if (config.thinking !== null) {
90
- const { provider, ...thinkingConfig } = config.thinking;
91
- agent.thinking(provider, thinkingConfig);
92
- }
93
- if (config.toolCallConcurrency !== null) {
94
- agent.toolCallConcurrency(config.toolCallConcurrency);
95
- }
96
- if (config.requireToolApproval) {
97
- agent.requireToolApproval();
98
- }
99
- }
100
- function applyMemory(agent, schema) {
101
- if (schema.memory !== null) {
102
- const memory = new memory_1.Memory();
103
- if (schema.memory.lastMessages !== null) {
104
- memory.lastMessages(schema.memory.lastMessages);
105
- }
106
- agent.memory(memory);
107
- }
108
- if (schema.checkpoint !== null) {
109
- agent.checkpoint(schema.checkpoint);
110
- }
111
- }
112
- function applyGuardrails(agent, guardrails) {
113
- for (const g of guardrails) {
114
- const builtGuardrail = {
115
- name: g.name,
116
- guardType: g.guardType,
117
- strategy: g.strategy,
118
- _config: g.config,
119
- };
120
- if (g.position === 'input') {
121
- agent.inputGuardrail(builtGuardrail);
122
- }
123
- else {
124
- agent.outputGuardrail(builtGuardrail);
125
- }
126
- }
127
- }
128
- function applyEvals(agent, evaluations, executor) {
129
- for (const evalSchema of evaluations) {
130
- const builtEval = buildEvalFromSchema(evalSchema, executor);
131
- agent.eval(builtEval);
132
- }
133
- }
134
- async function applyStructuredOutput(agent, structuredOutput, executor) {
135
- if (structuredOutput.enabled && structuredOutput.schemaSource) {
136
- const outputSchema = await executor.evaluateSchema(structuredOutput.schemaSource);
137
- agent.structuredOutput(outputSchema);
138
- }
139
- }
140
- async function applyMcpServers(agent, mcp, executor) {
141
- if (!mcp || mcp.length === 0)
142
- return;
143
- const mcpConfigs = [];
144
- for (const m of mcp) {
145
- if (m.configSource) {
146
- const config = (await executor.evaluateExpression(m.configSource));
147
- mcpConfigs.push(config);
148
- }
149
- }
150
- if (mcpConfigs.length > 0) {
151
- agent.mcp(new mcp_client_1.McpClient(mcpConfigs));
152
- }
153
- }
154
- async function applyTelemetry(agent, telemetry, executor) {
155
- if (telemetry?.source) {
156
- const built = (await executor.evaluateExpression(telemetry.source));
157
- agent.telemetry(built);
158
- }
159
- }
160
- function buildToolFromSchema(toolSchema, executor, preEvaluated) {
161
- const handler = async (input, ctx) => {
162
- if (toolSchema.hasSuspend && 'suspend' in ctx) {
163
- const interruptCtx = ctx;
164
- const result = await executor.executeTool(toolSchema.name, input, {
165
- resumeData: interruptCtx.resumeData,
166
- parentTelemetry: ctx.parentTelemetry,
167
- });
168
- if (isSuspendResult(result)) {
169
- return await interruptCtx.suspend(result.payload);
170
- }
171
- return result;
172
- }
173
- return await executor.executeTool(toolSchema.name, input, {
174
- parentTelemetry: ctx.parentTelemetry,
175
- });
176
- };
177
- let toMessage;
178
- if (toolSchema.hasToMessage) {
179
- if (executor.executeToMessageSync) {
180
- const syncExecutor = executor.executeToMessageSync.bind(executor);
181
- toMessage = (output) => {
182
- return syncExecutor(toolSchema.name, output);
183
- };
184
- }
185
- else {
186
- throw new Error('Executor does not support executeToMessageSync');
187
- }
188
- }
189
- const built = {
190
- name: toolSchema.name,
191
- description: toolSchema.description,
192
- inputSchema: toolSchema.inputSchema ?? undefined,
193
- handler,
194
- toMessage,
195
- suspendSchema: preEvaluated?.suspend,
196
- resumeSchema: preEvaluated?.resume,
197
- providerOptions: toolSchema.providerOptions
198
- ? toolSchema.providerOptions
199
- : undefined,
200
- };
201
- if (toolSchema.requireApproval) {
202
- return (0, tool_1.wrapToolForApproval)(built, { requireApproval: true });
203
- }
204
- return built;
205
- }
206
- function buildEvalFromSchema(evalSchema, executor) {
207
- return {
208
- name: evalSchema.name,
209
- description: evalSchema.description ?? undefined,
210
- evalType: evalSchema.type,
211
- modelId: evalSchema.modelId ?? null,
212
- credentialName: evalSchema.credentialName ?? null,
213
- _run: async (evalInput) => {
214
- return await executor.executeEval(evalSchema.name, evalInput);
215
- },
216
- };
217
- }
218
- //# sourceMappingURL=from-schema.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"from-schema.js","sourceRoot":"","sources":["../../src/sdk/from-schema.ts"],"names":[],"mappings":";;AAsCA,0CAMC;AAgBD,gCA+BC;AAvFD,6CAAyC;AACzC,qCAAkC;AAClC,iCAA6C;AAyB7C,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;AAOvD,SAAgB,eAAe,CAAC,KAAc;IAC7C,OAAO,CACN,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACb,KAAiC,CAAC,cAAc,CAAC,KAAK,IAAI,CAC3D,CAAC;AACH,CAAC;AAgBM,KAAK,UAAU,UAAU,CAC/B,KAAmB,EACnB,MAAmB,EACnB,OAA0B;IAE1B,MAAM,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC;IAEpC,UAAU,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IAEhC,IAAI,MAAM,CAAC,UAAU,KAAK,IAAI,EAAE,CAAC;QAChC,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IACrC,CAAC;IAED,IAAI,MAAM,CAAC,YAAY,KAAK,IAAI,EAAE,CAAC;QAClC,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IACzC,CAAC;IAED,MAAM,UAAU,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,eAA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EAAE,UAAU,CAAC,IAAI;QACrB,WAAW,EAAE,UAAU,CAAC,WAAW,IAAI,SAAS;QAChD,QAAQ,EAAE,UAAU,CAAC,IAAI;QACzB,OAAO,EAAE,UAAU,CAAC,OAAO,IAAI,IAAI;QACnC,cAAc,EAAE,UAAU,CAAC,cAAc,IAAI,IAAI;QACjD,IAAI,EAAE,KAAK,EAAE,SAAoB,EAAsB,EAAE;YAIxD,OAAO,MAAM,QAAQ,CAAC,WAAW,CAAC,UAAU,CAAC,IAAI,EAAE,SAAmC,CAAC,CAAC;QACzF,CAAC;KACD,CAAC;AACH,CAAC"}
@@ -1,99 +0,0 @@
1
- import type { JSONSchema7 } from 'json-schema';
2
- export interface AgentSchema {
3
- model: {
4
- provider: string | null;
5
- name: string | null;
6
- raw?: string;
7
- };
8
- credential: string | null;
9
- instructions: string | null;
10
- description: string | null;
11
- tools: ToolSchema[];
12
- providerTools: ProviderToolSchema[];
13
- memory: MemorySchema | null;
14
- evaluations: EvalSchema[];
15
- guardrails: GuardrailSchema[];
16
- mcp: McpServerSchema[] | null;
17
- telemetry: TelemetrySchema | null;
18
- checkpoint: 'memory' | null;
19
- config: {
20
- structuredOutput: {
21
- enabled: boolean;
22
- schemaSource: string | null;
23
- };
24
- thinking: ThinkingSchema | null;
25
- toolCallConcurrency: number | null;
26
- requireToolApproval: boolean;
27
- };
28
- }
29
- export interface ToolSchema {
30
- name: string;
31
- description: string;
32
- type: 'custom' | 'workflow' | 'provider' | 'mcp';
33
- editable: boolean;
34
- inputSchemaSource: string | null;
35
- outputSchemaSource: string | null;
36
- handlerSource: string | null;
37
- suspendSchemaSource: string | null;
38
- resumeSchemaSource: string | null;
39
- toMessageSource: string | null;
40
- requireApproval: boolean;
41
- needsApprovalFnSource: string | null;
42
- providerOptions: Record<string, unknown> | null;
43
- inputSchema: JSONSchema7 | null;
44
- outputSchema: JSONSchema7 | null;
45
- hasSuspend: boolean;
46
- hasResume: boolean;
47
- hasToMessage: boolean;
48
- }
49
- export interface ProviderToolSchema {
50
- name: string;
51
- source: string;
52
- }
53
- export interface MemorySchema {
54
- source: string | null;
55
- storage: 'memory' | 'custom';
56
- lastMessages: number | null;
57
- semanticRecall: {
58
- topK: number;
59
- messageRange: {
60
- before: number;
61
- after: number;
62
- } | null;
63
- embedder: string | null;
64
- } | null;
65
- workingMemory: {
66
- type: 'structured' | 'freeform';
67
- schema?: JSONSchema7;
68
- template?: string;
69
- } | null;
70
- }
71
- export interface EvalSchema {
72
- name: string;
73
- description: string | null;
74
- type: 'check' | 'judge';
75
- modelId: string | null;
76
- credentialName: string | null;
77
- hasCredential: boolean;
78
- handlerSource: string | null;
79
- }
80
- export interface GuardrailSchema {
81
- name: string;
82
- guardType: 'pii' | 'prompt-injection' | 'moderation' | 'custom';
83
- strategy: 'block' | 'redact' | 'warn';
84
- position: 'input' | 'output';
85
- config: Record<string, unknown>;
86
- source: string;
87
- }
88
- export interface McpServerSchema {
89
- name: string;
90
- configSource: string;
91
- }
92
- export interface TelemetrySchema {
93
- source: string;
94
- }
95
- export interface ThinkingSchema {
96
- provider: 'anthropic' | 'openai';
97
- budgetTokens?: number;
98
- reasoningEffort?: string;
99
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/types/sdk/schema.ts"],"names":[],"mappings":""}