@vertesia/create-plugin 0.63.0 → 0.65.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vertesia/create-plugin",
3
- "version": "0.63.0",
3
+ "version": "0.65.0",
4
4
  "description": "Initialize a Vertesia plugin package",
5
5
  "type": "module",
6
6
  "bin": {
@@ -0,0 +1,31 @@
1
+ # Vertesia tools plugin
2
+
3
+ This plugin is exposing tools to vertesia. The tools as exposed on an external webs erver providing two endpoints:
4
+ 1. `GET /` - show tool descriptions
5
+ 2. `POST /` - execute a tool given an execution payload.
6
+
7
+ Note that when deployed on vercel the endpoints are:
8
+
9
+ 1. `GET /api`
10
+ 2. `POST /api`
11
+
12
+ The payload used when executing a tool must conform to the following interface:
13
+
14
+ ```ts
15
+ interface ToolExecutionPayload<ParamsT extends Record<string, any>> {
16
+ context: {
17
+ serverUrl: string,
18
+ storeUrl: string,
19
+ apikey: string
20
+ }
21
+ vars: Record<string, any>,
22
+ tool_input: ParamsT,
23
+ tool_name: string,
24
+ }
25
+ ```
26
+
27
+ To launch the tools server you can start the vite dev server using `pnpm dev`.
28
+
29
+ If you want to **debug** and add breakpoints in the code you must run the vite dev server from VSCode by running the `Debug Tools Server` launch configuration.
30
+
31
+ Vercel deployment is supported by wrapping the `hono` server using a vercel adapter.
@@ -0,0 +1,8 @@
1
+ import app from '../src/server';
2
+ import { handle } from 'hono/vercel';
3
+
4
+ export const config = {
5
+ runtime: 'edge', // enables edge function runtime
6
+ };
7
+
8
+ export default handle(app);
@@ -1,8 +1,9 @@
1
1
  import { Hono } from 'hono';
2
2
  import { registry } from "./index.js";
3
+ import { cors } from 'hono/cors'
3
4
 
4
5
  const app = new Hono();
5
-
6
+ app.get("/", cors({ origin: '*', allowMethods: ['GET'] }))
6
7
  app.post('/', async (c) => {
7
8
  const data = await c.req.json();
8
9
  const r = await registry.execute(data)
@@ -0,0 +1,7 @@
1
+ {
2
+ "functions": {
3
+ "api/index.ts": {
4
+ "runtime": "edge"
5
+ }
6
+ }
7
+ }