relavium 0.1.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,190 @@
1
+ CREATE TABLE `agents` (
2
+ `id` text PRIMARY KEY NOT NULL,
3
+ `name` text NOT NULL,
4
+ `slug` text NOT NULL,
5
+ `description` text,
6
+ `model_id` text NOT NULL,
7
+ `system_prompt` text DEFAULT '' NOT NULL,
8
+ `tools` text DEFAULT '[]' NOT NULL,
9
+ `config` text DEFAULT '{}' NOT NULL,
10
+ `input_schema` text,
11
+ `output_schema` text,
12
+ `tags` text DEFAULT '[]' NOT NULL,
13
+ `source_path` text,
14
+ `is_active` integer DEFAULT 1 NOT NULL,
15
+ `deleted_at` integer,
16
+ `created_at` integer NOT NULL,
17
+ `updated_at` integer NOT NULL,
18
+ FOREIGN KEY (`model_id`) REFERENCES `model_catalog`(`id`) ON UPDATE no action ON DELETE no action
19
+ );
20
+ --> statement-breakpoint
21
+ CREATE UNIQUE INDEX `idx_agents_slug` ON `agents` (`slug`) WHERE "agents"."deleted_at" is null;--> statement-breakpoint
22
+ CREATE INDEX `idx_agents_model` ON `agents` (`model_id`);--> statement-breakpoint
23
+ CREATE INDEX `idx_agents_active` ON `agents` (`is_active`,"created_at" desc) WHERE "agents"."deleted_at" is null;--> statement-breakpoint
24
+ CREATE TABLE `llm_providers` (
25
+ `id` text PRIMARY KEY NOT NULL,
26
+ `name` text NOT NULL,
27
+ `display_name` text NOT NULL,
28
+ `base_url` text NOT NULL,
29
+ `api_key_keychain_ref` text,
30
+ `default_headers` text DEFAULT '{}' NOT NULL,
31
+ `is_active` integer DEFAULT 1 NOT NULL,
32
+ `deleted_at` integer,
33
+ `created_at` integer NOT NULL,
34
+ `updated_at` integer NOT NULL
35
+ );
36
+ --> statement-breakpoint
37
+ CREATE UNIQUE INDEX `idx_llm_providers_name` ON `llm_providers` (`name`) WHERE "llm_providers"."deleted_at" is null;--> statement-breakpoint
38
+ CREATE TABLE `messages` (
39
+ `id` text PRIMARY KEY NOT NULL,
40
+ `step_execution_id` text NOT NULL,
41
+ `run_id` text NOT NULL,
42
+ `sequence_number` integer NOT NULL,
43
+ `role` text NOT NULL,
44
+ `content` text,
45
+ `content_parts` text,
46
+ `tool_calls` text,
47
+ `tool_call_id` text,
48
+ `name` text,
49
+ `finish_reason` text,
50
+ `created_at` integer NOT NULL,
51
+ FOREIGN KEY (`step_execution_id`) REFERENCES `step_executions`(`id`) ON UPDATE no action ON DELETE cascade
52
+ );
53
+ --> statement-breakpoint
54
+ CREATE INDEX `idx_messages_step` ON `messages` (`step_execution_id`,`sequence_number`);--> statement-breakpoint
55
+ CREATE INDEX `idx_messages_run` ON `messages` (`run_id`,`created_at`);--> statement-breakpoint
56
+ CREATE TABLE `model_catalog` (
57
+ `id` text PRIMARY KEY NOT NULL,
58
+ `provider_id` text NOT NULL,
59
+ `model_id` text NOT NULL,
60
+ `display_name` text NOT NULL,
61
+ `context_window_tokens` integer NOT NULL,
62
+ `max_output_tokens` integer NOT NULL,
63
+ `input_cost_per_mtok_microcents` integer DEFAULT 0 NOT NULL,
64
+ `output_cost_per_mtok_microcents` integer DEFAULT 0 NOT NULL,
65
+ `cached_input_cost_per_mtok_microcents` integer DEFAULT 0 NOT NULL,
66
+ `supports_tool_calling` integer DEFAULT 0 NOT NULL,
67
+ `supports_vision` integer DEFAULT 0 NOT NULL,
68
+ `supports_streaming` integer DEFAULT 1 NOT NULL,
69
+ `supports_json_mode` integer DEFAULT 0 NOT NULL,
70
+ `capabilities` text DEFAULT '{}' NOT NULL,
71
+ `deprecation_date` integer,
72
+ `is_active` integer DEFAULT 1 NOT NULL,
73
+ `deleted_at` integer,
74
+ `created_at` integer NOT NULL,
75
+ `updated_at` integer NOT NULL,
76
+ FOREIGN KEY (`provider_id`) REFERENCES `llm_providers`(`id`) ON UPDATE no action ON DELETE no action
77
+ );
78
+ --> statement-breakpoint
79
+ CREATE UNIQUE INDEX `idx_model_catalog_provider_model` ON `model_catalog` (`provider_id`,`model_id`) WHERE "model_catalog"."deleted_at" is null;--> statement-breakpoint
80
+ CREATE INDEX `idx_model_catalog_provider` ON `model_catalog` (`provider_id`);--> statement-breakpoint
81
+ CREATE INDEX `idx_model_catalog_active` ON `model_catalog` (`is_active`) WHERE "model_catalog"."deleted_at" is null;--> statement-breakpoint
82
+ CREATE TABLE `run_costs` (
83
+ `id` text PRIMARY KEY NOT NULL,
84
+ `run_id` text NOT NULL,
85
+ `node_id` text NOT NULL,
86
+ `model_id` text,
87
+ `input_tokens` integer DEFAULT 0 NOT NULL,
88
+ `output_tokens` integer DEFAULT 0 NOT NULL,
89
+ `cost_microcents` integer DEFAULT 0 NOT NULL,
90
+ `created_at` integer NOT NULL,
91
+ FOREIGN KEY (`run_id`) REFERENCES `runs`(`id`) ON UPDATE no action ON DELETE cascade,
92
+ FOREIGN KEY (`model_id`) REFERENCES `model_catalog`(`id`) ON UPDATE no action ON DELETE no action
93
+ );
94
+ --> statement-breakpoint
95
+ CREATE INDEX `idx_run_costs_run` ON `run_costs` (`run_id`);--> statement-breakpoint
96
+ CREATE TABLE `run_events` (
97
+ `id` text PRIMARY KEY NOT NULL,
98
+ `run_id` text NOT NULL,
99
+ `step_execution_id` text,
100
+ `seq` integer NOT NULL,
101
+ `event_type` text NOT NULL,
102
+ `level` text DEFAULT 'info' NOT NULL,
103
+ `node_id` text,
104
+ `payload_json` text DEFAULT '{}' NOT NULL,
105
+ `ts` integer NOT NULL,
106
+ FOREIGN KEY (`run_id`) REFERENCES `runs`(`id`) ON UPDATE no action ON DELETE cascade
107
+ );
108
+ --> statement-breakpoint
109
+ CREATE UNIQUE INDEX `idx_run_events_run_seq` ON `run_events` (`run_id`,`seq`);--> statement-breakpoint
110
+ CREATE INDEX `idx_run_events_step` ON `run_events` (`step_execution_id`,`ts`) WHERE "run_events"."step_execution_id" is not null;--> statement-breakpoint
111
+ CREATE INDEX `idx_run_events_run_type` ON `run_events` (`run_id`,`event_type`,`ts`);--> statement-breakpoint
112
+ CREATE TABLE `runs` (
113
+ `id` text PRIMARY KEY NOT NULL,
114
+ `workflow_id` text NOT NULL,
115
+ `workflow_path` text,
116
+ `project_root` text,
117
+ `workflow_definition_snapshot` text NOT NULL,
118
+ `status` text DEFAULT 'pending' NOT NULL,
119
+ `execution_mode` text DEFAULT 'local' NOT NULL,
120
+ `trigger_type` text DEFAULT 'manual' NOT NULL,
121
+ `trigger_metadata` text DEFAULT '{}' NOT NULL,
122
+ `input_json` text DEFAULT '{}' NOT NULL,
123
+ `output_json` text,
124
+ `error_json` text,
125
+ `started_at` integer,
126
+ `completed_at` integer,
127
+ `total_input_tokens` integer DEFAULT 0 NOT NULL,
128
+ `total_output_tokens` integer DEFAULT 0 NOT NULL,
129
+ `total_cost_microcents` integer DEFAULT 0 NOT NULL,
130
+ `deleted_at` integer,
131
+ `created_at` integer NOT NULL,
132
+ `updated_at` integer NOT NULL,
133
+ FOREIGN KEY (`workflow_id`) REFERENCES `workflows`(`id`) ON UPDATE no action ON DELETE no action,
134
+ CONSTRAINT "runs_status_check" CHECK("runs"."status" in ('pending', 'running', 'paused', 'completed', 'failed', 'cancelled')),
135
+ CONSTRAINT "runs_execution_mode_check" CHECK("runs"."execution_mode" in ('local', 'cloud', 'managed'))
136
+ );
137
+ --> statement-breakpoint
138
+ CREATE INDEX `idx_runs_workflow` ON `runs` (`workflow_id`,"created_at" desc);--> statement-breakpoint
139
+ CREATE INDEX `idx_runs_status` ON `runs` (`status`,"created_at" desc) WHERE "runs"."deleted_at" is null;--> statement-breakpoint
140
+ CREATE INDEX `idx_runs_cost` ON `runs` (`workflow_id`,`created_at`,`total_cost_microcents`) WHERE "runs"."deleted_at" is null;--> statement-breakpoint
141
+ CREATE TABLE `step_executions` (
142
+ `id` text PRIMARY KEY NOT NULL,
143
+ `run_id` text NOT NULL,
144
+ `node_id` text NOT NULL,
145
+ `node_type` text NOT NULL,
146
+ `agent_id` text,
147
+ `agent_snapshot` text,
148
+ `model_id` text,
149
+ `attempt_number` integer DEFAULT 1 NOT NULL,
150
+ `status` text DEFAULT 'pending' NOT NULL,
151
+ `input_json` text DEFAULT '{}' NOT NULL,
152
+ `output_json` text,
153
+ `error_json` text,
154
+ `started_at` integer,
155
+ `completed_at` integer,
156
+ `duration_ms` integer,
157
+ `input_tokens` integer DEFAULT 0 NOT NULL,
158
+ `output_tokens` integer DEFAULT 0 NOT NULL,
159
+ `cached_tokens` integer DEFAULT 0 NOT NULL,
160
+ `cost_microcents` integer DEFAULT 0 NOT NULL,
161
+ `created_at` integer NOT NULL,
162
+ `updated_at` integer NOT NULL,
163
+ FOREIGN KEY (`run_id`) REFERENCES `runs`(`id`) ON UPDATE no action ON DELETE cascade,
164
+ FOREIGN KEY (`agent_id`) REFERENCES `agents`(`id`) ON UPDATE no action ON DELETE no action,
165
+ FOREIGN KEY (`model_id`) REFERENCES `model_catalog`(`id`) ON UPDATE no action ON DELETE no action,
166
+ CONSTRAINT "step_executions_status_check" CHECK("step_executions"."status" in ('pending', 'running', 'completed', 'failed', 'skipped'))
167
+ );
168
+ --> statement-breakpoint
169
+ CREATE INDEX `idx_step_exec_run` ON `step_executions` (`run_id`,`created_at`);--> statement-breakpoint
170
+ CREATE INDEX `idx_step_exec_run_node` ON `step_executions` (`run_id`,`node_id`,`attempt_number`);--> statement-breakpoint
171
+ CREATE INDEX `idx_step_exec_agent` ON `step_executions` (`agent_id`,"created_at" desc) WHERE "step_executions"."agent_id" is not null;--> statement-breakpoint
172
+ CREATE INDEX `idx_step_exec_model` ON `step_executions` (`model_id`,"created_at" desc) WHERE "step_executions"."model_id" is not null;--> statement-breakpoint
173
+ CREATE INDEX `idx_step_exec_cost` ON `step_executions` (`model_id`,`created_at`,`cost_microcents`) WHERE "step_executions"."model_id" is not null;--> statement-breakpoint
174
+ CREATE TABLE `workflows` (
175
+ `id` text PRIMARY KEY NOT NULL,
176
+ `name` text NOT NULL,
177
+ `slug` text NOT NULL,
178
+ `description` text,
179
+ `definition` text NOT NULL,
180
+ `input_schema` text,
181
+ `tags` text DEFAULT '[]' NOT NULL,
182
+ `source_path` text,
183
+ `is_active` integer DEFAULT 1 NOT NULL,
184
+ `deleted_at` integer,
185
+ `created_at` integer NOT NULL,
186
+ `updated_at` integer NOT NULL
187
+ );
188
+ --> statement-breakpoint
189
+ CREATE UNIQUE INDEX `idx_workflows_slug` ON `workflows` (`slug`) WHERE "workflows"."deleted_at" is null;--> statement-breakpoint
190
+ CREATE INDEX `idx_workflows_active` ON `workflows` (`is_active`,"updated_at" desc) WHERE "workflows"."deleted_at" is null;
@@ -0,0 +1,49 @@
1
+ CREATE TABLE `agent_sessions` (
2
+ `id` text PRIMARY KEY NOT NULL,
3
+ `agent_id` text,
4
+ `agent_slug` text NOT NULL,
5
+ `agent_snapshot` text,
6
+ `title` text,
7
+ `model_id` text,
8
+ `working_dir` text,
9
+ `git_ref` text,
10
+ `fs_scope_tier` text DEFAULT 'sandboxed' NOT NULL,
11
+ `status` text DEFAULT 'active' NOT NULL,
12
+ `context_json` text DEFAULT '{}' NOT NULL,
13
+ `total_input_tokens` integer DEFAULT 0 NOT NULL,
14
+ `total_output_tokens` integer DEFAULT 0 NOT NULL,
15
+ `total_cost_microcents` integer DEFAULT 0 NOT NULL,
16
+ `exported_workflow_path` text,
17
+ `deleted_at` integer,
18
+ `created_at` integer NOT NULL,
19
+ `updated_at` integer NOT NULL,
20
+ FOREIGN KEY (`agent_id`) REFERENCES `agents`(`id`) ON UPDATE no action ON DELETE no action,
21
+ FOREIGN KEY (`model_id`) REFERENCES `model_catalog`(`id`) ON UPDATE no action ON DELETE no action,
22
+ CONSTRAINT "agent_sessions_fs_scope_tier_check" CHECK("agent_sessions"."fs_scope_tier" in ('sandboxed', 'project', 'full')),
23
+ CONSTRAINT "agent_sessions_status_check" CHECK("agent_sessions"."status" in ('active', 'idle', 'exported', 'ended'))
24
+ );
25
+ --> statement-breakpoint
26
+ CREATE INDEX `idx_agent_sessions_status` ON `agent_sessions` (`status`,"updated_at" desc) WHERE "agent_sessions"."deleted_at" is null;--> statement-breakpoint
27
+ CREATE INDEX `idx_agent_sessions_agent` ON `agent_sessions` (`agent_id`,"created_at" desc) WHERE "agent_sessions"."agent_id" is not null;--> statement-breakpoint
28
+ CREATE TABLE `session_messages` (
29
+ `id` text PRIMARY KEY NOT NULL,
30
+ `session_id` text NOT NULL,
31
+ `sequence_number` integer NOT NULL,
32
+ `role` text NOT NULL,
33
+ `content` text,
34
+ `content_parts` text,
35
+ `tool_calls` text,
36
+ `tool_call_id` text,
37
+ `name` text,
38
+ `finish_reason` text,
39
+ `model_id` text,
40
+ `input_tokens` integer DEFAULT 0 NOT NULL,
41
+ `output_tokens` integer DEFAULT 0 NOT NULL,
42
+ `cost_microcents` integer DEFAULT 0 NOT NULL,
43
+ `created_at` integer NOT NULL,
44
+ FOREIGN KEY (`session_id`) REFERENCES `agent_sessions`(`id`) ON UPDATE no action ON DELETE cascade,
45
+ FOREIGN KEY (`model_id`) REFERENCES `model_catalog`(`id`) ON UPDATE no action ON DELETE no action
46
+ );
47
+ --> statement-breakpoint
48
+ CREATE UNIQUE INDEX `idx_session_messages_seq` ON `session_messages` (`session_id`,`sequence_number`);--> statement-breakpoint
49
+ CREATE INDEX `idx_session_messages_session` ON `session_messages` (`session_id`,`created_at`);
@@ -0,0 +1,28 @@
1
+ CREATE TABLE `media_objects` (
2
+ `id` text PRIMARY KEY NOT NULL,
3
+ `handle` text NOT NULL,
4
+ `mime_type` text NOT NULL,
5
+ `modality` text NOT NULL,
6
+ `byte_length` integer NOT NULL,
7
+ `duration_ms` integer,
8
+ `last_referenced_at` integer NOT NULL,
9
+ `deleted_at` integer,
10
+ `created_at` integer NOT NULL,
11
+ CONSTRAINT "media_objects_modality_check" CHECK("media_objects"."modality" in ('image', 'audio', 'video', 'document'))
12
+ );
13
+ --> statement-breakpoint
14
+ CREATE UNIQUE INDEX `media_objects_handle_unique` ON `media_objects` (`handle`);--> statement-breakpoint
15
+ CREATE INDEX `idx_media_objects_gc` ON `media_objects` (`last_referenced_at`) WHERE "media_objects"."deleted_at" is null;--> statement-breakpoint
16
+ CREATE TABLE `media_references` (
17
+ `id` text PRIMARY KEY NOT NULL,
18
+ `handle` text NOT NULL,
19
+ `scope_kind` text NOT NULL,
20
+ `scope_id` text NOT NULL,
21
+ `created_at` integer NOT NULL,
22
+ FOREIGN KEY (`handle`) REFERENCES `media_objects`(`handle`) ON UPDATE no action ON DELETE cascade,
23
+ CONSTRAINT "media_references_scope_kind_check" CHECK("media_references"."scope_kind" in ('run', 'node', 'session', 'workspace'))
24
+ );
25
+ --> statement-breakpoint
26
+ CREATE UNIQUE INDEX `idx_media_references_unique` ON `media_references` (`handle`,`scope_kind`,`scope_id`);--> statement-breakpoint
27
+ CREATE INDEX `idx_media_references_scope` ON `media_references` (`scope_kind`,`scope_id`);--> statement-breakpoint
28
+ CREATE INDEX `idx_media_references_handle` ON `media_references` (`handle`);
@@ -0,0 +1,3 @@
1
+ ALTER TABLE `model_catalog` ADD `media_image_cost_microcents` integer;--> statement-breakpoint
2
+ ALTER TABLE `model_catalog` ADD `media_audio_cost_microcents` integer;--> statement-breakpoint
3
+ ALTER TABLE `model_catalog` ADD `media_video_cost_microcents` integer;
@@ -0,0 +1 @@
1
+ ALTER TABLE `model_catalog` ADD `media_surface` text DEFAULT 'chat' NOT NULL;