@n8n/agents 0.6.0 → 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 -7
  9. package/dist/runtime/agent-runtime.js +390 -204
  10. package/dist/runtime/agent-runtime.js.map +1 -1
  11. package/dist/runtime/event-bus.d.ts +1 -0
  12. package/dist/runtime/event-bus.js +3 -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/runtime-helpers.d.ts +3 -4
  32. package/dist/runtime/runtime-helpers.js +6 -32
  33. package/dist/runtime/runtime-helpers.js.map +1 -1
  34. package/dist/runtime/stream.js +25 -43
  35. package/dist/runtime/stream.js.map +1 -1
  36. package/dist/runtime/strip-orphaned-tool-messages.js +1 -25
  37. package/dist/runtime/strip-orphaned-tool-messages.js.map +1 -1
  38. package/dist/runtime/title-generation.d.ts +12 -3
  39. package/dist/runtime/title-generation.js +72 -3
  40. package/dist/runtime/title-generation.js.map +1 -1
  41. package/dist/runtime/tool-adapter.d.ts +1 -1
  42. package/dist/runtime/tool-adapter.js +3 -2
  43. package/dist/runtime/tool-adapter.js.map +1 -1
  44. package/dist/runtime/working-memory.d.ts +1 -1
  45. package/dist/runtime/working-memory.js +1 -1
  46. package/dist/runtime/working-memory.js.map +1 -1
  47. package/dist/sdk/agent.d.ts +24 -23
  48. package/dist/sdk/agent.js +50 -324
  49. package/dist/sdk/agent.js.map +1 -1
  50. package/dist/sdk/eval.d.ts +0 -3
  51. package/dist/sdk/eval.js +4 -9
  52. package/dist/sdk/eval.js.map +1 -1
  53. package/dist/sdk/provider-capabilities.js +4 -2
  54. package/dist/sdk/provider-capabilities.js.map +1 -1
  55. package/dist/sdk/provider-tools.d.ts +17 -2
  56. package/dist/sdk/provider-tools.js +19 -0
  57. package/dist/sdk/provider-tools.js.map +1 -1
  58. package/dist/sdk/telemetry.d.ts +2 -0
  59. package/dist/sdk/telemetry.js +6 -0
  60. package/dist/sdk/telemetry.js.map +1 -1
  61. package/dist/sdk/tool.d.ts +17 -10
  62. package/dist/sdk/tool.js +34 -0
  63. package/dist/sdk/tool.js.map +1 -1
  64. package/dist/sdk/verify.js +1 -4
  65. package/dist/sdk/verify.js.map +1 -1
  66. package/dist/storage/base-memory.d.ts +64 -0
  67. package/dist/storage/base-memory.js +54 -0
  68. package/dist/storage/base-memory.js.map +1 -0
  69. package/dist/storage/postgres-memory.d.ts +33 -16
  70. package/dist/storage/postgres-memory.js +46 -25
  71. package/dist/storage/postgres-memory.js.map +1 -1
  72. package/dist/storage/sqlite-memory.d.ts +16 -6
  73. package/dist/storage/sqlite-memory.js +16 -10
  74. package/dist/storage/sqlite-memory.js.map +1 -1
  75. package/dist/types/index.d.ts +4 -2
  76. package/dist/types/index.js +3 -1
  77. package/dist/types/index.js.map +1 -1
  78. package/dist/types/runtime/event.d.ts +3 -9
  79. package/dist/types/runtime/event.js.map +1 -1
  80. package/dist/types/sdk/agent-builder.d.ts +0 -3
  81. package/dist/types/sdk/agent.d.ts +64 -27
  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,6 +1,13 @@
1
1
  import type { z } from 'zod';
2
2
  import type { ModelConfig, SerializableAgentState } from './agent';
3
3
  import type { AgentDbMessage } from './message';
