Commit graph

507 commits

Author SHA1 Message Date
Ajax Davis
0413b9be0e feat: complete MCP Bridge implementation
- Add @tpmjs/mcp-client package for connecting to MCP servers
- Add @tpmjs/bridge CLI for bridging local MCP servers to TPMJS
- Add @tpmjs/test-file-writer test MCP server
- Add BridgeConnection and CollectionBridgeTool database models
- Add /api/bridge endpoints for bridge communication
- Add /api/collections/[id]/bridge-tools API for managing bridge tools
- Update MCP handlers to include bridge tools in tools/list
- Add bridge status UI at /dashboard/settings/bridge
- Add interactive bridge tutorial at /docs/tutorials/bridge
2026-01-13 00:59:34 +10:00
Ajax Davis
fddd37b6f6 feat: add reusable EnvVarsEditor component with paste .env feature
- Create EnvVarsEditor component for editing key-value env vars
- Add paste .env snippet feature with preview of parsed variables
- Refactor agent and collection pages to use the new component
- Extract shared parseEnvString utility for consistent .env parsing
- Update API keys settings page to use shared parser

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-12 05:04:03 +10:00
Ajax Davis
a12615539f fix: hardcode Discord agent ID in GitHub Action
No need to use a secret for the agent ID since it's a public identifier.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-12 04:39:03 +10:00
Ajax Davis
1dc36cf64b feat: add GitHub Action for daily Discord summary
- Runs daily at 9 AM UTC via cron
- Can be triggered manually via workflow_dispatch
- Uses date-based conversation ID (discord-summary-YYYY-MM-DD)
- Triggers the Discord agent to read and summarize the past 24 hours

Requires DISCORD_AGENT_ID secret to be set in GitHub repo settings.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-12 04:35:33 +10:00
Ajax Davis
535a922564 fix: increase tool execution timeout to 5 minutes
Tools like discord-read that fetch data from external APIs need more time.
Previous 10-30 second timeout was causing silent failures.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-12 04:16:15 +10:00
Ajax Davis
8d9b47b735 fix: improve error visibility for agent tool execution
- Add structured logging for tool calls, results, and errors
- Log tool call initiation with input parameters
- Distinguish between success and error tool results
- Include isError flag in SSE tool_result events
- Improve error logging with stack traces and context

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-12 03:08:57 +10:00
Ajax Davis
4307cd43e3 feat: add environment variables support for agents and collections
- Add envVars field to Agent and Collection models in Prisma schema
- Add envVars to UpdateAgentSchema and UpdateCollectionSchema types
- Implement env vars merging logic (agent overrides collection)
- Pass env vars through tool executor to sandbox
- Add UI for managing env vars in agent and collection settings pages
- Update API routes to handle envVars PATCH updates
- Refactor discord tool execute functions for biome compatibility

This allows users to configure tool-specific environment variables (like
DISCORD_BOT_TOKEN) at both the collection and agent level, with agent
settings taking precedence over collection settings.
2026-01-12 01:35:29 +10:00
Ajax Davis
ac4186c604 fix: remove random color highlighting and improve contrast on architecture page
- Remove accent variant from Cell component, simplify to muted boolean
- Remove primary variant from ArchBox component
- Replace all text-primary with text-foreground for consistency
- Remove blue-tinted borders from sections
- Update all cells to use consistent styling

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-11 04:06:40 +10:00
Ajax Davis
5b88dc0e32 refactor: update architecture page to use TPMJS design system
Replaced custom lime/zinc colors with proper theme variables:
- bg-background, bg-surface, bg-surface-secondary
- text-foreground, text-foreground-secondary, text-foreground-tertiary
- border-border, border-primary
- Uses Badge component from @tpmjs/ui
- Uses Container component for layout
- Maintains the nested box layout style

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-11 03:09:23 +10:00
Ajax Davis
c722001ab3 feat: add architecture documentation page with chip-style diagrams
Create visual architecture documentation at /docs/architecture with:
- Platform overview showing user products, API layer, infrastructure
- Tool execution pipeline flow diagram
- Executor system comparison (default vs custom)
- Collections and Agents data model
- Tool discovery and sync pipeline
- Database entity relationships

Uses NVIDIA-inspired chip diagram aesthetic with nested boxes,
grid layouts, and lime/yellow accent colors on dark background.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-11 02:51:05 +10:00
Ajax Davis
cd175daf04 fix: use full inputSchema for tool definitions instead of flattened parameters
The issue was that tools with complex nested parameters (like arrays of objects)
were losing their structure when converted to Zod schemas. The LLM would then
pass stringified JSON instead of actual arrays.

