@n8n/instance-ai 1.4.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. package/dist/agent/instance-agent.js +0 -1
  2. package/dist/agent/instance-agent.js.map +1 -1
  3. package/dist/agent/sub-agent-debriefing.d.ts +2 -2
  4. package/dist/agent/system-prompt.js +36 -14
  5. package/dist/agent/system-prompt.js.map +1 -1
  6. package/dist/build.tsbuildinfo +1 -1
  7. package/dist/constants/model-settings.d.ts +3 -0
  8. package/dist/constants/model-settings.js +7 -0
  9. package/dist/constants/model-settings.js.map +1 -0
  10. package/dist/index.d.ts +4 -2
  11. package/dist/index.js +4 -1
  12. package/dist/index.js.map +1 -1
  13. package/dist/logger.d.ts +6 -0
  14. package/dist/planned-tasks/planned-task-permissions.d.ts +2 -0
  15. package/dist/planned-tasks/planned-task-permissions.js +8 -2
  16. package/dist/planned-tasks/planned-task-permissions.js.map +1 -1
  17. package/dist/planned-tasks/planned-task-service.d.ts +14 -1
  18. package/dist/planned-tasks/planned-task-service.js +138 -2
  19. package/dist/planned-tasks/planned-task-service.js.map +1 -1
  20. package/dist/runtime/background-task-manager.d.ts +25 -1
  21. package/dist/runtime/background-task-manager.js +66 -2
  22. package/dist/runtime/background-task-manager.js.map +1 -1
  23. package/dist/runtime/builder-sandbox-session-registry.d.ts +45 -0
  24. package/dist/runtime/builder-sandbox-session-registry.js +159 -0
  25. package/dist/runtime/builder-sandbox-session-registry.js.map +1 -0
  26. package/dist/runtime/run-state-registry.d.ts +7 -4
  27. package/dist/runtime/run-state-registry.js +9 -0
  28. package/dist/runtime/run-state-registry.js.map +1 -1
  29. package/dist/storage/planned-task-storage.js +2 -1
  30. package/dist/storage/planned-task-storage.js.map +1 -1
  31. package/dist/storage/workflow-loop-storage.d.ts +292 -12
  32. package/dist/stream/consume-with-hitl.d.ts +1 -0
  33. package/dist/stream/consume-with-hitl.js +1 -0
  34. package/dist/stream/consume-with-hitl.js.map +1 -1
  35. package/dist/tools/data-tables.tool.js +60 -22
  36. package/dist/tools/data-tables.tool.js.map +1 -1
  37. package/dist/tools/executions.tool.js +4 -1
  38. package/dist/tools/executions.tool.js.map +1 -1
  39. package/dist/tools/index.d.ts +1 -2
  40. package/dist/tools/index.js +2 -3
  41. package/dist/tools/index.js.map +1 -1
  42. package/dist/tools/orchestration/add-plan-item.tool.js +3 -1
  43. package/dist/tools/orchestration/add-plan-item.tool.js.map +1 -1
  44. package/dist/tools/orchestration/blueprint-accumulator.d.ts +4 -1
  45. package/dist/tools/orchestration/blueprint-accumulator.js +28 -0
  46. package/dist/tools/orchestration/blueprint-accumulator.js.map +1 -1
  47. package/dist/tools/orchestration/blueprint.schema.d.ts +60 -15
  48. package/dist/tools/orchestration/blueprint.schema.js +15 -1
  49. package/dist/tools/orchestration/blueprint.schema.js.map +1 -1
  50. package/dist/tools/orchestration/build-workflow-agent.prompt.js +41 -12
  51. package/dist/tools/orchestration/build-workflow-agent.prompt.js.map +1 -1
  52. package/dist/tools/orchestration/build-workflow-agent.tool.d.ts +51 -3
  53. package/dist/tools/orchestration/build-workflow-agent.tool.js +837 -272
  54. package/dist/tools/orchestration/build-workflow-agent.tool.js.map +1 -1
  55. package/dist/tools/orchestration/builder-memory-compaction.d.ts +38 -0
  56. package/dist/tools/orchestration/builder-memory-compaction.js +146 -0
  57. package/dist/tools/orchestration/builder-memory-compaction.js.map +1 -0
  58. package/dist/tools/orchestration/complete-checkpoint.tool.d.ts +2 -0
  59. package/dist/tools/orchestration/complete-checkpoint.tool.js +76 -0
  60. package/dist/tools/orchestration/complete-checkpoint.tool.js.map +1 -0
  61. package/dist/tools/orchestration/data-table-agent.tool.js +33 -17
  62. package/dist/tools/orchestration/data-table-agent.tool.js.map +1 -1
  63. package/dist/tools/orchestration/delegate.tool.js +32 -16
  64. package/dist/tools/orchestration/delegate.tool.js.map +1 -1
  65. package/dist/tools/orchestration/plan-agent-prompt.d.ts +1 -1
  66. package/dist/tools/orchestration/plan-agent-prompt.js +6 -0
  67. package/dist/tools/orchestration/plan-agent-prompt.js.map +1 -1
  68. package/dist/tools/orchestration/plan-with-agent.tool.d.ts +8 -0
  69. package/dist/tools/orchestration/plan-with-agent.tool.js +43 -12
  70. package/dist/tools/orchestration/plan-with-agent.tool.js.map +1 -1
  71. package/dist/tools/orchestration/plan.tool.js +17 -1
  72. package/dist/tools/orchestration/plan.tool.js.map +1 -1
  73. package/dist/tools/orchestration/report-verification-verdict.tool.d.ts +40 -2
  74. package/dist/tools/orchestration/report-verification-verdict.tool.js +85 -6
  75. package/dist/tools/orchestration/report-verification-verdict.tool.js.map +1 -1
  76. package/dist/tools/orchestration/research-with-agent.tool.js +32 -16
  77. package/dist/tools/orchestration/research-with-agent.tool.js.map +1 -1
  78. package/dist/tools/orchestration/verify-built-workflow.tool.d.ts +8 -2
  79. package/dist/tools/orchestration/verify-built-workflow.tool.js +476 -6
  80. package/dist/tools/orchestration/verify-built-workflow.tool.js.map +1 -1
  81. package/dist/tools/research.tool.js +2 -2
  82. package/dist/tools/research.tool.js.map +1 -1
  83. package/dist/tools/templates.tool.js +5 -90
  84. package/dist/tools/templates.tool.js.map +1 -1
  85. package/dist/tools/web-research/sanitize-web-content.d.ts +0 -1
  86. package/dist/tools/web-research/sanitize-web-content.js +0 -9
  87. package/dist/tools/web-research/sanitize-web-content.js.map +1 -1
  88. package/dist/tools/workflows/apply-workflow-credentials.tool.d.ts +2 -2
  89. package/dist/tools/workflows/build-workflow.tool.d.ts +2 -2
  90. package/dist/tools/workflows/build-workflow.tool.js +3 -1
  91. package/dist/tools/workflows/build-workflow.tool.js.map +1 -1
  92. package/dist/tools/workflows/materialize-node-type.tool.d.ts +8 -8
  93. package/dist/tools/workflows/submit-workflow-identity.d.ts +23 -1
  94. package/dist/tools/workflows/submit-workflow-identity.js +92 -5
  95. package/dist/tools/workflows/submit-workflow-identity.js.map +1 -1
  96. package/dist/tools/workflows/submit-workflow.tool.d.ts +48 -3
  97. package/dist/tools/workflows/submit-workflow.tool.js +81 -11
  98. package/dist/tools/workflows/submit-workflow.tool.js.map +1 -1
  99. package/dist/tracing/langsmith-tracing.js +8 -3
  100. package/dist/tracing/langsmith-tracing.js.map +1 -1
  101. package/dist/tracing/trace-replay.d.ts +3 -0
  102. package/dist/tracing/trace-replay.js +65 -0
  103. package/dist/tracing/trace-replay.js.map +1 -1
  104. package/dist/types.d.ts +79 -12
  105. package/dist/workflow-builder/parse-validate.d.ts +5 -1
  106. package/dist/workflow-builder/parse-validate.js +4 -3
  107. package/dist/workflow-builder/parse-validate.js.map +1 -1
  108. package/dist/workflow-loop/guidance.js +8 -2
  109. package/dist/workflow-loop/guidance.js.map +1 -1
  110. package/dist/workflow-loop/index.d.ts +3 -2
  111. package/dist/workflow-loop/index.js +9 -1
  112. package/dist/workflow-loop/index.js.map +1 -1
  113. package/dist/workflow-loop/remediation.d.ts +13 -0
  114. package/dist/workflow-loop/remediation.js +36 -0
  115. package/dist/workflow-loop/remediation.js.map +1 -0
  116. package/dist/workflow-loop/runtime.js +7 -0
  117. package/dist/workflow-loop/runtime.js.map +1 -1
  118. package/dist/workflow-loop/workflow-loop-controller.d.ts +1 -1
  119. package/dist/workflow-loop/workflow-loop-controller.js +196 -29
  120. package/dist/workflow-loop/workflow-loop-controller.js.map +1 -1
  121. package/dist/workflow-loop/workflow-loop-state.d.ts +338 -8
  122. package/dist/workflow-loop/workflow-loop-state.js +44 -1
  123. package/dist/workflow-loop/workflow-loop-state.js.map +1 -1
  124. package/dist/workflow-loop/workflow-task-service.d.ts +2 -1
  125. package/dist/workflow-loop/workflow-task-service.js +4 -0
  126. package/dist/workflow-loop/workflow-task-service.js.map +1 -1
  127. package/dist/workspace/builder-sandbox-factory.d.ts +3 -2
  128. package/dist/workspace/builder-sandbox-factory.js +74 -27
  129. package/dist/workspace/builder-sandbox-factory.js.map +1 -1
  130. package/dist/workspace/create-workspace.d.ts +2 -0
  131. package/dist/workspace/create-workspace.js.map +1 -1
  132. package/dist/workspace/sandbox-setup.js +36 -8
  133. package/dist/workspace/sandbox-setup.js.map +1 -1
  134. package/dist/workspace/snapshot-manager.d.ts +14 -2
  135. package/dist/workspace/snapshot-manager.js +57 -1
  136. package/dist/workspace/snapshot-manager.js.map +1 -1
  137. package/package.json +11 -5
  138. package/dist/tools/templates/template-api.d.ts +0 -21
  139. package/dist/tools/templates/template-api.js +0 -104
  140. package/dist/tools/templates/template-api.js.map +0 -1
  141. package/dist/tools/templates/types.d.ts +0 -52
  142. package/dist/tools/templates/types.js +0 -37
  143. package/dist/tools/templates/types.js.map +0 -1
  144. package/dist/tools/utils/mermaid.utils.d.ts +0 -15
  145. package/dist/tools/utils/mermaid.utils.js +0 -622
  146. package/dist/tools/utils/mermaid.utils.js.map +0 -1
  147. package/dist/tools/utils/node-configuration.utils.d.ts +0 -6
  148. package/dist/tools/utils/node-configuration.utils.js +0 -77
  149. package/dist/tools/utils/node-configuration.utils.js.map +0 -1
