@cat-factory/node-server 0.114.0 → 0.115.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sandbox.d.ts","sourceRoot":"","sources":["../../../src/db/schema/sandbox.ts"],"names":[],"mappings":"AAyBA,eAAO,MAAM,aAAa,mDAAsB,CAAA;AAEhD,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsBjC,CAAA;AAED,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAc3B,CAAA;AAED,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgB9B,CAAA;AAED,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4BvB,CAAA;AAED,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgBzB,CAAA"}
@@ -0,0 +1,98 @@
1
+ import { bigint, doublePrecision, index, integer, pgSchema, primaryKey, text, } from 'drizzle-orm/pg-core';
2
+ // The SANDBOX surface's Drizzle tables, split out of `db/schema.ts` along the isolation boundary
3
+ // the architecture already draws: `@cat-factory/sandbox` is "deliberately isolated from the core
4
+ // product so it can be extracted" (CLAUDE.md), and its tables live in their own Postgres schema
5
+ // (the analogue of the Worker's separate `SANDBOX_DB` D1 database) rather than beside the core
6
+ // ones. Keeping them in a sibling module — re-exported from `db/schema.ts`, so every importer and
7
+ // drizzle-kit see exactly the same surface — makes that separation visible in the file layout too,
8
+ // and keeps the core schema module under its size budget.
9
+ // Sandbox (parallel prompt/model testing surface). Lives in a DEDICATED Postgres
10
+ // `sandbox` schema (the analogue of the Worker's separate `SANDBOX_DB` D1 database), so
11
+ // the tables are unprefixed (`sandbox.prompt_versions`, …) — the schema is the namespace.
12
+ // Same connection/migrator as the main schema; the boot migrator creates the schema.
13
+ // Shipped baselines are NOT stored (read live from `@cat-factory/agents`); only candidate
14
+ // prompt versions are. JSON-shaped fields are text JSON. See backend/CLAUDE.md
15
+ // "Keep the runtimes symmetric".
16
+ export const sandboxSchema = pgSchema('sandbox');
17
+ export const sandboxPromptVersions = sandboxSchema.table('prompt_versions', {
18
+ workspace_id: text('workspace_id').notNull(),
19
+ id: text('id').notNull(),
20
+ lineage_id: text('lineage_id').notNull(),
21
+ agent_kind: text('agent_kind').notNull(),
22
+ name: text('name').notNull(),
23
+ origin: text('origin').notNull(),
24
+ system_text: text('system_text').notNull(),
25
+ base_prompt_id: text('base_prompt_id'),
26
+ version: integer('version').notNull(),
27
+ parent_id: text('parent_id'),
28
+ labels: text('labels').notNull().default('[]'),
29
+ created_at: bigint('created_at', { mode: 'number' }).notNull(),
30
+ created_by: text('created_by'),
31
+ archived_at: bigint('archived_at', { mode: 'number' }),
32
+ }, (t) => [
33
+ primaryKey({ columns: [t.workspace_id, t.id] }),
34
+ index('idx_sandbox_prompts_kind').on(t.workspace_id, t.agent_kind),
35
+ ]);
36
+ export const sandboxFixtures = sandboxSchema.table('fixtures', {
37
+ workspace_id: text('workspace_id').notNull(),
38
+ id: text('id').notNull(),
39
+ kind: text('kind').notNull(),
40
+ name: text('name').notNull(),
41
+ payload: text('payload'),
42
+ repo_ref: text('repo_ref'),
43
+ objective: text('objective'),
44
+ origin: text('origin').notNull(),
45
+ created_at: bigint('created_at', { mode: 'number' }).notNull(),
46
+ }, (t) => [primaryKey({ columns: [t.workspace_id, t.id] })]);
47
+ export const sandboxExperiments = sandboxSchema.table('experiments', {
48
+ workspace_id: text('workspace_id').notNull(),
49
+ id: text('id').notNull(),
50
+ name: text('name').notNull(),
51
+ agent_kind: text('agent_kind').notNull(),
52
+ judge_model: text('judge_model').notNull(),
53
+ repeats: integer('repeats').notNull(),
54
+ status: text('status').notNull(),
55
+ matrix: text('matrix').notNull(),
56
+ budget_tokens: bigint('budget_tokens', { mode: 'number' }),
57
+ created_at: bigint('created_at', { mode: 'number' }).notNull(),
58
+ created_by: text('created_by'),
59
+ }, (t) => [primaryKey({ columns: [t.workspace_id, t.id] })]);
60
+ export const sandboxRuns = sandboxSchema.table('runs', {
61
+ workspace_id: text('workspace_id').notNull(),
62
+ id: text('id').notNull(),
63
+ experiment_id: text('experiment_id').notNull(),
64
+ prompt_version_id: text('prompt_version_id').notNull(),
65
+ model: text('model').notNull(),
66
+ fixture_id: text('fixture_id').notNull(),
67
+ repeat_index: integer('repeat_index').notNull(),
68
+ status: text('status').notNull(),
69
+ output_text: text('output_text'),
70
+ usage: text('usage'),
71
+ latency_ms: integer('latency_ms'),
72
+ branch: text('branch'),
73
+ pr_url: text('pr_url'),
74
+ diff: text('diff'),
75
+ error: text('error'),
76
+ seed_sha: text('seed_sha'),
77
+ prompt_label: text('prompt_label').notNull(),
78
+ started_at: bigint('started_at', { mode: 'number' }),
79
+ finished_at: bigint('finished_at', { mode: 'number' }),
80
+ }, (t) => [
81
+ primaryKey({ columns: [t.workspace_id, t.id] }),
82
+ index('idx_sandbox_runs_experiment').on(t.workspace_id, t.experiment_id),
83
+ index('idx_sandbox_runs_queued').on(t.workspace_id, t.experiment_id, t.status),
84
+ ]);
85
+ export const sandboxGrades = sandboxSchema.table('grades', {
86
+ workspace_id: text('workspace_id').notNull(),
87
+ id: text('id').notNull(),
88
+ run_id: text('run_id').notNull(),
89
+ judge_model: text('judge_model').notNull(),
90
+ scores: text('scores').notNull().default('[]'),
91
+ weighted_total: doublePrecision('weighted_total').notNull(),
92
+ objective: text('objective'),
93
+ created_at: bigint('created_at', { mode: 'number' }).notNull(),
94
+ }, (t) => [
95
+ primaryKey({ columns: [t.workspace_id, t.id] }),
96
+ index('idx_sandbox_grades_run').on(t.workspace_id, t.run_id),
97
+ ]);
98
+ //# sourceMappingURL=sandbox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sandbox.js","sourceRoot":"","sources":["../../../src/db/schema/sandbox.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,eAAe,EACf,KAAK,EACL,OAAO,EACP,QAAQ,EACR,UAAU,EACV,IAAI,GACL,MAAM,qBAAqB,CAAA;AAE5B,iGAAiG;AACjG,iGAAiG;AACjG,gGAAgG;AAChG,+FAA+F;AAC/F,kGAAkG;AAClG,mGAAmG;AACnG,0DAA0D;AAE1D,iFAAiF;AACjF,wFAAwF;AACxF,0FAA0F;AAC1F,qFAAqF;AACrF,0FAA0F;AAC1F,+EA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