Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: CI

on:
push:
branches: [main]
pull_request:
branches: [main]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
ci:
name: Typecheck · Lint · Test · Build
runs-on: ubuntu-latest
timeout-minutes: 15

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Typecheck
run: pnpm typecheck

- name: Lint
run: pnpm lint || echo "No lint script found, skipping"

- name: Test
run: pnpm test || echo "No tests yet, skipping"

- name: Build
run: pnpm build
44 changes: 44 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Deploy

on:
push:
branches: [main]
paths:
- packages/backend/**
- pnpm-lock.yaml

jobs:
deploy:
name: Deploy backend to Cloudflare Workers
runs-on: ubuntu-latest
timeout-minutes: 15

permissions:
contents: read

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build backend
run: pnpm --filter backend build

- name: Deploy to Cloudflare Workers
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
workingDirectory: packages/backend
command: deploy
41 changes: 41 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Publish

on:
release:
types: [published]

jobs:
publish:
name: Publish widget to npm
runs-on: ubuntu-latest
timeout-minutes: 15

permissions:
contents: read
id-token: write # for npm provenance

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
registry-url: https://registry.npmjs.org
cache: pnpm

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build
run: pnpm build

- name: Publish widget
working-directory: packages/widget
run: pnpm publish --access public --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
node_modules/
dist/
.turbo/
.wrangler/
*.tsbuildinfo
.env
.env.local
.dev.vars
coverage/
7 changes: 7 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"semi": true,
"singleQuote": true,
"trailingComma": "all",
"printWidth": 100,
"tabWidth": 2
}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 VibeTechnologies

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
57 changes: 57 additions & 0 deletions examples/basic/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>WebAgent — Basic Example</title>
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
max-width: 800px;
margin: 0 auto;
padding: 40px 20px;
color: #1a1a1a;
}
h1 { color: #2563eb; }
.info { background: #f1f5f9; padding: 16px; border-radius: 8px; margin: 16px 0; }
code { background: #e2e8f0; padding: 2px 6px; border-radius: 4px; font-size: 14px; }
pre { background: #1e293b; color: #e2e8f0; padding: 16px; border-radius: 8px; overflow-x: auto; }
</style>
</head>
<body>
<h1>🤖 WebAgent — Basic Example</h1>
<p>This page demonstrates the minimal WebAgent widget integration.</p>

<div class="info">
<h3>Try it out</h3>
<p>Click the chat bubble in the bottom-right corner to start a conversation.</p>
<p>The agent can help with general questions and demonstrate tool usage.</p>
</div>

<h2>Integration Code</h2>
<pre><code>&lt;script src="https://cdn.example.com/webagent.min.js"&gt;&lt;/script&gt;
&lt;script&gt;
WebAgent.init({
apiBase: 'http://localhost:8787',
apiKey: 'your-api-key',
systemPrompt: 'You are a helpful assistant.',
welcomeMessage: 'Hi! How can I help you today?',
theme: 'light',
});
&lt;/script&gt;</code></pre>

<!-- WebAgent Widget -->
<script src="../../packages/widget/dist/webagent.min.js"></script>
<script>
WebAgent.init({
apiBase: 'http://localhost:8787',
apiKey: 'demo-key',
systemPrompt: 'You are a helpful and friendly assistant. Be concise and helpful.',
welcomeMessage: 'Hi! 👋 How can I help you today?',
theme: 'light',
position: 'bottom-right',
persistence: 'localStorage',
});
</script>
</body>
</html>
70 changes: 70 additions & 0 deletions examples/docs-site/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>WebAgent — Docs Site Example</title>
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
max-width: 800px;
margin: 0 auto;
padding: 40px 20px;
color: #1a1a1a;
line-height: 1.6;
}
h1 { color: #7c3aed; }
h2 { border-bottom: 2px solid #e2e8f0; padding-bottom: 8px; }
pre { background: #1e293b; color: #e2e8f0; padding: 16px; border-radius: 8px; overflow-x: auto; }
code { font-family: 'SF Mono', 'Fira Code', monospace; font-size: 14px; }
.info { background: #f5f3ff; padding: 16px; border-radius: 8px; margin: 16px 0; border: 1px solid #ddd6fe; }
</style>
</head>
<body>
<h1>📚 API Documentation</h1>
<p>Welcome to the ExampleAPI documentation. Our AI assistant can help you find the right endpoints and code examples.</p>

<div class="info">
<h3>Ask the AI assistant</h3>
<p>Try: "How do I authenticate?" or "Show me an example of creating a user"</p>
</div>

<h2>Authentication</h2>
<p>All API requests require a Bearer token in the Authorization header.</p>
<pre><code>curl -H "Authorization: Bearer YOUR_TOKEN" https://api.example.com/v1/users</code></pre>

<h2>Endpoints</h2>

<h3>GET /v1/users</h3>
<p>List all users. Supports pagination with <code>page</code> and <code>limit</code> query parameters.</p>

<h3>POST /v1/users</h3>
<p>Create a new user. Requires <code>name</code> and <code>email</code> in the request body.</p>
<pre><code>{
"name": "Jane Doe",
"email": "jane@example.com"
}</code></pre>

<h3>GET /v1/users/:id</h3>
<p>Get a single user by ID.</p>

<h3>DELETE /v1/users/:id</h3>
<p>Delete a user. Returns 204 No Content on success.</p>

<script src="../../packages/widget/dist/webagent.min.js"></script>
<script>
WebAgent.init({
apiBase: 'http://localhost:8787',
apiKey: 'demo-key',
systemPrompt: `You are a documentation assistant for ExampleAPI.
Help developers understand the API, find the right endpoints, and write code examples.
Use the knowledge base to answer questions accurately.
If you're unsure, suggest the user contact support.`,
welcomeMessage: 'Hi! 📚 I can help you navigate the API docs. What are you looking for?',
supportEmail: 'devrel@example.com',
theme: { primaryColor: '#7c3aed' },
knowledgeBaseUrl: 'http://localhost:8787/api/kb/example-api',
});
</script>
</body>
</html>
Loading
Loading