@@ -162,7 +162,6 @@ async function createInstanceAgent(options) {
162
162
  tools: hasDeferrableTools ? coreTools : tracedOrchestratorTools,
163
163
  inputProcessors: toolSearchProcessor ? [toolSearchProcessor] : undefined,
164
164
  memory,
165
- workspace: options.workspace,
166
165
  });
167
166
  (0, langsmith_tracing_1.mergeTraceRunInputs)(orchestrationContext?.tracing?.actorRun, (0, langsmith_tracing_1.buildAgentTraceInputs)({
168
167
  systemPrompt,
@@ -1 +1 @@
1
- {"version":3,"file":"instance-agent.js","sourceRoot":"","sources":["../../src/agent/instance-agent.ts"],"names":[],"mappings":";;AA4GA,kDAiJC;AA5PD,8CAA2C;AAC3C,gDAA6C;AAC7C,wDAA+F;AAE/F,qCAAwC;AACxC,mCAAgC;AAEhC,2DAAuD;AACvD,oCAAmG;AACnG,iEAAgE;AAChE,mDAAkD;AAClD,mGAAiG;AACjG,oEAA0F;AAE1F,SAAS,eAAe,CACvB,OAA0B;IAK1B,MAAM,OAAO,GAGT,EAAE,CAAC;IACP,KAAK,MAAM,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many">>;
29
29
  }, "strip", z.ZodTypeAny, {
30
- result: string;
31
30
  status: "completed" | "failed" | "cancelled";
31
+ result: string;
32
32
  role: string;
33
33
  agentId: string;
34
34
  toolCallCount: number;
@@ -43,8 +43,8 @@ export declare const subAgentDebriefingSchema: z.ZodObject<{
43
43
  blockers?: string[] | undefined;
44
44
  stoppingReason?: string | undefined;
45
45
  }, {
46
- result: string;
47
46
  status: "completed" | "failed" | "cancelled";
47
+ result: string;
48
48
  role: string;
49
49
  agentId: string;
50
50
  toolCallCount: number;
@@ -26,7 +26,7 @@ Some trigger nodes expose HTTP endpoints. Always share the full production URL w
26
26
 
27
27
  - **Webhook Trigger**: ${webhookBaseUrl}/{path} (where {path} is the node's webhook path parameter).
28
28
  - **Form Trigger**: ${webhookBaseUrl}/{path} (or ${webhookBaseUrl}/{webhookId} if no custom path is set). Same pattern as Webhook — no /chat suffix.
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 is published (active). Do NOT guess the webhookId — read the workflow to find it.
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 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
30
 
31
31
  **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
32
  }
@@ -143,11 +143,15 @@ You have access to workflow, execution, and credential tools plus a specialized
143
143
 
144
144
  ## When to Plan
145
145
 
146
- 1. **Single workflow** (build, fix, or modify one workflow): call \`build-workflow-with-agent\` directly — no plan needed.
146
+ Route by **what you are touching**, not by how risky the change feels:
147
147
 
148
- 2. **Multi-step work** (2+ tasks with dependencies e.g. data table setup + multiple workflows, or parallel builds + consolidation): call \`plan\` immediately — do NOT ask the user questions first. The planner sub-agent discovers credentials, data tables, and best practices, and will ask the user targeted questions itself if needed it has far better context about what to ask than you do. Only pass \`guidance\` when the conversation is ambiguous about which approach to take — one sentence, not a rewrite. When \`plan\` returns, tasks are already dispatched.
148
+ 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.
149
149
 
150
- 3. **Replanning after failure** (\`<planned-task-follow-up type="replan">\` arrived): inspect the failure details and remaining work. If only one simple task remains (e.g. a single data table operation or credential setup), handle it directly with the appropriate tool (\`manage-data-tables-with-agent\`, \`delegate\`, \`build-workflow-with-agent\`). Use \`create-tasks\` only when multiple dependent tasks still need scheduling — a runtime guard rejects \`create-tasks\` outside a replan context. If replanning is not appropriate, explain the blocker to the user.
150
+ 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**).
151
+
152
+ 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.
153
+
154
+ 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
155
 
152
156
  Use \`task-control(action="update-checklist")\` only for lightweight visible checklists that do not need scheduler-driven execution.
153
157
 
@@ -161,7 +165,7 @@ When \`credentials(action="setup")\` returns \`needsBrowserSetup=true\`, call \`
161
165
 
162
166
  Never use \`delegate\` to build, patch, fix, or update workflows — delegate does not have access to the builder sandbox, verification, or submit tools.
163
167
 
164
- To fix or modify an existing workflow, use a \`build-workflow\` task (via \`plan\` if multi-step, or \`build-workflow-with-agent\` directly if single) with the existing workflow ID and a spec describing what to change.
168
+ 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 trigger is mockable (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
169
 
166
170
  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
171
 
@@ -179,11 +183,17 @@ Always pass \`conversationContext\` when spawning background agents (\`build-wor
179
183
 
180
184
  ${credential_guardrails_prompt_1.SECRET_ASK_GUARDRAIL}
181
185
 
182
- **Post-build flow** (for direct builds via \`build-workflow-with-agent\`):
183
- 1. Builder finishes → check if the workflow has mocked credentials, missing parameters, unresolved placeholders, or unconfigured triggers.
184
- 2. If yes call \`workflows(action="setup")\` with the workflowId so the user can configure them through the setup UI.
186
+ **Post-build flow** (for direct \`build-workflow-with-agent\` calls with \`bypassPlan: true\` — plan-driven builds handle their own setup/verify flow via the checkpoint):
187
+
188
+ **Publishing is never required for testing.** Both \`executions(action="run")\` and \`verify-built-workflow\` inject \`inputData\` as the trigger's output via the pin-data adapter 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.
189
+
190
+ 1. Builder finishes → read \`outcome.workflowId\`, \`outcome.workItemId\`, \`outcome.triggerNodes\`, and \`outcome.verification\` from the \`<background-task-completed>\` payload's \`outcome\` field (the \`result\` field is only a short text summary). If \`outcome\` is missing, the build did not submit — skip to step 2.
191
+ - If \`outcome.verification\` is successful structured tool evidence (\`attempted: true\`, \`success: true\`, an \`executionId\`, and executed-node evidence), treat the workflow as already verified and do **not** call \`verify-built-workflow\` again. Never trust builder prose alone; only reuse the structured \`outcome.verification\` record.
192
+ - Otherwise, if any \`outcome.triggerNodes[*].nodeType\` matches \`n8n-nodes-base.scheduleTrigger\`, \`n8n-nodes-base.webhook\`, \`@n8n/n8n-nodes-langchain.chatTrigger\`, or \`n8n-nodes-base.formTrigger\`, call \`verify-built-workflow\` with the \`workItemId\` / \`workflowId\` and the trigger-appropriate \`inputData\` shape (see **Per-trigger \`inputData\` shape** below). The verify tool runs the workflow with sidecar pin-data — including the builder's mocked-credential pin data — and cleans up data-table rows it inserted, so it is safe to run without user approval. Run verify even when \`outcome.mockedCredentialsByNode\` is non-empty — the mocked pin data is precisely what it is designed to use.
193
+ - Skip verify only when: \`outcome.workflowId\` or \`outcome.workItemId\` is missing; \`outcome.hasUnresolvedPlaceholders === true\`; no trigger in \`triggerNodes\` matches a mockable type (polling triggers, OAuth-bound triggers); or the test path requires mocked credentials AND no \`outcome.verificationPinData\` is available (real-credential workflows with no mocked nodes do NOT require pin data — \`verify-built-workflow\` accepts missing pin data).
194
+ 2. If the workflow has mocked credentials, missing parameters, unresolved placeholders, or unconfigured triggers → call \`workflows(action="setup")\` with the workflowId so the user can configure them through the setup UI.
185
195
  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.
196
+ 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
197
  5. Only call \`workflows(action="publish")\` when the user explicitly asks to publish. Never publish automatically.
188
198
 
189
199
  ## Tool Usage
@@ -251,18 +261,30 @@ Working memory persists across all your conversations with this user. Keep it fo
251
261
 
252
262
  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
263
 
264
+ **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.
265
+
254
266
  When \`<running-tasks>\` context is present, use it only to reference active task IDs for cancellation or corrections.
255
267
 
256
- When \`<planned-task-follow-up type="synthesize">\` is present, all planned tasks completed successfully. Read the task outcomes and write the final user-facing completion message. Do not create another plan.
268
+ 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.
269
+
270
+ 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.
257
271
 
258
- When \`<planned-task-follow-up type="replan">\` is present, a planned task failedapply the replanning branch from \`## When to Plan\` above.
272
+ 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 and call \`complete-checkpoint(taskId, status: "succeeded", result, outcome)\` 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. 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
273
 
260
274
  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
275
 
262
- If the user sends a correction while a build is running, call \`task-control(action="correct-task")\` with the task ID and correction.
276
+ **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.
277
+
278
+ ### Per-trigger \`inputData\` shape
279
+
280
+ 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:
281
+ - **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.
282
+ - **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>\`.
283
+ - **Chat Trigger** (\`@n8n/n8n-nodes-langchain.chatTrigger\`) — \`{chatInput: "user message"}\`.
284
+ - **Schedule Trigger** (\`n8n-nodes-base.scheduleTrigger\`) — omit \`inputData\`; the adapter emits synthetic timestamp fields.
263
285
 
264
- ## Sandbox (Code Execution)
286
+ **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
287
 
266
- When available, \`mastra_workspace_execute_command\` runs shell commands in a persistent isolated sandbox. Use it for code execution, package installation, file processing. The sandbox cannot access the n8n host filesystem — use tool calls for n8n data.`;
288
+ If the user sends a correction while a build is running, call \`task-control(action="correct-task")\` with the task ID and correction.`;
267
289
  }
268
290
  //# sourceMappingURL=system-prompt.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"system-prompt.js","sourceRoot":"","sources":["../../src/agent/system-prompt.ts"],"names":[],"mappings":";;AAwBA,gDASC;AAyID,0CAoJC;AA9TD,iCAAiC;AAEjC,iFAAsE;AACtE,qDAA8D;AAG9D,MAAM,yBAAyB,GAC9B,2FAA2F,CAAC;AAiB7F,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;IACrD,OAAO;;;oBAGY,cAAc;;;;yBAIT,cAAc;sBACjB,cAAc,eAAe,cAAc;sBAC3C,cAAc;;mOAE+L,CAAC;AACpO,CAAC;AAED,SAAS,oBAAoB,CAC5B,gBAAqC,EACrC,YAA4C,EAC5C,cAAuB;IAGvB,IAAI,YAAY,EAAE,MAAM,KAAK,cAAc,EAAE,CAAC;QAC7C,MAAM,eAAe,GAAa,EAAE,CAAC;QACrC,IAAI,YAAY,CAAC,YAAY,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC;YACtD,eAAe,CAAC,IAAI,CAAC,kEAAkE,CAAC,CAAC;QAC1F,CAAC;QACD,IAAI,YAAY,CAAC,YAAY,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;YACnD,eAAe,CA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