@n8n/instance-ai 1.25.1 → 1.26.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/assets/workflow-diagnostics.mts +68 -0
- package/dist/agent/computer-use-prompt.d.ts +3 -4
- package/dist/agent/computer-use-prompt.js +150 -45
- package/dist/agent/computer-use-prompt.js.map +1 -1
- package/dist/agent/instance-agent.js +8 -7
- package/dist/agent/instance-agent.js.map +1 -1
- package/dist/agent/sub-agent-factory.js +2 -1
- package/dist/agent/sub-agent-factory.js.map +1 -1
- package/dist/agent/system-prompt.d.ts +2 -3
- package/dist/agent/system-prompt.js +12 -6
- package/dist/agent/system-prompt.js.map +1 -1
- package/dist/build.tsbuildinfo +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/dist/runtime/run-state-registry.d.ts +4 -1
- package/dist/runtime/run-state-registry.js +12 -0
- package/dist/runtime/run-state-registry.js.map +1 -1
- package/dist/skills/materialize-runtime-skills.js +2 -3
- package/dist/skills/materialize-runtime-skills.js.map +1 -1
- package/dist/stream/map-chunk.js +4 -0
- package/dist/stream/map-chunk.js.map +1 -1
- package/dist/tools/approval-copy.d.ts +3 -0
- package/dist/tools/approval-copy.js +22 -0
- package/dist/tools/approval-copy.js.map +1 -0
- package/dist/tools/credentials.tool.js +22 -9
- package/dist/tools/credentials.tool.js.map +1 -1
- package/dist/tools/data-tables.tool.js +110 -18
- package/dist/tools/data-tables.tool.js.map +1 -1
- package/dist/tools/executions.tool.js +130 -7
- package/dist/tools/executions.tool.js.map +1 -1
- package/dist/tools/index.js +3 -1
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/models/model-catalog.service.d.ts +7 -0
- package/dist/tools/models/model-catalog.service.js +126 -0
- package/dist/tools/models/model-catalog.service.js.map +1 -0
- package/dist/tools/models/schemas.d.ts +188 -0
- package/dist/tools/models/schemas.js +58 -0
- package/dist/tools/models/schemas.js.map +1 -0
- package/dist/tools/nodes/model-selection.d.ts +6 -0
- package/dist/tools/nodes/model-selection.js +24 -0
- package/dist/tools/nodes/model-selection.js.map +1 -0
- package/dist/tools/nodes.tool.js +168 -7
- package/dist/tools/nodes.tool.js.map +1 -1
- package/dist/tools/orchestration/build-agent.tool.js +25 -7
- package/dist/tools/orchestration/build-agent.tool.js.map +1 -1
- package/dist/tools/orchestration/parent-handoff-state.d.ts +8 -0
- package/dist/tools/orchestration/parent-handoff-state.js +183 -0
- package/dist/tools/orchestration/parent-handoff-state.js.map +1 -0
- package/dist/tools/orchestration/verification/analyze-result.d.ts +5 -2
- package/dist/tools/orchestration/verification/analyze-result.js +30 -36
- package/dist/tools/orchestration/verification/analyze-result.js.map +1 -1
- package/dist/tools/orchestration/verification/finalize-result.d.ts +9 -0
- package/dist/tools/orchestration/verification/finalize-result.js +18 -6
- package/dist/tools/orchestration/verification/finalize-result.js.map +1 -1
- package/dist/tools/orchestration/verification/scripted-gate-run.js +1 -0
- package/dist/tools/orchestration/verification/scripted-gate-run.js.map +1 -1
- package/dist/tools/orchestration/verification/tool-simulation-preflight.d.ts +15 -0
- package/dist/tools/orchestration/verification/tool-simulation-preflight.js +78 -0
- package/dist/tools/orchestration/verification/tool-simulation-preflight.js.map +1 -0
- package/dist/tools/orchestration/verify-built-workflow.tool.js +40 -3
- package/dist/tools/orchestration/verify-built-workflow.tool.js.map +1 -1
- package/dist/tools/search-models.tool.d.ts +2 -0
- package/dist/tools/search-models.tool.js +24 -0
- package/dist/tools/search-models.tool.js.map +1 -0
- package/dist/tools/shared/ask-user.tool.d.ts +2 -1
- package/dist/tools/shared/ask-user.tool.js +28 -4
- package/dist/tools/shared/ask-user.tool.js.map +1 -1
- package/dist/tools/tool-ids.d.ts +1 -0
- package/dist/tools/tool-ids.js +1 -0
- package/dist/tools/tool-ids.js.map +1 -1
- package/dist/tools/workflows/apply-workflow-credentials.tool.js +9 -3
- package/dist/tools/workflows/apply-workflow-credentials.tool.js.map +1 -1
- package/dist/tools/workflows/build-workflow.tool.d.ts +6 -0
- package/dist/tools/workflows/build-workflow.tool.js +26 -30
- package/dist/tools/workflows/build-workflow.tool.js.map +1 -1
- package/dist/tools/workflows/classify-node-destructiveness.service.d.ts +1 -0
- package/dist/tools/workflows/classify-node-destructiveness.service.js +24 -25
- package/dist/tools/workflows/classify-node-destructiveness.service.js.map +1 -1
- package/dist/tools/workflows/detect-array-input-collapse.js +1 -2
- package/dist/tools/workflows/detect-array-input-collapse.js.map +1 -1
- package/dist/tools/workflows/plan-verification-simulation.d.ts +1 -0
- package/dist/tools/workflows/plan-verification-simulation.js +4 -4
- package/dist/tools/workflows/plan-verification-simulation.js.map +1 -1
- package/dist/tools/workflows/reconcile-simulation-plan.js +5 -6
- package/dist/tools/workflows/reconcile-simulation-plan.js.map +1 -1
- package/dist/tools/workflows/saved-workflow-state.d.ts +34 -0
- package/dist/tools/workflows/saved-workflow-state.js +36 -0
- package/dist/tools/workflows/saved-workflow-state.js.map +1 -0
- package/dist/tools/workflows/setup-panel-state.js +1 -1
- package/dist/tools/workflows/setup-panel-state.js.map +1 -1
- package/dist/tools/workflows/setup-workflow.schema.d.ts +0 -40
- package/dist/tools/workflows/setup-workflow.service.d.ts +2 -4
- package/dist/tools/workflows/setup-workflow.service.js +4 -61
- package/dist/tools/workflows/setup-workflow.service.js.map +1 -1
- package/dist/tools/workflows/verification-graph.d.ts +12 -0
- package/dist/tools/workflows/verification-graph.js +49 -0
- package/dist/tools/workflows/verification-graph.js.map +1 -0
- package/dist/tools/workflows/workflow-node-diff.d.ts +1 -1
- package/dist/tools/workflows/workflow-node-diff.js +78 -23
- package/dist/tools/workflows/workflow-node-diff.js.map +1 -1
- package/dist/tools/workflows/workflow-source-compiler.js +1 -0
- package/dist/tools/workflows/workflow-source-compiler.js.map +1 -1
- package/dist/tools/workflows/workflow-source-diagnostics.d.ts +2 -0
- package/dist/tools/workflows/workflow-source-diagnostics.js +50 -0
- package/dist/tools/workflows/workflow-source-diagnostics.js.map +1 -0
- package/dist/tools/workflows/workflow-validation-warnings.d.ts +3 -0
- package/dist/tools/workflows/workflow-validation-warnings.js +1 -0
- package/dist/tools/workflows/workflow-validation-warnings.js.map +1 -1
- package/dist/tools/workflows.tool.js +122 -19
- package/dist/tools/workflows.tool.js.map +1 -1
- package/dist/tracing/langsmith-tracing.d.ts +4 -0
- package/dist/tracing/langsmith-tracing.js +23 -0
- package/dist/tracing/langsmith-tracing.js.map +1 -1
- package/dist/types.d.ts +74 -8
- package/dist/types.js.map +1 -1
- package/dist/workflow-loop/guidance.js +1 -1
- package/dist/workflow-loop/guidance.js.map +1 -1
- package/dist/workspace/sandbox-setup.d.ts +1 -2
- package/dist/workspace/sandbox-setup.js +7 -15
- package/dist/workspace/sandbox-setup.js.map +1 -1
- package/dist/workspace/sandbox-typescript.d.ts +4 -0
- package/dist/workspace/sandbox-typescript.js +27 -0
- package/dist/workspace/sandbox-typescript.js.map +1 -0
- package/dist/workspace/snapshot-manager.js +2 -0
- package/dist/workspace/snapshot-manager.js.map +1 -1
- package/package.json +11 -10
- package/skills/agent-builder/SKILL.md +6 -0
- package/skills/config-evals/references/config-eval-playbook.md +3 -3
- package/skills/debugging-executions/SKILL.md +71 -0
- package/skills/model-selection/SKILL.md +104 -0
- package/skills/one-off-operations/SKILL.md +46 -5
- package/skills/post-build-flow/SKILL.md +13 -0
- package/skills/workflow-builder/SKILL.md +27 -12
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import type { Diagnostic } from 'typescript/unstable/async';
|
|
3
|
+
|
|
4
|
+
function formatMessage(diagnostic: Diagnostic, indent = ''): string {
|
|
5
|
+
return [
|
|
6
|
+
indent + diagnostic.text,
|
|
7
|
+
...(diagnostic.messageChain ?? []).map((child) => formatMessage(child, indent + ' ')),
|
|
8
|
+
].join('\n');
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// Check only the requested source and its imports. Do not execute the source.
|
|
12
|
+
async function main(): Promise<void> {
|
|
13
|
+
// The sandbox installs this dependency from its own package manifest.
|
|
14
|
+
// eslint-disable-next-line import-x/no-extraneous-dependencies
|
|
15
|
+
const { API, DiagnosticCategory } = await import('typescript/unstable/async');
|
|
16
|
+
const cwd = process.cwd();
|
|
17
|
+
const configPath = path.join(cwd, `.workflow-diagnostics-${process.pid}.json`);
|
|
18
|
+
const config = JSON.stringify({
|
|
19
|
+
extends: './tsconfig.json',
|
|
20
|
+
files: [path.resolve(process.argv[2])],
|
|
21
|
+
include: [],
|
|
22
|
+
});
|
|
23
|
+
const api = new API({
|
|
24
|
+
cwd,
|
|
25
|
+
fs: {
|
|
26
|
+
fileExists: (file) => (file === configPath ? true : undefined),
|
|
27
|
+
readFile: (file) => (file === configPath ? config : undefined),
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
try {
|
|
31
|
+
const snapshot = await api.updateSnapshot({ openProjects: [configPath] });
|
|
32
|
+
const project = snapshot.getProject(configPath);
|
|
33
|
+
if (!project) throw new Error('Cannot open the workflow project');
|
|
34
|
+
const program = project.program;
|
|
35
|
+
const diagnostics = [
|
|
36
|
+
...(await program.getSyntacticDiagnostics()),
|
|
37
|
+
...(await program.getBindDiagnostics()),
|
|
38
|
+
...(await program.getSemanticDiagnostics()),
|
|
39
|
+
...(await program.getProgramDiagnostics()),
|
|
40
|
+
...(await program.getGlobalDiagnostics()),
|
|
41
|
+
];
|
|
42
|
+
const errors: string[] = [];
|
|
43
|
+
for (const diagnostic of diagnostics) {
|
|
44
|
+
if (diagnostic.category !== DiagnosticCategory.Error) continue;
|
|
45
|
+
const message = `error TS${diagnostic.code}: ${formatMessage(diagnostic)}`;
|
|
46
|
+
if (!diagnostic.fileName) {
|
|
47
|
+
errors.push(message);
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
const file = path.relative(cwd, diagnostic.fileName);
|
|
51
|
+
if (file.startsWith('..' + path.sep) || file.split(path.sep).includes('node_modules'))
|
|
52
|
+
continue;
|
|
53
|
+
const source = await program.getSourceFile(diagnostic.fileName);
|
|
54
|
+
if (!source || source.isDeclarationFile) continue;
|
|
55
|
+
let location = file;
|
|
56
|
+
if (diagnostic.pos >= 0) {
|
|
57
|
+
const position = source.getLineAndCharacterOfPosition(diagnostic.pos);
|
|
58
|
+
location = `${file}(${position.line + 1},${position.character + 1})`;
|
|
59
|
+
}
|
|
60
|
+
errors.push(`${location}: ${message}`);
|
|
61
|
+
}
|
|
62
|
+
console.log(JSON.stringify([...new Set(errors)]));
|
|
63
|
+
} finally {
|
|
64
|
+
await api.close();
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
await main();
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function getComputerUsePrompt({
|
|
3
|
-
|
|
4
|
-
localGateway: LocalGatewayStatus | undefined;
|
|
1
|
+
import type { ComputerUseState } from '../types';
|
|
2
|
+
export declare function getComputerUsePrompt({ state }: {
|
|
3
|
+
state: ComputerUseState | undefined;
|
|
5
4
|
}): string;
|
|
@@ -2,25 +2,120 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getComputerUsePrompt = getComputerUsePrompt;
|
|
4
4
|
const BROWSER_USE_EXTENSION_URL = 'https://chromewebstore.google.com/detail/n8n-browser-use/cegmdpndekdfpnafgacidejijecomlhh';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
const CHANNEL_ORDER = ['localComputer', 'browser'];
|
|
6
|
+
const CAPABILITIES = [
|
|
7
|
+
{
|
|
8
|
+
channel: 'localComputer',
|
|
9
|
+
compact: '*filesystem* (read/write local files)',
|
|
10
|
+
bullet: '- *filesystem* - read and write files. Use it when users want to include their own files in the automation.',
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
channel: 'localComputer',
|
|
14
|
+
compact: '*shell* (run local commands)',
|
|
15
|
+
bullet: "- *shell* - Execute shell commands. Use it when you need or are asked to execute commands on user's computer",
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
channel: 'browser',
|
|
19
|
+
compact: `*browser* (automate the user's real browser session; requires the "n8n Browser Use" Chrome extension: ${BROWSER_USE_EXTENSION_URL})`,
|
|
20
|
+
bullet: `- *browser* - Automate user's browser to access web pages and do tasks on user's behalf. Use it when you require access to user's browser session for example when creating credentials with user's accounts. Requires installing the "n8n Browser Use" Chrome extension from the Chrome Web Store: ${BROWSER_USE_EXTENSION_URL}`,
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
channel: 'localComputer',
|
|
24
|
+
compact: '*screenshot*/*mouse-keyboard* (never advertise or use unless explicitly requested)',
|
|
25
|
+
bullet: "- *screenshot*, *mouse-keyboard* - control user's computer mouse, keyboard and do screenshots (do not advertise or use this functionality if user does not explicitly ask for it)",
|
|
26
|
+
},
|
|
27
|
+
];
|
|
28
|
+
const SIGNALS = [
|
|
29
|
+
{
|
|
30
|
+
channels: ['browser'],
|
|
31
|
+
compact: "credential/OAuth/API-key setup through a service's web portal (*browser*)",
|
|
32
|
+
bullet: '- **Credential / OAuth setup** — user needs to set up, create, configure, or connect credentials for any service that requires OAuth or API key generation through a web portal (Slack, Google, Microsoft, HubSpot, Notion, Stripe, Twilio, etc.) → *browser*',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
channels: ['localComputer'],
|
|
36
|
+
compact: 'a local file (PDF, CSV, spec) as context, or docs/exports written to files (*filesystem*)',
|
|
37
|
+
bullet: '- **Local file as context** — user mentions a file, PDF, CSV, spec, or requirements doc they want to use as reference while building a workflow → *filesystem*',
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
channels: ['localComputer'],
|
|
41
|
+
bullet: '- **Documentation / output to files** — user asks to document, write up, export, or save a workflow description, runbook, or handover doc → *filesystem*',
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
channels: ['browser'],
|
|
45
|
+
compact: 'authenticated web research or form/frontend testing (*browser*)',
|
|
46
|
+
bullet: '- **Authenticated web research** — user wants to check something on a site they’re logged into, or gather data from a web-based tool → *browser*',
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
channels: ['browser'],
|
|
50
|
+
bullet: '- **Form / frontend testing** — user is building n8n forms or a web app with n8n as backend and wants end-to-end testing → *browser*',
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
channels: ['localComputer'],
|
|
54
|
+
compact: 'local commands or debugging (*shell*)',
|
|
55
|
+
bullet: '- **Shell / environment** — user asks to run a command (curl, CLI, DB query), automate something locally, or debug connectivity → *shell*',
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
channels: ['browser', 'localComputer'],
|
|
59
|
+
compact: 'migration from Make/Zapier or similar (*browser* + *filesystem*)',
|
|
60
|
+
bullet: '- **Platform migration** — user wants to migrate from Make, Zapier, or another automation platform, or replicate an existing workflow from it → *browser* + *filesystem*',
|
|
61
|
+
},
|
|
62
|
+
];
|
|
63
|
+
function joinPhrases(parts) {
|
|
64
|
+
if (parts.length <= 1)
|
|
65
|
+
return parts[0] ?? '';
|
|
66
|
+
if (parts.length === 2)
|
|
67
|
+
return `${parts[0]} and ${parts[1]}`;
|
|
68
|
+
return `${parts.slice(0, -1).join(', ')}, and ${parts[parts.length - 1]}`;
|
|
69
|
+
}
|
|
70
|
+
function joinSignals(parts) {
|
|
71
|
+
if (parts.length <= 1)
|
|
72
|
+
return parts[0] ?? '';
|
|
73
|
+
return `${parts.slice(0, -1).join('; ')}; or ${parts[parts.length - 1]}`;
|
|
74
|
+
}
|
|
75
|
+
function availableChannels(state) {
|
|
76
|
+
return CHANNEL_ORDER.filter((channel) => state[channel].status !== 'unavailable');
|
|
77
|
+
}
|
|
78
|
+
function liveToolCategories(state) {
|
|
79
|
+
return [
|
|
80
|
+
...new Set(CHANNEL_ORDER.flatMap((channel) => {
|
|
81
|
+
const channelState = state[channel];
|
|
82
|
+
return channelState.status === 'connected' ? channelState.toolCategories : [];
|
|
83
|
+
})),
|
|
84
|
+
];
|
|
85
|
+
}
|
|
86
|
+
function getCapabilityList(available, form) {
|
|
87
|
+
return CAPABILITIES.filter((c) => available.includes(c.channel)).map((c) => c[form]);
|
|
88
|
+
}
|
|
89
|
+
function getSignalList(available, form) {
|
|
90
|
+
return SIGNALS.filter((s) => s.channels.every((c) => available.includes(c)))
|
|
91
|
+
.map((s) => (form === 'bullet' ? s.bullet : s.compact))
|
|
92
|
+
.filter((text) => text !== undefined);
|
|
93
|
+
}
|
|
94
|
+
function getConnectInstructions(available) {
|
|
95
|
+
const lead = 'To connect, the user should select the + button beside the chat input.';
|
|
96
|
+
const localClause = '"Connect local computer" for filesystem, shell, and other local capabilities';
|
|
97
|
+
if (available.includes('browser') && available.includes('localComputer')) {
|
|
98
|
+
return `${lead} They should select "Connect browser" for browser automation, or ${localClause}, then follow the instructions in the setup dialog.`;
|
|
99
|
+
}
|
|
100
|
+
if (available.includes('browser')) {
|
|
101
|
+
return `${lead} They should select "Connect browser", then follow the instructions in the setup dialog.`;
|
|
102
|
+
}
|
|
103
|
+
return `${lead} They should select ${localClause}, then follow the instructions in the setup dialog.`;
|
|
104
|
+
}
|
|
105
|
+
function getNotConnectedPrompt(available) {
|
|
106
|
+
return `## Computer Use
|
|
10
107
|
|
|
11
|
-
This instance supports "Computer Use": connecting to the user's computer with the capabilities
|
|
108
|
+
This instance supports "Computer Use": connecting to the user's computer with the capabilities ${joinPhrases(getCapabilityList(available, 'compact'))}. Users choose which capabilities to enable and can reconnect with a different set.
|
|
12
109
|
|
|
13
|
-
Computer Use is NOT currently connected — do NOT attempt to use Computer Use tools. Proactively suggest connecting when the user needs:
|
|
110
|
+
Computer Use is NOT currently connected — do NOT attempt to use Computer Use tools. Proactively suggest connecting when the user needs: ${joinSignals(getSignalList(available, 'compact'))}.
|
|
14
111
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
112
|
+
${getConnectInstructions(available)}`;
|
|
113
|
+
}
|
|
114
|
+
function getConnectedPreamble(available) {
|
|
115
|
+
return `
|
|
18
116
|
## Computer Use
|
|
19
117
|
This instance support "Computer Use", which allows connecting to user's computer and execute following functionality:
|
|
20
|
-
|
|
21
|
-
- *shell* - Execute shell commands. Use it when you need or are asked to execute commands on user's computer
|
|
22
|
-
- *browser* - Automate user's browser to access web pages and do tasks on user's behalf. Use it when you require access to user's browser session for example when creating credentials with user's accounts. Requires installing the "n8n Browser Use" Chrome extension from the Chrome Web Store: ${BROWSER_USE_EXTENSION_URL}
|
|
23
|
-
- *screenshot*, *mouse-keyboard* - control user's computer mouse, keyboard and do screenshots (do not advertise or use this functionality if user does not explicitly ask for it)
|
|
118
|
+
${getCapabilityList(available, 'bullet').join('\n')}
|
|
24
119
|
|
|
25
120
|
Users have control over this functionality and can enable only the tools they want to provide.
|
|
26
121
|
Users can reconnect Computer Use with different set of functionality, so always rely on Computer Use status and the available tools and not the conversation history.
|
|
@@ -29,28 +124,34 @@ Users can reconnect Computer Use with different set of functionality, so always
|
|
|
29
124
|
|
|
30
125
|
Proactively suggest Computer Use (or use it directly if connected) when you detect these signals:
|
|
31
126
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
127
|
+
${getSignalList(available, 'bullet').join('\n')}
|
|
128
|
+
`;
|
|
129
|
+
}
|
|
130
|
+
function getComputerUsePrompt({ state }) {
|
|
131
|
+
if (!state)
|
|
132
|
+
return '';
|
|
133
|
+
const available = availableChannels(state);
|
|
134
|
+
if (available.length === 0)
|
|
135
|
+
return '';
|
|
136
|
+
const connectedChannels = CHANNEL_ORDER.filter((channel) => state[channel].status === 'connected');
|
|
137
|
+
if (connectedChannels.length === 0)
|
|
138
|
+
return getNotConnectedPrompt(available);
|
|
139
|
+
const liveCategories = liveToolCategories(state);
|
|
140
|
+
const promptParts = [getConnectedPreamble(available), '\n### Computer Use status'];
|
|
141
|
+
if (liveCategories.length === 0) {
|
|
142
|
+
promptParts.push('Computer Use is connected, but the user did not enable any capabilities');
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
promptParts.push(`Computer Use is connected, the user has enabled following capabilities: ${liveCategories.join(',')}`);
|
|
146
|
+
}
|
|
147
|
+
if (liveCategories.includes('filesystem')) {
|
|
40
148
|
promptParts.push(`
|
|
41
|
-
### Computer Use status`);
|
|
42
|
-
switch (localGateway.status) {
|
|
43
|
-
case 'connected':
|
|
44
|
-
if (localGateway.capabilities.length > 0) {
|
|
45
|
-
promptParts.push(`Computer Use is connected, the user has enabled following capabilities: ${localGateway.capabilities.join(',')}`);
|
|
46
|
-
if (localGateway.capabilities.includes('filesystem')) {
|
|
47
|
-
promptParts.push(`
|
|
48
149
|
### Computer Use - Filesystem Exploration
|
|
49
150
|
|
|
50
151
|
Keep exploration shallow: start at depth 1–2, prefer \`search\` over browsing, and read specific files rather than whole directories.`);
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
152
|
+
}
|
|
153
|
+
if (liveCategories.includes('browser')) {
|
|
154
|
+
promptParts.push(`
|
|
54
155
|
### Computer Use - Browser Automation rules
|
|
55
156
|
|
|
56
157
|
You can control the user's browser using the browser_* tools. Since this is their real browser, you share it with them.
|
|
@@ -83,22 +184,26 @@ secrets; never ask the user to paste secret values into chat.
|
|
|
83
184
|
|
|
84
185
|
The browser_navigate tool requires a connected tab to already be open. For fresh browser connection or when browser_navigate fails use browser_tab_open to open the url in a new tab.
|
|
85
186
|
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}`);
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
187
|
+
}
|
|
188
|
+
else if (available.includes('browser')) {
|
|
189
|
+
promptParts.push(`
|
|
89
190
|
### Browser Automation (Disabled in Computer Use)
|
|
90
191
|
|
|
91
192
|
Browser tools are not connected. If the user asks for browser automation, tell them to select the + button beside the chat input, select "Connect browser", and follow the setup instructions. The setup requires the n8n Browser Use Chrome extension from the Chrome Web Store: ${BROWSER_USE_EXTENSION_URL}`);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
else {
|
|
95
|
-
promptParts.push('Computer Use is connected, but the user did not enable any capabilities');
|
|
96
|
-
}
|
|
97
|
-
break;
|
|
98
|
-
default:
|
|
99
|
-
}
|
|
100
|
-
return promptParts.join('\n');
|
|
101
193
|
}
|
|
102
|
-
|
|
194
|
+
else {
|
|
195
|
+
promptParts.push(`
|
|
196
|
+
### Browser Automation (Unavailable)
|
|
197
|
+
|
|
198
|
+
Browser automation is not available on this instance. If the user asks for it, say so plainly — do not point them at a setup flow or a browser extension.`);
|
|
199
|
+
}
|
|
200
|
+
const localComputerStatus = state.localComputer.status;
|
|
201
|
+
if (localComputerStatus === 'disconnected' || localComputerStatus === 'disabledByUser') {
|
|
202
|
+
promptParts.push(`
|
|
203
|
+
### Local Computer (Not Connected)
|
|
204
|
+
|
|
205
|
+
The user's local computer is not connected, so filesystem, shell, and other local tools are unavailable. If the user needs them, tell them to select the + button beside the chat input, select "Connect local computer", and follow the setup instructions.`);
|
|
206
|
+
}
|
|
207
|
+
return promptParts.join('\n');
|
|
103
208
|
}
|
|
104
209
|
//# sourceMappingURL=computer-use-prompt.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"computer-use-prompt.js","sourceRoot":"","sources":["../../src/agent/computer-use-prompt.ts"],"names":[],"mappings":";;;AAEA,MAAM,yBAAyB,GAC9B,2FAA2F,CAAC;
|
|
1
|
+
{"version":3,"file":"computer-use-prompt.js","sourceRoot":"","sources":["../../src/agent/computer-use-prompt.ts"],"names":[],"mappings":";;;AAEA,MAAM,yBAAyB,GAC9B,2FAA2F,CAAC;AAG7F,MAAM,aAAa,GAAyB,CAAC,eAAe,EAAE,SAAS,CAAC,CAAC;AAOzE,MAAM,YAAY,GAMb;IACJ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AAC;IAED,IAAI,cAAc,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;QACxC,WAAW,CAAC,IAAI,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2QAgCwP,yBAAyB,EAAE,CAAC,CAAC;IACvS,CAAC;SAAM,IAAI,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;QAC1C,WAAW,CAAC,IAAI,CAAC;;;oRAGiQ,yBAAyB,EAAE,CAAC,CAAC;IAChT,CAAC;SAAM,CAAC;QACP,WAAW,CAAC,IAAI,CAAC;;;0JAGuI,CAAC,CAAC;IAC3J,CAAC;IAMD,MAAM,mBAAmB,GAAG,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC;IACvD,IAAI,mBAAmB,KAAK,cAAc,IAAI,mBAAmB,KAAK,gBAAgB,EAAE,CAAC;QACxF,WAAW,CAAC,IAAI,CAAC;;;6PAG0O,CAAC,CAAC;IAC9P,CAAC;IAED,OAAO,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC/B,CAAC"}
|
|
@@ -54,6 +54,9 @@ async function createInstanceAgent(options) {
|
|
|
54
54
|
context.runtimeSkillCatalog ??
|
|
55
55
|
orchestrationContext?.runtimeSkills,
|
|
56
56
|
};
|
|
57
|
+
if (orchestrationContext) {
|
|
58
|
+
orchestrationContext.domainContext = domainContext;
|
|
59
|
+
}
|
|
57
60
|
const requireMcpToolApproval = context.permissions?.executeMcpTool !== 'always_allow';
|
|
58
61
|
const { tools: mcpTools, connectionFailures: managerMcpFailures } = await mcpManager.getRegularTools(mcpServers, context.logger, requireMcpToolApproval);
|
|
59
62
|
const mcpConnectionFailures = managerMcpFailures.map((f) => ({
|
|
@@ -75,7 +78,6 @@ async function createInstanceAgent(options) {
|
|
|
75
78
|
: undefined,
|
|
76
79
|
})
|
|
77
80
|
: (0, tool_registry_1.createToolRegistry)();
|
|
78
|
-
const browserToolNames = new Set(context.localMcpServer?.getToolsByCategory('browser').map((tool) => tool.name) ?? []);
|
|
79
81
|
const warnSkippedMcpTool = (error) => {
|
|
80
82
|
context.logger.warn('Skipped MCP tool with unsafe name', {
|
|
81
83
|
toolName: error.toolName,
|
|
@@ -108,10 +110,8 @@ async function createInstanceAgent(options) {
|
|
|
108
110
|
if (builderMcpTools.size > 0)
|
|
109
111
|
orchestrationContext.mcpTools = builderMcpTools;
|
|
110
112
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
connectedMcpServices: (0, connected_mcp_services_1.listConnectedMcpServices)(mcpServers, safeMcpTools),
|
|
114
|
-
});
|
|
113
|
+
domainContext.connectedMcpServices = (0, connected_mcp_services_1.listConnectedMcpServices)(mcpServers, safeMcpTools);
|
|
114
|
+
const orchestratorDomainTools = (0, tools_1.createOrchestratorDomainTools)(domainContext);
|
|
115
115
|
const allOrchestratorTools = (0, tool_registry_1.mergeToolRegistries)(orchestratorDomainTools, orchestrationTools, safeLocalMcpTools, safeMcpTools);
|
|
116
116
|
for (const name of orchestrationContext?.disabledToolNames ?? [])
|
|
117
117
|
allOrchestratorTools.delete(name);
|
|
@@ -129,11 +129,10 @@ async function createInstanceAgent(options) {
|
|
|
129
129
|
(0, prompt_profiles_1.resolvePromptProfile)({}).profile.systemPromptVersion, {
|
|
130
130
|
webhookBaseUrl: orchestrationContext?.webhookBaseUrl,
|
|
131
131
|
formBaseUrl: orchestrationContext?.formBaseUrl,
|
|
132
|
-
|
|
132
|
+
computerUseState: context.computerUseState,
|
|
133
133
|
toolSearchEnabled: hasDeferrableTools,
|
|
134
134
|
mcpToolSearchEnabled: hasDeferredExternalMcpTools,
|
|
135
135
|
licenseHints: context.licenseHints,
|
|
136
|
-
browserAvailable: browserToolNames.size > 0,
|
|
137
136
|
branchReadOnly: context.branchReadOnly,
|
|
138
137
|
projectId: context.projectId,
|
|
139
138
|
conversationHistoryEnabled: Boolean(context.conversationHistoryService),
|
|
@@ -143,10 +142,12 @@ async function createInstanceAgent(options) {
|
|
|
143
142
|
: undefined,
|
|
144
143
|
});
|
|
145
144
|
(0, langsmith_tracing_1.setTracePromptVersion)(orchestrationContext?.tracing, orchestrationContext?.promptConfiguration?.version);
|
|
145
|
+
(0, langsmith_tracing_1.setTraceModelId)(orchestrationContext?.tracing, modelId);
|
|
146
146
|
const telemetry = orchestrationContext?.tracing?.getTelemetry?.({
|
|
147
147
|
agentRole: 'orchestrator',
|
|
148
148
|
functionId: 'instance-ai.orchestrator',
|
|
149
149
|
executionMode: 'foreground',
|
|
150
|
+
metadata: (0, langsmith_tracing_1.modelIdTraceMetadata)(modelId),
|
|
150
151
|
});
|
|
151
152
|
const agent = new agents_1.Agent('n8n-instance-agent')
|
|
152
153
|
.model(modelId)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instance-agent.js","sourceRoot":"","sources":["../../src/agent/instance-agent.ts"],"names":[],"mappings":";;;AAAA,wCAKqB;AAErB,iEAA4D;AAC5D,yEAIoC;AACpC,2DAAyE;AACzE,0EAAyE;AACzE,gEAA4F;AAC5F,6DAA4D;AAC5D,oDAA+F;AAC/F,oCAIkB;AAClB,mGAAiG;AACjG,gDAA8F;AAC9F,gEAAqE;AACrE,
|
|
1
|
+
{"version":3,"file":"instance-agent.js","sourceRoot":"","sources":["../../src/agent/instance-agent.ts"],"names":[],"mappings":";;;AAAA,wCAKqB;AAErB,iEAA4D;AAC5D,yEAIoC;AACpC,2DAAyE;AACzE,0EAAyE;AACzE,gEAA4F;AAC5F,6DAA4D;AAC5D,oDAA+F;AAC/F,oCAIkB;AAClB,mGAAiG;AACjG,gDAA8F;AAC9F,gEAAqE;AACrE,oEAMsC;AAOtC,0DAA0D;AAE1D,SAAS,0BAA0B,CAClC,OAAoB,EACpB,OAA0B,EAC1B,qBAAyC;IAEzC,MAAM,QAAQ,GAAG,CAAC,OAAO,CAAC,QAAQ,EAAE,qBAAqB,CAAC;SACxD,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE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D;qBACD;oBACF,CAAC,CAAC,EAAE,CAAC;aACN;YACF,CAAC,CAAC,SAAS;QACZ,iBAAiB,EAAE,kBAAkB;QACrC,eAAe,EAAE,kBAAkB,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,SAAS;QACtE,aAAa,EAAE,aAAa,EAAE,QAAQ;KACtC,CAAC,CACF,CAAC;IAEF,OAAO,EAAE,KAAK,EAAE,qBAAqB,EAAE,CAAC;AACzC,CAAC"}
|
|
@@ -58,11 +58,12 @@ function createSubAgent(options) {
|
|
|
58
58
|
workspace: options.workspace,
|
|
59
59
|
runtimeSkills: options.runtimeSkills,
|
|
60
60
|
});
|
|
61
|
+
(0, langsmith_tracing_1.setTraceModelId)(options.tracing, modelId);
|
|
61
62
|
const telemetry = options.tracing?.getTelemetry?.({
|
|
62
63
|
agentRole: role,
|
|
63
64
|
functionId: `instance-ai.subagent.${role.replace(/[^a-zA-Z0-9._-]+/g, '-')}`,
|
|
64
65
|
executionMode: options.tracing.traceKind === 'background_subagent' ? 'background_subagent' : 'background',
|
|
65
|
-
metadata: { agent_id: options.agentId },
|
|
66
|
+
metadata: { agent_id: options.agentId, ...(0, langsmith_tracing_1.modelIdTraceMetadata)(modelId) },
|
|
66
67
|
});
|
|
67
68
|
if (telemetry) {
|
|
68
69
|
agent.telemetry(telemetry);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sub-agent-factory.js","sourceRoot":"","sources":["../../src/agent/sub-agent-factory.ts"],"names":[],"mappings":";;;;;AAAA,wCAAmG;AAEnG,iFAIwC;AACxC,2DAAyE;AACzE,qDAI0B;AAC1B,mDAAqD;AACrD,oDAAsD;AACtD,
|
|
1
|
+
{"version":3,"file":"sub-agent-factory.js","sourceRoot":"","sources":["../../src/agent/sub-agent-factory.ts"],"names":[],"mappings":";;;;;AAAA,wCAAmG;AAEnG,iFAIwC;AACxC,2DAAyE;AACzE,qDAI0B;AAC1B,mDAAqD;AACrD,oD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AwB,IAAI,CAAC,OAAO,CAAC,mBAAmB,EAAE,GAAG,CAAC,EAAE;QAC5E,aAAa,EACZ,OAAO,CAAC,OAAO,CAAC,SAAS,KAAK,qBAAqB,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,YAAY;QAC3F,QAAQ,EAAE,EAAE,QAAQ,EAAE,OAAO,CAAC,OAAO,EAAE,GAAG,IAAA,wCAAoB,EAAC,OAAO,CAAC,EAAE;KACzE,CAAC,CAAC;IACH,IAAI,SAAS,EAAE,CAAC;QACf,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;IAC5B,CAAC;IAED,IAAA,uCAAmB,EAClB,QAAQ,EACR,IAAA,yCAAqB,EAAC;QACrB,YAAY;QACZ,KAAK;QACL,OAAO;KACP,CAAC,CACF,CAAC;IAEF,OAAO,KAAK,CAAC;AACd,CAAC"}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ComputerUseState } from '../types';
|
|
2
2
|
interface SystemPromptOptions {
|
|
3
3
|
webhookBaseUrl?: string;
|
|
4
4
|
formBaseUrl?: string;
|
|
5
|
-
|
|
5
|
+
computerUseState?: ComputerUseState;
|
|
6
6
|
toolSearchEnabled?: boolean;
|
|
7
7
|
mcpToolSearchEnabled?: boolean;
|
|
8
8
|
licenseHints?: string[];
|
|
9
|
-
browserAvailable?: boolean;
|
|
10
9
|
branchReadOnly?: boolean;
|
|
11
10
|
projectId?: string;
|
|
12
11
|
workspaceRoot?: string;
|
|
@@ -110,7 +110,7 @@ This n8n instance is in **read-only mode** (protected by source control settings
|
|
|
110
110
|
- Creating, modifying, or deleting workflows
|
|
111
111
|
- Creating data tables, modifying their schema, or mutating their rows
|
|
112
112
|
- Creating or deleting folders, moving or tagging workflows
|
|
113
|
-
- Running or stopping workflow executions
|
|
113
|
+
- Running or stopping workflow executions, and executing a single node
|
|
114
114
|
|
|
115
115
|
The following operations remain available:
|
|
116
116
|
- Listing, searching, and reading all resources
|
|
@@ -124,12 +124,12 @@ If the user asks for a blocked operation, explain that the instance is in read-o
|
|
|
124
124
|
}
|
|
125
125
|
function getCredentialSetupBullet(setupPanelEnabled) {
|
|
126
126
|
if (setupPanelEnabled) {
|
|
127
|
-
return '**Credential setup** uses `workflows(action="setup")` when a workflowId is available. When the result has `announced: true`, the setup panel
|
|
127
|
+
return '**Credential setup** uses `workflows(action="setup")` when a workflowId is available. Requirements can appear in the setup panel while the workflow is being built. The user can complete them immediately. Do not describe setup as happening only after the build. When the result has `announced: true`, the setup panel lists the remaining credentials and parameters. Summarize that result, report any validation warnings, and end your turn. Other results need their returned guidance: correct validation errors, respect denials and skipped items, and wait for requested destination approvals. Explicit credential replacement and an already-open setup card keep their card flow, including apply and test-trigger results. Do not treat a resumed card as a panel announcement. Each new user turn carries a `<workflow-setup-state>` block with current configuration; trust it over older tool results. Configuration alone does not prove successful testing. Use `credentials(action="setup")` when the user explicitly asks to create a credential outside of any workflow context. Never call both tools for the same workflow. Never describe workflow setup as something the user starts from the canvas or editor, and never ask the user to paste secrets into chat.';
|
|
128
128
|
}
|
|
129
129
|
return '**Credential setup** uses `workflows(action="setup")` when a workflowId is available — it opens the inline setup card in the n8n Assistant panel and handles credentials, parameters, and triggers in one step. Use `credentials(action="setup")` only when the user explicitly asks to create a credential outside of any workflow context. Never call both tools for the same workflow. Never describe workflow setup as something the user starts from the canvas or editor. Setup cards are only open while the setup call is pending — once it returns a result, the card is resolved: describe the outcome (e.g. credentials selected and ready), never that a card is open or that the user still needs to authorize. When a node in `nodesStillNeedingSetup` carries `parameterIssues`, the connected credential can\'t reach the value that was configured (e.g. a model outside what the credential allows) — fix the value, then tell the user plainly which value didn\'t work and what you set instead. Never silently swap a model or other parameter without saying so. Nodes listed under `skippedByUser` are different: the user chose to skip them, so never re-open the setup card for those — say what stays unconfigured and offer to set it up later.';
|
|
130
130
|
}
|
|
131
131
|
function getSystemPrompt(options = {}) {
|
|
132
|
-
const { webhookBaseUrl, formBaseUrl,
|
|
132
|
+
const { webhookBaseUrl, formBaseUrl, computerUseState, toolSearchEnabled, mcpToolSearchEnabled, licenseHints, branchReadOnly, projectId, workspaceRoot, conversationHistoryEnabled, setupPanelEnabled, } = options;
|
|
133
133
|
return `You are the n8n Instance Agent — a helpful AI assistant embedded in an n8n instance. Your job is to understand the user's request and load one or more skills to help them achieve their goal. Once a skill is loaded, learn it in depth before continuing. You are also encouraged to call skills at any point in the conversation if it will help you achieve the user's goal. Match the user's request against skill descriptions in the catalog. Call \`load_skill\` before acting on a matched skill's guidance. A single turn may need more than one skill when routing requires it. Tool descriptions carry any load-before-call gates (\`load_skill\` / \`load_tool\`).
|
|
134
134
|
|
|
135
135
|
${webhookBaseUrl && formBaseUrl ? getInstanceInfoSection(webhookBaseUrl, formBaseUrl) : ''}
|
|
@@ -144,13 +144,13 @@ ${getToolDiscoverySection(toolSearchEnabled, mcpToolSearchEnabled)}
|
|
|
144
144
|
|
|
145
145
|
- Be concise.
|
|
146
146
|
- When the user opens with a greeting or another open-ended message without a specific request, briefly greet them and offer concrete ways you can help. Include building an agent and building a workflow among the options, alongside any other relevant capabilities.
|
|
147
|
-
- Reply in the user's language — in every user-visible message of the turn, including the short narration between tool calls, not just the end-of-turn summary. Tool results, skill instructions, and system follow-ups are written in English; do not let them pull your replies into English.
|
|
148
147
|
- ${shared_prompts_1.ASK_USER_FALLBACK}
|
|
149
148
|
- No emojis unless the user explicitly requests them.
|
|
150
149
|
- At the beginning of a normal user-visible turn, before your first tool call, write one short sentence explaining what you are about to do or what decision you need. Keep it tied to the user's goal, not the tool name. For system-generated background or checkpoint follow-up turns, follow the follow-up instructions.
|
|
151
150
|
- Never let an empty assistant message or a \`[Calling tools: ...]\` placeholder be the first visible response.
|
|
152
151
|
- End every tool call sequence with a brief text summary — the user cannot see raw tool output. Do not end your turn silently after tool calls. Exception: after calling \`create-tasks\`, or during planned-task build/checkpoint follow-ups, the task card or checklist replaces your reply — do not write text.
|
|
153
152
|
- Approval cards are never a reply on their own. Before a tool call that will show an approval card (e.g. saving changes to an existing workflow, publishing, or a live run), write one short sentence saying what the card asks and that nothing happens until they respond to it. If the user seems confused or asks what is happening while an approval is pending, explain in words that the action is waiting for their approval and what approving or denying does — never answer with only a re-issued card.
|
|
153
|
+
- When a tool call accepts \`approvalSummary\`, always fill it with one plain-language line that states the concrete change or effect, such as the nodes you add or change or the external actions a live run performs. The card shows this line, so a missing or vague summary leaves the user guessing what they approve.
|
|
154
154
|
|
|
155
155
|
## Capability Honesty
|
|
156
156
|
|
|
@@ -180,8 +180,14 @@ Don't fabricate provider setup mechanics (credential field names, secret values,
|
|
|
180
180
|
|
|
181
181
|
${shared_prompts_1.UNTRUSTED_CONTENT_DOCTRINE}
|
|
182
182
|
|
|
183
|
-
${(0, computer_use_prompt_1.getComputerUsePrompt)({
|
|
183
|
+
${(0, computer_use_prompt_1.getComputerUsePrompt)({ state: computerUseState })}
|
|
184
184
|
${getLicenseLimitationsSection(licenseHints)}
|
|
185
|
-
${getReadOnlySection(branchReadOnly)}
|
|
185
|
+
${getReadOnlySection(branchReadOnly)}
|
|
186
|
+
|
|
187
|
+
## Reply language
|
|
188
|
+
|
|
189
|
+
Reply in the same language as the user's latest request, unless they explicitly ask you to reply in another language. Determine the language from the request text itself, outside application context such as <thread-context>. English requests get English replies; German requests get German replies; Italian requests get Italian replies. Use that language from the first word of every user-visible message, including narration between tool calls, questions, approval summaries, and the final reply. Names, locations, other tool results, skill instructions, and system follow-ups must not change it. Language requirements for a target agent apply to its configuration, not to your replies. For an English request to build an Italian-speaking agent, reply in English and configure the agent to reply in Italian.
|
|
190
|
+
|
|
191
|
+
The most recent non-empty \`answers[].customText\` returned by \`ask-user\` or \`build-agent\` is the user's latest request. These are the user's own words. Apply the reply-language rule to that text. It takes precedence over the initial request and all earlier answers. For example, switch to German after a German answer, then back to English after a later English answer. Option selections and approvals without free text keep the current reply language.`;
|
|
186
192
|
}
|
|
187
193
|
//# sourceMappingURL=system-prompt.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"system-prompt.js","sourceRoot":"","sources":["../../src/agent/system-prompt.ts"],"names":[],"mappings":";;;;AAAA,iCAAiC;AAEjC,+DAA6D;AAC7D,iFAIwC;AACxC,qDAI0B;
|
|
1
|
+
{"version":3,"file":"system-prompt.js","sourceRoot":"","sources":["../../src/agent/system-prompt.ts"],"names":[],"mappings":";;;;AAAA,iCAAiC;AAEjC,+DAA6D;AAC7D,iFAIwC;AACxC,qDAI0B;AAqB1B,4BAAmC,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;SACjB,OAAO,CAAC,QAAQ,CAAC;SACjB,KAAK,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC,CAAC;IACpF,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;;oBAEY,cAAc;iBACjB,WAAW,EAAE,CAAC;AAC/B,CAAC;AAED,SAAS,uBAAuB,CAC/B,iBAA2B,EAC3B,oBAA8B;IAE9B,IAAI,CAAC,iBAAiB;QAAE,OAAO,EAAE,CAAC;IAElC,MAAM,iBAAiB,GAAG,oBAAoB;QAC7C,CAAC,CAAC,4PAA4P;QAC9P,CAAC,CAAC,EAAE,CAAC;IACN,MAAM,WAAW,GAAG,oBAAoB;QACvC,CAAC,CAAC,yEAAyE;QAC3E,CAAC,CAAC,EAAE,CAAC;IAEN,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