4import process from "node:process";
56export async function hnValTown({ lastRunAt }: Interval) {
7// Edit to update time frame
8const twoMonthsAgo = new Date();
1import { OpenAI } from "https://esm.town/v/std/openai";
23export default async function(req: Request): Promise<Response> {
4if (req.method === "OPTIONS") {
5return new Response(null, {
1617/**
18* Simplified proof-of-concept function to test API connectivity
19* This should return an immediate result we can inspect
20*/
21export default async function generateFeed() {
22// First, let's return something immediately to confirm the function runs
23console.log("Function started");
2425// Create a debug log to capture all outputs
26let debugLog = [];
27function log(message, data = null) {
28let logEntry = { timestamp: new Date().toISOString(), message };
29if (data) logEntry.data = data;
85};
86} catch (error) {
87log("Error in test function", error.message);
88log("Error stack", error.stack);
89
21import { AgentRegistry } from "https://esm.town/v/salon/mandate/agentRegistry.ts";
22import { MemoryLogger } from "https://esm.town/v/salon/mandate/logger.ts";
23// import { generateHtmlShellV2 } from "https://esm.town/v/salon/mandate/ui.ts"; // Will replace with new UI function
24import { WorkflowDefinition } from "https://esm.town/v/salon/mandate/interfaces.ts";
25import {
69};
7071// Simple UI generation function (can be moved to a separate ui.ts file)
72// This will now pass workflow schemas to the client for dynamic form building.
73function generateHtmlWithWorkflowSelector(
74workflows: Record<string, WorkflowDefinition>,
75currentValUrl: string,
151const workflowSchemas = JSON.parse(document.getElementById('workflowSchemasData').textContent);
152153workflowSelector.addEventListener('change', function() {
154const selectedWorkflowId = this.value;
155dynamicInputsContainer.innerHTML = ''; // Clear previous inputs
279280// Main HTTP request handler
281export default async function(req: Request): Promise<Response> {
282globalLogger.clear(); // Clear logs for each new request
283const requestStartTime = Date.now();
284// Using import.meta.url to get the current val's URL for the view source link
285const currentValUrl = import.meta.url;
286const requestLog = globalLogger.createLogFunction(`REQ-${requestStartTime}`, "RequestHandler");
287288requestLog("INFO", "RequestReceived", `${req.method} ${req.url}`);
1617/** Main entry */
18export default async function generateFeed() {
19try {
20// Using hard-coded token instead of environment variable
MiniAppStarterui.tsx8 matches
3import { useEffect, useState } from "https://esm.sh/react@19";
45export function Section({ children, ...props }: any) {
6const sectionClass = `p-5 rounded-3xl bg-neutral-400/15 ${props.className || ""}`;
7return <div class={sectionClass}>{children}</div>;
93};
9495// export function Input(props: any) {
96// const inputClass = "dark:bg-white dark:text-black bg-black text-white rounded-md px-3 py-1 ";
97// return <input class={inputClass} {...props} />;
98// }
99100// export function Button(props: any) {
101// const buttonClass = "dark:bg-white dark:text-black bg-black text-white rounded-md px-3 py-1 ";
102// return <button class={buttonClass} {...props} />;
103// }
104105export function MonoButton(props: any) {
106return (
107<Button {...props}>
111}
112113export function MonoButtonWithStatus(props: any) {
114const [status, setStatus] = useState<any>();
115const handleClick = async () => {
132}
133134export function formatJSON(json: any) {
135return JSON.stringify(json, null, 2);
136}
146};
147148export function BackButton({}) {
149return <ArrowLeft className="w-5 h-5 m-2 cursor-pointer opacity-50" onClick={() => window.location.href = "/"} />;
150}
151152export function ShareButton({ onClick }) {
153return <Share className="w-5 h-5 m-2 cursor-pointer opacity-50" onClick={onClick} />;
154}
MiniAppStarterneynar.ts7 matches
1const baseUrl = "https://api.neynar.com/v2/farcaster/";
23export async function fetchNeynarGet(path: string) {
4const res = await fetch(baseUrl + path, {
5method: "GET",
14}
1516export function fetchUser(username: string) {
17return fetchNeynarGet(`user/by_username?username=${username}`).then(r => r.user);
18}
19export function fetchUsersById(fids: string) {
20return fetchNeynarGet(`user/bulk?fids=${fids}`).then(r => r.users);
21}
2223export function fetchUserFeed(fid: number) {
24return fetchNeynarGet(
25`feed?feed_type=filter&filter_type=fids&fids=${fid}&with_recasts=false&with_replies=false&limit=100&cursor=`,
27}
2829export function fetchChannel(channelId: string) {
30return fetchNeynarGet(`channel?id=${channelId}`).then(r => r.channel);
31}
3233export function fetchChannelFeed(channelId: string) {
34return fetchNeynarGet(
35`feed/channels?channel_ids=${channelId}&with_recasts=false&limit=100`,
37}
3839export function fetchChannelsFeed(channelIds: array) {
40return fetchNeynarGet(
41`feed/channels?channel_ids=${channelIds.join(",")}&with_recasts=false&limit=100`,
MiniAppStarterindex.tsx1 match
35});
3637function generateHtml(baseUrl: string, path: string = "/"): any {
38return (
39<html>
MiniAppStarterimage.tsx4 matches
5import satori from "npm:satori";
67export function handleImageEndpoints(app: Hono) {
8const headers = {
9"Content-Type": "image/png",
18}
1920export async function homeImage() {
21return await ogImage(
22<div tw="w-full h-full flex justify-start items-end text-[100px] bg-black text-white p-[50px]">
31}
3233export async function iconImage() {
34return await ogImage(
35<div tw="w-full h-full flex justify-center items-center text-[100px] bg-black text-white p-[50px]">
45//////////
4647export async function ogImage(body, options = {}) {
48const svg = await satori(
49body,
MiniAppStarterHome.tsx1 match
9import { fetchUsersById } from "../util/neynar.ts";
1011export function Home() {
12return (
13<div class="p-5 mb-8">