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

@dudko.dev/agent-web-vue

v0.0.5

Published

Vue 3 bindings for @dudko.dev/agent-web, the in-browser LLM agent: useAgent() - the agent as reactive Vue state (the transcript, tool calls, consent requests, questions, status) plus run / stop / approve / deny and the rest, its lifecycle tied to the comp

Readme

@dudko.dev/agent-web-vue

npm downloads license last commit release

agent.dudko.dev · docs · live demo · source

Vue 3 bindings for @dudko.dev/agent-web, the in-browser LLM agent. One composable, useAgent(), gives you the agent as Vue state - the transcript, the status, tool calls waiting for consent, the model's questions - and the methods to drive it: run, stop, approve, deny, answerQuestion and the rest. The agent lives as long as your component (or effect scope) does.

It is headless and thin: no components, no styles, no logic of its own. Everything the agent does in a view is @dudko.dev/agent-web-ui's controller (createAgentController) - the same one React's useAgent wraps. This package only turns it into refs and ties it to Vue's lifecycle.

Need the whole chat, ready-made? Use <dd-agent-chat> from @dudko.dev/agent-web-element - the full chat (Markdown answers, tool calls, consent prompts, saved chats, files, MCP Apps, 33 languages) as a web component that works in a Vue template:

<script setup lang="ts">
import '@dudko.dev/agent-web-element'
import { config } from './agent' // { model, credentials, tools, … }
</script>

<template>
  <dd-agent-chat :config.prop="config" lang="de" />
</template>

