create-skybridge 0.0.0-dev.e743e37 → 0.0.0-dev.e76a366
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/dist/index.js +19 -14
- package/dist/index.test.js +4 -2
- package/package.json +7 -7
- package/template/.dockerignore +4 -0
- package/template/AGENTS.md +1 -1
- package/template/Dockerfile +53 -0
- package/template/README.md +15 -20
- package/template/_gitignore +2 -1
- package/template/node_modules/.bin/alpic +2 -2
- package/template/node_modules/.bin/sb +2 -2
- package/template/node_modules/.bin/skybridge +2 -2
- package/template/node_modules/.bin/tsc +2 -2
- package/template/node_modules/.bin/tsserver +2 -2
- package/template/node_modules/.bin/tsx +2 -2
- package/template/node_modules/.bin/vite +2 -2
- package/template/package.json +17 -9
- package/template/src/helpers.ts +4 -0
- package/template/src/index.css +59 -0
- package/template/src/server.ts +77 -0
- package/template/src/views/components/doc-link.tsx +22 -0
- package/template/src/views/components/doc.tsx +21 -0
- package/template/src/views/components/nav.tsx +31 -0
- package/template/src/views/components/progress.tsx +35 -0
- package/template/src/views/components/steps/outro.tsx +68 -0
- package/template/src/views/components/steps/state.tsx +47 -0
- package/template/src/views/components/steps/tool-call.tsx +53 -0
- package/template/src/views/components/steps/tool-output.tsx +40 -0
- package/template/src/views/images/mascot/beret.png +0 -0
- package/template/src/views/images/mascot/chapka.png +0 -0
- package/template/src/views/images/mascot/cowboy-hat.png +0 -0
- package/template/src/views/images/mascot/fez.png +0 -0
- package/template/src/views/images/mascot/jester-hat.png +0 -0
- package/template/src/views/images/mascot/mitre.png +0 -0
- package/template/src/views/images/mascot/non-la.png +0 -0
- package/template/src/views/images/mascot/original.png +0 -0
- package/template/src/views/images/mascot/propeller-beanie.png +0 -0
- package/template/src/views/images/mascot/ski-mask.png +0 -0
- package/template/src/views/images/mascot/sombrero.png +0 -0
- package/template/src/views/images/mascot/top-hat.png +0 -0
- package/template/src/views/images/mascot/viking-helmet.png +0 -0
- package/template/src/views/onboarding.tsx +63 -0
- package/template/src/views/use-mascot.ts +60 -0
- package/template/src/vite-manifest.d.ts +4 -0
- package/template/tsconfig.json +4 -2
- package/template/vite.config.ts +14 -0
- package/template/server/src/index.ts +0 -62
- package/template/web/src/helpers.ts +0 -4
- package/template/web/src/index.css +0 -154
- package/template/web/src/widgets/magic-8-ball.tsx +0 -27
- package/template/web/vite.config.ts +0 -15
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Tooltip,
|
|
3
|
+
TooltipContent,
|
|
4
|
+
TooltipTrigger,
|
|
5
|
+
} from "@alpic-ai/ui/components/tooltip";
|
|
6
|
+
|
|
7
|
+
export default function Progress({
|
|
8
|
+
steps,
|
|
9
|
+
current,
|
|
10
|
+
onSelect,
|
|
11
|
+
}: {
|
|
12
|
+
steps: readonly string[];
|
|
13
|
+
current: number;
|
|
14
|
+
onSelect: (index: number) => void;
|
|
15
|
+
}) {
|
|
16
|
+
return (
|
|
17
|
+
<div className="flex gap-1.5">
|
|
18
|
+
{steps.map((label, i) => (
|
|
19
|
+
<Tooltip key={label}>
|
|
20
|
+
<TooltipTrigger asChild>
|
|
21
|
+
<button
|
|
22
|
+
type="button"
|
|
23
|
+
onClick={() => onSelect(i)}
|
|
24
|
+
className={`relative h-1 flex-1 rounded-full transition-opacity before:absolute before:-inset-y-5 before:inset-x-0 before:content-[''] [@media(hover:hover)]:hover:opacity-70 ${
|
|
25
|
+
i <= current ? "bg-primary" : "bg-muted"
|
|
26
|
+
}`}
|
|
27
|
+
aria-label={label}
|
|
28
|
+
/>
|
|
29
|
+
</TooltipTrigger>
|
|
30
|
+
<TooltipContent>{label}</TooltipContent>
|
|
31
|
+
</Tooltip>
|
|
32
|
+
))}
|
|
33
|
+
</div>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Card,
|
|
3
|
+
CardContent,
|
|
4
|
+
CardDescription,
|
|
5
|
+
CardTitle,
|
|
6
|
+
} from "@alpic-ai/ui/components/card";
|
|
7
|
+
import { BookOpen, CircleStar } from "lucide-react";
|
|
8
|
+
import { useOpenExternal } from "skybridge/web";
|
|
9
|
+
|
|
10
|
+
const LINKS = [
|
|
11
|
+
{
|
|
12
|
+
icon: CircleStar,
|
|
13
|
+
title: "See the examples",
|
|
14
|
+
description:
|
|
15
|
+
"Templates for OAuth, e-commerce, dashboards, games, and many more.",
|
|
16
|
+
href: "https://docs.skybridge.tech/showcase#examples",
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
icon: BookOpen,
|
|
20
|
+
title: "Read the docs",
|
|
21
|
+
description: "Learn more about Skybridge concepts, API, and tooling.",
|
|
22
|
+
href: "https://docs.skybridge.tech",
|
|
23
|
+
},
|
|
24
|
+
];
|
|
25
|
+
|
|
26
|
+
export default function Outro() {
|
|
27
|
+
// useOpenExternal: open a URL in a new browser tab from inside the iframe.
|
|
28
|
+
const openExternal = useOpenExternal();
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<>
|
|
32
|
+
<div className="flex flex-1 flex-col justify-center gap-3">
|
|
33
|
+
<h1 className="type-display-xs font-mozilla font-semibold text-primary">
|
|
34
|
+
That's a wrap!
|
|
35
|
+
</h1>
|
|
36
|
+
<p>
|
|
37
|
+
You've just mastered how{" "}
|
|
38
|
+
<strong>
|
|
39
|
+
the data flows between the tools, the view, and the model
|
|
40
|
+
</strong>
|
|
41
|
+
. You can start{" "}
|
|
42
|
+
<span className="bg-gradient-to-r from-primary via-cyan-500 to-primary bg-[length:200%_100%] bg-clip-text text-transparent font-semibold animate-gradient-flow">
|
|
43
|
+
vibing
|
|
44
|
+
</span>{" "}
|
|
45
|
+
now from this very template or:
|
|
46
|
+
</p>
|
|
47
|
+
</div>
|
|
48
|
+
<div className="grid grid-cols-2 gap-3 mt-auto">
|
|
49
|
+
{LINKS.map(({ icon: Icon, title, description, href }) => (
|
|
50
|
+
<Card
|
|
51
|
+
key={title}
|
|
52
|
+
hoverable
|
|
53
|
+
className="cursor-pointer bg-white/50 dark:bg-zinc-900/50"
|
|
54
|
+
onClick={() => openExternal(href)}
|
|
55
|
+
>
|
|
56
|
+
<CardContent className="flex flex-col gap-2">
|
|
57
|
+
<div className="flex items-center gap-3">
|
|
58
|
+
<Icon className="size-5 shrink-0 text-primary" />
|
|
59
|
+
<CardTitle>{title}</CardTitle>
|
|
60
|
+
</div>
|
|
61
|
+
<CardDescription>{description}</CardDescription>
|
|
62
|
+
</CardContent>
|
|
63
|
+
</Card>
|
|
64
|
+
))}
|
|
65
|
+
</div>
|
|
66
|
+
</>
|
|
67
|
+
);
|
|
68
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Button } from "@alpic-ai/ui/components/button";
|
|
2
|
+
import { HatGlasses } from "lucide-react";
|
|
3
|
+
import Doc from "@/views/components/doc.js";
|
|
4
|
+
import DocLink from "@/views/components/doc-link.js";
|
|
5
|
+
import { useMascot } from "@/views/use-mascot.js";
|
|
6
|
+
|
|
7
|
+
export default function State() {
|
|
8
|
+
const { hat, changeHat } = useMascot();
|
|
9
|
+
|
|
10
|
+
return (
|
|
11
|
+
<>
|
|
12
|
+
<div className="flex flex-1 flex-col justify-center gap-3">
|
|
13
|
+
<p>
|
|
14
|
+
The <strong>view state</strong> can be shared with the model:
|
|
15
|
+
</p>
|
|
16
|
+
<div className="flex">
|
|
17
|
+
<Button variant="cta" onClick={changeHat}>
|
|
18
|
+
<HatGlasses />
|
|
19
|
+
Change my hat
|
|
20
|
+
</Button>
|
|
21
|
+
</div>
|
|
22
|
+
<p className={`mt-2 ${hat ? "" : "invisible"}`} aria-hidden={!hat}>
|
|
23
|
+
Now, the LLM also knows I'm wearing a glorious{" "}
|
|
24
|
+
<span
|
|
25
|
+
// data-llm: describe what the user views to the model so they can collaborate
|
|
26
|
+
data-llm={`Mascot is wearing ${hat}`}
|
|
27
|
+
className="text-primary font-mozilla"
|
|
28
|
+
>
|
|
29
|
+
{hat}
|
|
30
|
+
</span>
|
|
31
|
+
.
|
|
32
|
+
</p>
|
|
33
|
+
</div>
|
|
34
|
+
<Doc>
|
|
35
|
+
Use{" "}
|
|
36
|
+
<DocLink href="https://docs.skybridge.tech/api-reference/use-view-state">
|
|
37
|
+
useViewState
|
|
38
|
+
</DocLink>{" "}
|
|
39
|
+
to update the context and{" "}
|
|
40
|
+
<DocLink href="https://docs.skybridge.tech/api-reference/data-llm">
|
|
41
|
+
data-llm
|
|
42
|
+
</DocLink>{" "}
|
|
43
|
+
to describe the UI.
|
|
44
|
+
</Doc>
|
|
45
|
+
</>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Button } from "@alpic-ai/ui/components/button";
|
|
2
|
+
import { Cookie } from "lucide-react";
|
|
3
|
+
import { useEffect, useState } from "react";
|
|
4
|
+
import { useCallTool } from "@/helpers.js";
|
|
5
|
+
import Doc from "@/views/components/doc.js";
|
|
6
|
+
import DocLink from "@/views/components/doc-link.js";
|
|
7
|
+
|
|
8
|
+
export default function ToolCall() {
|
|
9
|
+
// useCallTool: invoke a server tool from within the view.
|
|
10
|
+
const { callTool, isPending, data } = useCallTool("get-fortune-cookie");
|
|
11
|
+
const [prediction, setPrediction] = useState<string | null>(null);
|
|
12
|
+
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
if (data) {
|
|
15
|
+
setPrediction(data.structuredContent.prediction);
|
|
16
|
+
}
|
|
17
|
+
}, [data]);
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<>
|
|
21
|
+
<div className="flex flex-1 flex-col justify-center gap-3">
|
|
22
|
+
<p className="">
|
|
23
|
+
<strong>Tools</strong> can also be triggered from the view:
|
|
24
|
+
</p>
|
|
25
|
+
<div className="flex">
|
|
26
|
+
<Button
|
|
27
|
+
variant="cta"
|
|
28
|
+
loading={isPending}
|
|
29
|
+
icon={<Cookie />}
|
|
30
|
+
onClick={() => callTool()}
|
|
31
|
+
>
|
|
32
|
+
<code>get-fortune-cookie</code>
|
|
33
|
+
</Button>
|
|
34
|
+
</div>
|
|
35
|
+
<p
|
|
36
|
+
className={`font-mozilla italic text-primary mt-2 ${
|
|
37
|
+
prediction ? "" : "invisible"
|
|
38
|
+
}`}
|
|
39
|
+
aria-hidden={!prediction}
|
|
40
|
+
>
|
|
41
|
+
{prediction || "none"}
|
|
42
|
+
</p>
|
|
43
|
+
</div>
|
|
44
|
+
<Doc>
|
|
45
|
+
Use{" "}
|
|
46
|
+
<DocLink href="https://docs.skybridge.tech/api-reference/use-call-tool">
|
|
47
|
+
useCallTool
|
|
48
|
+
</DocLink>{" "}
|
|
49
|
+
to request tools from within the view.
|
|
50
|
+
</Doc>
|
|
51
|
+
</>
|
|
52
|
+
);
|
|
53
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { useToolInfo } from "@/helpers.js";
|
|
2
|
+
import Doc from "@/views/components/doc.js";
|
|
3
|
+
import DocLink from "@/views/components/doc-link.js";
|
|
4
|
+
|
|
5
|
+
export default function ToolOutput() {
|
|
6
|
+
// useToolInfo: read the input, output and metadata of the tool that opened this view.
|
|
7
|
+
const { output } = useToolInfo<"start">();
|
|
8
|
+
const name = output?.name;
|
|
9
|
+
|
|
10
|
+
return (
|
|
11
|
+
<>
|
|
12
|
+
<div className="flex flex-1 flex-col justify-center gap-3">
|
|
13
|
+
<h1 className="type-display-xs font-mozilla font-semibold">
|
|
14
|
+
Greetings,{" "}
|
|
15
|
+
<span className="text-primary">{name ?? "stranger"} !</span>
|
|
16
|
+
</h1>
|
|
17
|
+
{name ? (
|
|
18
|
+
<p>
|
|
19
|
+
You're wondering how do I know your name, don't you? Well, it's
|
|
20
|
+
because the view reads the <strong>tool output</strong>. The LLM
|
|
21
|
+
knows about it too.
|
|
22
|
+
</p>
|
|
23
|
+
) : (
|
|
24
|
+
<p>
|
|
25
|
+
The view reads the <strong>tool output</strong>, but no{" "}
|
|
26
|
+
<code>name</code> was passed this time. Try again with you surname
|
|
27
|
+
to see with this view personalize.
|
|
28
|
+
</p>
|
|
29
|
+
)}
|
|
30
|
+
</div>
|
|
31
|
+
<Doc>
|
|
32
|
+
Use{" "}
|
|
33
|
+
<DocLink href="https://docs.skybridge.tech/api-reference/use-tool-info">
|
|
34
|
+
useToolInfo
|
|
35
|
+
</DocLink>{" "}
|
|
36
|
+
to hydrates the view with tool input, output and metadata.
|
|
37
|
+
</Doc>
|
|
38
|
+
</>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import "@/index.css";
|
|
2
|
+
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { useLayout } from "skybridge/web";
|
|
5
|
+
import Nav from "./components/nav.js";
|
|
6
|
+
import Progress from "./components/progress.js";
|
|
7
|
+
import Outro from "./components/steps/outro.js";
|
|
8
|
+
import State from "./components/steps/state.js";
|
|
9
|
+
import ToolCall from "./components/steps/tool-call.js";
|
|
10
|
+
import ToolOutput from "./components/steps/tool-output.js";
|
|
11
|
+
import { useMascot } from "./use-mascot.js";
|
|
12
|
+
|
|
13
|
+
const STEPS = [
|
|
14
|
+
{ label: "Reading tool output", Component: ToolOutput },
|
|
15
|
+
{ label: "Sharing view state", Component: State },
|
|
16
|
+
{ label: "Calling tools", Component: ToolCall },
|
|
17
|
+
{ label: "Examples & docs", Component: Outro },
|
|
18
|
+
] as const;
|
|
19
|
+
|
|
20
|
+
export default function Onboarding() {
|
|
21
|
+
// useLayout: read host layout info (theme, display mode, locale, ...).
|
|
22
|
+
const { theme } = useLayout();
|
|
23
|
+
|
|
24
|
+
const [step, setStep] = useState(0);
|
|
25
|
+
const { img } = useMascot();
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<div
|
|
29
|
+
className={`${theme === "dark" ? "dark" : ""} mx-auto w-full max-w-4xl rounded-xl border border-border overflow-hidden bg-background text-foreground`}
|
|
30
|
+
>
|
|
31
|
+
<div className="min-h-[34rem] md:min-h-95 flex flex-col items-center gap-6 p-6 bg-gradient-to-br from-purple-50 via-white to-cyan-50 dark:from-purple-950/30 dark:via-zinc-950 dark:to-cyan-900/30 bg-[length:200%_200%] animate-aurora md:flex-row md:items-stretch">
|
|
32
|
+
<div className="shrink-0 self-center animate-float">
|
|
33
|
+
<img
|
|
34
|
+
src={img}
|
|
35
|
+
alt="Skybridge mascot"
|
|
36
|
+
className="h-32 w-32 md:h-50 md:w-50 object-contain animate-twirl"
|
|
37
|
+
/>
|
|
38
|
+
</div>
|
|
39
|
+
<div className="flex w-full flex-1 flex-col gap-6">
|
|
40
|
+
<Progress
|
|
41
|
+
steps={STEPS.map(({ label }) => label)}
|
|
42
|
+
current={step}
|
|
43
|
+
onSelect={setStep}
|
|
44
|
+
/>
|
|
45
|
+
<div className="grid flex-1">
|
|
46
|
+
{STEPS.map(({ label, Component }, i) => (
|
|
47
|
+
<div
|
|
48
|
+
key={label}
|
|
49
|
+
className={`col-start-1 row-start-1 flex flex-col gap-6 ${
|
|
50
|
+
step === i ? "" : "invisible pointer-events-none"
|
|
51
|
+
}`}
|
|
52
|
+
aria-hidden={step !== i}
|
|
53
|
+
>
|
|
54
|
+
<Component />
|
|
55
|
+
</div>
|
|
56
|
+
))}
|
|
57
|
+
</div>
|
|
58
|
+
<Nav current={step} total={STEPS.length} onChange={setStep} />
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
);
|
|
63
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
import { useViewState } from "skybridge/web";
|
|
3
|
+
import beret from "./images/mascot/beret.png";
|
|
4
|
+
import chapka from "./images/mascot/chapka.png";
|
|
5
|
+
import cowboyHat from "./images/mascot/cowboy-hat.png";
|
|
6
|
+
import fez from "./images/mascot/fez.png";
|
|
7
|
+
import jesterHat from "./images/mascot/jester-hat.png";
|
|
8
|
+
import mitre from "./images/mascot/mitre.png";
|
|
9
|
+
import nonLa from "./images/mascot/non-la.png";
|
|
10
|
+
import original from "./images/mascot/original.png";
|
|
11
|
+
import propellerBeanie from "./images/mascot/propeller-beanie.png";
|
|
12
|
+
import skiMask from "./images/mascot/ski-mask.png";
|
|
13
|
+
import sombrero from "./images/mascot/sombrero.png";
|
|
14
|
+
import topHat from "./images/mascot/top-hat.png";
|
|
15
|
+
import vikingHelmet from "./images/mascot/viking-helmet.png";
|
|
16
|
+
|
|
17
|
+
const Hats = {
|
|
18
|
+
beret,
|
|
19
|
+
chapka,
|
|
20
|
+
"cowboy hat": cowboyHat,
|
|
21
|
+
fez,
|
|
22
|
+
"jester hat": jesterHat,
|
|
23
|
+
mitre,
|
|
24
|
+
"nón lá": nonLa,
|
|
25
|
+
"propeller beanie": propellerBeanie,
|
|
26
|
+
"ski mask": skiMask,
|
|
27
|
+
sombrero,
|
|
28
|
+
"top hat": topHat,
|
|
29
|
+
"viking helmet": vikingHelmet,
|
|
30
|
+
} as const;
|
|
31
|
+
|
|
32
|
+
type HatLabel = keyof typeof Hats;
|
|
33
|
+
|
|
34
|
+
const LABELS = Object.keys(Hats) as HatLabel[];
|
|
35
|
+
|
|
36
|
+
export function useMascot() {
|
|
37
|
+
// useViewState: persist UI state on the host and surface it to the model.
|
|
38
|
+
const [state, setState] = useViewState<{ hat?: HatLabel }>({});
|
|
39
|
+
const { hat } = state;
|
|
40
|
+
const img = hat ? Hats[hat] : original;
|
|
41
|
+
|
|
42
|
+
// Preload all hats once so swaps are instant.
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
for (const src of Object.values(Hats)) {
|
|
45
|
+
new Image().src = src;
|
|
46
|
+
}
|
|
47
|
+
}, []);
|
|
48
|
+
|
|
49
|
+
return {
|
|
50
|
+
img,
|
|
51
|
+
hat,
|
|
52
|
+
changeHat: () => {
|
|
53
|
+
setState((prev) => {
|
|
54
|
+
const others = LABELS.filter((l) => l !== prev.hat);
|
|
55
|
+
const next = others[Math.floor(Math.random() * others.length)];
|
|
56
|
+
return { ...prev, hat: next };
|
|
57
|
+
});
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
}
|
package/template/tsconfig.json
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import tailwindcss from "@tailwindcss/vite";
|
|
3
|
+
import react from "@vitejs/plugin-react";
|
|
4
|
+
import { skybridge } from "skybridge/vite";
|
|
5
|
+
import { defineConfig } from "vite";
|
|
6
|
+
|
|
7
|
+
export default defineConfig({
|
|
8
|
+
plugins: [skybridge(), react(), tailwindcss()],
|
|
9
|
+
resolve: {
|
|
10
|
+
alias: {
|
|
11
|
+
"@": path.resolve(__dirname, "./src"),
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
});
|
|
@@ -1,62 +0,0 @@
|
|
|
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;
|
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
@import url("https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@1,600&display=swap");
|
|
2
|
-
|
|
3
|
-
.container {
|
|
4
|
-
display: flex;
|
|
5
|
-
justify-content: center;
|
|
6
|
-
align-items: center;
|
|
7
|
-
min-height: 100%;
|
|
8
|
-
max-height: 100%;
|
|
9
|
-
overflow: hidden;
|
|
10
|
-
padding: 1rem;
|
|
11
|
-
box-sizing: border-box;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.ball {
|
|
15
|
-
background: radial-gradient(
|
|
16
|
-
circle at 30% 30%,
|
|
17
|
-
#454565 0%,
|
|
18
|
-
#1c1c30 40%,
|
|
19
|
-
#0a0a10 100%
|
|
20
|
-
);
|
|
21
|
-
border-radius: 50%;
|
|
22
|
-
width: 12rem;
|
|
23
|
-
height: 12rem;
|
|
24
|
-
display: flex;
|
|
25
|
-
flex-direction: column;
|
|
26
|
-
align-items: center;
|
|
27
|
-
justify-content: center;
|
|
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;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
.question {
|
|
131
|
-
font-size: clamp(0.5rem, 2vw, 0.75rem);
|
|
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;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
.answer {
|
|
142
|
-
font-family: "Playfair Display", serif;
|
|
143
|
-
font-style: italic;
|
|
144
|
-
font-size: 1.25rem;
|
|
145
|
-
font-weight: 600;
|
|
146
|
-
margin-top: 0.5rem;
|
|
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;
|
|
154
|
-
}
|