@rulemetric/cli 0.6.3 → 0.6.5

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.
Files changed (38) hide show
  1. package/dist/{chunk-MUOUV5LY.js → chunk-3QVMIJUL.js} +2 -2
  2. package/dist/{chunk-6TPJGYFF.js → chunk-5ADHO5QF.js} +2 -2
  3. package/dist/{chunk-QNSVCSHG.js → chunk-6EMZI4Y3.js} +391 -374
  4. package/dist/chunk-6EMZI4Y3.js.map +7 -0
  5. package/dist/{chunk-VIYUIQHW.js → chunk-AHDRN6NE.js} +2 -2
  6. package/dist/{chunk-CVMRMSV4.js → chunk-BBLTN35F.js} +4 -4
  7. package/dist/{chunk-IPOO4IGF.js → chunk-CNMWYYSV.js} +2 -2
  8. package/dist/{chunk-3AEVHOTS.js → chunk-HNZLEEG2.js} +6 -2
  9. package/dist/chunk-HNZLEEG2.js.map +7 -0
  10. package/dist/chunk-TX2HKJLA.js +55 -0
  11. package/dist/chunk-TX2HKJLA.js.map +7 -0
  12. package/dist/commands/auth/login.js +6 -2
  13. package/dist/commands/auth/login.js.map +2 -2
  14. package/dist/commands/auth/signup.js +6 -2
  15. package/dist/commands/auth/signup.js.map +2 -2
  16. package/dist/commands/evals/agent.js +5 -5
  17. package/dist/commands/hooks/install.js +17 -5
  18. package/dist/commands/hooks/install.js.map +2 -2
  19. package/dist/commands/service/install.js +4 -0
  20. package/dist/commands/service/install.js.map +2 -2
  21. package/dist/lib/agent-loop.js +5 -5
  22. package/dist/lib/ensure-api-key.js +2 -1
  23. package/dist/lib/handlers/process-announcement.js +2 -2
  24. package/dist/lib/handlers/process-changelog.js +2 -2
  25. package/dist/lib/handlers/process-run-cleanup.js +2 -2
  26. package/dist/lib/handlers/process-session-goal.js +2 -2
  27. package/dist/lib/manual-tasks.js +2 -2
  28. package/dist/lib/telemetry.js +14 -0
  29. package/dist/lib/telemetry.js.map +7 -0
  30. package/oclif.manifest.json +83 -83
  31. package/package.json +6 -6
  32. package/dist/chunk-3AEVHOTS.js.map +0 -7
  33. package/dist/chunk-QNSVCSHG.js.map +0 -7
  34. /package/dist/{chunk-MUOUV5LY.js.map → chunk-3QVMIJUL.js.map} +0 -0
  35. /package/dist/{chunk-6TPJGYFF.js.map → chunk-5ADHO5QF.js.map} +0 -0
  36. /package/dist/{chunk-VIYUIQHW.js.map → chunk-AHDRN6NE.js.map} +0 -0
  37. /package/dist/{chunk-CVMRMSV4.js.map → chunk-BBLTN35F.js.map} +0 -0
  38. /package/dist/{chunk-IPOO4IGF.js.map → chunk-CNMWYYSV.js.map} +0 -0
@@ -464,137 +464,153 @@ var workerConnections = pgTable14("worker_connections", {
464
464
  index11("idx_worker_connections_type").on(table.userId, table.workerType)
465
465
  ]);
466
466
 
