@n8n/instance-ai 1.4.1 → 1.5.1

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 +13 -7
  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
@@ -5,6 +5,7 @@ declare const workItemRecordSchema: z.ZodObject<{
5
5
  state: z.ZodObject<{
6
6
  workItemId: z.ZodString;
7
7
  threadId: z.ZodString;
8
+ runId: z.ZodOptional<z.ZodString>;
8
9
  workflowId: z.ZodOptional<z.ZodString>;
9
10
  phase: z.ZodEnum<["building", "verifying", "repairing", "done", "blocked"]>;
10
11
  status: z.ZodEnum<["active", "completed", "blocked"]>;
@@ -15,6 +16,31 @@ declare const workItemRecordSchema: z.ZodObject<{
15
16
  rebuildAttempts: z.ZodNumber;
16
17
  mockedCredentialTypes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
17
18
  hasUnresolvedPlaceholders: z.ZodOptional<z.ZodBoolean>;
19
+ successfulSubmitSeen: z.ZodOptional<z.ZodBoolean>;
20
+ preSaveSubmitFailures: z.ZodOptional<z.ZodNumber>;
21
+ postSubmitRemediationSubmitsUsed: z.ZodOptional<z.ZodNumber>;
22
+ lastRemediation: z.ZodOptional<z.ZodObject<{
23
+ category: z.ZodEnum<["code_fixable", "needs_setup", "blocked"]>;
24
+ shouldEdit: z.ZodBoolean;
25
+ guidance: z.ZodString;
26
+ reason: z.ZodOptional<z.ZodString>;
27
+ remainingSubmitFixes: z.ZodOptional<z.ZodNumber>;
28
+ attemptCount: z.ZodOptional<z.ZodNumber>;
29
+ }, "strip", z.ZodTypeAny, {
30
+ category: "blocked" | "code_fixable" | "needs_setup";
31
+ shouldEdit: boolean;
32
+ guidance: string;
33
+ reason?: string | undefined;
34
+ remainingSubmitFixes?: number | undefined;
35
+ attemptCount?: number | undefined;
36
+ }, {
37
+ category: "blocked" | "code_fixable" | "needs_setup";
38
+ shouldEdit: boolean;
39
+ guidance: string;
40
+ reason?: string | undefined;
41
+ remainingSubmitFixes?: number | undefined;
42
+ attemptCount?: number | undefined;
43
+ }>>;
18
44
  }, "strip", z.ZodTypeAny, {
19
45
  status: "blocked" | "active" | "completed";
20
46
  workItemId: string;
@@ -23,11 +49,23 @@ declare const workItemRecordSchema: z.ZodObject<{
23
49
  source: "create" | "modify";
24
50
  rebuildAttempts: number;
25
51
  workflowId?: string | undefined;
52
+ runId?: string | undefined;
26
53
  lastTaskId?: string | undefined;
27
54
  lastExecutionId?: string | undefined;
28
55
  lastFailureSignature?: string | undefined;
29
56
  mockedCredentialTypes?: string[] | undefined;
30
57
  hasUnresolvedPlaceholders?: boolean | undefined;
58
+ successfulSubmitSeen?: boolean | undefined;
59
+ preSaveSubmitFailures?: number | undefined;
60
+ postSubmitRemediationSubmitsUsed?: number | undefined;
61
+ lastRemediation?: {
62
+ category: "blocked" | "code_fixable" | "needs_setup";
63
+ shouldEdit: boolean;
64
+ guidance: string;
65
+ reason?: string | undefined;
66
+ remainingSubmitFixes?: number | undefined;
67
+ attemptCount?: number | undefined;
68
+ } | undefined;
31
69
  }, {
32
70
  status: "blocked" | "active" | "completed";
33
71
  workItemId: string;
@@ -36,11 +74,23 @@ declare const workItemRecordSchema: z.ZodObject<{
36
74
  source: "create" | "modify";
37
75
  rebuildAttempts: number;
38
76
  workflowId?: string | undefined;
77
+ runId?: string | undefined;
39
78
  lastTaskId?: string | undefined;
40
79
  lastExecutionId?: string | undefined;
41
80
  lastFailureSignature?: string | undefined;
42
81
  mockedCredentialTypes?: string[] | undefined;
43
82
  hasUnresolvedPlaceholders?: boolean | undefined;
83
+ successfulSubmitSeen?: boolean | undefined;
84
+ preSaveSubmitFailures?: number | undefined;
85
+ postSubmitRemediationSubmitsUsed?: number | undefined;
86
+ lastRemediation?: {
87
+ category: "blocked" | "code_fixable" | "needs_setup";
88
+ shouldEdit: boolean;
89
+ guidance: string;
90
+ reason?: string | undefined;
91
+ remainingSubmitFixes?: number | undefined;
92
+ attemptCount?: number | undefined;
93
+ } | undefined;
44
94
  }>;
45
95
  attempts: z.ZodArray<z.ZodObject<{
46
96
  workItemId: z.ZodString;
@@ -53,38 +103,58 @@ declare const workItemRecordSchema: z.ZodObject<{
53
103
  failureSignature: z.ZodOptional<z.ZodString>;
54
104
  diagnosis: z.ZodOptional<z.ZodString>;
55
105
  fixApplied: z.ZodOptional<z.ZodString>;
106
+ remediationCategory: z.ZodOptional<z.ZodEnum<["code_fixable", "needs_setup", "blocked"]>>;
107
+ remediationShouldEdit: z.ZodOptional<z.ZodBoolean>;
108
+ remediationGuidance: z.ZodOptional<z.ZodString>;
56
109
  createdAt: z.ZodString;
57
110
  }, "strip", z.ZodTypeAny, {
111
+ createdAt: string;
58
112
  attempt: number;
59
113
  action: "build" | "verify" | "rebuild" | "patch";
60
- result: "blocked" | "success" | "failure";
114
+ result: "success" | "blocked" | "failure";
61
115
  workItemId: string;
62
116
  phase: "building" | "verifying" | "repairing" | "done" | "blocked";
63
- createdAt: string;
117
+ workflowId?: string | undefined;
64
118
  diagnosis?: string | undefined;
65
119
  fixApplied?: string | undefined;
66
- workflowId?: string | undefined;
67
120
  executionId?: string | undefined;
68
121
  failureSignature?: string | undefined;
122
+ remediationCategory?: "blocked" | "code_fixable" | "needs_setup" | undefined;
123
+ remediationShouldEdit?: boolean | undefined;
124
+ remediationGuidance?: string | undefined;
69
125
  }, {
126
+ createdAt: string;
70
127
  attempt: number;
71
128
  action: "build" | "verify" | "rebuild" | "patch";
72
- result: "blocked" | "success" | "failure";
129
+ result: "success" | "blocked" | "failure";
73
130
  workItemId: string;
74
131
  phase: "building" | "verifying" | "repairing" | "done" | "blocked";
75
- createdAt: string;
132
+ workflowId?: string | undefined;
76
133
  diagnosis?: string | undefined;
77
134
  fixApplied?: string | undefined;
78
- workflowId?: string | undefined;
79
135
  executionId?: string | undefined;
80
136
  failureSignature?: string | undefined;
137
+ remediationCategory?: "blocked" | "code_fixable" | "needs_setup" | undefined;
138
+ remediationShouldEdit?: boolean | undefined;
139
+ remediationGuidance?: string | undefined;
81
140
  }>, "many">;
82
141
  lastBuildOutcome: z.ZodOptional<z.ZodObject<{
83
142
  workItemId: z.ZodString;
143
+ runId: z.ZodOptional<z.ZodString>;
84
144
  taskId: z.ZodString;
85
145
  workflowId: z.ZodOptional<z.ZodString>;
86
146
  submitted: z.ZodBoolean;
87
147
  triggerType: z.ZodEnum<["manual_or_testable", "trigger_only"]>;
148
+ triggerNodes: z.ZodOptional<z.ZodArray<z.ZodObject<{
149
+ nodeName: z.ZodString;
150
+ nodeType: z.ZodString;
151
+ }, "strip", z.ZodTypeAny, {
152
+ nodeName: string;
153
+ nodeType: string;
154
+ }, {
155
+ nodeName: string;
156
+ nodeType: string;
157
+ }>, "many">>;
88
158
  needsUserInput: z.ZodBoolean;
89
159
  blockingReason: z.ZodOptional<z.ZodString>;
90
160
  failureSignature: z.ZodOptional<z.ZodString>;
@@ -93,6 +163,78 @@ declare const workItemRecordSchema: z.ZodObject<{
93
163
  mockedCredentialsByNode: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString, "many">>>;
94
164
  verificationPinData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>, "many">>>;
95
165
  hasUnresolvedPlaceholders: z.ZodOptional<z.ZodBoolean>;
166
+ remediation: z.ZodOptional<z.ZodObject<{
167
+ category: z.ZodEnum<["code_fixable", "needs_setup", "blocked"]>;
168
+ shouldEdit: z.ZodBoolean;
169
+ guidance: z.ZodString;
170
+ reason: z.ZodOptional<z.ZodString>;
171
+ remainingSubmitFixes: z.ZodOptional<z.ZodNumber>;
172
+ attemptCount: z.ZodOptional<z.ZodNumber>;
173
+ }, "strip", z.ZodTypeAny, {
174
+ category: "blocked" | "code_fixable" | "needs_setup";
175
+ shouldEdit: boolean;
176
+ guidance: string;
177
+ reason?: string | undefined;
178
+ remainingSubmitFixes?: number | undefined;
179
+ attemptCount?: number | undefined;
180
+ }, {
181
+ category: "blocked" | "code_fixable" | "needs_setup";
182
+ shouldEdit: boolean;
183
+ guidance: string;
184
+ reason?: string | undefined;
185
+ remainingSubmitFixes?: number | undefined;
186
+ attemptCount?: number | undefined;
187
+ }>>;
188
+ verification: z.ZodOptional<z.ZodObject<{
189
+ attempted: z.ZodBoolean;
190
+ success: z.ZodBoolean;
191
+ executionId: z.ZodOptional<z.ZodString>;
192
+ status: z.ZodOptional<z.ZodEnum<["success", "error", "waiting", "running", "unknown"]>>;
193
+ failureSignature: z.ZodOptional<z.ZodString>;
194
+ evidence: z.ZodOptional<z.ZodObject<{
195
+ nodesExecuted: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
196
+ producedOutputRows: z.ZodOptional<z.ZodNumber>;
197
+ errorNodeName: z.ZodOptional<z.ZodString>;
198
+ errorMessage: z.ZodOptional<z.ZodString>;
199
+ }, "strip", z.ZodTypeAny, {
200
+ nodesExecuted?: string[] | undefined;
201
+ producedOutputRows?: number | undefined;
202
+ errorNodeName?: string | undefined;
203
+ errorMessage?: string | undefined;
204
+ }, {
205
+ nodesExecuted?: string[] | undefined;
206
+ producedOutputRows?: number | undefined;
207
+ errorNodeName?: string | undefined;
208
+ errorMessage?: string | undefined;
209
+ }>>;
210
+ verifiedAt: z.ZodOptional<z.ZodString>;
211
+ }, "strip", z.ZodTypeAny, {
212
+ success: boolean;
213
+ attempted: boolean;
214
+ status?: "running" | "error" | "unknown" | "success" | "waiting" | undefined;
215
+ executionId?: string | undefined;
216
+ failureSignature?: string | undefined;
217
+ evidence?: {
218
+ nodesExecuted?: string[] | undefined;
219
+ producedOutputRows?: number | undefined;
220
+ errorNodeName?: string | undefined;
221
+ errorMessage?: string | undefined;
222
+ } | undefined;
223
+ verifiedAt?: string | undefined;
224
+ }, {
225
+ success: boolean;
226
+ attempted: boolean;
227
+ status?: "running" | "error" | "unknown" | "success" | "waiting" | undefined;
228
+ executionId?: string | undefined;
229
+ failureSignature?: string | undefined;
230
+ evidence?: {
231
+ nodesExecuted?: string[] | undefined;
232
+ producedOutputRows?: number | undefined;
233
+ errorNodeName?: string | undefined;
234
+ errorMessage?: string | undefined;
235
+ } | undefined;
236
+ verifiedAt?: string | undefined;
237
+ }>>;
96
238
  summary: z.ZodString;
97
239
  }, "strip", z.ZodTypeAny, {
98
240
  workItemId: string;
@@ -102,13 +244,40 @@ declare const workItemRecordSchema: z.ZodObject<{
102
244
  needsUserInput: boolean;
103
245
  summary: string;
104
246
  workflowId?: string | undefined;
247
+ runId?: string | undefined;
105
248
  mockedCredentialTypes?: string[] | undefined;
106
249
  hasUnresolvedPlaceholders?: boolean | undefined;
107
250
  failureSignature?: string | undefined;
251
+ triggerNodes?: {
252
+ nodeName: string;
253
+ nodeType: string;
254
+ }[] | undefined;
108
255
  blockingReason?: string | undefined;
109
256
  mockedNodeNames?: string[] | undefined;
110
257
  mockedCredentialsByNode?: Record<string, string[]> | undefined;
111
258
  verificationPinData?: Record<string, Record<string, unknown>[]> | undefined;
259
+ remediation?: {
260
+ category: "blocked" | "code_fixable" | "needs_setup";
261
+ shouldEdit: boolean;
262
+ guidance: string;
263
+ reason?: string | undefined;
264
+ remainingSubmitFixes?: number | undefined;
265
+ attemptCount?: number | undefined;
266
+ } | undefined;
267
+ verification?: {
268
+ success: boolean;
269
+ attempted: boolean;
270
+ status?: "running" | "error" | "unknown" | "success" | "waiting" | undefined;
271
+ executionId?: string | undefined;
272
+ failureSignature?: string | undefined;
273
+ evidence?: {
274
+ nodesExecuted?: string[] | undefined;
275
+ producedOutputRows?: number | undefined;
276
+ errorNodeName?: string | undefined;
277
+ errorMessage?: string | undefined;
278
+ } | undefined;
279
+ verifiedAt?: string | undefined;
280
+ } | undefined;
112
281
  }, {
113
282
  workItemId: string;
114
283
  taskId: string;
@@ -117,13 +286,40 @@ declare const workItemRecordSchema: z.ZodObject<{
117
286
  needsUserInput: boolean;
118
287
  summary: string;
119
288
  workflowId?: string | undefined;
289
+ runId?: string | undefined;
120
290
  mockedCredentialTypes?: string[] | undefined;
121
291
  hasUnresolvedPlaceholders?: boolean | undefined;
122
292
  failureSignature?: string | undefined;
293
+ triggerNodes?: {
294
+ nodeName: string;
295
+ nodeType: string;
296
+ }[] | undefined;
123
297
  blockingReason?: string | undefined;
124
298
  mockedNodeNames?: string[] | undefined;
125
299
  mockedCredentialsByNode?: Record<string, string[]> | undefined;
126
300
  verificationPinData?: Record<string, Record<string, unknown>[]> | undefined;
301
+ remediation?: {
302
+ category: "blocked" | "code_fixable" | "needs_setup";
303
+ shouldEdit: boolean;
304
+ guidance: string;
305
+ reason?: string | undefined;
306
+ remainingSubmitFixes?: number | undefined;
307
+ attemptCount?: number | undefined;
308
+ } | undefined;
309
+ verification?: {
310
+ success: boolean;
311
+ attempted: boolean;
312
+ status?: "running" | "error" | "unknown" | "success" | "waiting" | undefined;
313
+ executionId?: string | undefined;
314
+ failureSignature?: string | undefined;
315
+ evidence?: {
316
+ nodesExecuted?: string[] | undefined;
317
+ producedOutputRows?: number | undefined;
318
+ errorNodeName?: string | undefined;
319
+ errorMessage?: string | undefined;
320
+ } | undefined;
321
+ verifiedAt?: string | undefined;
322
+ } | undefined;
127
323
  }>>;
128
324
  }, "strip", z.ZodTypeAny, {
129
325
  state: {
@@ -134,24 +330,39 @@ declare const workItemRecordSchema: z.ZodObject<{
134
330
  source: "create" | "modify";
135
331
  rebuildAttempts: number;
136
332
  workflowId?: string | undefined;
333
+ runId?: string | undefined;
137
334
  lastTaskId?: string | undefined;
138
335
  lastExecutionId?: string | undefined;
139
336
  lastFailureSignature?: string | undefined;
140
337
  mockedCredentialTypes?: string[] | undefined;
141
338
  hasUnresolvedPlaceholders?: boolean | undefined;
339
+ successfulSubmitSeen?: boolean | undefined;
340
+ preSaveSubmitFailures?: number | undefined;
341
+ postSubmitRemediationSubmitsUsed?: number | undefined;
342
+ lastRemediation?: {
343
+ category: "blocked" | "code_fixable" | "needs_setup";
344
+ shouldEdit: boolean;
345
+ guidance: string;
346
+ reason?: string | undefined;
347
+ remainingSubmitFixes?: number | undefined;
348
+ attemptCount?: number | undefined;
349
+ } | undefined;
142
350
  };
143
351
  attempts: {
352
+ createdAt: string;
144
353
  attempt: number;
145
354
  action: "build" | "verify" | "rebuild" | "patch";
146
- result: "blocked" | "success" | "failure";
355
+ result: "success" | "blocked" | "failure";
147
356
  workItemId: string;
148
357
  phase: "building" | "verifying" | "repairing" | "done" | "blocked";
149
- createdAt: string;
358
+ workflowId?: string | undefined;
150
359
  diagnosis?: string | undefined;
151
360
  fixApplied?: string | undefined;
152
- workflowId?: string | undefined;
153
361
  executionId?: string | undefined;
154
362
  failureSignature?: string | undefined;
363
+ remediationCategory?: "blocked" | "code_fixable" | "needs_setup" | undefined;
364
+ remediationShouldEdit?: boolean | undefined;
365
+ remediationGuidance?: string | undefined;
155
366
  }[];
156
367
  lastBuildOutcome?: {
157
368
  workItemId: string;
@@ -161,13 +372,40 @@ declare const workItemRecordSchema: z.ZodObject<{
161
372
  needsUserInput: boolean;
162
373
  summary: string;
163
374
  workflowId?: string | undefined;
375
+ runId?: string | undefined;
164
376
  mockedCredentialTypes?: string[] | undefined;
165
377
  hasUnresolvedPlaceholders?: boolean | undefined;
166
378
  failureSignature?: string | undefined;
379
+ triggerNodes?: {
380
+ nodeName: string;
381
+ nodeType: string;
382
+ }[] | undefined;
167
383
  blockingReason?: string | undefined;
168
384
  mockedNodeNames?: string[] | undefined;
169
385
  mockedCredentialsByNode?: Record<string, string[]> | undefined;
170
386
  verificationPinData?: Record<string, Record<string, unknown>[]> | undefined;
387
+ remediation?: {
388
+ category: "blocked" | "code_fixable" | "needs_setup";
389
+ shouldEdit: boolean;
390
+ guidance: string;
391
+ reason?: string | undefined;
392
+ remainingSubmitFixes?: number | undefined;
393
+ attemptCount?: number | undefined;
394
+ } | undefined;
395
+ verification?: {
396
+ success: boolean;
397
+ attempted: boolean;
398
+ status?: "running" | "error" | "unknown" | "success" | "waiting" | undefined;
399
+ executionId?: string | undefined;
400
+ failureSignature?: string | undefined;
401
+ evidence?: {
402
+ nodesExecuted?: string[] | undefined;
403
+ producedOutputRows?: number | undefined;
404
+ errorNodeName?: string | undefined;
405
+ errorMessage?: string | undefined;
406
+ } | undefined;
407
+ verifiedAt?: string | undefined;
408
+ } | undefined;
171
409
  } | undefined;
172
410
  }, {
173
411
  state: {
@@ -178,24 +416,39 @@ declare const workItemRecordSchema: z.ZodObject<{
178
416
  source: "create" | "modify";
179
417
  rebuildAttempts: number;
180
418
  workflowId?: string | undefined;
419
+ runId?: string | undefined;
181
420
  lastTaskId?: string | undefined;
182
421
  lastExecutionId?: string | undefined;
183
422
  lastFailureSignature?: string | undefined;
184
423
  mockedCredentialTypes?: string[] | undefined;
185
424
  hasUnresolvedPlaceholders?: boolean | undefined;
425
+ successfulSubmitSeen?: boolean | undefined;
426
+ preSaveSubmitFailures?: number | undefined;
427
+ postSubmitRemediationSubmitsUsed?: number | undefined;
428
+ lastRemediation?: {
429
+ category: "blocked" | "code_fixable" | "needs_setup";
430
+ shouldEdit: boolean;
431
+ guidance: string;
432
+ reason?: string | undefined;
433
+ remainingSubmitFixes?: number | undefined;
434
+ attemptCount?: number | undefined;
435
+ } | undefined;
186
436
  };
187
437
  attempts: {
438
+ createdAt: string;
188
439
  attempt: number;
189
440
  action: "build" | "verify" | "rebuild" | "patch";
190
- result: "blocked" | "success" | "failure";
441
+ result: "success" | "blocked" | "failure";
191
442
  workItemId: string;
192
443
  phase: "building" | "verifying" | "repairing" | "done" | "blocked";
193
- createdAt: string;
444
+ workflowId?: string | undefined;
194
445
  diagnosis?: string | undefined;
195
446
  fixApplied?: string | undefined;
196
- workflowId?: string | undefined;
197
447
  executionId?: string | undefined;
198
448
  failureSignature?: string | undefined;
449
+ remediationCategory?: "blocked" | "code_fixable" | "needs_setup" | undefined;
450
+ remediationShouldEdit?: boolean | undefined;
451
+ remediationGuidance?: string | undefined;
199
452
  }[];
200
453
  lastBuildOutcome?: {
201
454
  workItemId: string;
@@ -205,13 +458,40 @@ declare const workItemRecordSchema: z.ZodObject<{
205
458
  needsUserInput: boolean;
206
459
  summary: string;
207
460
  workflowId?: string | undefined;
461
+ runId?: string | undefined;
208
462
  mockedCredentialTypes?: string[] | undefined;
209
463
  hasUnresolvedPlaceholders?: boolean | undefined;
210
464
  failureSignature?: string | undefined;
465
+ triggerNodes?: {
466
+ nodeName: string;
467
+ nodeType: string;
468
+ }[] | undefined;
211
469
  blockingReason?: string | undefined;
212
470
  mockedNodeNames?: string[] | undefined;
213
471
  mockedCredentialsByNode?: Record<string, string[]> | undefined;
214
472
  verificationPinData?: Record<string, Record<string, unknown>[]> | undefined;
473
+ remediation?: {
474
+ category: "blocked" | "code_fixable" | "needs_setup";
475
+ shouldEdit: boolean;
476
+ guidance: string;
477
+ reason?: string | undefined;
478
+ remainingSubmitFixes?: number | undefined;
479
+ attemptCount?: number | undefined;
480
+ } | undefined;
481
+ verification?: {
482
+ success: boolean;
483
+ attempted: boolean;
484
+ status?: "running" | "error" | "unknown" | "success" | "waiting" | undefined;
485
+ executionId?: string | undefined;
486
+ failureSignature?: string | undefined;
487
+ evidence?: {
488
+ nodesExecuted?: string[] | undefined;
489
+ producedOutputRows?: number | undefined;
490
+ errorNodeName?: string | undefined;
491
+ errorMessage?: string | undefined;
492
+ } | undefined;
493
+ verifiedAt?: string | undefined;
494
+ } | undefined;
215
495
  } | undefined;
216
496
  }>;
217
497
  export type WorkflowLoopWorkItemRecord = z.infer<typeof workItemRecordSchema>;
@@ -19,6 +19,7 @@ export interface ConsumeWithHitlOptions {
19
19
  waitForCorrection?: () => Promise<void>;
20
20
  llmStepTraceHooks?: LlmStepTraceHooks;
21
21
  maxSteps?: number;
22
+ resumeOptions?: Record<string, unknown>;
22
23
  }
23
24
  export interface ConsumeWithHitlResult {
24
25
  text: Promise<string>;
@@ -28,6 +28,7 @@ async function consumeStreamWithHitl(options) {
28
28
  runId: mastraRunId,
29
29
  toolCallId: suspension.toolCallId,
30
30
  maxSteps: options.maxSteps,
31
+ ...(options.resumeOptions ?? {}),
31
32
  }),
32
33
  }
33
34
  : {}),
@@ -1 +1 @@
1
- {"version":3,"file":"consume-with-hitl.js","sourceRoot":"","sources":["../../src/stream/consume-with-hitl.ts"],"names":[],"mappings":";;AA8CA,sDAqCC;AA/ED,oFAI8C;AAsCvC,KAAK,UAAU,qBAAqB,CAC1C,OAA+B;IAE/B,IAAI,CAAC,OAAO,CAAC,mBAAmB,EAAE,CAAC;QAClC,MAAM,IAAI,KAAK,CAAC,uEAAuE,CAAC,CAAC;IAC1F,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,IAAA,kDAAsB,EAAC;QAC3C,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,OAAO,EAAE;YACR,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,MAAM,EAAE,OAAO,CAAC,WAAW;YAC3B,MAAM,EAAE,OAAO,CAAC,MAAM;SACtB;QACD,OAAO,EAAE;YACR,IAAI,EAAE,MAAM;YACZ,mBAAmB,EAAE,OAAO,CAAC,mBAAmB;YAChD,gBAAgB,EAAE,OAAO,CAAC,gBAAgB;YAC1C,iBAAiB,EAAE,OAAO,CAAC,iBAAiB;YAC5C,GAAG,CAAC,OAAO,CAAC,QAAQ;gBACnB,CAAC,CAAC;oBACA,kBAAkB,EAAE,CAAC,EAAE,WAAW,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,CAAC;wBACrD,KAAK,EAAE,WAAW;wBAClB,UAAU,EAAE,UAAU,CAAC,UAAU;wBACjC,QAAQ,EAAE,OAAO,CAAC,QAAQ;qBAC1B,CAAC;iBACF;gBACF,CAAC,CAAC,EAAE,CAAC;SACN;QACD,iBAAiB,EAAE,OAAO,CAAC,iBAAiB;KAC5C,CAAC,CAAC;IAEH,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,WAAW,EAAE,MAAM,CAAC,WAAW,EAAE,CAAC;AACtF,CAAC"}
1
+ {"version":3,"file":"consume-with-hitl.js","sourceRoot":"","sources":["../../src/stream/consume-with-hitl.ts"],"names":[],"mappings":";;AAgDA,sDAsCC;AAlFD,oFAI8C;AAwCvC,KAAK,UAAU,qBAAqB,CAC1C,OAA+B;IAE/B,IAAI,CAAC,OAAO,CAAC,mBAAmB,EAAE,CAAC;QAClC,MAAM,IAAI,KAAK,CAAC,uEAAuE,CAAC,CAAC;IAC1F,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,IAAA,kDAAsB,EAAC;QAC3C,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,OAAO,EAAE;YACR,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,MAAM,EAAE,OAAO,CAAC,WAAW;YAC3B,MAAM,EAAE,OAAO,CAAC,MAAM;SACtB;QACD,OAAO,EAAE;YACR,IAAI,EAAE,MAAM;YACZ,mBAAmB,EAAE,OAAO,CAAC,mBAAmB;YAChD,gBAAgB,EAAE,OAAO,CAAC,gBAAgB;YAC1C,iBAAiB,EAAE,OAAO,CAAC,iBAAiB;YAC5C,GAAG,CAAC,OAAO,CAAC,QAAQ;gBACnB,CAAC,CAAC;oBACA,kBAAkB,EAAE,CAAC,EAAE,WAAW,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,CAAC;wBACrD,KAAK,EAAE,WAAW;wBAClB,UAAU,EAAE,UAAU,CAAC,UAAU;wBACjC,QAAQ,EAAE,OAAO,CAAC,QAAQ;wBAC1B,GAAG,CAAC,OAAO,CAAC,aAAa,IAAI,EAAE,CAAC;qBAChC,CAAC;iBACF;gBACF,CAAC,CAAC,EAAE,CAAC;SACN;QACD,iBAAiB,EAAE,OAAO,CAAC,iBAAiB;KAC5C,CAAC,CAAC;IAEH,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,WAAW,EAAE,MAAM,CAAC,WAAW,EAAE,CAAC;AACtF,CAAC"}