29
30- [React Hono Example](https://www.val.town/x/stevekrouse/reactHonoExample) is a
31 bigger example project, with a SQLite database table, queries, client-side
32 CSS, a favicon, and shared code that runs on both client and server.
9- The **client-side entrypoint** is `/frontend/index.html`, which in turn imports `/frontend/index.tsx`, which in turn imports the React app from `/frontend/components/App.tsx`.
10
11[React Hono Example](https://www.val.town/x/stevekrouse/reactHonoExample) is a fuller featured example project, with a SQLite database table, queries, client-side CSS and a favicon, and some shared code that runs on both client and server.
12 I just made a change to it
13
30- [ ] add triggers to sidebar
31- [ ] add upload from SQL, CSV and JSON
32- [ ] add ability to connect to a non-val town Turso database
33- [x] fix wonky sidebar separator height problem (thanks to @stevekrouse)
34- [x] make result tables scrollable
41 while (true) {
42 const r = await fetch(
43 `https://api.notion.com/v1/databases/${NOTION_DB_ID}/query`,
44 {
45 method: "POST",
11 SystemLogQueries,
12 ConfigurationQueries
13} from '../database/queries.ts';
14import { HealthMonitor } from '../monitoring/health.ts';
15import { MetricsCollector } from '../monitoring/metrics.ts';
16import { getDatabaseStats } from '../database/schema.ts';
17
18import type { QueryOptions } from '../../shared/types.ts';
264 try {
265 const health = await HealthMonitor.getSystemHealth();
266 const dbStats = await getDatabaseStats();
267
268 return c.json({
270 data: {
271 ...health,
272 database: dbStats
273 },
274 timestamp: new Date()
377 app.post(`${adminPath}/operations/cleanup`, async (c) => {
378 try {
379 // This would trigger database cleanup
380 await SystemLogQueries.log('info', 'admin-api', 'Manual cleanup operation triggered');
381
439 });
440
441 // Simple AI test without database
442 app.post(`${adminPath}/operations/test-ai-simple`, async (c) => {
443 try {
705 app.post(`${adminPath}/personas/test-persona`, async (c) => {
706 try {
707 const { personaRole = 'Technical Lead', issue = 'Database performance issues' } = await c.req.json();
708
709 const { PersonaSystem } = await import('../personas/personas.ts');
1089 HealthMonitor.getSystemHealth(),
1090 MetricsCollector.getCurrentMetrics(),
1091 getDatabaseStats(),
1092 SystemLogQueries.findRecent({ limit: 10 })
1093 ]);
1098 health,
1099 metrics,
1100 database: dbStats,
1101 recentLogs: recentLogs.data,
1102 timestamp: new Date()
4 */
5
6import { SystemLogQueries } from '../backend/database/queries.ts';
7import { HealthMonitor } from '../backend/monitoring/health.ts';
8import { YapTrapTestRunner } from '../tests/test-suite.ts';
156 }
157
158 // Validate database connectivity
159 const health = await HealthMonitor.getSystemHealth();
160 if (health.components.database?.status !== 'healthy') {
161 throw new Error('Database is not healthy');
162 }
163
205
206 // Simulate deployment steps
207 await this.simulateDeploymentStep('Updating database schema', 2000);
208 await this.simulateDeploymentStep('Deploying backend services', 3000);
209 await this.simulateDeploymentStep('Updating frontend assets', 1000);
291
292 // Simulate rollback process
293 await this.simulateDeploymentStep('Reverting database changes', 2000);
294 await this.simulateDeploymentStep('Restoring previous code version', 3000);
295 await this.simulateDeploymentStep('Updating configuration', 1000);
5
6import type { PersonaDiscussion, SystemIssue } from './personas.ts';
7import { SystemLogQueries } from '../database/queries.ts';
8import { AIEngine } from '../ai/engine.ts';
9import { generateId } from '../../shared/utils.ts';
471 files.push('/backend/ai/engine.ts');
472 break;
473 case 'database':
474 files.push('/backend/database/queries.ts');
475 break;
476 case 'platform-slack':
7import type { NormalizedMessage } from '../../shared/types.ts';
8import { generateConversationId, generateUserId } from '../../shared/utils.ts';
9import { ConversationQueries, UserQueries, ConversationParticipantQueries } from '../database/queries.ts';
10import { MetricsCollector } from '../monitoring/metrics.ts';
11
66 const conversationId = generateConversationId('slack', event.channel);
67
68 // Ensure user exists in database
69 await this.ensureUserExists(event.user, userId);
70
71 // Ensure conversation exists in database
72 await this.ensureConversationExists(event.channel, conversationId);
73
246
247 /**
248 * Ensure user exists in database
249 */
250 private async ensureUserExists(slackUserId: string, userId: string): Promise<void> {
278
279 /**
280 * Ensure conversation exists in database
281 */
282 private async ensureConversationExists(slackChannelId: string, conversationId: string): Promise<void> {
30 this.createPersonaTestSuite(),
31 this.createPlatformTestSuite(),
32 this.createDatabaseTestSuite(),
33 this.createEndToEndTestSuite()
34 ];
207
208 /**
209 * Database Test Suite
210 */
211 private createDatabaseTestSuite(): TestSuite {
212 return {
213 name: 'Database Tests',
214 description: 'Tests for database operations and data integrity',
215 scenarios: [
216 {
217 id: generateId('test'),
218 name: 'Schema Initialization',
219 description: 'Test database schema creation',
220 platform: 'slack',
221 inputMessages: [],
222 expectedBehavior: 'Should create all required tables and indexes',
223 tags: ['database', 'schema', 'initialization']
224 },
225 {
230 inputMessages: [],
231 expectedBehavior: 'Should store and retrieve messages correctly',
232 tags: ['database', 'messages', 'crud']
233 },
234 {
239 inputMessages: [],
240 expectedBehavior: 'Should update user personality profiles based on messages',
241 tags: ['database', 'personality', 'learning']
242 },
243 {
248 inputMessages: [],
249 expectedBehavior: 'Should clean up old data according to retention policies',
250 tags: ['database', 'retention', 'cleanup']
251 }
252 ]
5
6import type { SystemLog, NormalizedMessage } from '../../shared/types.ts';
7import { SystemLogQueries, MessageQueries, ConversationQueries } from '../database/queries.ts';
8import { AIEngine } from '../ai/engine.ts';
9import { generateId, generateConversationId, generateUserId } from '../../shared/utils.ts';
290 discussion.updatedAt = new Date();
291
292 // Store as a regular message in the database
293 const conversationId = generateConversationId('persona', discussionId);
294 await MessageQueries.createYapTrapMessage(