467
- // ../../packages/db/dist/schema/tables/eval-targets.js
468
- import { pgTable as pgTable15, text as text15, timestamp as timestamp15, jsonb as jsonb13, uuid as uuid15, integer as integer7, index as index12 } from "drizzle-orm/pg-core";
469
- var evalTargets = pgTable15("eval_targets", {
467
+ // ../../packages/db/dist/schema/tables/cli-setup-events.js
468
+ import { pgTable as pgTable15, text as text15, timestamp as timestamp15, jsonb as jsonb13, uuid as uuid15, index as index12 } from "drizzle-orm/pg-core";
469
+ var cliSetupEvents = pgTable15("cli_setup_events", {
470
470
  id: uuid15("id").primaryKey().defaultRandom(),
471
471
  userId: uuid15("user_id").notNull(),
472
- name: text15("name").notNull(),
473
- type: text15("type").notNull(),
474
- content: text15("content").notNull(),
475
- description: text15("description").notNull().default(""),
476
- metadata: jsonb13("metadata").notNull().default({}),
472
+ deviceId: text15("device_id").notNull(),
473
+ event: text15("event").notNull(),
474
+ cliVersion: text15("cli_version"),
475
+ os: text15("os"),
476
+ props: jsonb13("props").notNull().default({}),
477
+ createdAt: timestamp15("created_at", { withTimezone: true }).notNull().defaultNow()
478
+ }, (table) => [
479
+ index12("idx_cli_setup_events_user").on(table.userId, table.createdAt),
480
+ index12("idx_cli_setup_events_device").on(table.deviceId, table.createdAt)
481
+ ]);
482
+
483
+ // ../../packages/db/dist/schema/tables/eval-targets.js
484
+ import { pgTable as pgTable16, text as text16, timestamp as timestamp16, jsonb as jsonb14, uuid as uuid16, integer as integer7, index as index13 } from "drizzle-orm/pg-core";
485
+ var evalTargets = pgTable16("eval_targets", {
486
+ id: uuid16("id").primaryKey().defaultRandom(),
487
+ userId: uuid16("user_id").notNull(),
488
+ name: text16("name").notNull(),
489
+ type: text16("type").notNull(),
490
+ content: text16("content").notNull(),
491
+ description: text16("description").notNull().default(""),
492
+ metadata: jsonb14("metadata").notNull().default({}),
477
493
  version: integer7("version").notNull().default(1),
478
- parentId: uuid15("parent_id").references(() => evalTargets.id, { onDelete: "set null" }),
479
- createdAt: timestamp15("created_at", { withTimezone: true }).defaultNow(),
480
- updatedAt: timestamp15("updated_at", { withTimezone: true }).defaultNow()
494
+ parentId: uuid16("parent_id").references(() => evalTargets.id, { onDelete: "set null" }),
495
+ createdAt: timestamp16("created_at", { withTimezone: true }).defaultNow(),
496
+ updatedAt: timestamp16("updated_at", { withTimezone: true }).defaultNow()
481
497
  }, (table) => [
482
- index12("eval_targets_name_user_idx").on(table.name, table.userId),
483
- index12("idx_eval_targets_user").on(table.userId),
484
- index12("idx_eval_targets_type").on(table.type),
485
- index12("idx_eval_targets_parent").on(table.parentId)
498
+ index13("eval_targets_name_user_idx").on(table.name, table.userId),
499
+ index13("idx_eval_targets_user").on(table.userId),
500
+ index13("idx_eval_targets_type").on(table.type),
501
+ index13("idx_eval_targets_parent").on(table.parentId)
486
502
  ]);
487
- var evals = pgTable15("evals", {
488
- id: uuid15("id").primaryKey().defaultRandom(),
489
- evalTargetId: uuid15("eval_target_id").notNull().references(() => evalTargets.id, { onDelete: "cascade" }),
490
- name: text15("name").notNull(),
491
- prompt: text15("prompt").notNull(),
492
- expectedOutput: text15("expected_output").notNull().default(""),
493
- files: jsonb13("files").notNull().default([]),
494
- expectations: jsonb13("expectations").notNull().default([]),
495
- createdAt: timestamp15("created_at", { withTimezone: true }).defaultNow(),
496
- updatedAt: timestamp15("updated_at", { withTimezone: true }).defaultNow()
503
+ var evals = pgTable16("evals", {
504
+ id: uuid16("id").primaryKey().defaultRandom(),
505
+ evalTargetId: uuid16("eval_target_id").notNull().references(() => evalTargets.id, { onDelete: "cascade" }),
506
+ name: text16("name").notNull(),
507
+ prompt: text16("prompt").notNull(),
508
+ expectedOutput: text16("expected_output").notNull().default(""),
509
+ files: jsonb14("files").notNull().default([]),
510
+ expectations: jsonb14("expectations").notNull().default([]),
511
+ createdAt: timestamp16("created_at", { withTimezone: true }).defaultNow(),
512
+ updatedAt: timestamp16("updated_at", { withTimezone: true }).defaultNow()
497
513
  }, (table) => [
498
- index12("idx_evals_target").on(table.evalTargetId)
514
+ index13("idx_evals_target").on(table.evalTargetId)
499
515
  ]);
500
- var evalRuns = pgTable15("eval_runs", {
501
- id: uuid15("id").primaryKey().defaultRandom(),
502
- evalId: uuid15("eval_id").notNull().references(() => evals.id, { onDelete: "cascade" }),
503
- evalTargetId: uuid15("eval_target_id").notNull().references(() => evalTargets.id, { onDelete: "cascade" }),
516
+ var evalRuns = pgTable16("eval_runs", {
517
+ id: uuid16("id").primaryKey().defaultRandom(),
518
+ evalId: uuid16("eval_id").notNull().references(() => evals.id, { onDelete: "cascade" }),
519
+ evalTargetId: uuid16("eval_target_id").notNull().references(() => evalTargets.id, { onDelete: "cascade" }),
504
520
  evalTargetVersion: integer7("eval_target_version").notNull(),
505
- configuration: text15("configuration").notNull(),
521
+ configuration: text16("configuration").notNull(),
506
522
  runNumber: integer7("run_number").notNull().default(1),
507
523
  iteration: integer7("iteration").notNull().default(1),
508
- status: text15("status").notNull().default("completed"),
509
- outputs: jsonb13("outputs").notNull().default({}),
510
- timing: jsonb13("timing").notNull().default({}),
511
- grading: jsonb13("grading").notNull().default({}),
512
- comparison: jsonb13("comparison"),
513
- createdAt: timestamp15("created_at", { withTimezone: true }).defaultNow()
524
+ status: text16("status").notNull().default("completed"),
525
+ outputs: jsonb14("outputs").notNull().default({}),
526
+ timing: jsonb14("timing").notNull().default({}),
527
+ grading: jsonb14("grading").notNull().default({}),
528
+ comparison: jsonb14("comparison"),
529
+ createdAt: timestamp16("created_at", { withTimezone: true }).defaultNow()
514
530
  }, (table) => [
515
- index12("idx_eval_runs_eval").on(table.evalId),
516
- index12("idx_eval_runs_target").on(table.evalTargetId),
517
- index12("idx_eval_runs_iteration").on(table.evalTargetId, table.iteration)
531
+ index13("idx_eval_runs_eval").on(table.evalId),
532
+ index13("idx_eval_runs_target").on(table.evalTargetId),
533
+ index13("idx_eval_runs_iteration").on(table.evalTargetId, table.iteration)
518
534
  ]);
519
- var benchmarks = pgTable15("benchmarks", {
520
- id: uuid15("id").primaryKey().defaultRandom(),
521
- evalTargetId: uuid15("eval_target_id").notNull().references(() => evalTargets.id, { onDelete: "cascade" }),
535
+ var benchmarks = pgTable16("benchmarks", {
536
+ id: uuid16("id").primaryKey().defaultRandom(),
537
+ evalTargetId: uuid16("eval_target_id").notNull().references(() => evalTargets.id, { onDelete: "cascade" }),
522
538
  iteration: integer7("iteration").notNull().default(1),
523
- runSummary: jsonb13("run_summary").notNull().default({}),
524
- notes: jsonb13("notes").notNull().default([]),
525
- feedback: jsonb13("feedback"),
526
- createdAt: timestamp15("created_at", { withTimezone: true }).defaultNow()
539
+ runSummary: jsonb14("run_summary").notNull().default({}),
540
+ notes: jsonb14("notes").notNull().default([]),
541
+ feedback: jsonb14("feedback"),
542
+ createdAt: timestamp16("created_at", { withTimezone: true }).defaultNow()
527
543
  }, (table) => [
528
- index12("idx_benchmarks_target").on(table.evalTargetId)
544
+ index13("idx_benchmarks_target").on(table.evalTargetId)
529
545
  ]);
530
546
 
531
547
  // ../../packages/db/dist/schema/tables/optimization.js
532
- import { pgTable as pgTable16, text as text16, timestamp as timestamp16, jsonb as jsonb14, uuid as uuid16, integer as integer8, index as index13, real } from "drizzle-orm/pg-core";
533
- var triggerEvals = pgTable16("trigger_evals", {
534
- id: uuid16("id").primaryKey().defaultRandom(),
535
- evalTargetId: uuid16("eval_target_id").notNull().references(() => evalTargets.id, { onDelete: "cascade" }),
536
- userId: uuid16("user_id").notNull(),
537
- queries: jsonb14("queries").notNull().default([]),
538
- status: text16("status").notNull().default("pending_review"),
548
+ import { pgTable as pgTable17, text as text17, timestamp as timestamp17, jsonb as jsonb15, uuid as uuid17, integer as integer8, index as index14, real } from "drizzle-orm/pg-core";
549
+ var triggerEvals = pgTable17("trigger_evals", {
550
+ id: uuid17("id").primaryKey().defaultRandom(),
551
+ evalTargetId: uuid17("eval_target_id").notNull().references(() => evalTargets.id, { onDelete: "cascade" }),
552
+ userId: uuid17("user_id").notNull(),
553
+ queries: jsonb15("queries").notNull().default([]),
554
+ status: text17("status").notNull().default("pending_review"),
539
555
  trainIndices: integer8("train_indices").array().default([]),
540
556
  testIndices: integer8("test_indices").array().default([]),
541
- createdAt: timestamp16("created_at", { withTimezone: true }).defaultNow(),
542
- updatedAt: timestamp16("updated_at", { withTimezone: true }).defaultNow()
557
+ createdAt: timestamp17("created_at", { withTimezone: true }).defaultNow(),
558
+ updatedAt: timestamp17("updated_at", { withTimezone: true }).defaultNow()
543
559
  }, (table) => [
544
- index13("idx_trigger_evals_target").on(table.evalTargetId),
545
- index13("idx_trigger_evals_user").on(table.userId)
560
+ index14("idx_trigger_evals_target").on(table.evalTargetId),
561
+ index14("idx_trigger_evals_user").on(table.userId)
546
562
  ]);
547
- var optimizationRuns = pgTable16("optimization_runs", {
548
- id: uuid16("id").primaryKey().defaultRandom(),
549
- evalTargetId: uuid16("eval_target_id").notNull().references(() => evalTargets.id, { onDelete: "cascade" }),
550
- userId: uuid16("user_id").notNull(),
551
- type: text16("type").notNull(),
563
+ var optimizationRuns = pgTable17("optimization_runs", {
564
+ id: uuid17("id").primaryKey().defaultRandom(),
565
+ evalTargetId: uuid17("eval_target_id").notNull().references(() => evalTargets.id, { onDelete: "cascade" }),
566
+ userId: uuid17("user_id").notNull(),
567
+ type: text17("type").notNull(),
552
568
  iteration: integer8("iteration").notNull(),
553
569
  inputVersion: integer8("input_version").notNull(),
554
570
  outputVersion: integer8("output_version"),
555
571
  trainScore: real("train_score"),
556
572
  testScore: real("test_score"),
557
- analysis: jsonb14("analysis").notNull().default({}),
558
- status: text16("status").notNull().default("running"),
559
- createdAt: timestamp16("created_at", { withTimezone: true }).defaultNow()
573
+ analysis: jsonb15("analysis").notNull().default({}),
574
+ status: text17("status").notNull().default("running"),
575
+ createdAt: timestamp17("created_at", { withTimezone: true }).defaultNow()
560
576
  }, (table) => [
561
- index13("idx_optimization_runs_target").on(table.evalTargetId),
562
- index13("idx_optimization_runs_user").on(table.userId)
577
+ index14("idx_optimization_runs_target").on(table.evalTargetId),
578
+ index14("idx_optimization_runs_user").on(table.userId)
563
579
  ]);
564
580
 
565
581
  // ../../packages/db/dist/schema/tables/context-snapshots.js
566
- import { pgTable as pgTable17, text as text17, timestamp as timestamp17, jsonb as jsonb15, uuid as uuid17, integer as integer9, real as real2, index as index14, uniqueIndex as uniqueIndex7 } from "drizzle-orm/pg-core";
567
- var contextSnapshots = pgTable17("context_snapshots", {
568
- id: uuid17("id").primaryKey().defaultRandom(),
569
- sessionId: uuid17("session_id").references(() => sessions.id, { onDelete: "cascade" }),
570
- userId: uuid17("user_id").notNull().references(() => profiles.id, { onDelete: "cascade" }),
582
+ import { pgTable as pgTable18, text as text18, timestamp as timestamp18, jsonb as jsonb16, uuid as uuid18, integer as integer9, real as real2, index as index15, uniqueIndex as uniqueIndex7 } from "drizzle-orm/pg-core";
583
+ var contextSnapshots = pgTable18("context_snapshots", {
584
+ id: uuid18("id").primaryKey().defaultRandom(),
585
+ sessionId: uuid18("session_id").references(() => sessions.id, { onDelete: "cascade" }),
586
+ userId: uuid18("user_id").notNull().references(() => profiles.id, { onDelete: "cascade" }),
571
587
  sequence: integer9("sequence").notNull().default(0),
572
- provider: text17("provider").notNull(),
573
- model: text17("model").notNull(),
574
- systemPrompt: text17("system_prompt").notNull(),
575
- injectedInstructions: jsonb15("injected_instructions").notNull().default([]),
576
- messagesSummary: jsonb15("messages_summary").notNull(),
577
- tools: jsonb15("tools").notNull().default([]),
588
+ provider: text18("provider").notNull(),
589
+ model: text18("model").notNull(),
590
+ systemPrompt: text18("system_prompt").notNull(),
591
+ injectedInstructions: jsonb16("injected_instructions").notNull().default([]),
592
+ messagesSummary: jsonb16("messages_summary").notNull(),
593
+ tools: jsonb16("tools").notNull().default([]),
578
594
  // Deprecated: use content_blobs via tools_hash
579
- systemHash: text17("system_hash").notNull(),
580
- requestHash: text17("request_hash").notNull().default(""),
581
- toolsHash: text17("tools_hash"),
582
- injectedHash: text17("injected_hash"),
583
- messagesDelta: jsonb15("messages_delta").default([]),
595
+ systemHash: text18("system_hash").notNull(),
596
+ requestHash: text18("request_hash").notNull().default(""),
597
+ toolsHash: text18("tools_hash"),
598
+ injectedHash: text18("injected_hash"),
599
+ messagesDelta: jsonb16("messages_delta").default([]),
584
600
  // Storage pointer set when messages_delta is offloaded to the snapshot-deltas
585
601
  // bucket (Stage 1+). NULL = inline (messages_delta populated) OR pruned (both
586
602
  // NULL — see 00101). docs/plans/2026-06-24-messages-delta-object-storage-offload.md
587
- messagesDeltaRef: text17("messages_delta_ref"),
603
+ messagesDeltaRef: text18("messages_delta_ref"),
588
604
  maxTokens: integer9("max_tokens"),
589
605
  temperature: real2("temperature"),
590
606
  estimatedTokens: integer9("estimated_tokens"),
591
- capturedAt: timestamp17("captured_at", { withTimezone: true }).notNull().defaultNow(),
592
- metadata: jsonb15("metadata").default({})
607
+ capturedAt: timestamp18("captured_at", { withTimezone: true }).notNull().defaultNow(),
608
+ metadata: jsonb16("metadata").default({})
593
609
  }, (table) => [
594
- index14("idx_context_snapshots_session").on(table.sessionId),
595
- index14("idx_context_snapshots_user").on(table.userId),
596
- index14("idx_context_snapshots_hash").on(table.systemHash),
597
- index14("idx_context_snapshots_request_hash").on(table.requestHash),
610
+ index15("idx_context_snapshots_session").on(table.sessionId),
611
+ index15("idx_context_snapshots_user").on(table.userId),
612
+ index15("idx_context_snapshots_hash").on(table.systemHash),
613
+ index15("idx_context_snapshots_request_hash").on(table.requestHash),
598
614
  uniqueIndex7("idx_snapshots_session_request").on(table.sessionId, table.requestHash),
599
615
  // Concurrent snapshot POSTs for one session must not reuse a sequence — stops
600
616
  // the live duplicate-sequence corruption. Built via migration 00095.
@@ -604,416 +620,416 @@ var contextSnapshots = pgTable17("context_snapshots", {
604
620
  // WHERE user_id ORDER BY session_id, captured_at DESC). Matches the ORDER BY so
605
621
  // the planner drops the Incremental Sort (the ~11s-max, temp-spill-prone step);
606
622
  // verified 60.6ms -> 26.3ms. Built CONCURRENTLY via migration 00106.
607
- index14("idx_context_snapshots_user_session_captured").on(table.userId, table.sessionId, table.capturedAt.desc())
623
+ index15("idx_context_snapshots_user_session_captured").on(table.userId, table.sessionId, table.capturedAt.desc())
608
624
  ]);
609
625
 
610
626
  // ../../packages/db/dist/schema/tables/content-blobs.js
611
- import { pgTable as pgTable18, text as text18, timestamp as timestamp18, jsonb as jsonb16, integer as integer10, index as index15 } from "drizzle-orm/pg-core";
612
- var contentBlobs = pgTable18("content_blobs", {
613
- hash: text18("hash").primaryKey(),
614
- contentType: text18("content_type").notNull(),
615
- content: jsonb16("content").notNull(),
627
+ import { pgTable as pgTable19, text as text19, timestamp as timestamp19, jsonb as jsonb17, integer as integer10, index as index16 } from "drizzle-orm/pg-core";
628
+ var contentBlobs = pgTable19("content_blobs", {
629
+ hash: text19("hash").primaryKey(),
630
+ contentType: text19("content_type").notNull(),
631
+ content: jsonb17("content").notNull(),
616
632
  sizeBytes: integer10("size_bytes").notNull().default(0),
617
- createdAt: timestamp18("created_at", { withTimezone: true }).defaultNow()
633
+ createdAt: timestamp19("created_at", { withTimezone: true }).defaultNow()
618
634
  }, (table) => [
619
- index15("idx_content_blobs_type").on(table.contentType)
635
+ index16("idx_content_blobs_type").on(table.contentType)
620
636
  ]);
621
637
 
622
638
  // ../../packages/db/dist/schema/tables/eval-jobs.js
623
- import { pgTable as pgTable19, text as text19, timestamp as timestamp19, jsonb as jsonb17, uuid as uuid18, index as index16, integer as integer11, bigint as bigint2 } from "drizzle-orm/pg-core";
624
- var evalJobs = pgTable19("eval_jobs", {
625
- id: uuid18("id").primaryKey().defaultRandom(),
626
- userId: uuid18("user_id").notNull(),
627
- evalTargetId: uuid18("eval_target_id").notNull().references(() => evalTargets.id, { onDelete: "cascade" }),
628
- status: text19("status").notNull().default("pending"),
629
- config: jsonb17("config").notNull().default({}),
630
- progress: jsonb17("progress").notNull().default({}),
631
- result: jsonb17("result"),
632
- error: text19("error"),
633
- attempts: integer11("attempts").notNull().default(0),
634
- graphileJobId: bigint2("graphile_job_id", { mode: "number" }),
635
- taskKind: text19("task_kind"),
636
- payload: jsonb17("payload"),
637
- claimedBy: text19("claimed_by"),
638
- claimedAt: timestamp19("claimed_at", { withTimezone: true }),
639
- leaseExpiresAt: timestamp19("lease_expires_at", { withTimezone: true }),
640
- createdAt: timestamp19("created_at", { withTimezone: true }).defaultNow(),
641
- updatedAt: timestamp19("updated_at", { withTimezone: true }).defaultNow(),
642
- completedAt: timestamp19("completed_at", { withTimezone: true })
643
- }, (table) => [
644
- index16("idx_eval_jobs_user").on(table.userId),
645
- index16("idx_eval_jobs_target").on(table.evalTargetId),
646
- index16("idx_eval_jobs_status").on(table.status),
647
- index16("idx_eval_jobs_pending").on(table.userId, table.status)
648
- ]);
649
-
650
- // ../../packages/db/dist/schema/tables/agent-jobs.js
651
- import { pgTable as pgTable20, text as text20, timestamp as timestamp20, jsonb as jsonb18, uuid as uuid19, integer as integer12, index as index17 } from "drizzle-orm/pg-core";
652
- var agentJobs = pgTable20("agent_jobs", {
639
+ import { pgTable as pgTable20, text as text20, timestamp as timestamp20, jsonb as jsonb18, uuid as uuid19, index as index17, integer as integer11, bigint as bigint2 } from "drizzle-orm/pg-core";
640
+ var evalJobs = pgTable20("eval_jobs", {
653
641
  id: uuid19("id").primaryKey().defaultRandom(),
654
642
  userId: uuid19("user_id").notNull(),
655
- taskKind: text20("task_kind").notNull(),
643
+ evalTargetId: uuid19("eval_target_id").notNull().references(() => evalTargets.id, { onDelete: "cascade" }),
656
644
  status: text20("status").notNull().default("pending"),
657
- payload: jsonb18("payload").notNull(),
658
- dedupeKey: text20("dedupe_key"),
645
+ config: jsonb18("config").notNull().default({}),
646
+ progress: jsonb18("progress").notNull().default({}),
659
647
  result: jsonb18("result"),
660
648
  error: text20("error"),
661
- attempts: integer12("attempts").notNull().default(0),
649
+ attempts: integer11("attempts").notNull().default(0),
650
+ graphileJobId: bigint2("graphile_job_id", { mode: "number" }),
651
+ taskKind: text20("task_kind"),
652
+ payload: jsonb18("payload"),
662
653
  claimedBy: text20("claimed_by"),
663
654
  claimedAt: timestamp20("claimed_at", { withTimezone: true }),
664
655
  leaseExpiresAt: timestamp20("lease_expires_at", { withTimezone: true }),
665
- createdAt: timestamp20("created_at", { withTimezone: true }).notNull().defaultNow(),
666
- updatedAt: timestamp20("updated_at", { withTimezone: true }).notNull().defaultNow(),
656
+ createdAt: timestamp20("created_at", { withTimezone: true }).defaultNow(),
657
+ updatedAt: timestamp20("updated_at", { withTimezone: true }).defaultNow(),
667
658
  completedAt: timestamp20("completed_at", { withTimezone: true })
668
659
  }, (table) => [
669
- index17("idx_agent_jobs_claim").on(table.userId, table.status, table.taskKind, table.createdAt),
670
- index17("idx_agent_jobs_dedupe").on(table.userId, table.taskKind, table.dedupeKey)
660
+ index17("idx_eval_jobs_user").on(table.userId),
661
+ index17("idx_eval_jobs_target").on(table.evalTargetId),
662
+ index17("idx_eval_jobs_status").on(table.status),
663
+ index17("idx_eval_jobs_pending").on(table.userId, table.status)
671
664
  ]);
672
665
 
673
- // ../../packages/db/dist/schema/tables/insights.js
674
- import { pgTable as pgTable21, text as text21, timestamp as timestamp21, jsonb as jsonb19, uuid as uuid20, index as index18, uniqueIndex as uniqueIndex8, integer as integer13, bigint as bigint3 } from "drizzle-orm/pg-core";
675
- var insightsJobs = pgTable21("insights_jobs", {
666
+ // ../../packages/db/dist/schema/tables/agent-jobs.js
667
+ import { pgTable as pgTable21, text as text21, timestamp as timestamp21, jsonb as jsonb19, uuid as uuid20, integer as integer12, index as index18 } from "drizzle-orm/pg-core";
668
+ var agentJobs = pgTable21("agent_jobs", {
676
669
  id: uuid20("id").primaryKey().defaultRandom(),
677
670
  userId: uuid20("user_id").notNull(),
671
+ taskKind: text21("task_kind").notNull(),
678
672
  status: text21("status").notNull().default("pending"),
679
- projectPath: text21("project_path"),
680
- // Canonical project identity (project_path-keying fragments one project across
681
- // worktrees/subdirs/cwds — migration 00104). Nullable: legacy/unlinked rows fall
682
- // back to project_path. Stamped at enqueue when resolvable.
683
- projectId: uuid20("project_id").references(() => projects.id, { onDelete: "set null" }),
684
- config: jsonb19("config").notNull().default({}),
685
- progress: jsonb19("progress").notNull().default({}),
673
+ payload: jsonb19("payload").notNull(),
674
+ dedupeKey: text21("dedupe_key"),
686
675
  result: jsonb19("result"),
687
676
  error: text21("error"),
688
- attempts: integer13("attempts").notNull().default(0),
689
- graphileJobId: bigint3("graphile_job_id", { mode: "number" }),
690
- taskKind: text21("task_kind"),
691
- payload: jsonb19("payload"),
677
+ attempts: integer12("attempts").notNull().default(0),
692
678
  claimedBy: text21("claimed_by"),
693
679
  claimedAt: timestamp21("claimed_at", { withTimezone: true }),
694
680
  leaseExpiresAt: timestamp21("lease_expires_at", { withTimezone: true }),
695
- createdAt: timestamp21("created_at", { withTimezone: true }).defaultNow(),
696
- updatedAt: timestamp21("updated_at", { withTimezone: true }).defaultNow(),
681
+ createdAt: timestamp21("created_at", { withTimezone: true }).notNull().defaultNow(),
682
+ updatedAt: timestamp21("updated_at", { withTimezone: true }).notNull().defaultNow(),
697
683
  completedAt: timestamp21("completed_at", { withTimezone: true })
698
684
  }, (table) => [
699
- index18("idx_insights_jobs_user").on(table.userId),
700
- index18("idx_insights_jobs_status").on(table.status),
701
- index18("idx_insights_jobs_pending").on(table.userId, table.status),
702
- index18("idx_insights_jobs_project").on(table.projectId)
685
+ index18("idx_agent_jobs_claim").on(table.userId, table.status, table.taskKind, table.createdAt),
686
+ index18("idx_agent_jobs_dedupe").on(table.userId, table.taskKind, table.dedupeKey)
703
687
  ]);
704
- var insightsReports = pgTable21("insights_reports", {
705
- id: uuid20("id").primaryKey().defaultRandom(),
706
- userId: uuid20("user_id").notNull(),
707
- projectPath: text21("project_path"),
708
- data: jsonb19("data").notNull(),
709
- reportHtml: text21("report_html"),
710
- createdAt: timestamp21("created_at", { withTimezone: true }).defaultNow()
688
+
689
+ // ../../packages/db/dist/schema/tables/insights.js
690
+ import { pgTable as pgTable22, text as text22, timestamp as timestamp22, jsonb as jsonb20, uuid as uuid21, index as index19, uniqueIndex as uniqueIndex8, integer as integer13, bigint as bigint3 } from "drizzle-orm/pg-core";
691
+ var insightsJobs = pgTable22("insights_jobs", {
692
+ id: uuid21("id").primaryKey().defaultRandom(),
693
+ userId: uuid21("user_id").notNull(),
694
+ status: text22("status").notNull().default("pending"),
695
+ projectPath: text22("project_path"),
696
+ // Canonical project identity (project_path-keying fragments one project across
697
+ // worktrees/subdirs/cwds — migration 00104). Nullable: legacy/unlinked rows fall
698
+ // back to project_path. Stamped at enqueue when resolvable.
699
+ projectId: uuid21("project_id").references(() => projects.id, { onDelete: "set null" }),
700
+ config: jsonb20("config").notNull().default({}),
701
+ progress: jsonb20("progress").notNull().default({}),
702
+ result: jsonb20("result"),
703
+ error: text22("error"),
704
+ attempts: integer13("attempts").notNull().default(0),
705
+ graphileJobId: bigint3("graphile_job_id", { mode: "number" }),
706
+ taskKind: text22("task_kind"),
707
+ payload: jsonb20("payload"),
708
+ claimedBy: text22("claimed_by"),
709
+ claimedAt: timestamp22("claimed_at", { withTimezone: true }),
710
+ leaseExpiresAt: timestamp22("lease_expires_at", { withTimezone: true }),
711
+ createdAt: timestamp22("created_at", { withTimezone: true }).defaultNow(),
712
+ updatedAt: timestamp22("updated_at", { withTimezone: true }).defaultNow(),
713
+ completedAt: timestamp22("completed_at", { withTimezone: true })
711
714
  }, (table) => [
712
- index18("idx_insights_user").on(table.userId),
713
- index18("idx_insights_created").on(table.createdAt),
714
- uniqueIndex8("idx_insights_user_project").on(table.userId, table.projectPath)
715
+ index19("idx_insights_jobs_user").on(table.userId),
716
+ index19("idx_insights_jobs_status").on(table.status),
717
+ index19("idx_insights_jobs_pending").on(table.userId, table.status),
718
+ index19("idx_insights_jobs_project").on(table.projectId)
715
719
  ]);
716
-
717
- // ../../packages/db/dist/schema/tables/api-keys.js
718
- import { pgTable as pgTable22, text as text22, timestamp as timestamp22, uuid as uuid21, index as index19, uniqueIndex as uniqueIndex9 } from "drizzle-orm/pg-core";
719
- var apiKeys = pgTable22("api_keys", {
720
+ var insightsReports = pgTable22("insights_reports", {
720
721
  id: uuid21("id").primaryKey().defaultRandom(),
721
- userId: uuid21("user_id").notNull().references(() => profiles.id, { onDelete: "cascade" }),
722
- name: text22("name").notNull(),
723
- keyHash: text22("key_hash").notNull(),
724
- keyPrefix: text22("key_prefix").notNull(),
725
- lastUsedAt: timestamp22("last_used_at", { withTimezone: true }),
726
- expiresAt: timestamp22("expires_at", { withTimezone: true }),
727
- revokedAt: timestamp22("revoked_at", { withTimezone: true }),
722
+ userId: uuid21("user_id").notNull(),
723
+ projectPath: text22("project_path"),
724
+ data: jsonb20("data").notNull(),
725
+ reportHtml: text22("report_html"),
728
726
  createdAt: timestamp22("created_at", { withTimezone: true }).defaultNow()
729
727
  }, (table) => [
730
- index19("idx_api_keys_user").on(table.userId),
731
- uniqueIndex9("idx_api_keys_hash").on(table.keyHash)
728
+ index19("idx_insights_user").on(table.userId),
729
+ index19("idx_insights_created").on(table.createdAt),
730
+ uniqueIndex8("idx_insights_user_project").on(table.userId, table.projectPath)
732
731
  ]);
733
732
 
734
- // ../../packages/db/dist/schema/tables/extension-auth-codes.js
735
- import { pgTable as pgTable23, text as text23, timestamp as timestamp23, uuid as uuid22, index as index20 } from "drizzle-orm/pg-core";
736
- var extensionAuthCodes = pgTable23("extension_auth_codes", {
737
- code: text23("code").primaryKey(),
733
+ // ../../packages/db/dist/schema/tables/api-keys.js
734
+ import { pgTable as pgTable23, text as text23, timestamp as timestamp23, uuid as uuid22, index as index20, uniqueIndex as uniqueIndex9 } from "drizzle-orm/pg-core";
735
+ var apiKeys = pgTable23("api_keys", {
736
+ id: uuid22("id").primaryKey().defaultRandom(),
738
737
  userId: uuid22("user_id").notNull().references(() => profiles.id, { onDelete: "cascade" }),
739
- editor: text23("editor"),
740
- email: text23("email"),
741
- expiresAt: timestamp23("expires_at", { withTimezone: true }).notNull(),
738
+ name: text23("name").notNull(),
739
+ keyHash: text23("key_hash").notNull(),
740
+ keyPrefix: text23("key_prefix").notNull(),
741
+ lastUsedAt: timestamp23("last_used_at", { withTimezone: true }),
742
+ expiresAt: timestamp23("expires_at", { withTimezone: true }),
743
+ revokedAt: timestamp23("revoked_at", { withTimezone: true }),
742
744
  createdAt: timestamp23("created_at", { withTimezone: true }).defaultNow()
743
745
  }, (table) => [
744
- index20("idx_ext_auth_codes_expiry").on(table.expiresAt)
746
+ index20("idx_api_keys_user").on(table.userId),
747
+ uniqueIndex9("idx_api_keys_hash").on(table.keyHash)
745
748
  ]);
746
749
 
747
- // ../../packages/db/dist/schema/tables/eval-conversations.js
748
- import { pgTable as pgTable24, text as text24, timestamp as timestamp24, jsonb as jsonb20, uuid as uuid23, index as index21 } from "drizzle-orm/pg-core";
749
- var evalConversations = pgTable24("eval_conversations", {
750
- id: uuid23("id").primaryKey().defaultRandom(),
751
- evalTargetId: uuid23("eval_target_id").notNull().references(() => evalTargets.id, { onDelete: "cascade" }),
752
- userId: uuid23("user_id").notNull(),
753
- messages: jsonb20("messages").notNull().default([]),
754
- status: text24("status").notNull().default("active"),
755
- createdAt: timestamp24("created_at", { withTimezone: true }).defaultNow(),
756
- updatedAt: timestamp24("updated_at", { withTimezone: true }).defaultNow()
750
+ // ../../packages/db/dist/schema/tables/extension-auth-codes.js
751
+ import { pgTable as pgTable24, text as text24, timestamp as timestamp24, uuid as uuid23, index as index21 } from "drizzle-orm/pg-core";
752
+ var extensionAuthCodes = pgTable24("extension_auth_codes", {
753
+ code: text24("code").primaryKey(),
754
+ userId: uuid23("user_id").notNull().references(() => profiles.id, { onDelete: "cascade" }),
755
+ editor: text24("editor"),
756
+ email: text24("email"),
757
+ expiresAt: timestamp24("expires_at", { withTimezone: true }).notNull(),
758
+ createdAt: timestamp24("created_at", { withTimezone: true }).defaultNow()
757
759
  }, (table) => [
758
- index21("idx_eval_conversations_target").on(table.evalTargetId),
759
- index21("idx_eval_conversations_user").on(table.userId)
760
+ index21("idx_ext_auth_codes_expiry").on(table.expiresAt)
760
761
  ]);
761
762
 
762
- // ../../packages/db/dist/schema/tables/security-events.js
763
- import { pgTable as pgTable25, uuid as uuid24, text as text25, jsonb as jsonb21, timestamp as timestamp25, index as index22 } from "drizzle-orm/pg-core";
764
- var securityEvents = pgTable25("security_events", {
763
+ // ../../packages/db/dist/schema/tables/eval-conversations.js
764
+ import { pgTable as pgTable25, text as text25, timestamp as timestamp25, jsonb as jsonb21, uuid as uuid24, index as index22 } from "drizzle-orm/pg-core";
765
+ var evalConversations = pgTable25("eval_conversations", {
765
766
  id: uuid24("id").primaryKey().defaultRandom(),
766
- eventType: text25("event_type").notNull(),
767
- severity: text25("severity").notNull(),
768
- category: text25("category").notNull(),
769
- source: text25("source").notNull(),
770
- entityType: text25("entity_type"),
771
- entityId: uuid24("entity_id"),
772
- userId: uuid24("user_id"),
773
- details: jsonb21("details").notNull().default({}),
774
- createdAt: timestamp25("created_at", { withTimezone: true }).notNull().defaultNow()
767
+ evalTargetId: uuid24("eval_target_id").notNull().references(() => evalTargets.id, { onDelete: "cascade" }),
768
+ userId: uuid24("user_id").notNull(),
769
+ messages: jsonb21("messages").notNull().default([]),
770
+ status: text25("status").notNull().default("active"),
771
+ createdAt: timestamp25("created_at", { withTimezone: true }).defaultNow(),
772
+ updatedAt: timestamp25("updated_at", { withTimezone: true }).defaultNow()
775
773
  }, (table) => [
776
- index22("idx_security_events_type").on(table.eventType),
777
- index22("idx_security_events_user").on(table.userId),
778
- index22("idx_security_events_created").on(table.createdAt),
779
- index22("idx_security_events_severity").on(table.severity),
780
- index22("idx_security_events_source").on(table.source)
774
+ index22("idx_eval_conversations_target").on(table.evalTargetId),
775
+ index22("idx_eval_conversations_user").on(table.userId)
781
776
  ]);
782
777
 
783
- // ../../packages/db/dist/schema/tables/tasks.js
784
- import { pgTable as pgTable26, text as text26, timestamp as timestamp26, uuid as uuid25, index as index23 } from "drizzle-orm/pg-core";
785
- var tasks = pgTable26("tasks", {
778
+ // ../../packages/db/dist/schema/tables/security-events.js
779
+ import { pgTable as pgTable26, uuid as uuid25, text as text26, jsonb as jsonb22, timestamp as timestamp26, index as index23 } from "drizzle-orm/pg-core";
780
+ var securityEvents = pgTable26("security_events", {
786
781
  id: uuid25("id").primaryKey().defaultRandom(),
787
- title: text26("title").notNull(),
788
- description: text26("description"),
789
- status: text26("status").notNull().default("pending"),
790
- createdBy: uuid25("created_by"),
791
- createdAt: timestamp26("created_at", { withTimezone: true }).defaultNow(),
792
- updatedAt: timestamp26("updated_at", { withTimezone: true }).defaultNow()
782
+ eventType: text26("event_type").notNull(),
783
+ severity: text26("severity").notNull(),
784
+ category: text26("category").notNull(),
785
+ source: text26("source").notNull(),
786
+ entityType: text26("entity_type"),
787
+ entityId: uuid25("entity_id"),
788
+ userId: uuid25("user_id"),
789
+ details: jsonb22("details").notNull().default({}),
790
+ createdAt: timestamp26("created_at", { withTimezone: true }).notNull().defaultNow()
793
791
  }, (table) => [
794
- index23("tasks_created_by_idx").on(table.createdBy),
795
- index23("tasks_status_idx").on(table.status)
792
+ index23("idx_security_events_type").on(table.eventType),
793
+ index23("idx_security_events_user").on(table.userId),
794
+ index23("idx_security_events_created").on(table.createdAt),
795
+ index23("idx_security_events_severity").on(table.severity),
796
+ index23("idx_security_events_source").on(table.source)
796
797
  ]);
797
798
 
798
- // ../../packages/db/dist/schema/tables/skill-submissions.js
799
- import { pgTable as pgTable27, text as text27, timestamp as timestamp27, jsonb as jsonb22, uuid as uuid26 } from "drizzle-orm/pg-core";
800
- var skillSubmissions = pgTable27("skill_submissions", {
799
+ // ../../packages/db/dist/schema/tables/tasks.js
800
+ import { pgTable as pgTable27, text as text27, timestamp as timestamp27, uuid as uuid26, index as index24 } from "drizzle-orm/pg-core";
801
+ var tasks = pgTable27("tasks", {
801
802
  id: uuid26("id").primaryKey().defaultRandom(),
802
- skillId: text27("skill_id").notNull(),
803
- name: text27("name").notNull(),
804
- description: text27("description").notNull(),
805
- category: text27("category").notNull(),
806
- tools: text27("tools").array().notNull(),
807
- tags: text27("tags").array().default([]),
808
- content: text27("content").notNull(),
803
+ title: text27("title").notNull(),
804
+ description: text27("description"),
809
805
  status: text27("status").notNull().default("pending"),
810
- // pending | approved | rejected
811
- submittedBy: uuid26("submitted_by").notNull(),
812
- reviewedBy: uuid26("reviewed_by"),
813
- reviewNote: text27("review_note"),
814
- metadata: jsonb22("metadata"),
806
+ createdBy: uuid26("created_by"),
815
807
  createdAt: timestamp27("created_at", { withTimezone: true }).defaultNow(),
816
808
  updatedAt: timestamp27("updated_at", { withTimezone: true }).defaultNow()
809
+ }, (table) => [
810
+ index24("tasks_created_by_idx").on(table.createdBy),
811
+ index24("tasks_status_idx").on(table.status)
812
+ ]);
813
+
814
+ // ../../packages/db/dist/schema/tables/skill-submissions.js
815
+ import { pgTable as pgTable28, text as text28, timestamp as timestamp28, jsonb as jsonb23, uuid as uuid27 } from "drizzle-orm/pg-core";
816
+ var skillSubmissions = pgTable28("skill_submissions", {
817
+ id: uuid27("id").primaryKey().defaultRandom(),
818
+ skillId: text28("skill_id").notNull(),
819
+ name: text28("name").notNull(),
820
+ description: text28("description").notNull(),
821
+ category: text28("category").notNull(),
822
+ tools: text28("tools").array().notNull(),
823
+ tags: text28("tags").array().default([]),
824
+ content: text28("content").notNull(),
825
+ status: text28("status").notNull().default("pending"),
826
+ // pending | approved | rejected
827
+ submittedBy: uuid27("submitted_by").notNull(),
828
+ reviewedBy: uuid27("reviewed_by"),
829
+ reviewNote: text28("review_note"),
830
+ metadata: jsonb23("metadata"),
831
+ createdAt: timestamp28("created_at", { withTimezone: true }).defaultNow(),
832
+ updatedAt: timestamp28("updated_at", { withTimezone: true }).defaultNow()
817
833
  });
818
834
 
819
835
  // ../../packages/db/dist/schema/tables/harness-releases.js
820
- import { pgTable as pgTable28, text as text28, timestamp as timestamp28, jsonb as jsonb23, uuid as uuid27, uniqueIndex as uniqueIndex10, index as index24 } from "drizzle-orm/pg-core";
821
- var harnessReleases = pgTable28("harness_releases", {
822
- id: uuid27("id").primaryKey().defaultRandom(),
823
- harness: text28("harness").notNull(),
836
+ import { pgTable as pgTable29, text as text29, timestamp as timestamp29, jsonb as jsonb24, uuid as uuid28, uniqueIndex as uniqueIndex10, index as index25 } from "drizzle-orm/pg-core";
837
+ var harnessReleases = pgTable29("harness_releases", {
838
+ id: uuid28("id").primaryKey().defaultRandom(),
839
+ harness: text29("harness").notNull(),
824
840
  // "claude_code", "cursor", "copilot"
825
- version: text28("version").notNull(),
841
+ version: text29("version").notNull(),
826
842
  // "v2.1.119"
827
- publishedAt: timestamp28("published_at", { withTimezone: true }).notNull(),
828
- title: text28("title"),
843
+ publishedAt: timestamp29("published_at", { withTimezone: true }).notNull(),
844
+ title: text29("title"),
829
845
  // release name
830
- body: text28("body"),
846
+ body: text29("body"),
831
847
  // raw markdown
832
- categories: jsonb23("categories").default({}),
848
+ categories: jsonb24("categories").default({}),
833
849
  // { features: string[], fixes: string[], security: string[] }
834
- url: text28("url"),
850
+ url: text29("url"),
835
851
  // link to release page
836
- createdAt: timestamp28("created_at", { withTimezone: true }).defaultNow()
852
+ createdAt: timestamp29("created_at", { withTimezone: true }).defaultNow()
837
853
  }, (table) => [
838
854
  uniqueIndex10("idx_harness_releases_unique").on(table.harness, table.version),
839
- index24("idx_harness_releases_harness").on(table.harness),
840
- index24("idx_harness_releases_published").on(table.publishedAt)
855
+ index25("idx_harness_releases_harness").on(table.harness),
856
+ index25("idx_harness_releases_published").on(table.publishedAt)
841
857
  ]);
842
858
 
843
859
  // ../../packages/db/dist/schema/tables/notifications.js
844
- import { pgTable as pgTable29, text as text29, timestamp as timestamp29, jsonb as jsonb24, uuid as uuid28, index as index25, uniqueIndex as uniqueIndex11 } from "drizzle-orm/pg-core";
845
- var notifications = pgTable29("notifications", {
846
- id: uuid28("id").primaryKey().defaultRandom(),
847
- userId: uuid28("user_id").notNull(),
848
- type: text29("type").notNull(),
849
- title: text29("title").notNull(),
850
- body: text29("body"),
851
- url: text29("url"),
852
- sourceTable: text29("source_table"),
853
- sourceId: text29("source_id"),
854
- metadata: jsonb24("metadata").notNull().default({}),
855
- readAt: timestamp29("read_at", { withTimezone: true }),
856
- createdAt: timestamp29("created_at", { withTimezone: true }).notNull().defaultNow()
860
+ import { pgTable as pgTable30, text as text30, timestamp as timestamp30, jsonb as jsonb25, uuid as uuid29, index as index26, uniqueIndex as uniqueIndex11 } from "drizzle-orm/pg-core";
861
+ var notifications = pgTable30("notifications", {
862
+ id: uuid29("id").primaryKey().defaultRandom(),
863
+ userId: uuid29("user_id").notNull(),
864
+ type: text30("type").notNull(),
865
+ title: text30("title").notNull(),
866
+ body: text30("body"),
867
+ url: text30("url"),
868
+ sourceTable: text30("source_table"),
869
+ sourceId: text30("source_id"),
870
+ metadata: jsonb25("metadata").notNull().default({}),
871
+ readAt: timestamp30("read_at", { withTimezone: true }),
872
+ createdAt: timestamp30("created_at", { withTimezone: true }).notNull().defaultNow()
857
873
  }, (table) => [
858
- index25("idx_notifications_user_created").on(table.userId, table.createdAt),
859
- index25("idx_notifications_user_unread").on(table.userId),
874
+ index26("idx_notifications_user_created").on(table.userId, table.createdAt),
875
+ index26("idx_notifications_user_unread").on(table.userId),
860
876
  uniqueIndex11("idx_notifications_source_dedup").on(table.userId, table.sourceTable, table.sourceId)
861
877
  ]);
862
878
 
863
879
  // ../../packages/db/dist/schema/tables/launch-jobs.js
864
- import { pgTable as pgTable30, text as text30, timestamp as timestamp30, jsonb as jsonb25, uuid as uuid29, index as index26, integer as integer14, bigint as bigint4 } from "drizzle-orm/pg-core";
865
- var launchJobs = pgTable30("launch_jobs", {
866
- id: uuid29("id").primaryKey().defaultRandom(),
867
- userId: uuid29("user_id").notNull(),
868
- tool: text30("tool").notNull(),
869
- status: text30("status").notNull().default("pending"),
870
- config: jsonb25("config").notNull().default({}),
871
- result: jsonb25("result"),
872
- error: text30("error"),
880
+ import { pgTable as pgTable31, text as text31, timestamp as timestamp31, jsonb as jsonb26, uuid as uuid30, index as index27, integer as integer14, bigint as bigint4 } from "drizzle-orm/pg-core";
881
+ var launchJobs = pgTable31("launch_jobs", {
882
+ id: uuid30("id").primaryKey().defaultRandom(),
883
+ userId: uuid30("user_id").notNull(),
884
+ tool: text31("tool").notNull(),
885
+ status: text31("status").notNull().default("pending"),
886
+ config: jsonb26("config").notNull().default({}),
887
+ result: jsonb26("result"),
888
+ error: text31("error"),
873
889
  attempts: integer14("attempts").notNull().default(0),
874
890
  graphileJobId: bigint4("graphile_job_id", { mode: "number" }),
875
- taskKind: text30("task_kind"),
876
- payload: jsonb25("payload"),
877
- claimedBy: text30("claimed_by"),
878
- claimedAt: timestamp30("claimed_at", { withTimezone: true }),
879
- leaseExpiresAt: timestamp30("lease_expires_at", { withTimezone: true }),
880
- createdAt: timestamp30("created_at", { withTimezone: true }).defaultNow(),
881
- updatedAt: timestamp30("updated_at", { withTimezone: true }).defaultNow(),
882
- completedAt: timestamp30("completed_at", { withTimezone: true }),
883
- runId: uuid29("run_id").references(() => agentRuns.id, { onDelete: "set null" })
891
+ taskKind: text31("task_kind"),
892
+ payload: jsonb26("payload"),
893
+ claimedBy: text31("claimed_by"),
894
+ claimedAt: timestamp31("claimed_at", { withTimezone: true }),
895
+ leaseExpiresAt: timestamp31("lease_expires_at", { withTimezone: true }),
896
+ createdAt: timestamp31("created_at", { withTimezone: true }).defaultNow(),
897
+ updatedAt: timestamp31("updated_at", { withTimezone: true }).defaultNow(),
898
+ completedAt: timestamp31("completed_at", { withTimezone: true }),
899
+ runId: uuid30("run_id").references(() => agentRuns.id, { onDelete: "set null" })
884
900
  }, (table) => [
885
- index26("idx_launch_jobs_user").on(table.userId),
886
- index26("idx_launch_jobs_status").on(table.status),
887
- index26("idx_launch_jobs_pending").on(table.userId, table.status),
888
- index26("idx_launch_jobs_run").on(table.runId)
901
+ index27("idx_launch_jobs_user").on(table.userId),
902
+ index27("idx_launch_jobs_status").on(table.status),
903
+ index27("idx_launch_jobs_pending").on(table.userId, table.status),
904
+ index27("idx_launch_jobs_run").on(table.runId)
889
905
  ]);
890
906
 
891
907
  // ../../packages/db/dist/schema/tables/instruction-suggestions.js
892
- import { pgTable as pgTable31, uuid as uuid30, text as text31, real as real3, timestamp as timestamp31, boolean as boolean8, uniqueIndex as uniqueIndex12, index as index27 } from "drizzle-orm/pg-core";
893
- var instructionSuggestions = pgTable31("instruction_suggestions", {
894
- id: uuid30("id").primaryKey().defaultRandom(),
895
- userId: uuid30("user_id").notNull().references(() => profiles.id, { onDelete: "cascade" }),
896
- instructionId: uuid30("instruction_id").notNull().references(() => instructions.id, { onDelete: "cascade" }),
897
- projectPath: text31("project_path").notNull(),
908
+ import { pgTable as pgTable32, uuid as uuid31, text as text32, real as real3, timestamp as timestamp32, boolean as boolean8, uniqueIndex as uniqueIndex12, index as index28 } from "drizzle-orm/pg-core";
909
+ var instructionSuggestions = pgTable32("instruction_suggestions", {
910
+ id: uuid31("id").primaryKey().defaultRandom(),
911
+ userId: uuid31("user_id").notNull().references(() => profiles.id, { onDelete: "cascade" }),
912
+ instructionId: uuid31("instruction_id").notNull().references(() => instructions.id, { onDelete: "cascade" }),
913
+ projectPath: text32("project_path").notNull(),
898
914
  // Canonical project identity (migration 00104). Additive + nullable; the
899
915
  // unique index below stays on project_path (NOT NULL) so upserts are
900
916
  // unchanged. Readers prefer project_id to aggregate across path variants.
901
- projectId: uuid30("project_id").references(() => projects.id, { onDelete: "set null" }),
917
+ projectId: uuid31("project_id").references(() => projects.id, { onDelete: "set null" }),
902
918
  score: real3("score").notNull(),
903
- reason: text31("reason").notNull(),
904
- generatedAt: timestamp31("generated_at", { withTimezone: true }).notNull().defaultNow(),
919
+ reason: text32("reason").notNull(),
920
+ generatedAt: timestamp32("generated_at", { withTimezone: true }).notNull().defaultNow(),
905
921
  isStale: boolean8("is_stale").notNull().default(false),
906
- dismissedAt: timestamp31("dismissed_at", { withTimezone: true }),
907
- acceptedAt: timestamp31("accepted_at", { withTimezone: true }),
908
- promotedToInstructionId: uuid30("promoted_to_instruction_id").references(() => instructions.id, { onDelete: "set null" })
922
+ dismissedAt: timestamp32("dismissed_at", { withTimezone: true }),
923
+ acceptedAt: timestamp32("accepted_at", { withTimezone: true }),
924
+ promotedToInstructionId: uuid31("promoted_to_instruction_id").references(() => instructions.id, { onDelete: "set null" })
909
925
  }, (table) => [
910
926
  uniqueIndex12("idx_instruction_suggestions_user_project_instruction").on(table.userId, table.projectPath, table.instructionId),
911
- index27("idx_instruction_suggestions_user_project").on(table.userId, table.projectPath),
912
- index27("idx_instruction_suggestions_user_proj_id").on(table.userId, table.projectId),
913
- index27("idx_instruction_suggestions_generated_at").on(table.generatedAt)
927
+ index28("idx_instruction_suggestions_user_project").on(table.userId, table.projectPath),
928
+ index28("idx_instruction_suggestions_user_proj_id").on(table.userId, table.projectId),
929
+ index28("idx_instruction_suggestions_generated_at").on(table.generatedAt)
914
930
  ]);
915
- var instructionSuggestionEvents = pgTable31("instruction_suggestion_events", {
916
- id: uuid30("id").primaryKey().defaultRandom(),
917
- suggestionId: uuid30("suggestion_id").notNull().references(() => instructionSuggestions.id, { onDelete: "cascade" }),
918
- userId: uuid30("user_id").notNull().references(() => profiles.id, { onDelete: "cascade" }),
919
- eventType: text31("event_type").notNull(),
920
- tool: text31("tool"),
921
- sessionId: uuid30("session_id"),
922
- projectPath: text31("project_path").notNull(),
923
- createdAt: timestamp31("created_at", { withTimezone: true }).notNull().defaultNow()
931
+ var instructionSuggestionEvents = pgTable32("instruction_suggestion_events", {
932
+ id: uuid31("id").primaryKey().defaultRandom(),
933
+ suggestionId: uuid31("suggestion_id").notNull().references(() => instructionSuggestions.id, { onDelete: "cascade" }),
934
+ userId: uuid31("user_id").notNull().references(() => profiles.id, { onDelete: "cascade" }),
935
+ eventType: text32("event_type").notNull(),
936
+ tool: text32("tool"),
937
+ sessionId: uuid31("session_id"),
938
+ projectPath: text32("project_path").notNull(),
939
+ createdAt: timestamp32("created_at", { withTimezone: true }).notNull().defaultNow()
924
940
  }, (table) => [
925
- index27("idx_instruction_suggestion_events_suggestion_id").on(table.suggestionId),
926
- index27("idx_instruction_suggestion_events_user_id").on(table.userId)
941
+ index28("idx_instruction_suggestion_events_suggestion_id").on(table.suggestionId),
942
+ index28("idx_instruction_suggestion_events_user_id").on(table.userId)
927
943
  ]);
928
944
 
929
945
  // ../../packages/db/dist/schema/tables/model-pricing.js
930
- import { pgTable as pgTable32, text as text32, integer as integer15, numeric, timestamp as timestamp32, index as index28, primaryKey as primaryKey4 } from "drizzle-orm/pg-core";
931
- var modelPricing = pgTable32("model_pricing", {
932
- provider: text32("provider").notNull(),
933
- modelId: text32("model_id").notNull(),
946
+ import { pgTable as pgTable33, text as text33, integer as integer15, numeric, timestamp as timestamp33, index as index29, primaryKey as primaryKey4 } from "drizzle-orm/pg-core";
947
+ var modelPricing = pgTable33("model_pricing", {
948
+ provider: text33("provider").notNull(),
949
+ modelId: text33("model_id").notNull(),
934
950
  inputPerM: numeric("input_per_m").notNull(),
935
951
  outputPerM: numeric("output_per_m").notNull(),
936
952
  cacheReadPerM: numeric("cache_read_per_m").notNull(),
937
953
  cacheWrite5mPerM: numeric("cache_write_5m_per_m").notNull(),
938
954
  cacheWrite1hPerM: numeric("cache_write_1h_per_m").notNull(),
939
955
  contextWindow: integer15("context_window"),
940
- effectiveFrom: timestamp32("effective_from", { withTimezone: true }).notNull(),
941
- effectiveUntil: timestamp32("effective_until", { withTimezone: true }),
942
- source: text32("source").notNull()
956
+ effectiveFrom: timestamp33("effective_from", { withTimezone: true }).notNull(),
957
+ effectiveUntil: timestamp33("effective_until", { withTimezone: true }),
958
+ source: text33("source").notNull()
943
959
  }, (table) => [
944
960
  primaryKey4({ columns: [table.provider, table.modelId, table.effectiveFrom] }),
945
- index28("idx_model_pricing_active").on(table.provider, table.modelId, table.effectiveFrom.desc())
961
+ index29("idx_model_pricing_active").on(table.provider, table.modelId, table.effectiveFrom.desc())
946
962
  ]);
947
963
 
948
964
  // ../../packages/db/dist/schema/tables/limit-observations.js
949
- import { pgTable as pgTable33, text as text33, numeric as numeric2, timestamp as timestamp33, uuid as uuid31, jsonb as jsonb26, index as index29 } from "drizzle-orm/pg-core";
950
- var limitObservations = pgTable33("limit_observations", {
951
- id: uuid31("id").primaryKey().defaultRandom(),
952
- observedAt: timestamp33("observed_at", { withTimezone: true }).notNull().defaultNow(),
953
- provider: text33("provider").notNull(),
954
- plan: text33("plan").notNull(),
955
- limitType: text33("limit_type").notNull(),
965
+ import { pgTable as pgTable34, text as text34, numeric as numeric2, timestamp as timestamp34, uuid as uuid32, jsonb as jsonb27, index as index30 } from "drizzle-orm/pg-core";
966
+ var limitObservations = pgTable34("limit_observations", {
967
+ id: uuid32("id").primaryKey().defaultRandom(),
968
+ observedAt: timestamp34("observed_at", { withTimezone: true }).notNull().defaultNow(),
969
+ provider: text34("provider").notNull(),
970
+ plan: text34("plan").notNull(),
971
+ limitType: text34("limit_type").notNull(),
956
972
  value: numeric2("value").notNull(),
957
- unit: text33("unit").notNull(),
958
- comparator: text33("comparator").notNull().default("="),
959
- resetsAt: timestamp33("resets_at", { withTimezone: true }),
960
- sourceType: text33("source_type").notNull(),
961
- sourceUrl: text33("source_url"),
962
- sourceEvidence: jsonb26("source_evidence"),
973
+ unit: text34("unit").notNull(),
974
+ comparator: text34("comparator").notNull().default("="),
975
+ resetsAt: timestamp34("resets_at", { withTimezone: true }),
976
+ sourceType: text34("source_type").notNull(),
977
+ sourceUrl: text34("source_url"),
978
+ sourceEvidence: jsonb27("source_evidence"),
963
979
  confidence: numeric2("confidence").notNull(),
964
- userId: uuid31("user_id")
980
+ userId: uuid32("user_id")
965
981
  }, (table) => [
966
- index29("idx_limit_obs_lookup").on(table.provider, table.plan, table.limitType, table.observedAt.desc()),
967
- index29("idx_limit_obs_user").on(table.userId, table.observedAt.desc())
982
+ index30("idx_limit_obs_lookup").on(table.provider, table.plan, table.limitType, table.observedAt.desc()),
983
+ index30("idx_limit_obs_user").on(table.userId, table.observedAt.desc())
968
984
  ]);
969
985
 
970
986
  // ../../packages/db/dist/schema/tables/provider-docs-snapshots.js
971
- import { pgTable as pgTable34, text as text34, timestamp as timestamp34, uuid as uuid32, jsonb as jsonb27, boolean as boolean9, uniqueIndex as uniqueIndex13 } from "drizzle-orm/pg-core";
972
- var providerDocsSnapshots = pgTable34("provider_docs_snapshots", {
973
- id: uuid32("id").primaryKey().defaultRandom(),
974
- fetchedAt: timestamp34("fetched_at", { withTimezone: true }).notNull().defaultNow(),
975
- provider: text34("provider").notNull(),
976
- docUrl: text34("doc_url").notNull(),
977
- contentHash: text34("content_hash").notNull(),
978
- content: text34("content").notNull(),
987
+ import { pgTable as pgTable35, text as text35, timestamp as timestamp35, uuid as uuid33, jsonb as jsonb28, boolean as boolean9, uniqueIndex as uniqueIndex13 } from "drizzle-orm/pg-core";
988
+ var providerDocsSnapshots = pgTable35("provider_docs_snapshots", {
989
+ id: uuid33("id").primaryKey().defaultRandom(),
990
+ fetchedAt: timestamp35("fetched_at", { withTimezone: true }).notNull().defaultNow(),
991
+ provider: text35("provider").notNull(),
992
+ docUrl: text35("doc_url").notNull(),
993
+ contentHash: text35("content_hash").notNull(),
994
+ content: text35("content").notNull(),
979
995
  parseSuccess: boolean9("parse_success").notNull(),
980
- parseErrors: jsonb27("parse_errors")
996
+ parseErrors: jsonb28("parse_errors")
981
997
  }, (table) => [
982
998
  uniqueIndex13("idx_docs_dedup").on(table.provider, table.docUrl, table.contentHash)
983
999
  ]);
984
1000
 
985
1001
  // ../../packages/db/dist/schema/tables/plan-limits-active.js
986
- import { pgTable as pgTable35, text as text35, numeric as numeric3, timestamp as timestamp35, uuid as uuid33, primaryKey as primaryKey5, index as index30 } from "drizzle-orm/pg-core";
987
- var planLimitsActive = pgTable35("plan_limits_active", {
988
- provider: text35("provider").notNull(),
989
- plan: text35("plan").notNull(),
990
- limitType: text35("limit_type").notNull(),
1002
+ import { pgTable as pgTable36, text as text36, numeric as numeric3, timestamp as timestamp36, uuid as uuid34, primaryKey as primaryKey5, index as index31 } from "drizzle-orm/pg-core";
1003
+ var planLimitsActive = pgTable36("plan_limits_active", {
1004
+ provider: text36("provider").notNull(),
1005
+ plan: text36("plan").notNull(),
1006
+ limitType: text36("limit_type").notNull(),
991
1007
  value: numeric3("value").notNull(),
992
- unit: text35("unit").notNull(),
993
- effectiveFrom: timestamp35("effective_from", { withTimezone: true }).notNull(),
994
- effectiveUntil: timestamp35("effective_until", { withTimezone: true }),
1008
+ unit: text36("unit").notNull(),
1009
+ effectiveFrom: timestamp36("effective_from", { withTimezone: true }).notNull(),
1010
+ effectiveUntil: timestamp36("effective_until", { withTimezone: true }),
995
1011
  confidence: numeric3("confidence").notNull(),
996
- sourceObservationIds: uuid33("source_observation_ids").array().notNull()
1012
+ sourceObservationIds: uuid34("source_observation_ids").array().notNull()
997
1013
  }, (table) => [
998
1014
  primaryKey5({ columns: [table.provider, table.plan, table.limitType, table.effectiveFrom] }),
999
- index30("idx_plan_limits_lookup").on(table.provider, table.plan, table.limitType, table.effectiveFrom.desc())
1015
+ index31("idx_plan_limits_lookup").on(table.provider, table.plan, table.limitType, table.effectiveFrom.desc())
1000
1016
  ]);
1001
1017
 
1002
1018
  // ../../packages/db/dist/schema/tables/alert-dispatches.js
1003
- import { pgTable as pgTable36, text as text36, timestamp as timestamp36, uuid as uuid34, jsonb as jsonb28, index as index31 } from "drizzle-orm/pg-core";
1004
- var alertDispatches = pgTable36("alert_dispatches", {
1005
- id: uuid34("id").primaryKey().defaultRandom(),
1006
- userId: uuid34("user_id").notNull(),
1007
- alertKey: text36("alert_key").notNull(),
1019
+ import { pgTable as pgTable37, text as text37, timestamp as timestamp37, uuid as uuid35, jsonb as jsonb29, index as index32 } from "drizzle-orm/pg-core";
1020
+ var alertDispatches = pgTable37("alert_dispatches", {
1021
+ id: uuid35("id").primaryKey().defaultRandom(),
1022
+ userId: uuid35("user_id").notNull(),
1023
+ alertKey: text37("alert_key").notNull(),
1008
1024
  // 'soft' | 'approaching' | 'imminent' | 'hit'
1009
- severity: text36("severity").notNull(),
1010
- lastDispatchedAt: timestamp36("last_dispatched_at", { withTimezone: true }).notNull().defaultNow(),
1025
+ severity: text37("severity").notNull(),
1026
+ lastDispatchedAt: timestamp37("last_dispatched_at", { withTimezone: true }).notNull().defaultNow(),
1011
1027
  // { used_percentage, resets_at, ... } — snapshot of the input that fired this alert.
1012
- lastState: jsonb28("last_state").notNull(),
1028
+ lastState: jsonb29("last_state").notNull(),
1013
1029
  // 'in_app' | 'vscode' | 'banner'
1014
- channel: text36("channel").notNull()
1030
+ channel: text37("channel").notNull()
1015
1031
  }, (table) => [
1016
- index31("idx_alert_user_key").on(table.userId, table.alertKey, table.lastDispatchedAt.desc())
1032
+ index32("idx_alert_user_key").on(table.userId, table.alertKey, table.lastDispatchedAt.desc())
1017
1033
  ]);
1018
1034
 
1019
1035
  // ../../packages/db/dist/client.js
@@ -1033,6 +1049,7 @@ __export(schema_exports, {
1033
1049
  apiKeysRelations: () => apiKeysRelations,
1034
1050
  benchmarks: () => benchmarks,
1035
1051
  benchmarksRelations: () => benchmarksRelations,
1052
+ cliSetupEvents: () => cliSetupEvents,
1036
1053
  contentBlobs: () => contentBlobs,
1037
1054
  contextSnapshots: () => contextSnapshots,
1038
1055
  contextSnapshotsRelations: () => contextSnapshotsRelations,
@@ -1606,4 +1623,4 @@ export {
1606
1623
  getDb,
1607
1624
  closeDb
1608
1625
  };
1609
- //# sourceMappingURL=chunk-QNSVCSHG.js.map
1626
+ //# sourceMappingURL=chunk-6EMZI4Y3.js.map