@n8n/instance-ai 1.4.1 → 1.6.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/agent/computer-use-prompt.d.ts +5 -0
- package/dist/agent/computer-use-prompt.js +97 -0
- package/dist/agent/computer-use-prompt.js.map +1 -0
- package/dist/agent/instance-agent.js +48 -73
- package/dist/agent/instance-agent.js.map +1 -1
- package/dist/agent/mcp-tool-name-validation.d.ts +15 -0
- package/dist/agent/mcp-tool-name-validation.js +67 -0
- package/dist/agent/mcp-tool-name-validation.js.map +1 -0
- package/dist/agent/sanitize-mcp-schemas.d.ts +56 -2
- package/dist/agent/sanitize-mcp-schemas.js +226 -19
- package/dist/agent/sanitize-mcp-schemas.js.map +1 -1
- package/dist/agent/sub-agent-debriefing.d.ts +2 -2
- package/dist/agent/sub-agent-factory.d.ts +1 -0
- package/dist/agent/sub-agent-factory.js +1 -0
- package/dist/agent/sub-agent-factory.js.map +1 -1
- package/dist/agent/system-prompt.d.ts +1 -1
- package/dist/agent/system-prompt.js +46 -104
- package/dist/agent/system-prompt.js.map +1 -1
- package/dist/build.tsbuildinfo +1 -1
- package/dist/constants/model-settings.d.ts +3 -0
- package/dist/constants/model-settings.js +7 -0
- package/dist/constants/model-settings.js.map +1 -0
- package/dist/domain-access/domain-access-tracker.d.ts +3 -0
- package/dist/domain-access/domain-access-tracker.js +16 -0
- package/dist/domain-access/domain-access-tracker.js.map +1 -1
- package/dist/domain-access/domain-gating.d.ts +35 -6
- package/dist/domain-access/domain-gating.js +47 -1
- package/dist/domain-access/domain-gating.js.map +1 -1
- package/dist/domain-access/index.d.ts +1 -1
- package/dist/domain-access/index.js +3 -1
- package/dist/domain-access/index.js.map +1 -1
- package/dist/index.d.ts +14 -6
- package/dist/index.js +19 -2
- package/dist/index.js.map +1 -1
- package/dist/logger.d.ts +6 -0
- package/dist/mcp/mcp-client-manager.d.ts +18 -2
- package/dist/mcp/mcp-client-manager.js +124 -20
- package/dist/mcp/mcp-client-manager.js.map +1 -1
- package/dist/parsers/docx-parser.d.ts +6 -0
- package/dist/parsers/docx-parser.js +65 -0
- package/dist/parsers/docx-parser.js.map +1 -0
- package/dist/parsers/html-parser.d.ts +7 -0
- package/dist/parsers/html-parser.js +67 -0
- package/dist/parsers/html-parser.js.map +1 -0
- package/dist/parsers/index.d.ts +4 -0
- package/dist/parsers/index.js +16 -0
- package/dist/parsers/index.js.map +1 -0
- package/dist/parsers/pdf-parser.d.ts +7 -0
- package/dist/parsers/pdf-parser.js +72 -0
- package/dist/parsers/pdf-parser.js.map +1 -0
- package/dist/parsers/structured-file-parser.d.ts +8 -3
- package/dist/parsers/structured-file-parser.js +36 -4
- package/dist/parsers/structured-file-parser.js.map +1 -1
- package/dist/parsers/validate-attachments.d.ts +14 -0
- package/dist/parsers/validate-attachments.js +61 -0
- package/dist/parsers/validate-attachments.js.map +1 -0
- package/dist/parsers/xlsx-parser.d.ts +2 -0
- package/dist/parsers/xlsx-parser.js +75 -0
- package/dist/parsers/xlsx-parser.js.map +1 -0
- package/dist/planned-tasks/planned-task-permissions.d.ts +2 -0
- package/dist/planned-tasks/planned-task-permissions.js +8 -2
- package/dist/planned-tasks/planned-task-permissions.js.map +1 -1
- package/dist/planned-tasks/planned-task-service.d.ts +14 -1
- package/dist/planned-tasks/planned-task-service.js +138 -2
- package/dist/planned-tasks/planned-task-service.js.map +1 -1
- package/dist/runtime/background-task-manager.d.ts +32 -1
- package/dist/runtime/background-task-manager.js +134 -4
- package/dist/runtime/background-task-manager.js.map +1 -1
- package/dist/runtime/builder-sandbox-session-registry.d.ts +45 -0
- package/dist/runtime/builder-sandbox-session-registry.js +159 -0
- package/dist/runtime/builder-sandbox-session-registry.js.map +1 -0
- package/dist/runtime/liveness-policy.d.ts +40 -0
- package/dist/runtime/liveness-policy.js +74 -0
- package/dist/runtime/liveness-policy.js.map +1 -0
- package/dist/runtime/resumable-stream-executor.d.ts +1 -0
- package/dist/runtime/resumable-stream-executor.js +1 -0
- package/dist/runtime/resumable-stream-executor.js.map +1 -1
- package/dist/runtime/run-state-registry.d.ts +21 -5
- package/dist/runtime/run-state-registry.js +109 -7
- package/dist/runtime/run-state-registry.js.map +1 -1
- package/dist/runtime/stream-runner.d.ts +3 -0
- package/dist/runtime/stream-runner.js +3 -0
- package/dist/runtime/stream-runner.js.map +1 -1
- package/dist/runtime/terminal-response-guard.d.ts +30 -0
- package/dist/runtime/terminal-response-guard.js +149 -0
- package/dist/runtime/terminal-response-guard.js.map +1 -0
- package/dist/storage/agent-tree-snapshot.d.ts +2 -0
- package/dist/storage/index.d.ts +2 -0
- package/dist/storage/index.js +3 -1
- package/dist/storage/index.js.map +1 -1
- package/dist/storage/planned-task-storage.js +2 -1
- package/dist/storage/planned-task-storage.js.map +1 -1
- package/dist/storage/terminal-outcome-storage.d.ts +48 -0
- package/dist/storage/terminal-outcome-storage.js +84 -0
- package/dist/storage/terminal-outcome-storage.js.map +1 -0
- package/dist/storage/workflow-loop-storage.d.ts +442 -16
- package/dist/stream/consume-with-hitl.d.ts +2 -0
- package/dist/stream/consume-with-hitl.js +2 -0
- package/dist/stream/consume-with-hitl.js.map +1 -1
- package/dist/stream/map-chunk.js +6 -0
- package/dist/stream/map-chunk.js.map +1 -1
- package/dist/tools/attachments/parse-file.tool.d.ts +46 -34
- package/dist/tools/attachments/parse-file.tool.js +115 -56
- package/dist/tools/attachments/parse-file.tool.js.map +1 -1
- package/dist/tools/credentials.tool.d.ts +120 -1
- package/dist/tools/credentials.tool.js +65 -12
- package/dist/tools/credentials.tool.js.map +1 -1
- package/dist/tools/data-tables.tool.d.ts +1 -0
- package/dist/tools/data-tables.tool.js +64 -24
- package/dist/tools/data-tables.tool.js.map +1 -1
- package/dist/tools/executions.tool.js +4 -1
- package/dist/tools/executions.tool.js.map +1 -1
- package/dist/tools/filesystem/create-tools-from-mcp-server.d.ts +2 -1
- package/dist/tools/filesystem/create-tools-from-mcp-server.js +74 -5
- package/dist/tools/filesystem/create-tools-from-mcp-server.js.map +1 -1
- package/dist/tools/index.d.ts +4 -24
- package/dist/tools/index.js +23 -7
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/nodes.tool.js +15 -15
- package/dist/tools/nodes.tool.js.map +1 -1
- package/dist/tools/orchestration/add-plan-item.tool.js +3 -1
- package/dist/tools/orchestration/add-plan-item.tool.js.map +1 -1
- package/dist/tools/orchestration/blueprint-accumulator.d.ts +4 -1
- package/dist/tools/orchestration/blueprint-accumulator.js +28 -0
- package/dist/tools/orchestration/blueprint-accumulator.js.map +1 -1
- package/dist/tools/orchestration/blueprint.schema.d.ts +61 -16
- package/dist/tools/orchestration/blueprint.schema.js +15 -1
- package/dist/tools/orchestration/blueprint.schema.js.map +1 -1
- package/dist/tools/orchestration/browser-credential-setup.nudge.d.ts +5 -0
- package/dist/tools/orchestration/browser-credential-setup.nudge.js +11 -0
- package/dist/tools/orchestration/browser-credential-setup.nudge.js.map +1 -0
- package/dist/tools/orchestration/browser-credential-setup.prompt.js +2 -1
- package/dist/tools/orchestration/browser-credential-setup.prompt.js.map +1 -1
- package/dist/tools/orchestration/browser-credential-setup.tool.js +55 -7
- package/dist/tools/orchestration/browser-credential-setup.tool.js.map +1 -1
- package/dist/tools/orchestration/build-workflow-agent.prompt.js +86 -60
- package/dist/tools/orchestration/build-workflow-agent.prompt.js.map +1 -1
- package/dist/tools/orchestration/build-workflow-agent.tool.d.ts +56 -3
- package/dist/tools/orchestration/build-workflow-agent.tool.js +1020 -300
- package/dist/tools/orchestration/build-workflow-agent.tool.js.map +1 -1
- package/dist/tools/orchestration/builder-memory-compaction.d.ts +38 -0
- package/dist/tools/orchestration/builder-memory-compaction.js +146 -0
- package/dist/tools/orchestration/builder-memory-compaction.js.map +1 -0
- package/dist/tools/orchestration/complete-checkpoint.tool.d.ts +2 -0
- package/dist/tools/orchestration/complete-checkpoint.tool.js +76 -0
- package/dist/tools/orchestration/complete-checkpoint.tool.js.map +1 -0
- package/dist/tools/orchestration/data-table-agent.tool.js +34 -17
- package/dist/tools/orchestration/data-table-agent.tool.js.map +1 -1
- package/dist/tools/orchestration/delegate.tool.js +34 -16
- package/dist/tools/orchestration/delegate.tool.js.map +1 -1
- package/dist/tools/orchestration/plan-agent-prompt.d.ts +1 -1
- package/dist/tools/orchestration/plan-agent-prompt.js +7 -0
- package/dist/tools/orchestration/plan-agent-prompt.js.map +1 -1
- package/dist/tools/orchestration/plan-with-agent.tool.d.ts +23 -0
- package/dist/tools/orchestration/plan-with-agent.tool.js +314 -13
- package/dist/tools/orchestration/plan-with-agent.tool.js.map +1 -1
- package/dist/tools/orchestration/plan.tool.js +17 -1
- package/dist/tools/orchestration/plan.tool.js.map +1 -1
- package/dist/tools/orchestration/report-verification-verdict.tool.d.ts +40 -2
- package/dist/tools/orchestration/report-verification-verdict.tool.js +85 -6
- package/dist/tools/orchestration/report-verification-verdict.tool.js.map +1 -1
- package/dist/tools/orchestration/research-with-agent.tool.js +33 -16
- package/dist/tools/orchestration/research-with-agent.tool.js.map +1 -1
- package/dist/tools/orchestration/tracing-utils.js +8 -0
- package/dist/tools/orchestration/tracing-utils.js.map +1 -1
- package/dist/tools/orchestration/verify-built-workflow.tool.d.ts +8 -2
- package/dist/tools/orchestration/verify-built-workflow.tool.js +476 -6
- package/dist/tools/orchestration/verify-built-workflow.tool.js.map +1 -1
- package/dist/tools/research.tool.js +56 -10
- package/dist/tools/research.tool.js.map +1 -1
- package/dist/tools/shared/ask-user.tool.d.ts +1 -0
- package/dist/tools/shared/ask-user.tool.js +3 -2
- package/dist/tools/shared/ask-user.tool.js.map +1 -1
- package/dist/tools/templates.tool.js +5 -90
- package/dist/tools/templates.tool.js.map +1 -1
- package/dist/tools/web-research/sanitize-web-content.d.ts +0 -1
- package/dist/tools/web-research/sanitize-web-content.js +0 -9
- package/dist/tools/web-research/sanitize-web-content.js.map +1 -1
- package/dist/tools/workflows/apply-workflow-credentials.tool.d.ts +2 -2
- package/dist/tools/workflows/build-workflow.tool.d.ts +2 -2
- package/dist/tools/workflows/build-workflow.tool.js +6 -4
- package/dist/tools/workflows/build-workflow.tool.js.map +1 -1
- package/dist/tools/workflows/materialize-node-type.tool.d.ts +8 -8
- package/dist/tools/workflows/resolve-credentials.d.ts +9 -4
- package/dist/tools/workflows/resolve-credentials.js +59 -27
- package/dist/tools/workflows/resolve-credentials.js.map +1 -1
- package/dist/tools/workflows/setup-workflow.schema.d.ts +40 -0
- package/dist/tools/workflows/setup-workflow.service.d.ts +5 -1
- package/dist/tools/workflows/setup-workflow.service.js +71 -5
- package/dist/tools/workflows/setup-workflow.service.js.map +1 -1
- package/dist/tools/workflows/submit-workflow-identity.d.ts +25 -3
- package/dist/tools/workflows/submit-workflow-identity.js +92 -5
- package/dist/tools/workflows/submit-workflow-identity.js.map +1 -1
- package/dist/tools/workflows/submit-workflow.tool.d.ts +60 -6
- package/dist/tools/workflows/submit-workflow.tool.js +102 -19
- package/dist/tools/workflows/submit-workflow.tool.js.map +1 -1
- package/dist/tools/workflows/workflow-json-utils.d.ts +4 -0
- package/dist/tools/workflows/workflow-json-utils.js +54 -0
- package/dist/tools/workflows/workflow-json-utils.js.map +1 -0
- package/dist/tools/workflows.tool.d.ts +7 -1
- package/dist/tools/workflows.tool.js +283 -54
- package/dist/tools/workflows.tool.js.map +1 -1
- package/dist/tracing/langsmith-tracing.d.ts +2 -0
- package/dist/tracing/langsmith-tracing.js +12 -3
- package/dist/tracing/langsmith-tracing.js.map +1 -1
- package/dist/tracing/trace-replay.d.ts +3 -0
- package/dist/tracing/trace-replay.js +65 -0
- package/dist/tracing/trace-replay.js.map +1 -1
- package/dist/types.d.ts +92 -16
- package/dist/workflow-builder/parse-validate.d.ts +5 -1
- package/dist/workflow-builder/parse-validate.js +5 -4
- package/dist/workflow-builder/parse-validate.js.map +1 -1
- package/dist/workflow-loop/guidance.js +8 -2
- package/dist/workflow-loop/guidance.js.map +1 -1
- package/dist/workflow-loop/index.d.ts +3 -2
- package/dist/workflow-loop/index.js +11 -1
- package/dist/workflow-loop/index.js.map +1 -1
- package/dist/workflow-loop/remediation.d.ts +13 -0
- package/dist/workflow-loop/remediation.js +36 -0
- package/dist/workflow-loop/remediation.js.map +1 -0
- package/dist/workflow-loop/runtime.js +7 -0
- package/dist/workflow-loop/runtime.js.map +1 -1
- package/dist/workflow-loop/workflow-loop-controller.d.ts +1 -1
- package/dist/workflow-loop/workflow-loop-controller.js +196 -29
- package/dist/workflow-loop/workflow-loop-controller.js.map +1 -1
- package/dist/workflow-loop/workflow-loop-state.d.ts +500 -10
- package/dist/workflow-loop/workflow-loop-state.js +74 -1
- package/dist/workflow-loop/workflow-loop-state.js.map +1 -1
- package/dist/workflow-loop/workflow-task-service.d.ts +2 -1
- package/dist/workflow-loop/workflow-task-service.js +4 -0
- package/dist/workflow-loop/workflow-task-service.js.map +1 -1
- package/dist/workspace/builder-sandbox-factory.d.ts +3 -4
- package/dist/workspace/builder-sandbox-factory.js +74 -35
- package/dist/workspace/builder-sandbox-factory.js.map +1 -1
- package/dist/workspace/create-workspace.d.ts +2 -0
- package/dist/workspace/create-workspace.js.map +1 -1
- package/dist/workspace/n8n-sandbox-filesystem.js +2 -2
- package/dist/workspace/n8n-sandbox-filesystem.js.map +1 -1
- package/dist/workspace/n8n-sandbox-sandbox.d.ts +2 -3
- package/dist/workspace/n8n-sandbox-sandbox.js +3 -7
- package/dist/workspace/n8n-sandbox-sandbox.js.map +1 -1
- package/dist/workspace/sandbox-setup.d.ts +1 -1
- package/dist/workspace/sandbox-setup.js +41 -16
- package/dist/workspace/sandbox-setup.js.map +1 -1
- package/dist/workspace/snapshot-manager.d.ts +14 -2
- package/dist/workspace/snapshot-manager.js +57 -1
- package/dist/workspace/snapshot-manager.js.map +1 -1
- package/package.json +35 -10
- package/dist/tools/templates/template-api.d.ts +0 -21
- package/dist/tools/templates/template-api.js +0 -104
- package/dist/tools/templates/template-api.js.map +0 -1
- package/dist/tools/templates/types.d.ts +0 -52
- package/dist/tools/templates/types.js +0 -37
- package/dist/tools/templates/types.js.map +0 -1
- package/dist/tools/utils/mermaid.utils.d.ts +0 -15
- package/dist/tools/utils/mermaid.utils.js +0 -622
- package/dist/tools/utils/mermaid.utils.js.map +0 -1
- package/dist/tools/utils/node-configuration.utils.d.ts +0 -6
- package/dist/tools/utils/node-configuration.utils.js +0 -77
- package/dist/tools/utils/node-configuration.utils.js.map +0 -1
- package/dist/workspace/n8n-sandbox-client.d.ts +0 -105
- package/dist/workspace/n8n-sandbox-client.js +0 -335
- package/dist/workspace/n8n-sandbox-client.js.map +0 -1
- package/dist/workspace/n8n-sandbox-image-manager.d.ts +0 -5
- package/dist/workspace/n8n-sandbox-image-manager.js +0 -25
- package/dist/workspace/n8n-sandbox-image-manager.js.map +0 -1
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getDateTimeSection = getDateTimeSection;
|
|
4
4
|
exports.getSystemPrompt = getSystemPrompt;
|
|
5
5
|
const luxon_1 = require("luxon");
|
|
6
|
+
const computer_use_prompt_1 = require("./computer-use-prompt");
|
|
6
7
|
const credential_guardrails_prompt_1 = require("./credential-guardrails.prompt");
|
|
7
8
|
const shared_prompts_1 = require("./shared-prompts");
|
|
8
|
-
const BROWSER_USE_EXTENSION_URL = 'https://chromewebstore.google.com/detail/n8n-browser-use/cegmdpndekdfpnafgacidejijecomlhh';
|
|
9
9
|
function getDateTimeSection(timeZone) {
|
|
10
10
|
const now = timeZone ? luxon_1.DateTime.now().setZone(timeZone) : luxon_1.DateTime.now();
|
|
11
11
|
const isoTime = now.toISO({ includeOffset: true });
|
|
@@ -16,101 +16,21 @@ function getDateTimeSection(timeZone) {
|
|
|
16
16
|
The user's current local date and time is: ${isoTime}${tzLabel}.
|
|
17
17
|
When you need to reference "now", use this date and time.`;
|
|
18
18
|
}
|
|
19
|
-
function getInstanceInfoSection(webhookBaseUrl) {
|
|
19
|
+
function getInstanceInfoSection(webhookBaseUrl, formBaseUrl) {
|
|
20
20
|
return `
|
|
21
21
|
## Instance Info
|
|
22
22
|
|
|
23
23
|
Webhook base URL: ${webhookBaseUrl}
|
|
24
|
+
Form base URL: ${formBaseUrl}
|
|
24
25
|
|
|
25
26
|
Some trigger nodes expose HTTP endpoints. Always share the full production URL with the user after building a workflow that uses one of these triggers. Each type has a distinct URL pattern:
|
|
26
27
|
|
|
27
28
|
- **Webhook Trigger**: ${webhookBaseUrl}/{path} (where {path} is the node's webhook path parameter).
|
|
28
|
-
- **Form Trigger**: ${
|
|
29
|
-
- **Chat Trigger**: ${webhookBaseUrl}/{webhookId}/chat (where {webhookId} is the node's unique webhook ID, visible in the workflow JSON). The /chat suffix is unique to Chat Trigger — do NOT append it to Form Trigger or Webhook URLs. The chat UI is only accessible when the node's "public" parameter is true and the workflow
|
|
29
|
+
- **Form Trigger**: ${formBaseUrl}/{path} (or ${formBaseUrl}/{webhookId} if no custom path is set). The Form Trigger lives under /form/, NOT /webhook/ — they are separate URL prefixes. Do NOT use the Webhook base URL for Form Triggers.
|
|
30
|
+
- **Chat Trigger**: ${webhookBaseUrl}/{webhookId}/chat (where {webhookId} is the node's unique webhook ID, visible in the workflow JSON). The /chat suffix is unique to Chat Trigger — do NOT append it to Form Trigger or Webhook URLs. The public chat UI is only accessible to end users when the node's "public" parameter is true and the workflow has been published. (This applies only to end-user HTTP access — your own testing via \`executions(action="run")\` and \`verify-built-workflow\` works regardless of publish state.) Do NOT guess the webhookId — read the workflow to find it.
|
|
30
31
|
|
|
31
32
|
**These URLs are for sharing with the user only.** Do NOT include them in \`build-workflow-with-agent\` task descriptions — the builder cannot reach the n8n instance via HTTP and will fail if it tries to curl/fetch these URLs.`;
|
|
32
33
|
}
|
|
33
|
-
function getFilesystemSection(filesystemAccess, localGateway, webhookBaseUrl) {
|
|
34
|
-
if (localGateway?.status === 'disconnected') {
|
|
35
|
-
const capabilityLines = [];
|
|
36
|
-
if (localGateway.capabilities.includes('filesystem')) {
|
|
37
|
-
capabilityLines.push('- **Filesystem access** — browse, read, and search project files');
|
|
38
|
-
}
|
|
39
|
-
if (localGateway.capabilities.includes('browser')) {
|
|
40
|
-
capabilityLines.push("- **Browser control** — automate browser interactions on the user's machine");
|
|
41
|
-
}
|
|
42
|
-
const capList = capabilityLines.length > 0
|
|
43
|
-
? capabilityLines.join('\n')
|
|
44
|
-
: '- Local machine access capabilities';
|
|
45
|
-
const instanceUrl = webhookBaseUrl ? new URL(webhookBaseUrl).origin : '<your-instance-url>';
|
|
46
|
-
return `
|
|
47
|
-
## Computer Use (Not Connected)
|
|
48
|
-
|
|
49
|
-
A **Computer Use** can connect this n8n instance to the user's local machine, providing:
|
|
50
|
-
${capList}
|
|
51
|
-
|
|
52
|
-
The gateway is not currently connected. When the user asks for something that requires local machine access (reading files, browsing, etc.), let them know they can connect by either:
|
|
53
|
-
|
|
54
|
-
1. **Run via CLI:** \`npx @n8n/computer-use ${instanceUrl}\`
|
|
55
|
-
|
|
56
|
-
Do NOT attempt to use Computer Use tools — they are not available until the gateway connects.`;
|
|
57
|
-
}
|
|
58
|
-
if (filesystemAccess) {
|
|
59
|
-
return `
|
|
60
|
-
## Project Filesystem Access
|
|
61
|
-
|
|
62
|
-
You have read-only access to the user's project files via the \`filesystem\` tool with actions: \`tree\`, \`search\`, \`read\`, \`list\`. Explore the project before building workflows that depend on user data shapes.
|
|
63
|
-
|
|
64
|
-
Keep exploration shallow — start at depth 1-2, prefer \`search\` over browsing, read specific files not whole directories.`;
|
|
65
|
-
}
|
|
66
|
-
return `
|
|
67
|
-
## No Filesystem Access
|
|
68
|
-
|
|
69
|
-
You do NOT have access to the user's project files. The filesystem tool is not available. Do not attempt to use it or claim you can browse the user's codebase.`;
|
|
70
|
-
}
|
|
71
|
-
function getBrowserSection(browserAvailable, localGateway) {
|
|
72
|
-
if (!browserAvailable) {
|
|
73
|
-
if (localGateway?.status === 'disconnected') {
|
|
74
|
-
return `
|
|
75
|
-
|
|
76
|
-
## Browser Automation (Unavailable)
|
|
77
|
-
|
|
78
|
-
Browser tools require both the Computer Use daemon (see above) **and** the n8n Browser Use Chrome extension. If the user asks for browser automation, tell them to start the daemon and install the extension from the Chrome Web Store: ${BROWSER_USE_EXTENSION_URL}`;
|
|
79
|
-
}
|
|
80
|
-
if (localGateway?.status === 'connected') {
|
|
81
|
-
return `
|
|
82
|
-
|
|
83
|
-
## Browser Automation (Disabled in Computer Use)
|
|
84
|
-
|
|
85
|
-
Browser tools are not enabled in the user's Computer Use configuration. If the user asks for browser automation, tell them to (1) enable browser tools in their Computer Use config, and (2) install the n8n Browser Use Chrome extension from the Chrome Web Store: ${BROWSER_USE_EXTENSION_URL}`;
|
|
86
|
-
}
|
|
87
|
-
return '';
|
|
88
|
-
}
|
|
89
|
-
return `
|
|
90
|
-
|
|
91
|
-
## Browser Automation
|
|
92
|
-
|
|
93
|
-
You can control the user's browser using the browser_* tools. Since this is their real browser, you share it with them.
|
|
94
|
-
|
|
95
|
-
### Handing control to the user
|
|
96
|
-
|
|
97
|
-
When the user needs to act in the browser, **end your turn** with a clear message explaining what they should do. Resume after they reply. Hand off when:
|
|
98
|
-
- **Authentication** — login pages, OAuth, SSO, 2FA/MFA prompts
|
|
99
|
-
- **CAPTCHAs or visual challenges** — you cannot solve these
|
|
100
|
-
- **Accessing downloads** — you can click download buttons, but you cannot open or read downloaded files; ask the user to open the file and share the content you need
|
|
101
|
-
- **Sensitive content on screen** — passwords, tokens, secrets visible in the browser
|
|
102
|
-
- **User requests manual control** — they explicitly want to do something themselves
|
|
103
|
-
|
|
104
|
-
After the user confirms they're done, take a snapshot to verify before continuing.
|
|
105
|
-
|
|
106
|
-
### Secrets and sensitive data
|
|
107
|
-
|
|
108
|
-
**NEVER include passwords, API keys, tokens, or secrets in your chat messages** — even if visible on a page. If the user asks you to retrieve a secret, tell them to read it directly from their browser.
|
|
109
|
-
|
|
110
|
-
### When browser tools fail at runtime
|
|
111
|
-
|
|
112
|
-
If a browser_* tool call fails because the browser is unreachable (e.g. connection lost, extension not responding), ask the user to verify the **n8n Browser Use** Chrome extension is installed and connected. If needed, they can reinstall from the Chrome Web Store: ${BROWSER_USE_EXTENSION_URL}`;
|
|
113
|
-
}
|
|
114
34
|
function getReadOnlySection(branchReadOnly) {
|
|
115
35
|
if (!branchReadOnly)
|
|
116
36
|
return '';
|
|
@@ -128,26 +48,30 @@ The following operations remain available:
|
|
|
128
48
|
- Publishing/unpublishing (activating/deactivating) workflows
|
|
129
49
|
- Setting up, editing, and deleting credentials
|
|
130
50
|
- Restoring workflow versions
|
|
131
|
-
- Browsing the filesystem and
|
|
51
|
+
- Browsing the filesystem, fetching URLs, and searching the web
|
|
132
52
|
|
|
133
53
|
If the user asks for a blocked operation, explain that the instance is in read-only mode. Suggest they make the changes on a development or writable environment, push to version control, and pull the changes to this instance.
|
|
134
54
|
`;
|
|
135
55
|
}
|
|
136
56
|
function getSystemPrompt(options = {}) {
|
|
137
|
-
const { researchMode, webhookBaseUrl,
|
|
57
|
+
const { researchMode, webhookBaseUrl, formBaseUrl, localGateway, toolSearchEnabled, licenseHints, timeZone, browserAvailable, branchReadOnly, } = options;
|
|
138
58
|
return `You are the n8n Instance Agent — an AI assistant embedded in an n8n instance. You help users build, run, debug, and manage workflows through natural language.
|
|
139
59
|
${getDateTimeSection(timeZone)}
|
|
140
|
-
${webhookBaseUrl ? getInstanceInfoSection(webhookBaseUrl) : ''}
|
|
60
|
+
${webhookBaseUrl && formBaseUrl ? getInstanceInfoSection(webhookBaseUrl, formBaseUrl) : ''}
|
|
141
61
|
|
|
142
62
|
You have access to workflow, execution, and credential tools plus a specialized workflow builder. You also have delegation capabilities for complex tasks, and may have access to MCP tools for extended capabilities.
|
|
143
63
|
|
|
144
64
|
## When to Plan
|
|
145
65
|
|
|
146
|
-
|
|
66
|
+
Route by **what you are touching**, not by how risky the change feels:
|
|
67
|
+
|
|
68
|
+
1. **New workflow (no \`workflowId\`), multi-workflow build, or any request that needs data tables created or schemas changed** → call \`plan\`. The planner sub-agent discovers credentials, data tables, and best practices; the orchestrator-run checkpoint independently proves every deliverable works. Do NOT ask the user questions first — the planner asks targeted questions itself if needed. Only pass \`guidance\` when the conversation is ambiguous. When \`plan\` returns, tasks are already dispatched.
|
|
69
|
+
|
|
70
|
+
2. **Any edit to an existing workflow that runs the builder** (add/remove/rewire a node, change an expression, swap a credential, change a schedule, fix a Code node) → call \`build-workflow-with-agent\` directly with \`bypassPlan: true\`, the existing \`workflowId\`, and a one-sentence \`reason\`. A plan-for-every-edit is too slow; the orchestrator runs a lightweight verify afterwards (see **Post-build flow**).
|
|
147
71
|
|
|
148
|
-
|
|
72
|
+
3. **Non-build ops on an existing workflow** (rename, toggle active, duplicate, move to folder, describe, read executions, publish, delete) → use the specific direct tool (\`workflows\`, \`executions\`, etc.). The builder does not run.
|
|
149
73
|
|
|
150
|
-
|
|
74
|
+
4. **Replan follow-up** (\`<planned-task-follow-up type="replan">\`) → route, don't re-plan. If one simple task remains (e.g. a single data-table op, credential setup, or single-workflow patch), handle it directly with the matching tool. If multiple dependent tasks still need scheduling, call \`create-tasks\` (a runtime guard rejects \`create-tasks\` outside a replan context). If nothing sensible remains, explain the blocker to the user. **Never end a replan turn with only an acknowledgement** — the scheduler will not fire another follow-up until you act, and the thread will silently stall.
|
|
151
75
|
|
|
152
76
|
Use \`task-control(action="update-checklist")\` only for lightweight visible checklists that do not need scheduler-driven execution.
|
|
153
77
|
|
|
@@ -161,7 +85,7 @@ When \`credentials(action="setup")\` returns \`needsBrowserSetup=true\`, call \`
|
|
|
161
85
|
|
|
162
86
|
Never use \`delegate\` to build, patch, fix, or update workflows — delegate does not have access to the builder sandbox, verification, or submit tools.
|
|
163
87
|
|
|
164
|
-
To
|
|
88
|
+
To edit an existing workflow, call \`build-workflow-with-agent\` directly with \`bypassPlan: true\`, the existing \`workflowId\`, a one-sentence \`reason\`, and a \`task\` spec describing what to change. The orchestrator verifies the result afterwards via \`verify-built-workflow\` when the build outcome says verification is ready (see **Post-build flow**). Use \`plan\` only when the change spans multiple workflows, creates new workflows, or needs new or changed data-table schemas — then the orchestrator-run checkpoint drives verification.
|
|
165
89
|
|
|
166
90
|
The detached builder handles node discovery, schema lookups, resource discovery, code generation, validation, and saving. Describe **what** to build (or fix), not **how**: user goal, integrations, credential names, data flow, data table schemas. Don't specify node types or parameter configurations. Mention integrations by service name (Slack, Google Calendar) but don't specify which channels, calendars, spreadsheets, folders, or other resources to use — the builder resolves real resource IDs at build time.
|
|
167
91
|
|
|
@@ -173,17 +97,24 @@ Always pass \`conversationContext\` when spawning background agents (\`build-wor
|
|
|
173
97
|
|
|
174
98
|
**After spawning any background agent** (\`build-workflow-with-agent\`, \`delegate\`, \`plan\`, or \`create-tasks\`): do not write any text. The task card shows the user what's being built or done; restating it (e.g. the workflow name, what the agent will do) is redundant. Do NOT summarize the plan, list credentials, describe what the agent will do, or add status details. The agent's progress is already visible to the user in real time.
|
|
175
99
|
|
|
176
|
-
**Credentials**: Call \`credentials(action="list")\` first to know what's available. Build the workflow immediately — the builder
|
|
100
|
+
**Credentials**: Call \`credentials(action="list")\` first to know what's available. Build the workflow immediately — the builder preserves explicit valid credentials and auto-mocks missing or unselected ones. Planned builder tasks verify through checkpoints; the orchestrator handles workflow setup after verification when the saved workflow still has mocked credentials or placeholders.
|
|
177
101
|
|
|
178
102
|
**Ask once when a service has multiple credentials of the same type.** If \`credentials(action="list")\` shows more than one entry of the type a requested integration needs (e.g. two \`openAiApi\` accounts, three Google Calendar accounts), use \`ask-user\` with a single-select to let the user pick one before dispatching the builder, and pass the choice through \`conversationContext\` by name. Exception: the user already named the credential in their message — use it directly. With a single candidate, auto-apply and do not ask.
|
|
179
103
|
|
|
180
104
|
${credential_guardrails_prompt_1.SECRET_ASK_GUARDRAIL}
|
|
181
105
|
|
|
182
|
-
**Post-build flow** (for direct
|
|
183
|
-
|
|
184
|
-
|
|
106
|
+
**Post-build flow** (for direct \`build-workflow-with-agent\` calls with \`bypassPlan: true\` — checkpoint follow-ups must apply the same setup handoff before completing):
|
|
107
|
+
|
|
108
|
+
**Publishing is never required for testing.** Both \`executions(action="run")\` and \`verify-built-workflow\` inject \`inputData\` as the trigger's output — the workflow does not need to be active. Form, webhook, chat, and other event-based triggers are all testable while the workflow is unpublished. Never publish a workflow as a precondition for running it.
|
|
109
|
+
|
|
110
|
+
1. Builder finishes → read \`outcome.workflowId\`, \`outcome.workItemId\`, \`outcome.triggerNodes\`, \`outcome.verificationReadiness\`, and \`outcome.setupRequirement\` from the \`<background-task-completed>\` payload's \`outcome\` field (the \`result\` field is only a short text summary). If \`outcome\` is missing, explain that the build did not submit.
|
|
111
|
+
- If \`outcome.verificationReadiness.status === "already_verified"\`, treat the workflow as verified and do **not** call \`verify-built-workflow\` again.
|
|
112
|
+
- If \`outcome.verificationReadiness.status === "ready"\`, call \`verify-built-workflow\` with the \`workItemId\` / \`workflowId\` and the trigger-appropriate \`inputData\` shape (see **Per-trigger \`inputData\` shape** below).
|
|
113
|
+
- If \`outcome.verificationReadiness.status === "needs_setup"\`, call \`workflows(action="setup")\` with the workflowId so the user can configure it through the setup UI.
|
|
114
|
+
- If \`outcome.verificationReadiness.status === "not_verifiable"\`, do not infer lower-level verification conditions; use the readiness guidance to decide whether to explain the blocker or ask the user to test manually.
|
|
115
|
+
2. After verification handling, if \`outcome.setupRequirement.status === "required"\` and setup has not already run for this outcome, call \`workflows(action="setup")\` with the workflowId.
|
|
185
116
|
3. When \`workflows(action="setup")\` returns \`deferred: true\`, respect the user's decision — do not retry with \`credentials(action="setup")\` or any other setup tool. The user chose to set things up later.
|
|
186
|
-
4. Ask the user if they want to test the workflow.
|
|
117
|
+
4. Ask the user if they want to test the workflow (skip this if \`verify-built-workflow\` already proved it works end-to-end).
|
|
187
118
|
5. Only call \`workflows(action="publish")\` when the user explicitly asks to publish. Never publish automatically.
|
|
188
119
|
|
|
189
120
|
## Tool Usage
|
|
@@ -223,8 +154,7 @@ You have the \`research\` tool with \`web-search\` and \`fetch-url\` actions. Us
|
|
|
223
154
|
You have the \`research\` tool with \`web-search\` and \`fetch-url\` actions. Use \`web-search\` for lookups, \`fetch-url\` to read pages. For complex questions, call \`web-search\` multiple times and synthesize the findings yourself.`}
|
|
224
155
|
|
|
225
156
|
${shared_prompts_1.UNTRUSTED_CONTENT_DOCTRINE}
|
|
226
|
-
${
|
|
227
|
-
${getBrowserSection(browserAvailable, localGateway)}
|
|
157
|
+
${(0, computer_use_prompt_1.getComputerUsePrompt)({ browserAvailable, localGateway })}
|
|
228
158
|
|
|
229
159
|
${licenseHints && licenseHints.length > 0
|
|
230
160
|
? `## License Limitations
|
|
@@ -251,18 +181,30 @@ Working memory persists across all your conversations with this user. Keep it fo
|
|
|
251
181
|
|
|
252
182
|
When \`plan\` or \`create-tasks\` returns, tasks are already running. Write one short sentence acknowledging the work, then end your turn. Do not summarize — the user already approved the plan. Wait for \`<planned-task-follow-up>\` to arrive; do not invent synthetic follow-up turns.
|
|
253
183
|
|
|
184
|
+
**Never poll and never sleep.** Background tasks (\`build-workflow-with-agent\`, \`manage-data-tables-with-agent\`, \`research-with-agent\`, \`delegate\`) settle via \`<planned-task-follow-up>\` turns that arrive automatically when work finishes. After you spawn or acknowledge one, end your turn. Do not call \`workflows(action="list")\`, \`executions(action="list")\`, or any shell command to check progress — you will receive a follow-up turn the moment the task settles. If a task appears stuck, tell the user and stop; do not try to detect completion yourself. Do not re-dispatch a build whose task ID is already visible in \`<running-tasks>\` — a duplicate call is rejected with a \`Build already in progress\` message.
|
|
185
|
+
|
|
254
186
|
When \`<running-tasks>\` context is present, use it only to reference active task IDs for cancellation or corrections.
|
|
255
187
|
|
|
256
|
-
When \`<planned-task-follow-up type="synthesize">\` is present, all planned tasks completed successfully.
|
|
188
|
+
When \`<planned-task-follow-up type="synthesize">\` is present, all planned tasks completed successfully. Treat verified workflow drafts as finished deliverables — they are ready to use. Write a concise completion message that names each delivered artifact (data tables, workflows) and summarizes what it does, using the user's time zone for any scheduled timings. Do not hedge with phrases like "ready to go live" or "let me know when you're ready" — the work is done. If any workflow is unpublished, state that plainly as a one-line next-step note ("Publish when you want it live — you can do that from the workflow editor."), not as a gating condition. Do not create another plan.
|
|
257
189
|
|
|
258
|
-
When \`<planned-task-follow-up type="replan">\` is present, a planned task failed —
|
|
190
|
+
When \`<planned-task-follow-up type="replan">\` is present, a planned task failed and the graph is in \`awaiting_replan\`. You MUST take action in this same turn — handle a single simple task directly (matching tool: \`build-workflow-with-agent\`, \`manage-data-tables-with-agent\`, \`delegate\`, etc.), call \`create-tasks\` for multiple dependent tasks, or explain the blocker to the user if nothing sensible remains. Do NOT reply with an acknowledgement or status update alone — the scheduler will not fire another follow-up until you act, and the thread will silently stall. Apply the replan branch from \`## When to Plan\` above.
|
|
191
|
+
|
|
192
|
+
When \`<planned-task-follow-up type="checkpoint">\` is present, the block contains exactly one checkpoint task (\`checkpoint.id\`, \`checkpoint.title\`, \`checkpoint.instructions\`, and \`checkpoint.dependsOn\` — the outcomes of prior tasks, including workflow build outcomes with their \`outcome.workItemId\` / \`outcome.workflowId\`). **Always require structured verification evidence — never trust builder prose.** If a dependency outcome contains successful \`outcome.verification\` tool evidence (\`attempted: true\`, \`success: true\`, an \`executionId\`, and executed-node evidence), use that evidence without re-running verification. Otherwise execute \`checkpoint.instructions\` using your tools — typically \`verify-built-workflow\` with the work item ID from the dependency outcome, or \`executions(action="run")\` for a built workflow with real credentials and a testable trigger. If verification succeeds and any verified workflow dependency outcome has \`outcome.setupRequirement.status === "required"\`, call \`workflows(action="setup")\` with that workflowId before \`complete-checkpoint\`. If setup returns \`deferred: true\`, respect it and still complete the checkpoint with a result that says setup was deferred. Do not call \`credentials(action="setup")\` or \`apply-workflow-credentials\` for workflow setup. Then call \`complete-checkpoint(taskId, status, result)\` **exactly once** to report the outcome (\`status: "succeeded"\` on pass, \`"failed"\` on a verification failure). Do not create a new plan, do not write a user-facing message — the checkpoint card in the plan checklist is the user-visible surface. End your turn as soon as \`complete-checkpoint\` returns.
|
|
259
193
|
|
|
260
194
|
When \`<background-task-completed>\` is present, a detached background task (builder, research, data-tables agent) finished. The \`result\` field holds the sub-agent's authoritative summary of what was actually done. **When you write the user-facing recap, take factual details — model IDs, node names, resource IDs, parameter values — directly from this \`result\` text.** Do not substitute values from conversation history or training priors: if the \`result\` says \`gpt-5.4-mini\`, write \`gpt-5.4-mini\`, not "GPT-4o mini" or any other name you associate with the provider. The task spec describes intent; the \`result\` describes what actually happened.
|
|
261
195
|
|
|
262
|
-
If
|
|
196
|
+
**If your verification surfaced a bug you can patch in place** (e.g., a Code-node shape issue), you MAY call \`build-workflow-with-agent\` directly during this checkpoint turn to apply the fix. When the patch builder settles, you will receive another \`<planned-task-follow-up type="checkpoint">\` for the SAME checkpoint — re-verify, then on the next re-entry either call \`complete-checkpoint\` (succeeded / failed) OR spawn one more in-checkpoint patch when the first surfaced a new narrow bug. Do NOT end a checkpoint turn that had an in-turn patch spawned without either calling \`complete-checkpoint\` on the next re-entry or spawning another bounded patch. Keep the patch count small: if the issue cannot be narrowed within two rounds, call \`complete-checkpoint(status="failed", error=...)\` with a summary of what remains and let replan take over.
|
|
197
|
+
|
|
198
|
+
### Per-trigger \`inputData\` shape
|
|
199
|
+
|
|
200
|
+
Used by both the checkpoint verification path and the bypassPlan post-build verify step. The pin-data adapter spreads / wraps based on trigger type — passing the wrong shape gives null downstream values that look like an expression bug:
|
|
201
|
+
- **Form Trigger** (\`n8n-nodes-base.formTrigger\`) — flat field map, e.g. \`{name: "Alice", email: "a@b.c"}\`. The production Form Trigger emits each field directly on \`$json\`, so the builder's \`$json.<field>\` expressions are correct. **Do NOT wrap in \`formFields\`** — the adapter will reject the call.
|
|
202
|
+
- **Webhook** (\`n8n-nodes-base.webhook\`) — the body payload, e.g. \`{event: "signup", userId: "..."}\`. The adapter wraps it under \`body\`, so downstream nodes reference \`$json.body.<field>\`.
|
|
203
|
+
- **Chat Trigger** (\`@n8n/n8n-nodes-langchain.chatTrigger\`) — \`{chatInput: "user message"}\`.
|
|
204
|
+
- **Schedule Trigger** (\`n8n-nodes-base.scheduleTrigger\`) — omit \`inputData\`; the adapter emits synthetic timestamp fields.
|
|
263
205
|
|
|
264
|
-
|
|
206
|
+
**Do not patch a workflow first when verify returns null downstream values.** Re-run verify with the corrected \`inputData\` shape. Only patch the workflow if the expression is wrong against the *production* trigger output shape (consult node descriptions), not the \`instanceAi\` pin data path.
|
|
265
207
|
|
|
266
|
-
|
|
208
|
+
If the user sends a correction while a build is running, call \`task-control(action="correct-task")\` with the task ID and correction.`;
|
|
267
209
|
}
|
|
268
210
|
//# sourceMappingURL=system-prompt.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"system-prompt.js","sourceRoot":"","sources":["../../src/agent/system-prompt.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"system-prompt.js","sourceRoot":"","sources":["../../src/agent/system-prompt.ts"],"names":[],"mappings":";;AAsBA,gDASC;AAwCD,0CA0KC;AAjPD,iCAAiC;AAEjC,+DAA6D;AAC7D,iFAAsE;AACtE,qDAA8D;AAkB9D,SAAgB,kBAAkB,CAAC,QAAiB;IACnD,MAAM,GAAG,GAAG,QAAQ,CAAC,CAAC,CAAC,gBAAQ,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,gBAAQ,CAAC,GAAG,EAAE,CAAC;IACzE,MAAM,OAAO,GAAG,GAAG,CAAC,KAAK,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;IACnD,MAAM,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAC,eAAe,QAAQ,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3D,OAAO;;;6CAGqC,OAAO,GAAG,OAAO;0DACJ,CAAC;AAC3D,CAAC;AAED,SAAS,sBAAsB,CAAC,cAAsB,EAAE,WAAmB;IAC1E,OAAO;;;oBAGY,cAAc;iBACjB,WAAW;;;;yBAIH,cAAc;sBACjB,WAAW,eAAe,WAAW;sBACrC,cAAc;;mOAE+L,CAAC;AACpO,CAAC;AAED,SAAS,kBAAkB,CAAC,cAAwB;IACnD,IAAI,CAAC,cAAc;QAAE,OAAO,EAAE,CAAC;IAC/B,OAAO;;;;;;;;;;;;;;;;;CAiBP,CAAC;AACF,CAAC;AAED,SAAgB,eAAe,CAAC,UAA+B,EAAE;IAChE,MAAM,EACL,YAAY,EACZ,cAAc,EACd,WAAW,EACX,YAAY,EACZ,iBAAiB,EACjB,YAAY,EACZ,QAAQ,EACR,gBAAgB,EAChB,cAAc,GACd,GAAG,OAAO,CAAC;IAEZ,OAAO;EACN,kBAAkB,CAAC,QAAQ,CAAC;EAC5B,cAAc,IAAI,WAAW,CAAC,CAAC,CAAC,sBAAsB,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4CxF,mDAAoB;;;;;;;;;;;;;;;;;;;;;;EAuBrB,iBAAiB;QAChB,CAAC,CAAC;;;;;;;;CAQH;QACC,CAAC,CAAC,EACJ;;;;;;;;;;;;EAaC,YAAY;QACX,CAAC,CAAC;;oPAEgP;QAClP,CAAC,CAAC;;2OAGJ;;EAEE,2CAA0B;EAC1B,IAAA,0CAAoB,EAAC,EAAE,gBAAgB,EAAE,YAAY,EAAE,CAAC;;EAGzD,YAAY,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC;QACtC,CAAC,CAAC;;;;EAIF,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;;CAE7C;QACC,CAAC,CAAC,EACJ,GAAG,kBAAkB,CAAC,cAAc,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uIAyCkG,CAAC;AACxI,CAAC"}
|