You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(serve): port OpenAI server loopback default, streaming, and sequence fixes to TS
Mirrors the Python-side security/correctness fixes (beb08b3) in the TypeScript OpenAI server adapter and addresses remaining code-review comments.
Security (#1516):
- Default OpenAIServerConfig.host to 127.0.0.1 (loopback); binding all
interfaces (0.0.0.0) is now opt-in.
- Warn when serving on a non-loopback host with no apiKey set.
- Drop the hard-coded host: '0.0.0.0' from examples/serve/openai_responses.ts.
Correctness (streaming):
- ChatCompletionAPI and ResponsesAPI now emit text deltas from the events
the agent actually produces. Previously both handlers filtered for
event.name === 'update', but ToolCallingAgent only emits start/success,
so stream: true against the documented example yielded an SSE envelope
with zero text deltas. Now 'success' (state.result.text) is also emitted,
keeping streaming working for both ReActAgent and ToolCallingAgent.
Sequence number:
- sendEvent() now increments sequence_number before assigning it to the
event payload, instead of pre-building events with a stale/duplicated
sequence_number, violating the monotonic-sequence contract.
- Removed redundant sequence_number fields from event objects; the type is
now optional and populated centrally by sendEvent.
Docs:
- Replace the 'coming soon' TypeScript placeholder in
integrations/openai-api.mdx with the real openai_responses.ts example.
Tests:
- Add unit tests mirroring Python's test_openai_server_config.py: default
host is loopback; warning fires for non-loopback without apiKey; no
warning on loopback or when apiKey is set. Expose the module-level logger
so tests can spy on warn().
Signed-off-by: Veselin-Vasilev-IBM-1 <veselin.vasilev1@ibm.com>
0 commit comments