@lazyingart/agintiflow 0.20.260 → 0.20.261

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lazyingart/agintiflow",
3
- "version": "0.20.260",
3
+ "version": "0.20.261",
4
4
  "type": "module",
5
5
  "description": "AgInTiFlow is a project-aware agent workspace for hybrid wet-dry R&D, hardware-aware intelligence, software automation, and industrial workflows.",
6
6
  "license": "Apache-2.0",
@@ -175,13 +175,86 @@ async function main() {
175
175
  toolChoiceForProvider(
176
176
  { provider: "deepseek" },
177
177
  [{ role: "user", content: "Emit exactly one enabled tool call that performs the next concrete action." }]
178
- ) === "auto",
179
- "DeepSeek thinking mode received unsupported required tool selection during recovery"
178
+ ) === "required",
179
+ "DeepSeek action recovery did not require a tool call"
180
+ );
181
+ assert(
182
+ JSON.stringify(toolChoiceForProvider(
183
+ { provider: "deepseek" },
184
+ [{ role: "user", content: "Emit exactly one enabled tool call that performs the next concrete action." }],
185
+ [
186
+ { type: "function", function: { name: "apply_patch" } },
187
+ { type: "function", function: { name: "finish" } },
188
+ ]
189
+ )) === JSON.stringify({ type: "function", function: { name: "apply_patch" } }),
190
+ "DeepSeek action recovery did not force the only executable tool"
180
191
  );
181
192
  assert(
182
193
  JSON.stringify(providerStructuredOutputAttempts("deepseek")) === JSON.stringify(["json_object", "prompt"]),
183
194
  "DeepSeek structured extraction still probes an unsupported JSON Schema mode"
184
195
  );
196
+ let deepSeekActionPayload = null;
197
+ await requestNextStep(
198
+ {
199
+ chat: {
200
+ completions: {
201
+ create: async (payload) => {
202
+ deepSeekActionPayload = payload;
203
+ return {
204
+ choices: [{
205
+ message: {
206
+ role: "assistant",
207
+ content: "",
208
+ tool_calls: [{
209
+ id: "deepseek-action-patch",
210
+ type: "function",
211
+ function: {
212
+ name: "apply_patch",
213
+ arguments: JSON.stringify({
214
+ path: "service.py",
215
+ search: "old",
216
+ replace: "new",
217
+ expectedReplacements: 1,
218
+ }),
219
+ },
220
+ }],
221
+ },
222
+ }],
223
+ };
224
+ },
225
+ },
226
+ },
227
+ },
228
+ {
229
+ provider: "deepseek",
230
+ model: "deepseek-v4-pro",
231
+ reasoning: "xhigh",
232
+ goal: "Repair service.py from exact retained source.",
233
+ taskProfile: "code",
234
+ allowFileTools: true,
235
+ allowShellTool: false,
236
+ allowWebSearch: false,
237
+ allowMcpTools: false,
238
+ allowWrapperTools: false,
239
+ allowAuxiliaryTools: false,
240
+ completionFreshMutationRequired: true,
241
+ completionFreshMutationNeedsSourceRead: false,
242
+ completionFreshMutationPaths: ["service.py"],
243
+ },
244
+ [{ role: "user", content: "Emit exactly one enabled tool call that performs the next concrete action." }]
245
+ );
246
+ assert(
247
+ deepSeekActionPayload?.thinking?.type === "disabled",
248
+ "DeepSeek reasoning-only recovery did not disable a second expensive thinking pass"
249
+ );
250
+ assert(
251
+ deepSeekActionPayload?.tool_choice?.function?.name === "apply_patch",
252
+ "DeepSeek reasoning-only recovery did not force its single executable tool"
253
+ );
254
+ assert(
255
+ !Object.hasOwn(deepSeekActionPayload || {}, "reasoning_effort"),
256
+ "DeepSeek action-only recovery sent a conflicting reasoning effort"
257
+ );
185
258
 
186
259
  assert(!isPublicWebUrl("http://127.0.0.1/private"), "public URL guard accepted loopback");
187
260
  assert(!isPublicWebUrl("http://10.0.0.1/private"), "public URL guard accepted RFC1918 address");
@@ -705,6 +705,24 @@ try {
705
705
  tracebackPacket.content.includes("### tests/test_traceback_packet.py"),
706
706
  "exact same-workspace test files named by a traceback were omitted when discovery metadata was empty"
707
707
  );
