9const thisURL = parseProject(import.meta.url).links.self.project;
10
11function StatusRow({ rows }) {
12 return (
13 <div className="w-full flex flex-col space-y-2">
31}
32
33function StatusSection({ url, rows }) {
34 const sectionRows = rows.filter(row => row[0] === url);
35 const percentUp = Math.round((sectionRows.filter(row => row[1]).length / sectionRows.length) * 100);
47}
48
49export default async function(req: Request): Promise<Response> {
50 const { rows } = await sqlite.execute(
51 "select url, ok, duration, timestamp from uptime order by timestamp desc limit 200",
1/** @jsxImportSource https://esm.sh/react@18.2.0 */
2export function SparklineSVG({ strokeWidth = 2, data = [], fill = "none", stroke = "black" }) {
3 const padding = 2;
4 const xMargin = 25;
4const thisURL = parseProject(import.meta.url).links.self.latest;
5
6export async function notify(message: string) {
7 await email({ subject: message, text: `Email sent from ${thisURL}` });
8}
9const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
10
11export async function uptimeCheck(url: string, attempt = 1) {
12 let reason: string = "";
13 let status: number | null = null;
11// this cron updates a blob that the ../../shared/utils/pollEnabledStatus.ts hits during demos
12// that blob determines whether or not the cobrowsing button is ON or OFF
13export default async function (interval: Interval) {
14 // every page in the "Glancer demo" database should have it's own blob, so we have a cache for each demo
15 // this cron saves a blob for every page in the Demos DB
3import { fetchText } from "https://esm.town/v/stevekrouse/fetchText?v=5";
4
5function isHTMLElement(node: Node): node is HTMLElement {
6 return node.nodeType === Node.ELEMENT_NODE;
7}
19}
20
21export default function MessageComponent({ message }: MessageProps) {
22 const [expandedSections, setExpandedSections] = useState<Set<string>>(new Set());
23
152
153 // Detect tool calls
154 if (line.includes('tool_use') || line.includes('function_call')) {
155 try {
156 // Try to parse as JSON
170
171 // Detect tool results
172 if (line.includes('tool_result') || line.includes('function_result')) {
173 try {
174 const resultData = JSON.parse(line);
1import axios from "axios";
2async function fetchUsers() {
3 try {
4 const response = await axios.get("https://jsonplaceholder.typicode.com/users");
1export default async function(req: Request) {
2 try {
3 const apiKey = Deno.env.get("VALTOWN_API_TOKEN");
40}
41
42function App() {
43 const [weatherData, setWeatherData] = useState<WeatherData | null>(null);
44 const [location, setLocation] = useState<Location | null>(null);
A helper function to build a file's email
Simple functional CSS library for Val Town
import { OpenAI } from "https://esm.town/v/std/openai";
export default async function(req: Request): Promise<Response> {
if (req.method === "OPTIONS") {
return new Response(null, {
headers: {
"Access-Control-Allow-Origin": "*",
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.