- Import jsonSchema from AI SDK
- Check if tool.inputSchema exists (full JSON Schema from executor)
- Use jsonSchema() wrapper to preserve nested array/object structures
- Fall back to legacy tpmjsParamsToZodSchema only if inputSchema is missing

This fixes the changelog tool and similar tools with complex parameter types.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-11 02:34:37 +10:00
Ajax Davis
d74a23d54c fix: show tool outputs in embedded tool calls and improve light mode styling
- Build toolCallId -> output map from TOOL messages
- Pass outputs to embedded tool calls in ASSISTANT messages
- Skip rendering separate TOOL messages (now shown with their calls)
- Improve light mode contrast for tool cards:
  - Use slate-50 background instead of gray
  - Better status badge colors (green-700, blue-700 in light mode)
  - Better error colors (red-600 in light mode)
  - Better output text colors (emerald-700, red-600 in light mode)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-11 02:16:56 +10:00
Ajax Davis
9fc4532c0a fix: render embedded tool calls from ASSISTANT messages on page refresh
Previously, tool calls only rendered during streaming. Now they also
render when loading conversation history from the database, where
tool calls are embedded in ASSISTANT messages.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-11 02:08:33 +10:00
Ajax Davis
858b62b0be feat: add tool error rendering and JSON logs button in agent chat
- Add error detection for tool call outputs (success=false, error field)
- Display ERROR badge and red styling for failed tool calls
- Show error message preview in tool call header
- Add "JSON" button to view full conversation history as raw JSON
- Support format=json parameter in conversation API endpoint

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-11 02:01:34 +10:00
Ajax Davis
d495f61f10 fix: correct test package/tool name in executor verification
- Use @tpmjs/hello instead of @anthropic-ai/tpmjs-hello
- Use helloWorldTool instead of helloWorld (correct export name)
- Increase timeout to 30s to account for npm install in sandbox
- Add detailed logging to Vercel executor template

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-11 01:36:26 +10:00
Ajax Davis
d4e3c4ff0a feat: add API Reference and Custom Executors to developer menu
- Add /docs/api (API Reference - REST & MCP endpoints) to nav
- Add /docs/executors (Custom Executors - Deploy your own) to nav
- Updated both desktop dropdown and mobile menu
- Fix lint error in MobileMenu backdrop

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-11 01:08:36 +10:00
Ajax Davis
9ab4c2eba8 feat: add API getting started documentation page
- Comprehensive REST API and MCP protocol documentation
- Interactive examples with cURL commands
- Covers tools, search, collections, agents, and stats endpoints
- MCP protocol with initialize, tools/list, and tools/call examples
- Response format, error handling, and pagination docs
2026-01-11 00:49:15 +10:00
Ajax Davis
b38afb07bb feat: add workflow for syncing individual packages 2026-01-10 18:38:19 +10:00
Ajax Davis
ffa02b396b feat: add manual package sync endpoint
POST /api/sync/package with { packageName } to sync a specific package.
Useful for packages not yet indexed by npm search.
2026-01-10 18:25:10 +10:00
Ajax Davis
f226cfece0 feat: sync packages with tpmjs keyword even without tpmjs field
- Auto-discover tools for packages that only have tpmjs keyword
- Use 'utilities' as default category for keyword-only packages
- Enables packages like fbx2vrma-converter to be synced
2026-01-10 18:16:18 +10:00
Ajax Davis
67448afe38 fix: update sync-manual workflow to Node 22 and pnpm 9 2026-01-10 17:28:39 +10:00
Ajax Davis
71b5599455 fix: update health checks to use existing public endpoints
- Replace non-existent /api/collections/public and /api/agents/public
  with /api/stats which is a public endpoint