(with isCustomElement: (tag) => tag === 'dd-agent-chat' in the Vue plugin's template.compilerOptions - see its README). Use this package when you draw the chat yourself.

The family

One planning loop: two agents, and the layers that put its chat on a page. Every package has its page at agent.dudko.dev/docs. The live demo and the app are built on them.

| Package | What it is | | --- | --- | | @dudko.dev/agent | The agent in Node: stdio and HTTP MCP servers, OAuth 2.1, a REPL CLI, persistence and resume | | @dudko.dev/agent-web | The same agent in a browser tab, with no backend: your own key or a local WebGPU model | | @dudko.dev/agent-web-ui | Its chat with no framework: the state, a controller, labels in 33 languages, Markdown | | @dudko.dev/agent-web-react | React: the useAgent hook and a ready chat panel | | @dudko.dev/agent-web-element | <dd-agent-chat>: the whole chat as a web component, for a page on any stack | | @dudko.dev/agent-web-vue (this package) | Vue 3: the useAgent() composable | | @dudko.dev/agent-web-angular | Angular: injectAgent(), the chat state as signals | | @dudko.dev/agent-web-svelte | Svelte 4 and 5: createAgent(), the chat state as a store |

Install

npm i @dudko.dev/agent-web-vue @dudko.dev/agent-web vue
# and the provider(s) your config uses, e.g.
npm i @ai-sdk/google

vue (3.4 or later) and @dudko.dev/agent-web (the core, one per page) are peer dependencies. @dudko.dev/agent-web-ui comes with this package.

A chat in one component

<script setup lang="ts">
import { ref } from 'vue'
import { MemoryCredentialStore, type BrowserAgentConfig } from '@dudko.dev/agent-web'
import { useAgent } from '@dudko.dev/agent-web-vue'

// A constant (or a shallowRef you replace): a NEW object builds a new agent.
const config: BrowserAgentConfig = {
  model: { providerType: 'google', model: 'gemini-2.5-flash', credentialRef: 'google' },
  credentials: new MemoryCredentialStore({ google: import.meta.env.VITE_GOOGLE_KEY }),
  toolApproval: { mode: 'ask-writes' }, // writes wait for approve / deny
  askUser: true, // the model may ask the person (pendingQuestions)
}

const {
  status, isReady, isRunning, messages, pendingApprovals, pendingQuestions,
  run, stop, approve, deny, answerQuestion,
} = useAgent(config)

const draft = ref('')
const send = () => {
  const text = draft.value.trim()
  if (!text) return
  draft.value = ''
  void run(text)
}
</script>

<template>
  <p>{{ status }}</p>

  <ul>
    <li v-for="m in messages" :key="m.id" :class="m.role">
      {{ m.content }}<span v-if="m.pending">…</span>
    </li>
  </ul>

  <div v-for="a in pendingApprovals" :key="a.id">
    Allow <code>{{ a.name }}</code>?
    <button @click="approve(a.id)">Allow</button>
    <button @click="approve(a.id, { remember: true })">Always</button>
    <button @click="deny(a.id)">Deny</button>
  </div>

  <div v-for="q in pendingQuestions" :key="q.id">
    <p>{{ q.question }}</p>
    <button v-for="o in q.options" :key="o.label" @click="answerQuestion(q.id, { choice: [o.label] })">
      {{ o.label }}
    </button>
    <button @click="answerQuestion(q.id, { declined: true })">Skip</button>
  </div>

  <form @submit.prevent="send">
    <input v-model="draft" aria-label="Message" />
    <button v-if="isRunning" type="button" @click="stop">Stop</button>
    <button v-else :disabled="!isReady">Send</button>
  </form>
</template>

Model text is text: render it with {{ }} (or the Markdown tree below), never v-html.

useAgent(config, options?)

Call it in a component's setup / <script setup>, or inside an effectScope() (a store, a composable of your own). Called anywhere else it throws: nothing would dispose the agent.

| Argument | Type | What it does | | --------- | --------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | config | MaybeRefOrGetter<BrowserAgentConfig> | The core's createAgent config: a value, a Ref or a getter. A new object builds a new agent (the transcript stays); the same object never does, however often a getter re-runs. Keep it stable - a constant, a shallowRef you replace, a computed. It is given to the core raw (toRaw): a ref({...}) works too. | | options | MaybeRefOrGetter<UseAgentOptions> | The controller's options: onEvent (every raw event), autoStart (default true; false waits for reload()), maxEvents, approvals, questions, followUp, watch, appToolGrants. A new value is handed over live, without a rebuild (a changed autoStart rebuilds). |

What it returns

State - all read-only, all reactive:

| Field | Type | What it is | | ------------------ | --------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | state | Readonly<ShallowRef<AgentControllerSnapshot>> | Everything: the AgentUiState (plan, steps and tool calls, messages, totalUsage, subagents, questions, writtenFiles, undelivered, queued, error, …) plus isRunning, isReady, pendingApprovals, pendingQuestions, approvalMode, sessionId. | | status | ComputedRef<'idle' \| 'initializing' \| 'ready' \| 'running' \| 'error'> | Where the agent is. | | isReady | ComputedRef<boolean> | Built, and nothing runs. | | isRunning | ComputedRef<boolean> | A run of this tab - or of this conversation in another tab - goes on. | | messages | ComputedRef<ChatMessage[]> | The transcript; an answer being written has pending: true and grows as it streams. | | pendingApprovals | ComputedRef<ApprovalView[]> | Tool calls waiting for consent (id, name, input, readOnly, …). | | pendingQuestions | ComputedRef<PendingQuestion[]> | The model's questions (ask_user, with askUser on): id, question, options, multiple, allowOther, expiresAt. | | approvalMode | ComputedRef<ToolApprovalMode> | The consent policy in effect. | | agent | Readonly<ShallowRef<Agent \| undefined>> | The built core agent, once ready. |

How it is reactive. The controller keeps one frozen snapshot and makes a new one on every change; useAgent puts it into a shallowRef from the controller's subscribe. Nothing is deep: the snapshot is not wrapped in proxies, and a change that changes nothing makes no update. The computed refs read the snapshot, so a template that shows isReady re-renders only when isReady changes.

Methods - plain functions, the same for the component's life (destructure them freely):

| Method | What it does | | ----------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | | run(goal, { label?, images?, files?, attachments? }) | Run a goal; resolves with the core's RunResult, or undefined when it could not start. | | stop() | Abort this tab's run. | | send(text) | Say something to the running agent (it reads it at the next boundary); false when nothing runs. | | approve(id, { remember? }) / deny(id, reason?) | Answer a consent request; remember allows the tool for the rest of the agent's life. | | answerQuestion(id, answer) | { choice: [label] }, { other: text } (with allowOther) or { declined: true }; false when no such question waits. | | setApprovalMode(mode) | Switch the consent policy live. | | reset() / reload() | Clear the conversation (and the agent's memory of it) / build the agent again (after a new key). | | loadChat({ sessionId, messages?, totalUsage? }) | Switch to another conversation. | | sendUndelivered() / discardUndelivered() | What a stopped run never showed the agent: send it now, or drop it. | | stopSubagent(id), forgetSkill(name), compact() | Stop one helper; delete one of the agent's lessons; summarise the stored transcript. | | sendRemote(text) / stopRemote() | Reach this conversation's run in another tab. | | approveAppToolCall(call, signal?), sampleForApp(…) | For a host of MCP Apps: an app's tool call through the agent's consent, an app's completion through the agent's model. |

Each is documented in full on the controller's types (AgentControllerActions, re-exported here).

