@n8n/api-types 1.19.1 → 1.21.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 (96) hide show
  1. package/dist/agent-builder-interactive.d.ts +159 -0
  2. package/dist/agent-builder-interactive.js +67 -0
  3. package/dist/agent-builder-interactive.js.map +1 -0
  4. package/dist/agent-sse.d.ts +83 -0
  5. package/dist/agent-sse.js +3 -0
  6. package/dist/agent-sse.js.map +1 -0
  7. package/dist/agents.d.ts +258 -0
  8. package/dist/agents.js +52 -0
  9. package/dist/agents.js.map +1 -0
  10. package/dist/build.tsbuildinfo +1 -1
  11. package/dist/chat-hub.d.ts +18 -18
  12. package/dist/dto/agents/agent-build-resume.dto.d.ts +61 -0
  13. package/dist/dto/agents/agent-build-resume.dto.js +14 -0
  14. package/dist/dto/agents/agent-build-resume.dto.js.map +1 -0
  15. package/dist/dto/agents/agent-chat-message.dto.d.ts +11 -0
  16. package/dist/dto/agents/agent-chat-message.dto.js +12 -0
  17. package/dist/dto/agents/agent-chat-message.dto.js.map +1 -0
  18. package/dist/dto/agents/agent-integration.dto.d.ts +11 -0
  19. package/dist/dto/agents/agent-integration.dto.js +12 -0
  20. package/dist/dto/agents/agent-integration.dto.js.map +1 -0
  21. package/dist/dto/agents/create-agent-skill.dto.d.ts +27 -0
  22. package/dist/dto/agents/create-agent-skill.dto.js +17 -0
  23. package/dist/dto/agents/create-agent-skill.dto.js.map +1 -0
  24. package/dist/dto/agents/create-agent.dto.d.ts +9 -0
  25. package/dist/dto/agents/create-agent.dto.js +11 -0
  26. package/dist/dto/agents/create-agent.dto.js.map +1 -0
  27. package/dist/dto/agents/update-agent-config.dto.d.ts +9 -0
  28. package/dist/dto/agents/update-agent-config.dto.js +11 -0
  29. package/dist/dto/agents/update-agent-config.dto.js.map +1 -0
  30. package/dist/dto/agents/update-agent-schedule.dto.d.ts +11 -0
  31. package/dist/dto/agents/update-agent-schedule.dto.js +12 -0
  32. package/dist/dto/agents/update-agent-schedule.dto.js.map +1 -0
  33. package/dist/dto/agents/update-agent-skill.dto.d.ts +12 -0
  34. package/dist/dto/agents/update-agent-skill.dto.js +13 -0
  35. package/dist/dto/agents/update-agent-skill.dto.js.map +1 -0
  36. package/dist/dto/agents/update-agent.dto.d.ts +13 -0
  37. package/dist/dto/agents/update-agent.dto.js +13 -0
  38. package/dist/dto/agents/update-agent.dto.js.map +1 -0
  39. package/dist/dto/ai/ai-build-request.dto.d.ts +6 -6
  40. package/dist/dto/ai/ai-gateway-config-response.dto.d.ts +2 -0
  41. package/dist/dto/ai/ai-gateway-config-response.dto.js +1 -0
  42. package/dist/dto/ai/ai-gateway-config-response.dto.js.map +1 -1
  43. package/dist/dto/encryption/encryption-key-response.dto.d.ts +2 -7
  44. package/dist/dto/encryption/list-encryption-keys-query.dto.d.ts +14 -2
  45. package/dist/dto/encryption/list-encryption-keys-query.dto.js +19 -2
  46. package/dist/dto/encryption/list-encryption-keys-query.dto.js.map +1 -1
  47. package/dist/dto/evaluations/evaluation-config.dto.d.ts +845 -0
  48. package/dist/dto/evaluations/evaluation-config.dto.js +96 -0
  49. package/dist/dto/evaluations/evaluation-config.dto.js.map +1 -0
  50. package/dist/dto/evaluations/evaluation-error-code.d.ts +38 -0
  51. package/dist/dto/evaluations/evaluation-error-code.js +29 -0
  52. package/dist/dto/evaluations/evaluation-error-code.js.map +1 -0
  53. package/dist/dto/evaluations/index.d.ts +2 -0
  54. package/dist/dto/evaluations/index.js +19 -0
  55. package/dist/dto/evaluations/index.js.map +1 -0
  56. package/dist/dto/folders/list-folder-query.dto.d.ts +2 -2
  57. package/dist/dto/index.d.ts +14 -4
  58. package/dist/dto/index.js +39 -1
  59. package/dist/dto/index.js.map +1 -1
  60. package/dist/dto/instance-ai/instance-ai-confirm-request.dto.d.ts +95 -42
  61. package/dist/dto/instance-ai/instance-ai-confirm-request.dto.js +47 -18
  62. package/dist/dto/instance-ai/instance-ai-confirm-request.dto.js.map +1 -1
  63. package/dist/dto/oauth/oauth-client.dto.d.ts +11 -0
  64. package/dist/dto/oauth/oauth-client.dto.js +8 -1
  65. package/dist/dto/oauth/oauth-client.dto.js.map +1 -1
  66. package/dist/dto/project/update-project.dto.d.ts +2 -2
  67. package/dist/dto/provisioning/config.dto.d.ts +2 -0
  68. package/dist/dto/source-control/push-work-folder-request.dto.d.ts +3 -3
  69. package/dist/dto/workflow-history/update-workflow-history-version.dto.d.ts +1 -1
  70. package/dist/dto/workflows/activate-workflow.dto.d.ts +1 -1
  71. package/dist/dto/workflows/create-workflow.dto.d.ts +2 -2
  72. package/dist/dto/workflows/update-workflow.dto.d.ts +2 -2
  73. package/dist/frontend-settings.d.ts +8 -1
  74. package/dist/index.d.ts +7 -2
  75. package/dist/index.js +29 -3
  76. package/dist/index.js.map +1 -1
  77. package/dist/instance-registry-types.d.ts +174 -69
  78. package/dist/instance-registry-types.js +15 -1
  79. package/dist/instance-registry-types.js.map +1 -1
  80. package/dist/schemas/agent-run-reducer.js +1 -0
  81. package/dist/schemas/agent-run-reducer.js.map +1 -1
  82. package/dist/schemas/breaking-changes.schema.d.ts +48 -48
  83. package/dist/schemas/encryption-key.schema.d.ts +70 -0
  84. package/dist/schemas/encryption-key.schema.js +17 -0
  85. package/dist/schemas/encryption-key.schema.js.map +1 -0
  86. package/dist/schemas/evaluations.schema.d.ts +18 -0
  87. package/dist/schemas/evaluations.schema.js +14 -0
  88. package/dist/schemas/evaluations.schema.js.map +1 -0
  89. package/dist/schemas/instance-ai.schema.d.ts +337 -166
  90. package/dist/schemas/instance-ai.schema.js +80 -8
  91. package/dist/schemas/instance-ai.schema.js.map +1 -1
  92. package/dist/schemas/secrets-provider.schema.d.ts +10 -10
  93. package/dist/schemas/source-controlled-file.schema.d.ts +2 -2
  94. package/dist/schemas/user.schema.d.ts +12 -12
  95. package/dist/schemas/workflow-execution-status.schema.d.ts +4 -4
  96. package/package.json +5 -5
