@n8n/agents 0.3.0 → 0.5.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.
- package/dist/build.tsbuildinfo +1 -1
- package/dist/codegen/generate-agent-code.d.ts +2 -0
- package/dist/codegen/generate-agent-code.js +197 -0
- package/dist/codegen/generate-agent-code.js.map +1 -0
- package/dist/index.d.ts +10 -1
- package/dist/index.js +12 -2
- package/dist/index.js.map +1 -1
- package/dist/runtime/agent-runtime.d.ts +4 -3
- package/dist/runtime/agent-runtime.js +28 -87
- package/dist/runtime/agent-runtime.js.map +1 -1
- package/dist/runtime/memory-store.d.ts +3 -3
- package/dist/runtime/memory-store.js +2 -4
- package/dist/runtime/memory-store.js.map +1 -1
- package/dist/runtime/message-list.d.ts +9 -4
- package/dist/runtime/message-list.js +51 -8
- package/dist/runtime/message-list.js.map +1 -1
- package/dist/runtime/messages.d.ts +3 -3
- package/dist/runtime/messages.js +1 -2
- package/dist/runtime/messages.js.map +1 -1
- package/dist/runtime/model-factory.js +17 -4
- package/dist/runtime/model-factory.js.map +1 -1
- package/dist/runtime/runtime-helpers.d.ts +5 -5
- package/dist/runtime/runtime-helpers.js +6 -7
- package/dist/runtime/runtime-helpers.js.map +1 -1
- package/dist/runtime/strip-orphaned-tool-messages.d.ts +2 -2
- package/dist/runtime/strip-orphaned-tool-messages.js.map +1 -1
- package/dist/runtime/title-generation.d.ts +4 -0
- package/dist/runtime/title-generation.js +52 -15
- package/dist/runtime/title-generation.js.map +1 -1
- package/dist/runtime/working-memory.d.ts +10 -17
- package/dist/runtime/working-memory.js +41 -110
- package/dist/runtime/working-memory.js.map +1 -1
- package/dist/sdk/agent.d.ts +12 -1
- package/dist/sdk/agent.js +201 -1
- package/dist/sdk/agent.js.map +1 -1
- package/dist/sdk/eval.js +6 -0
- package/dist/sdk/eval.js.map +1 -1
- package/dist/sdk/from-schema.d.ts +15 -0
- package/dist/sdk/from-schema.js +218 -0
- package/dist/sdk/from-schema.js.map +1 -0
- package/dist/sdk/mcp-client.d.ts +1 -0
- package/dist/sdk/mcp-client.js +3 -0
- package/dist/sdk/mcp-client.js.map +1 -1
- package/dist/sdk/memory.d.ts +2 -0
- package/dist/sdk/memory.js +10 -0
- package/dist/sdk/memory.js.map +1 -1
- package/dist/sdk/message.d.ts +2 -2
- package/dist/sdk/message.js +14 -5
- package/dist/sdk/message.js.map +1 -1
- package/dist/sdk/provider-capabilities.d.ts +10 -0
- package/dist/sdk/provider-capabilities.js +26 -0
- package/dist/sdk/provider-capabilities.js.map +1 -0
- package/dist/sdk/tool.js +2 -1
- package/dist/sdk/tool.js.map +1 -1
- package/dist/sdk/verify.js +0 -11
- package/dist/sdk/verify.js.map +1 -1
- package/dist/storage/postgres-memory.d.ts +2 -2
- package/dist/storage/postgres-memory.js +4 -5
- package/dist/storage/postgres-memory.js.map +1 -1
- package/dist/storage/sqlite-memory.d.ts +2 -2
- package/dist/storage/sqlite-memory.js +4 -5
- package/dist/storage/sqlite-memory.js.map +1 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/sdk/agent-builder.d.ts +25 -0
- package/dist/types/sdk/agent-builder.js +3 -0
- package/dist/types/sdk/agent-builder.js.map +1 -0
- package/dist/types/sdk/agent.d.ts +1 -0
- package/dist/types/sdk/credential-provider.d.ts +13 -0
- package/dist/types/sdk/credential-provider.js +3 -0
- package/dist/types/sdk/credential-provider.js.map +1 -0
- package/dist/types/sdk/eval.d.ts +3 -0
- package/dist/types/sdk/handler-executor.d.ts +12 -0
- package/dist/types/sdk/handler-executor.js +3 -0
- package/dist/types/sdk/handler-executor.js.map +1 -0
- package/dist/types/sdk/memory.d.ts +4 -3
- package/dist/types/sdk/message.d.ts +1 -0
- package/dist/types/sdk/schema.d.ts +99 -0
- package/dist/types/sdk/schema.js +3 -0
- package/dist/types/sdk/schema.js.map +1 -0
- package/dist/types/sdk/tool.d.ts +1 -0
- package/dist/utils/zod.d.ts +1 -0
- package/dist/utils/zod.js +24 -1
- package/dist/utils/zod.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,99 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/types/sdk/schema.ts"],"names":[],"mappings":""}
|
package/dist/types/sdk/tool.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export interface BuiltTool {
|
|
|
16
16
|
readonly description: string;
|
|
17
17
|
readonly suspendSchema?: ZodType;
|
|
18
18
|
readonly resumeSchema?: ZodType;
|
|
19
|
+
readonly withDefaultApproval?: boolean;
|
|
19
20
|
readonly toMessage?: (output: unknown) => AgentMessage | undefined;
|
|
20
21
|
readonly toModelOutput?: (output: unknown) => unknown;
|
|
21
22
|
readonly handler?: (input: unknown, ctx: ToolContext | InterruptibleToolContext) => Promise<unknown>;
|
package/dist/utils/zod.d.ts
CHANGED
package/dist/utils/zod.js
CHANGED
|
@@ -1,7 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isZodSchema = isZodSchema;
|
|
4
|
+
exports.zodToJsonSchema = zodToJsonSchema;
|
|
5
|
+
const zod_to_json_schema_1 = require("zod-to-json-schema");
|
|
4
6
|
function isZodSchema(schema) {
|
|
5
|
-
return typeof schema
|
|
7
|
+
return (typeof schema === 'object' &&
|
|
8
|
+
schema !== null &&
|
|
9
|
+
typeof schema.safeParse === 'function');
|
|
10
|
+
}
|
|
11
|
+
function zodToJsonSchema(schema) {
|
|
12
|
+
if (!schema)
|
|
13
|
+
return null;
|
|
14
|
+
try {
|
|
15
|
+
if (isZodSchema(schema)) {
|
|
16
|
+
if ('toJSONSchema' in schema && typeof schema.toJSONSchema === 'function') {
|
|
17
|
+
return schema.toJSONSchema();
|
|
18
|
+
}
|
|
19
|
+
return (0, zod_to_json_schema_1.zodToJsonSchema)(schema);
|
|
20
|
+
}
|
|
21
|
+
if (typeof schema === 'object' && schema !== null) {
|
|
22
|
+
return schema;
|
|
23
|
+
}
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
6
29
|
}
|
|
7
30
|
//# sourceMappingURL=zod.js.map
|
package/dist/utils/zod.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zod.js","sourceRoot":"","sources":["../../src/utils/zod.ts"],"names":[],"mappings":";;
|
|
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,eAAe,CAAC,MAAgB;IAC/C,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IACzB,IAAI,CAAC;QACJ,IAAI,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC;YACzB,IAAI,cAAc,IAAI,MAAM,IAAI,OAAO,MAAM,CAAC,YAAY,KAAK,UAAU,EAAE,CAAC;gBAC3E,OAAQ,MAAyD,CAAC,YAAY,EAAE,CAAC;YAClF,CAAC;YACD,OAAO,IAAA,oCAAmB,EAAC,MAAM,CAA4B,CAAC;QAC/D,CAAC;QACD,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI,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"}
|