pierre-review 0.1.52 → 0.1.54

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.
@@ -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`);
@@ -162,6 +162,13 @@
162
162
  "when": 1780800000013,
163
163
  "tag": "0022_ci_status_events",
164
164
  "breakpoints": true
165
+ },
166
+ {
167
+ "idx": 23,
168
+ "version": "6",
169
+ "when": 1780800000014,
170
+ "tag": "0023_ai_usage",
171
+ "breakpoints": true
165
172
  }
166
173
  ]
167
174
  }
@@ -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");