Skip to content
Draft
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
59 changes: 0 additions & 59 deletions apps/testing/integration-suite/src/generated/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,65 +113,6 @@ if (!isDevelopment()) {
app.get('/_idle', idleHandler);
}

// Asset proxy routes - Development mode only (proxies to Vite asset server)
if (process.env.NODE_ENV !== 'production') {
const VITE_ASSET_PORT = parseInt(process.env.VITE_PORT || '5173', 10);

const proxyToVite = async (c: Context) => {
const viteUrl = `http://127.0.0.1:${VITE_ASSET_PORT}${c.req.path}`;
const controller = new AbortController();
const timeout = setTimeout(() => controller.abort(), 10000); // 10s timeout
try {
otel.logger.debug(`[Proxy] ${c.req.method} ${c.req.path} -> Vite:${VITE_ASSET_PORT}`);
const res = await fetch(viteUrl, { signal: controller.signal });
clearTimeout(timeout);
otel.logger.debug(`[Proxy] ${c.req.path} -> ${res.status} (${res.headers.get('content-type')})`);
return new Response(res.body, {
status: res.status,
headers: res.headers,
});
} catch (err) {
clearTimeout(timeout);
if (err instanceof Error && err.name === 'AbortError') {
otel.logger.error(`Vite proxy timeout: ${c.req.path}`);
return c.text('Vite asset server timeout', 504);
}
otel.logger.error(`Failed to proxy to Vite: ${c.req.path} - ${err instanceof Error ? err.message : String(err)}`);
return c.text('Vite asset server error', 500);
}
};

// Vite client scripts and HMR
app.get('/@vite/*', proxyToVite);
app.get('/@react-refresh', proxyToVite);

// Source files for HMR
app.get('/src/web/*', proxyToVite);
app.get('/src/*', proxyToVite); // Catch-all for other source files

// Workbench source files (in .agentuity/workbench-src/)
app.get('/.agentuity/workbench-src/*', proxyToVite);

// Node modules (Vite transforms these)
app.get('/node_modules/*', proxyToVite);

// Scoped packages (e.g., @agentuity/*, @types/*)
app.get('/@*', proxyToVite);

// File system access (for Vite's @fs protocol)
app.get('/@fs/*', proxyToVite);

// Module resolution (for Vite's @id protocol)
app.get('/@id/*', proxyToVite);

// Any .js, .jsx, .ts, .tsx files (catch remaining modules)
app.get('/*.js', proxyToVite);
app.get('/*.jsx', proxyToVite);
app.get('/*.ts', proxyToVite);
app.get('/*.tsx', proxyToVite);
app.get('/*.css', proxyToVite);
}

// Mount API routes
const { default: router_0 } = await import('../api/index.js');
app.route('/api', router_0);
Expand Down
43 changes: 43 additions & 0 deletions apps/testing/webrtc-test/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# dependencies (bun install)

node_modules

# output

out
dist
*.tgz

# code coverage

coverage
*.lcov

# logs

/logs
_.log
report.[0-9]_.[0-9]_.[0-9]_.[0-9]\*.json
Comment on lines +19 to +20
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Glob patterns appear malformed.

  • Line 19: _.log will only match a file literally named _.log, not *.log (all log files).
  • Line 20: The escaped pattern report.[0-9]_.[0-9]_.[0-9]_.[0-9]\*.json has unusual escaping that may not match intended files.

If the intent is to ignore all log files and report files, consider:

🔎 Suggested fix
-_.log
-report.[0-9]_.[0-9]_.[0-9]_.[0-9]\*.json
+*.log
+report.*.json
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
_.log
report.[0-9]_.[0-9]_.[0-9]_.[0-9]\*.json
*.log
report.*.json
🤖 Prompt for AI Agents
In apps/testing/webrtc-test/.gitignore around lines 19-20, the glob patterns are
malformed: change "_.log" to "*.log" to ignore all log files, and replace the
escaped report pattern with a proper glob such as
"report.[0-9]_[0-9]_[0-9]_[0-9]*.json" (or "report.*.json" if you want to match
any report filename) so the intended report files are actually ignored.


# dotenv environment variable files