- Remove sync_status check (endpoint doesn't exist)
- Update health page labels to match new check names

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-10 03:17:14 +10:00
Ajax Davis
37ac263799 feat: add comprehensive endpoint health monitoring
- Add GitHub Action workflow that runs every 5 minutes testing:
  - Basic health endpoint
  - Database connectivity (tools API)
  - Collections and Agents public APIs
  - MCP HTTP transport (initialize + tools/list)
  - MCP SSE transport
  - MCP server info endpoint
  - Tool health stats

- Add /api/health/report endpoint for storing health check results
- Add EndpointHealthReport Prisma model for persistence
- Add /health status page with:
  - Real-time status banner
  - Uptime percentage
  - Per-service health stats
  - Recent health check history
  - Auto-refresh every 30 seconds

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-10 03:08:11 +10:00
Ajax Davis
ee6d66a98e fix: resolve MCP route timeout and agent route conflict
- Add 10s database query timeout wrapper to prevent indefinite hangs
- Wrap all Prisma calls in MCP handlers with timeout protection
- Reduce maxDuration from 300s to 60s for MCP routes
- Move public conversation route from /api/agents/[username]/[uid] to
  /api/chat/[username]/[uid] to resolve Next.js route parameter conflict
- Update sharing docs to reflect new chat API path

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-10 01:45:17 +10:00
Ajax Davis
912f9605ab fix: enable Biome CSS tailwindDirectives for @apply parsing
- Add css.parser.tailwindDirectives to biome config
- Auto-format CSS files with new parser settings
2026-01-09 23:35:53 +10:00
Ajax Davis
bce7a9540c fix: resolve new ESLint rules from eslint-plugin-react-hooks update
- Use useId() instead of Math.random() for stable ID generation in Checkbox and Switch
- Use deterministic rotation/delay calculations instead of Math.random() in CategoryGrid and ProblemSection
- Add eslint-disable comments for intentional setState in useEffect patterns:
  - Hydration safety (setMounted)
  - Initial localStorage sync
  - Route-based UI sync
  - Controlled component sync
  - Browser API initial sync (scroll position, media queries)
- Add eslint-disable for ref merging pattern in AnimatedCounter and StatCard

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-09 23:25:15 +10:00
Ajax Davis
83f00c8a74 fix: add eslint-disable comments for set-state-in-effect rule in playground
The new react-hooks/set-state-in-effect ESLint rule flags setState calls
in useEffect hooks. These patterns are intentional in these components:
- ChatHeader: setMounted for hydration safety
- MessageBubble: setPartTimings for streaming state tracking
- SettingsSidebar: setEnvVars for localStorage initialization

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-09 23:08:26 +10:00
Ajax Davis
91fc8799b7 chore: update dependencies with compatibility fixes
- Update all packages to latest versions via pnpm update --latest
- Downgrade Prisma 7 to 6 (v7 requires schema migration)
- Downgrade Tailwind CSS 4 to 3 (v4 requires PostCSS migration)
- Downgrade Storybook 10 to 8 (addons not available in v10)
- Pin cheerio to 1.0.0-rc.12 via pnpm override (type exports changed)
- Fix AI SDK tool definitions: parameters -> inputSchema
- Fix cheerio types in extract-meta and table-extract tools
- Add explicit type annotations to tool execute functions
- Migrate biome config to v2.3.11 schema

All type-checks, tests, and builds pass.
2026-01-09 22:49:41 +10:00
Ajax Davis
751209b26f revert: restore maxDuration=300 for conversation routes
The maxDuration=60 change was causing all API routes to hang/timeout
on Vercel deployments. While the Hobby plan limit is 60s, setting
maxDuration=60 in certain route files appears to cause a deployment
issue where no API routes respond.

Reverting to maxDuration=300 to restore functionality. The actual
runtime timeout will be enforced by Vercel's plan limits anyway.
2026-01-09 20:01:18 +10:00
Ajax Davis
b9bc4fbc56 revert: restore framework=nextjs in vercel.json 2026-01-09 18:18:04 +10:00
Ajax Davis
f87147e95f fix: set framework to null for monorepo Vercel deployment 2026-01-09 18:11:26 +10:00
Ajax Davis
1bb221f455 fix: update MCP copy URLs to use new /api/mcp/{username}/{slug} format
- Update getCollectionCopyOptions to require username and slug params
- Update getAgentCopyOptions to require username param
- Add slug and username to public collections/agents API responses
- Remove deprecated /mcp/collections/{id} and /mcp/agents/{uid} URL formats
2026-01-09 08:14:39 +10:00
Ajax Davis
370f4d0232 chore: trigger deployment 2026-01-09 08:00:08 +10:00
Ajax Davis
2c2c891ce0 fix: reduce maxDuration to 60s for Vercel Hobby plan compatibility
Routes with maxDuration=300 were silently failing on Vercel's edge
routing layer - requests never reached the serverless function (no
logs appeared). Vercel Hobby plan has a 60s max function duration.

Affected routes:
- /api/agents/[id]/conversation/[conversationId]
- /api/agents/[username]/[uid]/conversation/[conversationId]
- /api/mcp/[username]/[slug]/[transport]

The issue caused these routes to hang indefinitely until client timeout.
2026-01-09 07:06:54 +10:00
Ajax Davis
5bf4260a70 fix: use sync rate limiter for conversation routes
The distributed rate limiter (checkRateLimitDistributed) was causing
timeouts in production, likely due to @vercel/kv connection issues.
Switch to sync in-memory rate limiter (checkRateLimit) which works
reliably across all other endpoints.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-09 05:23:18 +10:00
Ajax Davis
05ccdc66da fix: add timeout to Vercel KV rate limiter to prevent hanging
The rate limiter was calling @vercel/kv without a timeout, which could
hang indefinitely if KV is not configured or responding. This adds a
2-second timeout to prevent requests from timing out.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-09 04:51:33 +10:00
Ajax Davis
4db15221a7 fix: add ID-based conversation route for dashboard chat
The dashboard chat page was calling /api/agents/{uid}/conversation/...
but the only conversation route expected /api/agents/{username}/{uid}/...

This adds a new route at /api/agents/[id]/conversation/[conversationId]
that accepts agent ID directly, and updates the chat page to use it.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-09 03:42:04 +10:00
Ajax Davis
7fe1027902 fix: add root-level health and execute-tool routes for TPMJS compatibility
TPMJS verification expects endpoints at /health and /execute-tool,
not at /api/health and /api/execute-tool. This adds the correct routes
while keeping the /api versions for backwards compatibility.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-09 02:43:12 +10:00
Ajax Davis
63d408b911 fix(executor): use correct Vercel Sandbox SDK API
Key fixes:
- Use await result.stdout() / stderr() instead of result.stdout property
- Use sandbox.writeFiles([{ path, content: Buffer }]) correctly
- Use object form of runCommand with cmd, args, cwd, env
- Proper error handling and result parsing
2026-01-09 02:21:51 +10:00
Ajax Davis
ee65203745 fix(executor): add missing @types/react dependency 2026-01-09 01:54:18 +10:00
Ajax Davis
d6056a3f9b ci: add Claude-powered documentation auto-update workflow 2026-01-09 01:47:21 +10:00
Thomas Davis
7f14c66934
Merge pull request #13 from tpmjs/add-claude-github-actions-1767887076208
Add Claude Code GitHub Workflow
2026-01-09 01:44:59 +10:00
Thomas Davis
5a1b356234 "Claude Code Review workflow" 2026-01-09 01:44:40 +10:00
Thomas Davis
10d1bfc4a8 "Claude PR Assistant workflow" 2026-01-09 01:44:38 +10:00
Ajax Davis
6dc5f96989 fix(executor): correct @vercel/sandbox version to 1.1.5 2026-01-09 01:40:16 +10:00
Ajax Davis
44ea5bd9af refactor(executor): use Vercel Sandbox SDK for isolated VM execution
- Replace community Deno runtime with @vercel/sandbox SDK
- Next.js API routes create ephemeral sandbox VMs per execution
- Each tool execution: create VM → npm install → run → cleanup
- node22 runtime in sandbox handles npm packages natively
- Region pinned to iad1 (only region with Sandbox support)
- Proper authentication support via EXECUTOR_API_KEY

This provides true isolation - each tool runs in its own VM that's
destroyed after execution. More secure than shared serverless.
2026-01-09 01:35:22 +10:00
Ajax Davis
e5d7fa2b10 refactor(executor): switch vercel template from Next.js to Deno runtime
- Replace Next.js app router with pure Deno API functions
- Use vercel-deno@3.0.0 community runtime for native HTTP imports
- Deno natively supports importing from esm.sh URLs
- Simplified template: just api/health.ts and api/execute-tool.ts
- Remove unnecessary React/Next.js dependencies
- Update README with new architecture documentation

This matches the Railway executor's Deno-based approach but runs on
the user's own Vercel account. The Deno runtime enables dynamic
imports from esm.sh without any special setup.
2026-01-09 01:15:47 +10:00
Ajax Davis
0735ce7758 docs: add step-by-step custom executor tutorial
- Create comprehensive tutorial at /docs/tutorials/custom-executor
- Walk through from zero to running custom executor in 6 steps
- Cover prerequisites, Vercel deployment, environment config
- Include verification, testing, and connection to collections
- Add troubleshooting section for common issues
- Link tutorial from tutorials index and executors reference page
2026-01-09 00:55:54 +10:00
Ajax Davis
c6655adfbb style: fix formatting, add complexity ignores, use optional chain 2026-01-09 00:34:15 +10:00
Ajax Davis
9f0728d6a2 feat: add hot-swappable executor support for collections and agents
- Add executor configuration to Collection and Agent models in Prisma schema
- Create ExecutorConfigPanel component for selecting default or custom executors
- Add executor resolution logic with cascade (Agent → Collection → System Default)
- Create /api/executors/verify endpoint to test custom executor connectivity
- Add executor documentation page at /docs/executors with API specification
- Create deployable Vercel executor template in templates/vercel-executor/
- Update MCP handlers and agent tool execution to use configurable executors
- Add executor types and schemas to @tpmjs/types package

Users can now deploy their own executor instances and configure collections
or agents to use custom executors instead of the TPMJS default executor.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-09 00:19:22 +10:00