Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .changeset/strict-attempt-completion-schema.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
"@perstack/base": patch
"@perstack/runtime": patch
"@perstack/core": patch
"@perstack/react": patch
---

fix: add result param to attemptCompletion and remove GeneratingRunResult

- Add optional `result` string parameter to attemptCompletion tool schema so the LLM
can provide its final response text directly in the tool call
- Complete runs directly from CallingMcpTools when attemptCompletion succeeds, eliminating
the extra LLM round-trip in GeneratingRunResult
- Remove GeneratingRunResult state, its transitions, and the attemptCompletion event type
- Remove dead attemptCompletion event handling code from React event-to-activity utils
- Update E2E expert instructions to pass result via attemptCompletion args
6 changes: 4 additions & 2 deletions apps/base/src/tools/attempt-completion.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"
import { z } from "zod"
import { errorToolResult, successToolResult } from "../lib/tool-result.js"
import { getRemainingTodos } from "./todo.js"

Expand All @@ -19,8 +20,9 @@ export function registerAttemptCompletion(server: McpServer) {
"attemptCompletion",
{
title: "Attempt completion",
description: "Signal task completion. Validates all todos are complete before ending.",
inputSchema: {},
description:
"Signal task completion. Provide a result parameter with your final response text. Validates all todos are complete before ending.",
inputSchema: z.object({ result: z.string().optional() }).strict(),
},
async () => {
try {
Expand Down
2 changes: 1 addition & 1 deletion e2e/experts/bundled-base.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ envPath = [".env", ".env.local"]
version = "1.0.0"
description = "E2E test expert for bundled base with InMemoryTransport"
instruction = """
Call readTextFile on "perstack.toml" and then call attemptCompletion with result "OK"
Call readTextFile on "perstack.toml", then call attemptCompletion.
"""

[experts."e2e-bundled-base".skills."@perstack/base"]
Expand Down
4 changes: 2 additions & 2 deletions e2e/experts/cli-commands.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ envPath = [".env", ".env.local"]
version = "1.0.0"
description = "E2E test expert for CLI publish command validation"
instruction = """
Call attemptCompletion with result "OK"
Call attemptCompletion.
"""

[experts."e2e-publish-test".skills."@perstack/base"]
Expand All @@ -22,7 +22,7 @@ pick = ["attemptCompletion"]
version = "1.0.0"
description = "E2E test expert for CLI log command validation"
instruction = """
Call attemptCompletion with result "OK"
Call attemptCompletion.
"""

[experts."e2e-cli-simple".skills."@perstack/base"]
Expand Down
4 changes: 2 additions & 2 deletions e2e/experts/continue-resume.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ version = "1.0.0"
description = "E2E test expert for continue functionality"
instruction = """
1. Call askUser with question "confirm?"
2. After user responds, call attemptCompletion with result "OK"
2. After user responds, call attemptCompletion
"""

[experts."e2e-continue".skills."user-input"]
Expand All @@ -34,7 +34,7 @@ description = "E2E test expert for resume-from functionality"
instruction = """
1. Call think with thought "processing"
2. Call askUser with question "confirm?"
3. After user responds, call attemptCompletion with result "OK"
3. After user responds, call attemptCompletion
"""

[experts."e2e-resume".skills."user-input"]
Expand Down
6 changes: 3 additions & 3 deletions e2e/experts/delegate-chain.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ version = "1.0.0"
description = "E2E test expert for delegate chain"
instruction = """
1. Delegate to "e2e-delegate-level1" with "test"
2. When done, call attemptCompletion with result "OK"
2. When done, call attemptCompletion
"""
delegates = ["e2e-delegate-level1"]

Expand All @@ -25,7 +25,7 @@ version = "1.0.0"
description = "First level delegate expert"
instruction = """
1. Delegate to "e2e-delegate-level2" with "test"
2. When done, call attemptCompletion with result "OK"
2. When done, call attemptCompletion
"""
delegates = ["e2e-delegate-level2"]

Expand All @@ -39,7 +39,7 @@ pick = ["attemptCompletion"]
version = "1.0.0"
description = "Second level delegate expert"
instruction = """
Call attemptCompletion with result "OK"
Call attemptCompletion.
"""

[experts."e2e-delegate-level2".skills."@perstack/base"]
Expand Down
2 changes: 1 addition & 1 deletion e2e/experts/error-handling.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ version = "1.0.0"
description = "E2E test expert for tool error recovery"
instruction = """
1. Use readTextFile with the exact path given by user
2. Call attemptCompletion reporting: success/error + content or error message
2. Call attemptCompletion
"""

[experts."e2e-tool-error-recovery".skills."@perstack/base"]
Expand Down
4 changes: 2 additions & 2 deletions e2e/experts/errors.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ envPath = [".env", ".env.local"]
version = "1.0.0"
description = "E2E test expert with broken MCP skill"
instruction = """
Call attemptCompletion with result "OK"
Call attemptCompletion.
"""

[experts."e2e-mcp-error".skills."broken-skill"]
Expand All @@ -27,7 +27,7 @@ pick = ["attemptCompletion"]
version = "1.0.0"
description = "E2E test expert for invalid provider testing"
instruction = """
Call attemptCompletion with result "OK"
Call attemptCompletion.
"""

[experts."e2e-invalid-provider".skills."@perstack/base"]
Expand Down
2 changes: 1 addition & 1 deletion e2e/experts/global-runtime.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ envPath = [".env", ".env.local"]
version = "1.0.0"
description = "E2E test expert for global runtime configuration"
instruction = """
Call attemptCompletion with result "OK"
Call attemptCompletion.
"""

[experts."e2e-global-runtime".skills."@perstack/base"]
Expand Down
2 changes: 1 addition & 1 deletion e2e/experts/lockfile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ envPath = [".env", ".env.local"]
version = "1.0.0"
description = "E2E test expert for lockfile functionality"
instruction = """
Call readTextFile on "perstack.toml" and then call attemptCompletion with result "lockfile-test-ok"
Call readTextFile on "perstack.toml", then call attemptCompletion.
"""

[experts."e2e-lockfile".skills."@perstack/base"]
Expand Down
2 changes: 1 addition & 1 deletion e2e/experts/mixed-tools.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pick = ["attemptCompletion", "think"]
version = "1.0.0"
description = "E2E test helper expert"
instruction = """
Call attemptCompletion with result "OK"
Call attemptCompletion.
"""

[experts."e2e-helper".skills."@perstack/base"]
Expand Down
4 changes: 2 additions & 2 deletions e2e/experts/multi-modal.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ version = "1.0.0"
description = "E2E test expert for PDF file reading"
instruction = """
1. Use readPdfFile to read the PDF at the specified path
2. Call attemptCompletion with a brief summary of the content
2. Call attemptCompletion with a brief summary of the content as the result
"""

[experts."e2e-pdf-reader".skills."@perstack/base"]
Expand All @@ -24,7 +24,7 @@ version = "1.0.0"
description = "E2E test expert for image file reading"
instruction = """
1. Use readImageFile to read the image at the specified path
2. Call attemptCompletion with a brief description of the image
2. Call attemptCompletion with a brief description of the image as the result
"""

[experts."e2e-image-reader".skills."@perstack/base"]
Expand Down
6 changes: 3 additions & 3 deletions e2e/experts/parallel-delegate.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ version = "1.0.0"
description = "E2E test expert for parallel delegation"
instruction = """
1. In ONE response, delegate to BOTH "e2e-delegate-math" and "e2e-delegate-text" with "test"
2. When both return, call attemptCompletion with result "OK"
2. When both return, call attemptCompletion
"""
delegates = ["e2e-delegate-math", "e2e-delegate-text"]

Expand All @@ -24,7 +24,7 @@ pick = ["attemptCompletion", "think"]
version = "1.0.0"
description = "Math delegate expert"
instruction = """
Call attemptCompletion with result "Math result: 5"
Call attemptCompletion.
"""

[experts."e2e-delegate-math".skills."@perstack/base"]
Expand All @@ -37,7 +37,7 @@ pick = ["attemptCompletion"]
version = "1.0.0"
description = "Text processing delegate expert"
instruction = """
Call attemptCompletion with result "Text result: olleh"
Call attemptCompletion.
"""

[experts."e2e-delegate-text".skills."@perstack/base"]
Expand Down
24 changes: 12 additions & 12 deletions e2e/experts/reasoning-budget.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ version = "1.0.0"
description = "E2E test expert for Anthropic reasoning with minimal budget"
instruction = """
Solve this step by step: What is 23 * 47?
Show your reasoning, then call attemptCompletion with the answer.
Show your reasoning, then call attemptCompletion.
"""

[experts."e2e-reasoning-anthropic-minimal".skills."@perstack/base"]
Expand All @@ -26,7 +26,7 @@ version = "1.0.0"
description = "E2E test expert for Anthropic reasoning with low budget"
instruction = """
Solve this step by step: What is 23 * 47?
Show your reasoning, then call attemptCompletion with the answer.
Show your reasoning, then call attemptCompletion.
"""

[experts."e2e-reasoning-anthropic-low".skills."@perstack/base"]
Expand All @@ -40,7 +40,7 @@ version = "1.0.0"
description = "E2E test expert for Anthropic reasoning with medium budget"
instruction = """
Solve this step by step: What is 23 * 47?
Show your reasoning, then call attemptCompletion with the answer.
Show your reasoning, then call attemptCompletion.
"""

[experts."e2e-reasoning-anthropic-medium".skills."@perstack/base"]
Expand All @@ -54,7 +54,7 @@ version = "1.0.0"
description = "E2E test expert for Anthropic reasoning with high budget"
instruction = """
Solve this step by step: What is 23 * 47?
Show your reasoning, then call attemptCompletion with the answer.
Show your reasoning, then call attemptCompletion.
"""

[experts."e2e-reasoning-anthropic-high".skills."@perstack/base"]
Expand All @@ -72,7 +72,7 @@ version = "1.0.0"
description = "E2E test expert for OpenAI reasoning with minimal budget"
instruction = """
Solve this step by step: What is 23 * 47?
Show your reasoning, then call attemptCompletion with the answer.
Show your reasoning, then call attemptCompletion.
"""

[experts."e2e-reasoning-openai-minimal".skills."@perstack/base"]
Expand All @@ -86,7 +86,7 @@ version = "1.0.0"
description = "E2E test expert for OpenAI reasoning with low budget"
instruction = """
Solve this step by step: What is 23 * 47?
Show your reasoning, then call attemptCompletion with the answer.
Show your reasoning, then call attemptCompletion.
"""

[experts."e2e-reasoning-openai-low".skills."@perstack/base"]
Expand All @@ -100,7 +100,7 @@ version = "1.0.0"
description = "E2E test expert for OpenAI reasoning with medium budget"
instruction = """
Solve this step by step: What is 23 * 47?
Show your reasoning, then call attemptCompletion with the answer.
Show your reasoning, then call attemptCompletion.
"""

[experts."e2e-reasoning-openai-medium".skills."@perstack/base"]
Expand All @@ -114,7 +114,7 @@ version = "1.0.0"
description = "E2E test expert for OpenAI reasoning with high budget"
instruction = """
Solve this step by step: What is 23 * 47?
Show your reasoning, then call attemptCompletion with the answer.
Show your reasoning, then call attemptCompletion.
"""

[experts."e2e-reasoning-openai-high".skills."@perstack/base"]
Expand All @@ -132,7 +132,7 @@ version = "1.0.0"
description = "E2E test expert for Google reasoning with minimal budget"
instruction = """
Solve this step by step: What is 23 * 47?
Show your reasoning, then call attemptCompletion with the answer.
Show your reasoning, then call attemptCompletion.
"""

[experts."e2e-reasoning-google-minimal".skills."@perstack/base"]
Expand All @@ -146,7 +146,7 @@ version = "1.0.0"
description = "E2E test expert for Google reasoning with low budget"
instruction = """
Solve this step by step: What is 23 * 47?
Show your reasoning, then call attemptCompletion with the answer.
Show your reasoning, then call attemptCompletion.
"""

[experts."e2e-reasoning-google-low".skills."@perstack/base"]
Expand All @@ -160,7 +160,7 @@ version = "1.0.0"
description = "E2E test expert for Google reasoning with medium budget"
instruction = """
Solve this step by step: What is 23 * 47?
Show your reasoning, then call attemptCompletion with the answer.
Show your reasoning, then call attemptCompletion.
"""

[experts."e2e-reasoning-google-medium".skills."@perstack/base"]
Expand All @@ -174,7 +174,7 @@ version = "1.0.0"
description = "E2E test expert for Google reasoning with high budget"
instruction = """
Solve this step by step: What is 23 * 47?
Show your reasoning, then call attemptCompletion with the answer.
Show your reasoning, then call attemptCompletion.
"""

[experts."e2e-reasoning-google-high".skills."@perstack/base"]
Expand Down
4 changes: 2 additions & 2 deletions e2e/experts/runtime-version-future.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ envPath = [".env", ".env.local"]
[experts."e2e-runtime-future"]
version = "1.0.0"
minRuntimeVersion = "v99.0"
instruction = "Call attemptCompletion with result 'OK'"
instruction = "Call attemptCompletion."

[experts."e2e-runtime-future".skills."@perstack/base"]
type = "mcpStdioSkill"
Expand All @@ -23,7 +23,7 @@ version = "1.0.0"
minRuntimeVersion = "v1.0"
instruction = """
1. Delegate to "e2e-runtime-future" with "test"
2. When done, call attemptCompletion with result "OK"
2. When done, call attemptCompletion
"""
delegates = ["e2e-runtime-future"]

Expand Down
10 changes: 5 additions & 5 deletions e2e/experts/runtime-version.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ envPath = [".env", ".env.local"]
[experts."e2e-runtime-v1"]
version = "1.0.0"
minRuntimeVersion = "v1.0"
instruction = "Call attemptCompletion with result 'OK'"
instruction = "Call attemptCompletion."

[experts."e2e-runtime-v1".skills."@perstack/base"]
type = "mcpStdioSkill"
Expand All @@ -20,7 +20,7 @@ pick = ["attemptCompletion"]
# Expert without minRuntimeVersion (default)
[experts."e2e-runtime-default"]
version = "1.0.0"
instruction = "Call attemptCompletion with result 'OK'"
instruction = "Call attemptCompletion."

[experts."e2e-runtime-default".skills."@perstack/base"]
type = "mcpStdioSkill"
Expand All @@ -34,7 +34,7 @@ version = "1.0.0"
minRuntimeVersion = "v1.0"
instruction = """
1. Delegate to "e2e-runtime-chain-ok-l1" with "test"
2. When done, call attemptCompletion with result "OK"
2. When done, call attemptCompletion
"""
delegates = ["e2e-runtime-chain-ok-l1"]

Expand All @@ -49,7 +49,7 @@ version = "1.0.0"
minRuntimeVersion = "v1.0"
instruction = """
1. Delegate to "e2e-runtime-chain-ok-l2" with "test"
2. When done, call attemptCompletion with result "OK"
2. When done, call attemptCompletion
"""
delegates = ["e2e-runtime-chain-ok-l2"]

Expand All @@ -62,7 +62,7 @@ pick = ["attemptCompletion"]
[experts."e2e-runtime-chain-ok-l2"]
version = "1.0.0"
minRuntimeVersion = "v1.0"
instruction = "Call attemptCompletion with result 'OK'"
instruction = "Call attemptCompletion."

[experts."e2e-runtime-chain-ok-l2".skills."@perstack/base"]
type = "mcpStdioSkill"
Expand Down
Loading