create-skybridge 0.0.0-dev.f561bc3 → 0.0.0-dev.f6bca06

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.
Files changed (36) hide show
  1. package/LICENSE +21 -0
  2. package/dist/index.js +164 -33
  3. package/dist/index.test.js +12 -6
  4. package/package.json +12 -13
  5. package/template/AGENTS.md +1 -0
  6. package/template/README.md +54 -21
  7. package/template/_gitignore +2 -1
  8. package/template/alpic.json +1 -2
  9. package/template/node_modules/.bin/alpic +21 -0
  10. package/template/node_modules/.bin/nodemon +21 -0
  11. package/template/node_modules/.bin/sb +21 -0
  12. package/template/node_modules/.bin/skybridge +21 -0
  13. package/template/node_modules/.bin/tsc +21 -0
  14. package/template/node_modules/.bin/tsserver +21 -0
  15. package/template/node_modules/.bin/tsx +21 -0
  16. package/template/node_modules/.bin/vite +21 -0
  17. package/template/nodemon.json +5 -0
  18. package/template/package.json +27 -10
  19. package/template/server/src/index.ts +62 -34
  20. package/template/tsconfig.json +23 -0
  21. package/template/tsconfig.server.json +11 -0
  22. package/template/web/src/helpers.ts +1 -1
  23. package/template/web/src/index.css +130 -6
  24. package/template/web/src/widgets/magic-8-ball.tsx +8 -3
  25. package/template/web/vite.config.ts +3 -3
  26. package/template/pnpm-workspace.yaml +0 -7
  27. package/template/server/nodemon.json +0 -5
  28. package/template/server/package.json +0 -34
  29. package/template/server/src/env.ts +0 -12
  30. package/template/server/src/middleware.ts +0 -54
  31. package/template/server/src/server.ts +0 -79
  32. package/template/server/tsconfig.json +0 -17
  33. package/template/web/package.json +0 -24
  34. package/template/web/tsconfig.app.json +0 -34
  35. package/template/web/tsconfig.json +0 -13
  36. package/template/web/tsconfig.node.json +0 -26
@@ -0,0 +1,21 @@
1
+ #!/bin/sh
2
+ basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3
+
4
+ case `uname` in
5
+ *CYGWIN*|*MINGW*|*MSYS*)
6
+ if command -v cygpath > /dev/null 2>&1; then
7
+ basedir=`cygpath -w "$basedir"`
8
+ fi
9
+ ;;
10
+ esac
11
+
12
+ if [ -z "$NODE_PATH" ]; then
13
+ export NODE_PATH="/home/runner/work/skybridge/skybridge/node_modules/.pnpm/tsx@4.21.0/node_modules/tsx/dist/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/tsx@4.21.0/node_modules/tsx/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/tsx@4.21.0/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/node_modules"
14
+ else
15
+ export NODE_PATH="/home/runner/work/skybridge/skybridge/node_modules/.pnpm/tsx@4.21.0/node_modules/tsx/dist/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/tsx@4.21.0/node_modules/tsx/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/tsx@4.21.0/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/node_modules:$NODE_PATH"
16
+ fi
17
+ if [ -x "$basedir/node" ]; then
18
+ exec "$basedir/node" "$basedir/../tsx/dist/cli.mjs" "$@"
19
+ else
20
+ exec node "$basedir/../tsx/dist/cli.mjs" "$@"
21
+ fi
@@ -0,0 +1,21 @@
1
+ #!/bin/sh
2
+ basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3
+
4
+ case `uname` in
5
+ *CYGWIN*|*MINGW*|*MSYS*)
6
+ if command -v cygpath > /dev/null 2>&1; then
7
+ basedir=`cygpath -w "$basedir"`
8
+ fi
9
+ ;;
10
+ esac
11
+
12
+ if [ -z "$NODE_PATH" ]; then
13
+ export NODE_PATH="/home/runner/work/skybridge/skybridge/node_modules/.pnpm/vite@7.3.1_@types+node@25.2.2_jiti@2.6.1_lightningcss@1.30.2_terser@5.44.1_tsx@4.21.0_yaml@2.8.2/node_modules/vite/bin/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/vite@7.3.1_@types+node@25.2.2_jiti@2.6.1_lightningcss@1.30.2_terser@5.44.1_tsx@4.21.0_yaml@2.8.2/node_modules/vite/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/vite@7.3.1_@types+node@25.2.2_jiti@2.6.1_lightningcss@1.30.2_terser@5.44.1_tsx@4.21.0_yaml@2.8.2/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/node_modules"
14
+ else
15
+ export NODE_PATH="/home/runner/work/skybridge/skybridge/node_modules/.pnpm/vite@7.3.1_@types+node@25.2.2_jiti@2.6.1_lightningcss@1.30.2_terser@5.44.1_tsx@4.21.0_yaml@2.8.2/node_modules/vite/bin/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/vite@7.3.1_@types+node@25.2.2_jiti@2.6.1_lightningcss@1.30.2_terser@5.44.1_tsx@4.21.0_yaml@2.8.2/node_modules/vite/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/vite@7.3.1_@types+node@25.2.2_jiti@2.6.1_lightningcss@1.30.2_terser@5.44.1_tsx@4.21.0_yaml@2.8.2/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/node_modules:$NODE_PATH"
16
+ fi
17
+ if [ -x "$basedir/node" ]; then
18
+ exec "$basedir/node" "$basedir/../vite/bin/vite.js" "$@"
19
+ else
20
+ exec node "$basedir/../vite/bin/vite.js" "$@"
21
+ fi
@@ -0,0 +1,5 @@
1
+ {
2
+ "watch": ["server/src"],
3
+ "ext": "ts,json",
4
+ "exec": "tsx server/src/index.ts"
5
+ }
@@ -4,18 +4,35 @@
4
4
  "private": true,
