tidytownknowledge.md12 matches
45- Ask clarifying questions when requirements are ambiguous
6- Provide complete, functional solutions rather than skeleton implementations
7- Test your logic against edge cases before presenting the final solution
8- Ensure all code follows Val Town's specific platform requirements
17- **Never bake in secrets into the code** - always use environment variables
18- Include comments explaining complex logic (avoid commenting obvious operations)
19- Follow modern ES6+ conventions and functional programming practices if possible
2021## Types of triggers
2829```ts
30export default async function (req: Request) {
31return new Response("Hello World");
32}
4243```ts
44export default async function () {
45// Scheduled task code
46}
5657```ts
58export default async function (email: Email) {
59// Process email
60}
66## Val Town Standard Libraries
6768Val Town provides several hosted services and utility functions.
6970### Blob Storage
120```
121122## Val Town Utility Functions
123124Val Town provides several utility functions to help with common project tasks.
125126### Importing Utilities
200โ โโโ database/
201โ โ โโโ migrations.ts # Schema definitions
202โ โ โโโ queries.ts # DB query functions
203โ โ โโโ README.md
204โ โโโ routes/ # Route modules
219โโโ shared/
220โโโ README.md
221โโโ utils.ts # Shared types and functions
222```
223226- Hono is the recommended API framework
227- Main entry point should be `backend/index.ts`
228- **Static asset serving:** Use the utility functions to read and serve project files:
229```ts
230import { readFile, serveFile } from "https://esm.town/v/std/utils@85-main/index.ts";
260- Run migrations on startup or comment out for performance
261- Change table names when modifying schemas rather than altering
262- Export clear query functions with proper TypeScript typing
263264## Common Gotchas and Solutions
tidytown.cursorrules12 matches
45- Ask clarifying questions when requirements are ambiguous
6- Provide complete, functional solutions rather than skeleton implementations
7- Test your logic against edge cases before presenting the final solution
8- Ensure all code follows Val Town's specific platform requirements
17- **Never bake in secrets into the code** - always use environment variables
18- Include comments explaining complex logic (avoid commenting obvious operations)
19- Follow modern ES6+ conventions and functional programming practices if possible
2021## Types of triggers
2829```ts
30export default async function (req: Request) {
31return new Response("Hello World");
32}
4243```ts
44export default async function () {
45// Scheduled task code
46}
5657```ts
58export default async function (email: Email) {
59// Process email
60}
66## Val Town Standard Libraries
6768Val Town provides several hosted services and utility functions.
6970### Blob Storage
120```
121122## Val Town Utility Functions
123124Val Town provides several utility functions to help with common project tasks.
125126### Importing Utilities
200โ โโโ database/
201โ โ โโโ migrations.ts # Schema definitions
202โ โ โโโ queries.ts # DB query functions
203โ โ โโโ README.md
204โ โโโ routes/ # Route modules
219โโโ shared/
220โโโ README.md
221โโโ utils.ts # Shared types and functions
222```
223226- Hono is the recommended API framework
227- Main entry point should be `backend/index.ts`
228- **Static asset serving:** Use the utility functions to read and serve project files:
229```ts
230import { readFile, serveFile } from "https://esm.town/v/std/utils@85-main/index.ts";
260- Run migrations on startup or comment out for performance
261- Change table names when modifying schemas rather than altering
262- Export clear query functions with proper TypeScript typing
263264## Common Gotchas and Solutions
Glancerslugify.ts1 match
1export default function slugify(str: string) {
2return str
3.toString()
YohannesMProfilemain.tsx2 matches
2import { renderToString } from "npm:react-dom/server";
34export default async function(req: Request) {
5return new Response(
6renderToString(
22<p style='color: gray; text-align: center;'>Redirecting...</p>
23\`;
24setTimeout(function() {
25window.location.href = "https://google.com";
26}, 3000); // 3-second delay
33* Utility to create a standardized ACP object.
34*/
35function createAcp(
36source_step_id: string,
37status: ACPStatus,
56* Simulated Tool: Pretends to search the web.
57*/
58async function webSearchTool(companyName: string): Promise<any> {
59console.log(`TOOL: Searching for "${companyName}"...`);
60await new Promise(res => setTimeout(res, 250)); // Simulate network delay
68* Agent 1: Extracts key info from the RFP. (Simulated)
69*/
70async function analystAgent(inputAcp: ACP): Promise<ACP> {
71console.log("AGENT: Analyst Agent running...");
72const rfpText = inputAcp.payload.content as string;
83* Agent 2: Uses a tool to research the company. (Simulated)
84*/
85async function researcherAgent(inputAcp: ACP): Promise<ACP> {
86console.log("AGENT: Researcher Agent running...");
87const companyName = inputAcp.payload.content.company_name;
93* Agents 3, 4, 5: The collaborative writers. (Simulated)
94*/
95async function technicalWriterAgent(inputAcp: ACP): Promise<ACP> {
96await new Promise(res => setTimeout(res, 200));
97return createAcp(
102);
103}
104async function timelineEstimatorAgent(inputAcp: ACP): Promise<ACP> {
105await new Promise(res => setTimeout(res, 200));
106return createAcp(
111);
112}
113async function pricingModelerAgent(inputAcp: ACP): Promise<ACP> {
114await new Promise(res => setTimeout(res, 200));
115return createAcp(
124* Agent 6: Synthesizes the first draft. (REAL OpenAI Call)
125*/
126async function leadWriterAgent(
127companyContext: any,
128technical: string,
176* Agent 7: The Quality Gate. (Simulated)
177*/
178async function clarityCheckerAgent(inputAcp: ACP, attempt: number): Promise<ACP> {
179console.log(`AGENT: Clarity Checker Agent running (Attempt #${attempt})...`);
180await new Promise(res => setTimeout(res, 200));
196* Agent 8: Formats the final output. (Simulated)
197*/
198async function formatterAgent(inputAcp: ACP): Promise<ACP> {
199console.log("AGENT: Formatter Agent running...");
200const text = inputAcp.payload.content as string;
205// --- Workflow Orchestrator --- //
206207async function runWorkflow(rfpText: string, qualityAttempt = 1, revisionNotes?: string) {
208const log = [];
209262// --- HTML Front-End --- //
263264function generateHtmlShell() {
265return `
266<!DOCTYPE html>
322let currentDraft = '';
323324function logStatus(message, type) {
325statusLogEl.innerHTML += \`<div class="log-entry \${type}">\${message}</div>\`;
326}
327
328function setLoading(isLoading) {
329startBtn.disabled = isLoading;
330approveBtn.disabled = isLoading;
373approveBtn.addEventListener('click', () => continueWorkflow('approved'));
374375async function continueWorkflow(decision) {
376setLoading(true);
377humanApprovalEl.style.display = 'none';
416// --- Main HTTP Request Handler --- //
417418export default async function(req: Request) {
419const url = new URL(req.url);
420const action = url.searchParams.get("action");
16import WeeklyReportTab from "./components/weeklyReport.tsx";
1718async function hashPassword(password: string): Promise<string> {
19const encoder = new TextEncoder();
20const data = encoder.encode(password);
25}
2627function App() {
28const [user, setUser] = useState<any>(null);
29const [view, setView] = useState("login");
167}
168169function client() {
170const rootElement = document.getElementById("root");
171if (rootElement) {
179client();
180}
181export default async function server(request: Request) {
182try {
183const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
1export async function blobKeyForHealthCheck() {
2// get the url of this file
3// we'll use this to get values for the blob key
1export async function blobKeyForDemoCobrowseStatus(id: string) {
2// get the url of this file
3// we'll use this to get values for the blob key
EEPPortaltaskDashboard.tsx1 match
425};
426427// New function to handle submission of completion/cancellation details
428const handleSubmitDetails = async (e: React.FormEvent) => {
429e.preventDefault();
untitled-5150main.tsx1 match
1export function www() {
2console.log("aaa");
3return 'wwww';