@cat-factory/node-server 0.114.0 → 0.116.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.
Files changed (47) hide show
  1. package/dist/config.d.ts.map +1 -1
  2. package/dist/config.js +14 -0
  3. package/dist/config.js.map +1 -1
  4. package/dist/container-core-deps.d.ts +1 -0
  5. package/dist/container-core-deps.d.ts.map +1 -1
  6. package/dist/container-core-deps.js +2 -1
  7. package/dist/container-core-deps.js.map +1 -1
  8. package/dist/container-realtime-deps.d.ts +6 -1
  9. package/dist/container-realtime-deps.d.ts.map +1 -1
  10. package/dist/container-realtime-deps.js +48 -3
  11. package/dist/container-realtime-deps.js.map +1 -1
  12. package/dist/container-run-services-deps.d.ts +9 -1
  13. package/dist/container-run-services-deps.d.ts.map +1 -1
  14. package/dist/container-run-services-deps.js +14 -1
  15. package/dist/container-run-services-deps.js.map +1 -1
  16. package/dist/container.d.ts.map +1 -1
  17. package/dist/container.js +33 -17
  18. package/dist/container.js.map +1 -1
  19. package/dist/db/schema/sandbox.d.ts +952 -0
  20. package/dist/db/schema/sandbox.d.ts.map +1 -0
  21. package/dist/db/schema/sandbox.js +98 -0
  22. package/dist/db/schema/sandbox.js.map +1 -0
  23. package/dist/db/schema-integrations.d.ts +568 -0
  24. package/dist/db/schema-integrations.d.ts.map +1 -0
  25. package/dist/db/schema-integrations.js +83 -0
  26. package/dist/db/schema-integrations.js.map +1 -0
  27. package/dist/db/schema.d.ts +99 -1421
  28. package/dist/db/schema.d.ts.map +1 -1
  29. package/dist/db/schema.js +23 -148
  30. package/dist/db/schema.js.map +1 -1
  31. package/dist/repositories/drizzle/connections.d.ts +15 -1
  32. package/dist/repositories/drizzle/connections.d.ts.map +1 -1
  33. package/dist/repositories/drizzle/connections.js +87 -1
  34. package/dist/repositories/drizzle/connections.js.map +1 -1
  35. package/dist/repositories/drizzle/settings.d.ts +13 -1
  36. package/dist/repositories/drizzle/settings.d.ts.map +1 -1
  37. package/dist/repositories/drizzle/settings.js +47 -1
  38. package/dist/repositories/drizzle/settings.js.map +1 -1
  39. package/dist/repositories/drizzle.d.ts +3 -1
  40. package/dist/repositories/drizzle.d.ts.map +1 -1
  41. package/dist/repositories/drizzle.js +3 -1
  42. package/dist/repositories/drizzle.js.map +1 -1
  43. package/drizzle/20260726224909_rich_rafael_vega/migration.sql +8 -0
  44. package/drizzle/20260726224909_rich_rafael_vega/snapshot.json +16641 -0
  45. package/drizzle/20260726225204_validation_configs/migration.sql +9 -0
  46. package/drizzle/20260726225204_validation_configs/snapshot.json +16642 -0
  47. package/package.json +20 -20
@@ -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,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