@n8n/agents 0.26.3 → 0.27.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.
Files changed (70) hide show
  1. package/dist/build.tsbuildinfo +1 -1
  2. package/dist/runtime/loop/agent-runtime.d.ts +24 -51
  3. package/dist/runtime/loop/agent-runtime.js +321 -318
  4. package/dist/runtime/loop/agent-runtime.js.map +1 -1
  5. package/dist/runtime/loop/checkpoint-data.d.ts +12 -0
  6. package/dist/runtime/loop/checkpoint-data.js +65 -0
  7. package/dist/runtime/loop/checkpoint-data.js.map +1 -0
  8. package/dist/runtime/loop/execution-counter.js +1 -5
  9. package/dist/runtime/loop/execution-counter.js.map +1 -1
  10. package/dist/runtime/loop/generate-sink.d.ts +2 -2
  11. package/dist/runtime/loop/generate-sink.js +3 -5
  12. package/dist/runtime/loop/generate-sink.js.map +1 -1
  13. package/dist/runtime/loop/run-output-sink.d.ts +3 -78
  14. package/dist/runtime/loop/run-output-sink.js +7 -0
  15. package/dist/runtime/loop/run-output-sink.js.map +1 -1
  16. package/dist/runtime/loop/runtime-context.d.ts +17 -1
  17. package/dist/runtime/loop/runtime-context.js +49 -20
  18. package/dist/runtime/loop/runtime-context.js.map +1 -1
  19. package/dist/runtime/loop/runtime-helpers.d.ts +1 -1
  20. package/dist/runtime/loop/stream-sink.d.ts +9 -2
  21. package/dist/runtime/loop/stream-sink.js +78 -56
  22. package/dist/runtime/loop/stream-sink.js.map +1 -1
  23. package/dist/runtime/memory/memory-orchestrator.d.ts +1 -1
  24. package/dist/runtime/memory/memory-orchestrator.js +8 -8
  25. package/dist/runtime/memory/memory-orchestrator.js.map +1 -1
  26. package/dist/runtime/memory/memory-store.d.ts +1 -1
  27. package/dist/runtime/memory/memory-store.js +7 -2
  28. package/dist/runtime/memory/memory-store.js.map +1 -1
  29. package/dist/runtime/memory/tool-result-memory.d.ts +7 -0
  30. package/dist/runtime/memory/tool-result-memory.js +65 -0
  31. package/dist/runtime/memory/tool-result-memory.js.map +1 -0
  32. package/dist/runtime/model/messages.js +20 -9
  33. package/dist/runtime/model/messages.js.map +1 -1
  34. package/dist/runtime/model/raw-error.d.ts +1 -1
  35. package/dist/runtime/state/run-state.d.ts +2 -2
  36. package/dist/runtime/state/run-state.js +4 -4
  37. package/dist/runtime/state/run-state.js.map +1 -1
  38. package/dist/runtime/telemetry/runtime-telemetry.d.ts +1 -1
  39. package/dist/runtime/tools/delegate-sub-agent-runner.d.ts +13 -0
  40. package/dist/runtime/tools/delegate-sub-agent-runner.js +361 -0
  41. package/dist/runtime/tools/delegate-sub-agent-runner.js.map +1 -0
  42. package/dist/runtime/tools/delegate-sub-agent-tool.d.ts +5 -241
  43. package/dist/runtime/tools/delegate-sub-agent-tool.js +94 -487
  44. package/dist/runtime/tools/delegate-sub-agent-tool.js.map +1 -1
  45. package/dist/runtime/tools/tool-adapter.js +28 -28
  46. package/dist/runtime/tools/tool-adapter.js.map +1 -1
  47. package/dist/runtime/tools/tool-call-executor.d.ts +19 -86
  48. package/dist/runtime/tools/tool-call-executor.js +236 -579
  49. package/dist/runtime/tools/tool-call-executor.js.map +1 -1
  50. package/dist/runtime/tools/tool-call-runner.d.ts +25 -0
  51. package/dist/runtime/tools/tool-call-runner.js +328 -0
  52. package/dist/runtime/tools/tool-call-runner.js.map +1 -0
  53. package/dist/runtime/tools/tool-result-guard.d.ts +2 -7
  54. package/dist/runtime/tools/tool-result-guard.js +13 -70
  55. package/dist/runtime/tools/tool-result-guard.js.map +1 -1
  56. package/dist/types/runtime/agent-loop.d.ts +73 -0
  57. package/dist/types/runtime/agent-loop.js +3 -0
  58. package/dist/types/runtime/agent-loop.js.map +1 -0
  59. package/dist/types/runtime/agent-runtime.d.ts +51 -0
  60. package/dist/types/runtime/agent-runtime.js +3 -0
  61. package/dist/types/runtime/agent-runtime.js.map +1 -0
  62. package/dist/types/runtime/delegation.d.ts +234 -0
  63. package/dist/types/runtime/delegation.js +82 -0
  64. package/dist/types/runtime/delegation.js.map +1 -0
  65. package/dist/types/runtime/tool-execution.d.ts +103 -0
  66. package/dist/types/runtime/tool-execution.js +3 -0
  67. package/dist/types/runtime/tool-execution.js.map +1 -0
  68. package/dist/types/sdk/agent-builder.d.ts +1 -1
  69. package/dist/types/sdk/memory.d.ts +2 -1
  70. package/package.json +6 -6
