gsd-pi 2.76.0-dev.82e249f7b → 2.76.0-dev.97f5583d9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/claude-cli-check.js +32 -3
- package/dist/mcp-server.d.ts +7 -0
- package/dist/mcp-server.js +35 -1
- package/dist/resource-loader.d.ts +1 -1
- package/dist/resource-loader.js +2 -8
- package/dist/resources/extensions/claude-code-cli/readiness.js +4 -3
- package/dist/resources/extensions/claude-code-cli/stream-adapter.js +77 -17
- package/dist/resources/extensions/gsd/auto/phases.js +42 -1
- package/dist/resources/extensions/gsd/auto/run-unit.js +27 -0
- package/dist/resources/extensions/gsd/auto/session.js +12 -0
- package/dist/resources/extensions/gsd/auto-dispatch.js +16 -3
- package/dist/resources/extensions/gsd/auto-model-selection.js +1 -1
- package/dist/resources/extensions/gsd/auto-post-unit.js +25 -2
- package/dist/resources/extensions/gsd/auto-prompts.js +14 -0
- package/dist/resources/extensions/gsd/auto-recovery.js +13 -0
- package/dist/resources/extensions/gsd/auto-start.js +27 -18
- package/dist/resources/extensions/gsd/auto-worktree.js +51 -53
- package/dist/resources/extensions/gsd/auto.js +55 -27
- package/dist/resources/extensions/gsd/bootstrap/agent-end-recovery.js +17 -1
- package/dist/resources/extensions/gsd/bootstrap/db-tools.js +39 -9
- package/dist/resources/extensions/gsd/bootstrap/exec-tools.js +93 -0
- package/dist/resources/extensions/gsd/bootstrap/register-extension.js +2 -0
- package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +51 -5
- package/dist/resources/extensions/gsd/bootstrap/write-gate.js +34 -2
- package/dist/resources/extensions/gsd/clean-root-preflight.js +93 -0
- package/dist/resources/extensions/gsd/commands-prefs-wizard.js +968 -23
- package/dist/resources/extensions/gsd/compaction-snapshot.js +121 -0
- package/dist/resources/extensions/gsd/error-classifier.js +10 -3
- package/dist/resources/extensions/gsd/exec-history.js +120 -0
- package/dist/resources/extensions/gsd/exec-sandbox.js +258 -0
- package/dist/resources/extensions/gsd/gsd-db.js +115 -7
- package/dist/resources/extensions/gsd/guided-flow.js +189 -0
- package/dist/resources/extensions/gsd/health-widget.js +4 -1
- package/dist/resources/extensions/gsd/init-wizard.js +15 -1
- package/dist/resources/extensions/gsd/key-manager.js +6 -0
- package/dist/resources/extensions/gsd/model-router.js +36 -3
- package/dist/resources/extensions/gsd/pre-execution-checks.js +35 -9
- package/dist/resources/extensions/gsd/preferences-types.js +9 -0
- package/dist/resources/extensions/gsd/preferences-validation.js +83 -0
- package/dist/resources/extensions/gsd/preferences.js +17 -17
- package/dist/resources/extensions/gsd/prompts/discuss-headless.md +8 -0
- package/dist/resources/extensions/gsd/prompts/discuss.md +29 -2
- package/dist/resources/extensions/gsd/prompts/parallel-research-slices.md +5 -2
- package/dist/resources/extensions/gsd/safety/evidence-collector.js +96 -0
- package/dist/resources/extensions/gsd/safety/file-change-validator.js +13 -5
- package/dist/resources/extensions/gsd/safety/safety-harness.js +5 -1
- package/dist/resources/extensions/gsd/token-counter.js +22 -5
- package/dist/resources/extensions/gsd/tools/exec-search-tool.js +59 -0
- package/dist/resources/extensions/gsd/tools/exec-tool.js +126 -0
- package/dist/resources/extensions/gsd/tools/resume-tool.js +23 -0
- package/dist/resources/extensions/gsd/uok/plan-v2.js +20 -3
- package/dist/resources/extensions/gsd/workflow-mcp.js +3 -0
- package/dist/resources/skills/verify-before-complete/SKILL.md +2 -1
- package/dist/resources/skills/write-docs/SKILL.md +2 -1
- package/dist/tsconfig.extensions.tsbuildinfo +1 -1
- package/dist/web/standalone/.next/BUILD_ID +1 -1
- package/dist/web/standalone/.next/app-path-routes-manifest.json +10 -10
- package/dist/web/standalone/.next/build-manifest.json +2 -2
- package/dist/web/standalone/.next/prerender-manifest.json +3 -3
- package/dist/web/standalone/.next/required-server-files.json +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.html +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.html +1 -1
- package/dist/web/standalone/.next/server/app/index.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app-paths-manifest.json +10 -10
- package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
- package/dist/web/standalone/.next/server/middleware-manifest.json +5 -5
- package/dist/web/standalone/.next/server/pages/404.html +1 -1
- package/dist/web/standalone/.next/server/pages/500.html +1 -1
- package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
- package/dist/web/standalone/server.js +1 -1
- package/package.json +1 -1
- package/packages/mcp-server/dist/remote-questions.d.ts +45 -0
- package/packages/mcp-server/dist/remote-questions.d.ts.map +1 -0
- package/packages/mcp-server/dist/remote-questions.js +732 -0
- package/packages/mcp-server/dist/remote-questions.js.map +1 -0
- package/packages/mcp-server/dist/server.d.ts +7 -0
- package/packages/mcp-server/dist/server.d.ts.map +1 -1
- package/packages/mcp-server/dist/server.js +41 -4
- package/packages/mcp-server/dist/server.js.map +1 -1
- package/packages/mcp-server/dist/workflow-tools.d.ts.map +1 -1
- package/packages/mcp-server/dist/workflow-tools.js +64 -25
- package/packages/mcp-server/dist/workflow-tools.js.map +1 -1
- package/packages/mcp-server/package.json +2 -1
- package/packages/mcp-server/src/mcp-server.test.ts +30 -0
- package/packages/mcp-server/src/remote-questions.test.ts +294 -0
- package/packages/mcp-server/src/remote-questions.ts +916 -0
- package/packages/mcp-server/src/server.ts +62 -10
- package/packages/mcp-server/src/workflow-tools.test.ts +146 -1
- package/packages/mcp-server/src/workflow-tools.ts +84 -43
- package/packages/mcp-server/tsconfig.test.json +19 -0
- package/packages/mcp-server/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-ai/dist/providers/anthropic-auth.test.js +1 -1
- package/packages/pi-ai/dist/providers/anthropic-auth.test.js.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic-shared.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic-shared.js +27 -4
- package/packages/pi-ai/dist/providers/anthropic-shared.js.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic.js +8 -3
- package/packages/pi-ai/dist/providers/anthropic.js.map +1 -1
- package/packages/pi-ai/dist/providers/minimax-tool-name.test.d.ts +2 -0
- package/packages/pi-ai/dist/providers/minimax-tool-name.test.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/minimax-tool-name.test.js +80 -0
- package/packages/pi-ai/dist/providers/minimax-tool-name.test.js.map +1 -0
- package/packages/pi-ai/dist/providers/simple-options.d.ts +10 -0
- package/packages/pi-ai/dist/providers/simple-options.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/simple-options.js +16 -1
- package/packages/pi-ai/dist/providers/simple-options.js.map +1 -1
- package/packages/pi-ai/src/providers/anthropic-auth.test.ts +1 -1
- package/packages/pi-ai/src/providers/anthropic-shared.ts +26 -5
- package/packages/pi-ai/src/providers/anthropic.ts +9 -3
- package/packages/pi-ai/src/providers/minimax-tool-name.test.ts +98 -0
- package/packages/pi-ai/src/providers/simple-options.ts +17 -1
- package/packages/pi-ai/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-coding-agent/dist/core/model-registry-custom-caps.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/model-registry-custom-caps.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/model-registry-custom-caps.test.js +203 -0
- package/packages/pi-coding-agent/dist/core/model-registry-custom-caps.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/model-registry.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-registry.js +14 -0
- package/packages/pi-coding-agent/dist/core/model-registry.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/redact-secrets.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/redact-secrets.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/redact-secrets.js +49 -0
- package/packages/pi-coding-agent/dist/core/redact-secrets.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/redact-secrets.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/redact-secrets.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/redact-secrets.test.js +67 -0
- package/packages/pi-coding-agent/dist/core/redact-secrets.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/session-manager.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/session-manager.js +9 -5
- package/packages/pi-coding-agent/dist/core/session-manager.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/session-manager.test.js +25 -1
- package/packages/pi-coding-agent/dist/core/session-manager.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/chat-frame.d.ts +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/chat-frame.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/chat-frame.js +5 -4
- package/packages/pi-coding-agent/dist/modes/interactive/components/chat-frame.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/skill-invocation-message.d.ts +7 -6
- package/packages/pi-coding-agent/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/skill-invocation-message.js +29 -21
- package/packages/pi-coding-agent/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js +13 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/packages/pi-coding-agent/src/core/model-registry-custom-caps.test.ts +245 -0
- package/packages/pi-coding-agent/src/core/model-registry.ts +16 -0
- package/packages/pi-coding-agent/src/core/redact-secrets.test.ts +86 -0
- package/packages/pi-coding-agent/src/core/redact-secrets.ts +58 -0
- package/packages/pi-coding-agent/src/core/session-manager.test.ts +36 -1
- package/packages/pi-coding-agent/src/core/session-manager.ts +9 -5
- package/packages/pi-coding-agent/src/modes/interactive/components/chat-frame.ts +6 -6
- package/packages/pi-coding-agent/src/modes/interactive/components/skill-invocation-message.ts +36 -22
- package/packages/pi-coding-agent/src/modes/interactive/interactive-mode.ts +13 -1
- package/packages/pi-coding-agent/tsconfig.tsbuildinfo +1 -1
- package/src/resources/extensions/claude-code-cli/readiness.ts +4 -3
- package/src/resources/extensions/claude-code-cli/stream-adapter.ts +78 -17
- package/src/resources/extensions/claude-code-cli/tests/stream-adapter.test.ts +149 -5
- package/src/resources/extensions/gsd/auto/loop-deps.ts +13 -0
- package/src/resources/extensions/gsd/auto/phases.ts +66 -1
- package/src/resources/extensions/gsd/auto/run-unit.ts +29 -0
- package/src/resources/extensions/gsd/auto/session.ts +22 -0
- package/src/resources/extensions/gsd/auto-dispatch.ts +16 -3
- package/src/resources/extensions/gsd/auto-model-selection.ts +1 -1
- package/src/resources/extensions/gsd/auto-post-unit.ts +29 -3
- package/src/resources/extensions/gsd/auto-prompts.ts +28 -1
- package/src/resources/extensions/gsd/auto-recovery.ts +15 -0
- package/src/resources/extensions/gsd/auto-start.ts +29 -19
- package/src/resources/extensions/gsd/auto-worktree.ts +62 -63
- package/src/resources/extensions/gsd/auto.ts +58 -27
- package/src/resources/extensions/gsd/bootstrap/agent-end-recovery.ts +23 -1
- package/src/resources/extensions/gsd/bootstrap/db-tools.ts +40 -9
- package/src/resources/extensions/gsd/bootstrap/exec-tools.ts +109 -0
- package/src/resources/extensions/gsd/bootstrap/register-extension.ts +2 -0
- package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +53 -5
- package/src/resources/extensions/gsd/bootstrap/write-gate.ts +35 -2
- package/src/resources/extensions/gsd/clean-root-preflight.ts +111 -0
- package/src/resources/extensions/gsd/commands-prefs-wizard.ts +898 -32
- package/src/resources/extensions/gsd/compaction-snapshot.ts +165 -0
- package/src/resources/extensions/gsd/error-classifier.ts +10 -3
- package/src/resources/extensions/gsd/exec-history.ts +153 -0
- package/src/resources/extensions/gsd/exec-sandbox.ts +326 -0
- package/src/resources/extensions/gsd/gsd-db.ts +122 -7
- package/src/resources/extensions/gsd/guided-flow.ts +221 -0
- package/src/resources/extensions/gsd/health-widget.ts +3 -1
- package/src/resources/extensions/gsd/init-wizard.ts +15 -1
- package/src/resources/extensions/gsd/journal.ts +2 -1
- package/src/resources/extensions/gsd/key-manager.ts +6 -0
- package/src/resources/extensions/gsd/model-router.ts +42 -1
- package/src/resources/extensions/gsd/pre-execution-checks.ts +36 -10
- package/src/resources/extensions/gsd/preferences-types.ts +46 -0
- package/src/resources/extensions/gsd/preferences-validation.ts +79 -0
- package/src/resources/extensions/gsd/preferences.ts +17 -17
- package/src/resources/extensions/gsd/prompts/discuss-headless.md +8 -0
- package/src/resources/extensions/gsd/prompts/discuss.md +29 -2
- package/src/resources/extensions/gsd/prompts/parallel-research-slices.md +5 -2
- package/src/resources/extensions/gsd/safety/evidence-collector.ts +119 -0
- package/src/resources/extensions/gsd/safety/file-change-validator.ts +17 -4
- package/src/resources/extensions/gsd/safety/safety-harness.ts +9 -0
- package/src/resources/extensions/gsd/tests/auto-loop.test.ts +119 -1
- package/src/resources/extensions/gsd/tests/auto-paused-session-validation.test.ts +12 -0
- package/src/resources/extensions/gsd/tests/auto-recovery.test.ts +49 -0
- package/src/resources/extensions/gsd/tests/clean-root-preflight.test.ts +186 -0
- package/src/resources/extensions/gsd/tests/compaction-snapshot.test.ts +123 -0
- package/src/resources/extensions/gsd/tests/complete-slice.test.ts +2 -2
- package/src/resources/extensions/gsd/tests/complete-task.test.ts +2 -2
- package/src/resources/extensions/gsd/tests/custom-engine-loop-integration.test.ts +2 -0
- package/src/resources/extensions/gsd/tests/doctor-providers.test.ts +31 -0
- package/src/resources/extensions/gsd/tests/double-merge-guard.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/ensure-db-open.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/escalation.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/exec-history.test.ts +124 -0
- package/src/resources/extensions/gsd/tests/exec-sandbox.test.ts +210 -0
- package/src/resources/extensions/gsd/tests/file-change-validator.test.ts +58 -0
- package/src/resources/extensions/gsd/tests/gsd-db.test.ts +152 -1
- package/src/resources/extensions/gsd/tests/init-wizard.test.ts +27 -0
- package/src/resources/extensions/gsd/tests/isolation-none-branch-guard.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/issue-4540-regressions.test.ts +288 -0
- package/src/resources/extensions/gsd/tests/journal-integration.test.ts +2 -0
- package/src/resources/extensions/gsd/tests/key-manager.test.ts +7 -0
- package/src/resources/extensions/gsd/tests/md-importer.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/memory-store.test.ts +2 -2
- package/src/resources/extensions/gsd/tests/parallel-research-dispatch.test.ts +19 -0
- package/src/resources/extensions/gsd/tests/pre-exec-backtick-strip.test.ts +14 -0
- package/src/resources/extensions/gsd/tests/pre-exec-gate-loop.test.ts +272 -0
- package/src/resources/extensions/gsd/tests/pre-execution-checks.test.ts +234 -0
- package/src/resources/extensions/gsd/tests/preferences.test.ts +110 -0
- package/src/resources/extensions/gsd/tests/prefs-wizard-coverage.test.ts +44 -0
- package/src/resources/extensions/gsd/tests/provider-errors.test.ts +48 -0
- package/src/resources/extensions/gsd/tests/ready-phrase-no-files-4573.test.ts +388 -0
- package/src/resources/extensions/gsd/tests/restore-tools-after-discuss.test.ts +9 -3
- package/src/resources/extensions/gsd/tests/safety-harness-false-positives.test.ts +205 -0
- package/src/resources/extensions/gsd/tests/save-gate-result-render.test.ts +95 -0
- package/src/resources/extensions/gsd/tests/session-start-footer.test.ts +32 -40
- package/src/resources/extensions/gsd/tests/stash-queued-context-files.test.ts +56 -0
- package/src/resources/extensions/gsd/tests/token-counter.test.ts +105 -1
- package/src/resources/extensions/gsd/tests/tool-compatibility.test.ts +107 -0
- package/src/resources/extensions/gsd/tests/uok-plan-v2-wiring.test.ts +23 -0
- package/src/resources/extensions/gsd/tests/workflow-tool-executors.test.ts +65 -2
- package/src/resources/extensions/gsd/tests/write-gate.test.ts +64 -0
- package/src/resources/extensions/gsd/tests/zombie-gsd-state.test.ts +3 -1
- package/src/resources/extensions/gsd/token-counter.ts +22 -5
- package/src/resources/extensions/gsd/tools/exec-search-tool.ts +81 -0
- package/src/resources/extensions/gsd/tools/exec-tool.ts +183 -0
- package/src/resources/extensions/gsd/tools/resume-tool.ts +40 -0
- package/src/resources/extensions/gsd/uok/plan-v2.ts +26 -3
- package/src/resources/extensions/gsd/workflow-logger.ts +3 -1
- package/src/resources/extensions/gsd/workflow-mcp.ts +3 -0
- package/src/resources/skills/verify-before-complete/SKILL.md +2 -1
- package/src/resources/skills/write-docs/SKILL.md +2 -1
- /package/dist/web/standalone/.next/static/{ecSsu49rxxcpbNmVP4mLD → lLdDRDspgYzfz0bJAmUSz}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{ecSsu49rxxcpbNmVP4mLD → lLdDRDspgYzfz0bJAmUSz}/_ssgManifest.js +0 -0
|
@@ -339,10 +339,16 @@ export function convertMessages(
|
|
|
339
339
|
});
|
|
340
340
|
}
|
|
341
341
|
} else if (block.type === "toolCall") {
|
|
342
|
+
// Guard: never forward a tool_use block with an empty name.
|
|
343
|
+
// fine-grained-tool-streaming-2025-05-14 can cause the name to arrive
|
|
344
|
+
// as a delta on incompatible providers (e.g. MiniMax), leaving block.name
|
|
345
|
+
// as "". Re-sending that to MiniMax triggers error 2013 (#4538).
|
|
346
|
+
const toolName = isOAuthToken ? toClaudeCodeName(block.name) : block.name;
|
|
347
|
+
if (!toolName) continue;
|
|
342
348
|
blocks.push({
|
|
343
349
|
type: "tool_use",
|
|
344
350
|
id: block.id,
|
|
345
|
-
name:
|
|
351
|
+
name: toolName,
|
|
346
352
|
input: block.arguments ?? {},
|
|
347
353
|
});
|
|
348
354
|
} else if (block.type === "serverToolUse") {
|
|
@@ -505,7 +511,9 @@ export function buildParams(
|
|
|
505
511
|
if (supportsAdaptiveThinking(model.id)) {
|
|
506
512
|
params.thinking = { type: "adaptive" };
|
|
507
513
|
if (options.effort) {
|
|
508
|
-
|
|
514
|
+
// The SDK's OutputConfig.effort type doesn't include "xhigh" yet.
|
|
515
|
+
// Cast so our superset AnthropicEffort type compiles cleanly.
|
|
516
|
+
params.output_config = { effort: options.effort as "low" | "medium" | "high" | "max" };
|
|
509
517
|
}
|
|
510
518
|
} else {
|
|
511
519
|
params.thinking = {
|
|
@@ -641,12 +649,25 @@ export function processAnthropicStream(
|
|
|
641
649
|
output.content.push(block);
|
|
642
650
|
stream.push({ type: "thinking_start", contentIndex: output.content.length - 1, partial: output });
|
|
643
651
|
} else if (event.content_block.type === "tool_use") {
|
|
652
|
+
// Guard: some Anthropic-compatible providers (e.g. MiniMax with
|
|
653
|
+
// fine-grained-tool-streaming beta) stream the tool name as a delta,
|
|
654
|
+
// leaving content_block.name as "" here. Fall back to the tool list
|
|
655
|
+
// if available to avoid storing an empty name in history (#4538).
|
|
656
|
+
const rawName = event.content_block.name;
|
|
657
|
+
let resolvedName: string;
|
|
658
|
+
if (rawName) {
|
|
659
|
+
resolvedName = isOAuthToken ? fromClaudeCodeName(rawName, context.tools) : rawName;
|
|
660
|
+
} else {
|
|
661
|
+
const fallbackName = context.tools?.[0]?.name ?? rawName;
|
|
662
|
+
if (fallbackName && fallbackName !== rawName) {
|
|
663
|
+
console.warn(`[anthropic-shared] Empty tool name in content_block_start (id=${event.content_block.id}); falling back to first tool: ${fallbackName}`);
|
|
664
|
+
}
|
|
665
|
+
resolvedName = fallbackName;
|
|
666
|
+
}
|
|
644
667
|
const block: Block = {
|
|
645
668
|
type: "toolCall",
|
|
646
669
|
id: event.content_block.id,
|
|
647
|
-
name:
|
|
648
|
-
? fromClaudeCodeName(event.content_block.name, context.tools)
|
|
649
|
-
: event.content_block.name,
|
|
670
|
+
name: resolvedName,
|
|
650
671
|
arguments: (event.content_block.input as Record<string, any>) ?? {},
|
|
651
672
|
partialJson: "",
|
|
652
673
|
index: event.index,
|
|
@@ -110,8 +110,14 @@ async function createClient(
|
|
|
110
110
|
return { client, isOAuthToken: false };
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
-
// Skip beta headers for providers that don't support
|
|
114
|
-
|
|
113
|
+
// Skip beta headers for providers that don't support fine-grained-tool-streaming.
|
|
114
|
+
// MiniMax and minimax-cn implement the beta by emitting empty tool names in
|
|
115
|
+
// content_block_start (name arrives as a delta instead), which corrupts conversation
|
|
116
|
+
// history and triggers MiniMax error 2013 on the next request (#4538).
|
|
117
|
+
const skipBetaHeaders =
|
|
118
|
+
model.provider === "alibaba-coding-plan" ||
|
|
119
|
+
model.provider === "minimax" ||
|
|
120
|
+
model.provider === "minimax-cn";
|
|
115
121
|
const betaFeatures = skipBetaHeaders ? [] : ["fine-grained-tool-streaming-2025-05-14"];
|
|
116
122
|
if (needsInterleavedBeta && !skipBetaHeaders) {
|
|
117
123
|
betaFeatures.push("interleaved-thinking-2025-05-14");
|
|
@@ -123,7 +129,7 @@ async function createClient(
|
|
|
123
129
|
const client = new AnthropicClass({
|
|
124
130
|
apiKey: usesBearerAuth ? null : apiKey,
|
|
125
131
|
authToken: usesBearerAuth ? apiKey : undefined,
|
|
126
|
-
baseURL: model
|
|
132
|
+
baseURL: resolveAnthropicBaseUrl(model),
|
|
127
133
|
dangerouslyAllowBrowser: true,
|
|
128
134
|
defaultHeaders: mergeHeaders(
|
|
129
135
|
{
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Regression tests for MiniMax error 2013 "function name or parameters is empty" (#4538).
|
|
3
|
+
*
|
|
4
|
+
* Root cause: the `fine-grained-tool-streaming-2025-05-14` beta header is sent to
|
|
5
|
+
* MiniMax. MiniMax's Anthropic-compatible API implements this beta by streaming the
|
|
6
|
+
* tool name as a delta (empty string in `content_block_start`). The empty name gets
|
|
7
|
+
* stored in conversation history and sent back on the next request, causing MiniMax
|
|
8
|
+
* to return error 2013.
|
|
9
|
+
*
|
|
10
|
+
* Fix: exclude MiniMax (and minimax-cn) from the fine-grained-tool-streaming beta,
|
|
11
|
+
* same as alibaba-coding-plan. Also guard against storing empty tool names.
|
|
12
|
+
*/
|
|
13
|
+
import test, { describe } from "node:test";
|
|
14
|
+
import assert from "node:assert/strict";
|
|
15
|
+
import { readFileSync } from "node:fs";
|
|
16
|
+
import { dirname, join } from "node:path";
|
|
17
|
+
import { fileURLToPath } from "node:url";
|
|
18
|
+
import { convertMessages } from "./anthropic-shared.js";
|
|
19
|
+
import type { AssistantMessage } from "../types.js";
|
|
20
|
+
|
|
21
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
22
|
+
const source = readFileSync(join(__dirname, "anthropic.ts"), "utf-8");
|
|
23
|
+
|
|
24
|
+
describe("MiniMax fine-grained-tool-streaming exclusion (#4538)", () => {
|
|
25
|
+
test("minimax is excluded from fine-grained-tool-streaming-2025-05-14 beta", () => {
|
|
26
|
+
// The skipBetaHeaders flag must include minimax so it never receives the
|
|
27
|
+
// fine-grained-tool-streaming beta that causes empty tool names.
|
|
28
|
+
assert.match(
|
|
29
|
+
source,
|
|
30
|
+
/skipBetaHeaders.*minimax/s,
|
|
31
|
+
"minimax must be included in skipBetaHeaders to suppress fine-grained-tool-streaming",
|
|
32
|
+
);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
test("minimax-cn is excluded from fine-grained-tool-streaming-2025-05-14 beta", () => {
|
|
36
|
+
assert.match(
|
|
37
|
+
source,
|
|
38
|
+
/skipBetaHeaders.*minimax-cn/s,
|
|
39
|
+
"minimax-cn must be included in skipBetaHeaders to suppress fine-grained-tool-streaming",
|
|
40
|
+
);
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
describe("empty tool name guard in convertMessages (#4538)", () => {
|
|
45
|
+
// When fine-grained-tool-streaming causes a tool name to arrive as empty in
|
|
46
|
+
// content_block_start, we must not store '' in conversation history.
|
|
47
|
+
// convertMessages must skip tool_use blocks with empty/missing names.
|
|
48
|
+
const minimaxModel = {
|
|
49
|
+
id: "MiniMax-M2",
|
|
50
|
+
api: "anthropic-messages" as const,
|
|
51
|
+
provider: "minimax" as const,
|
|
52
|
+
baseUrl: "https://api.minimax.io/anthropic",
|
|
53
|
+
reasoning: true,
|
|
54
|
+
input: ["text"] as ["text"],
|
|
55
|
+
name: "MiniMax-M2",
|
|
56
|
+
cost: { input: 0.3, output: 1.2, cacheRead: 0, cacheWrite: 0 },
|
|
57
|
+
contextWindow: 196608,
|
|
58
|
+
maxTokens: 128000,
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
test("tool_use blocks with empty name are dropped from converted messages", () => {
|
|
62
|
+
const assistantMsg: AssistantMessage = {
|
|
63
|
+
role: "assistant",
|
|
64
|
+
content: [
|
|
65
|
+
{
|
|
66
|
+
type: "toolCall",
|
|
67
|
+
id: "toolu_01",
|
|
68
|
+
name: "", // empty — the bug: fine-grained streaming left name as ""
|
|
69
|
+
arguments: { path: "/foo" },
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
api: "anthropic-messages",
|
|
73
|
+
provider: "minimax",
|
|
74
|
+
model: "MiniMax-M2",
|
|
75
|
+
usage: { input: 1, output: 1, cacheRead: 0, cacheWrite: 0, totalTokens: 2, cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 } },
|
|
76
|
+
stopReason: "toolUse",
|
|
77
|
+
timestamp: Date.now(),
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
const messages = [assistantMsg];
|
|
81
|
+
const result = convertMessages(messages, minimaxModel, false, undefined);
|
|
82
|
+
|
|
83
|
+
// The assistant block with the empty-name toolCall must not appear in the output.
|
|
84
|
+
// If it does appear, its tool_use name must not be empty.
|
|
85
|
+
for (const param of result) {
|
|
86
|
+
if (param.role === "assistant" && Array.isArray(param.content)) {
|
|
87
|
+
for (const block of param.content) {
|
|
88
|
+
if ((block as any).type === "tool_use") {
|
|
89
|
+
assert.ok(
|
|
90
|
+
(block as any).name && (block as any).name.length > 0,
|
|
91
|
+
`tool_use block must never have an empty name; got: "${(block as any).name}"`,
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
});
|
|
@@ -1,9 +1,25 @@
|
|
|
1
1
|
import type { Api, Model, SimpleStreamOptions, StreamOptions, ThinkingBudgets, ThinkingLevel } from "../types.js";
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Compute the default maxTokens for a model when no explicit value is provided.
|
|
5
|
+
*
|
|
6
|
+
* The 32 k cap is retained only for native Anthropic models (api === "anthropic-messages")
|
|
7
|
+
* where the Anthropic API historically rejected higher values. Custom and
|
|
8
|
+
* Anthropic-compatible models (e.g. OpenAI-completions, Vertex, etc.) use their
|
|
9
|
+
* declared model.maxTokens directly so that providers with larger output windows
|
|
10
|
+
* (131 072 tokens, etc.) are not silently capped.
|
|
11
|
+
*/
|
|
12
|
+
export function defaultMaxTokens(model: Model<Api>): number {
|
|
13
|
+
if (model.api === "anthropic-messages") {
|
|
14
|
+
return Math.min(model.maxTokens, 32000);
|
|
15
|
+
}
|
|
16
|
+
return model.maxTokens;
|
|
17
|
+
}
|
|
18
|
+
|
|
3
19
|
export function buildBaseOptions(model: Model<Api>, options?: SimpleStreamOptions, apiKey?: string): StreamOptions {
|
|
4
20
|
return {
|
|
5
21
|
temperature: options?.temperature,
|
|
6
|
-
maxTokens: options?.maxTokens ||
|
|
22
|
+
maxTokens: options?.maxTokens || defaultMaxTokens(model),
|
|
7
23
|
signal: options?.signal,
|
|
8
24
|
apiKey: apiKey || options?.apiKey,
|
|
9
25
|
cacheRetention: options?.cacheRetention,
|