12 overLimit,
13 startTrackingUsage,
14} from "../database/queries.tsx";
15import { makeChangeValTypeTool, makeFetchTool, makeTextEditorTool } from "../tools/index.ts";
16import fileWithLinesNumbers from "../utils/fileWithLinesNumbers.ts";
11});
12
13// Inspirational quotes database
14const quotes: Quote[] = [
15 {
225 } : null);
226
227 // Update in database
228 const selectedClipData = updatedClips.find(c => c.id === selectedClip);
229 if (selectedClipData) {
294 } : null);
295
296 // Update positions in database
297 try {
298 for (const clip of updatedClips) {
11});
12
13// Database setup
14const PROJECTS_TABLE = 'video_editor_projects_v1';
15const CLIPS_TABLE = 'video_editor_clips_v1';
16
17// Initialize database tables
18async function initDatabase() {
19 await sqlite.execute(`CREATE TABLE IF NOT EXISTS ${PROJECTS_TABLE} (
20 id TEXT PRIMARY KEY,
43}
44
45// Initialize database on startup
46initDatabase().catch(console.error);
47
48// Serve static files
3## Description
4
5This is an AI-powered Grocery Shopping assistant that turns an imprecise list of items like "milk, bread, eggs" into a Kroger cart full of groceries. It relies on the Kroger API to search each item, then uses an LLM to decide which specific UPC to add to the cart (again, using the Kroger API). Once an item is selected, we store the UPC in the database so we can avoid consulting the LLM for that item again.
6
7Households have preferences for which items to buy, and what priorities they have for each item. For example, we prefer to buy free range eggs and poultry, but don't particularly care whether they are organic or not. These details are stored in a database, which should also be consulted to add context to the LLM's decisions.
8
9## Kroger OAuth Implementation
35- **User Management**: Create/update users based on Kroger profile ID
36
37## Database Schema
38
39The database consists of the following tables:
40
41### kroger_users_1
119โโโ backend/
120โ โโโ index.ts # Main HTTP handler with OAuth routes
121โ โโโ database/
122โ โ โโโ migrations.ts # Database schema setup
123โ โ โโโ krogerQueries.ts # Database query functions
124โ โโโ services/
125โ โโโ krogerAuth.ts # Kroger OAuth service
95- **HTTP-Only Cookies**: Session cookies are not accessible via JavaScript
96- **Token Refresh**: Automatic refresh of expired access tokens
97- **Secure Storage**: Tokens are stored securely in the database
98
99## Troubleshooting
20 updateUserLocation,
21 updateUserTokens,
22} from "./database/krogerQueries.ts";
23import { runMigrations } from "./database/migrations.ts";
24import { KrogerAuthService } from "./services/krogerAuth.ts";
25
26const app = new Hono();
27
28// Initialize database on startup
29await runMigrations();
30
208```
209โโโ backend/
210โ โโโ database/
211โ โ โโโ migrations.ts # Schema definitions
212โ โ โโโ queries.ts # DB query functions
270- Handle API calls properly with proper error catching
271
272### Database Patterns
273- Run migrations on startup or comment out for performance
274- Change table names when modifying schemas rather than altering
9- [ ] make it one click to branch off like old jp townie demos
10- [ ] opentownie as a pr bot
11- [ ] give it the ability to see its own client-side and server-side logs by building a middleware that shoves them into a SQL light database date and then give it a tool to access them
12- [ ] do a browser use or screenshot thing to give it access to its own visual output
13- [ ] Have it default to creating a new branch off main
7export const thinkTool = tool({
8 description:
9 "Use the tool to think about something. It will not obtain new information or change the database, but just append the thought to the log. Use it when complex reasoning or some cache memory is needed.",
10 parameters: z.object({
11 thought: z.string().describe("A thought to think about."),