@vertesia/create-plugin 0.79.3 → 0.79.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +68 -63
- package/lib/Package.d.ts +2 -2
- package/lib/Package.d.ts.map +1 -1
- package/lib/TemplateInit.d.ts +2 -1
- package/lib/TemplateInit.d.ts.map +1 -1
- package/lib/TemplateInit.js.map +1 -1
- package/lib/ToolTemplateInit.d.ts.map +1 -1
- package/lib/ToolTemplateInit.js +17 -4
- package/lib/ToolTemplateInit.js.map +1 -1
- package/lib/WebTemplateInit.d.ts.map +1 -1
- package/lib/WebTemplateInit.js +0 -9
- package/lib/WebTemplateInit.js.map +1 -1
- package/lib/copy.d.ts +1 -1
- package/lib/copy.d.ts.map +1 -1
- package/lib/copy.js +6 -2
- package/lib/copy.js.map +1 -1
- package/lib/init.d.ts.map +1 -1
- package/lib/init.js +73 -56
- package/lib/init.js.map +1 -1
- package/lib/types.d.ts +12 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/types.js +20 -0
- package/lib/types.js.map +1 -0
- package/package.json +15 -3
- package/templates/tool/.env.example +6 -0
- package/templates/tool/.vscode/launch.json +1 -1
- package/templates/tool/README.md +179 -20
- package/templates/tool/gitignore +26 -0
- package/templates/tool/rollup.config.js +30 -0
- package/templates/tool/src/collections/example/icon.svg.ts +6 -0
- package/templates/tool/src/collections/example/index.ts +14 -0
- package/templates/tool/src/collections/example/weather/WeatherTool.ts +32 -0
- package/templates/tool/src/collections/example/weather/manifest.ts +16 -0
- package/templates/tool/src/collections/index.ts +7 -0
- package/templates/tool/src/index.ts +4 -5
- package/templates/tool/src/server.ts +70 -16
- package/templates/tool/tsconfig.json +14 -4
- package/templates/tool/vercel.json +6 -5
- package/templates/tool/vite.config.js +46 -8
- package/templates/web/README.md +153 -51
- package/templates/web/eslint.config.js +2 -1
- package/templates/web/gitignore +25 -0
- package/templates/web/index.html.tmpl +4 -4
- package/templates/web/src/env.ts.tmpl +5 -11
- package/templates/web/vite.config.ts.tmpl +6 -4
- package/templates/tool/src/tools/WeatherTool.ts +0 -25
package/templates/web/README.md
CHANGED
|
@@ -1,54 +1,156 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
1
|
+
# Vertesia Custom App Sample
|
|
2
|
+
|
|
3
|
+
A sample project demonstrating how to build a custom app/plugin for the Vertesia platform using React, TypeScript, and Vite.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
This project serves as a template for building Vertesia plugins that can be integrated into the Vertesia platform. It includes:
|
|
8
|
+
|
|
9
|
+
- React 19 with TypeScript for type-safe component development
|
|
10
|
+
- Tailwind CSS for styling
|
|
11
|
+
- Vite for fast development and optimized builds
|
|
12
|
+
- Dual build modes: standalone app and plugin library
|
|
13
|
+
|
|
14
|
+
## Project Structure
|
|
15
|
+
|
|
16
|
+
```txt
|
|
17
|
+
src/
|
|
18
|
+
├── app.tsx # Main app component with router
|
|
19
|
+
├── plugin.tsx # Plugin entry point for Vertesia integration
|
|
20
|
+
├── routes.tsx # Application route definitions
|
|
21
|
+
├── pages.tsx # Page components
|
|
22
|
+
└── main.tsx # Dev mode entry point
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Getting Started
|
|
26
|
+
|
|
27
|
+
### Installation
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pnpm install
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Development
|
|
34
|
+
|
|
35
|
+
Run the app in development mode with hot module replacement:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
pnpm dev
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
The app will be available at `https://localhost:5173`.
|
|
42
|
+
|
|
43
|
+
### Building
|
|
44
|
+
|
|
45
|
+
Build both standalone app and plugin library:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
pnpm build
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Or build individually:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
# Build standalone app
|
|
55
|
+
pnpm build:app
|
|
56
|
+
|
|
57
|
+
# Build plugin library
|
|
58
|
+
pnpm build:lib
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
The plugin library will be output to the `dist/lib/` directory.
|
|
62
|
+
|
|
63
|
+
## Deployment
|
|
64
|
+
|
|
65
|
+
Since this is a standard web application, you can deploy it to any static hosting provider (Vercel, Netlify, Cloudflare Pages, AWS S3, etc.).
|
|
66
|
+
|
|
67
|
+
### Deploying to Vercel
|
|
68
|
+
|
|
69
|
+
Vercel is a practical deployment option with a generous free tier. You can very simply deploy your standalone app using the Vercel CLI.
|
|
70
|
+
|
|
71
|
+
#### Setup
|
|
72
|
+
|
|
73
|
+
Install the Vercel CLI globally:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
npm i -g vercel
|
|
32
77
|
```
|
|
33
78
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
79
|
+
#### Deployment Steps
|
|
80
|
+
|
|
81
|
+
1. **Login to Vercel**:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
vercel login
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
2. **Deploy to preview**:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
vercel
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
This will create a preview deployment and provide you with a URL to test your app.
|
|
94
|
+
|
|
95
|
+
3. **Deploy to production**:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
vercel --prod
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
For more information, visit the [Vercel CLI documentation](https://vercel.com/docs/cli).
|
|
102
|
+
|
|
103
|
+
#### Update App Manifest with Deployment URL
|
|
104
|
+
|
|
105
|
+
After deploying to Vercel, update your app manifest to point to the deployed URL using the vertesia CLI:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
vertesia apps update <appId> --manifest '{
|
|
109
|
+
"name": "my-app",
|
|
110
|
+
"title": "My App",
|
|
111
|
+
"description": "A sample app",
|
|
112
|
+
"publisher": "your-org",
|
|
113
|
+
"private": true,
|
|
114
|
+
"status": "beta",
|
|
115
|
+
"ui": {
|
|
116
|
+
"src": "https://your-app.vercel.app/lib/plugin.js",
|
|
117
|
+
"isolation": "shadow"
|
|
118
|
+
}
|
|
119
|
+
}'
|
|
54
120
|
```
|
|
121
|
+
|
|
122
|
+
Replace `appId` by the actual ID and `https://your-app.vercel.app` with your actual Vercel deployment URL.
|
|
123
|
+
|
|
124
|
+
## Key Features
|
|
125
|
+
|
|
126
|
+
### Dual Build Modes
|
|
127
|
+
|
|
128
|
+
- **App Mode**: Builds a standalone application for development and testing
|
|
129
|
+
- **Library Mode**: Builds a plugin that can be integrated into the Vertesia platform
|
|
130
|
+
|
|
131
|
+
### External Dependencies
|
|
132
|
+
|
|
133
|
+
When building as a plugin, React and Vertesia dependencies are externalized to prevent duplication:
|
|
134
|
+
|
|
135
|
+
- `react` / `react-dom`
|
|
136
|
+
- `@vertesia/common`
|
|
137
|
+
- `@vertesia/ui`
|
|
138
|
+
|
|
139
|
+
## Tech Stack
|
|
140
|
+
|
|
141
|
+
- **React 19** - UI framework
|
|
142
|
+
- **TypeScript** - Type safety
|
|
143
|
+
- **Vite** - Build tool and dev server
|
|
144
|
+
- **Tailwind CSS 4** - Styling
|
|
145
|
+
- **@vertesia/ui** - Vertesia UI components
|
|
146
|
+
- **@vertesia/plugin-builder** - Plugin build utilities
|
|
147
|
+
|
|
148
|
+
## Development Notes
|
|
149
|
+
|
|
150
|
+
- The dev server uses HTTPS (via `@vitejs/plugin-basic-ssl`)
|
|
151
|
+
- CSS can be inlined in the plugin bundle or kept separate (configured in [vite.config.ts](vite.config.ts))
|
|
152
|
+
- For debugging Vertesia UI sources, set `VERTESIA_UI_PATH` in [vite.config.ts](vite.config.ts)
|
|
153
|
+
|
|
154
|
+
## License
|
|
155
|
+
|
|
156
|
+
See package.json for license information.
|
|
@@ -3,8 +3,9 @@ import globals from 'globals'
|
|
|
3
3
|
import reactHooks from 'eslint-plugin-react-hooks'
|
|
4
4
|
import reactRefresh from 'eslint-plugin-react-refresh'
|
|
5
5
|
import tseslint from 'typescript-eslint'
|
|
6
|
+
import { defineConfig } from 'eslint/config';
|
|
6
7
|
|
|
7
|
-
export default
|
|
8
|
+
export default defineConfig(
|
|
8
9
|
{ ignores: ['dist'] },
|
|
9
10
|
{
|
|
10
11
|
extends: [js.configs.recommended, ...tseslint.configs.recommended],
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Logs
|
|
2
|
+
logs
|
|
3
|
+
*.log
|
|
4
|
+
npm-debug.log*
|
|
5
|
+
yarn-debug.log*
|
|
6
|
+
yarn-error.log*
|
|
7
|
+
pnpm-debug.log*
|
|
8
|
+
lerna-debug.log*
|
|
9
|
+
|
|
10
|
+
node_modules
|
|
11
|
+
dist
|
|
12
|
+
dist-ssr
|
|
13
|
+
lib
|
|
14
|
+
*.local
|
|
15
|
+
|
|
16
|
+
# Editor directories and files
|
|
17
|
+
.vscode/*
|
|
18
|
+
!.vscode/extensions.json
|
|
19
|
+
.idea
|
|
20
|
+
.DS_Store
|
|
21
|
+
*.suo
|
|
22
|
+
*.ntvs*
|
|
23
|
+
*.njsproj
|
|
24
|
+
*.sln
|
|
25
|
+
*.sw?
|
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
<script type="importmap">
|
|
10
10
|
{
|
|
11
11
|
"imports": {
|
|
12
|
-
"react": "https://esm.sh/react@19.
|
|
13
|
-
"react-dom": "https://esm.sh/react-dom@19.
|
|
14
|
-
"react-dom/client": "https://esm.sh/react-dom@19.
|
|
15
|
-
"react/jsx-runtime": "https://esm.sh/react@19.
|
|
12
|
+
"react": "https://esm.sh/react@19.1.2",
|
|
13
|
+
"react-dom": "https://esm.sh/react-dom@19.1.2",
|
|
14
|
+
"react-dom/client": "https://esm.sh/react-dom@19.1.2/client",
|
|
15
|
+
"react/jsx-runtime": "https://esm.sh/react@19.1.2/jsx-runtime"
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
</script>
|
|
@@ -4,17 +4,11 @@ Env.init({
|
|
|
4
4
|
name: "${plugin_title}",
|
|
5
5
|
version: "1.0.0",
|
|
6
6
|
isLocalDev: true,
|
|
7
|
-
isDocker:
|
|
7
|
+
isDocker: true,
|
|
8
8
|
type: "development",
|
|
9
9
|
endpoints: {
|
|
10
|
-
studio: "
|
|
11
|
-
zeno: "
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
apiKey: import.meta.env.VITE_FIREBASE_API_KEY,
|
|
15
|
-
authDomain: window.location.host,
|
|
16
|
-
projectId: "dengenlabs",
|
|
17
|
-
appId: "1:265888598630:web:6e5e76c8ecde887e5afba7"
|
|
18
|
-
},
|
|
19
|
-
datadog: false,
|
|
10
|
+
studio: "https://api.vertesia.io",
|
|
11
|
+
zeno: "https://api.vertesia.io",
|
|
12
|
+
sts: "https://sts.vertesia.io",
|
|
13
|
+
}
|
|
20
14
|
});
|
|
@@ -40,7 +40,7 @@ const inlineCss = ${ inlineCss };
|
|
|
40
40
|
* Vite configuration to build the plugin as a library or as a standalone application or to run the application in dev mode.
|
|
41
41
|
* Use `vite build --mode lib` to build a library (plugin)
|
|
42
42
|
* Use `vite build` or `vite build --mode app`to build a standalone application
|
|
43
|
-
* Use `vite dev` to run the
|
|
43
|
+
* Use `vite dev` to run the application in dev mode.
|
|
44
44
|
*/
|
|
45
45
|
export default defineConfig((env) => {
|
|
46
46
|
if (env.mode === 'lib') {
|
|
@@ -83,7 +83,7 @@ function defineLibConfig({ command }: ConfigEnv): UserConfig {
|
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
/**
|
|
86
|
-
* Vite configuration to run the
|
|
86
|
+
* Vite configuration to run the application in dev mode
|
|
87
87
|
* or to build a standalone application.
|
|
88
88
|
* @returns
|
|
89
89
|
*/
|
|
@@ -115,8 +115,10 @@ function defineAppConfig(): UserConfig {
|
|
|
115
115
|
resolve: {
|
|
116
116
|
// For debug support in vertesia ui sources - link to the vertesia/ui location
|
|
117
117
|
alias: VERTESIA_UI_PATH ? {
|
|
118
|
-
"@vertesia/ui
|
|
119
|
-
} : undefined
|
|
118
|
+
"@vertesia/ui": resolve(`${VERTESIA_UI_PATH}/src`)
|
|
119
|
+
} : undefined,
|
|
120
|
+
// Deduplicate React to prevent multiple instances
|
|
121
|
+
dedupe: ['react', 'react-dom']
|
|
120
122
|
}
|
|
121
123
|
}
|
|
122
124
|
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { Tool, ToolFunctionParams } from "@vertesia/agent-sdk";
|
|
2
|
-
|
|
3
|
-
interface WeatherToolParams {
|
|
4
|
-
location: string;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export const WeatherTool = {
|
|
8
|
-
name: "weather",
|
|
9
|
-
description: "Get the current weather for a given location.",
|
|
10
|
-
input_schema: {
|
|
11
|
-
type: "object",
|
|
12
|
-
properties: {
|
|
13
|
-
location: {
|
|
14
|
-
type: "string",
|
|
15
|
-
description: "The location to get the weather for, e.g., 'New York, NY'."
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
required: ["location"]
|
|
19
|
-
},
|
|
20
|
-
run: async (params: ToolFunctionParams<WeatherToolParams>) => {
|
|
21
|
-
const { location } = params.input;
|
|
22
|
-
// Simulate fetching weather data
|
|
23
|
-
return `The current weather in ${location} is sunny with a temperature of 75°F.`;
|
|
24
|
-
}
|
|
25
|
-
} satisfies Tool<WeatherToolParams>;
|