4
+ import type { BuiltObservationStore, ObservationalMemoryConfig } from './observation';
5
+ import type { JSONObject } from '../utils/json';
6
+ export interface MemoryDescriptor<TParams extends JSONObject = JSONObject> {
7
+ name: string;
8
+ constructorName: string;
9
+ connectionParams: TParams | null;
10
+ }
4
11
  export interface Thread {
5
12
  id: string;
6
13
  resourceId: string;
@@ -16,6 +23,10 @@ export interface BuiltMemory {
16
23
  getMessages(threadId: string, opts?: {
17
24
  limit?: number;
18
25
  before?: Date;
26
+ since?: {
27
+ sinceCreatedAt: Date;
28
+ sinceMessageId: string;
29
+ };
19
30
  }): Promise<AgentDbMessage[]>;
20
31
  saveMessages(args: {
21
32
  threadId: string;
@@ -65,6 +76,7 @@ export interface BuiltMemory {
65
76
  score: number;
66
77
  }>>;
67
78
  close?(): Promise<void>;
79
+ describe(): MemoryDescriptor;
68
80
  }
69
81
  export interface SemanticRecallConfig {
70
82
  scope?: 'thread' | 'resource';
@@ -79,9 +91,10 @@ export interface SemanticRecallConfig {
79
91
  export interface TitleGenerationConfig {
80
92
  model?: ModelConfig;
81
93
  instructions?: string;
94
+ sync?: boolean;
82
95
  }
83
- export interface MemoryConfig {
84
- memory: BuiltMemory;
96
+ export type ObservationCapableMemory = BuiltMemory & BuiltObservationStore;
97
+ interface MemoryConfigBase {
85
98
  lastMessages: number;
86
99
  workingMemory?: {
87
100
  template: string;
@@ -93,8 +106,16 @@ export interface MemoryConfig {
93
106
  semanticRecall?: SemanticRecallConfig;
94
107
  titleGeneration?: TitleGenerationConfig;
95
108
  }
109
+ export type MemoryConfig = (MemoryConfigBase & {
110
+ memory: BuiltMemory;
111
+ observationalMemory?: undefined;
112
+ }) | (MemoryConfigBase & {
113
+ memory: ObservationCapableMemory;
114
+ observationalMemory: ObservationalMemoryConfig;
115
+ });
96
116
  export interface CheckpointStore {
97
117
  save(key: string, state: SerializableAgentState): Promise<void>;
98
118
  load(key: string): Promise<SerializableAgentState | undefined>;
99
119
  delete(key: string): Promise<void>;
100
120
  }
121
+ export {};
@@ -1,7 +1,7 @@
1
1
  import type { ProviderOptions } from '@ai-sdk/provider-utils';
2
2
  import type { JSONValue } from '../utils/json';
3
3
  export type MessageRole = 'system' | 'user' | 'assistant' | 'tool';
4
- export type MessageContent = ContentText | ContentToolCall | ContentInvalidToolCall | ContentToolResult | ContentReasoning | ContentFile | ContentCitation | ContentProvider;
4
+ export type MessageContent = ContentText | ContentToolCall | ContentInvalidToolCall | ContentReasoning | ContentFile | ContentCitation | ContentProvider;
5
5
  export interface ContentMetadata {
6
6
  providerMetadata?: Record<string, unknown>;
7
7
  providerOptions?: ProviderOptions;
@@ -30,18 +30,19 @@ export type ContentFile = ContentMetadata & {
30
30
  };
31
31
  export type ContentToolCall = ContentMetadata & {
32
32
  type: 'tool-call';
33
- toolCallId?: string;
33
+ toolCallId: string;
34
34
  toolName: string;
35
35
  input: JSONValue;
36
36
  providerExecuted?: boolean;
37
- };
38
- export type ContentToolResult = ContentMetadata & {
39
- type: 'tool-result';
40
- toolName: string;
41
- toolCallId: string;
42
- result: JSONValue;
43
- isError?: boolean;
44
- };
37
+ } & ({
38
+ state: 'pending';
39
+ } | {
40
+ state: 'resolved';
41
+ output: JSONValue;
42
+ } | {
43
+ state: 'rejected';
44
+ error: string;
45
+ });
45
46
  export type ContentInvalidToolCall = ContentMetadata & {
46
47
  type: 'invalid-tool-call';
47
48
  toolCallId?: string;
@@ -0,0 +1,100 @@
1
+ import type { z } from 'zod';
2
+ import type { ModelConfig } from './agent';
3
+ import type { AgentDbMessage } from './message';
4
+ import type { BuiltTelemetry } from '../telemetry';
5
+ import type { JSONValue } from '../utils/json';
6
+ export declare const OBSERVATION_SCHEMA_VERSION = 1;
7
+ export type ScopeKind = 'thread' | 'resource' | 'agent';
8
+ export interface Observation {
9
+ id: string;
10
+ scopeKind: ScopeKind;
11
+ scopeId: string;
12
+ kind: string;
13
+ payload: JSONValue;
14
+ durationMs: number | null;
15
+ schemaVersion: number;
16
+ createdAt: Date;
17
+ }
18
+ export type NewObservation = Omit<Observation, 'id'>;
19
+ export interface ObservationCursor {
20
+ scopeKind: ScopeKind;
21
+ scopeId: string;
22
+ lastObservedMessageId: string;
23
+ lastObservedAt: Date;
24
+ updatedAt: Date;
25
+ }
26
+ export interface ObservationLockHandle {
27
+ scopeKind: ScopeKind;
28
+ scopeId: string;
29
+ holderId: string;
30
+ heldUntil: Date;
31
+ }
32
+ export type ObserveFn = (ctx: {
33
+ deltaMessages: AgentDbMessage[];
34
+ currentWorkingMemory: string | null;
35
+ cursor: ObservationCursor | null;
36
+ threadId: string;
37
+ resourceId: string;
38
+ now: Date;
39
+ trigger: ObservationalMemoryTrigger;
40
+ telemetry: BuiltTelemetry | undefined;
41
+ }) => Promise<NewObservation[]>;
42
+ export type CompactFn = (ctx: {
43
+ observations: Observation[];
44
+ currentWorkingMemory: string | null;
45
+ workingMemoryTemplate: string;
46
+ structured: boolean;
47
+ schema?: z.ZodObject<z.ZodRawShape>;
48
+ threadId: string;
49
+ resourceId: string;
50
+ model: ModelConfig;
51
+ compactorPrompt: string;
52
+ telemetry: BuiltTelemetry | undefined;
53
+ }) => Promise<{
54
+ content: string;
55
+ }>;
56
+ export interface BuiltObservationStore {
57
+ appendObservations(rows: NewObservation[]): Promise<Observation[]>;
58
+ getObservations(opts: {
59
+ scopeKind: ScopeKind;
60
+ scopeId: string;
61
+ since?: {
62
+ sinceCreatedAt: Date;
63
+ sinceObservationId: string;
64
+ };
65
+ kindIs?: string;
66
+ limit?: number;
67
+ schemaVersionAtMost?: number;
68
+ }): Promise<Observation[]>;
69
+ getMessagesForScope(scopeKind: ScopeKind, scopeId: string, opts?: {
70
+ since?: {
71
+ sinceCreatedAt: Date;
72
+ sinceMessageId: string;
73
+ };
74
+ }): Promise<AgentDbMessage[]>;
75
+ deleteObservations(ids: string[]): Promise<void>;
76
+ getCursor(scopeKind: ScopeKind, scopeId: string): Promise<ObservationCursor | null>;
77
+ setCursor(cursor: ObservationCursor): Promise<void>;
78
+ acquireObservationLock(scopeKind: ScopeKind, scopeId: string, opts: {
79
+ ttlMs: number;
80
+ holderId: string;
81
+ }): Promise<ObservationLockHandle | null>;
82
+ releaseObservationLock(handle: ObservationLockHandle): Promise<void>;
83
+ }
84
+ export type ObservationalMemoryTrigger = {
85
+ type: 'per-turn';
86
+ } | {
87
+ type: 'idle-timer';
88
+ idleMs: number;
89
+ gapThresholdMs?: number;
90
+ };
91
+ export interface ObservationalMemoryConfig {
92
+ observe?: ObserveFn;
93
+ compact?: CompactFn;
94
+ trigger?: ObservationalMemoryTrigger;
95
+ compactionThreshold?: number;
96
+ observerPrompt?: string;
97
+ compactorPrompt?: string;
98
+ lockTtlMs?: number;
99
+ sync?: boolean;
100
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OBSERVATION_SCHEMA_VERSION = void 0;
4
+ exports.OBSERVATION_SCHEMA_VERSION = 1;
5
+ //# sourceMappingURL=observation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"observation.js","sourceRoot":"","sources":["../../../src/types/sdk/observation.ts"],"names":[],"mappings":";;;AAYa,QAAA,0BAA0B,GAAG,CAAC,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { JSONSchema7 } from 'json-schema';
2
+ export interface ToolDescriptor {
3
+ name: string;
4
+ description: string;
5
+ systemInstruction: string | null;
6
+ inputSchema: JSONSchema7 | null;
7
+ outputSchema: JSONSchema7 | null;
8
+ hasSuspend: boolean;
9
+ hasResume: boolean;
10
+ hasToMessage: boolean;
11
+ requireApproval: boolean;
12
+ providerOptions: Record<string, unknown> | null;
13
+ }
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=schema.js.map
3
+ //# sourceMappingURL=tool-descriptor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-descriptor.js","sourceRoot":"","sources":["../../../src/types/sdk/tool-descriptor.ts"],"names":[],"mappings":""}
@@ -4,27 +4,32 @@ import type { AgentMessage } from './message';
4
4
  import type { BuiltTelemetry } from '../telemetry';
5
5
  import type { JSONObject } from '../utils/json';
6
6
  export interface ToolContext {
7
+ toolCallId?: string;
7
8
  parentTelemetry?: BuiltTelemetry;
8
9
  }
9
10
  export interface InterruptibleToolContext<S = unknown, R = unknown> {
10
11
  suspend: (payload: S) => Promise<never>;
11
12
  resumeData: R | undefined;
13
+ toolCallId?: string;
12
14
  parentTelemetry?: BuiltTelemetry;
13
15
  }
14
16
  export interface BuiltTool {
15
17
  readonly name: string;
16
18
  readonly description: string;
17
- readonly suspendSchema?: ZodType;
18
- readonly resumeSchema?: ZodType;
19
+ readonly systemInstruction?: string;
20
+ readonly suspendSchema?: ZodType | JSONSchema7;
21
+ readonly resumeSchema?: ZodType | JSONSchema7;
19
22
  readonly withDefaultApproval?: boolean;
20
23
  readonly toMessage?: (output: unknown) => AgentMessage | undefined;
21
24
  readonly toModelOutput?: (output: unknown) => unknown;
22
25
  readonly handler?: (input: unknown, ctx: ToolContext | InterruptibleToolContext) => Promise<unknown>;
23
26
  readonly inputSchema?: ZodType | JSONSchema7;
24
- readonly outputSchema?: ZodType;
27
+ readonly outputSchema?: ZodType | JSONSchema7;
25
28
  readonly mcpTool?: boolean;
26
29
  readonly mcpServerName?: string;
27
30
  readonly providerOptions?: Record<string, JSONObject>;
31
+ readonly metadata?: Record<string, unknown>;
32
+ readonly editable?: boolean;
28
33
  }
29
34
  export interface BuiltProviderTool {
30
35
  readonly name: `${string}.${string}`;
@@ -11,6 +11,7 @@ export interface BuiltTelemetry {
11
11
  readonly metadata?: Record<string, AttributeValue>;
12
12
  readonly recordInputs: boolean;
13
13
  readonly recordOutputs: boolean;
14
+ readonly runtimeRootSpanEnabled?: boolean;
14
15
  readonly integrations: TelemetryIntegration[];
15
16
  readonly tracer?: OpaqueTracer;
16
17
  readonly provider?: OpaqueTracerProvider;
@@ -0,0 +1,10 @@
1
+ import type { JSONSchema7 } from 'json-schema';
2
+ import type { ZodType } from 'zod';
3
+ export type ParseResult<T = unknown> = {
4
+ success: true;
5
+ data: T;
6
+ } | {
7
+ success: false;
8
+ error: string;
9
+ };
10
+ export declare function parseWithSchema(schema: ZodType | JSONSchema7, data: unknown): Promise<ParseResult>;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseWithSchema = parseWithSchema;
4
+ const zod_1 = require("./zod");
5
+ let ajvInstance;
6
+ function getAjv() {
7
+ if (!ajvInstance) {
8
+ const { default: Ajv } = require('ajv');
9
+ ajvInstance = new Ajv({ strict: false });
10
+ }
11
+ return ajvInstance;
12
+ }
13
+ async function parseWithSchema(schema, data) {
14
+ if ((0, zod_1.isZodSchema)(schema)) {
15
+ const result = await schema.safeParseAsync(data);
16
+ if (result.success)
17
+ return { success: true, data: result.data };
18
+ return { success: false, error: result.error.message };
19
+ }
20
+ const ajv = getAjv();
21
+ const validate = ajv.compile(schema);
22
+ if (validate(data))
23
+ return { success: true, data };
24
+ return { success: false, error: ajv.errorsText(validate.errors) };
25
+ }
26
+ //# sourceMappingURL=parse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse.js","sourceRoot":"","sources":["../../src/utils/parse.ts"],"names":[],"mappings":";;AAyBA,0CAcC;AAnCD,+BAAoC;AAMpC,IAAI,WAAqD,CAAC;AAE1D,SAAS,MAAM;IACd,IAAI,CAAC,WAAW,EAAE,CAAC;QAElB,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,KAAK,CAAgC,CAAC;QACvE,WAAW,GAAG,IAAI,GAAG,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;IAC1C,CAAC;IACD,OAAO,WAAW,CAAC;AACpB,CAAC;AAMM,KAAK,UAAU,eAAe,CACpC,MAA6B,EAC7B,IAAa;IAEb,IAAI,IAAA,iBAAW,EAAC,MAAM,CAAC,EAAE,CAAC;QACzB,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;QACjD,IAAI,MAAM,CAAC,OAAO;YAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;QAChE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;IACxD,CAAC;IAED,MAAM,GAAG,GAAG,MAAM,EAAE,CAAC;IACrB,MAAM,QAAQ,GAAG,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACrC,IAAI,QAAQ,CAAC,IAAI,CAAC;QAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IACnD,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,CAAC,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;AACnE,CAAC"}
@@ -1,4 +1,4 @@
1
1
  import type { JSONSchema7 } from 'json-schema';
2
2
  import type { ZodType } from 'zod';
3
- export declare function isZodSchema(schema: ZodType | JSONSchema7): schema is ZodType;
3
+ export declare function isZodSchema(schema: unknown): schema is ZodType;
4
4
  export declare function zodToJsonSchema(schema?: unknown): JSONSchema7 | null;
@@ -1 +1 @@
1
- {"version":3,"file":"zod.js","sourceRoot":"","sources":["../../src/utils/zod.ts"],"names":[],"mappings":";;AAKA,kCAMC;AAED,0CAgBC;AA3BD,2DAA4E;AAG5E,SAAgB,WAAW,CAAC,MAA6B;IACxD,OAAO,CACN,OAAO,MAAM,KAAK,QAAQ;QAC1B,MAAM,KAAK,IAAI;QACf,OAAQ,MAAkB,CAAC,SAAS,KAAK,UAAU,CACnD,CAAC;AACH,CAAC;AAED,SAAgB,eAA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AAI,EAAE,CAAC;YACnD,OAAO,MAAM,CAAC;QACf,CAAC;QACD,OAAO,IAAI,CAAC;IACb,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,IAAI,CAAC;IACb,CAAC;AACF,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { BuiltTool } from '../../types/sdk/tool';
2
+ import type { WorkspaceFilesystem } from '../types';
3
+ export declare function createBatchStrReplaceFileTool(filesystem: WorkspaceFilesystem): BuiltTool;
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createBatchStrReplaceFileTool = createBatchStrReplaceFileTool;
4
+ const text_editor_1 = require("@n8n/ai-utilities/text-editor");
5
+ const zod_1 = require("zod");
6
+ const tool_1 = require("../../sdk/tool");
7
+ const strReplacementSchema = zod_1.z.object({
8
+ old_str: zod_1.z.string().describe('Exact text to replace. Must match exactly and be unique.'),
9
+ new_str: zod_1.z.string().describe('Replacement text to write in place of old_str.'),
10
+ });
11
+ const inputSchema = zod_1.z.object({
12
+ path: zod_1.z.string().describe('Path to the file to edit'),
13
+ replacements: zod_1.z
14
+ .array(strReplacementSchema)
15
+ .describe('Ordered exact string replacements applied atomically.'),
16
+ });
17
+ const batchReplaceResultSchema = zod_1.z.object({
18
+ index: zod_1.z.number().int(),
19
+ old_str: zod_1.z.string(),
20
+ status: zod_1.z.enum(['success', 'failed', 'not_attempted']),
21
+ error: zod_1.z.string().optional(),
22
+ });
23
+ const outputSchema = zod_1.z.object({
24
+ success: zod_1.z.boolean().describe('Whether all replacements were applied'),
25
+ result: zod_1.z.string().optional().describe('Success message'),
26
+ error: zod_1.z.string().optional().describe('Error message when replacements could not be applied'),
27
+ results: zod_1.z
28
+ .array(batchReplaceResultSchema)
29
+ .optional()
30
+ .describe('Per-replacement statuses for a failed batch edit'),
31
+ });
32
+ function createErrorOutput(error) {
33
+ return {
34
+ success: false,
35
+ error: error instanceof Error ? error.message : 'Unknown workspace edit error.',
36
+ };
37
+ }
38
+ function isBatchReplaceResult(result) {
39
+ return Array.isArray(result);
40
+ }
41
+ function createBatchStrReplaceFileTool(filesystem) {
42
+ return new tool_1.Tool('workspace_batch_str_replace_file')
43
+ .description('Apply multiple exact text replacements to a workspace file atomically. If any replacement fails, no changes are written.')
44
+ .input(inputSchema)
45
+ .output(outputSchema)
46
+ .handler(async (input) => {
47
+ try {
48
+ const content = await filesystem.readFile(input.path, { encoding: 'utf-8' });
49
+ const editor = new text_editor_1.TextEditorDocument({ initialText: content.toString() });
50
+ const result = editor.executeBatch(input.replacements);
51
+ if (isBatchReplaceResult(result)) {
52
+ return { success: false, error: 'Batch replacement failed.', results: result };
53
+ }
54
+ const editedContent = editor.getText();
55
+ if (editedContent === null) {
56
+ throw new Error(`File "${input.path}" is not loaded.`);
57
+ }
58
+ await filesystem.writeFile(input.path, editedContent, { overwrite: true });
59
+ return { success: true, result };
60
+ }
61
+ catch (error) {
62
+ return createErrorOutput(error);
63
+ }
64
+ })
65
+ .build();
66
+ }
67
+ //# sourceMappingURL=batch-str-replace-file.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"batch-str-replace-file.js","sourceRoot":"","sources":["../../../src/workspace/tools/batch-str-replace-file.ts"],"names":[],"mappings":";;AAmDA,sEA6BC;AAhFD,+DAA4F;AAC5F,6BAAwB;AAExB,yCAAsC;AAItC,MAAM,oBAAoB,GAAG,OAAC,CAAC,MAAM,CAAC;IACrC,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,0DAA0D,CAAC;IACxF,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,gDAAgD,CAAC;CAC9E,CAAC,CAAC;AAEH,MAAM,WAAW,GAAG,OAAC,CAAC,MAAM,CAAC;IAC5B,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,0BAA0B,CAAC;IACrD,YAAY,EAAE,OAAC;SACb,KAAK,CAAC,oBAAoB,CAAC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AK,CAAC,WAAW,CAAC;SAClB,MAAM,CAAC,YAAY,CAAC;SACpB,OAAO,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;QACxB,IAAI,CAAC;YACJ,MAAM,OAAO,GAAG,MAAM,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;YAC7E,MAAM,MAAM,GAAG,IAAI,gCAAkB,CAAC,EAAE,WAAW,EAAE,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;YAC3E,MAAM,MAAM,GAAG,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;YAEvD,IAAI,oBAAoB,CAAC,MAAM,CAAC,EAAE,CAAC;gBAClC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,2BAA2B,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;YAChF,CAAC;YAED,MAAM,aAAa,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC;YACvC,IAAI,aAAa,KAAK,IAAI,EAAE,CAAC;gBAC5B,MAAM,IAAI,KAAK,CAAC,SAAS,KAAK,CAAC,IAAI,kBAAkB,CAAC,CAAC;YACxD,CAAC;YAED,MAAM,UAAU,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE,aAAa,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;YAC3E,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;QAClC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,OAAO,iBAAiB,CAAC,KAAK,CAAC,CAAC;QACjC,CAAC;IACF,CAAC,CAAC;SACD,KAAK,EAAE,CAAC;AACX,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { BuiltTool } from '../../types/sdk/tool';
2
+ import type { WorkspaceFilesystem } from '../types';
3
+ export declare function createStrReplaceFileTool(filesystem: WorkspaceFilesystem): BuiltTool;
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createStrReplaceFileTool = createStrReplaceFileTool;
4
+ const text_editor_1 = require("@n8n/ai-utilities/text-editor");
5
+ const zod_1 = require("zod");
6
+ const tool_1 = require("../../sdk/tool");
7
+ const inputSchema = zod_1.z.object({
8
+ path: zod_1.z.string().describe('Path to the file to edit'),
9
+ old_str: zod_1.z.string().describe('Exact text to replace. Must match exactly and be unique.'),
10
+ new_str: zod_1.z.string().describe('Replacement text to write in place of old_str.'),
11
+ });
12
+ const outputSchema = zod_1.z.object({
13
+ success: zod_1.z.boolean().describe('Whether the edit was applied'),
14
+ result: zod_1.z.string().optional().describe('Success message'),
15
+ error: zod_1.z.string().optional().describe('Error message when the edit could not be applied'),
16
+ });
17
+ function createErrorOutput(error) {
18
+ return {
19
+ success: false,
20
+ error: error instanceof Error ? error.message : 'Unknown workspace edit error.',
21
+ };
22
+ }
23
+ function createStrReplaceFileTool(filesystem) {
24
+ return new tool_1.Tool('workspace_str_replace_file')
25
+ .description('Replace one exact, unique text match in a workspace file without rewriting the whole file.')
26
+ .input(inputSchema)
27
+ .output(outputSchema)
28
+ .handler(async (input) => {
29
+ try {
30
+ const content = await filesystem.readFile(input.path, { encoding: 'utf-8' });
31
+ const editor = new text_editor_1.TextEditorDocument({ initialText: content.toString() });
32
+ const result = editor.execute({
33
+ command: 'str_replace',
34
+ path: input.path,
35
+ old_str: input.old_str,
36
+ new_str: input.new_str,
37
+ });
38
+ const editedContent = editor.getText();
39
+ if (editedContent === null) {
40
+ throw new Error(`File "${input.path}" is not loaded.`);
41
+ }
42
+ await filesystem.writeFile(input.path, editedContent, { overwrite: true });
43
+ return { success: true, result };
44
+ }
45
+ catch (error) {
46
+ return createErrorOutput(error);
47
+ }
48
+ })
49
+ .build();
50
+ }
51
+ //# sourceMappingURL=str-replace-file.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"str-replace-file.js","sourceRoot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C,IAAI,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;YAC7E,MAAM,MAAM,GAAG,IAAI,gCAAkB,CAAC,EAAE,WAAW,EAAE,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;YAC3E,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC;gBAC7B,OAAO,EAAE,aAAa;gBACtB,IAAI,EAAE,KAAK,CAAC,IAAI;gBAChB,OAAO,EAAE,KAAK,CAAC,OAAO;gBACtB,OAAO,EAAE,KAAK,CAAC,OAAO;aACtB,CAAC,CAAC;YACH,MAAM,aAAa,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC;YACvC,IAAI,aAAa,KAAK,IAAI,EAAE,CAAC;gBAC5B,MAAM,IAAI,KAAK,CAAC,SAAS,KAAK,CAAC,IAAI,kBAAkB,CAAC,CAAC;YACxD,CAAC;YAED,MAAM,UAAU,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE,aAAa,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;YAC3E,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;QAClC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,OAAO,iBAAiB,CAAC,KAAK,CAAC,CAAC;QACjC,CAAC;IACF,CAAC,CAAC;SACD,KAAK,EAAE,CAAC;AACX,CAAC"}
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createWorkspaceTools = createWorkspaceTools;
4
4
  const append_file_1 = require("./append-file");
5
+ const batch_str_replace_file_1 = require("./batch-str-replace-file");
5
6
  const copy_file_1 = require("./copy-file");
6
7
  const delete_file_1 = require("./delete-file");
7
8
  const execute_command_1 = require("./execute-command");
@@ -12,11 +13,14 @@ const move_file_1 = require("./move-file");
12
13
  const process_tools_1 = require("./process-tools");
13
14
  const read_file_1 = require("./read-file");
14
15
  const rmdir_1 = require("./rmdir");
16
+ const str_replace_file_1 = require("./str-replace-file");
15
17
  const write_file_1 = require("./write-file");
16
18
  function createWorkspaceTools(workspace) {
17
19
  const tools = [];
18
20
  if (workspace.filesystem) {
19
21
  tools.push((0, read_file_1.createReadFileTool)(workspace.filesystem));
22
+ tools.push((0, str_replace_file_1.createStrReplaceFileTool)(workspace.filesystem));
23
+ tools.push((0, batch_str_replace_file_1.createBatchStrReplaceFileTool)(workspace.filesystem));
20
24
  tools.push((0, write_file_1.createWriteFileTool)(workspace.filesystem));
21
25
  tools.push((0, list_files_1.createListFilesTool)(workspace.filesystem));
22
26
  tools.push((0, file_stat_1.createFileStatTool)(workspace.filesystem));
@@ -1 +1 @@
1
- {"version":3,"file":"workspace-tools.js","sourceRoot":"","sources":["../../../src/workspace/tools/workspace-tools.ts"],"names":[],"mappings":";;AAoBA,oDA0BC;AA5CD,+CAAqD;AACrD,2CAAiD;AACjD,+CAAqD;AACrD,uDAA6D;AAC7D,2CAAiD;AACjD,6CAAmD;AACnD,mCAA0C;AAC1C,2CAAiD;AACjD,mDAAiF;AACjF,2CAAiD;AACjD,mCAA0C;AAC1C,6CAAmD;AAOnD,SAAgB,oBAAoB,CAAC,SAAwB;IAC5D,MAAM,KAAK,GAAgB,EAAE,CAAC;IAE9B,IAAI,SAAS,CAAC,UAAU,EAAE,CAAC;QAC1B,KAAK,CAAC,IAAI,CAAC,IAAA,8BAAkB,EAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC;QACrD,KAAK,CAAC,IAAI,CAAC,IAAA,gCAAmB,EAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC;QACtD,KAAK,CAAC,IAAI,CAAC,IAAA,gCAAmB,EAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC;QACtD,KAAK,CAAC,IAAI,CAAC,IAAA,8BAAkB,EAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC;QACrD,KAAK,CAAC,IAAI,CAAC,IAAA,uBAAe,EAAC,SAAS,CAAC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AAC,IAAI,CAAC,IAAA,0CAAwB,EAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;IACzD,CAAC;IAED,IAAI,SAAS,CAAC,OAAO,EAAE,SAAS,EAAE,CAAC;QAClC,KAAK,CAAC,IAAI,CAAC,IAAA,uCAAuB,EAAC,SAAS,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC;QACjE,KAAK,CAAC,IAAI,CAAC,IAAA,qCAAqB,EAAC,SAAS,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC;IAChE,CAAC;IAED,OAAO,KAAK,CAAC;AACd,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@n8n/agents",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
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",
@@ -11,23 +11,32 @@
11
11
  "LICENSE_EE.md"
12
12
  ],
13
13
  "dependencies": {
14
+ "@ai-sdk/amazon-bedrock": "^4.0.95",
14
15
  "@ai-sdk/anthropic": "^3.0.58",
16
+ "@ai-sdk/azure": "^3.0.54",
17
+ "@ai-sdk/cohere": "^3.0.30",
18
+ "@ai-sdk/deepseek": "^2.0.29",
19
+ "@ai-sdk/gateway": "^3.0.104",
15
20
  "@ai-sdk/google": "^3.0.43",
21
+ "@ai-sdk/groq": "^3.0.35",
22
+ "@ai-sdk/mistral": "^3.0.30",
16
23
  "@ai-sdk/openai": "^3.0.41",
17
- "@ai-sdk/xai": "^3.0.67",
18
24
  "@ai-sdk/provider-utils": "^4.0.21",
19
- "@modelcontextprotocol/sdk": "1.26.0",
20
- "ajv": "^8.18.0",
25
+ "@ai-sdk/xai": "^3.0.67",
21
26
  "@libsql/client": "^0.17.0",
27
+ "@modelcontextprotocol/sdk": "1.26.0",
28
+ "@openrouter/ai-sdk-provider": "^2.8.0",
22
29
  "ai": "^6.0.116",
30
+ "ajv": "^8.18.0",
23
31
  "pg": "8.17.0",
24
- "zod": "3.25.67"
32
+ "zod": "3.25.67",
33
+ "@n8n/ai-utilities": "0.15.0"
25
34
  },
26
35
  "peerDependencies": {
27
- "langsmith": ">=0.3.0",
28
- "@opentelemetry/sdk-trace-node": ">=1.0.0",
36
+ "@opentelemetry/exporter-trace-otlp-http": ">=0.50.0",
29
37
  "@opentelemetry/sdk-trace-base": ">=1.0.0",
30
- "@opentelemetry/exporter-trace-otlp-http": ">=0.50.0"
38
+ "@opentelemetry/sdk-trace-node": ">=1.0.0",
39
+ "langsmith": ">=0.3.0"
31
40
  },
32
41
  "peerDependenciesMeta": {
33
42
  "langsmith": {
@@ -1,2 +0,0 @@
1
- import type { AgentSchema } from '../types/sdk/schema';
2
- export declare function generateAgentCode(schema: AgentSchema, agentName: string): Promise<string>;