.env
.env.\*
Comment on lines +24 to +25
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Escaped asterisk in .env.\* pattern.

The backslash may cause this pattern to not match .env.local, .env.production, etc. as intended.

🔎 Suggested fix
-.env.\*
+.env.*
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
.env
.env.\*
.env
.env.*
🤖 Prompt for AI Agents
In apps/testing/webrtc-test/.gitignore around lines 24-25, the pattern ".env.\*"
is escaped and won't match files like .env.local or .env.production; replace the
escaped pattern with an unescaped glob such as ".env.*" (or ".env*" if you also
want to match ".env") so the intended environment files are ignored.


# caches

.eslintcache
.cache
*.tsbuildinfo

# IntelliJ based IDEs

.idea

# Finder (MacOS) folder config

.DS_Store

# Agentuity build files

.agentuity
16 changes: 16 additions & 0 deletions apps/testing/webrtc-test/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"search.exclude": {
"**/.git/**": true,
"**/node_modules/**": true,
"**/bun.lock": true,
"**/.agentuity/**": true
},
"json.schemas": [
{
"fileMatch": [
"agentuity.json"
],
"url": "https://agentuity.dev/schema/cli/v1/agentuity.json"
}
]
}
64 changes: 64 additions & 0 deletions apps/testing/webrtc-test/AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Agent Guidelines for webrtc-test

## Commands

- **Build**: `bun run build` (compiles your application)
- **Dev**: `bun run dev` (starts development server)
- **Typecheck**: `bun run typecheck` (runs TypeScript type checking)
- **Deploy**: `bun run deploy` (deploys your app to the Agentuity cloud)

## Agent-Friendly CLI

The Agentuity CLI is designed to be agent-friendly with programmatic interfaces, structured output, and comprehensive introspection.

Read the [AGENTS.md](./node_modules/@agentuity/cli/AGENTS.md) file in the Agentuity CLI for more information on how to work with this project.

## Instructions

- This project uses Bun instead of NodeJS and TypeScript for all source code
- This is an Agentuity Agent project

## Web Frontend (src/web/)

The `src/web/` folder contains your React frontend, which is automatically bundled by the Agentuity build system.

**File Structure:**

- `index.html` - Main HTML file with `<script type="module" src="./frontend.tsx">`
- `frontend.tsx` - Entry point that renders the React app to `#root`
- `App.tsx` - Your main React component
- `public/` - Static assets (optional)

**How It Works:**

1. The build system automatically bundles `frontend.tsx` and all its imports (including `App.tsx`)
2. The bundled JavaScript is placed in `.agentuity/web/chunk/`
3. The HTML file is served at the root `/` route
4. Script references like `./frontend.tsx` are automatically resolved to the bundled chunks

**Key Points:**

- Use proper TypeScript/TSX syntax - the bundler handles all compilation
- No need for Babel or external bundlers
- React is bundled into the output (no CDN needed)
- Supports hot module reloading in dev mode with `import.meta.hot`
- Components can use all modern React features and TypeScript

**Example:**

```tsx
// src/web/App.tsx
import { useState } from 'react';

export function App() {
const [count, setCount] = useState(0);
return <button onClick={() => setCount((c) => c + 1)}>{count}</button>;
}
```

## Learn More

