···11+import { memory_block_entries, memory_blocks } from "./schema";
12import { migrate } from "drizzle-orm/bun-sqlite/migrator";
23import { drizzle } from "drizzle-orm/bun-sqlite";
34import { Database } from "bun:sqlite";
45import { env } from "../env";
55-import { memory_block_entries, memory_blocks } from "./schema";
6677const sqlite = new Database(env.DB_PATH);
88const db = drizzle(sqlite);
+1-1
src/db/schema.ts
···11-import { sql } from "drizzle-orm";
21import { integer, sqliteTable, text } from "drizzle-orm/sqlite-core";
22+import { sql } from "drizzle-orm";
3344export const interactions = sqliteTable("interactions", {
55 id: integer().primaryKey({ autoIncrement: true }),
+4-5
src/handlers/posts.ts
···11-import { interactions } from "../db/schema";
22-import { type Post } from "@skyware/bot";
11+import { isAuthorizedUser, logInteraction } from "../utils/interactions";
32import * as threadUtils from "../utils/thread";
43import modelPrompt from "../model/prompt.txt";
54import { GoogleGenAI } from "@google/genai";
55+import { interactions } from "../db/schema";
66+import { type Post } from "@skyware/bot";
77+import * as c from "../constants";
68import * as tools from "../tools";
79import consola from "consola";
810import { env } from "../env";
99-import db from "../db";
1010-import * as c from "../constants";
1111-import { isAuthorizedUser, logInteraction } from "../utils/interactions";
12111312const logger = consola.withTag("Post Handler");
1413
···11-import * as create_blog_post from "./tools/create_blog_post";
22-import * as mute_thread from "./tools/mute_thread";
33-import * as create_post from "./tools/create_post";
41import type { FunctionCall, GenerateContentConfig } from "@google/genai";
22+import * as create_blog_post from "./create_blog_post";
33+import * as create_post from "./create_post";
44+import * as mute_thread from "./mute_thread";
55import type { infer as z_infer } from "zod";
6677const validation_mappings = {
+3-2
src/tools/create_post.ts
···11+import { exceedsGraphemes, multipartResponse } from "../utils/thread";
12import { AtUri } from "@atproto/syntax";
23import { Type } from "@google/genai";
34import { env } from "../env";
45import bot from "../bot";
56import z from "zod";
66-import { exceedsGraphemes, multipartResponse } from "../utils/thread";
7788export const definition = {
99 name: "create_post",
1010- description: "Creates a new Bluesky post/thread and returns the URL.",
1010+ description:
1111+ "Creates a new Bluesky post/thread and returns the URL. Only do this if the user specifically requests a new thread.",
1112 parameters: {
1213 type: Type.OBJECT,
1314 properties: {
+3-3
src/tools/mute_thread.ts
···11+import { muted_threads } from "../db/schema";
22+import { AtUri } from "@atproto/syntax";
13import { Type } from "@google/genai";
24import bot from "../bot";
33-import z from "zod";
45import db from "../db";
55-import { muted_threads } from "../db/schema";
66-import { AtUri } from "@atproto/syntax";
66+import z from "zod";
7788export const definition = {
99 name: "mute_thread",
+3-3
src/utils/thread.ts
···11import { graphemeLength, Post, PostReference } from "@skyware/bot";
22-import * as yaml from "js-yaml";
33-import bot from "../bot";
42import { muted_threads } from "../db/schema";
33+import * as c from "../constants";
54import { eq } from "drizzle-orm";
55+import * as yaml from "js-yaml";
66+import bot from "../bot";
67import db from "../db";
77-import * as c from "../constants";
8899/*
1010 Traversal