SIGN IN SIGN UP

feat(chat): expose endAndContinue to custom agents (#4647)

## Summary

Raw `chat.customAgent()` loops can now call `chat.endAndContinue()` to
move the Session to a fresh run. The managed loop already used the same
server operation through `chat.requestUpgrade()`, but raw loops could
not call it directly.

Call the method between turns after detaching input listeners from the
old run. Await it and return immediately. Unconsumed `.in` records stay
on the Session for the continuation run.

I put this on the `chat` namespace next to the other raw chat
primitives. Happy to move it if maintainers prefer a different API
placement.

## Testing

- `pnpm exec vitest run` in `packages/trigger-sdk` (374 tests)
- Focused webapp Session E2E tests (3 tests)
- `pnpm run build` in `packages/trigger-sdk`
- Webapp typecheck
- `pnpm run format`
- `pnpm run lint`

## Checklist

- [x] I followed the contributing guide
- [x] The PR title follows the convention
- [x] I tested the change

## Changelog

Allow custom chat agents to rotate to a new task version without
dropping unconsumed Session input.

---------

Co-authored-by: Eric Allam <eallam@icloud.com>
G
Graham Tremper committed
4e006519de2d7d57088f6b43ea37f5c877158043
Parent: d54bcaa
Committed by GitHub <noreply@github.com> on 8/27/2026, 1:58:56 PM