- [Agentuity Documentation](https://agentuity.dev)
- [Bun Documentation](https://bun.sh/docs)
- [Hono Documentation](https://hono.dev/)
- [Zod Documentation](https://zod.dev/)
147 changes: 147 additions & 0 deletions apps/testing/webrtc-test/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
# webrtc-test

A new Agentuity project created with `agentuity create`.

## What You Get

A fully configured Agentuity project with:

- ✅ **TypeScript** - Full type safety out of the box
- ✅ **Bun runtime** - Fast JavaScript runtime and package manager
- ✅ **Hot reload** - Development server with auto-rebuild
- ✅ **Example agent** - Sample "hello" agent to get started
- ✅ **React frontend** - Pre-configured web interface
- ✅ **API routes** - Example API endpoints
- ✅ **Type checking** - TypeScript configuration ready to go

## Project Structure

```
my-app/
├── src/
│ ├── agent/ # Agent definitions
│ │ └── hello/
│ │ ├── agent.ts # Example agent
│ │ └── index.ts # Default exports
│ ├── api/ # API definitions
│ │ └── index.ts # Example routes
│ └── web/ # React web application
│ ├── public/ # Static assets
│ ├── App.tsx # Main React component
│ ├── frontend.tsx # Entry point
│ └── index.html # HTML template
├── AGENTS.md # Agent guidelines
├── app.ts # Application entry point
├── tsconfig.json # TypeScript configuration
├── package.json # Dependencies and scripts
└── README.md # Project documentation
```

## Available Commands

After creating your project, you can run:

### Development

```bash
bun dev
```

Starts the development server at `http://localhost:3500`

### Build

```bash
bun build
```

Compiles your application into the `.agentuity/` directory

### Type Check

```bash
bun typecheck
```

Runs TypeScript type checking

### Deploy to Agentuity

```bash
bun run deploy
```

Deploys your application to the Agentuity cloud

## Next Steps

After creating your project:

1. **Customize the example agent** - Edit `src/agent/hello/agent.ts`
2. **Add new agents** - Create new folders in `src/agent/`
3. **Add new APIs** - Create new folders in `src/api/`
4. **Add Web files** - Create new routes in `src/web/`
5. **Customize the UI** - Edit `src/web/app.tsx`
6. **Configure your app** - Modify `app.ts` to add middleware, configure services, etc.

## Creating Custom Agents

Create a new agent by adding a folder in `src/agent/`:

```typescript
// src/agent/my-agent/agent.ts
import { createAgent } from '@agentuity/runtime';
import { s } from '@agentuity/schema';

const agent = createAgent({
description: 'My amazing agent',
schema: {
input: s.object({
name: s.string(),
}),
output: s.string(),
},
handler: async (_ctx, { name }) => {
return `Hello, ${name}! This is my custom agent.`;
},
});

export default agent;
```

## Adding API Routes

Create custom routes in `src/api/`:

```typescript
// src/api/my-agent/route.ts
import { createRouter } from '@agentuity/runtime';
import myAgent from './agent';

const router = createRouter();

router.get('/', async (c) => {
const result = await myAgent.run({ message: 'Hello!' });
return c.json(result);
});

router.post('/', myAgent.validator(), async (c) => {
const data = c.req.valid('json');
const result = await myAgent.run(data);
return c.json(result);
});

export default router;
```

## Learn More

- [Agentuity Documentation](https://agentuity.dev)
- [Bun Documentation](https://bun.sh/docs)
- [Hono Documentation](https://hono.dev/)
- [Zod Documentation](https://zod.dev/)

## Requirements

- [Bun](https://bun.sh/) v1.0 or higher
- TypeScript 5+
35 changes: 35 additions & 0 deletions apps/testing/webrtc-test/agentuity.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/**
* Agentuity Configuration
*
* @see https://agentuity.com/docs/configuration
*/

import type { AgentuityConfig } from '@agentuity/cli';

export default {
/**
* Workbench (development only)
*
* Visual UI for testing agents during development. Not included in production builds.
* Omit this section to disable. Access at http://localhost:3500/workbench
*/
workbench: {
route: '/workbench',
headers: {},
},

/**
* Vite Plugins
*
* Custom Vite plugins for the client build (src/web/).
* Added after built-in plugins: React, browserEnvPlugin, patchPlugin
*
* Example (Tailwind CSS):
* bun add -d tailwindcss @tailwindcss/vite
* import tailwindcss from '@tailwindcss/vite';
* plugins: [tailwindcss()]
*
* @see https://vitejs.dev/plugins/
*/
// plugins: [],
} satisfies AgentuityConfig;
13 changes: 13 additions & 0 deletions apps/testing/webrtc-test/agentuity.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"$schema": "https://agentuity.dev/schema/cli/v1/agentuity.json",
"projectId": "proj_4ab8672d04f2ad11bf1481a29cf39d23",
"orgId": "org_2sr8VkWocx9J2ZRgCohc00I5m3d",
"deployment": {
"resources": {
"memory": "500Mi",
"cpu": "500m",
"disk": "500Mi"
}
},
"region": "usc"
}
Loading
Loading