Likes
4
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
yawnxyz
breakdown
HTTP
This project is an argument summarizer that leverages AI to analyze and extract key arguments from a given text. Goals: Provide a user-friendly interface for inputting text Process the input using a large language model (LLama3 via Groq) Extract and structure key arguments, explanations, and relevant quotes Present the summarized arguments in a clear, organized format The main pipeline: User inputs text through a web interface The input is sent to an AI model for processing The AI extracts and structures the arguments The results are validated against a predefined schema The structured arguments are displayed to the user This tool aims to help users quickly understand the main points and supporting evidence in complex texts or discussions, making it valuable for research, debate preparation, or general comprehension of argumentative content.
2
saolsen
telemetry
Script
Telemetry For Vals. Telemetry is a library that lets you trace val town executions with opentelemetry. All traces are stored in val.town sqlite and there is an integrated trace viewer to see them. Quickstart Instrument an http val like this. import {
init,
tracedHandler,
} from "https://esm.town/v/saolsen/telemetry";
// Set up tracing by passing in `import.meta.url`.
// be sure to await it!!!
await init(import.meta.url);
async function handler(req: Request): Promise<Response> {
// whatever else you do.
return
}
export default tracedHandler(handler); This will instrument the http val and trace every request. Too add additional traces see this widgets example . Then, too see your traces create another http val like this. import { traceViewer } from "https://esm.town/v/saolsen/telemetry";
export default traceViewer; This val will serve a UI that lets you browse traces. For example, you can see my UI here . Tracing By wrapping your http handler in tracedHandler all your val executions will be traced. You can add additional traces by using the helpers. trace lets you trace a block of syncronous code. import { trace } from "https://esm.town/v/saolsen/telemetry";
trace("traced block", () => {
// do something
}); traceAsync lets you trace a block of async code. import { traceAsync } from "https://esm.town/v/saolsen/telemetry";
await traceAsync("traced block", await () => {
// await doSomething();
}); traced wraps an async function in tracing. import { traceAsync } from "https://esm.town/v/saolsen/telemetry";
const myTracedFunction: () => Promise<string> = traced(
"myTracedFunction",
async () => {
// await sleep(100);
return "something";
},
); fetch is a traced version of the builtin fetch function that traces the request. Just import it and use it like you would use fetch . sqlite is a traced version of the val town sqlite client. Just import it and use it like you would use https://www.val.town/v/std/sqlite attribute adds an attribute to the current span, which you can see in the UI. event adds an event to the current span, which you can see in the UI.
6