doodleadmin.http.ts6 matches
8586<script>
87const API_BASE = 'https://doodle-api.val.run';
88const eventId = '${eventId || ''}';
89const secret = '${secret || ''}';
103async function loadEvent() {
104try {
105const response = await fetch(\`\${API_BASE}/events/\${eventId}\`);
106const data = await response.json();
107
168if (eventId && secret) {
169// Update existing event
170response = await fetch(\`\${API_BASE}/events/\${eventId}\`, {
171method: 'PATCH',
172headers: { 'Content-Type': 'application/json' },
175} else {
176// Create new event
177response = await fetch(\`\${API_BASE}/events\`, {
178method: 'POST',
179headers: { 'Content-Type': 'application/json' },
227const fullEditUrl = editUrl.startsWith('http') ? editUrl : window.location.origin + editUrl;
228const fullAnswerUrl = answerUrl.startsWith('http') ? answerUrl : window.location.origin + answerUrl;
229const response = await fetch(\`\${API_BASE}/email\`, {
230method: 'POST',
231headers: { 'Content-Type': 'application/json' },
259
260try {
261await fetch(\`\${API_BASE}/email\`, {
262method: 'POST',
263headers: { 'Content-Type': 'application/json' },
225226### Fixed Issues
227- **JSON Schema Validation**: Fixed invalid schema types for Anthropic API
228- **Circular Dependencies**: Implemented lazy loading to prevent import issues
229- **App Loading**: Resolved module loading problems that caused blank page
231### Architecture Decisions
232- **File-based Components**: Components loaded from project files for version control
233- **Standardized Interface**: Consistent API across all component types
234- **Container Abstraction**: Separate managers for each container type
235- **Safe Method Calls**: Proxy system for secure method invocation
oauth-connectmain.tsx4 matches
39});
4041app.get("/api/tokens", async (c) => {
42const user = c.get("user");
43return c.json(await getTokensByUserId(user.id));
47Deno.env.get("SLACK_CLIENT_ID"),
48Deno.env.get("SLACK_CLIENT_SECRET"),
49"https://oauth-connect.val.run/api/callback/slack",
50);
51app.get("/api/start-connection/:service", (c) => {
52const state = arctic.generateState();
5371});
7273app.get("/api/callback/:service", async (c) => {
74const service = c.req.param("service");
75
ChatAFFORDANCE-FRAMEWORK.md2 matches
1# UI Affordance Registration Framework
23A flexible system for dynamically registering and controlling UI components through client-side tools. This framework allows the assistant to create rich, interactive UI experiences by registering components in dedicated containers and interacting with them through a standardized API.
45## Overview
8- **Dynamic Component Registration**: Load and mount components from file keys
9- **Multiple Container Types**: Overlay, header, footer, sidebar, and inline containers
10- **Standardized Interface**: Consistent API for component interaction
11- **Lifecycle Management**: Proper mounting, unmounting, and cleanup
12- **Method Invocation**: Safe method calls on registered components
gpt-wrapperindex.ts8 matches
13});
1415// GreenPT API wrapper endpoint
16app.post("/v1/chat/completions", async (c) => {
17try {
18const apiKey = Deno.env.get("GREENPT_API_KEY");
19if (!apiKey) {
20return c.json({ error: "GREENPT_API_KEY not configured" }, 500);
21}
2238};
3940const response = await fetch("https://api.greenpt.ai/v1/chat/completions", {
41method: "POST",
42headers: {
43"Content-Type": "application/json",
44"Authorization": `Bearer ${apiKey}`,
45},
46body: JSON.stringify(
59const errorText = await response.text();
60return c.json({
61error: `GreenPT API error: ${response.status} ${errorText}`,
62}, response.status);
63}
72// Health check endpoint
73app.get("/health", (c) => {
74return c.json({ status: "ok", service: "GreenPT API Wrapper" });
75});
76
gpt-wrapperknowledge.md13 matches
14- Generate code in TypeScript or TSX
15- Add appropriate TypeScript types and interfaces for all data structures
16- Prefer official SDKs or libraries than writing API calls directly
17- Ask the user to supply API or library documentation if you are at all unsure about it
18- **Never bake in secrets into the code** - always use environment variables
19- Include comments explaining complex logic (avoid commenting obvious operations)
24### 1. HTTP Trigger
2526- Create web APIs and endpoints
27- Handle HTTP requests and responses
28- Example structure:
146Use GlobalRateLimitedChatOpenAI(model, requestsPerSecond) to enforce a global rate limit on chat completions, suitable for shared or public-facing endpoints.
147Val Town/Platform Notes
148Uses Val Town’s standard SQLite API for persistent storage.
149Designed for server-side use (no browser-specific code).
150No secrets are hardcoded; OpenAI API keys are managed by the OpenAI SDK/environment.
151152215However, it's *extremely importing* to note that `parseProject` and other Standard Library utilities ONLY RUN ON THE SERVER.
216If you need access to this data on the client, run it in the server and pass it to the client by splicing it into the HTML page
217or by making an API request for it.
218219## Val Town Platform Specifics
223- **AI Image:** To inline generate an AI image use: `<img src="https://maxm-imggenurl.web.val.run/the-description-of-your-image" />`
224- **Storage:** DO NOT use the Deno KV module for storage
225- **Browser APIs:** DO NOT use the `alert()`, `prompt()`, or `confirm()` methods
226- **Weather Data:** Use open-meteo for weather data (doesn't require API keys) unless otherwise specified
227- **View Source:** Add a view source link by importing & using `import.meta.url.replace("ems.sh", "val.town)"` (or passing this data to the client) and include `target="_top"` attribute
228- **Error Debugging:** Add `<script src="https://esm.town/v/std/catch"></script>` to HTML to capture client-side errors
229- **Error Handling:** Only use try...catch when there's a clear local resolution; Avoid catches that merely log or return 500s. Let errors bubble up with full context
230- **Environment Variables:** Use `Deno.env.get('keyname')` when you need to, but generally prefer APIs that don't require keys
231- **Imports:** Use `https://esm.sh` for npm and Deno dependencies to ensure compatibility on server and browser
232- **Storage Strategy:** Only use backend storage if explicitly required; prefer simple static client-side sites
266### Backend (Hono) Best Practices
267268- Hono is the recommended API framework
269- Main entry point should be `backend/index.ts`
270- **Static asset serving:** Use the utility functions to read and serve project files:
290});
291```
292- Create RESTful API routes for CRUD operations
293- Always include this snippet at the top-level Hono app to re-throwing errors to see full stack traces:
294```ts
327- For files in the project, use `readFile` helpers
3283295. **API Design:**
330- `fetch` handler is the entry point for HTTP vals
331- Run the Hono app with `export default app.fetch // This is the entry point for HTTP vals`
351```
352353`your-api-key` can be read from environment variables GREENPT_API_KEY.
354355The expected response to the curl call would be
gpt-wrapperopenai-client.mdc2 matches
15Use GlobalRateLimitedChatOpenAI(model, requestsPerSecond) to enforce a global rate limit on chat completions, suitable for shared or public-facing endpoints.
16Val Town/Platform Notes
17Uses Val Town’s standard SQLite API for persistent storage.
18Designed for server-side use (no browser-specific code).
19No secrets are hardcoded; OpenAI API keys are managed by the OpenAI SDK/environment.
gpt-wrapper.cursorrules10 matches
13- Generate code in TypeScript or TSX
14- Add appropriate TypeScript types and interfaces for all data structures
15- Prefer official SDKs or libraries than writing API calls directly
16- Ask the user to supply API or library documentation if you are at all unsure about it
17- **Never bake in secrets into the code** - always use environment variables
18- Include comments explaining complex logic (avoid commenting obvious operations)
23### 1. HTTP Trigger
2425- Create web APIs and endpoints
26- Handle HTTP requests and responses
27- Example structure:
173However, it's *extremely importing* to note that `parseProject` and other Standard Library utilities ONLY RUN ON THE SERVER.
174If you need access to this data on the client, run it in the server and pass it to the client by splicing it into the HTML page
175or by making an API request for it.
176177## Val Town Platform Specifics
181- **AI Image:** To inline generate an AI image use: `<img src="https://maxm-imggenurl.web.val.run/the-description-of-your-image" />`
182- **Storage:** DO NOT use the Deno KV module for storage
183- **Browser APIs:** DO NOT use the `alert()`, `prompt()`, or `confirm()` methods
184- **Weather Data:** Use open-meteo for weather data (doesn't require API keys) unless otherwise specified
185- **View Source:** Add a view source link by importing & using `import.meta.url.replace("ems.sh", "val.town)"` (or passing this data to the client) and include `target="_top"` attribute
186- **Error Debugging:** Add `<script src="https://esm.town/v/std/catch"></script>` to HTML to capture client-side errors
187- **Error Handling:** Only use try...catch when there's a clear local resolution; Avoid catches that merely log or return 500s. Let errors bubble up with full context
188- **Environment Variables:** Use `Deno.env.get('keyname')` when you need to, but generally prefer APIs that don't require keys
189- **Imports:** Use `https://esm.sh` for npm and Deno dependencies to ensure compatibility on server and browser
190- **Storage Strategy:** Only use backend storage if explicitly required; prefer simple static client-side sites
224### Backend (Hono) Best Practices
225226- 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:
248});
249```
250- Create RESTful API routes for CRUD operations
251- Always include this snippet at the top-level Hono app to re-throwing errors to see full stack traces:
252```ts
285- For files in the project, use `readFile` helpers
2862875. **API Design:**
288- `fetch` handler is the entry point for HTTP vals
289- Run the Hono app with `export default app.fetch // This is the entry point for HTTP vals`
reactHonoStarter-michelleindex.ts2 matches
12app.get("/frontend/**/*", c => serveFile(c.req.path, import.meta.url));
1314// Add your API routes here
15// app.get("/api/data", c => c.json({ hello: "world" }));
1617// Unwrap and rethrow Hono errors as the original error
oauth-connectHomePage.tsx2 matches
45export default function({ onLogin }) {
6const [apiKey, setApiKey] = useState("");
7const [isLoading, setIsLoading] = useState(false);
8const [error, onError] = useState("");
11<div className="max-w-lg mx-auto mt-12 p-6 flex flex-col gap-6">
12<h1 className="text-3xl">Val Town Oauth Connect</h1>
13<a href="/api/start-connection/slack" className="text-blue-500 hover:underline">Connect to Slack</a>
14</div>
15);