enh: add API for POST events and add to event stream - #812
Merged
Merged
Conversation
heerambavi1998
requested review from
bhaveshpatel640,
chiragjn,
debajyoti-truefoundry,
sr07asthana and
thesujai
as code owners
September 18, 2026 12:06
🦋 Changeset detectedLatest commit: ff0937d The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
heerambavi1998
added this pull request to stack #808
September 22, 2026 08:28
added 2 commits
September 23, 2026 10:09
heerambavi1998
force-pushed
the
ha/api
branch
from
September 23, 2026 04:41
4f61566 to
8d0e372
Compare
debajyoti-truefoundry
approved these changes
Sep 24, 2026
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 4 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit cadcd5e. Configure here.
added 2 commits
September 24, 2026 12:34
heerambavi1998
force-pushed
the
ha/api
branch
from
September 24, 2026 07:07
7895862 to
0a72eb0
Compare
added 2 commits
September 24, 2026 12:37
heerambavi1998
requested review from
govindavashishtha,
kumarsks619,
qaifi-tf,
sajal-truefoundry,
sayan-truefoundry and
vinit-truefoundry
as code owners
September 24, 2026 07:12
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.

Summary
add API for POST events and add to event stream
Changes
Also persist the post events to DB.
How was this tested?
unit tests
Checklist
pnpm build,pnpm test,pnpm typecheck,pnpm lint:ci, andpnpm format:checkpass locallypackages/trueforge-sdk,python/trueforge_sdk,.github/fern/openapi/openapi.json,docs/openapi.json) — fork PRs omit SDK regen; maintainers regenerate after merge.env.exampleupdated if configuration or behavior changedNote
Medium Risk
New authenticated turn-control surface for tool approval and policy events; handler does not yet persist or apply them, which can mislead integrators expecting HITL to resume execution.
Overview
Adds
POST /api/v1/sessions/{session_id}/turns/{turn_id}/eventsso the session creator can send mid-turn human-in-the-loop inputs: tool approvals, client tool responses, and session-scoped approval policies (user.tool_*types). Requests accept a batch of inbound events; the handler mintsidandcreated_atand returns 201 with the durable-shaped payloads (session-owner checks mirror other turn routes).The OpenAPI contract, Zod/core schemas, and regenerated TS/Python SDKs (
createTurnEvent/create_turn_event) are extended withCreateTurnEventRequest/Response,TurnInboundEventItem, tool-approval policy types, and persisted/stream variants of the user events onSessionEvent,TurnStreamingEvent, and related unions. trueforge-ui still drops these (andturn.update) until the runtime union catches up.Note: In this diff, DB insert / resume-the-turn wiring is stubbed (
insertTurnInboundEventsremains commented increateTurnEventHandler), so clients get stable IDs but events are not yet persisted or applied server-side.Reviewed by Cursor Bugbot for commit ff0937d. Bugbot is set up for automated code reviews on this repo. Configure here.