Lifecycle

  • Created in onBeforeMount inside a component, at once inside an effectScope. Until then - in setup, during a server render - the state is createInitialAgentSnapshot(config) (status 'idle'), and the calls that change the view or the agent to come (loadChat, reset, reload, setApprovalMode, discardUndelivered) wait for it and reach it in order; run resolves undefined.
  • Disposed in onScopeDispose: the component unmounting, or scope.stop(). The run is aborted, its consent requests denied and questions declined, the other-tab channels closed; the state stays as it was and every method becomes a no-op.

Server rendering (Nuxt, Vite SSR)

The agent is never created on the server. In a component that is Vue's own contract: mount hooks do not run there, so the server renders the initial snapshot (status: 'idle') and the browser builds the agent after hydration. Outside a component (an effectScope, a Pinia setup store) useAgent creates nothing where there is no window. If your store runs on both sides and you would rather not call it on the server at all, guard it yourself: if (!import.meta.env.SSR) useAgent(config) (Nuxt: import.meta.client). Keys belong in the browser anyway: the core's vault (VaultCredentialStore) lives there.

One agent for a subtree: provideAgent / injectAgent

A chat split into components (the transcript, the composer, the prompts) shares one agent:

// Chat.vue (the root)
const agent = provideAgent(config, options) // = useAgent(...), provided to descendants

// Composer.vue (anywhere below)
const { run, isReady } = injectAgent() // throws when no ancestor provided one

AGENT_KEY is the injection key, for your own provide / inject.

The chat in 33 languages

The chat's words in 33 languages are data in @dudko.dev/agent-web-ui/locales - each language a chunk of its own, loaded on demand:

import { shallowRef } from 'vue'
import { defaultLabels, mergeLabels } from '@dudko.dev/agent-web-ui'
import { loadAgentLabels } from '@dudko.dev/agent-web-ui/locales'

const labels = shallowRef(defaultLabels)
loadAgentLabels(navigator.language).then((l) => (labels.value = mergeLabels(defaultLabels, l)))
// {{ labels.stop }}, {{ labels.approve }}, …

Markdown answers

Answers are Markdown. @dudko.dev/agent-web-ui/markdown parses them into a safe tree (no HTML from the model, only http(s) / mailto links), with a streaming parser for an answer still being written. Draw the tree with h():

import { h, type VNode } from 'vue'
import { parseMarkdownCached, type MarkdownBlock, type MarkdownInline } from '@dudko.dev/agent-web-ui/markdown'

const inline = (runs: MarkdownInline[]): (VNode | string)[] =>
  runs.map((r) => {
    switch (r.t) {
      case 'text': return r.v
      case 'br': return h('br')
      case 'code': return h('code', r.v)
      case 'link': return h('a', { href: r.href, target: '_blank', rel: 'noreferrer noopener' }, inline(r.c))
      case 'file': return h('span', inline(r.c))
      default: return h({ strong: 'strong', em: 'em', del: 'del' }[r.t], inline(r.c))
    }
  })
const block = (b: MarkdownBlock): VNode => {
  switch (b.t) {
    case 'p': return h('p', inline(b.c))
    case 'h': return h(`h${b.level}`, inline(b.c))
    case 'code': return h('pre', h('code', b.v))
    case 'quote': return h('blockquote', b.c.map(block))
    case 'hr': return h('hr')
    case 'list': return h(b.ordered ? 'ol' : 'ul', b.items.map((i) => h('li', [...inline(i.c), i.sub && block(i.sub)])))
    case 'table': return h('table', [
      h('thead', h('tr', b.head.map((c) => h('th', inline(c))))),
      h('tbody', b.rows.map((row) => h('tr', row.map((c) => h('td', inline(c)))))),
    ])
  }
}
export const Markdown = (props: { text: string }) => h('div', parseMarkdownCached(props.text).map(block))

For a message still streaming (m.pending), parseMarkdownStreaming keeps what was drawn stable as the rest arrives.

What this package does not do

  • No components and no CSS (use <dd-agent-chat>, or the ui package's styles.css with your own markup). Motion is the stylesheet's: soft by default; motion="reduced" | "none" on <dd-agent-chat>, or data-awr-motion on your own .awr-chat root with the ui package's styles.css (its README, "Motion"). Skins too: skin="glass" (or one of your own) on <dd-agent-chat>, switched at run time by setting the attribute or the skin property, or data-awr-skin on your own root (its README, "Skins").
  • No agent logic: building the agent, folding its events, consent, questions, other tabs - all of it is the ui package's controller. A change there reaches React, the web component and Vue alike.

License

MIT - see LICENSE. Part of the dudko-dev/agents monorepo.