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

@twomilia/vue

v0.1.0

Published

Thin Vue 3 wrapper for the Twomilia web agent — useTwomilia() composable and a Vue plugin.

Readme

@twomilia/vue

Thin Vue 3 wrapper for the Twomilia web agent.

The agent ships from the CDN (like Stripe.js) and mounts its own shadow-DOM chat overlay — this package renders no UI of its own. It just loads twomilia.js and initializes the agent with your config at the right, client-only moment in the Vue lifecycle.

  • useTwomilia(config) — a composable that loads the agent in onMounted.
  • TwomiliaPlugin — a Vue plugin so app.use(TwomiliaPlugin, config) works.

Both are SSR-safe. loadTwomilia is already a no-op on the server, and this wrapper only ever calls it from client-only paths.

Install

npm install @twomilia/vue @twomilia/web vue

@twomilia/web is the shared loader core; vue is a peer dependency.

Usage — composable

Call useTwomilia once, anywhere in your app (typically the root component). Only analyticsKey is required — the proxy/server default to Twomilia Cloud.

<!-- App.vue -->
<script setup lang="ts">
import { useTwomilia, type TwomiliaConfig } from '@twomilia/vue'
import { cart } from './store'

const config: TwomiliaConfig = {
  // Required: your publishable key from Dashboard → Setup & API Keys.
  analyticsKey: 'twomilia_pub_xxx',

  // Ground answers in your dashboard knowledge base.
  knowledgeBase: true,

  // Named actions the agent can call in your app.
  customTools: {
    addToCart: {
      name: 'addToCart',
      description: 'Add a product to the shopping cart by its id.',
      parameters: {
        productId: { type: 'string', description: 'The product id to add.' },
        quantity: { type: 'number', description: 'How many.', required: false },
      },
      execute: async ({ productId, quantity }) => {
        cart.add(productId as string, (quantity as number) ?? 1)
        return { success: true, message: `Added ${productId} to cart` }
      },
    },
  },
}

useTwomilia(config)
</script>

<template>
  <!-- Your app. The Twomilia chat widget overlays itself automatically. -->
  <RouterView />
</template>

Usage — plugin

Prefer installing once at the app root? Use the plugin form:

// main.ts
import { createApp } from 'vue'
import { TwomiliaPlugin } from '@twomilia/vue'
import App from './App.vue'

createApp(App)
  .use(TwomiliaPlugin, {
    analyticsKey: 'twomilia_pub_xxx',
    knowledgeBase: true,
    customTools: {
      addToCart: {
        name: 'addToCart',
        description: 'Add a product to the shopping cart by its id.',
        parameters: { productId: 'string' },
        execute: async ({ productId }) => {
          // ...your app logic...
          return { success: true, message: `Added ${productId} to cart` }
        },
      },
    },
  })
  .mount('#app')

Mounting from several components, or calling .use() more than once, will not double-mount the overlay — the loader is idempotent.

Nuxt

twomilia.js is browser-only, so it must load on the client, never during SSR. Two idiomatic options:

1. From a component (recommended). onMounted only runs in the browser, so useTwomilia is already safe inside any <script setup>:

<!-- app.vue or any layout/page -->
<script setup lang="ts">
import { useTwomilia } from '@twomilia/vue'

useTwomilia({ analyticsKey: 'twomilia_pub_xxx', knowledgeBase: true })
</script>

2. As a client-only Nuxt plugin. Name the file with a .client.ts suffix so Nuxt only runs it in the browser:

// plugins/twomilia.client.ts
import { TwomiliaPlugin } from '@twomilia/vue'

export default defineNuxtPlugin((nuxtApp) => {
  nuxtApp.vueApp.use(TwomiliaPlugin, {
    analyticsKey: 'twomilia_pub_xxx',
    knowledgeBase: true,
  })
})

If you instead register it from a universal plugin (no .client suffix), guard the install with process.client:

// plugins/twomilia.ts
import { TwomiliaPlugin } from '@twomilia/vue'

export default defineNuxtPlugin((nuxtApp) => {
  if (process.client) {
    nuxtApp.vueApp.use(TwomiliaPlugin, { analyticsKey: 'twomilia_pub_xxx' })
  }
})

Config

useTwomilia / TwomiliaPlugin accept the full TwomiliaConfig from @twomilia/web. Common fields:

| Field | Type | Notes | | --- | --- | --- | | analyticsKey | string | Required. Publishable key (twomilia_pub_…). | | knowledgeBase | boolean | Ground answers in your dashboard knowledge. | | customTools | Record<string, TwomiliaTool> | Named actions the agent can call. | | userContext | { userId?, name?, email?, … } | Personalize support. | | interactionMode | 'copilot' \| 'autopilot' | How the agent acts. | | enableVoice / enableWebSearch | boolean | Optional capabilities. | | accentColor / headerTitle / inputPlaceholder / defaultOpen | — | Widget chrome. | | model / maxSteps / debug | — | Tuning. | | proxyUrl / serverUrl / useServerRuntime | — | Advanced / self-host (default: Twomilia Cloud). |

TwomiliaConfig and TwomiliaTool are re-exported for convenience:

import type { TwomiliaConfig, TwomiliaTool } from '@twomilia/vue'

License

MIT