@devries-cameron20 / t3code Mirror · read-only
Fork 0

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

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 04:45 UTC

main
ts 22 lines 1.04 KB
Raw
1 import * as Effect from "effect/Effect";
2 import * as SqlClient from "effect/sql/SqlClient";
3
4 import { DELEGATED_TASK_MESSAGE_CONDITION } from "../../orchestration-v2/delegatedTaskMessage.ts";
5
6 export default Effect.gen(function* () {
7 const sql = yield* SqlClient.SqlClient;
8
9 // Finalizing a delegated task finds its tasks' runs and the child's wakes without reading the
10 // child's history. ProjectionStore.getDelegatedChildControls and the delegatedTaskMessagesOnly read
11 // must spell the same expressions.
12 yield* sql`
13 CREATE INDEX IF NOT EXISTS orchestration_v2_projection_runs_delegated_task_idx
14 ON orchestration_v2_projection_runs(thread_id, json_extract(payload_json, '$.delegatedTaskId'))
15 WHERE json_valid(payload_json) AND json_extract(payload_json, '$.delegatedTaskId') IS NOT NULL
16 `;
17 yield* sql.unsafe(`
18 CREATE INDEX IF NOT EXISTS orchestration_v2_projection_messages_delegated_task_idx
19 ON orchestration_v2_projection_messages(thread_id, created_at, message_id)
20 WHERE ${DELEGATED_TASK_MESSAGE_CONDITION}
21 `);
22 });