5
5
  "description": "Alpic MCP Server Template",
6
6
  "type": "module",
7
- "packageManager": "pnpm@10.18.3",
8
7
  "scripts": {
9
- "dev": "pnpm --filter @apps-sdk-template/server dev",
10
- "build": "pnpm web:build && rm -rf server/dist && pnpm --filter=@apps-sdk-template/server --prod deploy server/dist && cp -r web/dist server/dist/assets && pnpm --filter=@apps-sdk-template/server build",
11
- "start": "pnpm server:start",
12
- "inspector": "pnpm --filter @apps-sdk-template/server inspector",
13
- "server:build": "pnpm --filter @apps-sdk-template/server build",
14
- "server:start": "pnpm --filter @apps-sdk-template/server start",
15
- "web:build": "pnpm --filter @apps-sdk-template/web build",
16
- "web:preview": "pnpm --filter @apps-sdk-template/web preview"
8
+ "dev": "skybridge dev",
9
+ "build": "skybridge build",
10
+ "start": "skybridge start",
11
+ "deploy": "alpic deploy"
12
+ },
13
+ "dependencies": {
14
+ "@modelcontextprotocol/sdk": "^1.26.0",
15
+ "cors": "^2.8.6",
16
+ "express": "^5.2.1",
17
+ "react": "^19.2.4",
18
+ "react-dom": "^19.2.4",
19
+ "skybridge": ">=0.29.1 <1.0.0",
20
+ "vite": "^7.3.1",
21
+ "zod": "^4.3.6"
17
22
  },
18
23
  "devDependencies": {
19
- "tsx": "^4.19.4"
24
+ "@skybridge/devtools": ">=0.26.1 <1.0.0",
25
+ "@types/cors": "^2.8.19",
26
+ "@types/express": "^5.0.6",
27
+ "@types/react": "^19.2.13",
28
+ "@types/react-dom": "^19.2.3",
29
+ "@vitejs/plugin-react": "^5.1.4",
30
+ "alpic": "^1.85.0",
31
+ "nodemon": "^3.1.11",
32
+ "tsx": "^4.21.0",
33
+ "typescript": "^5.9.3"
34
+ },
35
+ "engines": {
36
+ "node": ">=24.13.1"
20
37
  }
21
38
  }
