pierre-review 0.1.52 → 0.1.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/db/migrations/0023_ai_usage.sql +21 -0
- package/dist/db/migrations/meta/_journal.json +7 -0
- package/dist/db/migrations-pg/0012_woozy_captain_midlands.sql +16 -0
- package/dist/db/migrations-pg/meta/0012_snapshot.json +2528 -0
- package/dist/db/migrations-pg/meta/_journal.json +7 -0
- package/dist/db/queries.js +227 -0
- package/dist/db/schema.pg.js +20 -0
- package/dist/db/schema.sqlite.js +27 -0
- package/dist/db/usage.js +44 -0
- package/dist/pro/bind.js +5 -1
- package/dist/review/persist.js +34 -0
- package/package.json +1 -1
- package/public/assets/{index-BoELSGcB.js → index-B18EPUv2.js} +105 -106
- package/public/assets/index-BKNNIALz.css +10 -0
- package/public/index.html +2 -2
- package/public/assets/index-CyVlgIYP.css +0 -10
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
-- AI-spend ledger (additive). Append-only: one row per billable AI operation (LLM
|
|
2
|
+
-- completion or Agent-SDK run) so month-to-date usage is summable across features (the
|
|
3
|
+
-- per-feature cost columns upsert-overwrite). Surfaced only as credits, never dollars.
|
|
4
|
+
-- `seam` = summary (cheap completions) | agent (Agent-SDK runs). No FK on pr_id/repo_id
|
|
5
|
+
-- so the ledger survives PR/repo pruning. Postgres baseline regenerated via `db:generate:pg`.
|
|
6
|
+
CREATE TABLE `ai_usage` (
|
|
7
|
+
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
|
|
8
|
+
`account_id` integer NOT NULL,
|
|
9
|
+
`seam` text NOT NULL,
|
|
10
|
+
`feature` text NOT NULL,
|
|
11
|
+
`model` text NOT NULL,
|
|
12
|
+
`cost_usd` real NOT NULL,
|
|
13
|
+
`input_tokens` integer,
|
|
14
|
+
`output_tokens` integer,
|
|
15
|
+
`pr_id` integer,
|
|
16
|
+
`repo_id` integer,
|
|
17
|
+
`occurred_at` integer NOT NULL DEFAULT (unixepoch()),
|
|
18
|
+
FOREIGN KEY (`account_id`) REFERENCES `accounts`(`id`) ON UPDATE no action ON DELETE no action
|
|
19
|
+
);
|
|
20
|
+
--> statement-breakpoint
|
|
21
|
+
CREATE INDEX `au_account_occurred` ON `ai_usage` (`account_id`,`occurred_at`);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
CREATE TABLE "ai_usage" (
|
|
2
|
+
"id" serial PRIMARY KEY NOT NULL,
|
|
3
|
+
"account_id" integer NOT NULL,
|
|
4
|
+
"seam" text NOT NULL,
|
|
5
|
+
"feature" text NOT NULL,
|
|
6
|
+
"model" text NOT NULL,
|
|
7
|
+
"cost_usd" double precision NOT NULL,
|
|
8
|
+
"input_tokens" integer,
|
|
9
|
+
"output_tokens" integer,
|
|
10
|
+
"pr_id" integer,
|
|
11
|
+
"repo_id" integer,
|
|
12
|
+
"occurred_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
13
|
+
);
|
|
14
|
+
--> statement-breakpoint
|
|
15
|
+
ALTER TABLE "ai_usage" ADD CONSTRAINT "ai_usage_account_id_accounts_id_fk" FOREIGN KEY ("account_id") REFERENCES "public"."accounts"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
|
16
|
+
CREATE INDEX "au_account_occurred" ON "ai_usage" USING btree ("account_id","occurred_at");
|