Commit Graph

16 Commits

Author SHA1 Message Date
alex a565502989 Insert row 2026-05-29 09:24:16 -04:00
Devin AI d1c5be112e migrate agent-proxy to Netlify Edge Function so long sessions stream end-to-end
The reconnect + events.list backfill in c283d88 is correct but never ran:
the previous v2 Node Function was killed at ~27 s (well before the 20 min
reconnect budget could matter), so streams always died after the first MCP
tool batch.

Move the proxy to a Netlify Edge Function (Deno runtime) which has no
streaming-duration cap as long as we keep writing to the response body.
Same reconnect / backfill / dedupe-by-event-id pattern; same NDJSON wire
protocol to the browser. Implemented with plain fetch() against the
Anthropic REST API (npm packages on Edge are beta) so we have no SDK
runtime dependency.

Frontend now POSTs to /api/agent-proxy. The Anthropic SDK is removed
from the package; @netlify/edge-functions is added for ambient types.

Co-Authored-By: alex <alex@semipublic.co>
2026-05-13 12:40:31 +00:00
Devin AI c283d884cf fix(agent-proxy): reconnect with events.list backfill so long sessions don't cut off
The Anthropic Managed-Agents SSE stream (`/v1/sessions/{id}/events/stream`)
is not guaranteed to stay open for the life of a multi-turn session.
Inter-turn gaps (e.g. while MCP tools or the next model request run) of
~25s+ are common and can trigger upstream / proxy read timeouts; when
that happens, the SDK's `for await` iterator just ends and the proxy
silently closed the downstream response, leaving the browser with only
the events from the first tool batch.

Implement the official 'consolidation' pattern: treat any upstream
end-of-stream that isn't a terminal `session.status_*` as a transient
drop, fetch what we missed via `sessions.events.list()` (deduped by
event.id), reopen the live stream, and keep going — up to a 20 minute
wall-clock budget so a wedged session can't pin the function forever.

Also switch the wire format from inline-markdown-with-status-comments to
NDJSON, so the React side can render in-flight tool activity in a
separate status banner from the streaming brief. The existing zero-width
heartbeat is replaced by an explicit `{"type":"heartbeat"}` line.

Drop the `agent.tool_use` write-tool special case — the agent now
streams the brief directly via `agent.message` text blocks.

Co-Authored-By: alex <alex@semipublic.co>
2026-05-13 03:20:15 +00:00
alex d256ffb487 heartbeat added 2026-05-12 22:39:36 -04:00
alex 1a93c9246f Streaming updates 2026-05-12 22:29:25 -04:00
alex d1fd7fbe61 Env vars updated 2026-05-12 22:17:22 -04:00
alex 822944958f Managed agents endpoints addition 2026-05-12 22:10:33 -04:00
alex 09b1021d63 token change 2 2026-05-12 21:56:51 -04:00
alex 82c0fb096e token change 2026-05-12 21:54:15 -04:00
alex 450b6eff61 BG change 2026-05-12 21:49:31 -04:00
alex 8dbc8e78d8 Agent fix 2026-05-12 21:36:24 -04:00
alex 70cd0d6015 CSV fix again 2026-05-11 23:34:57 -04:00
alex a9873b5634 CSV handling 2026-05-11 23:21:45 -04:00
alex 5de3955a3f Revert "Invoke file ID"
This reverts commit c8ca68f13b.
2026-05-11 23:14:06 -04:00
alex c8ca68f13b Invoke file ID 2026-05-11 23:07:30 -04:00
alex ea05c521c3 Initial 2026-05-11 22:27:54 -04:00