@@ -1,34 +1,62 @@
1
- import express, { type Express } from "express";
2
-
3
- import { widgetsDevServer } from "skybridge/server";
4
- import type { ViteDevServer } from "vite";
5
- import { env } from "./env.js";
6
- import { mcp } from "./middleware.js";
7
- import server from "./server.js";
8
-
9
- const app = express() as Express & { vite: ViteDevServer };
10
-
11
- app.use(express.json());
12
-
13
- app.use(mcp(server));
14
-
15
- if (env.NODE_ENV !== "production") {
16
- app.use(await widgetsDevServer());
17
- }
18
-
19
- app.listen(3000, (error) => {
20
- if (error) {
21
- console.error("Failed to start server:", error);
22
- process.exit(1);
23
- }
24
-
25
- console.log(`Server listening on port 3000 - ${env.NODE_ENV}`);
26
- console.log(
27
- "Make your local server accessible with 'ngrok http 3000' and connect to ChatGPT with URL https://xxxxxx.ngrok-free.app/mcp",
28
- );
29
- });
30
-
31
- process.on("SIGINT", async () => {
32
- console.log("Server shutdown complete");
33
- process.exit(0);
34
- });
1
+ import { McpServer } from "skybridge/server";
2
+ import { z } from "zod";
3
+
4
+ const Answers = [
5
+ "As I see it, yes",
6
+ "Don't count on it",
7
+ "It is certain",
8
+ "It is decidedly so",
9
+ "Most likely",
10
+ "My reply is no",
11
+ "My sources say no",
12
+ "Outlook good",
13
+ "Outlook not so good",
14
+ "Signs point to yes",
15
+ "Very doubtful",
16
+ "Without a doubt",
17
+ "Yes definitely",
18
+ "Yes",
19
+ "You may rely on it",
20
+ ];
21
+
22
+ const server = new McpServer(
23
+ {
24
+ name: "alpic-openai-app",
25
+ version: "0.0.1",
26
+ },
27
+ { capabilities: {} },
28
+ ).registerWidget(
29
+ "magic-8-ball",
30
+ {
31
+ description: "Magic 8 Ball",
32
+ },
33
+ {
34
+ description: "For fortune-telling or seeking advice.",
35
+ inputSchema: {
36
+ question: z.string().describe("The user question."),
37
+ },
38
+ },
39
+ async ({ question }) => {
40
+ try {
41
+ // deterministic answer
42
+ const hash = question
43
+ .split("")
44
+ .reduce((acc, char) => acc + char.charCodeAt(0), 0);
45
+ const answer = Answers[hash % Answers.length];
46
+ return {
47
+ structuredContent: { answer },
48
+ content: [],
49
+ isError: false,
50
+ };
51
+ } catch (error) {
52
+ return {
53
+ content: [{ type: "text", text: `Error: ${error}` }],
54
+ isError: true,
55
+ };
56
+ }
57
+ },
58
+ );
59
+
60
+ server.run();
61
+
62
+ export type AppType = typeof server;
@@ -0,0 +1,23 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "ESNext",
5
+ "moduleResolution": "bundler",
6
+ "lib": ["ES2022", "DOM", "DOM.Iterable"],
7
+ "jsx": "react-jsx",
8
+
9
+ "strict": true,
10
+ "skipLibCheck": true,
11
+ "esModuleInterop": true,
12
+ "forceConsistentCasingInFileNames": true,
13
+ "verbatimModuleSyntax": true,
14
+
15
+ "noUnusedLocals": true,
16
+ "noUnusedParameters": true,
17
+ "noFallthroughCasesInSwitch": true,
18
+
19
+ "noEmit": true
20
+ },
21
+ "include": ["server/src", "web/src", "web/vite.config.ts"],
22
+ "exclude": ["dist", "node_modules"]
23
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "noEmit": false,
5
+ "outDir": "dist",
6
+ "sourceMap": true,
7
+ "declaration": true
8
+ },
9
+ "include": ["server/src"],
10
+ "exclude": ["dist", "node_modules"]
11
+ }
@@ -1,4 +1,4 @@
1
1
  import { generateHelpers } from "skybridge/web";
2
- import type { AppType } from "../../server/src/server";
2
+ import type { AppType } from "../../server/src/index.js";
3
3
 
4
4
  export const { useToolInfo } = generateHelpers<AppType>();
@@ -1,12 +1,23 @@
1
+ @import url("https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@1,600&display=swap");
2
+
1
3
  .container {
2
4
  display: flex;
3
5
  justify-content: center;
4
6
  align-items: center;
5
- height: 100%;
7
+ min-height: 100%;
8
+ max-height: 100%;
9
+ overflow: hidden;
10
+ padding: 1rem;
11
+ box-sizing: border-box;
6
12
  }
