Trending Vals
212
pomdtr
test_explorer
HTTP
Test Explorer Click on the play button next to list items to run them. Usage Fork this val Create new tests in any of vals (and export them) (see @pomdtr/example_test) import { assertEquals } from "https://deno.land/std@0.216.0/assert/mod.ts";
import { Test } from "https://esm.town/v/<account>/test_explorer";
export const exampleTestSuccess = new Test(() => {
assertEquals(1 + 1, 2);
});
export const exampleTestFailure = new Test(() => {
assertEquals(1 + 1, 3);
}); Go to https://<account>-test_explorer.web.val.run to run your test click on the val name to go to the val the tests are originating from click on the test name to run it ℹ️ You probably want to protect your test explorer behind an authentication middleware like @pomdtr/basicAuth Discovery mechanism In order to define a test, the user need to import the Test class from https://val.town/v/<account>/Test .
So we can use the api to search for vals containing the https://val.town/v/<account>/Test string to locate the vals containing tests. Next, we need to extract the tests from the val exports. We use exported instanceof Test to filter them (at some point we will probably use static analysis for this). TODO [x] persist test results in sqlite [x] Improve styling (help welcome ❤️) [ ] View logs in a modal [ ] Batch http requests
6
216
panphora
cronSiteMonitor
Cron
Site Monitor A simple cron script that monitors website availability and sends email notifications when sites are down. Features Monitors multiple websites concurrently 5-second timeout for each site check Email notifications for downtime events Uses ESM modules for email functionality Dependencies ESM email module ( https://esm.town/v/std/email ) Usage Fork, insert your own websites, and set a 10min cron timer. Error Handling The script considers a site as "down" if: The site fails to respond within 5 seconds The site returns a non-200 status code Any network or connection error occurs Email Notifications When downtime is detected, an email is sent with: Subject: Lists all down sites with a 🚨 emoji prefix Body: Simple text listing of all down sites License WTFPL
1
218
andreterron
bombCycloneOutageTracker
HTTP
🌪️ × 🔌 Bomb Cyclone - PSE Power Outage Tracker https://bomb-cyclone.terron.app Tracking PSE power outages after the Bomb Cyclone of Nov 19th, 2024. The data is obtained every 15 minutes using this cron job: @andreterron/PSEoutages Tracking started on Nov 20th, at around 7pm PST. If you know how others can help those affected by the outage, please add a comment here. I'll keep updating this readme and the website with more information.
1
219
trob
multilingualchatroom
HTTP
A simple chat room to share with friends of other languages, where each user can talk in their own language and see others' messages in their own language.
Click and hold a translated message to see the original message.
Open the app in a new window to start your own, unique chatroom that you can share with your friends via the room URL. TODO: BUG: fix the issue that keeps old usernames in the "[User] is typing" section after a user changes their name. BUG: Username edit backspaces is glitchy. UI: Update the title for each unique chatroom to make the difference clear. UI: mobile friendly. Feature: the ability for the message receiver to select a part of a translation that is confusing and the author will see that highlight of the confusing words and have the opportunity to reword the message or... Feature: bump a translation to a higher LLM for more accurate translation. Feature: use prior chat context for more accurate translations. Feature: Add video feed for non-verbals while chatting.
5
223
jamiedubs
runGlif
Script
glif API mini-SDK
make generative magical AI things set your GLIF_API_TOKEN in your own ENV, or you'll hit rate limits: https://glif.app/settings/api-tokens call from your val like: import { runGlif } from "https://esm.town/v/jamiedubs/runGlif";
const json = await runGlif({ id: "cluu91eda000cv8jd675qsrby", inputs: ["hello", "world"] });
console.log(json);
0
224
artivilla
farcasterKeyHook
HTTP
FarcasterCustomKeywordHook Simple service notify you your configured keywords on Farcaster to Slack 3 steps: Create a Neynar webhook (https://dev.neynar.com/webhook), via no-code to plug in your forked val URL as their webhook target URL. Add events and keywords you want notified to your slack bot. In the example below, we watch for the text "outpaint". Create a bot to send messages to Slack. https://docs.val.town/integrations/slack/send-messages-to-slack/#_top Add your SLACK_WEBHOOK_URL provided in the step under Val environment variables. https://www.val.town/settings/environment-variables Wait for keyword or Cast in Farcaster with keyword. Will change depending on your event types selected in Step 1-2. Profit 💸💸
1
225
226
xkonti
gptApiFramework
Script
Allows for automatic generation of Hono API compatible with GPTs. Endpoints' inputs and outputs need to be specified via types from which the Open API spec is generated automatically and available via /gpt/schema endpoint. ⚠️ Breaking changes introduced in v23 & 24: nothingToJson doesn't take the generic TResponse anymore. The type is inferred from the endpoint definition. The endpoint definition doesn't need the requestSchema , requestDesc and responseDesc defined anymore. The descriptions are inferred from the schema description. jsonToJson doesn't take the generic TRequest and TResponse anymore. Types are inferred from the endpoint definition. The endpoint definition doesn't need the requestDesc and responseDesc defined anymore. The descriptions are inferred from the schema description. Usage example: import { GptApi } from "https://esm.town/v/xkonti/gptApiFramework";
import { z } from "npm:zod";
/**
* COMMON TYPES
*/
const ResponseCommandSchema = z.object({
feedback: z.string().describe("Feedback regarding submitted action"),
command: z.string().describe("The command for the Mediator AI to follow strictly"),
data: z.string().optional().describe("Additional data related to the given command"),
}).describe("Contains feedback and further instructions to follow");
/**
* INITIALIZE API
*/
const api = new GptApi({
url: "https://xkonti-planoverseerai.web.val.run",
title: "Overseer AI API",
description: "The API for interacting with the Overseer AI",
version: "1.0.0",
policyGetter: async () => {
const { markdownToPrettyPage } = await import("https://esm.town/v/xkonti/markdownToHtmlPage?v=5");
return await markdownToPrettyPage("# Privacy Policy\n\n## Section 1...");
},
});
/**
* REQUIREMENTS GATHERING ENDPOINTS
*/
api.nothingToJson({
verb: "POST",
path: "/newproblem",
operationId: "new-problem",
desc: "Endpoint for informing Overseer AI about a new problem presented by the User",
responseSchema: ResponseCommandSchema,
responseDesc: "Instruction on how to proceed with the new problem",
}, async (ctx) => {
return {
feedback: "User input downloaded. Problem analysis is required.",
command: await getPrompt("analyze-problem"),
data: "",
};
});
export default api.serve();
2
227
229
begoon
thisval
Script
This val default exports a function returning ValInfo. The val information comes from the Deno stack trace induced by throw new Error() . type ValInfo = {
stack: string[]; // mostly for debugging
endpoint: string; // val endpoint URL, empty if it is not an HTTP val
user: string; // val.town user name
name: string; // val name
}; Here is an example program: import thisval from "https://esm.town/v/begoon/thisval";
const val = thisval();
export default async function(req: Request): Promise<Response> {
return Response.json(val);
} when invoked, it returns: {
"stack": [
"Error",
" at info (https://esm.town/v/begoon/thisval?v=12:10:11)",
" at https://esm.town/v/begoon/thisvaltest?v=2:3:13"
],
"endpoint": "begoon-thisvaltest.web.val.run",
"user": "begoon",
"name": "thisvaltest"
}
2
230
nknj
hackerNewsRAG
HTTP
Find comments on HN (powered by Algolia ), extract content and return a streaming markdown summary (powered by Substrate ). The RAG portion of this is 34 lines of Substrate code. Read the walkthrough: https://x.com/vprtwn/status/1812844236401762513 🪩 To fork, sign up for Substrate to get your own API key and $50 free credits. See also: https://www.val.town/v/substrate/twitterRAG
1
232
233
peterqliu
selfDestruct
Script
💥 Deletes the val using it, or whatever url is fed it. Handy for sharing single-use scripts without cluttering people's accounts. If used in an HTTP val, this will run immediately when anyone forks it, making for a zero-click execution as long as ValTown immediately serves a preview of the forked val. Add this to your code last and then do not run it, or you will lose your work. Recommend first checking that the val owner isn't you, so that only forked copies will self-destruct. Usage selfDestruct(import.meta.url) Returns a promise of successful deletion, though the val would not be around to read it.
3
238
239
240