@rulemetric/cli 0.5.2 → 0.5.4
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/bin/dev.js +7 -0
- package/dist/base-command.js +4 -4
- package/dist/{chunk-7DRLX3DN.js → chunk-3POYC5NA.js} +3 -3
- package/dist/{chunk-TJ2M5QVL.js → chunk-3QH73QOQ.js} +2 -2
- package/dist/{chunk-AOIY5RT6.js → chunk-4LHEN2FS.js} +17 -17
- package/dist/{chunk-LJ5OT5XN.js → chunk-7K4ILWS7.js} +6 -6
- package/dist/{chunk-5ZOLDIZQ.js → chunk-BCIUSUEV.js} +5 -5
- package/dist/{chunk-TDTHAOXO.js → chunk-DR5WLIOU.js} +2 -2
- package/dist/{chunk-K3BFZ7KG.js → chunk-E3BIT53W.js} +1 -1
- package/dist/chunk-E3BIT53W.js.map +7 -0
- package/dist/{chunk-4QGATD5Y.js → chunk-F5N6CLJJ.js} +1 -1
- package/dist/{chunk-4QGATD5Y.js.map → chunk-F5N6CLJJ.js.map} +2 -2
- package/dist/{chunk-7XDWLJJP.js → chunk-H3C6EGR2.js} +5 -5
- package/dist/{chunk-PHIAFGQ2.js → chunk-IATQXFJA.js} +7 -7
- package/dist/{chunk-IVOCDHWA.js → chunk-IPOO4IGF.js} +3 -3
- package/dist/{chunk-AUUHXCJU.js → chunk-JEJ3J5J6.js} +2 -2
- package/dist/{chunk-OAQG5WBV.js → chunk-LAKZUE35.js} +2 -2
- package/dist/{chunk-346TGPVR.js → chunk-LTT2YMYY.js} +2 -2
- package/dist/{chunk-CCSR73HF.js → chunk-N5A2IQAK.js} +2 -2
- package/dist/{chunk-IKEI4KNV.js → chunk-OTOWLUOJ.js} +4 -4
- package/dist/{chunk-YQFCUKNI.js → chunk-QNSVCSHG.js} +373 -414
- package/dist/chunk-QNSVCSHG.js.map +7 -0
- package/dist/{chunk-OKCFYPIQ.js → chunk-RCMXTLQF.js} +2 -2
- package/dist/{chunk-CGUV6TUA.js → chunk-RUCSRN7F.js} +2 -2
- package/dist/{chunk-4UJATBTG.js → chunk-SLL3OBKN.js} +4 -4
- package/dist/{chunk-CB43W53J.js → chunk-SZ7VDCD6.js} +3 -3
- package/dist/{chunk-N52AHNBH.js → chunk-W4MZXKZ2.js} +6 -2
- package/dist/chunk-W4MZXKZ2.js.map +7 -0
- package/dist/{chunk-DUR54APY.js → chunk-WLFX4PYR.js} +6 -6
- package/dist/{chunk-FUS5C4SB.js → chunk-Y4BJXXYV.js} +2 -2
- package/dist/{chunk-KHJUQFIK.js → chunk-YSEQWCN4.js} +2 -2
- package/dist/{chunk-CWFVBGX2.js → chunk-ZRLYHBPN.js} +4 -2
- package/dist/chunk-ZRLYHBPN.js.map +7 -0
- package/dist/{chunk-46LMTDRE.js → chunk-ZSGKRCKD.js} +7 -4
- package/dist/chunk-ZSGKRCKD.js.map +7 -0
- package/dist/commands/antigravity/backfill.js +5 -5
- package/dist/commands/auth/create-key.js +7 -5
- package/dist/commands/auth/create-key.js.map +2 -2
- package/dist/commands/auth/login.js +4 -4
- package/dist/commands/auth/logout.js +4 -4
- package/dist/commands/auth/revoke-key.js +4 -4
- package/dist/commands/auth/status.js +4 -4
- package/dist/commands/catalog/index.js +4 -4
- package/dist/commands/catalog/recommend.js +4 -4
- package/dist/commands/convert.js +6 -5
- package/dist/commands/convert.js.map +2 -2
- package/dist/commands/converters.js +4 -4
- package/dist/commands/crons/list.js +4 -4
- package/dist/commands/crons/run.js +4 -4
- package/dist/commands/dashboard.js +4 -4
- package/dist/commands/eval-targets/create.js +4 -4
- package/dist/commands/eval-targets/list.js +4 -4
- package/dist/commands/evals/agent.js +25 -28
- package/dist/commands/evals/agent.js.map +4 -4
- package/dist/commands/evals/benchmark.js +5 -5
- package/dist/commands/evals/compare.js +4 -4
- package/dist/commands/evals/create.js +4 -4
- package/dist/commands/evals/optimize-description.js +4 -4
- package/dist/commands/evals/optimize.js +4 -4
- package/dist/commands/evals/run.js +4 -4
- package/dist/commands/gateway/ensure.js +4 -4
- package/dist/commands/hooks/install.js +4 -4
- package/dist/commands/hooks/run.js +4 -4
- package/dist/commands/hooks/uninstall.js +4 -4
- package/dist/commands/import.js +4 -4
- package/dist/commands/instructions/create.js +4 -4
- package/dist/commands/instructions/delete.js +4 -4
- package/dist/commands/instructions/fork.js +4 -4
- package/dist/commands/instructions/get.js +4 -4
- package/dist/commands/instructions/list.js +4 -4
- package/dist/commands/instructions/promote.js +4 -4
- package/dist/commands/instructions/pull.js +4 -4
- package/dist/commands/instructions/upstream.js +4 -4
- package/dist/commands/instructions/versions.js +4 -4
- package/dist/commands/launcher.js +4 -4
- package/dist/commands/org/current.js +9 -9
- package/dist/commands/org/list.js +6 -6
- package/dist/commands/org/switch.js +7 -7
- package/dist/commands/packs/add-instruction.js +4 -4
- package/dist/commands/packs/apply.js +4 -4
- package/dist/commands/packs/create.js +4 -4
- package/dist/commands/packs/fork.js +4 -4
- package/dist/commands/packs/get.js +4 -4
- package/dist/commands/packs/list.js +4 -4
- package/dist/commands/packs/remove-instruction.js +4 -4
- package/dist/commands/proxy/env.js +4 -4
- package/dist/commands/proxy/logs.js +4 -4
- package/dist/commands/proxy/restart.js +4 -4
- package/dist/commands/proxy/setup.js +4 -4
- package/dist/commands/proxy/start.js +4 -4
- package/dist/commands/proxy/status.js +4 -4
- package/dist/commands/proxy/stop.js +4 -4
- package/dist/commands/research/backfill.js +7 -7
- package/dist/commands/research/tail-transcript.js +7 -7
- package/dist/commands/service/install.js +9 -4
- package/dist/commands/service/install.js.map +2 -2
- package/dist/commands/service/status.js +4 -4
- package/dist/commands/service/uninstall.js +4 -4
- package/dist/commands/sessions/analyze.js +4 -4
- package/dist/commands/sessions/end.js +4 -4
- package/dist/commands/sessions/import.js +4 -4
- package/dist/commands/sessions/list.js +4 -4
- package/dist/commands/sessions/start.js +6 -6
- package/dist/commands/setup.js +5 -5
- package/dist/commands/skills/export-approved.js +4 -4
- package/dist/commands/skills/install.js +4 -4
- package/dist/commands/skills/list.js +4 -4
- package/dist/commands/skills/publish.js +4 -4
- package/dist/commands/skills/search.js +4 -4
- package/dist/commands/skills/update.js +4 -4
- package/dist/commands/suggestions/accept.js +4 -4
- package/dist/commands/suggestions/dismiss.js +4 -4
- package/dist/commands/suggestions/list.js +4 -4
- package/dist/commands/suggestions/refresh.js +4 -4
- package/dist/dashboard/Dashboard.js +17 -15
- package/dist/dashboard/Dashboard.js.map +1 -1
- package/dist/dashboard/data.js +4 -2
- package/dist/dashboard/launcher/LauncherOverlay.js +6 -4
- package/dist/dashboard/launcher/api.js +3 -1
- package/dist/dashboard/launcher/useLaunchJobs.js +4 -2
- package/dist/{dist-NEECHU47.js → dist-UNYP5PJR.js} +2 -2
- package/dist/lib/active-org-refresh.js +3 -3
- package/dist/lib/agent-loop.js +19 -19
- package/dist/lib/antigravity-transcript.js +2 -2
- package/dist/lib/api-client.js +3 -1
- package/dist/lib/eval-benchmark.js +2 -2
- package/dist/lib/eval-conversation-handler.js +2 -2
- package/dist/lib/handlers/cron-suggest-instructions.js +4 -4
- package/dist/lib/handlers/process-announcement.js +3 -3
- package/dist/lib/handlers/process-changelog.js +3 -3
- package/dist/lib/handlers/process-conversation.js +3 -3
- package/dist/lib/handlers/process-eval.js +2 -2
- package/dist/lib/handlers/process-insights.js +2 -2
- package/dist/lib/handlers/process-launch.js +4 -4
- package/dist/lib/handlers/process-run-cleanup.js +4 -4
- package/dist/lib/handlers/process-session-goal.js +2 -2
- package/dist/lib/manual-tasks.js +7 -7
- package/dist/lib/research-client.js +2 -2
- package/dist/lib/setup-steps.js +2 -2
- package/dist/lib/terminal-target-heartbeat.js +2 -2
- package/dist/lib/worktree.js +2 -2
- package/oclif.manifest.json +1 -40
- package/package.json +7 -7
- package/dist/chunk-46LMTDRE.js.map +0 -7
- package/dist/chunk-CWFVBGX2.js.map +0 -7
- package/dist/chunk-K3BFZ7KG.js.map +0 -7
- package/dist/chunk-N52AHNBH.js.map +0 -7
- package/dist/chunk-YQFCUKNI.js.map +0 -7
- package/dist/commands/signals/report.js +0 -43
- package/dist/commands/signals/report.js.map +0 -7
- package/dist/lib/handlers/cron-close-stale-sessions.js +0 -19
- package/dist/lib/handlers/cron-close-stale-sessions.js.map +0 -7
- package/dist/lib/handlers/cron-data-integrity-audit.js +0 -22
- package/dist/lib/handlers/cron-data-integrity-audit.js.map +0 -7
- package/dist/lib/provider-aggregator.js +0 -59
- package/dist/lib/provider-aggregator.js.map +0 -7
- /package/dist/{chunk-7DRLX3DN.js.map → chunk-3POYC5NA.js.map} +0 -0
- /package/dist/{chunk-TJ2M5QVL.js.map → chunk-3QH73QOQ.js.map} +0 -0
- /package/dist/{chunk-AOIY5RT6.js.map → chunk-4LHEN2FS.js.map} +0 -0
- /package/dist/{chunk-LJ5OT5XN.js.map → chunk-7K4ILWS7.js.map} +0 -0
- /package/dist/{chunk-5ZOLDIZQ.js.map → chunk-BCIUSUEV.js.map} +0 -0
- /package/dist/{chunk-TDTHAOXO.js.map → chunk-DR5WLIOU.js.map} +0 -0
- /package/dist/{chunk-7XDWLJJP.js.map → chunk-H3C6EGR2.js.map} +0 -0
- /package/dist/{chunk-PHIAFGQ2.js.map → chunk-IATQXFJA.js.map} +0 -0
- /package/dist/{chunk-IVOCDHWA.js.map → chunk-IPOO4IGF.js.map} +0 -0
- /package/dist/{chunk-AUUHXCJU.js.map → chunk-JEJ3J5J6.js.map} +0 -0
- /package/dist/{chunk-OAQG5WBV.js.map → chunk-LAKZUE35.js.map} +0 -0
- /package/dist/{chunk-346TGPVR.js.map → chunk-LTT2YMYY.js.map} +0 -0
- /package/dist/{chunk-CCSR73HF.js.map → chunk-N5A2IQAK.js.map} +0 -0
- /package/dist/{chunk-IKEI4KNV.js.map → chunk-OTOWLUOJ.js.map} +0 -0
- /package/dist/{chunk-OKCFYPIQ.js.map → chunk-RCMXTLQF.js.map} +0 -0
- /package/dist/{chunk-CGUV6TUA.js.map → chunk-RUCSRN7F.js.map} +0 -0
- /package/dist/{chunk-4UJATBTG.js.map → chunk-SLL3OBKN.js.map} +0 -0
- /package/dist/{chunk-CB43W53J.js.map → chunk-SZ7VDCD6.js.map} +0 -0
- /package/dist/{chunk-DUR54APY.js.map → chunk-WLFX4PYR.js.map} +0 -0
- /package/dist/{chunk-FUS5C4SB.js.map → chunk-Y4BJXXYV.js.map} +0 -0
- /package/dist/{chunk-KHJUQFIK.js.map → chunk-YSEQWCN4.js.map} +0 -0
- /package/dist/{dist-NEECHU47.js.map → dist-UNYP5PJR.js.map} +0 -0
|
@@ -426,187 +426,175 @@ var packInstructions = pgTable12("pack_instructions", {
|
|
|
426
426
|
primaryKey3({ columns: [table.packId, table.instructionId] })
|
|
427
427
|
]);
|
|
428
428
|
|
|
429
|
-
// ../../packages/db/dist/schema/tables/project-signals.js
|
|
430
|
-
import { pgTable as pgTable13, text as text13, timestamp as timestamp13, uuid as uuid13, index as index10, primaryKey as primaryKey4 } from "drizzle-orm/pg-core";
|
|
431
|
-
var projectSignals = pgTable13("project_signals", {
|
|
432
|
-
userId: uuid13("user_id").notNull().references(() => profiles.id, { onDelete: "cascade" }),
|
|
433
|
-
projectPath: text13("project_path").notNull(),
|
|
434
|
-
detectedLanguages: text13("detected_languages").array().notNull().default([]).$type(),
|
|
435
|
-
lastSeenAt: timestamp13("last_seen_at", { withTimezone: true }).notNull().defaultNow()
|
|
436
|
-
}, (table) => [
|
|
437
|
-
primaryKey4({ columns: [table.userId, table.projectPath] }),
|
|
438
|
-
index10("idx_project_signals_user_seen").on(table.userId, table.lastSeenAt)
|
|
439
|
-
]);
|
|
440
|
-
|
|
441
429
|
// ../../packages/db/dist/schema/tables/usage-events.js
|
|
442
|
-
import { pgTable as
|
|
443
|
-
var instructionUsageEvents =
|
|
444
|
-
id:
|
|
445
|
-
instructionId:
|
|
446
|
-
userId:
|
|
447
|
-
surface:
|
|
448
|
-
action:
|
|
430
|
+
import { pgTable as pgTable13, text as text13, timestamp as timestamp13, jsonb as jsonb11, uuid as uuid13, index as index10 } from "drizzle-orm/pg-core";
|
|
431
|
+
var instructionUsageEvents = pgTable13("instruction_usage_events", {
|
|
432
|
+
id: uuid13("id").primaryKey().defaultRandom(),
|
|
433
|
+
instructionId: uuid13("instruction_id").references(() => instructions.id, { onDelete: "set null" }),
|
|
434
|
+
userId: uuid13("user_id").notNull(),
|
|
435
|
+
surface: text13("surface").notNull(),
|
|
436
|
+
action: text13("action").notNull(),
|
|
449
437
|
metadata: jsonb11("metadata"),
|
|
450
|
-
traceId:
|
|
451
|
-
createdAt:
|
|
438
|
+
traceId: text13("trace_id"),
|
|
439
|
+
createdAt: timestamp13("created_at", { withTimezone: true }).defaultNow()
|
|
452
440
|
}, (table) => [
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
441
|
+
index10("idx_usage_events_instruction").on(table.instructionId),
|
|
442
|
+
index10("idx_usage_events_user").on(table.userId),
|
|
443
|
+
index10("idx_usage_events_surface").on(table.surface),
|
|
444
|
+
index10("idx_usage_events_action").on(table.action),
|
|
445
|
+
index10("idx_usage_events_created_at").on(table.createdAt),
|
|
446
|
+
index10("idx_usage_events_user_created").on(table.userId, table.createdAt)
|
|
459
447
|
]);
|
|
460
448
|
|
|
461
449
|
// ../../packages/db/dist/schema/tables/worker-connections.js
|
|
462
|
-
import { pgTable as
|
|
463
|
-
var workerConnections =
|
|
464
|
-
id:
|
|
465
|
-
userId:
|
|
466
|
-
workerType:
|
|
467
|
-
clientName:
|
|
468
|
-
clientVersion:
|
|
469
|
-
workerVersion:
|
|
470
|
-
lastHeartbeat:
|
|
471
|
-
connectedAt:
|
|
450
|
+
import { pgTable as pgTable14, text as text14, timestamp as timestamp14, jsonb as jsonb12, uuid as uuid14, index as index11 } from "drizzle-orm/pg-core";
|
|
451
|
+
var workerConnections = pgTable14("worker_connections", {
|
|
452
|
+
id: uuid14("id").primaryKey().defaultRandom(),
|
|
453
|
+
userId: uuid14("user_id").notNull(),
|
|
454
|
+
workerType: text14("worker_type").notNull().default("mcp"),
|
|
455
|
+
clientName: text14("client_name").notNull(),
|
|
456
|
+
clientVersion: text14("client_version"),
|
|
457
|
+
workerVersion: text14("worker_version"),
|
|
458
|
+
lastHeartbeat: timestamp14("last_heartbeat", { withTimezone: true }).notNull().defaultNow(),
|
|
459
|
+
connectedAt: timestamp14("connected_at", { withTimezone: true }).notNull().defaultNow(),
|
|
472
460
|
metadata: jsonb12("metadata")
|
|
473
461
|
}, (table) => [
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
462
|
+
index11("idx_worker_connections_user").on(table.userId),
|
|
463
|
+
index11("idx_worker_connections_heartbeat").on(table.userId, table.lastHeartbeat),
|
|
464
|
+
index11("idx_worker_connections_type").on(table.userId, table.workerType)
|
|
477
465
|
]);
|
|
478
466
|
|
|
479
467
|
// ../../packages/db/dist/schema/tables/eval-targets.js
|
|
480
|
-
import { pgTable as
|
|
481
|
-
var evalTargets =
|
|
482
|
-
id:
|
|
483
|
-
userId:
|
|
484
|
-
name:
|
|
485
|
-
type:
|
|
486
|
-
content:
|
|
487
|
-
description:
|
|
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", {
|
|
470
|
+
id: uuid15("id").primaryKey().defaultRandom(),
|
|
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(""),
|
|
488
476
|
metadata: jsonb13("metadata").notNull().default({}),
|
|
489
477
|
version: integer7("version").notNull().default(1),
|
|
490
|
-
parentId:
|
|
491
|
-
createdAt:
|
|
492
|
-
updatedAt:
|
|
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()
|
|
493
481
|
}, (table) => [
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
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
486
|
]);
|
|
499
|
-
var evals =
|
|
500
|
-
id:
|
|
501
|
-
evalTargetId:
|
|
502
|
-
name:
|
|
503
|
-
prompt:
|
|
504
|
-
expectedOutput:
|
|
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(""),
|
|
505
493
|
files: jsonb13("files").notNull().default([]),
|
|
506
494
|
expectations: jsonb13("expectations").notNull().default([]),
|
|
507
|
-
createdAt:
|
|
508
|
-
updatedAt:
|
|
495
|
+
createdAt: timestamp15("created_at", { withTimezone: true }).defaultNow(),
|
|
496
|
+
updatedAt: timestamp15("updated_at", { withTimezone: true }).defaultNow()
|
|
509
497
|
}, (table) => [
|
|
510
|
-
|
|
498
|
+
index12("idx_evals_target").on(table.evalTargetId)
|
|
511
499
|
]);
|
|
512
|
-
var evalRuns =
|
|
513
|
-
id:
|
|
514
|
-
evalId:
|
|
515
|
-
evalTargetId:
|
|
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
504
|
evalTargetVersion: integer7("eval_target_version").notNull(),
|
|
517
|
-
configuration:
|
|
505
|
+
configuration: text15("configuration").notNull(),
|
|
518
506
|
runNumber: integer7("run_number").notNull().default(1),
|
|
519
507
|
iteration: integer7("iteration").notNull().default(1),
|
|
520
|
-
status:
|
|
508
|
+
status: text15("status").notNull().default("completed"),
|
|
521
509
|
outputs: jsonb13("outputs").notNull().default({}),
|
|
522
510
|
timing: jsonb13("timing").notNull().default({}),
|
|
523
511
|
grading: jsonb13("grading").notNull().default({}),
|
|
524
512
|
comparison: jsonb13("comparison"),
|
|
525
|
-
createdAt:
|
|
513
|
+
createdAt: timestamp15("created_at", { withTimezone: true }).defaultNow()
|
|
526
514
|
}, (table) => [
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
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)
|
|
530
518
|
]);
|
|
531
|
-
var benchmarks =
|
|
532
|
-
id:
|
|
533
|
-
evalTargetId:
|
|
519
|
+
var benchmarks = pgTable15("benchmarks", {
|
|
520
|
+
id: uuid15("id").primaryKey().defaultRandom(),
|
|
521
|
+
evalTargetId: uuid15("eval_target_id").notNull().references(() => evalTargets.id, { onDelete: "cascade" }),
|
|
534
522
|
iteration: integer7("iteration").notNull().default(1),
|
|
535
523
|
runSummary: jsonb13("run_summary").notNull().default({}),
|
|
536
524
|
notes: jsonb13("notes").notNull().default([]),
|
|
537
525
|
feedback: jsonb13("feedback"),
|
|
538
|
-
createdAt:
|
|
526
|
+
createdAt: timestamp15("created_at", { withTimezone: true }).defaultNow()
|
|
539
527
|
}, (table) => [
|
|
540
|
-
|
|
528
|
+
index12("idx_benchmarks_target").on(table.evalTargetId)
|
|
541
529
|
]);
|
|
542
530
|
|
|
543
531
|
// ../../packages/db/dist/schema/tables/optimization.js
|
|
544
|
-
import { pgTable as
|
|
545
|
-
var triggerEvals =
|
|
546
|
-
id:
|
|
547
|
-
evalTargetId:
|
|
548
|
-
userId:
|
|
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(),
|
|
549
537
|
queries: jsonb14("queries").notNull().default([]),
|
|
550
|
-
status:
|
|
538
|
+
status: text16("status").notNull().default("pending_review"),
|
|
551
539
|
trainIndices: integer8("train_indices").array().default([]),
|
|
552
540
|
testIndices: integer8("test_indices").array().default([]),
|
|
553
|
-
createdAt:
|
|
554
|
-
updatedAt:
|
|
541
|
+
createdAt: timestamp16("created_at", { withTimezone: true }).defaultNow(),
|
|
542
|
+
updatedAt: timestamp16("updated_at", { withTimezone: true }).defaultNow()
|
|
555
543
|
}, (table) => [
|
|
556
|
-
|
|
557
|
-
|
|
544
|
+
index13("idx_trigger_evals_target").on(table.evalTargetId),
|
|
545
|
+
index13("idx_trigger_evals_user").on(table.userId)
|
|
558
546
|
]);
|
|
559
|
-
var optimizationRuns =
|
|
560
|
-
id:
|
|
561
|
-
evalTargetId:
|
|
562
|
-
userId:
|
|
563
|
-
type:
|
|
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(),
|
|
564
552
|
iteration: integer8("iteration").notNull(),
|
|
565
553
|
inputVersion: integer8("input_version").notNull(),
|
|
566
554
|
outputVersion: integer8("output_version"),
|
|
567
555
|
trainScore: real("train_score"),
|
|
568
556
|
testScore: real("test_score"),
|
|
569
557
|
analysis: jsonb14("analysis").notNull().default({}),
|
|
570
|
-
status:
|
|
571
|
-
createdAt:
|
|
558
|
+
status: text16("status").notNull().default("running"),
|
|
559
|
+
createdAt: timestamp16("created_at", { withTimezone: true }).defaultNow()
|
|
572
560
|
}, (table) => [
|
|
573
|
-
|
|
574
|
-
|
|
561
|
+
index13("idx_optimization_runs_target").on(table.evalTargetId),
|
|
562
|
+
index13("idx_optimization_runs_user").on(table.userId)
|
|
575
563
|
]);
|
|
576
564
|
|
|
577
565
|
// ../../packages/db/dist/schema/tables/context-snapshots.js
|
|
578
|
-
import { pgTable as
|
|
579
|
-
var contextSnapshots =
|
|
580
|
-
id:
|
|
581
|
-
sessionId:
|
|
582
|
-
userId:
|
|
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" }),
|
|
583
571
|
sequence: integer9("sequence").notNull().default(0),
|
|
584
|
-
provider:
|
|
585
|
-
model:
|
|
586
|
-
systemPrompt:
|
|
572
|
+
provider: text17("provider").notNull(),
|
|
573
|
+
model: text17("model").notNull(),
|
|
574
|
+
systemPrompt: text17("system_prompt").notNull(),
|
|
587
575
|
injectedInstructions: jsonb15("injected_instructions").notNull().default([]),
|
|
588
576
|
messagesSummary: jsonb15("messages_summary").notNull(),
|
|
589
577
|
tools: jsonb15("tools").notNull().default([]),
|
|
590
578
|
// Deprecated: use content_blobs via tools_hash
|
|
591
|
-
systemHash:
|
|
592
|
-
requestHash:
|
|
593
|
-
toolsHash:
|
|
594
|
-
injectedHash:
|
|
579
|
+
systemHash: text17("system_hash").notNull(),
|
|
580
|
+
requestHash: text17("request_hash").notNull().default(""),
|
|
581
|
+
toolsHash: text17("tools_hash"),
|
|
582
|
+
injectedHash: text17("injected_hash"),
|
|
595
583
|
messagesDelta: jsonb15("messages_delta").default([]),
|
|
596
584
|
// Storage pointer set when messages_delta is offloaded to the snapshot-deltas
|
|
597
585
|
// bucket (Stage 1+). NULL = inline (messages_delta populated) OR pruned (both
|
|
598
586
|
// NULL — see 00101). docs/plans/2026-06-24-messages-delta-object-storage-offload.md
|
|
599
|
-
messagesDeltaRef:
|
|
587
|
+
messagesDeltaRef: text17("messages_delta_ref"),
|
|
600
588
|
maxTokens: integer9("max_tokens"),
|
|
601
589
|
temperature: real2("temperature"),
|
|
602
590
|
estimatedTokens: integer9("estimated_tokens"),
|
|
603
|
-
capturedAt:
|
|
591
|
+
capturedAt: timestamp17("captured_at", { withTimezone: true }).notNull().defaultNow(),
|
|
604
592
|
metadata: jsonb15("metadata").default({})
|
|
605
593
|
}, (table) => [
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
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
598
|
uniqueIndex7("idx_snapshots_session_request").on(table.sessionId, table.requestHash),
|
|
611
599
|
// Concurrent snapshot POSTs for one session must not reuse a sequence — stops
|
|
612
600
|
// the live duplicate-sequence corruption. Built via migration 00095.
|
|
@@ -616,378 +604,378 @@ var contextSnapshots = pgTable18("context_snapshots", {
|
|
|
616
604
|
// WHERE user_id ORDER BY session_id, captured_at DESC). Matches the ORDER BY so
|
|
617
605
|
// the planner drops the Incremental Sort (the ~11s-max, temp-spill-prone step);
|
|
618
606
|
// verified 60.6ms -> 26.3ms. Built CONCURRENTLY via migration 00106.
|
|
619
|
-
|
|
607
|
+
index14("idx_context_snapshots_user_session_captured").on(table.userId, table.sessionId, table.capturedAt.desc())
|
|
620
608
|
]);
|
|
621
609
|
|
|
622
610
|
// ../../packages/db/dist/schema/tables/content-blobs.js
|
|
623
|
-
import { pgTable as
|
|
624
|
-
var contentBlobs =
|
|
625
|
-
hash:
|
|
626
|
-
contentType:
|
|
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(),
|
|
627
615
|
content: jsonb16("content").notNull(),
|
|
628
616
|
sizeBytes: integer10("size_bytes").notNull().default(0),
|
|
629
|
-
createdAt:
|
|
617
|
+
createdAt: timestamp18("created_at", { withTimezone: true }).defaultNow()
|
|
630
618
|
}, (table) => [
|
|
631
|
-
|
|
619
|
+
index15("idx_content_blobs_type").on(table.contentType)
|
|
632
620
|
]);
|
|
633
621
|
|
|
634
622
|
// ../../packages/db/dist/schema/tables/eval-jobs.js
|
|
635
|
-
import { pgTable as
|
|
636
|
-
var evalJobs =
|
|
637
|
-
id:
|
|
638
|
-
userId:
|
|
639
|
-
evalTargetId:
|
|
640
|
-
status:
|
|
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"),
|
|
641
629
|
config: jsonb17("config").notNull().default({}),
|
|
642
630
|
progress: jsonb17("progress").notNull().default({}),
|
|
643
631
|
result: jsonb17("result"),
|
|
644
|
-
error:
|
|
632
|
+
error: text19("error"),
|
|
645
633
|
attempts: integer11("attempts").notNull().default(0),
|
|
646
634
|
graphileJobId: bigint2("graphile_job_id", { mode: "number" }),
|
|
647
|
-
taskKind:
|
|
635
|
+
taskKind: text19("task_kind"),
|
|
648
636
|
payload: jsonb17("payload"),
|
|
649
|
-
claimedBy:
|
|
650
|
-
claimedAt:
|
|
651
|
-
leaseExpiresAt:
|
|
652
|
-
createdAt:
|
|
653
|
-
updatedAt:
|
|
654
|
-
completedAt:
|
|
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 })
|
|
655
643
|
}, (table) => [
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
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)
|
|
660
648
|
]);
|
|
661
649
|
|
|
662
650
|
// ../../packages/db/dist/schema/tables/agent-jobs.js
|
|
663
|
-
import { pgTable as
|
|
664
|
-
var agentJobs =
|
|
665
|
-
id:
|
|
666
|
-
userId:
|
|
667
|
-
taskKind:
|
|
668
|
-
status:
|
|
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", {
|
|
653
|
+
id: uuid19("id").primaryKey().defaultRandom(),
|
|
654
|
+
userId: uuid19("user_id").notNull(),
|
|
655
|
+
taskKind: text20("task_kind").notNull(),
|
|
656
|
+
status: text20("status").notNull().default("pending"),
|
|
669
657
|
payload: jsonb18("payload").notNull(),
|
|
670
|
-
dedupeKey:
|
|
658
|
+
dedupeKey: text20("dedupe_key"),
|
|
671
659
|
result: jsonb18("result"),
|
|
672
|
-
error:
|
|
660
|
+
error: text20("error"),
|
|
673
661
|
attempts: integer12("attempts").notNull().default(0),
|
|
674
|
-
claimedBy:
|
|
675
|
-
claimedAt:
|
|
676
|
-
leaseExpiresAt:
|
|
677
|
-
createdAt:
|
|
678
|
-
updatedAt:
|
|
679
|
-
completedAt:
|
|
662
|
+
claimedBy: text20("claimed_by"),
|
|
663
|
+
claimedAt: timestamp20("claimed_at", { withTimezone: true }),
|
|
664
|
+
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(),
|
|
667
|
+
completedAt: timestamp20("completed_at", { withTimezone: true })
|
|
680
668
|
}, (table) => [
|
|
681
|
-
|
|
682
|
-
|
|
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)
|
|
683
671
|
]);
|
|
684
672
|
|
|
685
673
|
// ../../packages/db/dist/schema/tables/insights.js
|
|
686
|
-
import { pgTable as
|
|
687
|
-
var insightsJobs =
|
|
688
|
-
id:
|
|
689
|
-
userId:
|
|
690
|
-
status:
|
|
691
|
-
projectPath:
|
|
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", {
|
|
676
|
+
id: uuid20("id").primaryKey().defaultRandom(),
|
|
677
|
+
userId: uuid20("user_id").notNull(),
|
|
678
|
+
status: text21("status").notNull().default("pending"),
|
|
679
|
+
projectPath: text21("project_path"),
|
|
692
680
|
// Canonical project identity (project_path-keying fragments one project across
|
|
693
681
|
// worktrees/subdirs/cwds — migration 00104). Nullable: legacy/unlinked rows fall
|
|
694
682
|
// back to project_path. Stamped at enqueue when resolvable.
|
|
695
|
-
projectId:
|
|
683
|
+
projectId: uuid20("project_id").references(() => projects.id, { onDelete: "set null" }),
|
|
696
684
|
config: jsonb19("config").notNull().default({}),
|
|
697
685
|
progress: jsonb19("progress").notNull().default({}),
|
|
698
686
|
result: jsonb19("result"),
|
|
699
|
-
error:
|
|
687
|
+
error: text21("error"),
|
|
700
688
|
attempts: integer13("attempts").notNull().default(0),
|
|
701
689
|
graphileJobId: bigint3("graphile_job_id", { mode: "number" }),
|
|
702
|
-
taskKind:
|
|
690
|
+
taskKind: text21("task_kind"),
|
|
703
691
|
payload: jsonb19("payload"),
|
|
704
|
-
claimedBy:
|
|
705
|
-
claimedAt:
|
|
706
|
-
leaseExpiresAt:
|
|
707
|
-
createdAt:
|
|
708
|
-
updatedAt:
|
|
709
|
-
completedAt:
|
|
692
|
+
claimedBy: text21("claimed_by"),
|
|
693
|
+
claimedAt: timestamp21("claimed_at", { withTimezone: true }),
|
|
694
|
+
leaseExpiresAt: timestamp21("lease_expires_at", { withTimezone: true }),
|
|
695
|
+
createdAt: timestamp21("created_at", { withTimezone: true }).defaultNow(),
|
|
696
|
+
updatedAt: timestamp21("updated_at", { withTimezone: true }).defaultNow(),
|
|
697
|
+
completedAt: timestamp21("completed_at", { withTimezone: true })
|
|
710
698
|
}, (table) => [
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
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)
|
|
715
703
|
]);
|
|
716
|
-
var insightsReports =
|
|
717
|
-
id:
|
|
718
|
-
userId:
|
|
719
|
-
projectPath:
|
|
704
|
+
var insightsReports = pgTable21("insights_reports", {
|
|
705
|
+
id: uuid20("id").primaryKey().defaultRandom(),
|
|
706
|
+
userId: uuid20("user_id").notNull(),
|
|
707
|
+
projectPath: text21("project_path"),
|
|
720
708
|
data: jsonb19("data").notNull(),
|
|
721
|
-
reportHtml:
|
|
722
|
-
createdAt:
|
|
709
|
+
reportHtml: text21("report_html"),
|
|
710
|
+
createdAt: timestamp21("created_at", { withTimezone: true }).defaultNow()
|
|
723
711
|
}, (table) => [
|
|
724
|
-
|
|
725
|
-
|
|
712
|
+
index18("idx_insights_user").on(table.userId),
|
|
713
|
+
index18("idx_insights_created").on(table.createdAt),
|
|
726
714
|
uniqueIndex8("idx_insights_user_project").on(table.userId, table.projectPath)
|
|
727
715
|
]);
|
|
728
716
|
|
|
729
717
|
// ../../packages/db/dist/schema/tables/api-keys.js
|
|
730
|
-
import { pgTable as
|
|
731
|
-
var apiKeys =
|
|
732
|
-
id:
|
|
733
|
-
userId:
|
|
734
|
-
name:
|
|
735
|
-
keyHash:
|
|
736
|
-
keyPrefix:
|
|
737
|
-
lastUsedAt:
|
|
738
|
-
expiresAt:
|
|
739
|
-
revokedAt:
|
|
740
|
-
createdAt:
|
|
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
|
+
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 }),
|
|
728
|
+
createdAt: timestamp22("created_at", { withTimezone: true }).defaultNow()
|
|
741
729
|
}, (table) => [
|
|
742
|
-
|
|
730
|
+
index19("idx_api_keys_user").on(table.userId),
|
|
743
731
|
uniqueIndex9("idx_api_keys_hash").on(table.keyHash)
|
|
744
732
|
]);
|
|
745
733
|
|
|
746
734
|
// ../../packages/db/dist/schema/tables/extension-auth-codes.js
|
|
747
|
-
import { pgTable as
|
|
748
|
-
var extensionAuthCodes =
|
|
749
|
-
code:
|
|
750
|
-
userId:
|
|
751
|
-
editor:
|
|
752
|
-
email:
|
|
753
|
-
expiresAt:
|
|
754
|
-
createdAt:
|
|
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(),
|
|
738
|
+
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(),
|
|
742
|
+
createdAt: timestamp23("created_at", { withTimezone: true }).defaultNow()
|
|
755
743
|
}, (table) => [
|
|
756
|
-
|
|
744
|
+
index20("idx_ext_auth_codes_expiry").on(table.expiresAt)
|
|
757
745
|
]);
|
|
758
746
|
|
|
759
747
|
// ../../packages/db/dist/schema/tables/eval-conversations.js
|
|
760
|
-
import { pgTable as
|
|
761
|
-
var evalConversations =
|
|
762
|
-
id:
|
|
763
|
-
evalTargetId:
|
|
764
|
-
userId:
|
|
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(),
|
|
765
753
|
messages: jsonb20("messages").notNull().default([]),
|
|
766
|
-
status:
|
|
767
|
-
createdAt:
|
|
768
|
-
updatedAt:
|
|
754
|
+
status: text24("status").notNull().default("active"),
|
|
755
|
+
createdAt: timestamp24("created_at", { withTimezone: true }).defaultNow(),
|
|
756
|
+
updatedAt: timestamp24("updated_at", { withTimezone: true }).defaultNow()
|
|
769
757
|
}, (table) => [
|
|
770
|
-
|
|
771
|
-
|
|
758
|
+
index21("idx_eval_conversations_target").on(table.evalTargetId),
|
|
759
|
+
index21("idx_eval_conversations_user").on(table.userId)
|
|
772
760
|
]);
|
|
773
761
|
|
|
774
762
|
// ../../packages/db/dist/schema/tables/security-events.js
|
|
775
|
-
import { pgTable as
|
|
776
|
-
var securityEvents =
|
|
777
|
-
id:
|
|
778
|
-
eventType:
|
|
779
|
-
severity:
|
|
780
|
-
category:
|
|
781
|
-
source:
|
|
782
|
-
entityType:
|
|
783
|
-
entityId:
|
|
784
|
-
userId:
|
|
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", {
|
|
765
|
+
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"),
|
|
785
773
|
details: jsonb21("details").notNull().default({}),
|
|
786
|
-
createdAt:
|
|
774
|
+
createdAt: timestamp25("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
787
775
|
}, (table) => [
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
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)
|
|
793
781
|
]);
|
|
794
782
|
|
|
795
783
|
// ../../packages/db/dist/schema/tables/tasks.js
|
|
796
|
-
import { pgTable as
|
|
797
|
-
var tasks =
|
|
798
|
-
id:
|
|
799
|
-
title:
|
|
800
|
-
description:
|
|
801
|
-
status:
|
|
802
|
-
createdBy:
|
|
803
|
-
createdAt:
|
|
804
|
-
updatedAt:
|
|
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", {
|
|
786
|
+
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()
|
|
805
793
|
}, (table) => [
|
|
806
|
-
|
|
807
|
-
|
|
794
|
+
index23("tasks_created_by_idx").on(table.createdBy),
|
|
795
|
+
index23("tasks_status_idx").on(table.status)
|
|
808
796
|
]);
|
|
809
797
|
|
|
810
798
|
// ../../packages/db/dist/schema/tables/skill-submissions.js
|
|
811
|
-
import { pgTable as
|
|
812
|
-
var skillSubmissions =
|
|
813
|
-
id:
|
|
814
|
-
skillId:
|
|
815
|
-
name:
|
|
816
|
-
description:
|
|
817
|
-
category:
|
|
818
|
-
tools:
|
|
819
|
-
tags:
|
|
820
|
-
content:
|
|
821
|
-
status:
|
|
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", {
|
|
801
|
+
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(),
|
|
809
|
+
status: text27("status").notNull().default("pending"),
|
|
822
810
|
// pending | approved | rejected
|
|
823
|
-
submittedBy:
|
|
824
|
-
reviewedBy:
|
|
825
|
-
reviewNote:
|
|
811
|
+
submittedBy: uuid26("submitted_by").notNull(),
|
|
812
|
+
reviewedBy: uuid26("reviewed_by"),
|
|
813
|
+
reviewNote: text27("review_note"),
|
|
826
814
|
metadata: jsonb22("metadata"),
|
|
827
|
-
createdAt:
|
|
828
|
-
updatedAt:
|
|
815
|
+
createdAt: timestamp27("created_at", { withTimezone: true }).defaultNow(),
|
|
816
|
+
updatedAt: timestamp27("updated_at", { withTimezone: true }).defaultNow()
|
|
829
817
|
});
|
|
830
818
|
|
|
831
819
|
// ../../packages/db/dist/schema/tables/harness-releases.js
|
|
832
|
-
import { pgTable as
|
|
833
|
-
var harnessReleases =
|
|
834
|
-
id:
|
|
835
|
-
harness:
|
|
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
824
|
// "claude_code", "cursor", "copilot"
|
|
837
|
-
version:
|
|
825
|
+
version: text28("version").notNull(),
|
|
838
826
|
// "v2.1.119"
|
|
839
|
-
publishedAt:
|
|
840
|
-
title:
|
|
827
|
+
publishedAt: timestamp28("published_at", { withTimezone: true }).notNull(),
|
|
828
|
+
title: text28("title"),
|
|
841
829
|
// release name
|
|
842
|
-
body:
|
|
830
|
+
body: text28("body"),
|
|
843
831
|
// raw markdown
|
|
844
832
|
categories: jsonb23("categories").default({}),
|
|
845
833
|
// { features: string[], fixes: string[], security: string[] }
|
|
846
|
-
url:
|
|
834
|
+
url: text28("url"),
|
|
847
835
|
// link to release page
|
|
848
|
-
createdAt:
|
|
836
|
+
createdAt: timestamp28("created_at", { withTimezone: true }).defaultNow()
|
|
849
837
|
}, (table) => [
|
|
850
838
|
uniqueIndex10("idx_harness_releases_unique").on(table.harness, table.version),
|
|
851
|
-
|
|
852
|
-
|
|
839
|
+
index24("idx_harness_releases_harness").on(table.harness),
|
|
840
|
+
index24("idx_harness_releases_published").on(table.publishedAt)
|
|
853
841
|
]);
|
|
854
842
|
|
|
855
843
|
// ../../packages/db/dist/schema/tables/notifications.js
|
|
856
|
-
import { pgTable as
|
|
857
|
-
var notifications =
|
|
858
|
-
id:
|
|
859
|
-
userId:
|
|
860
|
-
type:
|
|
861
|
-
title:
|
|
862
|
-
body:
|
|
863
|
-
url:
|
|
864
|
-
sourceTable:
|
|
865
|
-
sourceId:
|
|
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"),
|
|
866
854
|
metadata: jsonb24("metadata").notNull().default({}),
|
|
867
|
-
readAt:
|
|
868
|
-
createdAt:
|
|
855
|
+
readAt: timestamp29("read_at", { withTimezone: true }),
|
|
856
|
+
createdAt: timestamp29("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
869
857
|
}, (table) => [
|
|
870
|
-
|
|
871
|
-
|
|
858
|
+
index25("idx_notifications_user_created").on(table.userId, table.createdAt),
|
|
859
|
+
index25("idx_notifications_user_unread").on(table.userId),
|
|
872
860
|
uniqueIndex11("idx_notifications_source_dedup").on(table.userId, table.sourceTable, table.sourceId)
|
|
873
861
|
]);
|
|
874
862
|
|
|
875
863
|
// ../../packages/db/dist/schema/tables/launch-jobs.js
|
|
876
|
-
import { pgTable as
|
|
877
|
-
var launchJobs =
|
|
878
|
-
id:
|
|
879
|
-
userId:
|
|
880
|
-
tool:
|
|
881
|
-
status:
|
|
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"),
|
|
882
870
|
config: jsonb25("config").notNull().default({}),
|
|
883
871
|
result: jsonb25("result"),
|
|
884
|
-
error:
|
|
872
|
+
error: text30("error"),
|
|
885
873
|
attempts: integer14("attempts").notNull().default(0),
|
|
886
874
|
graphileJobId: bigint4("graphile_job_id", { mode: "number" }),
|
|
887
|
-
taskKind:
|
|
875
|
+
taskKind: text30("task_kind"),
|
|
888
876
|
payload: jsonb25("payload"),
|
|
889
|
-
claimedBy:
|
|
890
|
-
claimedAt:
|
|
891
|
-
leaseExpiresAt:
|
|
892
|
-
createdAt:
|
|
893
|
-
updatedAt:
|
|
894
|
-
completedAt:
|
|
895
|
-
runId:
|
|
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" })
|
|
896
884
|
}, (table) => [
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
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
889
|
]);
|
|
902
890
|
|
|
903
891
|
// ../../packages/db/dist/schema/tables/instruction-suggestions.js
|
|
904
|
-
import { pgTable as
|
|
905
|
-
var instructionSuggestions =
|
|
906
|
-
id:
|
|
907
|
-
userId:
|
|
908
|
-
instructionId:
|
|
909
|
-
projectPath:
|
|
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(),
|
|
910
898
|
// Canonical project identity (migration 00104). Additive + nullable; the
|
|
911
899
|
// unique index below stays on project_path (NOT NULL) so upserts are
|
|
912
900
|
// unchanged. Readers prefer project_id to aggregate across path variants.
|
|
913
|
-
projectId:
|
|
901
|
+
projectId: uuid30("project_id").references(() => projects.id, { onDelete: "set null" }),
|
|
914
902
|
score: real3("score").notNull(),
|
|
915
|
-
reason:
|
|
916
|
-
generatedAt:
|
|
903
|
+
reason: text31("reason").notNull(),
|
|
904
|
+
generatedAt: timestamp31("generated_at", { withTimezone: true }).notNull().defaultNow(),
|
|
917
905
|
isStale: boolean8("is_stale").notNull().default(false),
|
|
918
|
-
dismissedAt:
|
|
919
|
-
acceptedAt:
|
|
920
|
-
promotedToInstructionId:
|
|
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" })
|
|
921
909
|
}, (table) => [
|
|
922
910
|
uniqueIndex12("idx_instruction_suggestions_user_project_instruction").on(table.userId, table.projectPath, table.instructionId),
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
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)
|
|
926
914
|
]);
|
|
927
|
-
var instructionSuggestionEvents =
|
|
928
|
-
id:
|
|
929
|
-
suggestionId:
|
|
930
|
-
userId:
|
|
931
|
-
eventType:
|
|
932
|
-
tool:
|
|
933
|
-
sessionId:
|
|
934
|
-
projectPath:
|
|
935
|
-
createdAt:
|
|
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()
|
|
936
924
|
}, (table) => [
|
|
937
|
-
|
|
938
|
-
|
|
925
|
+
index27("idx_instruction_suggestion_events_suggestion_id").on(table.suggestionId),
|
|
926
|
+
index27("idx_instruction_suggestion_events_user_id").on(table.userId)
|
|
939
927
|
]);
|
|
940
928
|
|
|
941
929
|
// ../../packages/db/dist/schema/tables/model-pricing.js
|
|
942
|
-
import { pgTable as
|
|
943
|
-
var modelPricing =
|
|
944
|
-
provider:
|
|
945
|
-
modelId:
|
|
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
934
|
inputPerM: numeric("input_per_m").notNull(),
|
|
947
935
|
outputPerM: numeric("output_per_m").notNull(),
|
|
948
936
|
cacheReadPerM: numeric("cache_read_per_m").notNull(),
|
|
949
937
|
cacheWrite5mPerM: numeric("cache_write_5m_per_m").notNull(),
|
|
950
938
|
cacheWrite1hPerM: numeric("cache_write_1h_per_m").notNull(),
|
|
951
939
|
contextWindow: integer15("context_window"),
|
|
952
|
-
effectiveFrom:
|
|
953
|
-
effectiveUntil:
|
|
954
|
-
source:
|
|
940
|
+
effectiveFrom: timestamp32("effective_from", { withTimezone: true }).notNull(),
|
|
941
|
+
effectiveUntil: timestamp32("effective_until", { withTimezone: true }),
|
|
942
|
+
source: text32("source").notNull()
|
|
955
943
|
}, (table) => [
|
|
956
|
-
|
|
957
|
-
|
|
944
|
+
primaryKey4({ columns: [table.provider, table.modelId, table.effectiveFrom] }),
|
|
945
|
+
index28("idx_model_pricing_active").on(table.provider, table.modelId, table.effectiveFrom.desc())
|
|
958
946
|
]);
|
|
959
947
|
|
|
960
948
|
// ../../packages/db/dist/schema/tables/limit-observations.js
|
|
961
|
-
import { pgTable as
|
|
962
|
-
var limitObservations =
|
|
963
|
-
id:
|
|
964
|
-
observedAt:
|
|
965
|
-
provider:
|
|
966
|
-
plan:
|
|
967
|
-
limitType:
|
|
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(),
|
|
968
956
|
value: numeric2("value").notNull(),
|
|
969
|
-
unit:
|
|
970
|
-
comparator:
|
|
971
|
-
resetsAt:
|
|
972
|
-
sourceType:
|
|
973
|
-
sourceUrl:
|
|
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"),
|
|
974
962
|
sourceEvidence: jsonb26("source_evidence"),
|
|
975
963
|
confidence: numeric2("confidence").notNull(),
|
|
976
|
-
userId:
|
|
964
|
+
userId: uuid31("user_id")
|
|
977
965
|
}, (table) => [
|
|
978
|
-
|
|
979
|
-
|
|
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())
|
|
980
968
|
]);
|
|
981
969
|
|
|
982
970
|
// ../../packages/db/dist/schema/tables/provider-docs-snapshots.js
|
|
983
|
-
import { pgTable as
|
|
984
|
-
var providerDocsSnapshots =
|
|
985
|
-
id:
|
|
986
|
-
fetchedAt:
|
|
987
|
-
provider:
|
|
988
|
-
docUrl:
|
|
989
|
-
contentHash:
|
|
990
|
-
content:
|
|
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(),
|
|
991
979
|
parseSuccess: boolean9("parse_success").notNull(),
|
|
992
980
|
parseErrors: jsonb27("parse_errors")
|
|
993
981
|
}, (table) => [
|
|
@@ -995,49 +983,46 @@ var providerDocsSnapshots = pgTable35("provider_docs_snapshots", {
|
|
|
995
983
|
]);
|
|
996
984
|
|
|
997
985
|
// ../../packages/db/dist/schema/tables/plan-limits-active.js
|
|
998
|
-
import { pgTable as
|
|
999
|
-
var planLimitsActive =
|
|
1000
|
-
provider:
|
|
1001
|
-
plan:
|
|
1002
|
-
limitType:
|
|
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(),
|
|
1003
991
|
value: numeric3("value").notNull(),
|
|
1004
|
-
unit:
|
|
1005
|
-
effectiveFrom:
|
|
1006
|
-
effectiveUntil:
|
|
992
|
+
unit: text35("unit").notNull(),
|
|
993
|
+
effectiveFrom: timestamp35("effective_from", { withTimezone: true }).notNull(),
|
|
994
|
+
effectiveUntil: timestamp35("effective_until", { withTimezone: true }),
|
|
1007
995
|
confidence: numeric3("confidence").notNull(),
|
|
1008
|
-
sourceObservationIds:
|
|
996
|
+
sourceObservationIds: uuid33("source_observation_ids").array().notNull()
|
|
1009
997
|
}, (table) => [
|
|
1010
|
-
|
|
1011
|
-
|
|
998
|
+
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())
|
|
1012
1000
|
]);
|
|
1013
1001
|
|
|
1014
1002
|
// ../../packages/db/dist/schema/tables/alert-dispatches.js
|
|
1015
|
-
import { pgTable as
|
|
1016
|
-
var alertDispatches =
|
|
1017
|
-
id:
|
|
1018
|
-
userId:
|
|
1019
|
-
alertKey:
|
|
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(),
|
|
1020
1008
|
// 'soft' | 'approaching' | 'imminent' | 'hit'
|
|
1021
|
-
severity:
|
|
1022
|
-
lastDispatchedAt:
|
|
1009
|
+
severity: text36("severity").notNull(),
|
|
1010
|
+
lastDispatchedAt: timestamp36("last_dispatched_at", { withTimezone: true }).notNull().defaultNow(),
|
|
1023
1011
|
// { used_percentage, resets_at, ... } — snapshot of the input that fired this alert.
|
|
1024
1012
|
lastState: jsonb28("last_state").notNull(),
|
|
1025
1013
|
// 'in_app' | 'vscode' | 'banner'
|
|
1026
|
-
channel:
|
|
1014
|
+
channel: text36("channel").notNull()
|
|
1027
1015
|
}, (table) => [
|
|
1028
|
-
|
|
1016
|
+
index31("idx_alert_user_key").on(table.userId, table.alertKey, table.lastDispatchedAt.desc())
|
|
1029
1017
|
]);
|
|
1030
1018
|
|
|
1031
1019
|
// ../../packages/db/dist/client.js
|
|
1032
|
-
import { createClient } from "@supabase/supabase-js";
|
|
1033
1020
|
import { drizzle } from "drizzle-orm/postgres-js";
|
|
1034
1021
|
import postgres from "postgres";
|
|
1035
1022
|
|
|
1036
1023
|
// ../../packages/db/dist/schema/index.js
|
|
1037
1024
|
var schema_exports = {};
|
|
1038
1025
|
__export(schema_exports, {
|
|
1039
|
-
INSTRUCTION_SCOPES: () => INSTRUCTION_SCOPES,
|
|
1040
|
-
ORG_ROLES: () => ORG_ROLES,
|
|
1041
1026
|
agentJobs: () => agentJobs,
|
|
1042
1027
|
agentRuns: () => agentRuns,
|
|
1043
1028
|
agentRunsRelations: () => agentRunsRelations,
|
|
@@ -1097,7 +1082,6 @@ __export(schema_exports, {
|
|
|
1097
1082
|
projectCheckouts: () => projectCheckouts,
|
|
1098
1083
|
projectInstructions: () => projectInstructions,
|
|
1099
1084
|
projectInstructionsRelations: () => projectInstructionsRelations,
|
|
1100
|
-
projectSignals: () => projectSignals,
|
|
1101
1085
|
projects: () => projects,
|
|
1102
1086
|
projectsRelations: () => projectsRelations,
|
|
1103
1087
|
providerDocsSnapshots: () => providerDocsSnapshots,
|
|
@@ -1367,10 +1351,6 @@ var contextSnapshotsRelations = relations(contextSnapshots, ({ one }) => ({
|
|
|
1367
1351
|
})
|
|
1368
1352
|
}));
|
|
1369
1353
|
|
|
1370
|
-
// ../../packages/db/dist/schema/enums.js
|
|
1371
|
-
var INSTRUCTION_SCOPES = ["org", "team", "project", "personal"];
|
|
1372
|
-
var ORG_ROLES = ["owner", "admin", "member"];
|
|
1373
|
-
|
|
1374
1354
|
// ../../packages/db/dist/db-load.js
|
|
1375
1355
|
var _inFlight = 0;
|
|
1376
1356
|
var _peak = 0;
|
|
@@ -1385,8 +1365,6 @@ function trackDbOpEnd() {
|
|
|
1385
1365
|
}
|
|
1386
1366
|
|
|
1387
1367
|
// ../../packages/db/dist/client.js
|
|
1388
|
-
var _supabase;
|
|
1389
|
-
var _supabaseAdmin;
|
|
1390
1368
|
var _db;
|
|
1391
1369
|
var _client;
|
|
1392
1370
|
var _closed = false;
|
|
@@ -1400,18 +1378,6 @@ function getEnv(name) {
|
|
|
1400
1378
|
throw new Error(`Missing required env var: ${name}`);
|
|
1401
1379
|
return value;
|
|
1402
1380
|
}
|
|
1403
|
-
function getSupabase() {
|
|
1404
|
-
if (!_supabase) {
|
|
1405
|
-
_supabase = createClient(getEnv("SUPABASE_URL"), getEnv("SUPABASE_ANON_KEY"));
|
|
1406
|
-
}
|
|
1407
|
-
return _supabase;
|
|
1408
|
-
}
|
|
1409
|
-
function getSupabaseAdmin() {
|
|
1410
|
-
if (!_supabaseAdmin) {
|
|
1411
|
-
_supabaseAdmin = createClient(getEnv("SUPABASE_URL"), getEnv("SUPABASE_SERVICE_ROLE_KEY"));
|
|
1412
|
-
}
|
|
1413
|
-
return _supabaseAdmin;
|
|
1414
|
-
}
|
|
1415
1381
|
function getDb() {
|
|
1416
1382
|
if (_closed) {
|
|
1417
1383
|
throw new Error("getDb() called after closeDb(): the connection pool is closed for shutdown. Stop issuing queries (timers/requests) before draining the pool.");
|
|
@@ -1622,19 +1588,12 @@ var heavyDb = new Proxy({}, {
|
|
|
1622
1588
|
const readSafe = READ_ONLY_ENTRY_METHODS.has(prop);
|
|
1623
1589
|
return (...args) => wrapBuilder(value.apply(real4, args), readSafe);
|
|
1624
1590
|
}
|
|
1591
|
+
if (prop === "transaction" && typeof value === "function") {
|
|
1592
|
+
return (...args) => gaugeTransaction(() => value.apply(real4, args));
|
|
1593
|
+
}
|
|
1625
1594
|
return value;
|
|
1626
1595
|
}
|
|
1627
1596
|
});
|
|
1628
|
-
var supabase = new Proxy({}, {
|
|
1629
|
-
get(_target, prop) {
|
|
1630
|
-
return getSupabase()[prop];
|
|
1631
|
-
}
|
|
1632
|
-
});
|
|
1633
|
-
var supabaseAdmin = new Proxy({}, {
|
|
1634
|
-
get(_target, prop) {
|
|
1635
|
-
return getSupabaseAdmin()[prop];
|
|
1636
|
-
}
|
|
1637
|
-
});
|
|
1638
1597
|
|
|
1639
1598
|
export {
|
|
1640
1599
|
profiles,
|
|
@@ -1647,4 +1606,4 @@ export {
|
|
|
1647
1606
|
getDb,
|
|
1648
1607
|
closeDb
|
|
1649
1608
|
};
|
|
1650
|
-
//# sourceMappingURL=chunk-
|
|
1609
|
+
//# sourceMappingURL=chunk-QNSVCSHG.js.map
|