7
13
 
8
14
  .ball {
9
- background-color: black;
15
+ background: radial-gradient(
16
+ circle at 30% 30%,
17
+ #454565 0%,
18
+ #1c1c30 40%,
19
+ #0a0a10 100%
20
+ );
10
21
  border-radius: 50%;
11
22
  width: 12rem;
12
23
  height: 12rem;
@@ -15,16 +26,129 @@
15
26
  align-items: center;
16
27
  justify-content: center;
17
28
  font-family: monospace;
29
+ text-align: center;
30
+ position: relative;
31
+ box-shadow:
32
+ 0 10px 30px rgba(0, 0, 0, 0.5),
33
+ 0 5px 15px rgba(0, 0, 0, 0.3),
34
+ inset 0 -20px 40px rgba(0, 0, 0, 0.6);
35
+ animation:
36
+ float 3s ease-in-out infinite,
37
+ colorShift 15s ease-in-out infinite;
38
+ transition: transform 0.3s ease;
39
+ cursor: pointer;
40
+ border: 1px solid rgba(30, 30, 50, 0.6);
41
+ }
42
+
43
+ .ball:hover {
44
+ transform: scale(1.05) translateY(-8px);
45
+ animation: colorShift 15s ease-in-out infinite;
46
+ box-shadow:
47
+ 0 20px 50px rgba(0, 0, 0, 0.6),
48
+ 0 10px 25px rgba(0, 0, 0, 0.4),
49
+ inset 0 -20px 40px rgba(0, 0, 0, 0.6);
50
+ }
51
+
52
+ @keyframes float {
53
+ 0%,
54
+ 100% {
55
+ transform: translateY(0);
56
+ }
57
+ 50% {
58
+ transform: translateY(-8px);
59
+ }
60
+ }
61
+
62
+ @keyframes colorShift {
63
+ 0%,
64
+ 100% {
65
+ background: radial-gradient(
66
+ circle at 30% 30%,
67
+ #454565 0%,
68
+ #1c1c30 40%,
69
+ #0a0a10 100%
70
+ );
71
+ }
72
+ 25% {
73
+ background: radial-gradient(
74
+ circle at 30% 30%,
75
+ #3f4a65 0%,
76
+ #181e30 40%,
77
+ #090a10 100%
78
+ );
79
+ }
80
+ 50% {
81
+ background: radial-gradient(
82
+ circle at 30% 30%,
83
+ #3a5065 0%,
84
+ #152230 40%,
85
+ #080a10 100%
86
+ );
87
+ }
88
+ 75% {
89
+ background: radial-gradient(
90
+ circle at 30% 30%,
91
+ #3f4a65 0%,
92
+ #181e30 40%,
93
+ #090a10 100%
94
+ );
95
+ }
96
+ }
97
+
98
+ .ball::before {
99
+ content: "";
100
+ position: absolute;
101
+ top: 8%;
102
+ left: 20%;
103
+ width: 30%;
104
+ height: 20%;
105
+ background: radial-gradient(
106
+ ellipse,
107
+ rgba(255, 255, 255, 0.3) 0%,
108
+ transparent 70%
109
+ );
110
+ border-radius: 50%;
111
+ pointer-events: none;
112
+ }
113
+
114
+ .ball::after {
115
+ content: "";
116
+ position: absolute;
117
+ bottom: 8%;
118
+ right: 25%;
119
+ width: 25%;
120
+ height: 10%;
121
+ background: radial-gradient(
122
+ ellipse,
123
+ rgba(255, 255, 255, 0.1) 0%,
124
+ transparent 70%
125
+ );
126
+ border-radius: 50%;
127
+ pointer-events: none;
18
128
  }
19
129
 
20
130
  .question {
21
- font-size: 0.75rem;
131
+ font-size: clamp(0.5rem, 2vw, 0.75rem);
22
132
  color: lightgrey;
133
+ max-width: 90%;
134
+ word-wrap: break-word;
135
+ overflow-wrap: break-word;
136
+ text-align: center;
137
+ line-height: 1.3;
138
+ font-style: italic;
23
139
  }
24
140
 
