1export default async function (e: Email) {
2
3}
15 * @returns Promise resolving to whether the project exists
16 */
17export async function valExists(valId: string): Promise<boolean> {
18 try {
19 await sdk.vals.retrieve(valId);
34 * @returns Promise resolving to the Val ID
35 */
36export async function resolveValId(identifier: string): Promise<string> {
37 // If it looks like a direct ID, return as-is
38 if (!identifier.startsWith("@")) {
72 * Determine the type of a Val file.
73 *
74 * This function attempts to determine the type of a file within a val
75 * based on its existing state on the server or its filename. The process...
76 * 1. Check if the file already exists in the Val at the specified path.
94 * @returns The val file type
95 */
96export async function getValItemType(
97 valId: string,
98 branchId: string,
1import { hi } from "https://esm.town/v/valdottown/test-townie-credits/error.tsx";
2export default async function (req: Request): Promise<Response> {
3 return Response.json({ ok: true });
4}
1import { ValTown } from "npm:";
2
3export function hi() {
4 return "hi";
5}
7
8
9export default async function (req: Request): Promise<Response> {
10 // Get URL info
11 const url = new URL(req.url);
109 * Handle proxy requests to the parquet host
110 */
111async function handleProxyRequest(
112 req: Request,
113 path: string,
18 transitionProperty: "background-color, color",
19 transitionDuration: "1s",
20 transitionTimingFunction: "ease-in-out",
21 "&:hover": {
22 backgroundColor: "magenta",
34};
35
36function App () {
37 return (
38 <html>
53}
54
55export default async function (req: Request): Promise<Response> {
56 const html = renderToString(<App />);
57 return new Response(html, {
43}
44
45export function jsxs (type: ElementType<any, keyof JSX.IntrinsicElements>, props: SXProps|null, key?: Key) {
46 return jsx(type, props, key);
47}
23});
24
25export function Messages ({
26 messages,
27 messageEndTimes,
58}
59
60function Message ({
61 message,
62 messageEndTimes,
86}
87
88function AssistantMessage ({ message, messageEndTimes, running }: {
89 message: Message;
90 messageEndTimes: Record<string, number>;
107}
108
109function Part ({ part }) {
110 switch (part.type) {
111 case "text":
122}
123
124function TextPart ({ part }) {
125 return (
126 <ReactMarkdown>
130}
131
132function Details ({ open, onClick, children, summary }) {
133 return (
134 <details
148}
149
150function ToolPart ({ part }) {
151 const { openSummaries, setOpenSummaries } = useContext(MessageContext);
152 const {
312}
313
314function EditorToolPart ({ part }) {
315 const { openSummaries, setOpenSummaries } = useContext(MessageContext);
316 const {
379}
380
381function UserMessage ({ message }: {
382 message: Message;
383}) {
114
115 // Sanitize error messages to remove any sensitive information
116 function sanitizeErrorMessage(message) {
117 if (!message) return "Unknown error";
118
125 }
126
127 function addQuery(id, sql) {
128 const container = document.createElement('div');
129 container.className = 'query';
146 }
147
148 function showTable(el, columns, rows) {
149 if (rows.length === 0) {
150 el.innerHTML = '<span class="success">No results</span>';
171 }
172
173 (async function() {
174 try {
175 // Initialize DuckDB
16}
17
18function buildTrie(words: string[]): TrieNode {
19 const root = new TrieNode();
20 for (const word of words) {
31}
32
33function findBoggleWords(board: { x: number; y: number; letter: string }[], wordList: string[]): string[] {
34 const trie = buildTrie(wordList);
35 const foundWords = new Set<string>();
49 ];
50
51 function isValidCell(x: number, y: number): boolean {
52 return x >= 0 && x < cols && y >= 0 && y < rows;
53 }
54
55 function dfs(x: number, y: number, node: TrieNode, visited: Set<string>, currentWord: string) {
56 // Out of bounds or already visited cell
57 const cellKey = `${x},${y}`;
93}
94
95export default function boggleSolver(
96 board: { x: number; y: number; letter: string }[],
97 wordList: string[] = wordListCache || [],