feat(workflow-kit): typed WorldRunHandle<TResult> + runAndWait (sync result retrieval) - #113
Merged
Merged
Conversation
…nc result retrieval The world engine is durable: kit.run() returns a handle, not the output. This surfaces the SDK Run's result API so migrations of synchronously-consumed workflows stay type-safe: - WorldRunHandle<TResult> now exposes returnValue/status/exists/cancel (typed), not just runId (was an untyped pass-through). - WorkflowKit.run<TResult>() is generic so returnValue is typed from the workflow fn. - new WorkflowKit.runAndWait(): runs and resolves with the output (both engines), throws on failure (legacy: non-success status; world: WorkflowRunFailedError / WorkflowRunCancelledError — confirmed by reading @workflow/core run.js). - docs (EN+FR) + API ref updated; version bumps: core 1.5.0, workflow-world 0.1.1, mcp-docs 1.0.8. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.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.
Résumé
Le moteur world est durable et découplé :
kit.run()renvoie un handle, pas la sortie. Cette PR expose l'API de résultat duRundu SDK pour que la migration de workflows consommés synchronement reste type-safe.Changements
WorldRunHandle<TResult>(générique) expose désormaisreturnValue/status/exists/cancel()typés — au lieu d'un simple{ runId }non typé (pass-through).WorkflowKit.run<TResult>()générique →returnValuetypé depuis la fonction du workflow.WorkflowKit.runAndWait()(nouveau) : exécute et résout avec la sortie (les deux moteurs), throw en cas d'échec :status !== "success"(avec l'erreur du run) ;WorkflowRunFailedError/WorkflowRunCancelledError).@workflow/core(run.js:pollReturnValuethrowWorkflowRunFailedError/WorkflowRunCancelledError).Migration (drop-in)
Tests
@ai_kit/coreWorkflowKit : 11 passed (dont 4 nouveauxrunAndWait: world succès, world échec→reject, legacy succès, legacy non-success→throw).@ai_kit/workflow-world: 15 passed (contrat miroir).Docs (EN + FR)
world-engine: section « Récupérer le résultat d'un run ».workflow-kit:rungénérique,runAndWait, tableWorldRunHandle<TResult>.@ai_kit/mcp-docs.Versions
@ai_kit/core1.4.0 → 1.5.0@ai_kit/workflow-world0.1.0 → 0.1.1@ai_kit/mcp-docs1.0.7 → 1.0.8🤖 Generated with Claude Code