Back to packages list

Vals using hono

Description from the NPM package:
Web framework built on Web Standards
xkonti avatar
gptApiFramework
@xkonti
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();
pomdtr avatar
cliOld
@pomdtr
HTTP (deprecated)
Cli Vals Cli vals are a new type of val (same as http, email, cron and script vals). A cli val must use a function without args as it's default export. The function body will run on the user device using deno . An error message will be shown if deno is not installed. export default function() { if (Deno.args.length == 0) { console.error("<name> arg is required!"); Deno.exit(1); } console.log(`Hey ${Deno.args[0]}!`); } Fork @pomdtr/example_cli to get started. Of course, you can use a cli framework to parse arguments (ex: cliffy ). Running a cli val Go to https://pomdtr-cli.web.val.run/v/<author>/<name>[?v=<version>] to get a runnable script for your val. You can pipe the script to a shell to test it curl 'https://pomdtr-cli.web.val.run/v/pomdtr/cli_example' | sh -s Steve Hello Steve! Or save it to your $PATH . # save the script to the ~/.local/bin folder curl 'https://pomdtr-cli.web.val.run/v/pomdtr/cli_example' > ~/.local/bin/cli_example # make the script executable chmod +x ~/.local/bin/cli_example # run the installed val cli_example Steve Allowing cli vals to access private resources Cli vals run on your device, so by default they can only access public/unlisted vals. You can set the DENO_AUTH_TOKENS env var in your shell config to allow deno to import private vals. export DENO_AUTH_TOKENS=<your-token>@esm.town Cli vals don't have access to val town tokens. Instead of trying to replicate your valtown secrets locally, you can configure your cli vals to call your http endpoints using fetch .
saolsen avatar
changes
@saolsen
HTTP (deprecated)
View val changes as a diff. Go to /v/username/valname/version to see a diff between that version and the previous one. For example https://saolsen-changes.web.val.run/v/saolsen/tracing/108
stevekrouse avatar
date_me_form
@stevekrouse
HTTP (deprecated)
@jsxImportSource npm:hono@3/jsx
pomdtr avatar
bookmarklets
@pomdtr
HTTP (deprecated)
Bookmarklet Manager Write your bookmarklets in val.town. Usage You val should just contain your bookmarklet code. alert("Hi mom!"); Make sure that your val is either unlisted or public, and not named bookmarklets . Then navigate to https://pomdtr-bookmarklets.web.val.run/v/:author/:name to generate the bookmarklet link. Sharing a bookmarklet Make sure that your val is public, and add a #bookmarklet tag anywhere in the code. alert("Hi mom!"); // #bookmarklet It should automatically appears on https://pomdtr-bookmarklets.web.val.run . ⚠️ If you are using the Arc Browser , you can use the Powerlet extension to install bookmarklets.
stevekrouse avatar
dateme
@stevekrouse
HTTP
Date Me Directory This is entry-point val for the source code for the Date Me Directory. Contributions welcome! This app uses Hono as the server framework and for JSX . The vals are stored in Val Town SQLite . Contributing Forking this repo should mostly work, except for the sqlite database. You'll need to create the table & populate it with some data. This script should do it, but I think it has a couple bugs. If you're interested in contributing to this project contact me or comment on this val and I'll get it working for ya! Todos [ ] Make the SQLite database forkable and build a widget/workflow for that, ie fix @stevekrouse/dateme_sqlite [ ] Require an email (that isn't shared publicly) [ ] Verify the email address with a "magic link" [ ] Refactor Location to an array of Lat, Lon [ ] Geocode all the existing locations [ ] Add a geocoder map input to the form [ ] Allow selecting multiple location through the form [ ] Profile performance & speed up site, possibly add more caching [ ] Let people edit their forms [ ] Featured profiles
saolsen avatar
clerk_hono_poc
@saolsen
HTTP (deprecated)
Sloppy but it's a working POC. Clerk key would be shared by all vals though, probably annoying since you'd have to configure each URL in clerk. Could be fine though. The CLERK_JWT_KEY is a hack where I took the pem and replaced all the newlines with '|' so I could set it as an env var and then turn them back to newlines.
steveVT avatar
untitled_apricotParrotfish
@steveVT
HTTP (deprecated)
Forked from stevekrouse/blob_admin
stevekrouse avatar
untitled_indigoNightingale
@stevekrouse
HTTP (deprecated)
Forked from stevekrouse/blob_admin
saolsen avatar
connect4_agent
@saolsen
Script
An interactive, runnable TypeScript val by saolsen
stevekrouse avatar
untitled_pinkRoundworm
@stevekrouse
HTTP (deprecated)
Forked from vez/comments
vez avatar
untitled_tanHare
@vez
HTTP (deprecated)
Forked from stevekrouse/blob_admin
vez avatar
comments
@vez
HTTP (deprecated)
Comments (just add water) A self-contained comments system Val. Just fork this val and you have a complete (but extremely minimal) comment system! Call on the front-end using: const MY_FORKED_VAL_URL = "https://vez-comments.web.val.run"; const getComments = async () => { const response = await fetch(MY_FORKED_VAL_URL); const json = await response.json(); return json; }; const addComment = async (str) => { try { const response = await fetch(MY_FORKED_VAL_URL, { method: "POST", body: JSON.stringify(str), }); if (response.status >= 400 && response.status < 600) { /* error */ return false; } else { /* success */ return true; } } catch (e) { /* error */ return false; } }; Here's an example of a blog post where I used the val for the comment system: https://vezwork.github.io/polylab/dist/demo/bidirectionalParse/. Check out "view source"!
stevekrouse avatar
blob_admin
@stevekrouse
HTTP (deprecated)
Forked from stevekrouse/sqlite_admin
stevekrouse avatar
edit_redirect_example
@stevekrouse
HTTP (deprecated)
An interactive, runnable TypeScript val by stevekrouse
rlesser avatar
dependency_graph
@rlesser
HTTP (deprecated)
An interactive, runnable TypeScript val by rlesser