@@ -1,55 +1,8 @@
1
- import type { ProviderOptions } from '@ai-sdk/provider-utils';
2
- import type { JSONSchema7 } from 'json-schema';
3
- import type { z } from 'zod';
4
- import { type ModelCost } from '../../sdk/catalog';
5
- import type { RuntimeSkillSource } from '../../skills/types';
6
- import type { BuiltFileStore, BuiltMemory, BuiltProviderTool, BuiltTelemetry, BuiltTool, CheckpointStore, EpisodicMemoryConfig, GenerateResult, McpConnectionFailedEvent, ObservationalMemoryConfig, ObservationLogMemoryConfig, RunOptions, ReasoningLevel, SerializableAgentState, StreamResult, ThinkingConfig, TitleGenerationConfig } from '../../types';
7
- import type { AgentPersistenceOptions, ExecutionOptions, ModelConfig, PromptCachingConfig, ResumeOptions } from '../../types/sdk/agent';
1
+ import type { BuiltTelemetry, GenerateResult, RunOptions, SerializableAgentState, StreamResult } from '../../types';
2
+ import type { AgentRuntimeConfig } from '../../types/runtime/agent-runtime';
3
+ import type { ExecutionOptions, ResumeOptions } from '../../types/sdk/agent';
8
4
  import type { AgentMessage } from '../../types/sdk/message';
9
- import { type WorkspaceFilesystem } from '../../workspace';
10
- import type { ScopedMemoryTaskEvent } from '../memory/scoped-memory-task-runner';
11
- import { type FetchFn } from '../model/model-factory';
12
- import { AgentEventBus } from '../state/event-bus';
13
- import { RunStateManager } from '../state/run-state';
14
- export interface VolatileInstructionsContext {
15
- persistence?: AgentPersistenceOptions;
16
- }
17
- export type VolatileInstructionsProvider = (context: VolatileInstructionsContext) => Promise<string | undefined>;
18
- export interface AgentRuntimeConfig {
19
- name: string;
20
- model: ModelConfig;
21
- modelFetch?: FetchFn;
22
- instructions: string;
23
- skillSource?: RuntimeSkillSource;
24
- instructionProviderOptions?: ProviderOptions;
25
- tools?: BuiltTool[];
26
- deferredTools?: BuiltTool[];
27
- workspaceFilesystem?: WorkspaceFilesystem;
28
- toolSearch?: {
29
- topK?: number;
30
- };
31
- providerTools?: BuiltProviderTool[];
32
- memory?: BuiltMemory;
33
- fileStore?: BuiltFileStore;
34
- observationLog?: ObservationLogMemoryConfig;
35
- observationalMemory?: ObservationalMemoryConfig;
36
- episodicMemory?: EpisodicMemoryConfig;
37
- structuredOutput?: z.ZodType | JSONSchema7;
38
- checkpointStorage?: 'memory' | CheckpointStore;
39
- thinking?: ThinkingConfig;
40
- reasoning?: ReasoningLevel;
41
- promptCaching?: PromptCachingConfig;
42
- eventBus?: AgentEventBus;
43
- toolCallConcurrency?: number;
44
- titleGeneration?: TitleGenerationConfig;
45
- telemetry?: BuiltTelemetry;
46
- runId?: string;
47
- modelCost?: ModelCost;
48
- runState?: RunStateManager;
49
- onMemoryTaskEvent?: (event: ScopedMemoryTaskEvent) => void;
50
- mcpConnectionFailures?: McpConnectionFailedEvent[];
51
- volatileInstructionsProvider?: VolatileInstructionsProvider;
52
- }
5
+ export type { AgentRuntimeConfig, VolatileInstructionsContext, VolatileInstructionsProvider, } from '../../types/runtime/agent-runtime';
53
6
  export declare class AgentRuntime {
54
7
  private config;
55
8
  private runState;
@@ -77,6 +30,13 @@ export declare class AgentRuntime {
77
30
  runId: string;
78
31
  contextNotes?: string[];
79
32
  } & ExecutionOptions): Promise<StreamResult>;
33
+ private prepareToolResume;
34
+ private handleResumeFailure;
35
+ private restoreCheckpointMessages;
36
+ private prepareResumeMemory;
37
+ private generateResumedRun;
38
+ private createResumedStream;
39
+ private loadStepCheckpoint;
80
40
  private buildMessageList;
81
41
  private initRun;
82
42
  private finalizeGenerate;
@@ -85,8 +45,21 @@ export declare class AgentRuntime {
85
45
  private createRunServices;
86
46
  private maybeGenerateTitle;
87
47
  private runAgentLoop;
48
+ private prepareLoop;
49
+ private canDiscardRejectedInput;
50
+ private buildToolBatchContext;
51
+ private resumePendingTools;
52
+ private runLoopIteration;
53
+ private prepareModelCall;
54
+ private createInputRejectionHandler;
55
+ private callModelWithRetries;
56
+ private recordTurnUsage;
57
+ private finishToolBatch;
58
+ private cleanupFailedSuspension;
59
+ private completeToolTurn;
88
60
  private resolveVolatileInstructions;
89
61
  private startStream;
62
+ private writeMcpConnectionWarnings;
90
63
  private persistSuspension;
91
64
  private persistStepCheckpoint;
92
65
  private cleanupRun;