Val Town Code SearchReturn to Val Town

API Access

You can access search results via JSON API by adding format=json to your query:

https://codesearch.val.run/image-url.jpg%20%22Image%20title%22?q=function&page=64&format=json

For typeahead suggestions, use the /typeahead endpoint:

https://codesearch.val.run/typeahead?q=function

Returns an array of strings in format "username" or "username/projectName"

Found 19319 results for "function"(987ms)

41};
42
43// Main function
44async function registerToggleRoleCommand() {
45 console.log("🚀 Starting toggle-role command registration process...");
46
112const result = await registerToggleRoleCommand();
113
114// Export the result and function for external use
115export default result;
48];
49
50// Main function
51async function registerCommands() {
52 console.log("🚀 Starting command registration process...");
53
141const result = await registerCommands();
142
143// Export the result and function for external use
144export default result;

mandatelogger.ts2 matches

@salon•Updated 5 days ago
1// logger.ts
2import { LogEntry, LogFunction, LogLevel } from "https://esm.town/v/salon/mandate/interfaces.ts"; // Adjust path for Val Town
3
4export class MemoryLogger {
24 }
25
26 public createLogFunction(mandateId: string, baseComponent?: string): LogFunction {
27 return (level, component, message, details) => {
28 const entry: Omit<LogEntry, "timestamp" | "taskId"> = {

mandateagentRegistry.ts4 matches

@salon•Updated 5 days ago
1// agentRegistry.ts
2import { AgentFunction } from "https://esm.town/v/salon/mandate/interfaces.ts"; // Adjust path for Val Town
3
4export class AgentRegistry {
5 private agents: Map<string, AgentFunction<any, any>> = new Map();
6
7 public register<InputPayload, OutputPayload>(
8 name: string,
9 agentFn: AgentFunction<InputPayload, OutputPayload>,
10 ): void {
11 if (this.agents.has(name)) {
16 }
17
18 public getAgent(name: string): AgentFunction<any, any> | undefined {
19 return this.agents.get(name);
20 }
41};
42
43// Main function
44async function registerToggleRoleCommand() {
45 console.log("🚀 Starting toggle-role command registration process...");
46
112const result = await registerToggleRoleCommand();
113
114// Export the result and function for external use
115export default result;
26}
27
28// Main function
29async function unregisterAllCommands() {
30 console.log("🔄 Starting command unregistration process...");
31
117const result = await unregisterAllCommands();
118
119// Export the result and function for external use
120export default result;

SuperMain.tsx15 matches

@Get•Updated 5 days ago
26 mandateId: string;
27 taskId: string;
28 log: LogFunction;
29 // NEW: Add configuration specific to this agent instance in the workflow
30 config?: Record<string, any>;
32}
33
34/** Defines the function signature for any agent. */
35type AgentFunction<InputPayload = any, OutputPayload = any> = (
36 input: AgentInput<InputPayload>,
37 context: AgentContext,
79// --- Logging ---
80
81type LogFunction = (level: LogLevel, component: string, message: string, details?: any) => void;
82type LogLevel = "DEBUG" | "INFO" | "WARN" | "ERROR" | "SUCCESS";
83
119 }
120
121 createLogFunction(mandateId: string, baseComponent?: string): LogFunction {
122 return (level, component, message, details) => {
123 const entry: Omit<LogEntry, "timestamp" | "taskId"> = {
174
175class AgentRegistry {
176 private agents: Map<string, AgentFunction<any, any>> = new Map();
177
178 register<InputPayload, OutputPayload>(
179 name: string,
180 agentFn: AgentFunction<InputPayload, OutputPayload>,
181 ): void {
182 if (this.agents.has(name)) {
187 }
188
189 getAgent(name: string): AgentFunction<any, any> | undefined {
190 return this.agents.get(name);
191 }
241 ): Promise<WorkflowResult<FinalPayload>> {
242 const mandateId = `M-${Date.now()}-${definition.id}`;
243 const log = this.logger.createLogFunction(mandateId, "WorkflowEngine");
244 // Store outputs of successful steps: Map<stepId, AgentOutput>
245 const stepResults = new Map<string, AgentOutput<any>>();
489
490// Agent 1: Summarizer (modified for new signature)
491async function summarizerAgent(
492 input: AgentInput<{ textToSummarize: string }>,
493 context: AgentContext,
519
520// Agent 2: Fetch External Data (using config)
521async function fetchAgent(
522 input: AgentInput<{ url_from_input?: string }>, // Input might override config
523 context: AgentContext,
558
559// Agent 3: Combiner Agent (New)
560async function combinerAgent(
561 input: AgentInput<{ summary?: string; externalDataTitle?: string }>,
562 context: AgentContext,
649agentRegistry.register("combiner", combinerAgent); // Register the new agent
650
651function generateHtmlShellV2() {
652 // Simple HTML UI for the enhanced workflow
653 return `<!DOCTYPE html>
759
760// Val Town Entry Point (or adapt for Node.js/Deno/Bun)
761export default async function(req: Request): Promise<Response> {
762 // IMPORTANT: Clear logs for each new request to avoid mixing logs between runs
763 globalLogger.clear();
764 const requestStartTime = Date.now();
765 const requestLog = globalLogger.createLogFunction(`REQ-${requestStartTime}`, "RequestHandler");
766
767 requestLog("INFO", "RequestReceived", `Incoming ${req.method} request for ${req.url}`);

subdomainslab.tsx1 match

@rayyan•Updated 5 days ago
1export default async function (req: Request): Promise<Response> {
2 return Response.json({ ok: true })
3}

subdomainsvid.tsx1 match

@rayyan•Updated 5 days ago
1export default async function (req: Request): Promise<Response> {
2 return Response.json({ ok: true })
3}

subdomainsporn.tsx1 match

@rayyan•Updated 5 days ago
1export default async function (req: Request): Promise<Response> {
2 return Response.json({ ok: true })
3}

getFileEmail4 file matches

@shouser•Updated 2 weeks ago
A helper function to build a file's email
tuna

tuna8 file matches

@jxnblk•Updated 3 weeks ago
Simple functional CSS library for Val Town
lost1991
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": "*",
webup
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.