@@ -21,6 +21,7 @@ import {
2121 type OrchestrationSession ,
2222 type OrchestrationThreadActivity ,
2323 type OrchestrationThreadDiffStat ,
24+ type OrchestrationThreadDoneOverride ,
2425 type OrchestrationThreadShell ,
2526 ModelSelection ,
2627 OrchestrationThreadGoal ,
@@ -231,6 +232,15 @@ function mapLatestTurn(
231232 } ;
232233}
233234
235+ function mapThreadDoneOverride (
236+ row : Schema . Schema . Type < typeof ProjectionThreadDbRowSchema > ,
237+ ) : OrchestrationThreadDoneOverride | null {
238+ if ( row . doneOverride == null || row . doneOverrideAt == null ) {
239+ return null ;
240+ }
241+ return { state : row . doneOverride , at : row . doneOverrideAt } ;
242+ }
243+
234244function mapThreadDiffStat (
235245 row : Schema . Schema . Type < typeof ProjectionThreadDiffStatDbRowSchema > | undefined ,
236246) : OrchestrationThreadDiffStat | null {
@@ -392,6 +402,9 @@ const makeProjectionSnapshotQuery = Effect.gen(function* () {
392402 updated_at AS "updatedAt",
393403 archived_at AS "archivedAt",
394404 pinned_at AS "pinnedAt",
405+ done_override AS "doneOverride",
406+ done_override_at AS "doneOverrideAt",
407+ last_seen_at AS "lastSeenAt",
395408 latest_user_message_at AS "latestUserMessageAt",
396409 pending_approval_count AS "pendingApprovalCount",
397410 pending_user_input_count AS "pendingUserInputCount",
@@ -425,6 +438,9 @@ const makeProjectionSnapshotQuery = Effect.gen(function* () {
425438 updated_at AS "updatedAt",
426439 archived_at AS "archivedAt",
427440 pinned_at AS "pinnedAt",
441+ done_override AS "doneOverride",
442+ done_override_at AS "doneOverrideAt",
443+ last_seen_at AS "lastSeenAt",
428444 latest_user_message_at AS "latestUserMessageAt",
429445 pending_approval_count AS "pendingApprovalCount",
430446 pending_user_input_count AS "pendingUserInputCount",
@@ -460,6 +476,9 @@ const makeProjectionSnapshotQuery = Effect.gen(function* () {
460476 updated_at AS "updatedAt",
461477 archived_at AS "archivedAt",
462478 pinned_at AS "pinnedAt",
479+ done_override AS "doneOverride",
480+ done_override_at AS "doneOverrideAt",
481+ last_seen_at AS "lastSeenAt",
463482 latest_user_message_at AS "latestUserMessageAt",
464483 pending_approval_count AS "pendingApprovalCount",
465484 pending_user_input_count AS "pendingUserInputCount",
@@ -977,6 +996,9 @@ const makeProjectionSnapshotQuery = Effect.gen(function* () {
977996 updated_at AS "updatedAt",
978997 archived_at AS "archivedAt",
979998 pinned_at AS "pinnedAt",
999+ done_override AS "doneOverride",
1000+ done_override_at AS "doneOverrideAt",
1001+ last_seen_at AS "lastSeenAt",
9801002 latest_user_message_at AS "latestUserMessageAt",
9811003 pending_approval_count AS "pendingApprovalCount",
9821004 pending_user_input_count AS "pendingUserInputCount",
@@ -1423,6 +1445,8 @@ const makeProjectionSnapshotQuery = Effect.gen(function* () {
14231445 updatedAt : row . updatedAt ,
14241446 archivedAt : row . archivedAt ,
14251447 pinnedAt : row . pinnedAt ,
1448+ doneOverride : mapThreadDoneOverride ( row ) ,
1449+ lastSeenAt : row . lastSeenAt ?? null ,
14261450 deletedAt : row . deletedAt ,
14271451 messages : messagesByThread . get ( row . threadId ) ?? [ ] ,
14281452 proposedPlans : proposedPlansByThread . get ( row . threadId ) ?? [ ] ,
@@ -1660,6 +1684,8 @@ const makeProjectionSnapshotQuery = Effect.gen(function* () {
16601684 updatedAt : row . updatedAt ,
16611685 archivedAt : row . archivedAt ,
16621686 pinnedAt : row . pinnedAt ,
1687+ doneOverride : mapThreadDoneOverride ( row ) ,
1688+ lastSeenAt : row . lastSeenAt ?? null ,
16631689 deletedAt : row . deletedAt ,
16641690 messages : messagesByThread . get ( row . threadId ) ?? [ ] ,
16651691 proposedPlans : proposedPlansByThread . get ( row . threadId ) ?? [ ] ,
@@ -1806,6 +1832,8 @@ const makeProjectionSnapshotQuery = Effect.gen(function* () {
18061832 updatedAt : row . updatedAt ,
18071833 archivedAt : row . archivedAt ,
18081834 pinnedAt : row . pinnedAt ,
1835+ doneOverride : mapThreadDoneOverride ( row ) ,
1836+ lastSeenAt : row . lastSeenAt ?? null ,
18091837 session : sessionByThread . get ( row . threadId ) ?? null ,
18101838 latestUserMessageAt : row . latestUserMessageAt ,
18111839 hasPendingApprovals : row . pendingApprovalCount > 0 ,
@@ -1955,6 +1983,8 @@ const makeProjectionSnapshotQuery = Effect.gen(function* () {
19551983 updatedAt : row . updatedAt ,
19561984 archivedAt : row . archivedAt ,
19571985 pinnedAt : row . pinnedAt ,
1986+ doneOverride : mapThreadDoneOverride ( row ) ,
1987+ lastSeenAt : row . lastSeenAt ?? null ,
19581988 session : sessionByThread . get ( row . threadId ) ?? null ,
19591989 latestUserMessageAt : row . latestUserMessageAt ,
19601990 hasPendingApprovals : row . pendingApprovalCount > 0 ,
@@ -2221,6 +2251,8 @@ const makeProjectionSnapshotQuery = Effect.gen(function* () {
22212251 updatedAt : threadRow . value . updatedAt ,
22222252 archivedAt : threadRow . value . archivedAt ,
22232253 pinnedAt : threadRow . value . pinnedAt ,
2254+ doneOverride : mapThreadDoneOverride ( threadRow . value ) ,
2255+ lastSeenAt : threadRow . value . lastSeenAt ?? null ,
22242256 session : Option . isSome ( sessionRow ) ? mapSessionRow ( sessionRow . value ) : null ,
22252257 latestUserMessageAt : threadRow . value . latestUserMessageAt ,
22262258 hasPendingApprovals : threadRow . value . pendingApprovalCount > 0 ,
@@ -2321,6 +2353,8 @@ const makeProjectionSnapshotQuery = Effect.gen(function* () {
23212353 updatedAt : threadRow . value . updatedAt ,
23222354 archivedAt : threadRow . value . archivedAt ,
23232355 pinnedAt : threadRow . value . pinnedAt ,
2356+ doneOverride : mapThreadDoneOverride ( threadRow . value ) ,
2357+ lastSeenAt : threadRow . value . lastSeenAt ?? null ,
23242358 deletedAt : null ,
23252359 messages : messageRows . map ( mapThreadMessageRow ) ,
23262360 proposedPlans : proposedPlanRows . map ( mapProposedPlanRow ) ,
0 commit comments