Skip to content

feat(fresh/ai): expose awaited durable chat response completion #1458

Description

@rickylabs

Reproduction

toNetScriptChatResponse() delegates to toDurableChatSessionResponse() through a private default adapter, but NetScriptChatResponseOptions exposes neither mode nor waitUntil. The upstream transport defaults to mode: immediate.

Consumers that require mode: await cannot adopt the helper without injecting a custom toResponse adapter and retaining a direct transport dependency.

For a long-lived Deno/Fresh server this is observable: immediate mode returns 202 before the assistant stream is durably written, moves write errors to background logging, and closes the enclosing request/telemetry span before settle metrics are available. Await mode returns only after the write and propagates failures.

Expected

Expose an owned completion option, e.g. mode?: immediate | await and optionally waitUntil, forwarding it to the transport. Add tests for response status and failure propagation in both modes.

Consumer evidence

rickylabs/eis-chat PR #169 uses NetScript addressing/auth/message conversion but retains a narrow mode: await adapter. Remove it when the published option exists.

Related to #238 and production lifecycle hardening #950.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions