(header: SessionHeader)
| 1084 | } |
| 1085 | |
| 1086 | function isValidConversationCopyLineage(header: SessionHeader): boolean { |
| 1087 | const copy = header.conversationCopy; |
| 1088 | if (copy === undefined) return true; |
| 1089 | if ( |
| 1090 | !isSessionConversationCopy(copy) || |
| 1091 | !isSafeSessionId(copy.sourceSessionId) || |
| 1092 | copy.sourceSessionId === header.id || |
| 1093 | header.subagentParent !== undefined |
| 1094 | ) { |
| 1095 | return false; |
| 1096 | } |
| 1097 | if (copy.kind === 'branch') { |
| 1098 | return ( |
| 1099 | header.parentSessionId === copy.sourceSessionId && |
| 1100 | header.branchOfTurnId === copy.sourceTurnId && |
| 1101 | header.revisionRootSessionId === undefined && |
| 1102 | header.revisionParentSessionId === undefined && |
| 1103 | header.revisionOfTurnId === undefined && |
| 1104 | header.revisionIndex === undefined && |
| 1105 | header.revisionState === undefined |
| 1106 | ); |
| 1107 | } |
| 1108 | return ( |
| 1109 | header.revisionParentSessionId === copy.sourceSessionId && |
| 1110 | header.revisionOfTurnId === copy.sourceTurnId |
| 1111 | ); |
| 1112 | } |
| 1113 | |
| 1114 | function isValidSubagentSessionLineage(header: SessionHeader): boolean { |
| 1115 | if (header.subagentParent === undefined) { |
no test coverage detected