npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

flue-svelte

v0.1.2

Published

Community-maintained, unofficial Svelte 5 adapter for Flue conversations

Readme

flue-svelte

Community-maintained, unofficial Svelte adapter for Flue; not published or supported by the Flue upstream maintainers.

Svelte 5 reactive state for live Flue agent conversations. flue-svelte manages UI state; @flue/sdk handles HTTP and Durable Streams transport.

pnpm add flue-svelte @flue/[email protected]

Requires Svelte ^5.3.0 and exactly @flue/[email protected].

useFlueAgent()

A hook observes one agent conversation, addressed by URL: wherever the application's app.ts mounts the agent's routes (app.route('/agents/triage', createAgentRouter(Triage))) plus a caller-chosen conversation id. Starting a new conversation is initializing the hook with a fresh id appended to the mount URL.

<script lang="ts">
  import { useFlueAgent } from 'flue-svelte';

  let { conversationId }: { conversationId: string } = $props();
  const agent = useFlueAgent(() => ({ url: `/api/agents/triage/${conversationId}` }));
  // agent.messages, agent.status, agent.sendMessage(...)
</script>
function useFlueAgent(getOptions?: () => UseFlueAgentOptions): UseFlueAgentResult;

interface UseFlueAgentOptions {
  readonly url?: string;
  readonly client?: FlueClient;
  readonly live?: 'sse' | 'long-poll';
}

| Option | Description | | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | url | Conversation URL (agent mount URL + conversation id). Relative URLs resolve against the browser origin. Omit (together with client) to keep the hook dormant. | | client | Pre-configured createFlueClient({ url, headers, token, fetch }) for custom auth or transport. Takes precedence over url. Keep its identity stable with $derived — a new instance replaces the session. | | live | Live stream mode. Defaults to 'sse'; use 'long-poll' to disable SSE. |

interface UseFlueAgentResult {
  readonly messages: readonly FlueConversationMessage[];
  readonly status: AgentStatus;
  readonly historyReady: boolean;
  readonly error: Error | undefined;
  readonly failedSends: readonly FailedSend[];
  readonly settlements: readonly FlueConversationSettlement[];
  sendMessage(message: string, options?: SendMessageOptions): Promise<void>;
  refresh(): void;
}

interface SendMessageOptions {
  images?: DeliveredAttachment[];
}

type AgentStatus = 'idle' | 'connecting' | 'submitted' | 'streaming' | 'error';

| Status | Meaning | | ------------ | ------------------------------------------------------------------------ | | idle | No local prompt is active, or the hook is dormant. | | connecting | Initial connection or retry. error holds the latest retryable failure. | | submitted | A prompt is being admitted or awaits attributable assistant activity. | | streaming | Assistant activity for this client's submission is arriving. | | error | Prompt admission, a submission, or stream observation failed. |

settlements mirrors the observed conversation's terminal submission outcomes (FlueConversationSettlement[]), so application code can correlate a submissionId with its completed/failed/aborted outcome; status and error semantics are unaffected by it.

sendMessage()

Adds an optimistic user message, delivers it through the conversation client, and resolves when the server admits the prompt (202 admission). It does not wait for generation. If admission fails, the optimistic message is retained and surfaced through failedSends (with status: 'error') so a UI can offer retry, and the promise rejects. The canonical user message later re-keys to the optimistic row's id, so the rendered row is stable across the optimistic→confirmed swap. Concurrent sends use the runtime's per-conversation queue. Calling it on a dormant hook rejects.

refresh()

Re-runs the conversation's history catch-up and resumes live updates. A conversation that does not exist yet reports as empty (historyReady with no messages); when its creation is triggered out-of-band (a webhook, queue worker, or server-side wakeup), call refresh() on whatever schedule the application chooses.

History and live updates

The hook loads the materialized conversation snapshot before publishing it, sets historyReady to true, and then follows live updates from the exact snapshot checkpoint. Consumers receive one coherent initial transcript. Transient stream failures retry with capped exponential backoff from a fresh snapshot; redelivered chunks are deduped, so at-least-once transports never double-apply streaming deltas.

The hook has no stop() method because ending browser observation does not cancel server work.

Messages

Messages are the SDK's materialized conversation shape (FlueConversationMessage with FlueConversationPart[]): text and reasoning parts carry a streaming | done state, dynamic-tool parts progress from input-available to output-available/output-error, and file parts carry a ready-to-use url (a hosted attachment URL once durably recorded; a local data: preview on an optimistic echo). Message metadata is agent-authored; timestamps, token usage, and model identity exist only when the application attaches them.

SSR and lifecycle

Call the hook during component initialization with a synchronous, side-effect-free options getter. Hooks return empty, idle server snapshots and connect only after mount in the browser. Read properties directly from the stable result object; destructuring or spreading creates a nonreactive snapshot.

Changing the url, client, or live option replaces the current session. Unmounting stops local observation but not server-side work.

Re-exported types

flue-svelte re-exports these SDK types: DeliveredAttachment, FlueClient, FlueConversationMessage, FlueConversationPart, FlueConversationSettlement, PromptUsage.