The best way to control Claude Code, Codex and more from any computer or phone

main
ts 23 lines 916 Bytes
Raw
1 import * as Effect from "effect/Effect";
2 import * as SqlClient from "effect/sql/SqlClient";
3
4 export default Effect.gen(function* () {
5 const sql = yield* SqlClient.SqlClient;
6
7 yield* sql`
8 CREATE INDEX orchestration_v2_projection_turn_items_thread_run_idx
9 ON orchestration_v2_projection_turn_items(thread_id, run_id)
10 `;
11 // Keep this predicate aligned with ProjectionStore's pending-item query.
12 yield* sql`
13 CREATE INDEX orchestration_v2_projection_turn_items_shell_pending_idx
14 ON orchestration_v2_projection_turn_items(thread_id, run_id)
15 WHERE type IN ('command_execution', 'dynamic_tool', 'subagent')
16 AND status NOT IN ('completed', 'interrupted', 'failed', 'cancelled')
17 `;
18 yield* sql`
19 CREATE INDEX orchestration_v2_projection_messages_latest_user_idx
20 ON orchestration_v2_projection_messages(thread_id, updated_at DESC, message_id DESC)
21 WHERE role = 'user'
22 `;
23 });