@@ -0,0 +1,159 @@
1
+ import { z } from 'zod';
2
+ export declare const ASK_LLM_TOOL_NAME: "ask_llm";
3
+ export declare const ASK_CREDENTIAL_TOOL_NAME: "ask_credential";
4
+ export declare const ASK_QUESTION_TOOL_NAME: "ask_question";
5
+ export declare const interactiveToolNameSchema: z.ZodUnion<[z.ZodLiteral<"ask_llm">, z.ZodLiteral<"ask_credential">, z.ZodLiteral<"ask_question">]>;
6
+ export type InteractiveToolName = z.infer<typeof interactiveToolNameSchema>;
7
+ export declare const askLlmInputSchema: z.ZodObject<{
8
+ purpose: z.ZodOptional<z.ZodString>;
9
+ }, "strip", z.ZodTypeAny, {
10
+ purpose?: string | undefined;
11
+ }, {
12
+ purpose?: string | undefined;
13
+ }>;
14
+ export declare const askLlmResumeSchema: z.ZodObject<{
15
+ provider: z.ZodString;
16
+ model: z.ZodString;
17
+ credentialId: z.ZodString;
18
+ credentialName: z.ZodString;
19
+ }, "strip", z.ZodTypeAny, {
20
+ provider: string;
21
+ model: string;
22
+ credentialId: string;
23
+ credentialName: string;
24
+ }, {
25
+ provider: string;
26
+ model: string;
27
+ credentialId: string;
28
+ credentialName: string;
29
+ }>;
30
+ export type AskLlmInput = z.infer<typeof askLlmInputSchema>;
31
+ export type AskLlmResume = z.infer<typeof askLlmResumeSchema>;
32
+ export declare const askCredentialInputSchema: z.ZodObject<{
33
+ purpose: z.ZodString;
34
+ nodeType: z.ZodOptional<z.ZodString>;
35
+ credentialType: z.ZodString;
36
+ slot: z.ZodOptional<z.ZodString>;
37
+ }, "strip", z.ZodTypeAny, {
38
+ purpose: string;
39
+ credentialType: string;
40
+ nodeType?: string | undefined;
41
+ slot?: string | undefined;
42
+ }, {
43
+ purpose: string;
44
+ credentialType: string;
45
+ nodeType?: string | undefined;
46
+ slot?: string | undefined;
47
+ }>;
48
+ export declare const askCredentialResumeSchema: z.ZodUnion<[z.ZodObject<{
49
+ credentialId: z.ZodString;
50
+ credentialName: z.ZodString;
51
+ }, "strip", z.ZodTypeAny, {
52
+ credentialId: string;
53
+ credentialName: string;
54
+ }, {
55
+ credentialId: string;
56
+ credentialName: string;
57
+ }>, z.ZodObject<{
58
+ skipped: z.ZodLiteral<true>;
59
+ }, "strip", z.ZodTypeAny, {
60
+ skipped: true;
61
+ }, {
62
+ skipped: true;
63
+ }>]>;
64
+ export type AskCredentialInput = z.infer<typeof askCredentialInputSchema>;
65
+ export type AskCredentialResume = z.infer<typeof askCredentialResumeSchema>;
66
+ export declare const askQuestionOptionSchema: z.ZodObject<{
67
+ label: z.ZodString;
68
+ value: z.ZodString;
69
+ description: z.ZodOptional<z.ZodString>;
70
+ }, "strip", z.ZodTypeAny, {
71
+ value: string;
72
+ label: string;
73
+ description?: string | undefined;
74
+ }, {
75
+ value: string;
76
+ label: string;
77
+ description?: string | undefined;
78
+ }>;
79
+ export declare const askQuestionInputSchema: z.ZodObject<{
80
+ question: z.ZodString;
81
+ options: z.ZodArray<z.ZodObject<{
82
+ label: z.ZodString;
83
+ value: z.ZodString;
84
+ description: z.ZodOptional<z.ZodString>;
85
+ }, "strip", z.ZodTypeAny, {
86
+ value: string;
87
+ label: string;
88
+ description?: string | undefined;
89
+ }, {
90
+ value: string;
91
+ label: string;
92
+ description?: string | undefined;
93
+ }>, "many">;
94
+ allowMultiple: z.ZodOptional<z.ZodBoolean>;
95
+ }, "strip", z.ZodTypeAny, {
96
+ options: {
97
+ value: string;
98
+ label: string;
99
+ description?: string | undefined;
100
+ }[];
101
+ question: string;
102
+ allowMultiple?: boolean | undefined;
103
+ }, {
104
+ options: {
105
+ value: string;
106
+ label: string;
107
+ description?: string | undefined;
108
+ }[];
109
+ question: string;
110
+ allowMultiple?: boolean | undefined;
111
+ }>;
112
+ export declare const askQuestionResumeSchema: z.ZodObject<{
113
+ values: z.ZodArray<z.ZodString, "many">;
114
+ }, "strip", z.ZodTypeAny, {
115
+ values: string[];
116
+ }, {
117
+ values: string[];
118
+ }>;
119
+ export type AskQuestionOption = z.infer<typeof askQuestionOptionSchema>;
120
+ export type AskQuestionInput = z.infer<typeof askQuestionInputSchema>;
121
+ export type AskQuestionResume = z.infer<typeof askQuestionResumeSchema>;
122
+ export declare const interactiveResumeDataSchema: z.ZodUnion<[z.ZodObject<{
123
+ provider: z.ZodString;
124
+ model: z.ZodString;
125
+ credentialId: z.ZodString;
126
+ credentialName: z.ZodString;
127
+ }, "strip", z.ZodTypeAny, {
128
+ provider: string;
129
+ model: string;
130
+ credentialId: string;
131
+ credentialName: string;
132
+ }, {
133
+ provider: string;
134
+ model: string;
135
+ credentialId: string;
136
+ credentialName: string;
137
+ }>, z.ZodUnion<[z.ZodObject<{
138
+ credentialId: z.ZodString;
139
+ credentialName: z.ZodString;
140
+ }, "strip", z.ZodTypeAny, {
141
+ credentialId: string;
142
+ credentialName: string;
143
+ }, {
144
+ credentialId: string;
145
+ credentialName: string;
146
+ }>, z.ZodObject<{
147
+ skipped: z.ZodLiteral<true>;
148
+ }, "strip", z.ZodTypeAny, {
149
+ skipped: true;
150
+ }, {
151
+ skipped: true;
152
+ }>]>, z.ZodObject<{
153
+ values: z.ZodArray<z.ZodString, "many">;
154
+ }, "strip", z.ZodTypeAny, {
155
+ values: string[];
156
+ }, {
157
+ values: string[];
158
+ }>]>;
159
+ export type InteractiveResumeData = z.infer<typeof interactiveResumeDataSchema>;
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.interactiveResumeDataSchema = exports.askQuestionResumeSchema = exports.askQuestionInputSchema = exports.askQuestionOptionSchema = exports.askCredentialResumeSchema = exports.askCredentialInputSchema = exports.askLlmResumeSchema = exports.askLlmInputSchema = exports.interactiveToolNameSchema = exports.ASK_QUESTION_TOOL_NAME = exports.ASK_CREDENTIAL_TOOL_NAME = exports.ASK_LLM_TOOL_NAME = void 0;
4
+ const zod_1 = require("zod");
5
+ exports.ASK_LLM_TOOL_NAME = 'ask_llm';
6
+ exports.ASK_CREDENTIAL_TOOL_NAME = 'ask_credential';
7
+ exports.ASK_QUESTION_TOOL_NAME = 'ask_question';
8
+ exports.interactiveToolNameSchema = zod_1.z.union([
9
+ zod_1.z.literal(exports.ASK_LLM_TOOL_NAME),
10
+ zod_1.z.literal(exports.ASK_CREDENTIAL_TOOL_NAME),
11
+ zod_1.z.literal(exports.ASK_QUESTION_TOOL_NAME),
12
+ ]);
13
+ exports.askLlmInputSchema = zod_1.z.object({
14
+ purpose: zod_1.z
15
+ .string()
16
+ .optional()
17
+ .describe('Short sentence describing why the model is needed, e.g. "Main LLM for the Slack triage agent"'),
18
+ });
19
+ exports.askLlmResumeSchema = zod_1.z.object({
20
+ provider: zod_1.z.string(),
21
+ model: zod_1.z.string(),
22
+ credentialId: zod_1.z.string(),
23
+ credentialName: zod_1.z.string(),
24
+ });
25
+ exports.askCredentialInputSchema = zod_1.z.object({
26
+ purpose: zod_1.z.string().describe('One short sentence describing what this credential is used for'),
27
+ nodeType: zod_1.z
28
+ .string()
29
+ .optional()
30
+ .describe('The n8n node type requiring this credential, e.g. "n8n-nodes-base.slack"'),
31
+ credentialType: zod_1.z
32
+ .string()
33
+ .describe('The credential type name to request for this slot, e.g. "slackApi". When the slot accepts multiple credential types, pick the single best match (typically the OAuth or first listed type).'),
34
+ slot: zod_1.z.string().optional().describe('Credential slot name on the node, e.g. "slackApi"'),
35
+ });
36
+ exports.askCredentialResumeSchema = zod_1.z.union([
37
+ zod_1.z.object({ credentialId: zod_1.z.string(), credentialName: zod_1.z.string() }),
38
+ zod_1.z.object({ skipped: zod_1.z.literal(true) }),
39
+ ]);
40
+ exports.askQuestionOptionSchema = zod_1.z.object({
41
+ label: zod_1.z.string().describe('Display label for this option'),
42
+ value: zod_1.z.string().describe('Internal value for this option'),
43
+ description: zod_1.z.string().optional().describe('Optional additional explanation'),
44
+ });
45
+ exports.askQuestionInputSchema = zod_1.z.object({
46
+ question: zod_1.z.string().describe('The question to display to the user'),
47
+ options: zod_1.z
48
+ .array(exports.askQuestionOptionSchema)
49
+ .min(1)
50
+ .describe('Choices to present. With a single option the tool auto-resolves to that option without rendering a card.'),
51
+ allowMultiple: zod_1.z
52
+ .boolean()
53
+ .optional()
54
+ .describe('If true the user may select more than one option; defaults to false'),
55
+ });
56
+ exports.askQuestionResumeSchema = zod_1.z.object({
57
+ values: zod_1.z
58
+ .array(zod_1.z.string())
59
+ .min(1)
60
+ .describe('Selected option values, or freeform text entered in the Other field.'),
61
+ });
62
+ exports.interactiveResumeDataSchema = zod_1.z.union([
63
+ exports.askLlmResumeSchema,
64
+ exports.askCredentialResumeSchema,
65
+ exports.askQuestionResumeSchema,
66
+ ]);
67
+ //# sourceMappingURL=agent-builder-interactive.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-builder-interactive.js","sourceRoot":"","sources":["../src/agent-builder-interactive.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,83 @@
1
+ import type { AgentPersistedMessageContentPart } from './agents';
2
+ export interface ToolSuspendedPayload {
3
+ toolCallId: string;
4
+ runId: string;
5
+ toolName: string;
6
+ input: unknown;
7
+ }
8
+ export interface AgentSseMessage {
9
+ role: string;
10
+ content: AgentPersistedMessageContentPart[];
11
+ }
12
+ export type AgentSseEvent = {
13
+ type: 'start-step';
14
+ } | {
15
+ type: 'finish-step';
16
+ } | {
17
+ type: 'text-start';
18
+ id: string;
19
+ } | {
20
+ type: 'text-delta';
21
+ id: string;
22
+ delta: string;
23
+ } | {
24
+ type: 'text-end';
25
+ id: string;
26
+ } | {
27
+ type: 'reasoning-start';
28
+ id: string;
29
+ } | {
30
+ type: 'reasoning-delta';
31
+ id: string;
32
+ delta: string;
33
+ } | {
34
+ type: 'reasoning-end';
35
+ id: string;
36
+ } | {
37
+ type: 'tool-input-start';
38
+ toolCallId: string;
39
+ toolName: string;
40
+ } | {
41
+ type: 'tool-input-delta';
42
+ toolCallId: string;
43
+ delta: string;
44
+ } | {
45
+ type: 'tool-call';
46
+ toolCallId: string;
47
+ toolName: string;
48
+ input: unknown;
49
+ } | {
50
+ type: 'tool-execution-start';
51
+ toolCallId: string;
52
+ toolName: string;
53
+ } | {
54
+ type: 'tool-result';
55
+ toolCallId: string;
56
+ toolName: string;
57
+ output: unknown;
58
+ isError?: boolean;
59
+ } | {
60
+ type: 'tool-call-suspended';
61
+ payload: ToolSuspendedPayload;
62
+ } | {
63
+ type: 'message';
64
+ message: AgentSseMessage;
65
+ } | {
66
+ type: 'working-memory-update';
67
+ toolName: string;
68
+ } | {
69
+ type: 'code-delta';
70
+ delta: string;
71
+ } | {
72
+ type: 'config-updated';
73
+ } | {
74
+ type: 'tool-updated';
75
+ } | {
76
+ type: 'error';
77
+ message: string;
78
+ errorCode?: string;
79
+ missing?: string[];
80
+ } | {
81
+ type: 'done';
82
+ sessionId?: string;
83
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=agent-sse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-sse.js","sourceRoot":"","sources":["../src/agent-sse.ts"],"names":[],"mappings":""}
@@ -0,0 +1,258 @@
1
+ import { z } from 'zod';
2
+ export interface ChatIntegrationDescriptor {
3
+ type: string;
4
+ label: string;
5
+ icon: string;
6
+ credentialTypes: string[];
7
+ }
8
+ export declare const SUPPORTED_WORKFLOW_TOOL_TRIGGERS: readonly ["n8n-nodes-base.manualTrigger", "n8n-nodes-base.executeWorkflowTrigger", "@n8n/n8n-nodes-langchain.chatTrigger", "n8n-nodes-base.scheduleTrigger", "n8n-nodes-base.formTrigger"];
9
+ export declare const INCOMPATIBLE_WORKFLOW_TOOL_BODY_NODE_TYPES: readonly ["n8n-nodes-base.wait", "n8n-nodes-base.form", "n8n-nodes-base.respondToWebhook"];
10
+ export declare const AGENT_SCHEDULE_TRIGGER_TYPE = "schedule";
11
+ export declare const AGENT_WORKFLOW_TRIGGER_TYPE = "workflow";
12
+ export declare const DEFAULT_AGENT_SCHEDULE_WAKE_UP_PROMPT = "Automated message: you were triggered on schedule.";
13
+ export interface AgentCredentialIntegration {
14
+ type: string;
15
+ credentialId: string;
16
+ credentialName: string;
17
+ }
18
+ export interface AgentScheduleIntegration {
19
+ type: typeof AGENT_SCHEDULE_TRIGGER_TYPE;
20
+ active: boolean;
21
+ cronExpression: string;
22
+ wakeUpPrompt: string;
23
+ }
24
+ export type AgentIntegration = AgentCredentialIntegration | AgentScheduleIntegration;
25
+ export interface AgentScheduleConfig {
26
+ active: boolean;
27
+ cronExpression: string;
28
+ wakeUpPrompt: string;
29
+ }
30
+ export interface AgentIntegrationStatusEntry {
31
+ type: string;
32
+ credentialId?: string;
33
+ }
34
+ export interface AgentIntegrationStatusResponse {
35
+ status: 'connected' | 'disconnected';
36
+ integrations: AgentIntegrationStatusEntry[];
37
+ }
38
+ export declare function isAgentScheduleIntegration(integration: AgentIntegration | null | undefined): integration is AgentScheduleIntegration;
39
+ export declare function isAgentCredentialIntegration(integration: AgentIntegration | null | undefined): integration is AgentCredentialIntegration;
40
+ export interface NodeToolConfig {
41
+ nodeType: string;
42
+ nodeTypeVersion: number;
43
+ nodeParameters?: Record<string, unknown>;
44
+ credentials?: Record<string, {
45
+ id: string;
46
+ name: string;
47
+ }>;
48
+ }
49
+ interface BaseAgentJsonToolRef {
50
+ name?: string;
51
+ description?: string;
52
+ workflow?: string;
53
+ node?: NodeToolConfig;
54
+ requireApproval?: boolean;
55
+ allOutputs?: boolean;
56
+ }
57
+ export type AgentJsonToolRef = (BaseAgentJsonToolRef & {
58
+ type: 'custom';
59
+ id: string;
60
+ }) | (BaseAgentJsonToolRef & {
61
+ type: 'workflow';
62
+ id?: never;
63
+ }) | (BaseAgentJsonToolRef & {
64
+ type: 'node';
65
+ id?: never;
66
+ });
67
+ export interface AgentJsonSkillRef {
68
+ type: 'skill';
69
+ id: string;
70
+ }
71
+ export type AgentJsonConfigRef = AgentJsonToolRef | AgentJsonSkillRef;
72
+ export interface AgentSkill {
73
+ name: string;
74
+ description: string;
75
+ instructions: string;
76
+ }
77
+ export interface AgentSkillMutationResponse {
78
+ id: string;
79
+ skill: AgentSkill;
80
+ versionId: string | null;
81
+ }
82
+ export interface AgentJsonConfig {
83
+ name: string;
84
+ description?: string;
85
+ icon?: {
86
+ type: 'icon' | 'emoji';
87
+ value: string;
88
+ };
89
+ model: string;
90
+ credential?: string;
91
+ instructions: string;
92
+ memory?: {
93
+ enabled: boolean;
94
+ storage: 'n8n' | 'sqlite' | 'postgres';
95
+ connection?: Record<string, unknown>;
96
+ lastMessages?: number;
97
+ semanticRecall?: {
98
+ topK: number;
99
+ scope?: 'thread' | 'resource';
100
+ messageRange?: {
101
+ before: number;
102
+ after: number;
103
+ };
104
+ embedder?: string;
105
+ };
106
+ };
107
+ tools?: AgentJsonToolRef[];
108
+ skills?: AgentJsonSkillRef[];
109
+ providerTools?: Record<string, Record<string, unknown>>;
110
+ integrations?: AgentIntegration[];
111
+ config?: {
112
+ thinking?: {
113
+ provider: 'anthropic' | 'openai';
114
+ budgetTokens?: number;
115
+ reasoningEffort?: string;
116
+ };
117
+ toolCallConcurrency?: number;
118
+ nodeTools?: {
119
+ enabled: boolean;
120
+ };
121
+ };
122
+ }
123
+ export interface AgentPublishedVersionDto {
124
+ schema: AgentJsonConfig | null;
125
+ skills: Record<string, AgentSkill> | null;
126
+ publishedFromVersionId: string;
127
+ model: string | null;
128
+ provider: string | null;
129
+ credentialId: string | null;
130
+ publishedById: string | null;
131
+ }
132
+ export interface AgentPersistedMessageContentPart {
133
+ type: 'text' | 'reasoning' | 'tool-call' | (string & {});
134
+ text?: string;
135
+ toolName?: string;
136
+ toolCallId?: string;
137
+ input?: unknown;
138
+ state?: string;
139
+ output?: unknown;
140
+ error?: string;
141
+ }
142
+ export interface AgentPersistedMessageDto {
143
+ id: string;
144
+ role: 'user' | 'assistant' | (string & {});
145
+ content: AgentPersistedMessageContentPart[];
146
+ }
147
+ export declare const AGENT_BUILDER_DEFAULT_MODEL: "claude-sonnet-4-5";
148
+ export declare const agentBuilderModeSchema: z.ZodEnum<["default", "custom"]>;
149
+ export type AgentBuilderMode = z.infer<typeof agentBuilderModeSchema>;
150
+ export declare const agentBuilderAdminSettingsSchema: z.ZodDiscriminatedUnion<"mode", [z.ZodObject<{
151
+ mode: z.ZodLiteral<"default">;
152
+ }, "strip", z.ZodTypeAny, {
153
+ mode: "default";
154
+ }, {
155
+ mode: "default";
156
+ }>, z.ZodObject<{
157
+ mode: z.ZodLiteral<"custom">;
158
+ provider: z.ZodString;
159
+ credentialId: z.ZodString;
160
+ modelName: z.ZodString;
161
+ }, "strip", z.ZodTypeAny, {
162
+ provider: string;
163
+ credentialId: string;
164
+ mode: "custom";
165
+ modelName: string;
166
+ }, {
167
+ provider: string;
168
+ credentialId: string;
169
+ mode: "custom";
170
+ modelName: string;
171
+ }>]>;
172
+ export type AgentBuilderAdminSettings = z.infer<typeof agentBuilderAdminSettingsSchema>;
173
+ export declare const agentBuilderAdminSettingsResponseSchema: z.ZodObject<{
174
+ settings: z.ZodDiscriminatedUnion<"mode", [z.ZodObject<{
175
+ mode: z.ZodLiteral<"default">;
176
+ }, "strip", z.ZodTypeAny, {
177
+ mode: "default";
178
+ }, {
179
+ mode: "default";
180
+ }>, z.ZodObject<{
181
+ mode: z.ZodLiteral<"custom">;
182
+ provider: z.ZodString;
183
+ credentialId: z.ZodString;
184
+ modelName: z.ZodString;
185
+ }, "strip", z.ZodTypeAny, {
186
+ provider: string;
187
+ credentialId: string;
188
+ mode: "custom";
189
+ modelName: string;
190
+ }, {
191
+ provider: string;
192
+ credentialId: string;
193
+ mode: "custom";
194
+ modelName: string;
195
+ }>]>;
196
+ isConfigured: z.ZodBoolean;
197
+ }, "strip", z.ZodTypeAny, {
198
+ settings: {
199
+ mode: "default";
200
+ } | {
201
+ provider: string;
202
+ credentialId: string;
203
+ mode: "custom";
204
+ modelName: string;
205
+ };
206
+ isConfigured: boolean;
207
+ }, {
208
+ settings: {
209
+ mode: "default";
210
+ } | {
211
+ provider: string;
212
+ credentialId: string;
213
+ mode: "custom";
214
+ modelName: string;
215
+ };
216
+ isConfigured: boolean;
217
+ }>;
218
+ export type AgentBuilderAdminSettingsResponse = z.infer<typeof agentBuilderAdminSettingsResponseSchema>;
219
+ export declare const AgentBuilderAdminSettingsUpdateDto: z.ZodDiscriminatedUnion<"mode", [z.ZodObject<{
220
+ mode: z.ZodLiteral<"default">;
221
+ }, "strip", z.ZodTypeAny, {
222
+ mode: "default";
223
+ }, {
224
+ mode: "default";
225
+ }>, z.ZodObject<{
226
+ mode: z.ZodLiteral<"custom">;
227
+ provider: z.ZodString;
228
+ credentialId: z.ZodString;
229
+ modelName: z.ZodString;
230
+ }, "strip", z.ZodTypeAny, {
231
+ provider: string;
232
+ credentialId: string;
233
+ mode: "custom";
234
+ modelName: string;
235
+ }, {
236
+ provider: string;
237
+ credentialId: string;
238
+ mode: "custom";
239
+ modelName: string;
240
+ }>]>;
241
+ export type AgentBuilderAdminSettingsUpdateRequest = AgentBuilderAdminSettings;
242
+ export declare const agentBuilderStatusResponseSchema: z.ZodObject<{
243
+ isConfigured: z.ZodBoolean;
244
+ }, "strip", z.ZodTypeAny, {
245
+ isConfigured: boolean;
246
+ }, {
247
+ isConfigured: boolean;
248
+ }>;
249
+ export type AgentBuilderStatusResponse = z.infer<typeof agentBuilderStatusResponseSchema>;
250
+ export interface AgentBuilderOpenSuspension {
251
+ toolCallId: string;
252
+ runId: string;
253
+ }
254
+ export interface AgentBuilderMessagesResponse {
255
+ messages: AgentPersistedMessageDto[];
256
+ openSuspensions: AgentBuilderOpenSuspension[];
257
+ }
258
+ export {};
package/dist/agents.js ADDED
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.agentBuilderStatusResponseSchema = exports.AgentBuilderAdminSettingsUpdateDto = exports.agentBuilderAdminSettingsResponseSchema = exports.agentBuilderAdminSettingsSchema = exports.agentBuilderModeSchema = exports.AGENT_BUILDER_DEFAULT_MODEL = exports.DEFAULT_AGENT_SCHEDULE_WAKE_UP_PROMPT = exports.AGENT_WORKFLOW_TRIGGER_TYPE = exports.AGENT_SCHEDULE_TRIGGER_TYPE = exports.INCOMPATIBLE_WORKFLOW_TOOL_BODY_NODE_TYPES = exports.SUPPORTED_WORKFLOW_TOOL_TRIGGERS = void 0;
4
+ exports.isAgentScheduleIntegration = isAgentScheduleIntegration;
5
+ exports.isAgentCredentialIntegration = isAgentCredentialIntegration;
6
+ const n8n_workflow_1 = require("n8n-workflow");
7
+ const zod_1 = require("zod");
8
+ exports.SUPPORTED_WORKFLOW_TOOL_TRIGGERS = [
9
+ n8n_workflow_1.MANUAL_TRIGGER_NODE_TYPE,
10
+ n8n_workflow_1.EXECUTE_WORKFLOW_TRIGGER_NODE_TYPE,
11
+ n8n_workflow_1.CHAT_TRIGGER_NODE_TYPE,
12
+ n8n_workflow_1.SCHEDULE_TRIGGER_NODE_TYPE,
13
+ n8n_workflow_1.FORM_TRIGGER_NODE_TYPE,
14
+ ];
15
+ exports.INCOMPATIBLE_WORKFLOW_TOOL_BODY_NODE_TYPES = [
16
+ 'n8n-nodes-base.wait',
17
+ 'n8n-nodes-base.form',
18
+ 'n8n-nodes-base.respondToWebhook',
19
+ ];
20
+ exports.AGENT_SCHEDULE_TRIGGER_TYPE = 'schedule';
21
+ exports.AGENT_WORKFLOW_TRIGGER_TYPE = 'workflow';
22
+ exports.DEFAULT_AGENT_SCHEDULE_WAKE_UP_PROMPT = 'Automated message: you were triggered on schedule.';
23
+ function isAgentScheduleIntegration(integration) {
24
+ return integration?.type === exports.AGENT_SCHEDULE_TRIGGER_TYPE;
25
+ }
26
+ function isAgentCredentialIntegration(integration) {
27
+ return (integration !== null &&
28
+ integration !== undefined &&
29
+ integration.type !== exports.AGENT_SCHEDULE_TRIGGER_TYPE &&
30
+ 'credentialId' in integration &&
31
+ typeof integration.credentialId === 'string');
32
+ }
33
+ exports.AGENT_BUILDER_DEFAULT_MODEL = 'claude-sonnet-4-5';
34
+ exports.agentBuilderModeSchema = zod_1.z.enum(['default', 'custom']);
35
+ exports.agentBuilderAdminSettingsSchema = zod_1.z.discriminatedUnion('mode', [
36
+ zod_1.z.object({ mode: zod_1.z.literal('default') }),
37
+ zod_1.z.object({
38
+ mode: zod_1.z.literal('custom'),
39
+ provider: zod_1.z.string().min(1),
40
+ credentialId: zod_1.z.string().min(1),
41
+ modelName: zod_1.z.string().min(1),
42
+ }),
43
+ ]);
44
+ exports.agentBuilderAdminSettingsResponseSchema = zod_1.z.object({
45
+ settings: exports.agentBuilderAdminSettingsSchema,
46
+ isConfigured: zod_1.z.boolean(),
47
+ });
48
+ exports.AgentBuilderAdminSettingsUpdateDto = exports.agentBuilderAdminSettingsSchema;
49
+ exports.agentBuilderStatusResponseSchema = zod_1.z.object({
50
+ isConfigured: zod_1.z.boolean(),
51
+ });
52
+ //# sourceMappingURL=agents.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agents.js","sourceRoot":"","sources":["../src/agents.ts"],"names":[],"mappings":";;;AA2FA,gEAIC;AAED,oEAUC;AA3GD,+CAMsB;AACtB,6BAAwB;AAoBX,QAAA,gCAAgC,GAAG;IAC/C,uCAAwB;IACxB,iDAAkC;IAClC,qCAAsB;IACtB,yCAA0B;IAC1B,qCAAsB;CACb,CAAC;AASE,QAAA,0CAA0C,GAAG;IACzD,qBAAqB;IACrB,qBAAqB;IACrB,iCAAiC;CACxB,CAAC;AAEE,QAAA,2BAA2B,GAAG,UAAU,CAAC;AAOzC,QAAA,2BAA2B,GAAG,UAAU,CAAC;AAEzC,QAAA,qCAAqC,GACjD,oDAAoD,CAAC;AAiCtD,SAAgB,0BAA0B,CACzC,WAAgD;IAEhD,OAAO,WAAW,EAAE,IAAI,KAAK,mCAA2B,CAAC;AAC1D,CAAC;AAED,SAAgB,4BAA4B,CAC3C,WAAgD;IAEhD,OAAO,CACN,WAAW,KAAK,IAAI;QACpB,WAAW,KAAK,SAAS;QACzB,WAAW,CAAC,IAAI,KAAK,mCAA2B;QAChD,cAAc,IAAI,WAAW;QAC7B,OAAO,WAAW,CAAC,YAAY,KAAK,QAAQ,CAC5C,CAAC;AACH,CAAC;AAkJY,QAAA,2BAA2B,GAAG,mBAA4B,CAAC;AAE3D,QAAA,sBAAsB,GAAG,OAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC;AAavD,QAAA,+BAA+B,GAAG,OAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE;IAC3E,OAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,OAAC,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;IACxC,OAAC,CAAC,MAAM,CAAC;QACR,IAAI,EAAE,OAAC,CAAC,OAAO,CAAC,QAAQ,CAAC;QACzB,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;QAC3B,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;QAC/B,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;KAC5B,CAAC;CACF,CAAC,CAAC;AAGU,QAAA,uCAAuC,GAAG,OAAC,CAAC,MAAM,CAAC;IAC/D,QAAQ,EAAE,uCAA+B;IACzC,YAAY,EAAE,OAAC,CAAC,OAAO,EAAE;CACzB,CAAC,CAAC;AAMU,QAAA,kCAAkC,GAAG,uCAA+B,CAAC;AAGrE,QAAA,gCAAgC,GAAG,OAAC,CAAC,MAAM,CAAC;IACxD,YAAY,EAAE,OAAC,CAAC,OAAO,EAAE;CACzB,CAAC,CAAC"}