SIGN IN SIGN UP

fix(assistants): reject run-step identity hijacking before tool callbacks (#2476)

## Summary
- Validate canonical assistant run-step identities before emitting raw
events, mutating snapshots, or finalizing tool calls.
- Reject duplicate run-step creation and foreign lifecycle events while
preserving standalone terminal events, reserved identifiers, sequential
steps, listener mutations, and descriptor-safe proxy handling.
- Add 27 regression cases through the public
`AssistantStream.fromReadableStream()` NDJSON transport and the existing
streaming helper.

## Validation
- Red-first: 19 run-step identity/security assertions failed on current
`main`; all 27 new assertions now pass.
- Focused AssistantStream suites: 176 tests passed.
- Full handwritten suites: 6,303 tests across 149 files passed.
- Generated API suites against an isolated private mock: 556 tests
across 82 suites passed.
- Repository lint, strict TypeScript, production build, published
TypeScript 4.9 and current TypeScript checks, `publint`, and
packed-package verification passed.
- The packed CommonJS and ESM public `AssistantStream` exports both
reject the original duplicate-ID attack before exposing its
attacker-controlled callback or snapshot.
H
Hayden committed
63b1c7595336519429940a90f5e5e2dfa63b5559
Parent: 05cf7ab
Committed by GitHub <noreply@github.com> on 8/26/2026, 8:29:04 PM