25
141
  .answer {
26
- font-size: 1.125rem;
27
- font-weight: bold;
142
+ font-family: "Playfair Display", serif;
143
+ font-style: italic;
144
+ font-size: 1.25rem;
145
+ font-weight: 600;
28
146
  margin-top: 0.5rem;
29
- color: aqua;
147
+ color: #7dd3fc;
148
+ text-shadow: 0 0 10px rgba(125, 211, 252, 0.5);
149
+ max-width: 90%;
150
+ word-wrap: break-word;
151
+ overflow-wrap: break-word;
152
+ text-align: center;
153
+ line-height: 1.3;
30
154
  }
@@ -5,13 +5,18 @@ import { useToolInfo } from "../helpers";
5
5
 
6
6
  function Magic8Ball() {
7
7
  const { input, output } = useToolInfo<"magic-8-ball">();
8
- if (!output) return <div>Shaking...</div>;
9
8
 
10
9
  return (
11
10
  <div className="container">
12
11
  <div className="ball">
13
- <div className="question">{input.question}</div>
14
- <div className="answer">{output.answer}</div>
12
+ {output ? (
13
+ <>
14
+ <div className="question">{input.question}</div>
15
+ <div className="answer">{output.answer}</div>
16
+ </>
17
+ ) : (
18
+ <div className="question">Shaking...</div>
19
+ )}
15
20
  </div>
16
21
  </div>
17
22
  );
@@ -1,12 +1,12 @@
1
1
  import path from "node:path";
2
2
  import react from "@vitejs/plugin-react";
3
3
  import { skybridge } from "skybridge/web";
4
- import { defineConfig } from "vite";
4
+ import { defineConfig, type PluginOption } from "vite";
5
5
 
6
6
  // https://vite.dev/config/
7
7
  export default defineConfig({
8
- plugins: [skybridge(), react()],
9
-
8
+ plugins: [skybridge() as PluginOption, react()],
9
+ root: __dirname,
10
10
  resolve: {
11
11
  alias: {
12
12
  "@": path.resolve(__dirname, "./src"),
@@ -1,7 +0,0 @@
1
- packages:
2
- - "web"
3
- - "server"
4
- sharedWorkspaceLockfile: false
5
-
6
- catalog:
7
- skybridge: ^0.13.1
@@ -1,5 +0,0 @@
1
- {
2
- "watch": ["src/**/*"],
3
- "ext": "ts,js,json",
4
- "exec": "tsx src/index.ts"
5
- }
@@ -1,34 +0,0 @@
1
- {
2
- "name": "@apps-sdk-template/server",
3
- "version": "0.0.1",
4
- "private": true,
5
- "main": "dist/index.js",
6
- "description": "Alpic MCP Server Template",
7
- "files": [
8
- "dist"
9
- ],
10
- "type": "module",
11
- "scripts": {
12
- "dev": "nodemon",
13
- "build": "tsc",
14
- "start": "node dist/index.js",
15
- "inspector": "mcp-inspector http://localhost:3000/mcp"
16
- },
17
- "dependencies": {
18
- "@modelcontextprotocol/sdk": "^1.24.3",
19
- "@t3-oss/env-core": "^0.13.8",
20
- "dotenv": "^17.2.3",
21
- "express": "^5.1.0",
22
- "skybridge": "catalog:",
23
- "vite": "^7.1.11",
24
- "zod": "^4.1.13"
25
- },
26
- "devDependencies": {
27
- "@modelcontextprotocol/inspector": "^0.17.5",
28
- "@types/express": "^5.0.3",
29
- "@types/node": "^22.15.30",
30
- "nodemon": "^3.1.10",
31
- "tsx": "^4.19.2",
32
- "typescript": "^5.7.2"
33
- }
34
- }
@@ -1,12 +0,0 @@
1
- import "dotenv/config";
2
-
3
- import { createEnv } from "@t3-oss/env-core";
4
- import { z } from "zod";
5
-
6
- export const env = createEnv({
7
- server: {
8
- NODE_ENV: z.enum(["development", "production"]).default("development"),
9
- },
10
- runtimeEnv: process.env,
11
- emptyStringAsUndefined: true,
12
- });
@@ -1,54 +0,0 @@
1
- import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
2
- import type { NextFunction, Request, Response } from "express";
3
-
4
- import type { McpServer } from "skybridge/server";
5
-
6
- export const mcp =
7
- (server: McpServer) =>
8
- async (req: Request, res: Response, next: NextFunction) => {
9
- // Only handle requests to the /mcp path
10
- if (req.path !== "/mcp") {
11
- return next();
12
- }
13
-
14
- if (req.method === "POST") {
15
- try {
16
- const transport = new StreamableHTTPServerTransport({
17
- sessionIdGenerator: undefined,
18
- });
19
-
20
- res.on("close", () => {
21
- transport.close();
22
- });
23
-
24
- await server.connect(transport);
25
-
26
- await transport.handleRequest(req, res, req.body);
27
- } catch (error) {
28
- console.error("Error handling MCP request:", error);
29
- if (!res.headersSent) {
30
- res.status(500).json({
31
- jsonrpc: "2.0",
32
- error: {
33
- code: -32603,
34
- message: "Internal server error",
35
- },
36
- id: null,
37
- });
38
- }
39
- }
40
- } else if (req.method === "GET" || req.method === "DELETE") {
41
- res.writeHead(405).end(
42
- JSON.stringify({
43
- jsonrpc: "2.0",
44
- error: {
45
- code: -32000,
46
- message: "Method not allowed.",
47
- },
48
- id: null,
49
- }),
50
- );
51
- } else {
52
- next();
53
- }
54
- };
@@ -1,79 +0,0 @@
1
- import { McpServer } from "skybridge/server";
2
- import { z } from "zod";
3
-
4
- const Answers = [
5
- "As I see it, yes",
6
- "Ask again later",
7
- "Better not tell you now",
8
- "Cannot predict now",
9
- "Concentrate and ask again",
10
- "Don't count on it",
11
- "It is certain",
12
- "It is decidedly so",
13
- "Most likely",
14
- "My reply is no",
15
- "My sources say no",
16
- "Outlook good",
17
- "Outlook not so good",
18
- "Reply hazy, try again",
19
- "Signs point to yes",
20
- "Very doubtful",
21
- "Without a doubt",
22
- "Yes definitely",
23
- "Yes",
24
- "You may rely on it",
25
- ];
26
-
27
- const server = new McpServer(
28
- {
29
- name: "alpic-openai-app",
30
- version: "0.0.1",
31
- },
32
- { capabilities: {} },
33
- ).registerWidget(
34
- "magic-8-ball",
35
- {
36
- description: "Magic 8 Ball",
37
- },
38
- {
39
- description: "For fortune-telling or seeking advice.",
40
- inputSchema: {
41
- question: z.string().describe("The user question."),
42
- },
43
- },
44
- async ({ question }) => {
45
- try {
46
- // deterministic answer
47
- const hash = question
48
- .split("")
49
- .reduce((acc, char) => acc + char.charCodeAt(0), 0);
50
- const answer = Answers[hash % Answers.length];
51
- return {
52
- /**
53
- * Arbitrary JSON passed only to the component.
54
- * Use it for data that should not influence the model’s reasoning, like the full set of locations that backs a dropdown.
55
- * _meta is never shown to the model.
56
- */
57
- _meta: {},
58
- /**
59
- * Structured data that is used to hydrate your component.
60
- * ChatGPT injects this object into your iframe as window.openai.toolOutput
61
- */
62
- structuredContent: { answer },
63
- /**
64
- * Optional free-form text that the model receives verbatim
65
- */
66
- content: [],
67
- isError: false,
68
- };
69
- } catch (error) {
70
- return {
71
- content: [{ type: "text", text: `Error: ${error}` }],
72
- isError: true,
73
- };
74
- }
75
- },
76
- );
77
-
78
- export default server;
79
- export type AppType = typeof server;
@@ -1,17 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ESNext",
4
- "module": "ESNext",
5
- "moduleResolution": "bundler",
6
- "esModuleInterop": true,
7
- "strict": true,
8
- "skipLibCheck": true,
9
- "forceConsistentCasingInFileNames": true,
10
- "outDir": "dist",
11
- "sourceMap": true,
12
- "jsx": "react",
13
- "inlineSources": true
14
- },
15
- "include": ["**/*.ts", "**/*.tsx"],
16
- "exclude": ["dist", "node_modules"]
17
- }