708
+ const repeatedTracebackPacketState = structuredClone(tracebackPacketState);
709
+ repeatedTracebackPacketState.meta.projectVerification.testRuns[0].failureSignature =
710
+ "repeated-validator-traceback-file-recovery";
711
+ repeatedTracebackPacketState.meta.projectVerification.testRuns[0].failureSummary =
712
+ [
713
+ `File "${path.join(workspace, "duplicate-source.py")}", line 1, in first`,
714
+ `File "${path.join(workspace, "duplicate-source.py")}", line 2, in second`,
715
+ `File "${path.join(workspace, "duplicate-source.py")}", line 3, in third`,
716
+ `File "${path.join(workspace, "tests", "test_traceback_packet.py")}", line 4, in test_contract`,
717
+ ].join("\n");
718
+ const repeatedTracebackPacket = await buildFailedTestRecoveryPacket(
719
+ { commandCwd: workspace },
720
+ repeatedTracebackPacketState
721
+ );
722
+ assert(
723
+ repeatedTracebackPacket.paths.includes("tests/test_traceback_packet.py"),
724
+ "duplicate frames from one validator crowded the actual failing test out of recovery evidence"
725
+ );
708
726
  assert(
709
727
  (await failedTestRepairPatchBlock(
710
728
  duplicateRepairState,
@@ -4777,8 +4777,8 @@ async function failedTestTracebackSourceDocuments(testRun = {}, config = {}) {
4777
4777
  ? path.resolve(reportedPath)
4778
4778
  : path.resolve(commandCwd, reportedPath);
4779
4779
  const line = Math.max(1, Number(match[2] || 1));
4780
- if (seen.has(`${absolutePath}:${line}`)) continue;
4781
- seen.add(`${absolutePath}:${line}`);
4780
+ if (seen.has(absolutePath)) continue;
4781
+ seen.add(absolutePath);
4782
4782
  const insideWorkspace =
4783
4783
  absolutePath === commandCwd || absolutePath.startsWith(`${commandCwd}${path.sep}`);
4784
4784
  const namedByCommand = command.includes(absolutePath);
@@ -4797,7 +4797,7 @@ async function failedTestTracebackSourceDocuments(testRun = {}, config = {}) {
4797
4797
  const raw = await fs.readFile(absolutePath, "utf8").catch(() => "");
4798
4798
  if (!raw) continue;
4799
4799
  documents.push({ absolutePath, line, raw });
4800
- if (documents.length >= 3) break;
4800
+ if (documents.length >= 5) break;
4801
4801
  }
4802
4802
  return documents;
4803
4803
  }
@@ -134,6 +134,10 @@ function chatReasoningEffort(config = {}) {
134
134
  }
135
135
 
136
136
  function withChatReasoningEffort(payload = {}, config = {}) {
137
+ if (payload.thinking?.type === "disabled") {
138
+ const { reasoning_effort: _reasoningEffort, ...rest } = payload;
139
+ return rest;
140
+ }
137
141
  const reasoning = chatReasoningEffort(config);
138
142
  if (!reasoning) {
139
143
  const { reasoning_effort: _reasoningEffort, ...rest } = payload;
@@ -336,17 +340,35 @@ function assertLocalRequestWithinContext(payload = {}, config = {}, label = "age
336
340
 
337
341
  export { hasExplicitDeepResearchIntent } from "./research-routing.js";
338
342
 
339
- export function toolChoiceForProvider(config, messages = []) {
340
- const requiresConcreteContinuation = messages.slice(-3).some(
343
+ function requiresConcreteToolContinuation(messages = []) {
344
+ return messages.slice(-3).some(
341
345
  (message) =>
342
346
  message?.role === "user" &&
343
347
  /emit exactly one enabled tool call that performs the next concrete action/i.test(String(message.content || ""))
344
348
  );
345
- // DeepSeek thinking models reject tool_choice="required" even though they
346
- // accept the same native tool schema with auto selection. The continuation
347
- // instruction remains explicit in the messages, so keep the supported
348
- // provider mode instead of turning a recoverable truncation into HTTP 400.
349
- if (requiresConcreteContinuation && normalizeProviderId(config.provider, "") !== "deepseek") {
349
+ }
350
+
351
+ function deepSeekActionOnlyRequest(config = {}, messages = []) {
352
+ return normalizeProviderId(config.provider, "") === "deepseek" &&
353
+ requiresConcreteToolContinuation(messages);
354
+ }
355
+
356
+ export function toolChoiceForProvider(config, messages = [], tools = []) {
357
+ const requiresConcreteContinuation = requiresConcreteToolContinuation(messages);
358
+ if (requiresConcreteContinuation) {
359
+ const actionable = (Array.isArray(tools) ? tools : [])
360
+ .filter((tool) => tool?.type === "function" && tool.function?.name !== "finish")
361
+ .map((tool) => String(tool.function?.name || ""))
362
+ .filter(Boolean);
363
+ if (
364
+ normalizeProviderId(config.provider, "") === "deepseek" &&
365
+ actionable.length === 1
366
+ ) {
367
+ return {
368
+ type: "function",
369
+ function: { name: actionable[0] },
370
+ };
371
+ }
350
372
  return "required";
351
373
  }
352
374
  if (config.provider !== "venice") return "auto";
@@ -2649,10 +2671,13 @@ export async function requestNextStep(client, config, messages) {
2649
2671
  const nativePayload = {
2650
2672
  model: config.model,
2651
2673
  temperature: 0,
2652
- tool_choice: toolChoiceForProvider(config, messages),
2674
+ tool_choice: toolChoiceForProvider(config, messages, requestTools),
2653
2675
  parallel_tool_calls: false,
2654
2676
  messages: prepareMessages(config, messages),
2655
2677
  tools: requestTools,
2678
+ ...(deepSeekActionOnlyRequest(config, messages)
2679
+ ? { thinking: { type: "disabled" } }
2680
+ : {}),
2656
2681
  ...(Number(config.maxOutputTokens || 0) > 0 ? { max_tokens: Number(config.maxOutputTokens) } : {}),
2657
2682
  };
2658
2683
  const textPayload = {
@@ -75,7 +75,7 @@ export const PROVIDER_CONTRACTS = Object.freeze({
75
75
  defaultModel: "deepseek-v4-flash",
76
76
  toolProtocol: "native",
77
77
  structuredOutput: "json_object",
78
- supportsReasoningEffort: false,
78
+ supportsReasoningEffort: true,
79
79
  textToolFallback: false,
80
80
  }),
81
81
  openai: Object.freeze({