Repository navigation
chore: version packages - #18
Merged
Merged
Conversation
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.
This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.
Releases
@loquix/[email protected]
Minor Changes
41e85fe: Add
@loquix/adapter-http, which turns an HTTP endpoint into anAgentProvider.AgentProviderhas existed since the first release with no implementation topoint at, so every integration started by writing streaming, cancellation and
error handling by hand. This package covers the shape almost everyone needs: a
POST to your own backend returning server-sent events, newline-delimited JSON, or
plain text.
It has no runtime dependencies and holds no credentials — the endpoint it calls
is yours, which is what keeps provider keys on the server where they belong.
@loquix/[email protected]
Minor Changes
a4b5156: Fix
AgentController'ssendTimeoutcutting off long-running responses, and addstreamIdleTimeout.Previously,
sendTimeout(default 60s) was composed into the same abortsignal that was handed to
provider.send()for the entire lifetime of thatsignal. A provider that forwards the signal to
fetch— which is the correctthing to do, and what
@loquix/adapter-httpdoes — had the timeout keeprunning after the response stream was returned, silently aborting the body.
Any response that streamed for longer than
sendTimeoutin total was cutoff mid-sentence, moved the controller to
error, and was never appended tomessages— even though the provider had already started respondingnormally.
sendTimeoutnow bounds only the wait forprovider.send()to resolve witha stream, matching its documented intent. Once that promise settles, the
timeout is cleared and has no further effect — a stream can now run as long
as it needs to. A negative
sendTimeout(e.g.-1) no longer throws aRangeError; it istreated as disabled, the same as
0, andNaNfalls back to the defaultrather than silently removing the guard — the same rule
UploadControlleralready applies to its own numeric options. (
±Infinityis handleddifferently — see below.)
To fill the gap this leaves — a server that returns headers and then goes
quiet forever — there's a new
streamIdleTimeoutoption (default 60_000,0disables). It aborts the stream only when no chunk has arrived for thatlong, resetting on every chunk, so a long-but-healthy response is never
punished — only actual silence is. A paused stream is exempt: pausing
suspends idle detection for as long as it's paused.
Because
@loquix/reactis linked with@loquix/corein this repo'schangesets config, it receives the same version bump even though none of its
own code changed.
StreamingController.connect()takes an optional second argument carryingthat timeout.
connect()itself defaults it to0(disabled), so a bareconnect(stream)— every call that existed before this option was added —arms no idle timer and is genuinely unaffected.
AgentControlleris the onecaller that opts into the 60s default described above; it resolves that
default itself before calling
connect(), so its own behavior (unlike adirect
connect()call) does change from 0.5.0 in exactly the way the restof this note describes.
If you previously set
sendTimeout: 0to disable timeouts entirely, youmust now also set
streamIdleTimeout: 0.streamIdleTimeoutis a newoption and defaults to on (60_000), so that exact 0.5.0 opt-out
configuration no longer means "no timeouts" — it now arms a 60-second idle
timer against the response stream it never used to touch. If your backend
has a normal gap of more than 60s between chunks (a long-running tool call, a
cold start, a slow retrieval hop), you will start seeing a new failure there:
onErrorfires with aDOMExceptionnamedTimeoutError(
"StreamingController: no chunk received within streamIdleTimeout"), thecontroller moves to
error, and whatever the stream had already produced isdiscarded rather than appended to
messages. SetstreamIdleTimeout: 0alongside
sendTimeout: 0to restore the old "never times out" behavior.Separately,
sendTimeout/streamIdleTimeoutnow treat±Infinityas anexplicit "no timeout" (equivalent to
0) rather than falling back to thedefault — see
sanitizeTimeoutMs's own doc comment for the reasoning. OnlyNaN(and other non-finite-but-not-infinite garbage) still falls back to thedefault.
sanitizeTimeoutMsalso now clamps a finite value above2_147_483_647(the32-bit signed integer
setTimeoutactually accepts) down to that max, insteadof passing it straight through. Measured:
setTimeout(fn, 2_147_483_648)fires after 1ms, not after the enormous delay the caller asked for — the
value silently overflows the 32-bit argument, so a very long
sendTimeoutorstreamIdleTimeoutused to fail almost instantly instead of effectively never.±Infinityremains the explicit way to disable a timeout entirely.@loquix/[email protected]
Patch Changes