feat: Stream Events v2, tool builders, run/runAndWait split (0.1.10)#10
Open
AjayaRamachandran wants to merge 3 commits into
Open
feat: Stream Events v2, tool builders, run/runAndWait split (0.1.10)#10AjayaRamachandran wants to merge 3 commits into
AjayaRamachandran wants to merge 3 commits into
Conversation
- Split client.run (fire-and-forget) from client.runAndWait (polling) (R18)
- Generic RunResult<T> for type-narrowed answers via Zod (R10, R13)
- Default headers / defaults options for FunctionTools at the client level (R9)
- ResourceTool, MCPTool.headers + auth, expanded Engine union (R7, R17, R4)
- ReasoningNode.subtasks (plural), ToolUse, RunInput.images/resources/skills/agentId (R1, R2, R3)
- Stream parser emits StartedEvent first, parses reasoning_node/tool_call/result/error frames (R8, R15, R5)
- New tools.{platform,function,mcp,resource} builders (R11)
- normalizeTools auto-promotes function-tool defaults into JSON Schema parameters (R12)
- client.observe(runId) for re-attaching to in-flight runs (R16)
27 tests pass. Requires API with Stream Events v2 support.
Co-authored-by: Cursor <cursoragent@cursor.com>
Restores options.awaitCompletion as a deprecated alias so existing
docs snippets (apps/web quickstart, playground, llms.txt, etc.) keep
working without changes:
- RunOptions { awaitCompletion?: boolean } and RunParams.options come
back, both marked @deprecated
- client.run({ ..., options: { awaitCompletion: true } }) routes
through runAndWait() and emits a one-shot console.warn
- Refactored to a private createRunOnly() helper to break recursion
(run -> runAndWait -> run -> ... loop)
Wire format: stream parser now reads payload.runId ?? payload.run_id
so the canonical camelCase shape is preferred but legacy snake_case
keys still parse.
ErrorCode spelling: cancelled -> canceled (one l, matches RunStatus).
README ErrorCode block updated.
README: new "Back-compat and deprecations" section documenting the
options.awaitCompletion deprecation, runId canonical/legacy policy, and
canceled spelling.
Tests: 31 pass (was 27). New tests cover the deprecation routing, no-op
options object still fire-and-forgets, legacy run_id snake_case still
parses, and canceled error code on the wire.
Co-authored-by: Cursor <cursoragent@cursor.com>
Return the terminal run status and result metadata from stream generators so consumers do not see failed SSE streams as succeeded. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
27 tests pass. Requires API with Stream Events v2 support.