@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 26 lines 1.03 KB
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 // Include the parent ID so transfer checks do not reread each child payload.
8 yield* sql`
9 CREATE INDEX orchestration_v2_projection_threads_subagent_result_idx
10 ON orchestration_v2_projection_threads(
11 thread_id, json_extract(payload_json, '$.lineage.parentThreadId')
12 )
13 WHERE CASE WHEN json_valid(payload_json) THEN
14 json_extract(payload_json, '$.lineage.relationshipToParent') = 'subagent'
15 AND json_extract(payload_json, '$.lineage.parentThreadId') IS NOT NULL
16 AND json_extract(payload_json, '$.forkedFrom.type') = 'node'
17 ELSE 0 END
18 `;
19 yield* sql`
20 CREATE INDEX orchestration_v2_projection_runs_delegated_delivery_idx
21 ON orchestration_v2_projection_runs(thread_id)
22 WHERE CASE WHEN json_valid(payload_json)
23 THEN json_type(payload_json, '$.delegatedCompletion.delivery') = 'object'
24 ELSE 0 END
25 `;
26 });